v0.4.0
Minor Changes
-
1289409Thanks @ParthJadhav! - Add a framework-neutral lifecycle controller, a headless React hook, a Vue composable, and a
Svelte action. Publish explicitreact,vue, andsvelteentry points, preserve React's client
boundary for Next.js, reduce the package contents, and add a documentation site and reliable npm
release workflow. The engine now defaults sound off and followsprefers-reduced-motionfor camera
shake and nonessential UI transitions.Add size-focused
engine,tools,tools/heavy, andlazyentry points; configurable procedural
model scaling; exact built-in icon silhouettes that avoid canvas readbacks; explicit pause/resume;
automatic hidden-tab suspension; data-saver quality detection; dynamic-layout observation; and
robust primary-pointer capture/cancellation for touch and pen input.Add six advanced tools—Gravity Gun, Laser Cutter, Acid Sprayer, Wrecking Ball, Sticky Bombs, and
Glitch Gun—with split loading and measured procedural-model bounds. Add material-aware fire,
fracture, laser, acid, and electrical behavior; seven bounded spatial tool combos; opt-in,
pixel-budgeted destruction undo/redo; immutable built-in and custom tool loadouts; and a typed
state-isolated custom-tool SDK. Publishtools/advanced,loadouts, andsdkentry points and
cover them in consumer fixtures, the live demo, package validation, and documentation.Cap the transient effects layer at CSS-pixel resolution by default to avoid DPR-squared
Canvas2D-to-WebGL upload cost, with aneffectsPixelRatiooverride for explicit supersampling.
The balanced adaptive-quality tier now disables the measured post-processing bottleneck immediately
instead of retaining it until a second downgrade. -
1289409Thanks @ParthJadhav! - Add a ready-made toolbar for every stack, keyboard-operable tools, translatable strings, and a
channel for reporting degradation.desktop-destroyer/elementregisters<desktop-destroyer>, a complete toolbar in a shadow root
that works unchanged in Svelte, Angular, Solid, Qwik, Astro and plain HTML./vuenow exports a
DesktopDestroyercomponent alongside the composable. Both, and the React component, render one
sharedToolbarModel, published asdesktop-destroyer/toolbarfor hosts building their own UI.- Keyboard aiming makes the tools reachable without a pointer:
Aplaces a cursor on the page,
arrows steer it,Enteruses the tool, and moves and strikes are announced. The underlying
engine.strike(x, y, { holdMs })andengine.setAim()are public, and a keyboard blow is
undoable like any other. Custom tools need no changes to be reachable this way. - Every user-visible string, including tool names and hints, can be replaced through
strings, so
the toy can be translated or reworded.DEFAULT_STRINGSandresolveStrings()are exported. onError(option,engine.onError(),engine.errorand an"error"event) reports the
failures that were previously only aconsole.warn: capture failure, live-capture fallback,
element-harvest failure, a missing text mask, and page-height truncation. Registering a handler
silences the matching warning so nothing is logged twice.engine.historyEnableddistinguishes "undo is on" from "there is something to undo", so a
toolbar can show its undo controls from the start instead of having them appear mid-session.
Patch Changes
-
1289409Thanks @ParthJadhav! - Bundle thehtml-to-imagecapture code into the package as a lazily-loaded chunk and drop the
runtime dependency. Loadingdistdirectly in a browser (the demo, harnesses, benchmarks, CDN
usage) previously failed to resolve the bare specifier and silently degraded to overlay mode —
no destructible page content, no fracture debris, and content-dependent tools (laser cutter, acid
sprayer, bugs, demolition chunks) did nothing.Fix the broom leaving a trail of phantom torn-edge rings on intact pages:
ContentLayer.restore
now composes its pristine disc on a scratch canvas and stamps it in one draw, instead of a
clip + clear + draw sequence that antialiased the rim twice and left a partial-alpha seam the
surface shader shaded as a wound.Make the Glitch Gun read on light backgrounds: corruption now tears real page slices sideways and
composites its interference bars withdifferenceinstead ofscreen, which was nearly invisible
against white.The demo toolbar now exercises the full public surface: built-in loadout switching, undo/redo,
whole-page repair, snapshot download, sound and pause toggles, combo toasts, and a live
fps/capture status readout. -
1289409Thanks @ParthJadhav! - Test the destruction pipeline for real, and harden the release path.Unit tests now run against a DOM with a real Canvas2D rasterizer, so the coverage map, wound
compositing, physics solver and every built-in tool are asserted on actual pixels rather than
mocks — 274 tests, up from 57, taking line coverage from 44% to 85%. A new runtime suite
(bun run test:browser) drives the built package through headless Chrome and asserts what a
visitor sees: the page is captured, the WebGL2 surface shader comes up, tools punch real holes,
undo restores them, and disposing puts the real page back. Both run in CI, with coverage floors
and a per-module gate.Also fixes
import "desktop-destroyer/element"throwing when evaluated on a server, and stops
bundlers from tree-shaking away the element's registration.