/** * dsh-widgets — the rail’s measurement layer. * * Everything that reads the shell’s layout and turns it into the rail’s geometry: * the `--dsx-rail-top` / `--dsx-input-bottom` anchor probes, the right-bar width * tracking (read per frame while the user drags a width handle), the ResizeObserver * fan-out, and the budget / YIELD beat — which is applied straight to the DOM so it * cannot land a frame late behind React’s commit. * * Moved out of `client/index.ts` (Phase 2.6b) with its body unchanged. The * mechanism state (observers, timers, the last-published fingerprints) lives here; * the two values the composition root itself owns stay there and arrive through * accessors: * - `railBudget` is part of the bridge snapshot, so `emit()` reads it; * - `drawerEl` is written by the rail view’s ref. * `prefs` is a LIVE binding, hence `getPrefs()` at the point of use. */ import { type Prefs } from '../runtime/prefs'; /** What the measurement layer needs from the composition root. */ export interface RailMeasureDeps { /** The LIVE prefs binding — read it at the point of use, never capture it. */ getPrefs: () => Prefs; /** The LIVE rail budget (px); -1 until measured. */ getRailBudget: () => number; /** Publish a new rail budget (the composition root owns the binding). */ setRailBudget: (next: number) => void; /** The drawer wrapper, if the rail is mounted. */ getDrawerEl: () => HTMLDivElement | null; /** Rebuild + publish the bridge snapshot. */ emit: () => void; /** Subscribe to the bridge (the width watcher runs on every emit). */ subscribe: (fn: () => void) => () => void; } /** The measurement layer’s handle on the composition root. */ export interface RailMeasure { /** Start the observers/listeners; returns the disposer `ctx.effect` wants. */ install: () => () => void; /** Recompute the geometry now, with an optional observer width hint. */ scheduleMeasure: (widthHint?: number, horizontalOnly?: boolean) => void; } /** Build the measurement layer bound to one composition root. */ export declare function createRailMeasure(deps: RailMeasureDeps): RailMeasure;