/** The timer queue a debounce is scheduled on. `window` satisfies it, which is how a component * adopted into another document keeps its pending work on *that* document's realm instead of the * ambient one (the same reason `` and `` retain an owner window). */ export interface DebounceTimerHost{setTimeout(handler:()=>void,timeoutMs:number):ReturnType;clearTimeout(handle:ReturnType):void;} /** * A single pending-value debounce timer: `push()` restarts the delay and remembers only the * latest value, `flush()` settles it immediately, and `cancel()`/`dispose()` discard it with no * callback. One instance tracks exactly one in-flight edit -- a caller debouncing several * independent things at once (one per filter id, one per row) keeps its own keyed collection of * instances (a `Map>`), exactly like `lr-filter-bar`'s per-filter-id * collection, so cancelling one key's entry never touches another's and a bulk teardown is just * "dispose every value in the map". * * `pending`/`pendingValue` expose that in-flight edit, because for several callers "a debounce is * armed" *is* the "the user is currently editing this field" state: `lr-filter-bar` suppresses its * external-value sync and substitutes the not-yet-committed value into a controlled child while * one is armed, and `lr-data-grid` treats one as an outstanding server request. `pendingValue` is * consumed before `onSettled` runs, so a callback reading it back sees `undefined`, never the * value it was just handed. * * `dispose()` additionally marks the controller permanently inert: a `push()` after `dispose()` * is a no-op rather than scheduling a new timer, so a caller that disposes every instance from its * own `disconnectedCallback()` can rely on no timer ever firing into a torn-down host again, even * if a stray reference to the controller outlives the component. `cancel()` alone leaves the * controller reusable -- it only discards whatever is currently pending, matching * `lr-filter-bar`'s `cancelDebounce()`, which is called on `reset()`/a chip removal without ending * that field's ability to debounce a later edit, and which also runs on a disconnect that a * re-parent may follow. */ export declare class DebounceController{#private;delayMs:number;private readonly onSettled;private readonly resolveTimerHost?; /** * @param delayMs The delay applied by the *next* `push()`; assign it at any time (a host whose * debounce is itself a reactive property just writes it before pushing). An already-armed * timer keeps the delay it started with. * @param onSettled Receives the latest pushed value once the delay elapses or `flush()` runs. * @param resolveTimerHost Resolves the realm to schedule on, re-read on every `push()` and * retained for the matching clear, so a controller whose host moves between documents still * cancels on the realm that scheduled the work. Falls back to the ambient timer queue. */ constructor(delayMs:number,onSettled:(value:T)=>void,resolveTimerHost?:(()=>DebounceTimerHost|null|undefined)|undefined); /** Whether a pushed value is waiting to settle -- the "this field is mid-edit" predicate. */ get pending():boolean; /** The latest pushed value while one is pending, `undefined` otherwise. */ get pendingValue():T|undefined; /** Records a new pending value, restarting the timer. A no-op once disposed. */ push(value:T):void; /** Fires `onSettled` immediately with the latest pushed value, if one is pending. A no-op * otherwise -- safe to call unconditionally (e.g. on every blur). */ flush():void; /** Discards any pending value with no callback. Leaves the controller usable for a later * `push()`. */ cancel():void; /** * Like `cancel()`, but a no-op when `nextValue` matches the value currently pending -- the * primitive a host's own external-write handler needs so a controlled-input rebind (a * framework template writing back the exact value it just handed the control, on the very next * render) cannot silently defeat an in-flight debounce. Nothing pending: identical to `cancel()` * (already a no-op there). A `nextValue` that genuinely differs from the pending one still * supersedes it, exactly as an unconditional `cancel()` always did -- an external replacement * is still a real edit, not an echo. * * `equals` defaults to `Object.is` (`===` plus correct `NaN`/`-0` handling); a caller debouncing * a non-primitive `T` (an object, a `Window`-keyed marker) supplies its own, matching whatever * "same value" means for that `T`. */ cancelIfChanged(nextValue:T,equals?:(a:T,b:T)=>boolean):void; /** Same as `cancel()`, plus permanently disables further `push()` calls. Call from * `disconnectedCallback()` so a timer already in flight can never settle into a torn-down * host, and so a lingering reference can't schedule a new one afterward. */ dispose():void;}