UNPKG

flexium

Version:

A lightweight, signals-based UI framework with cross-platform renderers

61 lines (56 loc) 1.73 kB
import { S as Signal, C as Computed } from './canvas-BarP3tEC.js'; import { V as VNode } from './renderer-CWYPPHmO.js'; interface Location { pathname: string; search: string; hash: string; query: Record<string, string>; } interface RouterContext { location: Signal<Location> | Computed<Location>; params: Signal<Record<string, string>> | Computed<Record<string, string>>; navigate: (path: string) => void; matches: Signal<RouteMatch[]> | Computed<RouteMatch[]>; } interface RouteProps { path?: string; index?: boolean; component: Function; children?: any; } interface RouteMatch { route: RouteDef; params: Record<string, string>; pathname: string; } interface RouteDef { path: string; index: boolean; component: Function; children: RouteDef[]; } interface LinkProps { to: string; class?: string; children?: any; } declare function createLocation(): [Signal<Location>, (path: string) => void]; declare function matchPath(pathname: string, routePath: string): { matches: boolean; params: Record<string, string>; }; declare function useRouter(): RouterContext; declare function Router(props: { children: any; }): () => VNode | null; /** * Route configuration component. * Doesn't render anything directly; used by Router to build the route tree. */ declare function Route(_props: RouteProps): null; /** * Renders the child route content. */ declare function Outlet(): (() => VNode | null) | null; declare function Link(props: LinkProps): VNode; export { Link, type LinkProps, type Location, Outlet, Route, type RouteDef, type RouteMatch, type RouteProps, Router, type RouterContext, createLocation, matchPath, useRouter };