import type { RouteChange } from 'lwr/domRouterUtils'; import type { ContextId } from 'lwr/navigation'; import type { PageReference, Router, RouterConfig, RoutingMatch } from 'lwr/router'; import type { MessageObject } from 'lwr/routerUtils'; import type { NavigateOptions } from '../routerUtils/types.js'; type HandleNavFunction = (p: PageReference) => boolean; type PreNavFunction = (r: RouteChange) => boolean | Promise; type ErrorNavFunction = (m: MessageObject) => void; type ServerRouterConfig = RouterConfig & { url?: string; handleNavigation?: HandleNavFunction; preNavigate?: PreNavFunction; errorNavigate?: ErrorNavFunction; }; export declare class ServerRouter { router: Router; target: EventTarget; contextId: ContextId; handleNavHook?: HandleNavFunction; preNavHook?: PreNavFunction; errorNavHook?: ErrorNavFunction; currentRoute: RoutingMatch | undefined; constructor(config: ServerRouterConfig, router: Router, target: EventTarget); /** * lightning/navigation * Perform a hard navigation to the given page reference * Client only! */ navigate(address: PageReference, _replace?: boolean, options?: NavigateOptions): Promise; /** * lightning/navigation * Generate a URL based on the given page reference */ generateUrl(address: PageReference, options?: NavigateOptions): string | null; /** * Async version of generateUrl */ generateUrlAsync(address: PageReference, options?: NavigateOptions): Promise; /** * Initialize the CurrentPageReference & NavigationContext wires plus the client-only NavigationMixin * On the server, use the URL from the config * On the client, pull the URL from the current location */ private initWires; /** * Get a relative URL from a fully qualified one * eg: "http://www.site.com/items/123abc?mode=dark" -> "/items/123abc?mode=dark" */ private getRelativeUrl; /** * Validate the page reference passed to the navigate API */ private getValidatedUrl; /** * Run the errorNavigate filters */ private processError; } /** * Create and initialize a new Server Router * On the server, enable the CurrentPageReference & NavigationContext wires plus the generateUrl API * On the client, do hard navigations and enable all "lightning/navigation" APIs for hydrated or CSR islands * Note: This router does not implement subscribe() or the CurrentView wire */ export declare function createServerRouter(config: ServerRouterConfig, target: EventTarget): void; export {}; //# sourceMappingURL=serverRouter.d.ts.map