/** * vapor-chamber-router - the navigation engine. Vue 3.6-native: router state * IS a shallowRef (alien-signals-backed in 3.6) - no bridge layer. * * The two-layer URL model: * PATH change -> resolve -> guards -> components + loaders (parallel, with * an AbortController created per navigation; starting a new * navigation aborts the previous one's fetches immediately) * -> ONE atomic frozen snapshot commit (two-phase: data * loads during, commits with - a page never renders with * the previous page's data). * QUERY/HASH-only change -> fast path: location commits immediately (no * matching, no guards, no remount); loaders whose template * depends on a changed key refetch in the background and * patch `snapshot.data` when done (isLoading tracks it). * * `navigate()` resolves to `RouterError | null` - null means committed. * Guard refusals (`refused:guard`) and superseded navigations * (`aborted:navigation`) are returned but NOT dispatched to onError. */ import type { RouterError } from './errors'; import type { RouterHistory } from './history'; import type { RouteTable } from './table'; import type { AfterEachHook, NavigationGuard, QueryPatch, RenderEntry, RouteLocation, RouteLocationRaw, RouteSnapshot, TableRecord } from './types'; /** * The location before the first commit, and a MODULE-LEVEL SINGLETON - one * object shared by every router in the process and exported publicly as a * sentinel. Both of its details are load-bearing: * * `Object.freeze` reaches one level, so the nested `params` / `query` / `meta` * are frozen too: otherwise `useRoute().value.params.id = 1` before the router * is ready would edit a global every other router hands out. Frozen * unconditionally rather than under DEV like ../freeze: this is four * empty objects frozen once at module load, so there is no per-commit cost to * weigh, and a shared constant is exactly where a silent write does the most * damage. * * `query` is a `dict()` because every OTHER query in this engine is - both arms * of resolveLocation, cleanQueryPatch, and setQuery stay prototype-free so a * consumer never has to know which branch built the query (a literal `{}` here * would make `route.query.constructor` answer before the first navigation and * not after it). */ export declare const START_LOCATION: RouteLocation; export type EngineContext = { getTable: () => RouteTable | null; history: RouterHistory; /** Resolve the renderable chain into render entries (components loaded, * blade rows wrapped). Throws coded RouterErrors. */ resolveRender: (records: readonly TableRecord[], to: RouteLocation) => Promise; /** Run the load chain through the configured preset. Throws coded RouterErrors. */ runLoaders: (records: readonly TableRecord[], to: RouteLocation, signal: AbortSignal) => Promise>; /** Which loaders in the chain does a set of changed query keys affect? */ loadAffectedBy: (records: readonly TableRecord[], keys: readonly string[]) => readonly TableRecord[]; /** Real failures only - refusals never arrive here. */ onError: (error: unknown, to: RouteLocation) => void; /** After a committed PATH navigation (not query-only). */ onCommit?: (snapshot: RouteSnapshot, from: RouteLocation, info: { popstate: boolean; }) => void; }; export type NavigateOptions = { replace?: boolean; popstate?: boolean; delta?: number; }; export type Engine = ReturnType; export declare function createEngine(ctx: EngineContext): { snapshot: import("vue").ShallowRef; isLoading: import("vue").ShallowRef; isRevalidating: import("vue").ShallowRef; trackRevalidation: (recordName: string, revalidation: Promise, to: RouteLocation) => void; navigate: (raw: RouteLocationRaw, opts?: NavigateOptions, redirects?: number) => Promise; resolveLocation: (raw: RouteLocationRaw) => RouteLocation; handlePop: (fullPath: string, info: { delta: number; }) => void; setQuery: (patch: QueryPatch, opts: { history?: "push" | "replace"; }, resolveMode: (key: string) => "push" | "replace") => void; setRouteData: (recordName: string, value: unknown) => void; /** Cancel the navigation in flight, as a newer one would (router.dispose). * No successor will clear the loading flag, so this does; a cancelled * navigation walks no history back (see revert). */ cancel: () => void; beforeEach: (guard: NavigationGuard) => () => void; afterEach: (hook: AfterEachHook) => () => void; }; //# sourceMappingURL=engine.d.ts.map