frontend/.pnpm-store/v3/files/77/896131ac1e3f591a355b32c381d365a660af50ea7ff1074dfeba1157a902a6c11ddde5d0aeff6a9944fdbd53a0a9d203869a13f98dc7ca5908ad42a2246a43

121 lines
2.9 KiB
Plaintext

interface TinroRoute {
url: string
from: string
path: string
query: Record<string, string>
hash: string
}
interface TinroBreadcrumb {
url: string
name: string
}
interface TinroRouteMeta {
url: string
from?: string
match: string
pattern: string
breadcrumbs?: Array<TinroBreadcrumb>
query: Record<string, string>
params: Record<string, string>
subscribe(handler: (meta: TinroRouteMeta) => void)
}
interface TinroRouterModeSwitcher {
/** Set HistoryAPI navigation method */
history(): ()=>void
/** Set hash navigation method */
hash(): ()=>void
/** Set memory navigation method */
memory(): ()=>void
}
interface TinroRouterLocationHash {
/** Get current hash value*/
get(): string
/** Set current hash value*/
set(value:string): void
/** Clear current hash value*/
clear(): void
}
interface TinroRouterLocationQuery {
/** Get the query object or a value from it by property name */
get(name?:string): Record<string, string>|string
/** Update or add a property in the query object */
set(name:string,value:string|number): void
/** Delete a property from the query object */
delete(name:string): void
/** Replace value of the query object */
replace(value: Record<string, string>): void
/** Clear the query object */
clear(): void
}
interface TinroRouterLocation {
hash: TinroRouterLocationHash
query: TinroRouterLocationQuery
}
declare interface TinroRouter {
/** Point browser to the URL */
goto(url: string, replace?: boolean): void
/** Get current route object on URL change */
subscribe(handler: (currentRoute: TinroRoute) => void)
/** Switch navigatin method */
mode: TinroRouterModeSwitcher
/** Location object methods */
location: TinroRouterLocation
/** @deprecated Use meta().params instead */
params(): Record<string, string>
/** @deprecated Use router.mode.hash() instead*/
useHashNavigation(use?: boolean): void
/** @deprecated Import `meta` from `tinro` package directly */
meta(): TinroRouteMeta
}
export const active: any
export function meta(): TinroRouteMeta
export const router: TinroRouter
export class Route {
$$prop_def: {
/**
* Exact o relative path of the route
* @default "/*"
*/
path?: string;
/**
* Is route fallback
* @default false
*/
fallback?: boolean;
/**
* Redirect route to the specified path
*/
redirect?: string;
/**
* Will be show only first matched with URL nested route
* @default false
*/
firstmatch?: boolean;
/**
* Name of the route to use in breadcrumbs
* @default null
*/
breadcrumb?: string;
};
$$slot_def: { default: {
/** Current meta for the route */
meta: TinroRouteMeta
/** @deprecated Use meta.params instead */
params: Record<string, string>
} };
}