import { HTMLProps, ComponentType } from 'react';
export declare type TText = string;
export declare type TRouteState = any;
export declare type TRouteName = string;
export declare type TRoutePath = string;
export declare type TURL = string;
export declare type TQuery = {
[key: string]: string;
};
export declare type TQueryString = string;
export declare type THook = (route: IRoute, state: TRouteState) => Promise;
export declare type TDefaultHookCallee = (route: IRoute, state: any) => (hook: THook) => Promise;
export interface IQueryObject {
[key: string]: any;
}
export interface IRoute {
name: TRouteName;
path: TRoutePath;
view: ComponentType;
onBeforeExit?: Hook;
onEnter?: Hook;
}
export interface IData {
route: IRoute;
state: TRouteState;
queryParams: TQuery;
}
export interface IProvider extends HTMLProps {
routes: IRoute[];
queryString?: TQueryString;
url?: TURL;
onBeforeExit?: Hook;
onEnter?: Hook;
hookCallee?: HookCallee;
}
export interface IContext {
goTo: (toRouteName: TRouteName, toState?: TRouteState, queryParams?: TQuery, withPrefix?: string) => void;
getHref: (routeName: string, state?: TRouteState, queryParams?: TQuery) => string;
route: {
name: TRouteName;
path: TRoutePath;
view: ComponentType;
};
routes: IRoute[];
queryParams: TQuery;
state: TRouteState;
}
export interface ILinkProps extends Pick, Exclude, 'href'>> {
routeName: TRouteName;
state?: TRouteState;
queryParams?: IQueryObject;
suffix?: string;
prefix?: string;
}