@modastar/z-router 0.0.5 → 0.0.7
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.
- package/dist/index.cjs +1 -540
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -58
- package/dist/index.d.ts +73 -58
- package/dist/index.js +1 -495
- package/dist/index.js.map +1 -1
- package/example/index.html +14 -0
- package/example/package.json +25 -0
- package/example/pnpm-lock.yaml +1417 -0
- package/example/pnpm-workspace.yaml +2 -0
- package/example/vite.config.ts +14 -0
- package/package.json +7 -3
- package/vite.config.ts +10 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/context/locationContext.ts","../src/components/locationProvider.tsx","../src/components/routeComponent.tsx","../src/hooks/useRouter.ts","../src/context/routerContext.ts","../src/components/routerProvider.tsx","../src/utils.ts","../src/components/stack.tsx","../src/hooks/useLocation.ts","../src/hooks/useRoute.ts","../src/context/routeContext.ts","../src/hooks/useMatches.ts","../src/components/routeProvider.tsx","../src/types.d.ts"],"sourcesContent":["export * from \"./components/index.js\";\nexport * from \"./context/index.js\";\nexport * from \"./hooks/index.js\";\nexport * from \"./types.d.js\";\nexport * from \"./utils.js\";\n","import { createContext } from \"react\";\n\nimport type { Location } from \"@/types.js\";\n\nexport const LocationContext = createContext<Location | null>(null);\n","import { LocationContext } from \"@/context/locationContext.js\";\nimport type { Location } from \"@/types.js\";\n\nexport const LocationProvider = ({\n location,\n children,\n}: {\n location: Location;\n children: React.ReactNode;\n}) => {\n return (\n <LocationContext.Provider value={location}>\n {children}\n </LocationContext.Provider>\n );\n};\n","import { useEffect, useState } from \"react\";\n\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport type { Route } from \"@/types.js\";\n\nexport const RouteComponent = ({\n route,\n children,\n}: {\n route: Route;\n children?: React.ReactNode;\n}) => {\n const router = useRouter();\n const [pending, setPending] = useState(!!route.beforeLoad);\n\n useEffect(() => {\n if (route.beforeLoad) {\n route\n .beforeLoad({ location: router.location! })\n .catch((error: unknown) => {\n if (\n error instanceof Error &&\n typeof error.cause === \"object\" &&\n error.cause !== null &&\n \"to\" in error.cause\n ) {\n router.navigate({\n to: (error.cause as any).to,\n replace: (error.cause as any).replace,\n });\n }\n })\n .finally(() => setPending(false));\n }\n }, []);\n\n if (pending) {\n const PendingComponent = route.pendingComponent!;\n return <PendingComponent />;\n }\n\n const Component = route.component;\n return Component ? <Component>{children}</Component> : children;\n};\n","import { useContext } from \"react\";\n\nimport { RouterContext } from \"@/context/routerContext.js\";\n\nexport const useRouter = () => {\n const router = useContext(RouterContext);\n if (router === null) {\n throw new Error(\"useRouter must be used within a Stack\");\n }\n return router;\n};\n","import { createContext } from \"react\";\n\nimport type {\n BackOptions,\n ForwardOptions,\n Location,\n NavigateOptions,\n RouterOptions,\n} from \"@/types.js\";\n\nexport interface RouterContextType {\n // Router Config\n options: RouterOptions;\n\n // Navigation State\n history: Location[];\n currentLocationIndex: number;\n location: Location | null;\n canGoBack: boolean;\n canGoForward: boolean;\n\n // Transition state\n isTransitioning: boolean;\n transitionDuration: number;\n transitioningToIndex: number | null;\n\n // Actions\n navigate: (options: NavigateOptions) => void;\n back: (options: BackOptions) => void;\n forward: (options: ForwardOptions) => void;\n}\n\nexport const RouterContext = createContext<RouterContextType | null>(null);\n","import { useCallback, useEffect, useState } from \"react\";\n\nimport { RouterContext } from \"@/context/routerContext.js\";\nimport type {\n BackOptions,\n ForwardOptions,\n Location,\n NavigateOptions,\n RouterOptions,\n} from \"@/types.js\";\nimport { DefaultTransitionDuration } from \"@/utils.js\";\n\nexport const RouterProvider = ({\n router,\n children,\n}: {\n router: RouterOptions;\n children: React.ReactNode;\n}) => {\n const [history, setHistory] = useState<Location[]>([]);\n const [currentLocationIndex, setCurrentLocationIndex] = useState<number>(-1);\n const [isTransitioning, setIsTransitioning] = useState<boolean>(false);\n const [transitionDuration, setTransitionDuration] = useState<number>(\n DefaultTransitionDuration\n );\n const [transitioningToIndex, setTransitioningToIndex] = useState<\n number | null\n >(null);\n\n const navigate = useCallback(\n ({\n to,\n replace,\n transition,\n duration,\n updateHistory,\n onFinish,\n ...locationOptions\n }: NavigateOptions) => {\n if (isTransitioning) return;\n const newLocationIndex = replace\n ? currentLocationIndex\n : currentLocationIndex + 1;\n const newLocation: Location = {\n index: newLocationIndex,\n params: {},\n query: {},\n state: new Map(),\n pathname: to,\n ...locationOptions,\n };\n if (newLocationIndex === history.length) {\n setHistory([...history, newLocation]);\n } else {\n setHistory((prevHistory) => {\n const newHistory = [...prevHistory];\n newHistory[newLocationIndex] = newLocation;\n return newHistory.slice(0, currentLocationIndex + 2);\n });\n }\n if (\n !replace &&\n currentLocationIndex >= 0 &&\n (transition ??\n router.defaultViewTransition?.(\n history.at(currentLocationIndex),\n history.at(newLocationIndex)\n ))\n ) {\n const currentDuration = duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(currentDuration);\n setTransitioningToIndex(newLocationIndex);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(null);\n setCurrentLocationIndex(newLocationIndex);\n onFinish?.();\n if (updateHistory) {\n window.history.pushState({}, \"\", to);\n }\n }, currentDuration);\n } else if (!replace) {\n setCurrentLocationIndex(newLocationIndex);\n if (updateHistory) {\n window.history.pushState({}, \"\", to);\n }\n } else if (updateHistory) {\n window.history.replaceState({}, \"\", to);\n }\n },\n [currentLocationIndex, history, isTransitioning, router]\n );\n\n useEffect(() => {\n console.log(\"Navigate: History updated:\", history);\n }, [history]);\n\n const back = useCallback(\n (options: BackOptions) => {\n if (isTransitioning) return;\n const newLocationIndex = currentLocationIndex - (options?.depth ?? 1);\n if (\n currentLocationIndex > 0 &&\n (options?.transition ??\n router.defaultViewTransition?.(\n history.at(currentLocationIndex),\n history.at(newLocationIndex)\n ))\n ) {\n const currentDuration = options?.duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(currentDuration);\n setTransitioningToIndex(newLocationIndex);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(null);\n setCurrentLocationIndex(newLocationIndex);\n options?.onFinish?.();\n }, currentDuration);\n } else {\n setCurrentLocationIndex(newLocationIndex);\n }\n },\n [currentLocationIndex, history, isTransitioning, router]\n );\n\n const forward = useCallback(\n (options: ForwardOptions) => {\n if (isTransitioning) return;\n const newLocationIndex = currentLocationIndex + 1;\n if (\n newLocationIndex < history.length &&\n (options?.transition ??\n router.defaultViewTransition?.(\n history.at(currentLocationIndex),\n history.at(newLocationIndex)\n ))\n ) {\n const duration = options?.duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(duration);\n setTransitioningToIndex(newLocationIndex);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(null);\n setCurrentLocationIndex(newLocationIndex);\n options?.onFinish?.();\n }, duration);\n } else {\n setCurrentLocationIndex(newLocationIndex);\n }\n },\n [currentLocationIndex, history, isTransitioning, router]\n );\n\n return (\n <RouterContext.Provider\n value={{\n options: router,\n\n history,\n currentLocationIndex,\n location: history.at(currentLocationIndex) || null,\n canGoBack: currentLocationIndex > 0,\n canGoForward: currentLocationIndex < history.length - 1,\n\n isTransitioning,\n transitionDuration,\n transitioningToIndex,\n\n navigate,\n back,\n forward,\n }}\n >\n {children}\n </RouterContext.Provider>\n );\n};\n","import type { Location, RootRoute, Route, RouterOptions } from \"./types.js\";\n\nexport const DefaultTransitionDuration = 300;\n\nexport const redirect = (options: { to: string; replace?: boolean }) => {\n return new Error(\"\", { cause: options });\n};\n\nexport const matchUrl = (\n pattern: string,\n url: string\n): { params: Record<string, string>; query: Record<string, string> } | null => {\n try {\n // 解析 URL\n let pathname, searchParams;\n\n if (url.startsWith(\"http://\") || url.startsWith(\"https://\")) {\n const urlObj = new URL(url);\n pathname = urlObj.pathname;\n searchParams = urlObj.searchParams;\n } else {\n // 處理相對路徑\n const [path, queryString] = url.split(\"?\");\n if (!path) {\n return null;\n }\n pathname = path;\n searchParams = new URLSearchParams(queryString || \"\");\n }\n\n // 移除路徑首尾的斜線以便比較\n const cleanPath = pathname.replaceAll(/^\\/|\\/$/g, \"\");\n const cleanPattern = pattern.replaceAll(/^\\/|\\/$/g, \"\");\n\n // 分割路徑段\n const pathSegments = cleanPath.split(\"/\");\n const patternSegments = cleanPattern.split(\"/\");\n\n // 路徑段數量不同則不匹配\n if (pathSegments.length !== patternSegments.length) {\n return null;\n }\n\n // 提取路徑參數\n const params: Record<string, string> = {};\n for (let i = 0; i < patternSegments.length; i++) {\n const patternSegment = patternSegments[i];\n const pathSegment = pathSegments[i];\n\n if (patternSegment.startsWith(\":\")) {\n // 動態參數\n const paramName = patternSegment.slice(1);\n params[paramName] = decodeURIComponent(pathSegment);\n } else if (patternSegment !== pathSegment) {\n // 靜態段不匹配\n return null;\n }\n }\n\n // 提取查詢參數\n const query = Object.fromEntries(searchParams.entries());\n\n return { params, query };\n } catch {\n return null;\n }\n};\n\nexport const matchRoute = (\n rootRoute: RootRoute,\n url: string\n): {\n matches: Route[];\n params: Record<string, string>;\n query: Record<string, string>;\n} | null => {\n const _matchRoute = (\n matches: Route[],\n route: Route\n ): {\n matches: Route[];\n params: Record<string, string>;\n query: Record<string, string>;\n } | null => {\n if (route.children) {\n for (const childRoute of route.children) {\n const matchesResult = _matchRoute([...matches, childRoute], childRoute);\n if (matchesResult) {\n return matchesResult;\n }\n }\n return null;\n }\n\n let pattern = \"\";\n for (const match of matches) {\n if (match.pathname === undefined) continue;\n pattern += `/${match.pathname}`;\n }\n const result = matchUrl(pattern, url);\n if (result) {\n return { matches, ...result };\n }\n return null;\n };\n\n return _matchRoute([], rootRoute);\n};\n\nexport const parseLocationFromHref = (\n rootRoute: RootRoute,\n to: string\n): Pick<Location, \"pathname\" | \"params\" | \"query\"> | null => {\n const result = matchRoute(rootRoute, to);\n if (!result) return null;\n return {\n pathname: to,\n params: result.params,\n query: result.query,\n };\n};\n\nexport const createRouter = (options: RouterOptions): RouterOptions => {\n return options;\n};\n","import { useEffect, useState } from \"react\";\n\nimport { useMatches } from \"@/hooks/useMatches.js\";\nimport { useRoute } from \"@/hooks/useRoute.js\";\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport type { RootRoute } from \"@/types.js\";\n\nimport { LocationProvider } from \"./locationProvider.js\";\nimport { RouteComponent } from \"./routeComponent.js\";\nimport { RouteProvider } from \"./routeProvider.js\";\n\nexport const PageRenderer = () => {\n const route = useRoute();\n const matches = useMatches();\n if (!matches || matches.length === 0) {\n const NotFoundComponent = route.notFoundComponent!;\n return <NotFoundComponent />;\n }\n let content: React.ReactNode = null;\n for (let i = matches.length - 1; i >= 0; i--) {\n const route = matches[i];\n content = <RouteComponent route={route}>{content}</RouteComponent>;\n }\n return content;\n};\n\nconst StackComponent = () => {\n const {\n history,\n currentLocationIndex,\n canGoBack,\n canGoForward,\n isTransitioning,\n transitioningToIndex,\n transitionDuration,\n back,\n forward,\n } = useRouter();\n\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n const [dragOffset, setDragOffset] = useState(0);\n const [isCanceling, setIsCanceling] = useState(false);\n const [isTransitionStarted, setIsTransitionStarted] = useState(false);\n\n useEffect(() => {\n if (!isTransitioning || transitioningToIndex === null) return;\n setIsTransitionStarted(true);\n setTimeout(() => {\n setIsTransitionStarted(false);\n }, transitionDuration);\n }, [isTransitioning, transitioningToIndex]);\n\n const reset = () => {\n setIsDragging(false);\n setDragOffset(0);\n setIsCanceling(false);\n };\n\n const handleTouchStart = (e: React.TouchEvent) => {\n if (isTransitioning || (!canGoForward && !canGoBack)) return;\n setIsDragging(true);\n setStartX(e.touches[0].clientX);\n };\n\n const handleTouchMove = (e: React.TouchEvent) => {\n if (!isDragging) return;\n const offset = e.touches[0].clientX - startX;\n if (\n (offset > 0 && currentLocationIndex === 0) ||\n (offset < 0 && currentLocationIndex + 1 === history.length)\n ) {\n setDragOffset(0);\n return;\n }\n setDragOffset(Math.min(window.innerWidth, offset));\n };\n\n const handleTouchEnd = () => {\n if (!isDragging) return;\n\n if (dragOffset > window.innerWidth * 0.3 && canGoBack) {\n back({\n onFinish: reset,\n });\n } else if (dragOffset < -window.innerWidth * 0.3 && canGoForward) {\n forward({\n onFinish: reset,\n });\n } else {\n setIsCanceling(true);\n setTimeout(reset, transitionDuration);\n }\n };\n\n return (\n <div className=\"relative inset-0 h-full w-full overflow-hidden\">\n {currentLocationIndex >= 1 && (\n <div className=\"absolute inset-0 -z-10\">\n <LocationProvider location={history.at(currentLocationIndex - 1)!}>\n <PageRenderer key={currentLocationIndex - 1} />\n </LocationProvider>\n </div>\n )}\n <div\n key={currentLocationIndex}\n className=\"bg-background absolute inset-0 overflow-hidden\"\n style={{\n transform:\n isTransitioning &&\n transitioningToIndex !== null &&\n transitioningToIndex < currentLocationIndex\n ? `translateX(100%)`\n : isDragging && dragOffset > 0 && !isCanceling\n ? `translateX(${dragOffset}px)`\n : \"translateX(0px)\",\n transition:\n isCanceling ||\n (isTransitioning &&\n transitioningToIndex !== null &&\n transitioningToIndex < currentLocationIndex)\n ? `transform ${transitionDuration}ms ease-out`\n : \"\",\n boxShadow:\n isDragging && dragOffset > 0\n ? \"-4px 0 8px rgba(0,0,0,0.1)\"\n : \"none\",\n }}\n onTouchStart={handleTouchStart}\n onTouchMove={handleTouchMove}\n onTouchEnd={handleTouchEnd}\n >\n <LocationProvider location={history.at(currentLocationIndex)!}>\n <PageRenderer key={currentLocationIndex} />\n </LocationProvider>\n </div>\n {((isDragging && dragOffset < 0) ||\n (isTransitioning &&\n transitioningToIndex !== null &&\n currentLocationIndex < transitioningToIndex)) && (\n <div\n key={transitioningToIndex}\n className=\"bg-background absolute inset-0 z-10 overflow-hidden transition-transform ease-in\"\n style={{\n transform: isTransitionStarted\n ? `translateX(0px)`\n : isDragging && !isCanceling\n ? `translateX(${window.innerWidth + dragOffset}px)`\n : \"translateX(100%)\",\n transitionDuration:\n isTransitioning || isCanceling\n ? `${transitionDuration}ms`\n : \"0ms\",\n }}\n >\n <LocationProvider\n location={\n isDragging\n ? history.at(currentLocationIndex + 1)!\n : history.at(transitioningToIndex!)!\n }\n >\n <PageRenderer key={transitioningToIndex} />\n </LocationProvider>\n </div>\n )}\n </div>\n );\n};\n\nexport const Stack = ({ rootRoute }: { rootRoute: RootRoute }) => {\n return (\n <RouteProvider rootRoute={rootRoute}>\n <StackComponent />\n </RouteProvider>\n );\n};\n","import { useContext } from \"react\";\n\nimport { LocationContext } from \"@/context/locationContext.js\";\n\nexport const useLocation = () => {\n const context = useContext(LocationContext);\n if (context === null) {\n throw new Error(\"useLocation must be used within a LocationProvider\");\n }\n return context;\n};\n","import { useContext } from \"react\";\n\nimport { RouteContext } from \"@/context/routeContext.js\";\n\nexport const useRoute = () => {\n const route = useContext(RouteContext);\n if (route === null) {\n throw new Error(\"useRoute must be used within a RouteProvider\");\n }\n return route;\n};\n","import { createContext } from \"react\";\n\nimport type { RootRoute } from \"@/types.js\";\n\nexport const RouteContext = createContext<RootRoute | null>(null);\n","import { matchRoute } from \"@/utils.js\";\n\nimport { useLocation } from \"./useLocation.js\";\nimport { useRoute } from \"./useRoute.js\";\n\nexport const useMatches = () => {\n const route = useRoute();\n const location = useLocation();\n if (!location) return [];\n return matchRoute(route, location.pathname)?.matches || [];\n};\n","import { useEffect } from \"react\";\n\nimport { RouteContext } from \"@/context/routeContext.js\";\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport type { RootRoute } from \"@/types.js\";\nimport { parseLocationFromHref } from \"@/utils.js\";\n\nexport const RouteProvider = ({\n rootRoute,\n children,\n}: {\n rootRoute: RootRoute;\n children: React.ReactNode;\n}) => {\n const router = useRouter();\n\n useEffect(() => {\n const currentLocation = parseLocationFromHref(\n rootRoute,\n window.location.href\n );\n if (!currentLocation) return;\n router.navigate({\n to: currentLocation.pathname,\n params: currentLocation.params,\n query: currentLocation.query,\n });\n return () => {\n router.back();\n };\n }, []);\n\n return (\n <RouteContext.Provider value={rootRoute}>{children}</RouteContext.Provider>\n );\n};\n","export interface Route {\n id?: string;\n pathname?: string;\n beforeLoad?: ({ location }: { location: Location }) => Promise<void>;\n component?: React.ComponentType<{ children?: React.ReactNode }>;\n pendingComponent?: React.ComponentType;\n children?: Route[];\n}\n\nexport interface RootRoute extends Route {\n notFoundComponent?: React.ComponentType;\n}\n\nexport interface Location {\n index: number;\n pathname: string;\n params: any;\n query: any;\n state?: Map<string, any>;\n}\n\nexport interface RouterOptions {\n defaultViewTransition?: (\n fromLocation: Location | undefined,\n toLocation: Location | undefined\n ) => boolean;\n}\n\nexport interface TransitionOptions {\n transition?: boolean;\n duration?: number;\n onFinish?: () => void;\n}\n\nexport type NavigateOptions = Partial<\n Pick<Location, \"params\" | \"query\" | \"state\">\n> & {\n to: string;\n replace?: boolean;\n updateHistory?: boolean;\n} & TransitionOptions;\n\nexport type BackOptions =\n | (TransitionOptions & {\n depth?: number;\n })\n | void;\n\nexport type ForwardOptions =\n | (TransitionOptions & {\n depth?: number;\n })\n | void;\n\nexport class RedirectError extends Error {\n options: { to: string; replace?: boolean };\n constructor(options: { to: string; replace?: boolean }) {\n super();\n this.options = options;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA8B;AAIvB,IAAM,sBAAkB,4BAA+B,IAAI;;;ACO9D;AARG,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AACF,MAGM;AACJ,SACE,4CAAC,gBAAgB,UAAhB,EAAyB,OAAO,UAC9B,UACH;AAEJ;;;ACfA,IAAAA,gBAAoC;;;ACApC,IAAAC,gBAA2B;;;ACA3B,IAAAC,gBAA8B;AAgCvB,IAAM,oBAAgB,6BAAwC,IAAI;;;AD5BlE,IAAM,YAAY,MAAM;AAC7B,QAAM,aAAS,0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,CAAC,cACf,cAAc,OAAO,aAAa,UAAU,QAC5C;AAAA,UACJ,oBACE,mBAAmB,cACf,GAAG,kBAAkB,OACrB;AAAA,QACR;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,UACE,aACI,QAAQ,GAAG,uBAAuB,CAAC,IACnC,QAAQ,GAAG,oBAAqB;AAAA,YAGtC,uDAAC,kBAAkB,oBAAsB;AAAA;AAAA,QAC3C;AAAA;AAAA,MAtBK;AAAA,IAuBP;AAAA,KAEJ;AAEJ;AAEO,IAAM,QAAQ,CAAC,EAAE,UAAU,MAAgC;AAChE,SACE,6CAAC,iBAAc,WACb,uDAAC,kBAAe,GAClB;AAEJ;;;AM1HO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC;AAAA,EACA,YAAY,SAA4C;AACtD,UAAM;AACN,SAAK,UAAU;AAAA,EACjB;AACF;","names":["import_react","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_react","import_react","import_react","import_react","import_jsx_runtime","import_jsx_runtime","route"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/hooks/useRouter.ts","../src/context/router-context.ts","../src/components/link.tsx","../src/context/location-context.ts","../src/components/location-provider.tsx","../src/context/outlet-context.ts","../src/hooks/useOutlet.ts","../src/context/route-match-context.ts","../src/hooks/useRouteMatch.ts","../src/components/outlet-provider.tsx","../src/hooks/useLocation.ts","../src/context/route-context.ts","../src/hooks/useRoute.ts","../src/components/route-component.tsx","../src/hooks/useRootRoute.ts","../src/context/root-route-context.ts","../src/components/route-provider.tsx","../src/components/outlet.tsx","../src/components/router-provider.tsx","../src/constants.ts","../src/utils.ts","../src/components/stack.tsx","../src/components/page-renderer.tsx","../src/components/root-route-provider.tsx"],"sourcesContent":["export * from \"./components/index.js\";\nexport * from \"./context/index.js\";\nexport * from \"./hooks/index.js\";\nexport * from \"./types.d.js\";\nexport * from \"./utils.js\";\n","import { useContext } from \"react\";\n\nimport { RouterContext } from \"@/context/router-context.js\";\n\nexport const useRouter = () => {\n const router = useContext(RouterContext);\n if (router === null) {\n throw new Error(\"useRouter must be used within a Stack\");\n }\n return router;\n};\n","import { createContext } from \"react\";\n\nimport type {\n BackOptions,\n ForwardOptions,\n Location,\n NavigateOptions,\n RouterOptions,\n} from \"@/types.js\";\n\nexport interface RouterContextType {\n // Router Config\n options: RouterOptions;\n\n // Navigation State\n history: Location[];\n location?: Location;\n canGoBack: boolean;\n canGoForward: boolean;\n\n // Transition state\n isTransitioning: boolean;\n transitionDuration: number;\n transitioningToIndex?: number;\n\n // Actions\n navigate: (options: NavigateOptions) => void;\n back: (options?: BackOptions) => void;\n forward: (options?: ForwardOptions) => void;\n\n // Low-level state action\n setLocationState: (index: number, state: Record<string, any>) => void;\n}\n\nexport const RouterContext = createContext<RouterContextType | null>(null);\n","import { useRouter } from \"@/hooks/useRouter.js\";\nimport type { NavigateOptions } from \"@/types.js\";\n\nexport type LinkProps = React.ComponentPropsWithoutRef<\"a\"> & NavigateOptions;\n\nexport const Link: React.FC<LinkProps> = ({\n to,\n replace,\n transition,\n duration,\n onFinish,\n ...props\n}) => {\n const router = useRouter();\n return (\n <a\n {...props}\n href={to}\n onClick={(e) => {\n e.preventDefault();\n router.navigate({ to, replace, transition, duration, onFinish });\n }}\n />\n );\n};\n","import { createContext } from \"react\";\n\nimport type { Location } from \"@/types.js\";\n\nexport interface LocationContextType extends Location {\n canGoBack: boolean;\n canGoForward: boolean;\n getState: (key: string) => any;\n setState: (key: string, value: any) => void;\n deleteState: (key: string) => void;\n}\n\nexport const LocationContext = createContext<LocationContextType | null>(null);\n","import { LocationContext } from \"@/context/location-context.js\";\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport type { Location } from \"@/types.js\";\nimport { useCallback } from \"react\";\n\nexport const LocationProvider = ({\n location,\n ...props\n}: {\n location: Location;\n children: React.ReactNode;\n}) => {\n const router = useRouter();\n const getState = useCallback(\n (key: string) => {\n return location.state[key];\n },\n [location]\n );\n const setState = useCallback(\n (key: string, value: any) => {\n router.setLocationState(location.index, {\n ...location.state,\n [key]: value,\n });\n },\n [router, location]\n );\n const deleteState = useCallback(\n (key: string) => {\n delete location.state[key];\n router.setLocationState(location.index, location.state);\n },\n [router, location]\n );\n return (\n <LocationContext.Provider\n value={{\n ...location,\n canGoBack: location.index > 0,\n canGoForward: location.index < router.history.length - 1,\n getState,\n setState,\n deleteState,\n }}\n {...props}\n />\n );\n};\n","import { createContext } from \"react\";\n\nexport const OutletContext = createContext<number>(0);\n","import { OutletContext } from \"@/context/outlet-context.js\";\nimport { useContext } from \"react\";\n\nexport const useOutlet = () => useContext(OutletContext);\n","import type { RouteMatch } from \"@/types.js\";\nimport { createContext } from \"react\";\n\nexport const RouteMatchContext = createContext<RouteMatch | null>(null);\n","import { RouteMatchContext } from \"@/context/route-match-context.js\";\nimport { useContext } from \"react\";\n\nexport const useRouteMatch = () => {\n const routeMatch = useContext(RouteMatchContext);\n if (routeMatch === null) {\n throw new Error(\"useRouteMatch must be used within a RouteMatchProvider\");\n }\n return routeMatch;\n};\n","import { OutletContext } from \"@/context/outlet-context.js\";\n\nexport const OutletProvider = ({\n depth,\n ...props\n}: {\n depth: number;\n children?: React.ReactNode;\n}) => <OutletContext.Provider value={depth} {...props} />;\n","import { useContext } from \"react\";\n\nimport { LocationContext } from \"@/context/location-context.js\";\n\nexport const useLocation = () => {\n const context = useContext(LocationContext);\n if (context === null) {\n throw new Error(\"useLocation must be used within a LocationProvider\");\n }\n return context;\n};\n","import type { ParsedRoute } from \"@/types.js\";\nimport { createContext } from \"react\";\n\nexport interface RouteContextType extends ParsedRoute {\n getState: (key: string) => any;\n setState: (key: string, value: any) => void;\n}\n\nexport const RouteContext = createContext<RouteContextType | null>(null);\n","import { RouteContext } from \"@/context/route-context.js\";\nimport { useContext } from \"react\";\n\nexport const useRoute = () => {\n const route = useContext(RouteContext);\n if (route === null) {\n throw new Error(\"useRoute must be used within a RouteProvider\");\n }\n return route;\n};\n","import { useLocation } from \"@/hooks/useLocation.js\";\nimport { useRoute } from \"@/hooks/useRoute.js\";\nimport { useRouteMatch } from \"@/hooks/useRouteMatch.js\";\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport { useEffect, useState } from \"react\";\nimport { Outlet } from \"./outlet.js\";\n\nexport const RouteComponent = ({ depth = 0 }: { depth?: number }) => {\n const router = useRouter();\n const location = useLocation();\n const routeMatch = useRouteMatch();\n const route = useRoute();\n\n const pendingStateKey = `_Z.${route.id}.pending`;\n\n const [pending, setPending] = useState(\n !!route?.beforeLoad && route?.getState(pendingStateKey) !== false\n );\n\n useEffect(() => {\n if (!route || depth >= routeMatch.matches.length) {\n return;\n }\n // TODO: push location still loading. Maybe store state in route () instead of location\n if (pending && route?.beforeLoad) {\n route.setState(pendingStateKey, true);\n route\n .beforeLoad({ location })\n .catch(({ cause }: Error) => {\n if (\"to\" in (cause as any)) {\n router.navigate(cause as any);\n }\n })\n .finally(() => {\n route.setState(pendingStateKey, false);\n setPending(false);\n });\n }\n }, []);\n\n if (!route) {\n return null;\n }\n\n if (depth >= routeMatch.matches.length) {\n const NotFoundComponent = route.notFoundComponent!;\n return <NotFoundComponent />;\n }\n\n if (pending) {\n const PendingComponent = route.pendingComponent!;\n return <PendingComponent />;\n }\n\n const Component = route.component;\n return Component ? <Component /> : <Outlet />;\n};\n","import { useContext } from \"react\";\n\nimport { RootRouteContext } from \"@/context/root-route-context.js\";\n\nexport const useRootRoute = () => {\n const route = useContext(RootRouteContext);\n if (route === null) {\n throw new Error(\"useRootRoute must be used within a RootRouteProvider\");\n }\n return route;\n};\n","import { createContext } from \"react\";\n\nimport type { ParsedRoute } from \"@/types.js\";\n\nexport interface RootRouteContextType extends ParsedRoute {\n getRouteState: (id: string, key: string) => any;\n setRouteState: (id: string, key: string, value: any) => void;\n}\n\nexport const RootRouteContext = createContext<RootRouteContextType | null>(\n null\n);\n","import { RouteContext } from \"@/context/route-context.js\";\nimport { useRootRoute } from \"@/hooks/useRootRoute.js\";\nimport type { ParsedRoute } from \"@/types.js\";\nimport { useCallback } from \"react\";\n\nexport const RouteProvider = ({\n route,\n ...props\n}: {\n route?: ParsedRoute;\n children?: React.ReactNode;\n}) => {\n if (!route) {\n return <RouteContext.Provider value={null} {...props} />;\n }\n\n const rootRoute = useRootRoute();\n\n const getState = useCallback(\n (key: string) => {\n return rootRoute.getRouteState(route.id, key);\n },\n [rootRoute.getRouteState]\n );\n\n const setState = useCallback(\n (key: string, value: any) => {\n rootRoute.setRouteState(route.id, key, value);\n },\n [rootRoute.setRouteState]\n );\n\n return (\n <RouteContext.Provider\n value={{ ...route, getState, setState }}\n {...props}\n />\n );\n};\n","import { useOutlet } from \"@/hooks/useOutlet.js\";\nimport { useRouteMatch } from \"@/hooks/useRouteMatch.js\";\nimport { OutletProvider } from \"./outlet-provider.js\";\nimport { RouteComponent } from \"./route-component.js\";\nimport { RouteProvider } from \"./route-provider.js\";\n\nexport const Outlet = () => {\n const routeMatch = useRouteMatch();\n const depth = useOutlet() + 1;\n return (\n <OutletProvider depth={depth}>\n <RouteProvider route={routeMatch.matches.at(depth)}>\n <RouteComponent depth={depth} />\n </RouteProvider>\n </OutletProvider>\n );\n};\n","import { useCallback, useEffect, useState } from \"react\";\n\nimport { RouterContext } from \"@/context/router-context.js\";\nimport type {\n BackOptions,\n ForwardOptions,\n Location,\n NavigateOptions,\n RouterOptions,\n} from \"@/types.js\";\nimport { DefaultTransitionDuration, parseLocation } from \"@/utils.js\";\nimport { LocationProvider } from \"./location-provider.js\";\n\nexport const RouterProvider = ({\n options,\n ...props\n}: {\n options: RouterOptions;\n children: React.ReactNode;\n}) => {\n const [history, setHistory] = useState<Location[]>([\n parseLocation(window.location),\n ]);\n const [currentLocationIndex, setCurrentLocationIndex] = useState<number>(0);\n const location = history.at(currentLocationIndex)!;\n const [isTransitioning, setIsTransitioning] = useState<boolean>(false);\n const [transitionDuration, setTransitionDuration] = useState<number>(\n DefaultTransitionDuration\n );\n const [transitioningToIndex, setTransitioningToIndex] = useState<number>();\n\n useEffect(() => {\n window.history.replaceState(\n {\n index: 0,\n },\n \"\"\n );\n const handlePopState = ({ state }: PopStateEvent) => {\n setCurrentLocationIndex(state?.index ?? 0);\n };\n\n window.addEventListener(\"popstate\", handlePopState);\n return () => {\n window.removeEventListener(\"popstate\", handlePopState);\n };\n }, [setCurrentLocationIndex]);\n\n // Update location state\n const setLocationState = useCallback(\n (index: number, state: Record<string, any>) => {\n setHistory((prevHistory) =>\n prevHistory.map((location) =>\n location.index === index ? { ...location, state } : location\n )\n );\n if (index === currentLocationIndex) {\n window.history.replaceState(\n {\n index,\n ...state,\n },\n \"\",\n location.pathname\n );\n }\n },\n [currentLocationIndex]\n );\n\n const navigate = useCallback(\n ({\n to,\n replace,\n transition,\n duration,\n updateHistory = true,\n onFinish,\n ...locationOptions\n }: NavigateOptions) => {\n if (isTransitioning) return;\n\n const index = replace ? currentLocationIndex : currentLocationIndex + 1;\n\n // Resolve to with absolute or relative paths like \"..\" or \".\"\n let pathname: string;\n if (to.startsWith(\".\")) {\n const currentPathSegments = location.pathname\n .split(\"/\")\n .filter((seg) => seg.length > 0);\n const toPathSegments = to.split(\"/\").filter((seg) => seg.length > 0);\n for (const segment of toPathSegments) {\n if (segment.startsWith(\".\")) {\n if (segment === \".\") {\n continue;\n } else if (segment === \"..\") {\n currentPathSegments.pop();\n } else {\n throw new Error(\n `Invalid relative path segment: ${segment} in ${to}`\n );\n }\n } else if (segment.length > 0) {\n currentPathSegments.push(segment);\n }\n }\n pathname = \"/\" + currentPathSegments.join(\"/\");\n } else {\n pathname = to;\n }\n\n setHistory((prevHistory) => [\n ...(index === history.length ? history : prevHistory.slice(0, index)),\n {\n index,\n search: {},\n state: {},\n pathname,\n ...locationOptions,\n },\n ]);\n if (\n !replace &&\n currentLocationIndex >= 0 &&\n (transition ??\n options.defaultUseTransition?.(location, history.at(index)))\n ) {\n const currentDuration = duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(currentDuration);\n setTransitioningToIndex(index);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(undefined);\n setCurrentLocationIndex(index);\n onFinish?.();\n if (updateHistory) {\n window.history.pushState(\n {\n index,\n },\n \"\",\n to\n );\n }\n }, currentDuration);\n } else if (!replace) {\n setCurrentLocationIndex(index);\n if (updateHistory) {\n window.history.pushState(\n {\n index,\n },\n \"\",\n to\n );\n }\n } else if (updateHistory) {\n window.history.replaceState(\n {\n index,\n },\n \"\",\n to\n );\n }\n },\n [currentLocationIndex, history, isTransitioning, options]\n );\n\n const back = useCallback(\n ({ transition, duration, onFinish, depth }: BackOptions = {}) => {\n if (currentLocationIndex === 0 || isTransitioning) return;\n const newLocationIndex = currentLocationIndex - (depth ?? 1);\n if (\n currentLocationIndex > 0 &&\n (transition ??\n options.defaultUseTransition?.(\n location,\n history.at(newLocationIndex)\n ))\n ) {\n const finalDuration = duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(finalDuration);\n setTransitioningToIndex(newLocationIndex);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(undefined);\n setCurrentLocationIndex(newLocationIndex);\n onFinish?.();\n window.history.back();\n }, finalDuration);\n } else {\n setCurrentLocationIndex(newLocationIndex);\n onFinish?.();\n window.history.back();\n }\n },\n [currentLocationIndex, history, isTransitioning, options]\n );\n\n const forward = useCallback(\n ({ transition, duration, onFinish }: ForwardOptions = {}) => {\n if (currentLocationIndex + 1 >= history.length || isTransitioning) return;\n const newLocationIndex = currentLocationIndex + 1;\n if (\n newLocationIndex < history.length &&\n (transition ??\n options.defaultUseTransition?.(\n location,\n history.at(newLocationIndex)\n ))\n ) {\n const finalDuration = duration ?? DefaultTransitionDuration;\n setIsTransitioning(true);\n setTransitionDuration(finalDuration);\n setTransitioningToIndex(newLocationIndex);\n setTimeout(() => {\n setIsTransitioning(false);\n setTransitioningToIndex(undefined);\n setCurrentLocationIndex(newLocationIndex);\n onFinish?.();\n window.history.forward();\n }, finalDuration);\n } else {\n setCurrentLocationIndex(newLocationIndex);\n onFinish?.();\n window.history.forward();\n }\n },\n [currentLocationIndex, history, isTransitioning, options]\n );\n\n return (\n <RouterContext.Provider\n value={{\n options,\n\n history,\n location,\n canGoBack: currentLocationIndex > 0,\n canGoForward: currentLocationIndex < history.length - 1,\n\n isTransitioning,\n transitionDuration,\n transitioningToIndex,\n\n navigate,\n back,\n forward,\n\n setLocationState,\n }}\n >\n <LocationProvider location={location} {...props} />\n </RouterContext.Provider>\n );\n};\n","import type { RouterOptions } from \"./types.js\";\n\nexport const DefaultRouterOptions: RouterOptions = {\n defaultTransitionDuration: 300,\n};\n","import { DefaultRouterOptions } from \"./constants.js\";\nimport type {\n Location,\n ParsedRoute,\n Route,\n RouteMatch,\n RouterOptions,\n} from \"./types.js\";\n\nexport const DefaultTransitionDuration = 300;\n\nexport const redirect = (options: { to: string; replace?: boolean }) => {\n return new Error(\"\", { cause: options });\n};\n\n/**\n * @param pattern pathname pattern like `/users/:id`. Leading and trailing slashes are optional.\n * @param url URL to match against the pattern. Can be href or pathname with query string.\n * @returns extracted params and query if matched, otherwise null\n */\nexport const matchPattern = (\n pattern: string,\n url: string\n): { params: Record<string, string>; query: Record<string, string> } | null => {\n try {\n // 解析 URL\n let pathname, searchParams;\n\n if (url.startsWith(\"http://\") || url.startsWith(\"https://\")) {\n const urlObj = new URL(url);\n pathname = urlObj.pathname;\n searchParams = urlObj.searchParams;\n } else {\n // 處理相對路徑\n const [path, queryString] = url.split(\"?\");\n if (!path) {\n return null;\n }\n pathname = path;\n searchParams = new URLSearchParams(queryString || \"\");\n }\n\n // 移除路徑首尾的斜線以便比較\n const cleanPath = pathname.replaceAll(/^\\/|\\/$/g, \"\");\n const cleanPattern = pattern.replaceAll(/^\\/|\\/$/g, \"\");\n\n // 分割路徑段\n const pathSegments = cleanPath.split(\"/\");\n const patternSegments = cleanPattern.split(\"/\");\n\n // 路徑段數量不同則不匹配\n if (pathSegments.length !== patternSegments.length) {\n return null;\n }\n\n // 提取路徑參數\n const params: Record<string, string> = {};\n for (let i = 0; i < patternSegments.length; i++) {\n const patternSegment = patternSegments[i];\n const pathSegment = pathSegments[i];\n\n if (patternSegment.startsWith(\":\")) {\n // 動態參數\n const paramName = patternSegment.slice(1);\n params[paramName] = decodeURIComponent(pathSegment);\n } else if (patternSegment !== pathSegment) {\n // 靜態段不匹配\n return null;\n }\n }\n\n // 提取查詢參數\n const query = Object.fromEntries(searchParams.entries());\n\n return { params, query };\n } catch {\n return null;\n }\n};\n\nexport const matchRoute = (route: ParsedRoute, url: string): RouteMatch => {\n const _matchRoute = (\n matches: ParsedRoute[],\n { children }: ParsedRoute\n ): RouteMatch | null => {\n if (children && children.length > 0) {\n for (const childRoute of children) {\n const matchesResult = _matchRoute([...matches, childRoute], childRoute);\n if (matchesResult) {\n return matchesResult;\n }\n }\n return null;\n }\n\n const result = matchPattern(buildPathnameFromMatches(matches), url);\n return result ? { matches, ...result } : null;\n };\n\n return (\n _matchRoute([route], route) || {\n matches: [],\n params: {},\n query: {},\n }\n );\n};\n\nexport const buildPathnameFromMatches = (matches: Route[]): string => {\n let cleanedPathnames: string[] = []; // pathnames without leading/trailing slashes\n for (const match of matches) {\n if (match.pathname === undefined) continue;\n cleanedPathnames.push(match.pathname.replaceAll(/^\\/|\\/$/g, \"\"));\n }\n return \"/\" + cleanedPathnames.join(\"/\");\n};\n\nexport const parseLocation = (location: globalThis.Location): Location => ({\n index: 0,\n state: {},\n pathname: location.pathname,\n search: Object.fromEntries(new URLSearchParams(location.search)),\n});\n\nexport const createRouterOptions = (\n options?: RouterOptions\n): RouterOptions => ({\n ...DefaultRouterOptions,\n ...options,\n});\n\nexport const parseRoute = (route: Route): ParsedRoute => {\n const parseRouteRecursive = (route: Route, parentId: string): ParsedRoute => {\n const id =\n route.name ??\n (route.pathname\n ? `${parentId}/${route.pathname.replaceAll(/^\\/|\\/$/g, \"\")}`\n : parentId);\n\n const parsedRoute: ParsedRoute = {\n ...route,\n id,\n children: route.children?.map((child) => parseRouteRecursive(child, id)),\n };\n\n return parsedRoute;\n };\n return parseRouteRecursive(route, \"\");\n};\n","import { useEffect, useState } from \"react\";\n\nimport { useRouter } from \"@/hooks/useRouter.js\";\nimport type { Route } from \"@/types.js\";\n\nimport { LocationProvider } from \"./location-provider.js\";\nimport { PageRenderer } from \"./page-renderer.js\";\nimport { RootRouteProvider } from \"./root-route-provider.js\";\n\nconst StackComponent = () => {\n const {\n history,\n location,\n canGoBack,\n canGoForward,\n isTransitioning,\n transitioningToIndex,\n transitionDuration,\n back,\n forward,\n } = useRouter();\n const currentLocationIndex = location?.index;\n\n const [isDragging, setIsDragging] = useState(false);\n const [startX, setStartX] = useState(0);\n const [dragOffset, setDragOffset] = useState(0);\n const [isCanceling, setIsCanceling] = useState(false);\n const [isTransitionStarted, setIsTransitionStarted] = useState(false);\n\n useEffect(() => {\n if (!isTransitioning || transitioningToIndex === null) return;\n setIsTransitionStarted(true);\n setTimeout(() => {\n setIsTransitionStarted(false);\n }, transitionDuration);\n }, [isTransitioning, transitioningToIndex]);\n\n if (currentLocationIndex === undefined) return;\n\n const reset = () => {\n setIsDragging(false);\n setDragOffset(0);\n setIsCanceling(false);\n };\n\n const handleTouchStart = (e: React.TouchEvent) => {\n if (isTransitioning || (!canGoForward && !canGoBack)) return;\n setIsDragging(true);\n setStartX(e.touches[0].clientX);\n };\n\n const handleTouchMove = (e: React.TouchEvent) => {\n if (!isDragging) return;\n const offset = e.touches[0].clientX - startX;\n if (\n (offset > 0 && currentLocationIndex === 0) ||\n (offset < 0 && currentLocationIndex + 1 === history.length)\n ) {\n setDragOffset(0);\n return;\n }\n setDragOffset(Math.min(window.innerWidth, offset));\n };\n\n const handleTouchEnd = () => {\n if (!isDragging) return;\n\n if (dragOffset > window.innerWidth * 0.3 && canGoBack) {\n back({\n onFinish: reset,\n });\n } else if (dragOffset < -window.innerWidth * 0.3 && canGoForward) {\n forward({\n onFinish: reset,\n });\n } else {\n setIsCanceling(true);\n setTimeout(reset, transitionDuration);\n }\n };\n\n return (\n <div\n style={{\n position: \"relative\",\n inset: 0,\n height: \"100%\",\n width: \"100%\",\n overflow: \"hidden\",\n }}\n >\n {currentLocationIndex >= 1 &&\n ((isDragging && dragOffset > 0) ||\n (isTransitioning &&\n transitioningToIndex !== undefined &&\n transitioningToIndex < currentLocationIndex)) && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n zIndex: -10,\n }}\n >\n <LocationProvider location={history.at(currentLocationIndex - 1)!}>\n <PageRenderer key={currentLocationIndex - 1} />\n </LocationProvider>\n </div>\n )}\n <div\n key={currentLocationIndex}\n style={{\n background: \"white\",\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n transform:\n isTransitioning &&\n transitioningToIndex !== undefined &&\n transitioningToIndex < currentLocationIndex\n ? `translateX(100%)`\n : isDragging && dragOffset > 0 && !isCanceling\n ? `translateX(${dragOffset}px)`\n : \"translateX(0px)\",\n transition:\n isCanceling ||\n (isTransitioning &&\n transitioningToIndex !== undefined &&\n transitioningToIndex < currentLocationIndex)\n ? `transform ${transitionDuration}ms ease-out`\n : \"\",\n boxShadow:\n isDragging && dragOffset > 0\n ? \"-4px 0 8px rgba(0,0,0,0.1)\"\n : \"none\",\n }}\n onTouchStart={handleTouchStart}\n onTouchMove={handleTouchMove}\n onTouchEnd={handleTouchEnd}\n >\n <PageRenderer />\n </div>\n {((isDragging && dragOffset < 0) ||\n (isTransitioning &&\n transitioningToIndex !== undefined &&\n currentLocationIndex < transitioningToIndex)) && (\n <div\n key={transitioningToIndex}\n style={{\n background: \"white\",\n position: \"absolute\",\n inset: 0,\n zIndex: 10,\n overflow: \"hidden\",\n transition: \"transform ease-in\",\n transform: isTransitionStarted\n ? `translateX(0px)`\n : isDragging && !isCanceling\n ? `translateX(${window.innerWidth + dragOffset}px)`\n : \"translateX(100%)\",\n transitionDuration:\n isTransitioning || isCanceling\n ? `${transitionDuration}ms`\n : \"0ms\",\n }}\n >\n <LocationProvider\n location={\n isDragging\n ? history.at(currentLocationIndex + 1)!\n : history.at(transitioningToIndex!)!\n }\n >\n <PageRenderer key={transitioningToIndex} />\n </LocationProvider>\n </div>\n )}\n </div>\n );\n};\n\nexport const Stack = ({ rootRoute }: { rootRoute: Route }) => (\n <RootRouteProvider rootRoute={rootRoute}>\n <StackComponent />\n </RootRouteProvider>\n);\n","import { RouteMatchContext } from \"@/context/route-match-context.js\";\nimport { useLocation } from \"@/hooks/useLocation.js\";\nimport { useRootRoute } from \"@/hooks/useRootRoute.js\";\nimport { matchRoute } from \"@/utils.js\";\nimport { RouteComponent } from \"./route-component.js\";\nimport { RouteProvider } from \"./route-provider.js\";\n\nexport const PageRenderer = () => {\n const rootRoute = useRootRoute();\n const location = useLocation();\n const routeMatch = matchRoute(rootRoute, location.pathname);\n return (\n <RouteMatchContext.Provider value={routeMatch}>\n <RouteProvider route={rootRoute}>\n <RouteComponent />\n </RouteProvider>\n </RouteMatchContext.Provider>\n );\n};\n","import { RootRouteContext } from \"@/context/root-route-context.js\";\nimport type { Route } from \"@/types.js\";\nimport { parseRoute } from \"@/utils.js\";\nimport { useCallback, useState } from \"react\";\n\nexport const RootRouteProvider = ({\n rootRoute,\n ...props\n}: {\n rootRoute: Route;\n children: React.ReactNode;\n}) => {\n const parsedRoute = parseRoute(rootRoute);\n const [state, setState] = useState<Record<string, Record<string, any>>>({});\n\n const getRouteState = useCallback(\n (id: string, key: string) => {\n return state[id]?.[key];\n },\n [state]\n );\n\n const setRouteState = useCallback((id: string, key: string, value: any) => {\n setState((prevState) => ({\n ...prevState,\n [id]: {\n ...prevState[id],\n [key]: value,\n },\n }));\n }, []);\n\n return (\n <RootRouteContext.Provider\n value={{ ...parsedRoute, getRouteState, setRouteState }}\n {...props}\n />\n );\n};\n"],"mappings":"mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,+BAAAE,EAAA,SAAAC,GAAA,oBAAAC,EAAA,qBAAAC,EAAA,WAAAC,GAAA,qBAAAC,EAAA,kBAAAC,EAAA,mBAAA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EAAa,GAC3BX,GACCC,IAAyB,QACzBK,EAAuBL,OACzB,OAAC,OAEC,MAAO,CACL,WAAY,QACZ,SAAU,WACV,MAAO,EACP,OAAQ,GACR,SAAU,SACV,WAAY,oBACZ,UAAWc,EACP,kBACAR,GAAc,CAACM,EACf,cAAc,OAAO,WAAaF,CAAU,MAC5C,mBACJ,mBACEX,GAAmBa,EACf,GAAGX,CAAkB,KACrB,KACR,EAEA,mBAACqB,EAAA,CACC,SACEhB,EACIX,EAAQ,GAAGU,EAAuB,CAAC,EACnCV,EAAQ,GAAGK,CAAqB,EAGtC,mBAACuB,EAAA,GAAkBvB,CAAsB,EAC3C,GA3BKA,CA4BP,GAEJ,CAEJ,EAEawB,GAAQ,CAAC,CAAE,UAAAC,CAAU,OAChC,OAACC,GAAA,CAAkB,UAAWD,EAC5B,mBAAC/B,GAAA,EAAe,EAClB","names":["index_exports","__export","DefaultTransitionDuration","Link","LocationContext","LocationProvider","Outlet","RootRouteContext","RouterContext","RouterProvider","Stack","buildPathnameFromMatches","createRouterOptions","matchPattern","matchRoute","parseLocation","parseRoute","redirect","useLocation","useRootRoute","useRoute","useRouter","__toCommonJS","import_react","import_react","RouterContext","useRouter","router","RouterContext","import_jsx_runtime","Link","to","replace","transition","duration","onFinish","props","router","useRouter","e","import_react","LocationContext","import_react","import_jsx_runtime","LocationProvider","location","props","router","useRouter","getState","key","setState","value","deleteState","LocationContext","import_react","OutletContext","import_react","useOutlet","OutletContext","import_react","RouteMatchContext","import_react","useRouteMatch","routeMatch","RouteMatchContext","import_jsx_runtime","OutletProvider","depth","props","OutletContext","import_react","useLocation","context","LocationContext","import_react","RouteContext","import_react","useRoute","route","RouteContext","import_react","import_jsx_runtime","RouteComponent","depth","router","useRouter","location","useLocation","routeMatch","useRouteMatch","route","useRoute","pendingStateKey","pending","setPending","cause","NotFoundComponent","PendingComponent","Component","Outlet","import_react","import_react","RootRouteContext","useRootRoute","route","RootRouteContext","import_react","import_jsx_runtime","RouteProvider","route","props","RouteContext","rootRoute","useRootRoute","getState","key","setState","value","import_jsx_runtime","Outlet","routeMatch","useRouteMatch","depth","useOutlet","OutletProvider","RouteProvider","RouteComponent","import_react","DefaultRouterOptions","DefaultTransitionDuration","redirect","options","matchPattern","pattern","url","pathname","searchParams","urlObj","path","queryString","cleanPath","cleanPattern","pathSegments","patternSegments","params","i","patternSegment","pathSegment","paramName","query","matchRoute","route","_matchRoute","matches","children","childRoute","matchesResult","result","buildPathnameFromMatches","cleanedPathnames","match","parseLocation","location","createRouterOptions","DefaultRouterOptions","parseRoute","parseRouteRecursive","parentId","id","child","import_jsx_runtime","RouterProvider","options","props","history","setHistory","parseLocation","currentLocationIndex","setCurrentLocationIndex","location","isTransitioning","setIsTransitioning","transitionDuration","setTransitionDuration","DefaultTransitionDuration","transitioningToIndex","setTransitioningToIndex","handlePopState","state","setLocationState","index","prevHistory","navigate","to","replace","transition","duration","updateHistory","onFinish","locationOptions","pathname","currentPathSegments","seg","toPathSegments","segment","currentDuration","back","depth","newLocationIndex","finalDuration","forward","RouterContext","LocationProvider","import_react","import_jsx_runtime","PageRenderer","rootRoute","useRootRoute","location","useLocation","routeMatch","matchRoute","RouteMatchContext","RouteProvider","RouteComponent","import_react","import_jsx_runtime","RootRouteProvider","rootRoute","props","parsedRoute","parseRoute","state","setState","getRouteState","id","key","setRouteState","value","prevState","RootRouteContext","import_jsx_runtime","StackComponent","history","location","canGoBack","canGoForward","isTransitioning","transitioningToIndex","transitionDuration","back","forward","useRouter","currentLocationIndex","isDragging","setIsDragging","startX","setStartX","dragOffset","setDragOffset","isCanceling","setIsCanceling","isTransitionStarted","setIsTransitionStarted","reset","handleTouchStart","e","handleTouchMove","offset","handleTouchEnd","LocationProvider","PageRenderer","Stack","rootRoute","RootRouteProvider"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,31 +2,42 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
|
|
4
4
|
interface Route {
|
|
5
|
-
|
|
5
|
+
name?: string;
|
|
6
6
|
pathname?: string;
|
|
7
7
|
beforeLoad?: ({ location }: { location: Location }) => Promise<void>;
|
|
8
|
-
component?: React.ComponentType<{ children?: React.ReactNode }>;
|
|
9
8
|
pendingComponent?: React.ComponentType;
|
|
9
|
+
component?: React.ComponentType<{ children?: React.ReactNode }>;
|
|
10
|
+
notFoundComponent?: React.ComponentType;
|
|
10
11
|
children?: Route[];
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
interface
|
|
14
|
-
|
|
14
|
+
interface ParsedRoute extends Route {
|
|
15
|
+
id: string;
|
|
16
|
+
children?: ParsedRoute[];
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
interface Location {
|
|
18
20
|
index: number;
|
|
19
21
|
pathname: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
search: Record<string, string>;
|
|
23
|
+
state: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface RouteMatch {
|
|
27
|
+
matches: ParsedRoute[];
|
|
28
|
+
params: Record<string, string>;
|
|
29
|
+
query: Record<string, string>;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
interface RouterOptions {
|
|
26
|
-
|
|
33
|
+
defaultUseTransition?: (
|
|
27
34
|
fromLocation: Location | undefined,
|
|
28
35
|
toLocation: Location | undefined
|
|
29
36
|
) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @default 300
|
|
39
|
+
*/
|
|
40
|
+
defaultTransitionDuration?: number;
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
interface TransitionOptions {
|
|
@@ -35,79 +46,80 @@ interface TransitionOptions {
|
|
|
35
46
|
onFinish?: () => void;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
type NavigateOptions =
|
|
39
|
-
Pick<Location, "params" | "query" | "state">
|
|
40
|
-
> & {
|
|
49
|
+
type NavigateOptions = {
|
|
41
50
|
to: string;
|
|
42
51
|
replace?: boolean;
|
|
43
52
|
updateHistory?: boolean;
|
|
44
53
|
} & TransitionOptions;
|
|
45
54
|
|
|
46
|
-
type BackOptions =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| (TransitionOptions & {
|
|
54
|
-
depth?: number;
|
|
55
|
-
})
|
|
56
|
-
| void;
|
|
57
|
-
|
|
58
|
-
declare class RedirectError extends Error {
|
|
59
|
-
options: { to: string; replace?: boolean };
|
|
60
|
-
constructor(options: { to: string; replace?: boolean }) {
|
|
61
|
-
super();
|
|
62
|
-
this.options = options;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
55
|
+
type BackOptions = TransitionOptions & {
|
|
56
|
+
depth?: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type ForwardOptions = TransitionOptions & {
|
|
60
|
+
depth?: number;
|
|
61
|
+
};
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
type LinkProps = React.ComponentPropsWithoutRef<"a"> & NavigateOptions;
|
|
64
|
+
declare const Link: React.FC<LinkProps>;
|
|
65
|
+
|
|
66
|
+
declare const LocationProvider: ({ location, ...props }: {
|
|
67
67
|
location: Location;
|
|
68
68
|
children: React.ReactNode;
|
|
69
69
|
}) => react_jsx_runtime.JSX.Element;
|
|
70
70
|
|
|
71
|
-
declare const
|
|
72
|
-
route: Route;
|
|
73
|
-
children?: React.ReactNode;
|
|
74
|
-
}) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
71
|
+
declare const Outlet: () => react_jsx_runtime.JSX.Element;
|
|
75
72
|
|
|
76
|
-
declare const RouterProvider: ({
|
|
77
|
-
|
|
73
|
+
declare const RouterProvider: ({ options, ...props }: {
|
|
74
|
+
options: RouterOptions;
|
|
78
75
|
children: React.ReactNode;
|
|
79
76
|
}) => react_jsx_runtime.JSX.Element;
|
|
80
77
|
|
|
81
|
-
declare const PageRenderer: () => react_jsx_runtime.JSX.Element | null;
|
|
82
78
|
declare const Stack: ({ rootRoute }: {
|
|
83
|
-
rootRoute:
|
|
79
|
+
rootRoute: Route;
|
|
84
80
|
}) => react_jsx_runtime.JSX.Element;
|
|
85
81
|
|
|
86
|
-
|
|
82
|
+
interface LocationContextType extends Location {
|
|
83
|
+
canGoBack: boolean;
|
|
84
|
+
canGoForward: boolean;
|
|
85
|
+
getState: (key: string) => any;
|
|
86
|
+
setState: (key: string, value: any) => void;
|
|
87
|
+
deleteState: (key: string) => void;
|
|
88
|
+
}
|
|
89
|
+
declare const LocationContext: react.Context<LocationContextType | null>;
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
interface RootRouteContextType extends ParsedRoute {
|
|
92
|
+
getRouteState: (id: string, key: string) => any;
|
|
93
|
+
setRouteState: (id: string, key: string, value: any) => void;
|
|
94
|
+
}
|
|
95
|
+
declare const RootRouteContext: react.Context<RootRouteContextType | null>;
|
|
89
96
|
|
|
90
97
|
interface RouterContextType {
|
|
91
98
|
options: RouterOptions;
|
|
92
99
|
history: Location[];
|
|
93
|
-
|
|
94
|
-
location: Location | null;
|
|
100
|
+
location?: Location;
|
|
95
101
|
canGoBack: boolean;
|
|
96
102
|
canGoForward: boolean;
|
|
97
103
|
isTransitioning: boolean;
|
|
98
104
|
transitionDuration: number;
|
|
99
|
-
transitioningToIndex
|
|
105
|
+
transitioningToIndex?: number;
|
|
100
106
|
navigate: (options: NavigateOptions) => void;
|
|
101
|
-
back: (options
|
|
102
|
-
forward: (options
|
|
107
|
+
back: (options?: BackOptions) => void;
|
|
108
|
+
forward: (options?: ForwardOptions) => void;
|
|
109
|
+
setLocationState: (index: number, state: Record<string, any>) => void;
|
|
103
110
|
}
|
|
104
111
|
declare const RouterContext: react.Context<RouterContextType | null>;
|
|
105
112
|
|
|
106
|
-
declare const useLocation: () =>
|
|
113
|
+
declare const useLocation: () => LocationContextType;
|
|
107
114
|
|
|
108
|
-
declare const
|
|
115
|
+
declare const useRootRoute: () => RootRouteContextType;
|
|
109
116
|
|
|
110
|
-
|
|
117
|
+
interface RouteContextType extends ParsedRoute {
|
|
118
|
+
getState: (key: string) => any;
|
|
119
|
+
setState: (key: string, value: any) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare const useRoute: () => RouteContextType;
|
|
111
123
|
|
|
112
124
|
declare const useRouter: () => RouterContextType;
|
|
113
125
|
|
|
@@ -116,16 +128,19 @@ declare const redirect: (options: {
|
|
|
116
128
|
to: string;
|
|
117
129
|
replace?: boolean;
|
|
118
130
|
}) => Error;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
/**
|
|
132
|
+
* @param pattern pathname pattern like `/users/:id`. Leading and trailing slashes are optional.
|
|
133
|
+
* @param url URL to match against the pattern. Can be href or pathname with query string.
|
|
134
|
+
* @returns extracted params and query if matched, otherwise null
|
|
135
|
+
*/
|
|
136
|
+
declare const matchPattern: (pattern: string, url: string) => {
|
|
125
137
|
params: Record<string, string>;
|
|
126
138
|
query: Record<string, string>;
|
|
127
139
|
} | null;
|
|
128
|
-
declare const
|
|
129
|
-
declare const
|
|
140
|
+
declare const matchRoute: (route: ParsedRoute, url: string) => RouteMatch;
|
|
141
|
+
declare const buildPathnameFromMatches: (matches: Route[]) => string;
|
|
142
|
+
declare const parseLocation: (location: globalThis.Location) => Location;
|
|
143
|
+
declare const createRouterOptions: (options?: RouterOptions) => RouterOptions;
|
|
144
|
+
declare const parseRoute: (route: Route) => ParsedRoute;
|
|
130
145
|
|
|
131
|
-
export { type BackOptions, DefaultTransitionDuration, type ForwardOptions, type Location, LocationContext, LocationProvider, type NavigateOptions,
|
|
146
|
+
export { type BackOptions, DefaultTransitionDuration, type ForwardOptions, Link, type LinkProps, type Location, LocationContext, type LocationContextType, LocationProvider, type NavigateOptions, Outlet, type ParsedRoute, RootRouteContext, type RootRouteContextType, type Route, type RouteMatch, RouterContext, type RouterContextType, type RouterOptions, RouterProvider, Stack, type TransitionOptions, buildPathnameFromMatches, createRouterOptions, matchPattern, matchRoute, parseLocation, parseRoute, redirect, useLocation, useRootRoute, useRoute, useRouter };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,31 +2,42 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
|
|
4
4
|
interface Route {
|
|
5
|
-
|
|
5
|
+
name?: string;
|
|
6
6
|
pathname?: string;
|
|
7
7
|
beforeLoad?: ({ location }: { location: Location }) => Promise<void>;
|
|
8
|
-
component?: React.ComponentType<{ children?: React.ReactNode }>;
|
|
9
8
|
pendingComponent?: React.ComponentType;
|
|
9
|
+
component?: React.ComponentType<{ children?: React.ReactNode }>;
|
|
10
|
+
notFoundComponent?: React.ComponentType;
|
|
10
11
|
children?: Route[];
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
interface
|
|
14
|
-
|
|
14
|
+
interface ParsedRoute extends Route {
|
|
15
|
+
id: string;
|
|
16
|
+
children?: ParsedRoute[];
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
interface Location {
|
|
18
20
|
index: number;
|
|
19
21
|
pathname: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
search: Record<string, string>;
|
|
23
|
+
state: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface RouteMatch {
|
|
27
|
+
matches: ParsedRoute[];
|
|
28
|
+
params: Record<string, string>;
|
|
29
|
+
query: Record<string, string>;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
interface RouterOptions {
|
|
26
|
-
|
|
33
|
+
defaultUseTransition?: (
|
|
27
34
|
fromLocation: Location | undefined,
|
|
28
35
|
toLocation: Location | undefined
|
|
29
36
|
) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @default 300
|
|
39
|
+
*/
|
|
40
|
+
defaultTransitionDuration?: number;
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
interface TransitionOptions {
|
|
@@ -35,79 +46,80 @@ interface TransitionOptions {
|
|
|
35
46
|
onFinish?: () => void;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
|
-
type NavigateOptions =
|
|
39
|
-
Pick<Location, "params" | "query" | "state">
|
|
40
|
-
> & {
|
|
49
|
+
type NavigateOptions = {
|
|
41
50
|
to: string;
|
|
42
51
|
replace?: boolean;
|
|
43
52
|
updateHistory?: boolean;
|
|
44
53
|
} & TransitionOptions;
|
|
45
54
|
|
|
46
|
-
type BackOptions =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| (TransitionOptions & {
|
|
54
|
-
depth?: number;
|
|
55
|
-
})
|
|
56
|
-
| void;
|
|
57
|
-
|
|
58
|
-
declare class RedirectError extends Error {
|
|
59
|
-
options: { to: string; replace?: boolean };
|
|
60
|
-
constructor(options: { to: string; replace?: boolean }) {
|
|
61
|
-
super();
|
|
62
|
-
this.options = options;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
55
|
+
type BackOptions = TransitionOptions & {
|
|
56
|
+
depth?: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type ForwardOptions = TransitionOptions & {
|
|
60
|
+
depth?: number;
|
|
61
|
+
};
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
type LinkProps = React.ComponentPropsWithoutRef<"a"> & NavigateOptions;
|
|
64
|
+
declare const Link: React.FC<LinkProps>;
|
|
65
|
+
|
|
66
|
+
declare const LocationProvider: ({ location, ...props }: {
|
|
67
67
|
location: Location;
|
|
68
68
|
children: React.ReactNode;
|
|
69
69
|
}) => react_jsx_runtime.JSX.Element;
|
|
70
70
|
|
|
71
|
-
declare const
|
|
72
|
-
route: Route;
|
|
73
|
-
children?: React.ReactNode;
|
|
74
|
-
}) => string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
71
|
+
declare const Outlet: () => react_jsx_runtime.JSX.Element;
|
|
75
72
|
|
|
76
|
-
declare const RouterProvider: ({
|
|
77
|
-
|
|
73
|
+
declare const RouterProvider: ({ options, ...props }: {
|
|
74
|
+
options: RouterOptions;
|
|
78
75
|
children: React.ReactNode;
|
|
79
76
|
}) => react_jsx_runtime.JSX.Element;
|
|
80
77
|
|
|
81
|
-
declare const PageRenderer: () => react_jsx_runtime.JSX.Element | null;
|
|
82
78
|
declare const Stack: ({ rootRoute }: {
|
|
83
|
-
rootRoute:
|
|
79
|
+
rootRoute: Route;
|
|
84
80
|
}) => react_jsx_runtime.JSX.Element;
|
|
85
81
|
|
|
86
|
-
|
|
82
|
+
interface LocationContextType extends Location {
|
|
83
|
+
canGoBack: boolean;
|
|
84
|
+
canGoForward: boolean;
|
|
85
|
+
getState: (key: string) => any;
|
|
86
|
+
setState: (key: string, value: any) => void;
|
|
87
|
+
deleteState: (key: string) => void;
|
|
88
|
+
}
|
|
89
|
+
declare const LocationContext: react.Context<LocationContextType | null>;
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
interface RootRouteContextType extends ParsedRoute {
|
|
92
|
+
getRouteState: (id: string, key: string) => any;
|
|
93
|
+
setRouteState: (id: string, key: string, value: any) => void;
|
|
94
|
+
}
|
|
95
|
+
declare const RootRouteContext: react.Context<RootRouteContextType | null>;
|
|
89
96
|
|
|
90
97
|
interface RouterContextType {
|
|
91
98
|
options: RouterOptions;
|
|
92
99
|
history: Location[];
|
|
93
|
-
|
|
94
|
-
location: Location | null;
|
|
100
|
+
location?: Location;
|
|
95
101
|
canGoBack: boolean;
|
|
96
102
|
canGoForward: boolean;
|
|
97
103
|
isTransitioning: boolean;
|
|
98
104
|
transitionDuration: number;
|
|
99
|
-
transitioningToIndex
|
|
105
|
+
transitioningToIndex?: number;
|
|
100
106
|
navigate: (options: NavigateOptions) => void;
|
|
101
|
-
back: (options
|
|
102
|
-
forward: (options
|
|
107
|
+
back: (options?: BackOptions) => void;
|
|
108
|
+
forward: (options?: ForwardOptions) => void;
|
|
109
|
+
setLocationState: (index: number, state: Record<string, any>) => void;
|
|
103
110
|
}
|
|
104
111
|
declare const RouterContext: react.Context<RouterContextType | null>;
|
|
105
112
|
|
|
106
|
-
declare const useLocation: () =>
|
|
113
|
+
declare const useLocation: () => LocationContextType;
|
|
107
114
|
|
|
108
|
-
declare const
|
|
115
|
+
declare const useRootRoute: () => RootRouteContextType;
|
|
109
116
|
|
|
110
|
-
|
|
117
|
+
interface RouteContextType extends ParsedRoute {
|
|
118
|
+
getState: (key: string) => any;
|
|
119
|
+
setState: (key: string, value: any) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare const useRoute: () => RouteContextType;
|
|
111
123
|
|
|
112
124
|
declare const useRouter: () => RouterContextType;
|
|
113
125
|
|
|
@@ -116,16 +128,19 @@ declare const redirect: (options: {
|
|
|
116
128
|
to: string;
|
|
117
129
|
replace?: boolean;
|
|
118
130
|
}) => Error;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
/**
|
|
132
|
+
* @param pattern pathname pattern like `/users/:id`. Leading and trailing slashes are optional.
|
|
133
|
+
* @param url URL to match against the pattern. Can be href or pathname with query string.
|
|
134
|
+
* @returns extracted params and query if matched, otherwise null
|
|
135
|
+
*/
|
|
136
|
+
declare const matchPattern: (pattern: string, url: string) => {
|
|
125
137
|
params: Record<string, string>;
|
|
126
138
|
query: Record<string, string>;
|
|
127
139
|
} | null;
|
|
128
|
-
declare const
|
|
129
|
-
declare const
|
|
140
|
+
declare const matchRoute: (route: ParsedRoute, url: string) => RouteMatch;
|
|
141
|
+
declare const buildPathnameFromMatches: (matches: Route[]) => string;
|
|
142
|
+
declare const parseLocation: (location: globalThis.Location) => Location;
|
|
143
|
+
declare const createRouterOptions: (options?: RouterOptions) => RouterOptions;
|
|
144
|
+
declare const parseRoute: (route: Route) => ParsedRoute;
|
|
130
145
|
|
|
131
|
-
export { type BackOptions, DefaultTransitionDuration, type ForwardOptions, type Location, LocationContext, LocationProvider, type NavigateOptions,
|
|
146
|
+
export { type BackOptions, DefaultTransitionDuration, type ForwardOptions, Link, type LinkProps, type Location, LocationContext, type LocationContextType, LocationProvider, type NavigateOptions, Outlet, type ParsedRoute, RootRouteContext, type RootRouteContextType, type Route, type RouteMatch, RouterContext, type RouterContextType, type RouterOptions, RouterProvider, Stack, type TransitionOptions, buildPathnameFromMatches, createRouterOptions, matchPattern, matchRoute, parseLocation, parseRoute, redirect, useLocation, useRootRoute, useRoute, useRouter };
|