/** * Router utilities. * @module bquery/router */ import { type ReadonlySignal } from '../reactive/index'; import type { RouteDefinition } from './types'; /** * Flattens nested routes into a single array with full paths. * Does NOT include the router base - base is only for browser history. * @internal */ export declare const flattenRoutes: (routes: RouteDefinition[], parentPath?: string) => RouteDefinition[]; /** * Resolves a route by name and params. * * @param name - The route name * @param params - Route params to interpolate * @returns The resolved path * @throws {Error} If no router is initialized, the route name is unknown, * a required path param is missing from `params`, a param value does not satisfy * its route regex constraint, or a route param constraint has invalid syntax * * @example * ```ts * import { resolve } from 'bquery/router'; * * const path = resolve('user', { id: '42' }); * // Returns '/user/42' if route is defined as { name: 'user', path: '/user/:id' } * ``` */ export declare const resolve: (name: string, params?: Record) => string; /** * Checks if a path matches the current route. * * @param path - Path to check * @param exact - Whether to match exactly (default: false) * @returns True if the path matches * * @example * ```ts * import { isActive } from 'bquery/router'; * * if (isActive('/dashboard')) { * // Highlight nav item * } * ``` */ export declare const isActive: (path: string, exact?: boolean) => boolean; /** * Creates a computed signal that checks if a path is active. * * @param path - Path to check * @param exact - Whether to match exactly * @returns A reactive signal * * @example * ```ts * import { isActiveSignal } from 'bquery/router'; * import { effect } from 'bquery/reactive'; * * const dashboardActive = isActiveSignal('/dashboard'); * effect(() => { * navItem.classList.toggle('active', dashboardActive.value); * }); * ``` */ export declare const isActiveSignal: (path: string, exact?: boolean) => ReadonlySignal; //# sourceMappingURL=utils.d.ts.map