import { ComponentChildren } from '../dom/create-dom-element'; import { VComponent } from '../component'; import { Reactive } from '../reactive'; import { Maybe } from '../utils/types'; export type PageComponent = (maybeChildren: { children?: ComponentChildren[]; }) => VComponent; export type RouterConfig = Array<{ path: string; component: PageComponent; children?: RouterConfig; redirect?: string; } | { path: string; redirect: string; }>; export interface RouteChangeHandler { publishRouteChange(): void; onRouteChange(callback: () => void): void; } export interface CurrentLocation { location: Location; } export type RouterLocation = { path: string; params: Record; }; export declare class Router { private readonly config; private readonly _routeChangerHandler; protected _currentLocation: CurrentLocation; private readonly _history; constructor(config: RouterConfig, _routeChangerHandler: RouteChangeHandler, _currentLocation: CurrentLocation, _history?: History); readonly route: Reactive; getCurrentUrl(): RouterLocation; private _initialized; private _buildRouterLocation; private _findFullPathPattern; private resetDepth?; init(resetDepth?: () => void): void; getComponentForPath(path: string, { depth }?: { depth?: number | undefined; }): Maybe; navigate(url: string): void; private _findDynamicParams; getMatchingRoute({ path, depth }: { path: string; depth: number; }): { path: string; component: PageComponent; children?: RouterConfig | undefined; redirect?: string | undefined; } | { path: string; redirect: string; } | null; } declare class RouterBuilder { config: RouterConfig; withConfig(config: RouterConfig): this; build(): Router; } /** * @deprecated use createRouter instead * @returns */ export declare const routerBuilder: () => RouterBuilder; export declare const createRouter: (config: RouterConfig) => Router; export {};