export declare const dispatchAtlasLayoutUpdateEvent: () => void; export declare function initLayout(): void; /** * Persists `layout-*` class state per `storageKey`. Instance is live on return. * * Subscribers fire on class transitions, with an immediate replay if the current * state already matches. Initial replay waits for `deferCallbacksUntil`. * * `data-layout-restored="true"` is always set after the initial flush — even on * setup or callback failure — so CSS gated on it cannot leave content hidden. * Setup errors are re-thrown. * * View transitions coalesce same-microtask callbacks and skip while another is * animating, avoiding `InvalidStateError` aborts. */ export type LayoutClassWhen = 'added' | 'removed' | 'always'; export interface LayoutCallbackEvent { className: string; isApplied: boolean; storageKey: string; } export type LayoutCallback = (event: LayoutCallbackEvent) => void; export interface LayoutStateView { [className: string]: boolean; } export interface LayoutStatePersisted { [storageKey: string]: LayoutStateView; } export interface LayoutStateOptions { /** Observed element. Defaults to ``. */ root?: HTMLElement; /** Storage backend. Defaults to `localStorage`. */ storage?: Pick; /** * Bucket key under `atlas-layout-preferences` and the value surfaced as * `LayoutCallbackEvent.storageKey`. Same key shares state. Getter is * re-read per operation. Defaults to `'default'`. */ storageKey?: string | (() => string); /** * Key into `atlas-layout-exclusions`. Classes listed under this key are * skipped during restore, persist, subscriber dispatch (including initial * replay), and the inline pre-paint restore. Getter is re-read per * operation. Omit to disable exclusion lookup. */ excludesKey?: string | (() => string); /** * Classes to write into `atlas-layout-exclusions[excludesKey]` on * construction. Requires `excludesKey`. Empty array clears the blocklist; * omission leaves any persisted entry untouched. */ excludes?: string[]; /** Delays initial subscriber callbacks. Defaults to next microtask. */ deferCallbacksUntil?: Promise; /** Wrap initial restoration in `document.startViewTransition` if available. */ useViewTransitionOnRestore?: boolean; } export interface LayoutSubscribeOptions { /** Wrap in a coalesced view transition; runs sync if one is already active. */ useViewTransition?: boolean; } export interface LayoutStateInstance { /** * Subscribe to `className` transitions. Replays once if the current state * matches (queued behind `deferCallbacksUntil`). Returns an unsubscribe fn. */ subscribe(className: string, when: LayoutClassWhen, callback: LayoutCallback, options?: LayoutSubscribeOptions): () => void; /** Current bucket state. */ getViewState(): LayoutStateView; /** All bucket state. */ getState(): LayoutStatePersisted; /** Stop observing; subscriptions remain registered. */ stop(): void; } export interface LayoutSubscription { className: string; when: LayoutClassWhen; callback: LayoutCallback; useViewTransition: boolean; } /** `atlas-layout-exclusions` shape: key → set of excluded `layout-*` class names. */ export interface LayoutExclusionsPersisted { [key: string]: { [className: string]: true; }; } export declare function createLayoutState(options?: LayoutStateOptions): LayoutStateInstance; //# sourceMappingURL=layout.d.ts.map