@nano_kit/router 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/constants.ts","../src/diy.ts","../src/utils.ts","../src/navigation.ts","../src/searchParams.ts","../src/paths.ts","../src/router.ts","../src/di.ts"],"sourcesContent":["export const PushHistoryAction = 'push'\nexport const ReplaceHistoryAction = 'replace'\nexport const PopHistoryAction = 'pop'\n","import type { Navigation } from './navigation.js'\n\n/**\n * Handle link click events to navigate using the router.\n * @param this - Router navigation object\n * @param event - MouseEvent from the click\n */\nexport function onLinkClick(\n this: Navigation,\n event: Pick<MouseEvent, 'target' | 'button' | 'defaultPrevented' | 'altKey' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'preventDefault'>\n) {\n const link = (event.target as HTMLElement).closest('a')\n\n if (\n link\n && event.button === 0 // Left mouse button\n && link.target !== '_blank' // Not for new tab\n && link.origin === location.origin // Not external link\n && link.rel !== 'external' // Not external link\n && link.target !== '_self' // Now manually disabled\n && !link.download // Not download link\n && !event.altKey // Not download link by user\n && !event.metaKey // Not open in new tab by user\n && !event.ctrlKey // Not open in new tab by user\n && !event.shiftKey // Not open in new window by user\n && !event.defaultPrevented // Click was not cancelled\n ) {\n event.preventDefault()\n this.push(link.href)\n }\n}\n\n/**\n * Effect to listen for link clicks and navigate using the router.\n * @param navigation - Router navigation object\n * @returns Cleanup function to remove the event listener\n */\nexport function listenLinks(navigation: Navigation) {\n const onClick = onLinkClick.bind(navigation)\n\n document.body.addEventListener('click', onClick)\n\n return () => {\n document.body.removeEventListener('click', onClick)\n }\n}\n\n/**\n * Reset scroll position to the top of the page.\n */\nexport function resetScroll() {\n window.scrollTo(0, 0)\n}\n\n/**\n * Scroll to an anchor on the page.\n * @param hash - The anchor hash (e.g., #section1)\n * @param options - `scrollIntoView` options\n */\nexport function scrollToAnchor(hash: string, options?: ScrollIntoViewOptions) {\n if (hash) {\n const id = hash.slice(1)\n const anchor = document.getElementById(id) || document.getElementsByName(id)[0]\n\n if (anchor) {\n anchor.scrollIntoView(options)\n }\n }\n}\n\n/**\n * Utility class to save and restore scroll positions using session storage.\n */\nexport class ScrollRestorator {\n readonly #storageKeyPrefix: string\n\n /**\n * Create a ScrollRestorator instance.\n * @param storageKeyPrefix - Prefix for session storage keys\n */\n constructor(storageKeyPrefix = 'krsp-') {\n this.#storageKeyPrefix = storageKeyPrefix\n }\n\n /**\n * Save the current scroll position for the given location.\n * @param location - The location object\n */\n save(location: Location) {\n sessionStorage.setItem(this.#storageKeyPrefix + location.href, String(window.scrollY))\n }\n\n /**\n * Restore the scroll position for the given location.\n * @param location - The location object\n * @returns True if a saved position was restored, false otherwise\n */\n restore(location: Location) {\n const key = this.#storageKeyPrefix + location.href\n const value = parseInt(sessionStorage.getItem(key)!)\n\n if (!isNaN(value)) {\n window.scrollTo(0, value)\n this.clear(location)\n\n return true\n }\n\n return false\n }\n\n /**\n * Clear the saved scroll position for the given location.\n * @param location - The location object\n */\n clear(location: Location) {\n sessionStorage.removeItem(this.#storageKeyPrefix + location.href)\n }\n}\n","import type {\n UrlUpdate,\n UrlObject,\n UrlHrefObject,\n HistoryAction,\n Location\n} from './types.js'\n\n/**\n * Removes trailing slash from a path string.\n * @param path - The path string to process.\n * @returns The path string without a trailing slash.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function removeTrailingSlash(path: string) {\n return path.replace(/(.)\\/($|\\?)/, '$1$2')\n}\n\n/**\n * Parses a href string into a URL object.\n * @param href - The href string to parse.\n * @returns URL object representing the parsed href.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function parseHref(href: string) {\n return new URL(removeTrailingSlash(href), 'http://a')\n}\n\n/**\n * Generates a href string from a URL object.\n * @param location - The URL object containing pathname, search, and hash.\n * @returns The generated href string.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function getHref(location: UrlObject): string {\n return removeTrailingSlash(location.pathname + location.search + location.hash)\n}\n\n/**\n * Creates an URL object with href from a UrlObject.\n * @param url - The UrlObject containing pathname, search, and hash.\n * @returns UrlHrefObject with generated href.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function createHrefObject(url: UrlObject): UrlHrefObject {\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n href: getHref(url)\n }\n}\n\n/**\n * Applies navigation updates to an UrlObject.\n * @param url - The original UrlObject to update.\n * @param update - Navigation update string or UrlUpdate object with partial URL components.\n * @returns Updated UrlHrefObject.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function updateHrefObject(\n url: UrlObject,\n update: string | UrlUpdate\n): UrlHrefObject {\n const updateObject = typeof update === 'string'\n ? parseHref(update)\n : update\n const updatedUrl = parseHref(updateObject.pathname ?? url.pathname)\n\n updatedUrl.search = updateObject.search ?? url.search\n updatedUrl.hash = updateObject.hash ?? url.hash\n\n if (updateObject.searchParams) {\n updatedUrl.search = updateObject.searchParams.toString()\n }\n\n return createHrefObject(updatedUrl)\n}\n\n/**\n * Updates a href string with navigation changes.\n * @param href - The original href string to update.\n * @param update - Navigation update string or UrlUpdate object with partial URL components.\n * @returns Updated href string.\n */\nexport function updateHref(href: string, update: string | UrlUpdate): string {\n if (typeof update === 'string') {\n return removeTrailingSlash(update)\n }\n\n return updateHrefObject(parseHref(href), update).href\n}\n\n/**\n * Composes multiple matcher functions into a single matcher.\n * @param matchers - Array of matcher functions to compose.\n * @param nomatch - Value to return if no match is found (default: null).\n * @returns Composed matcher function.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function composeMatchers<A extends unknown[], R = unknown, N = null>(\n matchers: ((...args: [...A]) => R | N)[],\n nomatch: N = null as N\n) {\n const len = matchers.length\n\n return (...args: A) => {\n for (let i = 0, result; i < len; i++) {\n if (result = matchers[i](...args)) {\n return result\n }\n }\n\n return nomatch\n }\n}\n\n/**\n * Creates a location object with action for navigation.\n * @param url - The UrlObject representing the location.\n * @param action - The history action associated with the location (default: null).\n * @returns Location object with URL and action.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function createLocation(\n url: UrlObject,\n action: HistoryAction = null\n): Location {\n return {\n ...createHrefObject(url),\n action\n }\n}\n\n/**\n * Updates a location object with navigation changes.\n * @param url - The original UrlObject to update.\n * @param update - Navigation update string or UrlUpdate object with partial URL components.\n * @param action - The history action associated with the updated location.\n * @returns Updated Location object.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function updateLocation(\n url: UrlObject,\n update: string | UrlUpdate,\n action: HistoryAction\n): Location {\n return {\n ...updateHrefObject(url, update),\n action\n }\n}\n","import {\n type KeysOf,\n type ValueOfKey,\n type ReadableSignal,\n type WritableSignal,\n atIndex,\n onMount,\n readonly,\n record,\n signal,\n batch,\n updateList,\n action,\n computed,\n untracked,\n mountable\n} from '@nano_kit/store'\nimport type {\n Location,\n Routes\n} from './types.js'\nimport type {\n Navigation,\n RouteLocation,\n RouteLocationRecord,\n RouteMatch\n} from './navigation.types.js'\nimport {\n PopHistoryAction,\n PushHistoryAction,\n ReplaceHistoryAction\n} from './constants.js'\nimport {\n composeMatchers,\n createLocation,\n parseHref,\n removeTrailingSlash,\n updateLocation\n} from './utils.js'\n\nexport * from './navigation.types.js'\n\nfunction createPatternRegex(pattern: string) {\n return new RegExp(`^${\n removeTrailingSlash(pattern)\n // Escape all special regex characters\n .replace(/[\\s!#$()+,.:<=?[\\\\\\]^{|}]/g, '\\\\$&')\n // /:param? -> (?:/(?<param>(?<=/)[^/]+))?\n .replace(/\\/\\\\:(\\w+)\\\\\\?/g, '(?:/(?<$1>(?<=/)[^/]+))?')\n // /:param -> /(?<param>[^/]+)\n .replace(/\\/\\\\:(\\w+)/g, '/(?<$1>[^/]+)')\n // /* - > (?:/(?<wildcard>.+))?$\n .replace(/\\/\\*$/g, '(?:/(?<wildcard>.+))?$')\n }/?$`, 'i')\n}\n\nfunction patternMatcher(this: RegExp, route: string, path: string) {\n const matches = path.match(this)\n\n if (!matches) {\n return null\n }\n\n const params: Record<string, string> = {}\n\n if (matches.groups) {\n Object.entries(matches.groups).forEach(([key, value]) => {\n params[key] = value\n ? decodeURIComponent(value)\n : ''\n })\n }\n\n return {\n route,\n params\n }\n}\n\nconst nomatch = {\n route: null,\n params: {}\n}\n\nfunction createMatcher(routes: Routes) {\n return composeMatchers(Object.entries(routes).map(\n ([route, pattern]) => patternMatcher.bind(\n createPatternRegex(pattern),\n route\n )\n ), nomatch)\n}\n\n// For SSR purposes, create matcher once\nconst matcherCache = new WeakMap<Routes, ReturnType<typeof createMatcher>>()\n\nfunction createCachedMatcher(routes: Routes) {\n let matcher = matcherCache.get(routes)\n\n if (!matcher) {\n matcher = createMatcher(routes)\n matcherCache.set(routes, matcher)\n }\n\n return matcher\n}\n\nfunction applyBrowserLocation({ href, action }: Location) {\n if (action === PushHistoryAction) {\n history.pushState(null, '', href)\n } else if (action === ReplaceHistoryAction) {\n history.replaceState(null, '', href)\n }\n}\n\n/**\n * Creates a browser navigation instance with route matching.\n * @param routes - Routes object defining path patterns.\n * @returns Tuple of current location signal and navigation methods object.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function browserNavigation<const R extends Routes = {}>(\n routes: R = {} as R\n): [RouteLocationRecord<R>, Navigation] {\n const match = createCachedMatcher(routes)\n const routerLocation = (location: Location) => ({\n ...location,\n ...match(location.pathname)\n }) as RouteLocation<R>\n const $location = mountable(signal(\n routerLocation(createLocation(location))\n ))\n const update = (location: RouteLocation<R> | null) => {\n if (location !== null) {\n applyBrowserLocation(location)\n $location(location)\n }\n }\n const maybeUpdate = (nextLocation: Location) => {\n const location = $location()\n\n if (\n location.href !== nextLocation.href\n // Always update if there is a hash change\n // (to allow scrolling to anchors on the same page)\n || nextLocation.hash.length > 1\n ) {\n const { action } = nextLocation\n const nextRouteLocation = routerLocation(nextLocation)\n\n if (action === null || action === PopHistoryAction) {\n update(nextRouteLocation)\n } else {\n navigation.transition(\n update,\n nextRouteLocation,\n location\n )\n }\n }\n }\n const sync = (event?: unknown) => {\n maybeUpdate(\n createLocation(\n location,\n event ? PopHistoryAction : null\n )\n )\n }\n const navigation: Navigation = {\n transition(fn, nextLocation) {\n fn(nextLocation)\n },\n get length() {\n return history.length\n },\n back: action(() => {\n navigation.transition(history.back, null, $location())\n }),\n forward: action(() => {\n navigation.transition(history.forward, null, $location())\n }),\n push: action((to) => {\n maybeUpdate(\n updateLocation(location, to, PushHistoryAction)\n )\n }),\n replace: action((to) => {\n maybeUpdate(\n updateLocation(location, to, ReplaceHistoryAction)\n )\n })\n }\n\n onMount($location, () => {\n sync()\n\n window.addEventListener('popstate', sync)\n\n return () => {\n window.removeEventListener('popstate', sync)\n }\n })\n\n return [record(readonly($location)), navigation]\n}\n\n/**\n * Creates a virtual navigation instance with route matching.\n * @param initialPath - Initial path for the virtual navigation (default: '/').\n * @param routes - Routes object defining path patterns.\n * @returns Tuple of current location signal and navigation methods object.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function virtualNavigation<const R extends Routes = {}>(\n initialPath = '/',\n routes: R = {} as R\n): [RouteLocationRecord<R>, Navigation] {\n const match = createCachedMatcher(routes)\n const routerLocation = (location: Location) => ({\n ...location,\n ...match(location.pathname)\n }) as RouteLocation<R>\n const $history = signal(\n [routerLocation(createLocation(parseHref(initialPath)))]\n )\n const $activeIndex = signal(0)\n const $location = mountable(atIndex($history, $activeIndex) as WritableSignal<RouteLocation<R>>)\n const go = (steps: number) => {\n const newIndex = Math.max(0, Math.min(\n $history().length - 1,\n $activeIndex() + steps\n ))\n\n batch(() => {\n $activeIndex(newIndex)\n $location((location): RouteLocation<R> => ({\n ...location,\n action: PopHistoryAction\n }))\n })\n }\n const back = () => go(-1)\n const forward = () => go(1)\n const update = (location: RouteLocation<R> | null) => {\n if (location !== null) {\n if (location.action === PushHistoryAction) {\n const activeIndex = $activeIndex()\n const nextIndex = activeIndex + 1\n\n batch(() => {\n updateList($history, (history) => {\n history.splice(nextIndex, history.length - activeIndex - 1, location)\n })\n $activeIndex(nextIndex)\n })\n } else if (location.action === ReplaceHistoryAction) {\n $location(location)\n }\n }\n }\n const maybeUpdate = (nextLocation: Location, location: RouteLocation<R>) => {\n if (\n location.href !== nextLocation.href\n // Always update if there is a hash change\n // (to allow scrolling to anchors on the same page)\n || nextLocation.hash.length > 1\n ) {\n const nextRouteLocation = routerLocation(nextLocation)\n\n navigation.transition(\n update,\n nextRouteLocation,\n location\n )\n }\n }\n const navigation: Navigation = {\n transition(fn, location) {\n fn(location)\n },\n get length() {\n return untracked($history).length\n },\n back: action(() => {\n navigation.transition(back, null, $location())\n }),\n forward: action(() => {\n navigation.transition(forward, null, $location())\n }),\n push: action((to) => {\n const location = $location()\n\n maybeUpdate(\n updateLocation(location, to, PushHistoryAction),\n location\n )\n }),\n replace: action((to) => {\n const location = $location()\n\n maybeUpdate(\n updateLocation(location, to, ReplaceHistoryAction),\n location\n )\n })\n }\n\n return [record(readonly($location)), navigation]\n}\n\n/**\n * Computed signal for a specific route parameter.\n * @param $location - Current location signal.\n * @param key - Parameter key to extract.\n * @param parser - Optional parser function for the parameter value.\n * @returns Computed signal of the parameter value.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function routeParam<\n const R extends Routes,\n M extends RouteMatch<R> = RouteMatch<R>,\n K extends KeysOf<M['params']> = KeysOf<M['params']>,\n V extends ValueOfKey<M['params'], K> = ValueOfKey<M['params'], K>,\n T = V | undefined\n>(\n $location: RouteLocationRecord<R>,\n key: K,\n parser: (value: NoInfer<V> | undefined) => T = _ => _ as unknown as T\n): ReadableSignal<T> {\n const { $params } = $location as RouteLocationRecord<{}>\n\n return computed(() => parser(($params() as Record<K, V>)[key]))\n}\n","import {\n type ReadableSignal,\n computed\n} from '@nano_kit/store'\nimport type { Routes } from './types.js'\nimport type { RouteLocationRecord } from './navigation.types.js'\n\nexport type SearchParamsSignal = ReadableSignal<URLSearchParams>\n\n/**\n * Creates a computed signal that provides access to URL search parameters.\n * @param $location - Location signal record containing the current location state\n * @returns A computed signal that returns URLSearchParams instance\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function searchParams($location: RouteLocationRecord<Routes>): SearchParamsSignal {\n const { $search } = $location\n\n return computed(() => new URLSearchParams($search()))\n}\n\n/**\n * Creates a computed signal for a specific search parameter with optional parsing.\n * @param $searchParams - Search parameters signal\n * @param key - The parameter key to extract\n * @param parser - Optional function to parse the parameter value\n * @returns A computed signal that returns the parsed parameter value\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function searchParam<T = string | null>(\n $searchParams: SearchParamsSignal,\n key: string,\n parser: (value: string | null) => T = _ => _ as T\n): ReadableSignal<T> {\n return computed(() => parser($searchParams().get(key)))\n}\n","import type { AnyFn } from '@nano_kit/store'\nimport type { Routes } from './types.js'\nimport type { Paths } from './paths.types.js'\nimport { removeTrailingSlash } from './utils.js'\n\nexport * from './paths.types.js'\n\nfunction execPattern(\n this: (string | ((params: Record<string, string | number>) => string))[],\n params: Record<string, string | number>\n) {\n return this\n .map((part, i) => (i % 2 === 0 ? part as string : (part as (params: Record<string, string | number>) => string)(params)))\n .join('')\n}\n\nfunction partToFunction(part: string, i: number) {\n return (\n i % 2 === 0\n ? part\n : part === undefined\n ? (params: Record<string, string | number> = {}) => (\n params.wildcard\n ? `/${params.wildcard}`\n : ''\n )\n : (params: Record<string, string | number> = {}) => (\n part in params\n ? `/${encodeURIComponent(params[part])}`\n : ''\n )\n )\n}\n\nfunction patternToFunction(pattern: string) {\n const parts = pattern\n .split(/\\/(?::(\\w+)\\??|\\*)/g)\n .map(partToFunction)\n\n return execPattern.bind(parts)\n}\n\n/**\n * Builds path generators from route definitions.\n * Creates functions or static strings for generating URLs from route patterns.\n * @param routes - Object mapping route names to URL patterns\n * @returns Object with path generators for each route\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function buildPaths<const R extends Routes>(routes: R) {\n return Object.entries(routes).reduce<Record<string, string | AnyFn>>(\n (hrefs, [route, pattern]) => {\n if (/:|\\*/.test(pattern)) {\n hrefs[route] = patternToFunction(pattern)\n } else {\n hrefs[route] = removeTrailingSlash(pattern)\n }\n\n return hrefs\n },\n {}\n ) as Paths<R>\n}\n\n/**\n * Adds a base path to all route patterns.\n * @param base - The base path to prepend.\n * @param routes - The original route patterns.\n * @returns New route patterns with the base path prepended.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function basePath<const R extends Routes>(base: string | null | undefined, routes: R): R {\n if (!base) {\n return routes\n }\n\n const normalizedBase = removeTrailingSlash(base).replace(/^\\.\\//, '/')\n\n if (normalizedBase === '' || normalizedBase === '/') {\n return routes\n }\n\n return Object.entries(routes).reduce<Record<string, string>>(\n (paths, [route, pattern]) => {\n paths[route] = removeTrailingSlash(`${normalizedBase}${pattern}`)\n\n return paths\n },\n {}\n ) as R\n}\n","import {\n type ReadableSignal,\n type WritableSignal,\n computed,\n signal\n} from '@nano_kit/store'\nimport type { Routes } from './types.js'\nimport type { RouteLocationRecord } from './navigation.types.js'\nimport type {\n StoresPreload,\n PageMatchRef,\n LayoutMatchRef,\n MatchRef,\n ViewModuleLoader,\n LoadableRef,\n ViewRef,\n ViewRefGetter,\n UnknownLayoutMatchRef,\n UnknownMatchRef,\n UnknownPageMatchRef,\n UnknownComposer\n} from './router.types.js'\nimport { composeMatchers } from './utils.js'\n\nexport * from './router.types.js'\n\ntype Composed = (layout: unknown, page: unknown) => unknown\n\ntype UnknownMatcher = (route: string | null, composed: Composed) => ViewRef<unknown> | null\n\n/**\n * Load all lazy pages in the pages reference tree.\n * @param pages - Pages reference tree\n * @returns Promise that resolves when all pages are loaded\n */\nexport async function loadPages(\n pages: UnknownMatchRef[],\n tasks?: Set<Promise<unknown>>\n): Promise<void> {\n const allTasks = tasks ?? new Set()\n\n for (const ref of pages) {\n if ('expected' in ref) {\n ref.page(allTasks)\n } else {\n ref.layout(allTasks)\n void loadPages(ref.pages, allTasks)\n }\n }\n\n if (!tasks) {\n await Promise.all(allTasks)\n }\n}\n\n/**\n * Load a specific lazy page by route in the pages reference tree.\n * @param pages - Pages reference tree\n * @param route - Route name to load\n * @returns Promise that resolves when the page is loaded\n */\nexport async function loadPage<R extends Routes, K extends keyof R & string, P, L>(\n pages: MatchRef<K, P, L>[],\n route: K,\n tasks?: Set<Promise<unknown> | null>\n): Promise<void> {\n const allTasks = tasks ?? new Set()\n\n for (const ref of pages) {\n if ('expected' in ref) {\n if (ref.expected === route) {\n ref.page(allTasks)\n // Page can be not async loadable\n allTasks.add(null)\n break\n }\n } else\n if (allTasks.size < (loadPage(ref.pages, route, allTasks), allTasks.size)) {\n ref.layout(allTasks)\n break\n }\n }\n\n if (!tasks) {\n await Promise.all(allTasks)\n }\n}\n\n/**\n * Define a loadable view.\n * @param load - Function that loads the view module\n * @param fallback - Optional fallback view while loading\n * @returns Loadable view reference object\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function loadable<const V>(\n load: ViewModuleLoader<V>,\n fallback?: V\n): LoadableRef<V> {\n const $viewRef = signal<ViewRef<V>>({\n view: fallback,\n loading: true\n })\n const init = (tasks?: Set<Promise<unknown> | null>) => {\n const promise = load().then(module => $viewRef({\n view: module.default,\n storesToPreload: module.storesToPreload,\n loading: false\n }))\n\n tasks?.add(promise)\n }\n let initialized = false\n\n return {\n load(tasks) {\n if (!initialized) {\n initialized = true\n init(tasks)\n }\n\n return $viewRef()\n }\n }\n}\n\nfunction isLoadable<C = unknown>(ref: unknown): ref is LoadableRef<C> {\n return typeof (ref as LoadableRef<C>)?.load === 'function'\n}\n\nfunction getViewRefGetter<C>(\n page: C | LoadableRef<C>,\n storesToPreload: StoresPreload | undefined\n): ViewRefGetter<C> {\n let getter: ViewRefGetter<C>\n\n if (isLoadable(page)) {\n getter = page.load\n } else {\n const ref = {\n view: page,\n storesToPreload\n }\n\n getter = () => ref\n }\n\n return getter\n}\n\n/**\n * Define a page match reference for route matching.\n * @param expected - The expected route name to match\n * @param page - The page component or value to return when matched\n * @returns Page view reference object\n */\nexport function page<R extends string, const P>(\n expected: R,\n page: LoadableRef<P>\n): PageMatchRef<R, P>\n\n/**\n * Define a page match reference for route matching.\n * @param expected - The expected route name to match\n * @param page - The page component or value to return when matched\n * @param storesToPreload - Optional function to preload stores\n * @returns Page view reference object\n */\nexport function page<R extends string, const P>(\n expected: R,\n page: P,\n storesToPreload?: StoresPreload\n): PageMatchRef<R, P>\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function page<R extends string, const P>(\n expected: R,\n page: P | LoadableRef<P>,\n storesToPreload?: StoresPreload\n): PageMatchRef<R, P> {\n return {\n expected,\n page: getViewRefGetter(page, storesToPreload)\n }\n}\n\n/**\n * Define a page match reference for route matching.\n * @param expected - The expected route name to match\n * @param page - The page component or value to return when matched\n * @returns Page view reference object\n */\nexport function notFound<const P>(\n page: LoadableRef<P>\n): PageMatchRef<null, P>\n\n/**\n * Define a page match reference for route matching.\n * @param expected - The expected route name to match\n * @param page - The page component or value to return when matched\n * @param storesToPreload - Optional function to preload stores\n * @returns Page view reference object\n */\nexport function notFound<const P>(\n page: P,\n storesToPreload?: StoresPreload\n): PageMatchRef<null, P>\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function notFound<const P>(\n page: P | LoadableRef<P>,\n storesToPreload?: StoresPreload\n): PageMatchRef<null, P> {\n return {\n expected: null,\n page: getViewRefGetter(page, storesToPreload)\n }\n}\n\n/**\n * Define a layout match reference for nested route matching.\n * @param layout - The layout component or value\n * @param pages - Array of page or nested layout match references\n * @returns Layout match reference object\n */\nexport function layout<R extends string, P, const L>(\n layout: L | LoadableRef<L>,\n pages: MatchRef<R, P, L>[]\n): LayoutMatchRef<R, P, L>\n\n/**\n * Define a layout match reference for nested route matching.\n * @param layout - The layout component or value\n * @param pages - Array of page or nested layout match references\n * @param storesToPreload - Optional function to preload stores\n * @returns Layout match reference object\n */\nexport function layout<R extends string, P, const L>(\n layout: L,\n storesToPreload: StoresPreload,\n pages: MatchRef<R, P, L>[]\n): LayoutMatchRef<R, P, L>\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function layout(\n layout: unknown,\n stroesToPreloadOrPages: StoresPreload | UnknownMatchRef[],\n maybePages?: UnknownMatchRef[]\n) {\n let pages: UnknownMatchRef[]\n let storesToPreload: StoresPreload | undefined\n\n if (maybePages === undefined) {\n pages = stroesToPreloadOrPages as UnknownMatchRef[]\n } else {\n pages = maybePages\n storesToPreload = stroesToPreloadOrPages as StoresPreload\n }\n\n return {\n layout: getViewRefGetter(layout, storesToPreload),\n pages\n }\n}\n\nfunction createMatcher(pages: UnknownMatchRef[]): UnknownMatcher {\n return composeMatchers(pages.map(\n ref => ('expected' in ref\n ? createPageMatcher(ref)\n : createLayoutMatcher(ref))\n ))\n}\n\n// For SSR purposes, create matcher once\nconst matcherCache = new WeakMap<UnknownMatchRef[], ReturnType<typeof createMatcher>>()\n\nfunction createCachedMatcher(pages: UnknownMatchRef[]) {\n let matcher = matcherCache.get(pages)\n\n if (!matcher) {\n matcher = createMatcher(pages)\n matcherCache.set(pages, matcher)\n }\n\n return matcher\n}\n\nfunction createPageMatcher({ expected, page }: UnknownPageMatchRef): UnknownMatcher {\n return (route: string | null) => (route === expected ? page() : null)\n}\n\nfunction createLayoutMatcher({ layout, pages }: UnknownLayoutMatchRef): UnknownMatcher {\n const match = createCachedMatcher(pages)\n\n return (route: string | null, composed: Composed) => {\n const ref = match(route, composed)\n\n if (ref) {\n const layoutRef = layout()\n\n if (layoutRef.loading || !layoutRef.view) {\n return layoutRef\n }\n\n const storesToPreload = () => [\n ...layoutRef.storesToPreload?.() ?? [],\n ...ref.storesToPreload?.() ?? []\n ]\n\n return {\n view: composed(layoutRef.view, ref.view),\n storesToPreload\n }\n }\n\n return null\n }\n}\n\nfunction createComposed(compose: UnknownComposer | undefined): Composed {\n const storage = new Map<unknown, {\n page: WritableSignal<unknown>\n composed: unknown\n }>()\n\n return (layout: unknown, page: unknown) => {\n let entry = storage.get(layout)\n\n if (!entry) {\n const $page = signal(page)\n\n entry = {\n page: $page,\n composed: compose?.($page, layout)\n }\n storage.set(layout, entry)\n } else {\n entry.page(() => page)\n }\n\n return entry.composed\n }\n}\n\n/**\n * Creates a computed signal that matches the current route against page definitions.\n * @param $location - Route match signal containing route and parameters\n * @param pages - Array of page match references\n * @returns Tuple of computed signal containing the matched page or null and function to preload stores\n */\nexport function router<R extends Routes, K extends keyof R & string, P>(\n $location: RouteLocationRecord<R>,\n pages: (\n | PageMatchRef<NoInfer<K>, P>\n | PageMatchRef<null, P>\n )[]\n): [ReadableSignal<P | null>, StoresPreload]\n\n/**\n * Creates a computed signal that matches the current route against page and layout definitions.\n * Supports nested layouts with composition function for combining layouts with nested content.\n * @param $location - Route match signal containing route and parameters\n * @param pages - Array of page and layout match references\n * @param compose - Function to compose layouts with nested content\n * @returns Tuple of computed signal containing the matched page or composed layout and function to preload stores\n */\nexport function router<R extends Routes, K extends keyof R & string, P, N, L, C>(\n $location: RouteLocationRecord<R>,\n pages: (\n | PageMatchRef<NoInfer<K>, P>\n | PageMatchRef<null, P>\n | LayoutMatchRef<NoInfer<K>, N, L>\n )[],\n compose: ($nested: ReadableSignal<N | null>, layout: L) => C\n): [ReadableSignal<P | C | null>, StoresPreload]\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function router(\n $location: RouteLocationRecord<Routes>,\n pages: UnknownMatchRef[],\n compose?: UnknownComposer\n): [ReadableSignal<unknown>, StoresPreload] {\n const { $route } = $location\n const match = createCachedMatcher(pages)\n const composed = createComposed(compose)\n let ref: ViewRef<unknown> | null = null\n const $page = computed(() => (ref = match($route(), composed))?.view ?? null)\n const storesToPreload = () => {\n $page()\n return ref?.storesToPreload?.() ?? []\n }\n\n return [$page, storesToPreload]\n}\n","import {\n type InjectionFactory,\n type ReadableSignal,\n inject\n} from '@nano_kit/store'\nimport type { Routes } from './types.js'\nimport {\n type Navigation,\n type RouteLocationRecord,\n browserNavigation,\n virtualNavigation\n} from './navigation.js'\nimport {\n type LayoutMatchRef,\n type PageMatchRef,\n type StoresPreload,\n type UnknownComposer,\n type UnknownMatchRef,\n router\n} from './router.js'\n\n/**\n * Create browser navigation and location injection factories.\n * @param routes - Routes object defining path patterns.\n * @returns Tuple of location and navigation injection factories.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function browserNavigation$<const R extends Routes = {}>(\n routes: R = {} as R\n): [\n InjectionFactory<RouteLocationRecord<R>>,\n InjectionFactory<Navigation>\n] {\n const BrowserNavigation$ = () => browserNavigation(routes)\n const Location$ = () => inject(BrowserNavigation$)[0]\n const Navigation$ = () => inject(BrowserNavigation$)[1]\n\n return [\n Location$,\n Navigation$\n ]\n}\n\n/**\n * Create virtual navigation and location injection factories.\n * @param initialPath - Initial path for the virtual navigation (default: '/').\n * @param routes - Routes object defining path patterns.\n * @returns Tuple of location and navigation injection factories.\n */\n/* @__NO_SIDE_EFFECTS__ */\nexport function virtualNavigation$<const R extends Routes = {}>(\n initialPath?: string,\n routes?: R\n): [\n InjectionFactory<RouteLocationRecord<R>>,\n InjectionFactory<Navigation>\n] {\n const VirtualNavigation$ = () => virtualNavigation(initialPath, routes)\n const Location$ = () => inject(VirtualNavigation$)[0]\n const Navigation$ = () => inject(VirtualNavigation$)[1]\n\n return [\n Location$,\n Navigation$\n ]\n}\n\n/**\n * Creates a current route matching page injection factory.\n * @param Location$ - Injection factory for the route location record.\n * @param pages - Array of page match references.\n * @returns Tuple of page injection factory and stores preload injection factory.\n */\nexport function router$<R extends Routes, K extends keyof R & string, P>(\n Location$: InjectionFactory<RouteLocationRecord<R>>,\n pages: (\n | PageMatchRef<NoInfer<K>, P>\n | PageMatchRef<null, P>\n )[]\n): [\n InjectionFactory<ReadableSignal<P | null>>,\n InjectionFactory<StoresPreload>\n]\n\n/**\n * Creates a current route matching page and layout injection factory.\n * @param Location$ - Injection factory for the route location record.\n * @param pages - Array of page and layout match references.\n * @param compose - Function to compose layouts with nested content.\n * @returns Tuple of page injection factory and stores preload injection factory.\n */\nexport function router$<R extends Routes, K extends keyof R & string, P, N, L, C>(\n Location$: InjectionFactory<RouteLocationRecord<R>>,\n pages: (\n | PageMatchRef<NoInfer<K>, P>\n | PageMatchRef<null, P>\n | LayoutMatchRef<NoInfer<K>, N, L>\n )[],\n compose: ($nested: ReadableSignal<N | null>, layout: L) => C\n): [\n InjectionFactory<ReadableSignal<P | C | null>>,\n InjectionFactory<StoresPreload>\n]\n\n/* @__NO_SIDE_EFFECTS__ */\nexport function router$(\n Location$: InjectionFactory<RouteLocationRecord<Routes>>,\n pages: UnknownMatchRef[],\n compose?: UnknownComposer\n): [\n InjectionFactory<ReadableSignal<unknown>>,\n InjectionFactory<StoresPreload>\n] {\n const Router$ = () => router(\n inject(Location$),\n pages,\n compose!\n )\n const Page$ = () => inject(Router$)[0]\n const StoresToPreload$ = () => inject(Router$)[1]\n\n return [\n Page$,\n StoresToPreload$\n ]\n}\n"],"names":["location","createMatcher","matcherCache","createCachedMatcher","action","history","page","layout"],"mappings":";;AAAO,MAAM,iBAAA,GAAoB;AAC1B,MAAM,oBAAA,GAAuB;AAC7B,MAAM,gBAAA,GAAmB;;ACKzB,SAAS,YAEd,KAAA,EACA;AACA,EAAA,MAAM,IAAA,GAAQ,KAAA,CAAM,MAAA,CAAuB,OAAA,CAAQ,GAAG,CAAA;AAEtD,EAAA,IACE,IAAA,IACG,KAAA,CAAM,MAAA,KAAW,CAAA,IACjB,KAAK,MAAA,KAAW,QAAA,IAChB,IAAA,CAAK,MAAA,KAAW,SAAS,MAAA,IACzB,IAAA,CAAK,GAAA,KAAQ,UAAA,IACb,KAAK,MAAA,KAAW,OAAA,IAChB,CAAC,IAAA,CAAK,QAAA,IACN,CAAC,KAAA,CAAM,MAAA,IACP,CAAC,KAAA,CAAM,OAAA,IACP,CAAC,KAAA,CAAM,WACP,CAAC,KAAA,CAAM,QAAA,IACP,CAAC,MAAM,gBAAA,EACV;AACA,IAAA,KAAA,CAAM,cAAA,EAAe;AACrB,IAAA,IAAA,CAAK,IAAA,CAAK,KAAK,IAAI,CAAA;AAAA,EACrB;AACF;AAOO,SAAS,YAAY,UAAA,EAAwB;AAClD,EAAA,MAAM,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E,CAAC,CAAA;AACpD,EAAA,MAAM,WAAA,GAAc,MAAM,MAAA,CAAO,kBAAkB,EAAE,CAAC,CAAA;AAEtD,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA;AAAA,GACF;AACF;AAAA;AAwCO,SAAS,OAAA,CACd,SAAA,EACA,KAAA,EACA,OAAA,EAIA;AACA,EAAA,MAAM,UAAU,MAAM,MAAA;AAAA,IACpB,OAAO,SAAS,CAAA;AAAA,IAChB,KAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,MAAM,KAAA,GAAQ,MAAM,MAAA,CAAO,OAAO,EAAE,CAAC,CAAA;AACrC,EAAA,MAAM,gBAAA,GAAmB,MAAM,MAAA,CAAO,OAAO,EAAE,CAAC,CAAA;AAEhD,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,26 @@
1
+ import { type KeysOf, type ValueOfKey, type ReadableSignal } from '@nano_kit/store';
2
+ import type { Routes } from './types.js';
3
+ import type { Navigation, RouteLocationRecord, RouteMatch } from './navigation.types.js';
4
+ export * from './navigation.types.js';
5
+ /**
6
+ * Creates a browser navigation instance with route matching.
7
+ * @param routes - Routes object defining path patterns.
8
+ * @returns Tuple of current location signal and navigation methods object.
9
+ */
10
+ export declare function browserNavigation<const R extends Routes = {}>(routes?: R): [RouteLocationRecord<R>, Navigation];
11
+ /**
12
+ * Creates a virtual navigation instance with route matching.
13
+ * @param initialPath - Initial path for the virtual navigation (default: '/').
14
+ * @param routes - Routes object defining path patterns.
15
+ * @returns Tuple of current location signal and navigation methods object.
16
+ */
17
+ export declare function virtualNavigation<const R extends Routes = {}>(initialPath?: string, routes?: R): [RouteLocationRecord<R>, Navigation];
18
+ /**
19
+ * Computed signal for a specific route parameter.
20
+ * @param $location - Current location signal.
21
+ * @param key - Parameter key to extract.
22
+ * @param parser - Optional parser function for the parameter value.
23
+ * @returns Computed signal of the parameter value.
24
+ */
25
+ export declare function routeParam<const R extends Routes, M extends RouteMatch<R> = RouteMatch<R>, K extends KeysOf<M['params']> = KeysOf<M['params']>, V extends ValueOfKey<M['params'], K> = ValueOfKey<M['params'], K>, T = V | undefined>($location: RouteLocationRecord<R>, key: K, parser?: (value: NoInfer<V> | undefined) => T): ReadableSignal<T>;
26
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EAapB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAEV,MAAM,EACP,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,UAAU,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,uBAAuB,CAAA;AAc9B,cAAc,uBAAuB,CAAA;AA2ErC;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,EAC3D,MAAM,GAAE,CAAW,GAClB,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAkFtC;AAED;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,EAC3D,WAAW,SAAM,EACjB,MAAM,GAAE,CAAW,GAClB,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CA4FtC;AAED;;;;;;GAMG;AAEH,wBAAgB,UAAU,CACxB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EACvC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EACnD,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EACjE,CAAC,GAAG,CAAC,GAAG,SAAS,EAEjB,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACjC,GAAG,EAAE,CAAC,EACN,MAAM,GAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,CAA0B,GACpE,cAAc,CAAC,CAAC,CAAC,CAInB"}
@@ -0,0 +1,50 @@
1
+ import type { ReadableRecord, ReadableSignal, Mountable } from '@nano_kit/store';
2
+ import type { Routes, ParseUrl, UrlUpdate, Location } from './types.js';
3
+ export type RouteMatch<R extends Routes, K extends keyof R = keyof R> = {
4
+ [K in keyof R]: {
5
+ route: K;
6
+ params: ParseUrl<R[K]>;
7
+ };
8
+ }[K];
9
+ export type RouteLocation<R extends Routes> = Location & (RouteMatch<R> | {
10
+ route: null;
11
+ params: {};
12
+ });
13
+ export type RouteLocationSignal<R extends Routes> = Mountable<ReadableSignal<RouteLocation<R>>>;
14
+ export type RouteLocationRecord<R extends Routes> = ReadableRecord<RouteLocationSignal<R>>;
15
+ /**
16
+ * Navigation interface for managing route transitions.
17
+ */
18
+ export interface Navigation {
19
+ /**
20
+ * Handle a transition between two locations.
21
+ * You can redefine this method to perform custom actions like transition confirmation.
22
+ * @param fn - Function to execute during the transition.
23
+ * @param nextLocation - The next location to navigate to, or null.
24
+ * @param prevLocation - The previous location.
25
+ */
26
+ transition<R extends Routes = Routes>(fn: (nextLocation: RouteLocation<R> | null) => void, nextLocation: RouteLocation<R> | null, prevLocation: RouteLocation<R>): void;
27
+ /**
28
+ * Number of entries in the history stack.
29
+ */
30
+ length: number;
31
+ /**
32
+ * Navigate back in history.
33
+ */
34
+ back(): void;
35
+ /**
36
+ * Navigate forward in history.
37
+ */
38
+ forward(): void;
39
+ /**
40
+ * Navigate to a new URL by pushing a new entry onto the history stack.
41
+ * @param to - The target URL as a string or UrlUpdate object with partial URL components.
42
+ */
43
+ push(to: string | UrlUpdate): void;
44
+ /**
45
+ * Navigate to a new URL by replacing the current entry in the history stack.
46
+ * @param to - The target URL as a string or UrlUpdate object with partial URL components.
47
+ */
48
+ replace(to: string | UrlUpdate): void;
49
+ }
50
+ //# sourceMappingURL=navigation.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.types.d.ts","sourceRoot":"","sources":["../src/navigation.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACV,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACT,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI;KACrE,CAAC,IAAI,MAAM,CAAC,GAAG;QACd,KAAK,EAAE,CAAC,CAAA;QACR,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KACvB;CACF,CAAC,CAAC,CAAC,CAAA;AAEJ,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI,QAAQ,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG;IACxE,KAAK,EAAE,IAAI,CAAA;IACX,MAAM,EAAE,EAAE,CAAA;CACX,CAAC,CAAA;AAEF,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/F,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1F;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAClC,EAAE,EAAE,CACF,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,KAClC,IAAI,EACT,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,EACrC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,GAC7B,IAAI,CAAA;IACP;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,IAAI,IAAI,CAAA;IACZ;;OAEG;IACH,OAAO,IAAI,IAAI,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;CACtC"}
@@ -0,0 +1,18 @@
1
+ import type { Routes } from './types.js';
2
+ import type { Paths } from './paths.types.js';
3
+ export * from './paths.types.js';
4
+ /**
5
+ * Builds path generators from route definitions.
6
+ * Creates functions or static strings for generating URLs from route patterns.
7
+ * @param routes - Object mapping route names to URL patterns
8
+ * @returns Object with path generators for each route
9
+ */
10
+ export declare function buildPaths<const R extends Routes>(routes: R): Paths<R>;
11
+ /**
12
+ * Adds a base path to all route patterns.
13
+ * @param base - The base path to prepend.
14
+ * @param routes - The original route patterns.
15
+ * @returns New route patterns with the base path prepended.
16
+ */
17
+ export declare function basePath<const R extends Routes>(base: string | null | undefined, routes: R): R;
18
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG7C,cAAc,kBAAkB,CAAA;AAqChC;;;;;GAKG;AAEH,wBAAgB,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAYrD,KAAK,CAAC,CAAC,CAAC,CACd;AAED;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAmB9F"}
@@ -0,0 +1,7 @@
1
+ import type { Routes, ParseUrl } from './types.js';
2
+ type RemoveTrailingSlash<T extends string> = T extends '/' ? T : T extends `${infer U}/` ? U : T;
3
+ export type Paths<R extends Routes> = {
4
+ [K in keyof R]: ParseUrl<R[K], string | number> extends infer Params ? Params extends Record<string, never> ? RemoveTrailingSlash<R[K]> : {} extends Params ? (params?: Params) => string : (params: Params) => string : never;
5
+ };
6
+ export {};
7
+ //# sourceMappingURL=paths.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.types.d.ts","sourceRoot":"","sources":["../src/paths.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACT,MAAM,YAAY,CAAA;AAEnB,KAAK,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;AAEhG,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,IAAI;KACnC,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,MAAM,MAAM,GAChE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAClC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACzB,EAAE,SAAS,MAAM,GACf,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,GAC3B,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAC9B,KAAK;CACV,CAAA"}
@@ -0,0 +1,87 @@
1
+ import { type ReadableSignal } from '@nano_kit/store';
2
+ import type { Routes } from './types.js';
3
+ import type { RouteLocationRecord } from './navigation.types.js';
4
+ import type { StoresPreload, PageMatchRef, LayoutMatchRef, MatchRef, ViewModuleLoader, LoadableRef, UnknownMatchRef } from './router.types.js';
5
+ export * from './router.types.js';
6
+ /**
7
+ * Load all lazy pages in the pages reference tree.
8
+ * @param pages - Pages reference tree
9
+ * @returns Promise that resolves when all pages are loaded
10
+ */
11
+ export declare function loadPages(pages: UnknownMatchRef[], tasks?: Set<Promise<unknown>>): Promise<void>;
12
+ /**
13
+ * Load a specific lazy page by route in the pages reference tree.
14
+ * @param pages - Pages reference tree
15
+ * @param route - Route name to load
16
+ * @returns Promise that resolves when the page is loaded
17
+ */
18
+ export declare function loadPage<R extends Routes, K extends keyof R & string, P, L>(pages: MatchRef<K, P, L>[], route: K, tasks?: Set<Promise<unknown> | null>): Promise<void>;
19
+ /**
20
+ * Define a loadable view.
21
+ * @param load - Function that loads the view module
22
+ * @param fallback - Optional fallback view while loading
23
+ * @returns Loadable view reference object
24
+ */
25
+ export declare function loadable<const V>(load: ViewModuleLoader<V>, fallback?: V): LoadableRef<V>;
26
+ /**
27
+ * Define a page match reference for route matching.
28
+ * @param expected - The expected route name to match
29
+ * @param page - The page component or value to return when matched
30
+ * @returns Page view reference object
31
+ */
32
+ export declare function page<R extends string, const P>(expected: R, page: LoadableRef<P>): PageMatchRef<R, P>;
33
+ /**
34
+ * Define a page match reference for route matching.
35
+ * @param expected - The expected route name to match
36
+ * @param page - The page component or value to return when matched
37
+ * @param storesToPreload - Optional function to preload stores
38
+ * @returns Page view reference object
39
+ */
40
+ export declare function page<R extends string, const P>(expected: R, page: P, storesToPreload?: StoresPreload): PageMatchRef<R, P>;
41
+ /**
42
+ * Define a page match reference for route matching.
43
+ * @param expected - The expected route name to match
44
+ * @param page - The page component or value to return when matched
45
+ * @returns Page view reference object
46
+ */
47
+ export declare function notFound<const P>(page: LoadableRef<P>): PageMatchRef<null, P>;
48
+ /**
49
+ * Define a page match reference for route matching.
50
+ * @param expected - The expected route name to match
51
+ * @param page - The page component or value to return when matched
52
+ * @param storesToPreload - Optional function to preload stores
53
+ * @returns Page view reference object
54
+ */
55
+ export declare function notFound<const P>(page: P, storesToPreload?: StoresPreload): PageMatchRef<null, P>;
56
+ /**
57
+ * Define a layout match reference for nested route matching.
58
+ * @param layout - The layout component or value
59
+ * @param pages - Array of page or nested layout match references
60
+ * @returns Layout match reference object
61
+ */
62
+ export declare function layout<R extends string, P, const L>(layout: L | LoadableRef<L>, pages: MatchRef<R, P, L>[]): LayoutMatchRef<R, P, L>;
63
+ /**
64
+ * Define a layout match reference for nested route matching.
65
+ * @param layout - The layout component or value
66
+ * @param pages - Array of page or nested layout match references
67
+ * @param storesToPreload - Optional function to preload stores
68
+ * @returns Layout match reference object
69
+ */
70
+ export declare function layout<R extends string, P, const L>(layout: L, storesToPreload: StoresPreload, pages: MatchRef<R, P, L>[]): LayoutMatchRef<R, P, L>;
71
+ /**
72
+ * Creates a computed signal that matches the current route against page definitions.
73
+ * @param $location - Route match signal containing route and parameters
74
+ * @param pages - Array of page match references
75
+ * @returns Tuple of computed signal containing the matched page or null and function to preload stores
76
+ */
77
+ export declare function router<R extends Routes, K extends keyof R & string, P>($location: RouteLocationRecord<R>, pages: (PageMatchRef<NoInfer<K>, P> | PageMatchRef<null, P>)[]): [ReadableSignal<P | null>, StoresPreload];
78
+ /**
79
+ * Creates a computed signal that matches the current route against page and layout definitions.
80
+ * Supports nested layouts with composition function for combining layouts with nested content.
81
+ * @param $location - Route match signal containing route and parameters
82
+ * @param pages - Array of page and layout match references
83
+ * @param compose - Function to compose layouts with nested content
84
+ * @returns Tuple of computed signal containing the matched page or composed layout and function to preload stores
85
+ */
86
+ export declare function router<R extends Routes, K extends keyof R & string, P, N, L, C>($location: RouteLocationRecord<R>, pages: (PageMatchRef<NoInfer<K>, P> | PageMatchRef<null, P> | LayoutMatchRef<NoInfer<K>, N, L>)[], compose: ($nested: ReadableSignal<N | null>, layout: L) => C): [ReadableSignal<P | C | null>, StoresPreload];
87
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,WAAW,EAIX,eAAe,EAGhB,MAAM,mBAAmB,CAAA;AAG1B,cAAc,mBAAmB,CAAA;AAMjC;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,eAAe,EAAE,EACxB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,EAC/E,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAC1B,KAAK,EAAE,CAAC,EACR,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,EAC9B,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,QAAQ,CAAC,EAAE,CAAC,GACX,WAAW,CAAC,CAAC,CAAC,CA0BhB;AA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EAAE,GACzB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAuG1B;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,EACpE,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACjC,KAAK,EAAE,CACH,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CACxB,EAAE,GACF,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,aAAa,CAAC,CAAA;AAE5C;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC7E,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACjC,KAAK,EAAE,CACH,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3B,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,GACrB,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACnC,EAAE,EACH,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAC3D,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,aAAa,CAAC,CAAA"}
@@ -0,0 +1,54 @@
1
+ import type { AnyAccessor, ReadableSignal } from '@nano_kit/store';
2
+ export type StoresPreload = () => AnyAccessor[];
3
+ export interface ViewRef<V> {
4
+ /**
5
+ * The component or value of the view.
6
+ */
7
+ view: V | undefined;
8
+ /**
9
+ * Optional function to preload stores associated with the view.
10
+ */
11
+ storesToPreload?: StoresPreload;
12
+ /**
13
+ * Indicates if the view is loading.
14
+ */
15
+ loading?: boolean;
16
+ }
17
+ export type ViewRefGetter<V> = (tasks?: Set<Promise<unknown> | null>) => ViewRef<V>;
18
+ export interface PageMatchRef<R extends string | null, P> {
19
+ /**
20
+ * The expected route name to match.
21
+ */
22
+ expected: R;
23
+ /**
24
+ * Function to get the view reference for the matched page.
25
+ */
26
+ page: ViewRefGetter<P>;
27
+ }
28
+ export interface LayoutMatchRef<R extends string, P, L> {
29
+ /**
30
+ * Function to get the view reference for the layout.
31
+ */
32
+ layout: ViewRefGetter<L>;
33
+ /**
34
+ * Children match references for nested routes.
35
+ */
36
+ pages: MatchRef<R, P, L>[];
37
+ }
38
+ export type MatchRef<R extends string, P, L> = PageMatchRef<R, P> | PageMatchRef<null, P> | LayoutMatchRef<R, P, L>;
39
+ export interface ViewModule<V> {
40
+ default: V;
41
+ storesToPreload?: StoresPreload;
42
+ }
43
+ export type ViewModuleLoader<P> = () => Promise<ViewModule<P>>;
44
+ export interface LoadableRef<P> {
45
+ /**
46
+ * Function to load the view module asynchronously.
47
+ */
48
+ load: ViewRefGetter<P>;
49
+ }
50
+ export type UnknownPageMatchRef = PageMatchRef<string, unknown> | PageMatchRef<null, unknown>;
51
+ export type UnknownLayoutMatchRef = LayoutMatchRef<string, unknown, unknown>;
52
+ export type UnknownMatchRef = MatchRef<string, unknown, unknown>;
53
+ export type UnknownComposer = ($nested: ReadableSignal<unknown>, layout: unknown) => unknown;
54
+ //# sourceMappingURL=router.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.types.d.ts","sourceRoot":"","sources":["../src/router.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACf,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,aAAa,GAAG,MAAM,WAAW,EAAE,CAAA;AAE/C,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB;;OAEG;IACH,IAAI,E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MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAE7F,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAE5E,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAEhE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { type ReadableSignal } from '@nano_kit/store';
2
+ import type { Routes } from './types.js';
3
+ import type { RouteLocationRecord } from './navigation.types.js';
4
+ export type SearchParamsSignal = ReadableSignal<URLSearchParams>;
5
+ /**
6
+ * Creates a computed signal that provides access to URL search parameters.
7
+ * @param $location - Location signal record containing the current location state
8
+ * @returns A computed signal that returns URLSearchParams instance
9
+ */
10
+ export declare function searchParams($location: RouteLocationRecord<Routes>): SearchParamsSignal;
11
+ /**
12
+ * Creates a computed signal for a specific search parameter with optional parsing.
13
+ * @param $searchParams - Search parameters signal
14
+ * @param key - The parameter key to extract
15
+ * @param parser - Optional function to parse the parameter value
16
+ * @returns A computed signal that returns the parsed parameter value
17
+ */
18
+ export declare function searchParam<T = string | null>($searchParams: SearchParamsSignal, key: string, parser?: (value: string | null) => T): ReadableSignal<T>;
19
+ //# sourceMappingURL=searchParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchParams.d.ts","sourceRoot":"","sources":["../src/searchParams.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAA;AAEhE;;;;GAIG;AAEH,wBAAgB,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAIvF;AAED;;;;;;GAMG;AAEH,wBAAgB,WAAW,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,EAC3C,aAAa,EAAE,kBAAkB,EACjC,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,CAAe,GAChD,cAAc,CAAC,CAAC,CAAC,CAEnB"}
@@ -0,0 +1,34 @@
1
+ import type { ReadableSignal } from '@nano_kit/store';
2
+ export interface UrlObject {
3
+ hash: string;
4
+ pathname: string;
5
+ search: string;
6
+ }
7
+ export interface UrlHrefObject extends UrlObject {
8
+ href: string;
9
+ }
10
+ export interface UrlUpdate {
11
+ hash?: string;
12
+ pathname?: string;
13
+ search?: string;
14
+ searchParams?: URLSearchParams;
15
+ }
16
+ export type HistoryAction = 'push' | 'replace' | 'pop' | null;
17
+ export interface Location extends UrlHrefObject {
18
+ action: HistoryAction;
19
+ }
20
+ export type LocationSignal = ReadableSignal<Location>;
21
+ export type Routes = Record<string, string>;
22
+ type Split<S extends string, D extends string> = string extends S ? string[] : S extends '' ? [] : S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
23
+ type PathToParams<PathArray, Value = string, Params = {}> = PathArray extends [
24
+ infer First,
25
+ ...infer Rest
26
+ ] ? First extends `:${infer Param}` ? First extends `:${infer Param}?` ? PathToParams<Rest, Value, Params & Partial<Record<Param, Value>>> : PathToParams<Rest, Value, Params & Record<Param, Value>> : Rest extends [] ? First extends '*' ? Params & {
27
+ wildcard: Value;
28
+ } : PathToParams<Rest, Value, Params> : PathToParams<Rest, Value, Params> : Params;
29
+ type Simplify<T> = {
30
+ [K in keyof T]: T[K];
31
+ } & {};
32
+ export type ParseUrl<Path extends string, Value = string> = Simplify<PathToParams<Split<Path, '/'>, Value>>;
33
+ export {};
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAAA;AAE7D,MAAM,WAAW,QAAS,SAAQ,aAAa;IAC7C,MAAM,EAAE,aAAa,CAAA;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAErD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE3C,KAAK,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM,SAAS,CAAC,GAC7D,MAAM,EAAE,GACR,CAAC,SAAS,EAAE,GACV,EAAE,GACF,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,EAAE,GAClC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACnB,CAAC,CAAC,CAAC,CAAA;AAEX,KAAK,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,GAAG,EAAE,IAAI,SAAS,SAAS;IAC5E,MAAM,KAAK;IACX,GAAG,MAAM,IAAI;CACd,GACG,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,GAC7B,KAAK,SAAS,IAAI,MAAM,KAAK,GAAG,GAC9B,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GACjE,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAC1D,IAAI,SAAS,EAAE,GACb,KAAK,SAAS,GAAG,GACf,MAAM,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GAC5B,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GACnC,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GACrC,MAAM,CAAA;AAEV,KAAK,QAAQ,CAAC,CAAC,IAAI;KAChB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG,EAAE,CAAA;AAEN,MAAM,MAAM,QAAQ,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,GAAG,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,62 @@
1
+ import type { UrlUpdate, UrlObject, UrlHrefObject, HistoryAction, Location } from './types.js';
2
+ /**
3
+ * Removes trailing slash from a path string.
4
+ * @param path - The path string to process.
5
+ * @returns The path string without a trailing slash.
6
+ */
7
+ export declare function removeTrailingSlash(path: string): string;
8
+ /**
9
+ * Parses a href string into a URL object.
10
+ * @param href - The href string to parse.
11
+ * @returns URL object representing the parsed href.
12
+ */
13
+ export declare function parseHref(href: string): URL;
14
+ /**
15
+ * Generates a href string from a URL object.
16
+ * @param location - The URL object containing pathname, search, and hash.
17
+ * @returns The generated href string.
18
+ */
19
+ export declare function getHref(location: UrlObject): string;
20
+ /**
21
+ * Creates an URL object with href from a UrlObject.
22
+ * @param url - The UrlObject containing pathname, search, and hash.
23
+ * @returns UrlHrefObject with generated href.
24
+ */
25
+ export declare function createHrefObject(url: UrlObject): UrlHrefObject;
26
+ /**
27
+ * Applies navigation updates to an UrlObject.
28
+ * @param url - The original UrlObject to update.
29
+ * @param update - Navigation update string or UrlUpdate object with partial URL components.
30
+ * @returns Updated UrlHrefObject.
31
+ */
32
+ export declare function updateHrefObject(url: UrlObject, update: string | UrlUpdate): UrlHrefObject;
33
+ /**
34
+ * Updates a href string with navigation changes.
35
+ * @param href - The original href string to update.
36
+ * @param update - Navigation update string or UrlUpdate object with partial URL components.
37
+ * @returns Updated href string.
38
+ */
39
+ export declare function updateHref(href: string, update: string | UrlUpdate): string;
40
+ /**
41
+ * Composes multiple matcher functions into a single matcher.
42
+ * @param matchers - Array of matcher functions to compose.
43
+ * @param nomatch - Value to return if no match is found (default: null).
44
+ * @returns Composed matcher function.
45
+ */
46
+ export declare function composeMatchers<A extends unknown[], R = unknown, N = null>(matchers: ((...args: [...A]) => R | N)[], nomatch?: N): (...args: A) => N | NonNullable<R>;
47
+ /**
48
+ * Creates a location object with action for navigation.
49
+ * @param url - The UrlObject representing the location.
50
+ * @param action - The history action associated with the location (default: null).
51
+ * @returns Location object with URL and action.
52
+ */
53
+ export declare function createLocation(url: UrlObject, action?: HistoryAction): Location;
54
+ /**
55
+ * Updates a location object with navigation changes.
56
+ * @param url - The original UrlObject to update.
57
+ * @param update - Navigation update string or UrlUpdate object with partial URL components.
58
+ * @param action - The history action associated with the updated location.
59
+ * @returns Updated Location object.
60
+ */
61
+ export declare function updateLocation(url: UrlObject, update: string | UrlUpdate, action: HistoryAction): Location;
62
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","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
+ "name": "@nano_kit/router",
3
+ "type": "module",
4
+ "version": "1.0.0-alpha.4",
5
+ "description": "A small and powerful router for @nano_kit/store state manager.",
6
+ "author": "dangreen",
7
+ "license": "MIT",
8
+ "homepage": "https://nano_kit.js.org/router",
9
+ "funding": "https://ko-fi.com/dangreen",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/TrigenSoftware/nano_kit.git",
13
+ "directory": "packages/router"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/TrigenSoftware/nano_kit/issues"
17
+ },
18
+ "keywords": [
19
+ "router",
20
+ "routing",
21
+ "navigation",
22
+ "store",
23
+ "state",
24
+ "signal",
25
+ "reactive",
26
+ "nano_kit"
27
+ ],
28
+ "engines": {
29
+ "node": ">=16"
30
+ },
31
+ "sideEffects": false,
32
+ "exports": {
33
+ "./package.json": "./package.json",
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "peerDependencies": {
43
+ "@nano_kit/store": "^1.0.0-alpha.0"
44
+ }
45
+ }