UNPKG

1.47 kBTypeScriptView Raw
1import { AnimationBuilder, ComponentProps } from '../../../interface';
2import { NavigationHookCallback } from '../../route/route-interface';
3export interface HTMLStencilElement extends HTMLElement {
4 componentOnReady(): Promise<this>;
5}
6export interface NavOutlet {
7 setRouteId(id: string, params: ComponentProps | undefined, direction: RouterDirection, animation?: AnimationBuilder): Promise<RouteWrite>;
8 getRouteId(): Promise<RouteID | undefined>;
9}
10export interface RouterEventDetail {
11 from: string | null;
12 redirectedFrom: string | null;
13 to: string;
14}
15export interface RouteRedirect {
16 from: string[];
17 to?: ParsedRoute;
18}
19export interface RouteWrite {
20 changed: boolean;
21 element: HTMLElement | undefined;
22 markVisible?: () => void | Promise<void>;
23}
24export interface RouteID {
25 id: string;
26 element: HTMLElement | undefined;
27 params?: {
28 [key: string]: any;
29 };
30}
31export interface RouteEntry {
32 id: string;
33 path: string[];
34 params: {
35 [key: string]: any;
36 } | undefined;
37 beforeLeave?: NavigationHookCallback;
38 beforeEnter?: NavigationHookCallback;
39}
40export interface RouteNode extends RouteEntry {
41 children: RouteTree;
42}
43export interface ParsedRoute {
44 segments: string[];
45 queryString?: string;
46}
47export declare type RouterDirection = 'forward' | 'back' | 'root';
48export declare type NavOutletElement = NavOutlet & HTMLStencilElement;
49export declare type RouteChain = RouteEntry[];
50export declare type RouteTree = RouteNode[];