galhui
Version:
UI library using galho framework
27 lines (26 loc) • 1.23 kB
TypeScript
import { G } from "galho";
import { Dic, Task, falsy, str } from "galho/util.js";
export declare const hash: (s: G, value: str) => G<HTMLElement>;
export declare function init(...routeRoot: G[]): void;
export type Update = (...path: string[]) => Task<void | (G | Element)[]>;
export type RouteResult = G[] | [view: G[] | falsy, onupdate: Update];
export type Route = RouteResult | ((...path: string[]) => Task<RouteResult | void>);
export type Routes = Dic<Route>;
export declare var currentPath: str;
export declare function add(handlers: Routes): void;
export declare function add(key: str, handler: Route): void;
export declare function set(t: (G | Element | falsy)[]): void;
export declare function push(...items: (G | Element | falsy)[]): void;
export declare function pop(...items: G[]): void;
type Intercept = (key: str, options: {
path: str;
sub: str[];
cancel(): void;
}) => void | str;
export declare function intercept(v: Intercept): void;
export declare function has(path: str): boolean;
export declare function defaultRoute(value?: str): string;
export declare function goTo(path: string): Promise<void>;
export declare function updateAnchors(): void;
export declare function hmr(): void;
export {};