/** * Handle definition for accumulating data across route segments. * * Handles allow server-side route handlers to pass accumulated data to client * components. Unlike loaders (which fetch data for specific routes), handles * accumulate data across all matched route segments. * * @example * ```ts * // Define a handle (name auto-generated from file + export) * export const Breadcrumbs = createHandle(); * * // Use in handler * const push = ctx.use(Breadcrumbs); * push({ label: "Home", href: "/" }); * * // Consume on client * const crumbs = useHandle(Breadcrumbs); * ``` */ export interface Handle { /** * Brand to distinguish handles from loaders in ctx.use() */ readonly __brand: "handle"; /** * Auto-generated unique ID for this handle (used as key in storage) * Format: "filePath#ExportName" in dev, "hash#ExportName" in production */ readonly $$id: string; } /** * Look up a collect function from the registry by handle $$id. * Returns undefined if not registered (falls back to defaultCollect in useHandle). */ export declare function getCollectFn(id: string): ((segments: unknown[][]) => unknown) | undefined; /** * Create a handle definition for accumulating data across route segments. * * The $$id is auto-generated by the Vite exposeInternalIds plugin based on * file path and export name. No manual naming required. * * @param collect - Optional collect function (default: flatten into array) * @param __injectedId - Auto-injected by Vite plugin, do not provide manually * * @example * ```ts * // Default: flatten into array * export const Breadcrumbs = createHandle(); * // Result type: BreadcrumbItem[] * * // Custom: last value wins * export const PageTitle = createHandle( * (segments) => segments.flat().at(-1) ?? "Default Title" * ); * // Result type: string * * // Custom: object merge * export const Meta = createHandle, MetaTags>( * (segments) => Object.assign({ robots: "index,follow" }, ...segments.flat()) * ); * // Result type: MetaTags * * // Custom: dedupe by href * export const Breadcrumbs = createHandle( * (segments) => { * const all = segments.flat(); * return all.filter((item, i) => all.findIndex(x => x.href === item.href) === i); * } * ); * ``` */ export declare function createHandle(collect?: (segments: TData[][]) => TAccumulated, __injectedId?: string): Handle; /** * Type guard to check if a value is a Handle. */ export declare function isHandle(value: unknown): value is Handle; //# sourceMappingURL=handle.d.ts.map