/** RouterElement */ export class RouterElement extends HTMLElement { /** * Event handler for handling when child router is added. * This function is called in the scope of RouterElement for the top level collection of routers and instances of RouterElement for nested router collections. * Used to link up RouterElements with child RouterElements even through Shadow DOM. * @param {CustomEvent} event - routerAdded event */ static handlerAddRouter(event: CustomEvent): void; /** @param {CustomEvent} event Handles routerLinksAdded event and registers the RouterLink added */ static handlerRouterLinksAdded(event: CustomEvent): void; /** * Handles the navigate event and initiates browser navigation * @param {CustomEvent} event the navigate event */ static handlerNavigate(event: CustomEvent): void; /** * Used to link up RouterElements with child RouterElements even through Shadow DOM. * @param {RouterElement} router - routerElement to add. RouterElement after the first can be thought of as auxillary RouterElements */ static addRouter(router: RouterElement): void; /** * Removes a RouterElement from the routing process. * @param {RouterElement} routerElement to be removed */ static removeRouter(routerElement: RouterElement): void; /** * Global handler for hash changes */ static changeHash(): void; /** * Global handler for url changes. * Should be called if the user changes the URL via the URL bar or navigating history * @return {Promise} true if the new url was dispatched to the top level RouterElement */ static changeUrl(): Promise; /** * Global handler for page clicks. Filters out and handles clicks from links. * @param {(MouseEvent|HTMLAnchorElement|string)} navigationSource - The source of the new url to navigate to. Can be a click event from clicking a link OR an anchor element OR a string that is the url to navigate to. */ static navigate(navigationSource: (MouseEvent | HTMLAnchorElement | string)): Promise; /** * Clears all current match information for all available routers. * This initializes ready for the next matching. */ static prepareRoutersForDispatch(routers: any): void; /** * Common entry point that starts the routing process. * @param {string} url * @param {boolean} [skipHistory] * @fires RouterElement#onRouteCancelled */ static dispatch(url: string, skipHistory?: boolean): Promise; /** Updates the location history with the new href */ static updateHistory(href: any): void; /** * Sets the active status of any registered links based on the current URL * @param {string} [url] url to match against for link status * @param {{a: HTMLAnchorElement, routerMatches: AssignmentMatches}[]} [links] optional list of links to update the status for * @returns {Promise} Named items require parsing and processing prior to being analyzed. Resolved when named items are finished parsed and processed. */ static updateAnchorsStatus(url?: string, links?: { a: HTMLAnchorElement; routerMatches: { /** * - Assignments of type router */ routes: string[]; /** * - Assignments of type namedItems */ named: import('./named-routing').NamedMatch[]; }; }[]): Promise; /** * Gets the current URL state based on currently active routers and outlets. * @param {RouterElement[]} [routers] * @returns {string} url state representation of the routers passed in */ static getUrlState(routers?: RouterElement[]): string; /** * Iterates over each child RouterElement and calls it to match it portion of the current URL. * @param {string} url - While URL. Will be parsed for individual router URLs. * @param {RouterElement[]} routers * @returns {Promise} resolves when matching is complete. false if matching was cancelled. */ static performMatchOnRouters(url: string, routers: RouterElement[]): Promise; /** A URL can represent the state of multiplr routers on the page. This function will parse a url into sub urls for each router. * @param {string} url - The url to parse into multple router parts * @returns {Array} Each entry in the array is the url for a router. */ static splitUrlIntoRouters(url: string): Array; /** * Registers HTMLAnchorElements so that they become candidates route status styling. * @param {HTMLAnchorElement[]} links * @param {string} [activeClassName] */ static registerLinks(links: HTMLAnchorElement[], activeClassName?: string): Promise; /** */ static removeDisconnectedAnchors(): void; /** * @typedef {Object} AssignmentMatches * @property {string[]} routes - Assignments of type router * @property {import('./named-routing').NamedMatch[]} named - Assignments of type namedItems */ /** * * @param {(MouseEvent|HTMLAnchorElement|string)} hrefSource - The source of the new url to handle. Can be a click event from clicking a link OR an anchor element OR a string that is the url to navigate to. * @returns {Promise} assignmentMatches * */ static sanitizeLinkHref(hrefSource: (MouseEvent | HTMLAnchorElement | string)): Promise<{ /** * - Assignments of type router */ routes: string[]; /** * - Assignments of type namedItems */ named: import('./named-routing').NamedMatch[]; }>; /** Global/top level initialization */ static initialize(): Promise; /** * Returns the absolute URL of the link (if any) that this click event is clicking on, if we can and should override the resulting full page navigation. Returns null otherwise. * @param {(MouseEvent|HTMLAnchorElement|string)} hrefSource - The source of the new url to handle. Can be a click event from clicking a link OR an anchor element OR a string that is the url to navigate to. * @return {string?} Returns the absolute URL of the link (if any) that this click event is clicking on, if we can and should override the resulting full page navigation. Returns null if click should not be consumed. */ static _getSameOriginLinkHref(hrefSource: (MouseEvent | HTMLAnchorElement | string)): string | null; /** @returns {string} the hash portion of the browsers current url */ static _getHash(): string; /** @returns {string} the browsers current url without protocol of host */ static baseUrlSansHost(): string; /** * @private * Converts URL like object to a url string * @param {Location|URL} [url] url location object to encode defaults to window.location * @returns {string} url passed in */ private static _getUrl; /** Dispose */ disconnectedCallback(): void; /** Initialize */ connectedCallback(): Promise; created: boolean; _routers: any[]; _parentRouter: any; handlerAddRouter: any; /** * Event handler for handling when child route is added. * Used to link up RouterElements with child RouteElements even through Shadow DOM. * @param {CustomEvent} event - routeAdded event */ handlerAddRoute(event: CustomEvent): void; /** @type {import('./routes-route').Match} */ _currentMatch: import('./routes-route').Match; canLeave: any; /** @returns {string} the name of this router */ getName(): string; routerName: string; /** @returns {import('./routes-route').Match} */ getCurrentMatch(): import('./routes-route').Match; /** Clear the current router match */ clearCurrentMatch(): void; /** * Performs matching for nested routes as they connect. * @param {import('./routes-route').RouteElement} routeElement * @returns {Promise} */ addRoute(routeElement: import('./routes-route').RouteElement): Promise; /** * Takes in a url that contains named router data and renders the router using the information * @param {string} url to process as a named item * @returns {Promise} */ processNamedUrl(url: string): Promise; /** * Performs route matching by iterating through routes looking for matches * @param {String} url * @returns {Promise} */ performMatchOnRouter(url: string): Promise; hasMatch: boolean; /** * Tries to invoke matching of a url to a {RouteElement} * @param {string} url to match * @param {import('./routes-route').RouteElement} routeElement to match against * @returns {Promise} */ performMatchOnRoute(url: string, routeElement: import('./routes-route').RouteElement): Promise; /** * Update router state after router matching process has completed * Updates the parents match url remainder */ postProcessMatch(): void; /** @returns {string} Generates a url from this router (ignoring parent url segments) */ generateUrlFragment(): string; /** @returns {import('./routes-outlet').OutletElement} */ getOutletElement(): import('./routes-outlet').OutletElement; /** @returns {import('./routes-route').RouteElement[]} */ getRouteElements(): import('./routes-route').RouteElement[]; /** * Finds immediate child route elements * @param {string} tagNames CSV of immediate children with tag names to find * @returns {Array} of immediate children with matching tag names */ _getRouterElements(tagNames: string): Array; } export namespace RouterElement { namespace _currentMatch { export { shortUrl as remainder }; export const data: any; export const redirect: any; export const url: string; export const useCache: boolean; } const hasMatch: boolean; const _routers: any[]; const _route: {}; const _initialized: boolean; const _activeRouters: any[]; const _dwellTime: number; const _anchors: { a: HTMLAnchorElement; routerMatches: { /** * - Assignments of type router */ routes: string[]; /** * - Assignments of type namedItems */ named: import("./named-routing.js").NamedMatch[]; }; }[]; const _encodeSpaceAsPlusInQuery: boolean; const assignedOutlets: {}; } declare const shortUrl: string; export {};