native-spa-route
Version:
provide SPA route's experience with native web component
100 lines (99 loc) • 3.24 kB
TypeScript
import { LitElement, nothing, PropertyValueMap } from 'lit';
export type RouteConfig = {
path: string;
title: string;
children?: RouteConfig[];
}[];
export declare class Route extends LitElement {
static styles: import("lit").CSSResult;
path: string;
exact: boolean;
element: string;
url?: string;
lazy: boolean;
appendDirection: 'before' | 'after';
customRender: boolean | string;
renderAfterReady: boolean;
disableShadow: boolean;
shadowCSSUrl: string;
loadingElement?: string;
lockLoadingTime?: number;
/**
* alias as shadowCSSUrl, more readable
*/
cssUrl: string | string[];
cssParseMode: 'inline' | 'base64';
cssDelayRender: number;
errorRender?: (error: Error) => string;
drop: boolean;
cssOnly: boolean;
customCSSBlockRenderTime?: number;
cacheVaildTime: number;
/**
* if enabled virtualNode, native-route-container will ignore this node.
*/
virtualNode: boolean;
groupMatchMode: boolean;
private _style_tag_ref;
private log;
private cachelog;
private active;
private fullpath;
protected _url_module?: Promise<any>;
protected moduleReady: 'nothing' | 'pending' | 'fulfilled' | 'rejected';
protected cssReady: 'nothing' | 'pending' | 'fulfilled' | 'rejected';
protected cssContent: string;
protected _css_base64?: string;
isExactMatch: boolean;
isModuleRenderInstanceDestroied: boolean;
cacheDestroyTimer?: ReturnType<typeof setTimeout>;
checkIsExactMatch(): boolean;
getFullPath(): string;
private isCssExsit;
isActive(): boolean;
private isRenderError;
private isRenderLoading;
private isRenderElement;
private renderErrorContent;
private renderLoading;
private renderElement;
protected render(): typeof nothing | import("lit").TemplateResult<1>;
private setCSSContent;
private _load_CSS;
private _load_URL_module;
private loadAssets;
_route_match_check_path: string;
_route_match_check_grouped_path: (string | RegExp)[];
private route_change_callback;
cacheCustomRenderDom?: HTMLDivElement;
private _could_set_cache_invalid_timer;
private _call_module_destroy;
private _set_cache_invalid_timer;
private _render_url_module;
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
private _parse_route_match_check_group;
connectedCallback(): void;
disconnectedCallback(): void;
protected createRenderRoot(): HTMLElement | DocumentFragment;
}
declare global {
interface HTMLElementTagNameMap {
'native-route': Route;
}
interface DocumentEventMap {
/**
* dispatch event while active status changed
*/
'route:active_status_change': CustomEvent<{
current: boolean;
previous: boolean;
}>;
'route:active': CustomEvent<{}>;
'route:un_active': CustomEvent<{}>;
/**
* dispatch event while isExactMatch attribute changed
*/
'route:exact_match_change': CustomEvent<boolean>;
}
}