export interface ClientRouterProps { /** Fallback animation strategy when native View Transitions are not supported. */ fallback?: "none" | "animate" | "swap"; /** * When true, opts every same-origin link into the default prefetch strategy * (hover) by calling prefetchInit({ prefetchAll: true }) once on the client. */ prefetchAll?: boolean; /** * Extra `` attribute names to preserve across SPA swaps. By default the * client router copies the incoming server-rendered document's `` * attributes onto the live root, dropping any current attribute that isn't * internal to the transition machinery — so a *runtime* attribute a consumer * sets from a persisted island (e.g. `data-theme` or `data-sidebar-hidden` * driven from `localStorage`) is lost on every navigation. List those names * here and the router re-applies their current value after each swap. Emitted * as a `` tag that `swapRootAttributes` * reads at swap time. * * Mount with the **same list on every page** that participates in SPA * navigation: the preserve-list is read from the *current* (outgoing) page's * meta at swap time, so a page that omits an entry drops that attribute when * navigating away from it. Names are matched case-insensitively (DOM attribute * names are lowercased). For dynamic/computed cases, mutate * `event.newDocument.documentElement` in a `zfb:before-swap` listener instead. * @see https://github.com/Takazudo/zudo-front-builder/issues/1103 */ preserveHtmlAttrs?: string[]; /** * Opt this page OUT of the same-page traverse fast-path (default `false` — * fast-path ON). By default a Back/Forward traversal between two history * entries sharing the same `pathname + search` is served instantly from the * live DOM — no re-fetch, no re-swap, so island/client state is preserved. * * Set this on a **per-request SSR page** (`prerender = false`) whose * server-rendered content can legitimately differ between two visits to the * same URL: with the fast-path skipped such a traverse would pin the stale * first-render content. Emitted as * ``, which the router reads * on the current (target) page to force the fetch back on. Mount with the * **same value on every page** that participates in SPA navigation, mirroring * the `preserveHtmlAttrs` guidance. * @see https://github.com/Takazudo/zudo-front-builder/issues/1376 */ traverseRefetch?: boolean; } /** * Public element shape for each node returned by ``. * Structural type — intentionally matches the Preact/React VNode object shape * so consumers do not type-infer through the internal representation. */ export type ClientRouterElement = { readonly type: string; readonly props: Readonly>; readonly key: unknown; }; /** * `` — SPA soft-swap navigation with View Transition animations. * * Mount once in your page ``. Emits the opt-in meta tags and the global * `.zfb-route-announcer` stylesheet that the route-announcer ARIA div needs. * Importing this module performs no side effects — click/form-submit * intercepts are wired only when `./client-router.js` (the activation shim, * imported directly or via the `@takazudo/zfb-runtime/client-router` subpath) * is evaluated. * * @example * ```tsx * import { ClientRouter } from "@takazudo/zfb-runtime"; * // In your page : * * ``` */ export declare function ClientRouter({ fallback, prefetchAll: prefetchAllProp, preserveHtmlAttrs, traverseRefetch, }?: ClientRouterProps): readonly ClientRouterElement[];