/** * @module ui/router/ibgib-router-service-base * * Generic, isomorphic/browser abstract base class for ibgib client SPA routers. * Manages HTML5 History API (pushState/replaceState), browser back/forward (popstate), * internal anchor link click interception, re-entrancy locks, and pub/sub route change notifications. */ import { RouterNavigateOptions, RouteListener } from './router-types.mjs'; /** * Abstract base class for ibgib SPA routers. * Parameterized by the application-specific route data model `TRouteInfo`. */ export declare abstract class IbGibRouterServiceBase { protected lc: string; protected currentRoute?: TRouteInfo; protected listeners: RouteListener[]; protected isNavigating: boolean; constructor(); /** * Parse raw URL pathname (and optional query string) into typed route info. * Must be implemented by the concrete downstream application router. */ protected abstract parseRoute(pathname: string): TRouteInfo; /** * Format typed route info into a URL pathname string. * Must be implemented by the concrete downstream application router. */ protected abstract formatRoute(route: TRouteInfo): string; /** * Check if two route infos represent the same route to prevent redundant event triggers. * Must be implemented by the concrete downstream application router. */ protected abstract isSameRoute(a?: TRouteInfo, b?: TRouteInfo): boolean; /** * Provide a fallback route if `loadCurrentURL` or `popstate` parsing encounters an error. * Must be implemented by the concrete downstream application router. */ protected abstract getFallbackRoute(pathname: string, error: unknown): TRouteInfo; /** * Hook to determine whether an anchor link click should be ignored by the SPA click interceptor. * Defaults to ignoring `/api/`, `/assets/`, and `/css/`. * Override in downstream routers if additional asset paths exist. */ protected isIgnoredPath(href: string): boolean; /** * Initializes window and document level listeners for HTML5 history navigation and anchor clicks. */ protected initBrowserListeners(): void; /** * Subscribes a listener to route change events. * Returns an unsubscribe callback. */ subscribe(listener: RouteListener): () => void; /** * Returns the current active route info, if any. */ getCurrentRoute(): TRouteInfo | undefined; /** * Navigates to a given typed route info. * Updates window.history (pushState or replaceState) and dispatches route changes to listeners. */ navigate(route: TRouteInfo, opts?: RouterNavigateOptions): Promise; /** * Navigates to a raw pathname string by parsing it into a typed route info. */ navigatePath(pathname: string, opts?: RouterNavigateOptions): Promise; /** * Reads current window.location, parses the route, updates internal state, * and notifies all listeners. Call during application bootstrap after Shell is ready. */ loadCurrentURL(): Promise; /** * Dispatches route changes sequentially to all registered subscribers. */ protected notifyListeners(route: TRouteInfo): Promise; } //# sourceMappingURL=ibgib-router-service-base.d.mts.map