/** * vapor-chamber/router - router for Vue 3.6 over a server-owned catch-all. * * It follows the package peer range: the entry loads on Vue 3.5 * (tests/vue35-entries.test.ts), and only ./router/vapor needs 3.6. Rows come * from a server-side route generator emitting the RouteRecord schema (types.ts). * The server owns one catch-all (`/admin/{any?}` -> Blade shell -> one island); * this router owns every URL inside it. Path = navigation, query = state. * * Route table delivery: * routes: adminRoutes // generated TS module - primary * routes: { inline: '#vcr-routes' } // Blade-inlined, per-user filtered * routes: { url: '/api/vc/routes' } // admin tasks / router.reload() * * Data delivery: each row's `load` string is resolved by a loader PRESET (see * loaders.ts SPI) - `vapor-chamber/router-fetch` (in-box, plain JSON backends) * or your own LoaderHandlers for any other backend convention. * * `createRouter()` is pure - IO and listeners begin at start()/app.use(). */ import { type AnnounceOption } from './announce'; import type { HttpClient } from '../http'; import { type RouterHistory } from './history'; import { type LoaderHandlers } from './loaders'; import type { Router } from './router-type'; import type { ComponentMap, RouteLocation, RouteRecord, RoutesPayload } from './types'; export { onBeforeLeave, useBreadcrumbs, useMenu, useQueryParam, useRoute, useRouteData, useRouteError, useRouter, usePagination, } from './composables'; export type { Pagination, PaginationOptions, QueryParamHandle } from './composables'; export { buildBreadcrumbs, buildMenu } from './menu'; export type { Breadcrumb, MenuItem } from './menu'; export { preheatIdle, stampActiveLinks, type IdlePreheatOptions } from './dom'; export type { HistoryListener } from './history'; export { START_LOCATION } from './engine'; export { HARD_NAV_CODES, isRouterError, routerError } from './errors'; export type { RouterError, RouterErrorCode } from './errors'; export { canUseWebHistory, createMemoryHistory, createWebHistory, normalizeBase, resolveBase, stripBase } from './history'; export type { ResolveBaseOptions } from './history'; export type { RouterHistory } from './history'; export { defaultAffects, interpolateLoad, runLoaders } from './loaders'; export { revalidateRoutes } from './revalidate'; export type { RevalidateMap, RevalidateOptions, RevalidatePlugin } from './revalidate'; export { routerFacts } from './facts'; export type { FactSink, RouterFailedFact, RouterFlagFact, RouterNavigatedFact } from './facts'; export type { LoaderContext, LoaderHandlers, PrefixHandler, UrlHandler } from './loaders'; export type { Router } from './router-type'; export { compilePath, createRouteTable } from './table'; export type { RouteTable } from './table'; export type * from './types'; export { decodeQueryParam, encodeQueryParam, parseQuery, pathActivity, resolveQueryHistory, stringifyQuery } from './url'; export type RoutesSource = readonly RouteRecord[] | RoutesPayload | { inline: string; } | { url: string; }; export type RouterOptions = { /** Mount base, e.g. '/admin'. Falls back to the payload's base, then ''. */ base?: string; routes: RoutesSource; /** component key -> component | () => import(...) */ components?: ComponentMap; /** Loader preset resolving `load` values - vapor-chamber/router-fetch (in-box) * or your own LoaderHandlers. Routes without `load` never need this. */ loaders?: LoaderHandlers; /** Override history (createMemoryHistory for tests/SSR). Default: web. */ history?: RouterHistory; /** The app's http client, for every request the router makes: the * `routes: { url }` table (REQUIRED for that source), its loaders * (`LoaderContext.http`) and blade rows (`fetchBlade`'s second argument). * `routerHttp()` from `vapor-chamber/router/remote` marks it as router * traffic, and any `HttpClient` works. */ http?: HttpClient; /** Document-level link interception + active stamping + hover and focus warm-up. * Default: true in the browser. */ links?: boolean; /** Selector scoping data-active stamping (e.g. the admin shell) - stamping * walks only this subtree instead of the whole document. Interception * stays document-level. */ linksRoot?: string; /** Island hooks for blade rows - app conventions injected, never assumed. */ hydrate?: (el: Element) => unknown; dehydrate?: (el: Element) => unknown; /** Fetch server HTML for blade rows. REQUIRED if the table has any; * `bladeFetcher()` from `vapor-chamber/router/remote` is the in-box one. A * blade row with no fetcher is a coded `router:missing:fetchBlade`. `http` * is the router's client, undefined when it has none. */ fetchBlade?: (href: string, http?: HttpClient) => Promise; /** Terminal error handler. Default: hard-navigate on HARD_NAV_CODES, log * the rest. */ onError?: (error: unknown, to: RouteLocation) => void; /** Scroll to top after committed push navigations. Default: true. */ scroll?: boolean; /** Announce each client-side navigation to assistive technology, in an * assertive live region: `document.title`, else the first `

`, else the * path. `false` turns it off; a function returns the text. Not on the * initial load or a query-only change. Default: true. See announce.ts. */ announce?: AnnounceOption; /** CSS selector of a SMALL element (a heading, a skip link) to focus after * each client-side navigation; made focusable with tabindex="-1" only if it * is not already. Default: none (focus is not moved). See announce.ts. */ focusOnNavigate?: string; }; /** * A routes payload as a read answers it: plain JSON, the table itself. A * failure is a non-2xx problem, which the http client throws; an envelope * (`{ state }`, a 2xx `{ problem }`) is off-protocol. */ export declare function readRoutesPayload(raw: unknown): RoutesPayload; export declare function createRouter(options: RouterOptions): Router; //# sourceMappingURL=index.d.ts.map