native-spa-route
Version:
provide SPA route's experience with native web component
49 lines (48 loc) • 1.61 kB
TypeScript
import { LitElement, nothing, PropertyValueMap } from 'lit';
import { Route } from './route';
export declare class RouteContainer extends LitElement {
/**
* config container work route path, default is `/`
* @default '/'
*/
rootPath: string;
/**
* config should cacht event where the target has `href` attribute
* if enable this, click a link will auto use `history.pushState`.
* @default true
*/
autoCatchHrefClick: boolean;
/**
* config is this component use shadow dom.
* @default false
*/
disableShadow: boolean;
allRouteNode: NodeListOf<Route>;
statusRenderMap: Record<string, (status: string) => string>;
status: 'common' | '404';
contentOf404?: string | (() => string);
active: boolean;
/**
* get current container's status
*/
getStatus(): "common" | "404";
/**
* if disabled shadow dom, this is the only way to add 404 status content
*/
set404Content(content: string | (() => string)): void;
private _render_404;
private _render_with_light_dom;
private _render_with_shadow_dom;
protected render(): typeof nothing | import("lit").TemplateResult<1>;
private _is_match_route;
protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
protected createRenderRoot(): HTMLElement | DocumentFragment;
private _route_change_callback;
connectedCallback(): void;
disconnectedCallback(): void;
}
declare global {
interface HTMLElementTagNameMap {
'native-route-container': RouteContainer;
}
}