/** @typedef {Map|HTMLOrSVGElement['dataset']} MatchData */
/**
* @typedef {Object} Match
* @property {string} url - The url that was matched and consumed by this route. The match.url and the match.remainder will together equal the URL that the route originally matched against.
* @property {string} remainder - If the route performed a partial match, the remainder of the URL that was not attached is stored in this property.
* @property {Map} data - Any data found and matched in the URL.
* @property {?string} redirect - A URL to redirect to.
* @property {boolean} useCache - Indicator as to wether the current HTML content can be reused.
*/
/** */
export class RouteElement extends HTMLElement {
/**
* @param {string|DocumentFragment|Node} target element to set the data on
* @param {MatchData} data to set on the element
*/
static setData(target: string | DocumentFragment | Node, data: MatchData): void;
/** Initialize */
connectedCallback(): void;
created: boolean;
baseUrl: string;
canLeave: any;
/** @type {string|DocumentFragment|Node} */
content: string | DocumentFragment | Node;
data: any;
/**
* @private
* @param {string} url to break into segments
* @returns {Array} string broken into segments
*/
private _createPathSegments;
/**
* Performs matching and partial matching. In order to successfully match, a RouteElement elements path attribute must match from the start of the URL. A full match would completely match the URL. A partial match would return from the start.
* @fires RouteElement#onROuteMatch
* @param {string} url - The url to perform matching against
* @returns {Match} match - The resulting match. Null will be returned if no match was made.
*/
match(url: string): Match;
lastMatch: {
url: string;
remainder: string;
data: Map;
redirect: any;
useCache: boolean;
};
/** Clear the last match which will reset cache state */
clearLastMatch(): void;
/**
* Generates content for this route.
* @param {Map} [attributes] - Object of properties that will be applied to the content. Only applies if the content was not generated form a Template.
* @returns {Promise} - The resulting generated content.
*/
getContent(attributes?: Map): Promise;
}
export type MatchData = Map | HTMLOrSVGElement['dataset'];
export type Match = {
/**
* - The url that was matched and consumed by this route. The match.url and the match.remainder will together equal the URL that the route originally matched against.
*/
url: string;
/**
* - If the route performed a partial match, the remainder of the URL that was not attached is stored in this property.
*/
remainder: string;
/**
* - Any data found and matched in the URL.
*/
data: Map;
/**
* - A URL to redirect to.
*/
redirect: string | null;
/**
* - Indicator as to wether the current HTML content can be reused.
*/
useCache: boolean;
};