// Generated by dts-bundle-generator v8.1.2 import { ChildDom, TagFunc } from 'vanjs-core'; /** * 1. Exclusions ("not" routes) and other matching options (via extraKeys) * - not = ensure the next segment is not the pattern provided * - regex = match the pattern provided * - notRegex = ensure the next segment does not match the pattern provided * - optional = the next segment is optional * - multiple = the next segment can be repeated * - oneOf = the next segment can be one of the provided options * - allOf = the next segment must match all of the provided options * - param = next segment is a named parameter & pattern * - escape = next segment is a literal string, can be escaped characters and/or one of the above options * 2. Query parameters * 3. Data loaders? + loading displays * 4. Route guards / authentication * 5. Route transitions? */ export type RouteMatcherObject = { not: RouteMatcher; } | { regex: RegExp; } | { notRegex: RegExp; } | { optional: RouteMatcher; } | { multiple: RouteMatcher; } | { oneOf: RouteMatcher[]; } | { allOf: RouteMatcher[]; } | { param: { name: string; test: RouteMatcher; }; } | { escape: RouteMatcher; } | { matchAny: true; } | { fn: (segment: string) => { matches: boolean; increment?: number; params?: any; hasParams?: boolean; }; }; export type RouteMatcher = string | RouteMatcherObject; export interface ActiveRoute { routePath: string[]; } export declare const urlPathToActiveRoute: (urlPath: string) => ActiveRoute; export declare const nowRoute: () => ActiveRoute; export declare const activeRoute: import("vanjs-core").State; export interface MatchResult { show: boolean; params: Record; hasParams: boolean; } export interface RoutePassthrough { currentRoute: { path: RouteMatcher[]; hasParams?: boolean; }; extraProps: Record; baseRoute?: string; } export type ExtraKeys = keyof ExtraKeyObject; export interface RecursiveRouteMap { [key: string]: RecursiveRouteMap & TagFunc & ExtraKeysAsFinal; } export type ExtraKeysAsFinal = { [K in ExtraKeys]: ReturnType[K]>; }; export type FinalRouteObject = RecursiveRouteMap & ExtraKeysAsFinal & TagFunc; declare class ExtraKeyObject { not: (route: RoutePassthrough) => (prop: RouteMatcher) => FinalRouteObject; regex: (route: RoutePassthrough) => (prop: string | RegExp) => FinalRouteObject; notRegex: (route: RoutePassthrough) => (prop: string | RegExp) => FinalRouteObject; optional: (route: RoutePassthrough) => (prop: RouteMatcher) => FinalRouteObject; multiple: (route: RoutePassthrough) => (prop: RouteMatcher) => FinalRouteObject; escape: (route: RoutePassthrough) => (prop: string) => FinalRouteObject; fn: (route: RoutePassthrough) => (prop: (segment: string) => { matches: boolean; increment?: number; params?: any; hasParams?: boolean; }) => FinalRouteObject; oneOf: (prps: RoutePassthrough) => (...props: RouteMatcher[]) => FinalRouteObject; allOf: (prps: RoutePassthrough) => (...props: RouteMatcher[]) => FinalRouteObject; param: (prps: RoutePassthrough) => (name: string, test: RouteMatcher) => FinalRouteObject; any: (prps: RoutePassthrough) => FinalRouteObject; getRoute: (prps: RoutePassthrough) => (params?: Record) => string; getRouteMatchString: (prps: RoutePassthrough) => string; addExtraProps: (prps: RoutePassthrough) => (extraProps: Record) => FinalRouteObject; getRouteMatchTest: (prps: RoutePassthrough) => (exampleUrl: string) => boolean; getPassthrough: (prps: RoutePassthrough) => RoutePassthrough; getRouteMatchFull: (prps: RoutePassthrough) => (exampleUrl: string) => MatchResult; } export type RouteInputs = ((params: Record) => ChildDom | ChildDom[]) | ChildDom | ChildDom[]; export type RouteInputSelectors = string | Array | FinalRouteObject; export declare const routeTo: (...extras: RouteInputSelectors[]) => string; export declare const createRouter: (r?: RoutePassthrough) => FinalRouteObject; export declare const route: FinalRouteObject; export {};