/** * vapor-chamber-router - the single DOM integration point. * * Delegated listeners on the document (and on each open shadow root an event * comes from) own everything link-shaped inside the base: * . click interception (page.js checklist: shadow DOM via composedPath, * download, rel=external, explicit target, cross-origin - which also * excludes mailto:/tel: - modifier keys, `data-native` opt-out, * `data-replace` for replaceState) * . `data-active` / `data-exact-active` stamping on in-base anchors after * each commit - Blade-rendered menus light up with zero Vue * . hover and focus preheat (100ms intent delay, cancelled on leave or * blur), the link found by the same composed-path scan as a click, * between the links of a shadow root too * * Plus the idle preheater: * load event + requestIdleCallback, saveData/2g skip, abort on first user * interaction, errors swallowed. */ export type DomIntegrationOptions = { base: string; /** Can the router handle this base-relative path? Falls through to a * normal full-page navigation when false. */ canHandle: (path: string) => boolean; navigate: (fullPath: string, replace: boolean) => void; /** Warm the lazy component(s) behind a base-relative path (hover or focus intent). */ preheat?: (path: string) => void; intentDelayMs?: number; /** * Called when the page is restored from the back/forward cache (`pageshow` * with `event.persisted`) - the JS heap and DOM were frozen, not torn down, * so nothing here re-runs on its own: active-link stamping reflects * whatever path was current when the page froze, and one-shot setup tied * to the original `load` event (idle preheat) never fires again. Left to * the caller to decide what "fresh" means (re-stamp, re-arm preheat, * `reload()`) rather than this module guessing at a data-freshness policy. */ onRestore?: () => void; }; /** `pathname`, `search` and `hash` are the parsed href's, for the same-page hash test. */ export type RoutableTarget = { path: string; fullPath: string; pathname: string; search: string; hash: string; }; export declare function installDomIntegration(options: DomIntegrationOptions): () => void; /** * Stamp `data-active` (prefix match) / `data-exact-active` (same path, * trailing-slash tolerant) on every in-base anchor. Call after each commit. * * The exact match also gets `aria-current="page"`, which is what a screen * reader announces as "current page" (WAI-ARIA 1.2). Only the exact match: a * section link that is merely a prefix match is active for styling, not the * page, and ARIA asks for one current element per set. */ export declare function stampActiveLinks(base: string, currentPath: string, root?: ParentNode): void; export type IdlePreheatOptions = { /** ms between successive loads. Default 200. */ gap?: number; /** ms ceiling for the idle wait. Default 4000. */ idleTimeout?: number; }; /** * Idle-time preheating of lazy chunks: waits * for the load event + requestIdleCallback, skips on saveData/2g, aborts all * remaining loads on the first real user interaction, swallows errors. * One-shot per call; returns a cancel function. */ export declare function preheatIdle(factories: ReadonlyArray<() => Promise>, options?: IdlePreheatOptions): () => void; //# sourceMappingURL=dom.d.ts.map