SouthpawStrings’ practice Desk started as a product feature: theory tools and a practice player as draggable, snappable windows a player arranges and keeps. The layout logic underneath — packing, magnetism, undo, fail-safe state round-trips — kept proving itself, so in August 2026 it was extracted into its own library: @denley/desk-engine, pure TypeScript with zero runtime dependencies, published to a self-hosted npm registry and consumed like any other package.

The engine owns what every desk needs and no host should rewrite: a two-pass layout pack with a zero-overlap invariant, magnet snap zones and drag-edge snapping (halves, quarters, full), an always-on-top band, an MRU window switcher, spatial directional focus (“which window is to my left?”), undo stacks, cloth-drag physics, and a JSON round-trip sanitiser that turns any stored garbage back into a working desk.

Hosts supply exactly two things the engine is deliberately generic over: a catalog — the apps that can appear on the desk, with their sizing contract — and a globals codec for whatever host-domain fields ride in the desk document. Everything else, including the shared React window chrome (frame, dock, switcher, gestures), comes from the library, so its consumers cannot drift apart on behaviour.

Why it matters

One engine, three products, no drift

Extraction disciplineProduct code became a libraryThe desk was proven inside one product before a line of it was generalised. The engine keeps the hard-won rules — window ids, z-order, the no-overlap pack — and leaves the skin, catalog, and domain state to each host.
Fail-safe by contractGarbage in, working desk outThe sanitiser is total: any stored document, from any version, parses to a usable desk. Renamed apps carry legacy-id maps so a saved layout never silently loses a window.
Shared chromeThe window frame lives onceFrame, dock, Alt-Tab switcher, drag gestures with optional cloth physics, and directional keyboard focus ship in the React layer — extracted after two hosts hand-rolled them and drifted.
This site is the demoYou are inside itdenley.nz is the engine’s third consumer: every page here is a window. Drag this one by its title bar, throw it at a screen edge, minimise it to the dock, or press Ctrl/Cmd+backtick to switch windows.

The development story

Nine releases in eleven days — each one proven first

The engine moved out of SouthpawStrings on 19 August 2026 and reached 1.9.0 by the end of the month — but nothing was designed in a vacuum. Every feature followed the same rule: prove it inside a real product first, then extract it. The shared window chrome joined after both consumers had hand-rolled their own frames and drifted apart. The viewport-fit hook joined when the SouthpawStrings desk learned to stop scrolling the page. The drag controller, the cloth physics, and the phone card stack each graduated from product code to library code with their hard-won rules intact.

Directional keyboard focus tells the story best: the geometry (“which window is to my left?”) landed in 1.7.0 as a pure, DOM-free rule; the consumer half — focus rings, Ctrl+Shift+Arrow wiring, the traps around DOM focus in hidden tabs — was proven inside the AI Orchestrator’s desk and extracted in 1.8.0 once it worked. 1.9.0 added collapsed windows (rolled up to their title bar, in place) the same day SouthpawStrings shipped the behaviour that needed them. The changelog reads as a running engineering journal — every entry records what broke, why, and what rule came out of it — because documenting the work while doing it is the lifecycle here.