import type { ReactiveController, ReactiveControllerHost } from 'lit'; import type { HTMLTemplateResult } from './../../Dom/Html'; import type { IBaseRouteConfig, IRouteView } from './../Route/Interfaces/IBaseRouteConfig'; import type { RouteConfig } from './../Route/RouteConfig'; /** * The config options for a RouterController. */ export interface IRouterControllerConfig { useHash?: boolean; fallback?: IBaseRouteConfig; callback?: (route: RouteConfig) => void; scrollRestoration?: ScrollRestoration; } /** * A reactive controller that performs location-based routing using a * configuration of URL patterns and associated render callbacks. * * @fires routesConnected {RoutesConnectedEvent} - Fired when a child routes controller is connected. * * @public */ export declare class RouterController implements ReactiveController { private static readonly ROUTING_STRATEGIES; private static readonly ORIGIN; private readonly _childRoutes; private readonly _host; private readonly _callback; private readonly _fallback; private _currentPathname; private _currentRoute; private _currentParams; private _parentRoutes; private _onDisconnect; private _windowClickSubscription; private _windowPopStateSubscription; private _hostRoutesConnectedSubscription; private _useHash; private _routes; /** * Constructs a new instance of the `MutationController` class. * * @public */ constructor(host: ReactiveControllerHost & HTMLElement, routes: Array, config?: IRouterControllerConfig); /** * The currently installed set of routes in precedence order. * * This array is mutable. To dynamically add a new route you can write: * * ```ts * this._routes.routes.push({ * path: '/foo', * render: () => html`

Foo

`, * }); * ``` * * Mutating this property does not trigger any route transitions. If the * changes may result is a different route matching for the current path, you * must instigate a route update with `navigate()`. * * @public */ get routes(): Array; set routes(value: Array); /** * Gets or sets the `useHash` property. * * For example, if `useHash` is `true`, the URL will look like * `http://example.com/#/path/to/resource` instead of * `http://example.com/path/to/resource`. * * @public */ get useHash(): boolean; set useHash(value: boolean); /** * Gets or sets the `scrollRestoration` property. * * @public */ get scrollRestoration(): ScrollRestoration; set scrollRestoration(value: ScrollRestoration); /** * A default fallback route which will always be matched if none of the * `routes` match. Implicitly matches to the path "/*". * * @public * @readonly */ get fallback(): IBaseRouteConfig | undefined; /** * Returns the `callback` property. * * @public * @readonly */ get callback(): ((type: RouteConfig) => void) | undefined; /** * The current parsed route parameters. * * @public * @readonly */ get params(): Record; hostConnected(): void; /** * @public */ hostDisconnected(): void; /** * Navigates this routes controller to `pathname`. * * This does not navigate parent routes, so it isn't (yet) a general page * navigation API. It does navigate child routes if pathname matches a * pattern with a tail wildcard pattern (`/*`). * * @public */ navigate(pathname: string): Promise; /** * Returns a URL string of the current route, including parent routes, * optionally replacing the local path with `pathname`. * * @public */ link(pathname?: string): string; /** * The result of calling the current route's render() callback. * * @public */ outlet(): IRouteView | HTMLTemplateResult | undefined; /** * Matches `url` against the installed routes and returns the first match. * * @private */ private getRoute; /** * @private */ private onRoutesConnected; /** * @private */ private onWindowClick; /** * @private */ private onWindowPopState; } //# sourceMappingURL=RouterController.d.ts.map