import { a as ViewStateBase, c as ViewStateChangeReason, n as ScrollState, t as GetViewStateOptions } from "./types-16GC5k1z.js"; import { ReactiveController, ReactiveControllerHost } from "lit"; type ViewStateControllerOptions = { /** Component kind written into every state, e.g. `tree-list`. */ readonly kind: string; /** Build the full current state (pending included). Called when the change event fires. */ readonly capture: () => S; /** Trailing debounce for `view-state-change`, ms. Default 150. */ readonly debounceMs?: number; }; /** * Plumbing shared by every view-stateful component: * * - **change events** — `notify(reason)` coalesces changes into one debounced * `view-state-change` event (strongest reason wins: user > data > restore), * flushed immediately on disconnect so the last change is never lost. * - **restore marking** — changes made inside `restoring(fn)` are reported as * `restore`, so persistence code can skip writing back what it just loaded. * - **validation** — `accepts(state)` rejects a state for another kind / version. * - **pending scroll** — a scroll position waiting for its anchor item (or for * enough content). Cancelled by the user's own scroll intent on the target * given to `observeScrollTarget()`. * * The component owns its facets (selection, expansion, columns) and decides * what's pending; this controller only carries the cross-cutting parts. */ declare class ViewStateController implements ReactiveController { #private; constructor(host: ReactiveControllerHost & EventTarget, options: ViewStateControllerOptions); get kind(): string; hostConnected(): void; hostDisconnected(): void; /** Record a change. Inside `restoring()` the reason is forced to `restore`. */ notify(reason?: ViewStateChangeReason): void; /** Fire any pending change event now. */ flush(): void; /** Run `fn` with every `notify()` inside it reported as `restore`. */ restoring(fn: () => T): T; /** True while inside `restoring()`. */ get isRestoring(): boolean; /** Whether `state` is for this component kind and schema version. Warns when not. */ accepts(state: Partial | null | undefined): state is Partial; /** * Stamp `v` / `kind` onto `fields` and apply `include`. Components build * their full field set and pass it through here from `getViewState()`. */ shape(fields: Omit, options?: GetViewStateOptions): S; /** * Watch `target` for user scroll intent (wheel / touch / pointer / nav key); * any intent drops the pending scroll. Call again if the scroll container * is replaced. */ observeScrollTarget(target: EventTarget): void; get pendingScroll(): ScrollState | undefined; set pendingScroll(scroll: ScrollState | undefined); /** * Try the pending scroll with `apply`; it returns `true` once the position * was fully reached (anchor present, content long enough), which clears it. * Call after each render that may have added items. */ applyPendingScroll(apply: (scroll: ScrollState) => boolean): void; /** * Call from the viewport's `scroll` listener. Ignored while a scroll restore * is still pending; the event caused by a restore's own write is reported * as `restore`, anything else as `user`. */ notifyScroll(): void; } export { ViewStateControllerOptions as n, ViewStateController as t };