@tanstack/react-router 0.0.1-beta.207 → 0.0.1-beta.208

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.
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sources":["../../src/react.tsx"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n LinkOptions,\n ToOptions,\n ResolveRelativePath,\n NavigateOptions,\n} from './link'\nimport {\n AnySearchSchema,\n AnyPathParams,\n AnyContext,\n AnyRoute,\n rootRouteId,\n} from './route'\nimport {\n RoutePaths,\n RouteByPath,\n RouteIds,\n ParseRoute,\n RoutesById,\n RouteById,\n AllParams,\n} from './routeInfo'\nimport { RegisteredRouter, RouterOptions, Router, RouterState } from './router'\nimport { RouteMatch } from './RouteMatch'\nimport { NoInfer, functionalUpdate, last } from './utils'\nimport { MatchRouteOptions, RouterContext } from './RouterProvider'\nimport { routerContext } from './RouterProvider'\n\nconst useLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type RouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = {\n useMatch: <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }) => TSelected\n useRouteMeta: <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }) => TSelected\n useSearch: <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }) => TSelected\n useParams: <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }) => TSelected\n}\n\nexport type ErrorRouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = {\n error: unknown\n info: { componentStack: string }\n} & RouteProps<TFullSearchSchema, TAllParams, TAllContext>\n\nexport type PendingRouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = RouteProps<TFullSearchSchema, TAllParams, TAllContext>\n\n//\n\ntype ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<RouteProps<TFullSearchSchema, TAllParams, TAllContext>>\n\nexport type ErrorRouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<\n ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>\n>\n\nexport type PendingRouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<\n PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>\n>\n\nexport type AnyRouteComponent = RouteComponent<any, any, any>\n\nexport function lazyRouteComponent<\n T extends Record<string, any>,\n TKey extends keyof T = 'default',\n>(\n importer: () => Promise<T>,\n exportName?: TKey,\n): T[TKey] extends (props: infer TProps) => any\n ? AsyncRouteComponent<TProps>\n : never {\n let loadPromise: Promise<any>\n\n const load = () => {\n if (!loadPromise) {\n loadPromise = importer()\n }\n\n return loadPromise\n }\n\n const lazyComp = React.lazy(async () => {\n const moduleExports = await load()\n const comp = moduleExports[exportName ?? 'default']\n return {\n default: comp,\n }\n })\n\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n\nexport type LinkPropsOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // If set to `true`, the link's underlying navigate() call will be wrapped in a `React.startTransition` call. Defaults to `true`.\n startTransition?: boolean\n}\n\nexport type MakeUseMatchRouteOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToOptions<AnyRoute, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions\n\nexport type MakeMatchRouteOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouteTree,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => ReactNode)\n | React.ReactNode\n }\n\nexport type MakeLinkPropsOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>\n\nexport type MakeLinkOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n }\n\nexport type PromptProps = {\n message: string\n condition?: boolean | any\n children?: ReactNode\n}\n\n//\n\nexport function useLinkProps<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(\n options: MakeLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const { buildLink, state: routerState } = useRouter()\n const match = useMatch({\n strict: false,\n })\n\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n hash,\n search,\n params,\n to,\n state,\n mask,\n preload,\n preloadDelay,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ...rest\n } = options\n\n const linkInfo = buildLink(routerState, {\n from: options.to ? match.pathname : undefined,\n ...options,\n } as any)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n handleTouchStart,\n isActive,\n next,\n } = linkInfo\n\n const handleReactClick = (e: Event) => {\n if (options.startTransition ?? true) {\n ;(React.startTransition || ((d) => d))(() => {\n handleClick(e)\n })\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps as any, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled\n ? undefined\n : next.maskedLocation\n ? next.maskedLocation.href\n : next.href,\n onClick: composeHandlers([onClick, handleReactClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkComponent<TProps extends Record<string, any> = {}> {\n <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n props: MakeLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n TProps &\n React.RefAttributes<HTMLAnchorElement>,\n ): ReactNode\n}\n\nexport const Link: LinkComponent = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\nexport function Navigate<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(props: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const { navigate } = useRouter()\n const match = useMatch({ strict: false })\n\n useLayoutEffect(() => {\n navigate({\n from: props.to ? match.pathname : undefined,\n ...props,\n } as any)\n }, [])\n\n return null\n}\n\nexport const matchesContext = React.createContext<RouteMatch[]>(null!)\nexport type RouterProps<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & {\n router: Router<TRouteTree>\n context?: Partial<RouterOptions<TRouteTree, TDehydrated>['meta']>\n}\n\nexport function useRouter<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n>(): RouterContext<TRouteTree> {\n const resolvedContext = window.__TSR_ROUTER_CONTEXT__ || routerContext\n const value = React.useContext(resolvedContext)\n warning(value, 'useRouter must be used inside a <RouterProvider> component!')\n return value as any\n}\n\nexport function useRouterState<\n TSelected = RouterState<RegisteredRouter['routeTree']>,\n>(opts?: {\n select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected\n}): TSelected {\n const { state } = useRouter()\n // return useStore(router.__store, opts?.select as any)\n return opts?.select ? opts.select(state) : (state as any)\n}\n\nexport function useMatches<T = RouteMatch[]>(opts?: {\n select?: (matches: RouteMatch[]) => T\n}): T {\n const contextMatches = React.useContext(matchesContext)\n\n return useRouterState({\n select: (state) => {\n const matches = state.matches.slice(\n state.matches.findIndex((d) => d.id === contextMatches[0]?.id),\n )\n return opts?.select ? opts.select(matches) : (matches as T)\n },\n })\n}\n\ntype StrictOrFrom<TFrom> =\n | {\n from: TFrom\n strict?: true\n }\n | {\n from?: never\n strict: false\n }\n\nexport function useMatch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TRouteMatchState = RouteMatch<TRouteTree, TFrom>,\n TSelected = TRouteMatchState,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (match: TRouteMatchState) => TSelected\n },\n): TStrict extends true ? TRouteMatchState : TRouteMatchState | undefined {\n const nearestMatch = React.useContext(matchesContext)[0]!\n const nearestMatchRouteId = nearestMatch?.routeId\n\n const matchRouteId = useRouterState({\n select: (state) => {\n const match = opts?.from\n ? state.matches.find((d) => d.routeId === opts?.from)\n : state.matches.find((d) => d.id === nearestMatch.id)\n\n return match!.routeId\n },\n })\n\n if (opts?.strict ?? true) {\n invariant(\n nearestMatchRouteId == matchRouteId,\n `useMatch(\"${\n matchRouteId as string\n }\") is being called in a component that is meant to render the '${nearestMatchRouteId}' route. Did you mean to 'useMatch(\"${\n matchRouteId as string\n }\", { strict: false })' or 'useRoute(\"${\n matchRouteId as string\n }\")' instead?`,\n )\n }\n\n const matchSelection = useRouterState({\n select: (state) => {\n const match = opts?.from\n ? state.matches.find((d) => d.routeId === opts?.from)\n : state.matches.find((d) => d.id === nearestMatch.id)\n\n invariant(\n match,\n `Could not find ${\n opts?.from\n ? `an active match from \"${opts.from}\"`\n : 'a nearest match!'\n }`,\n )\n\n return opts?.select ? opts.select(match as any) : match\n },\n })\n\n return matchSelection as any\n}\n\nexport type RouteFromIdOrRoute<\n T,\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n> = T extends ParseRoute<TRouteTree>\n ? T\n : T extends RouteIds<TRouteTree>\n ? RoutesById<TRouteTree>[T]\n : T extends string\n ? RouteIds<TRouteTree>\n : never\n\nexport function useRouteMeta<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TRouteMeta = RouteById<TRouteTree, TFrom>['types']['allMeta'],\n TSelected = TRouteMeta,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TRouteMeta) => TSelected\n },\n): TStrict extends true ? TSelected : TSelected | undefined {\n return useMatch({\n ...(opts as any),\n select: (match: RouteMatch) =>\n opts?.select ? opts.select(match.meta as TRouteMeta) : match.meta,\n })\n}\n\nexport function useSearch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TSearch = RouteById<TRouteTree, TFrom>['types']['fullSearchSchema'],\n TSelected = TSearch,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TSearch) => TSelected\n },\n): TStrict extends true ? TSelected : TSelected | undefined {\n return useMatch({\n ...(opts as any),\n select: (match: RouteMatch) => {\n return opts?.select ? opts.select(match.search as TSearch) : match.search\n },\n })\n}\n\nexport function useParams<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TDefaultSelected = AllParams<TRouteTree> &\n RouteById<TRouteTree, TFrom>['types']['allParams'],\n TSelected = TDefaultSelected,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TDefaultSelected) => TSelected\n },\n): TSelected {\n return useRouterState({\n select: (state: any) => {\n const params = (last(state.matches) as any)?.params\n return opts?.select ? opts.select(params) : params\n },\n })\n}\n\nexport function useNavigate<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TDefaultFrom extends RoutePaths<TRouteTree> = '/',\n>(defaultOpts?: { from?: TDefaultFrom }) {\n const { navigate } = useRouter()\n const match = useMatch({\n strict: false,\n })\n return React.useCallback(\n <\n TFrom extends RoutePaths<TRouteTree> = TDefaultFrom,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n ) => {\n return navigate({\n from: opts?.to ? match.pathname : undefined,\n ...defaultOpts,\n ...(opts as any),\n })\n },\n [],\n )\n}\n\nexport function useMatchRoute<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n>() {\n const { state, matchRoute } = useRouter()\n\n return React.useCallback(\n <\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n >(\n opts: MakeUseMatchRouteOptions<\n TRouteTree,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n >,\n ): false | RouteById<TRouteTree, TResolved>['types']['allParams'] => {\n const { pending, caseSensitive, ...rest } = opts\n\n return matchRoute(state, rest as any, {\n pending,\n caseSensitive,\n })\n },\n [],\n )\n}\n\nexport function Matches() {\n const { routesById, state } = useRouter()\n\n // const matches = useRouterState({\n // select: (state) => {\n // return state.matches\n // },\n // })\n\n const { matches } = state\n\n const locationKey = useRouterState({\n select: (d) => d.resolvedLocation.state?.key,\n })\n\n const route = routesById[rootRouteId]\n\n const errorComponent = React.useCallback(\n (props: any) => {\n return React.createElement(ErrorComponent, {\n ...props,\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })\n },\n [route],\n )\n\n return (\n <matchesContext.Provider value={matches}>\n <CatchBoundary\n resetKey={locationKey}\n errorComponent={errorComponent}\n onCatch={() => {\n warning(\n false,\n `Error in router! Consider setting an 'errorComponent' in your RootRoute! 👍`,\n )\n }}\n >\n {matches.length ? <Match matches={matches} /> : null}\n </CatchBoundary>\n </matchesContext.Provider>\n )\n}\n\nexport function MatchRoute<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(\n props: MakeMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return !!params ? props.children : null\n}\n\nexport function Outlet() {\n const matches = React.useContext(matchesContext).slice(1)\n\n if (!matches[0]) {\n return null\n }\n\n return <Match matches={matches} />\n}\n\nconst defaultPending = () => null\n\nfunction Match({ matches }: { matches: RouteMatch[] }) {\n const { options, routesById } = useRouter()\n const match = matches[0]!\n const routeId = match?.routeId\n const route = routesById[routeId]\n const locationKey = useRouterState({\n select: (s) => s.resolvedLocation.state?.key,\n })\n\n const PendingComponent = (route.options.pendingComponent ??\n options.defaultPendingComponent ??\n defaultPending) as any\n\n const routeErrorComponent =\n route.options.errorComponent ??\n options.defaultErrorComponent ??\n ErrorComponent\n\n const ResolvedSuspenseBoundary =\n route.options.wrapInSuspense ?? !route.isRoot\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = !!routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const errorComponent = React.useCallback(\n (props: any) => {\n return React.createElement(routeErrorComponent, {\n ...props,\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })\n },\n [route],\n )\n\n return (\n <matchesContext.Provider value={matches}>\n <ResolvedSuspenseBoundary\n fallback={React.createElement(PendingComponent, {\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })}\n >\n <ResolvedCatchBoundary\n resetKey={locationKey}\n errorComponent={errorComponent}\n onCatch={() => {\n warning(false, `Error in route match: ${match.id}`)\n }}\n >\n <MatchInner match={match} />\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchesContext.Provider>\n )\n}\n\nfunction MatchInner({ match }: { match: RouteMatch }): any {\n const { options, routesById } = useRouter()\n const route = routesById[match.routeId]\n\n if (match.status === 'error') {\n throw match.error\n }\n\n if (match.status === 'pending') {\n throw match.loadPromise\n }\n\n if (match.status === 'success') {\n let comp = route.options.component ?? options.defaultComponent\n\n if (comp) {\n return React.createElement(comp, {\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta as any,\n useSearch: route.useSearch,\n useParams: route.useParams as any,\n } as any)\n }\n\n return <Outlet />\n }\n\n invariant(\n false,\n 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',\n )\n}\n\nfunction SafeFragment(props: any) {\n return <>{props.children}</>\n}\n\n// export function useInjectHtml() {\n// const { } = useRouter()\n\n// return React.useCallback(\n// (html: string | (() => Promise<string> | string)) => {\n// router.injectHtml(html)\n// },\n// [],\n// )\n// }\n\n// export function useDehydrate() {\n// const { } = useRouter()\n\n// return React.useCallback(function dehydrate<T>(\n// key: any,\n// data: T | (() => Promise<T> | T),\n// ) {\n// return router.dehydrateData(key, data)\n// },\n// [])\n// }\n\n// export function useHydrate() {\n// const { } = useRouter()\n\n// return function hydrate<T = unknown>(key: any) {\n// return router.hydrateData(key) as T\n// }\n// }\n\n// This is the messiest thing ever... I'm either seriously tired (likely) or\n// there has to be a better way to reset error boundaries when the\n// router's location key changes.\n\nexport function CatchBoundary(props: {\n resetKey: string\n children: any\n errorComponent?: any\n onCatch: (error: any) => void\n}) {\n const errorComponent = props.errorComponent ?? ErrorComponent\n\n return (\n <CatchBoundaryImpl\n resetKey={props.resetKey}\n onCatch={props.onCatch}\n children={({ error }) => {\n if (error) {\n return React.createElement(errorComponent, {\n error,\n })\n }\n\n return props.children\n }}\n />\n )\n}\n\nexport class CatchBoundaryImpl extends React.Component<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: (error: any) => void\n}> {\n state = { error: null } as any\n static getDerivedStateFromError(error: any) {\n return { error }\n }\n componentDidUpdate(\n prevProps: Readonly<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: ((error: any, info: any) => void) | undefined\n }>,\n prevState: any,\n ): void {\n if (prevState.error && prevProps.resetKey !== this.props.resetKey) {\n this.setState({ error: null })\n }\n }\n componentDidCatch(error: any) {\n this.props.onCatch?.(error)\n }\n render() {\n return this.props.children(this.state)\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n\nexport function useBlocker(\n message: string,\n condition: boolean | any = true,\n): void {\n const { history } = useRouter()\n\n React.useEffect(() => {\n if (!condition) return\n\n let unblock = history.block((retry, cancel) => {\n if (window.confirm(message)) {\n unblock()\n retry()\n }\n })\n\n return unblock\n })\n}\n\nexport function Block({ message, condition, children }: PromptProps) {\n useBlocker(message, condition)\n return (children ?? null) as ReactNode\n}\n\nexport function shallow<T>(objA: T, objB: T) {\n if (Object.is(objA, objB)) {\n return true\n }\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return false\n }\n\n const keysA = Object.keys(objA)\n if (keysA.length !== Object.keys(objB).length) {\n return false\n }\n\n for (let i = 0; i < keysA.length; i++) {\n if (\n !Object.prototype.hasOwnProperty.call(objB, keysA[i] as string) ||\n !Object.is(objA[keysA[i] as keyof T], objB[keysA[i] as keyof T])\n ) {\n return false\n }\n }\n return true\n}\n"],"names":["useLayoutEffect","window","React","useEffect","lazyRouteComponent","importer","exportName","loadPromise","load","lazyComp","lazy","moduleExports","comp","default","preload","useLinkProps","options","buildLink","state","routerState","useRouter","match","useMatch","strict","type","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","mask","preloadDelay","replace","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","rest","linkInfo","from","pathname","undefined","href","handleClick","handleFocus","handleEnter","handleLeave","handleTouchStart","isActive","next","handleReactClick","e","startTransition","d","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","defaultPrevented","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","maskedLocation","join","role","Link","forwardRef","props","ref","linkProps","createElement","_extends","Navigate","navigate","matchesContext","createContext","resolvedContext","__TSR_ROUTER_CONTEXT__","routerContext","value","useContext","warning","useRouterState","opts","select","useMatches","contextMatches","matches","slice","findIndex","id","nearestMatch","nearestMatchRouteId","routeId","matchRouteId","find","invariant","matchSelection","useRouteMeta","meta","useSearch","useParams","last","useNavigate","defaultOpts","useCallback","useMatchRoute","matchRoute","pending","caseSensitive","Matches","routesById","locationKey","resolvedLocation","key","route","rootRouteId","errorComponent","ErrorComponent","Provider","CatchBoundary","resetKey","onCatch","length","Match","MatchRoute","Outlet","defaultPending","s","PendingComponent","pendingComponent","defaultPendingComponent","routeErrorComponent","defaultErrorComponent","ResolvedSuspenseBoundary","wrapInSuspense","isRoot","Suspense","SafeFragment","ResolvedCatchBoundary","fallback","MatchInner","status","error","component","defaultComponent","Fragment","CatchBoundaryImpl","Component","getDerivedStateFromError","componentDidUpdate","prevProps","prevState","setState","componentDidCatch","render","show","setShow","useState","process","env","NODE_ENV","padding","maxWidth","display","alignItems","gap","fontSize","appearance","border","fontWeight","borderRadius","height","color","overflow","message","useBlocker","condition","history","unblock","block","retry","cancel","confirm","Block","shallow","objA","objB","Object","is","keysA","keys","i","prototype","hasOwnProperty","call"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,eAAe,GACnB,OAAOC,MAAM,KAAK,WAAW,GAAGC,gBAAK,CAACF,eAAe,GAAGE,gBAAK,CAACC,SAAS,CAAA;;AAoCzE;;AAoCO,SAASC,kBAAkBA,CAIhCC,QAA0B,EAC1BC,UAAiB,EAGT;AACR,EAAA,IAAIC,WAAyB,CAAA;EAE7B,MAAMC,IAAI,GAAGA,MAAM;IACjB,IAAI,CAACD,WAAW,EAAE;MAChBA,WAAW,GAAGF,QAAQ,EAAE,CAAA;AAC1B,KAAA;AAEA,IAAA,OAAOE,WAAW,CAAA;GACnB,CAAA;AAED,EAAA,MAAME,QAAQ,gBAAGP,gBAAK,CAACQ,IAAI,CAAC,YAAY;AACtC,IAAA,MAAMC,aAAa,GAAG,MAAMH,IAAI,EAAE,CAAA;AAClC,IAAA,MAAMI,IAAI,GAAGD,aAAa,CAACL,UAAU,IAAI,SAAS,CAAC,CAAA;IACnD,OAAO;AACLO,MAAAA,OAAO,EAAED,IAAAA;KACV,CAAA;AACH,GAAC,CAAC,CAAA;EAEAH,QAAQ,CAASK,OAAO,GAAGN,IAAI,CAAA;AAEjC,EAAA,OAAOC,QAAQ,CAAA;AACjB,CAAA;AA6EA;;AAEO,SAASM,YAAYA,CAO1BC,OAAyE,EAC1B;EAC/C,MAAM;IAAEC,SAAS;AAAEC,IAAAA,KAAK,EAAEC,WAAAA;GAAa,GAAGC,SAAS,EAAE,CAAA;EACrD,MAAMC,KAAK,GAAGC,QAAQ,CAAC;AACrBC,IAAAA,MAAM,EAAE,KAAA;A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OAAOC,IAAI,KAAK,QAAQ,IACxBA,IAAI,KAAK,IAAI,EACb;AACA,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,MAAMG,KAAK,GAAGF,MAAM,CAACG,IAAI,CAACL,IAAI,CAAC,CAAA;AAC/B,EAAA,IAAII,KAAK,CAACnE,MAAM,KAAKiE,MAAM,CAACG,IAAI,CAACJ,IAAI,CAAC,CAAChE,MAAM,EAAE;AAC7C,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,KAAK,IAAIqE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,KAAK,CAACnE,MAAM,EAAEqE,CAAC,EAAE,EAAE;AACrC,IAAA,IACE,CAACJ,MAAM,CAACK,SAAS,CAACC,cAAc,CAACC,IAAI,CAACR,IAAI,EAAEG,KAAK,CAACE,CAAC,CAAW,CAAC,IAC/D,CAACJ,MAAM,CAACC,EAAE,CAACH,IAAI,CAACI,KAAK,CAACE,CAAC,CAAC,CAAY,EAAEL,IAAI,CAACG,KAAK,CAACE,CAAC,CAAC,CAAY,CAAC,EAChE;AACA,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AACA,EAAA,OAAO,IAAI,CAAA;AACb;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react.js","sources":["../../src/react.tsx"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n LinkOptions,\n ToOptions,\n ResolveRelativePath,\n NavigateOptions,\n} from './link'\nimport {\n AnySearchSchema,\n AnyPathParams,\n AnyContext,\n AnyRoute,\n rootRouteId,\n} from './route'\nimport {\n RoutePaths,\n RouteByPath,\n RouteIds,\n ParseRoute,\n RoutesById,\n RouteById,\n AllParams,\n} from './routeInfo'\nimport { RegisteredRouter, RouterOptions, Router, RouterState } from './router'\nimport { RouteMatch } from './RouteMatch'\nimport { NoInfer, functionalUpdate, last } from './utils'\nimport { MatchRouteOptions, RouterContext } from './RouterProvider'\nimport { routerContext } from './RouterProvider'\n\nconst useLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type RouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = {\n useMatch: <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }) => TSelected\n useRouteMeta: <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }) => TSelected\n useSearch: <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }) => TSelected\n useParams: <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }) => TSelected\n}\n\nexport type ErrorRouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = {\n error: unknown\n info: { componentStack: string }\n} & RouteProps<TFullSearchSchema, TAllParams, TAllContext>\n\nexport type PendingRouteProps<\n TFullSearchSchema extends Record<string, any> = AnySearchSchema,\n TAllParams extends AnyPathParams = AnyPathParams,\n TAllContext extends Record<string, any> = AnyContext,\n> = RouteProps<TFullSearchSchema, TAllParams, TAllContext>\n\n//\n\ntype ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<RouteProps<TFullSearchSchema, TAllParams, TAllContext>>\n\nexport type ErrorRouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<\n ErrorRouteProps<TFullSearchSchema, TAllParams, TAllContext>\n>\n\nexport type PendingRouteComponent<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends Record<string, any>,\n> = AsyncRouteComponent<\n PendingRouteProps<TFullSearchSchema, TAllParams, TAllContext>\n>\n\nexport type AnyRouteComponent = RouteComponent<any, any, any>\n\nexport function lazyRouteComponent<\n T extends Record<string, any>,\n TKey extends keyof T = 'default',\n>(\n importer: () => Promise<T>,\n exportName?: TKey,\n): T[TKey] extends (props: infer TProps) => any\n ? AsyncRouteComponent<TProps>\n : never {\n let loadPromise: Promise<any>\n\n const load = () => {\n if (!loadPromise) {\n loadPromise = importer()\n }\n\n return loadPromise\n }\n\n const lazyComp = React.lazy(async () => {\n const moduleExports = await load()\n const comp = moduleExports[exportName ?? 'default']\n return {\n default: comp,\n }\n })\n\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n\nexport type LinkPropsOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // If set to `true`, the link's underlying navigate() call will be wrapped in a `React.startTransition` call. Defaults to `true`.\n startTransition?: boolean\n}\n\nexport type MakeUseMatchRouteOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToOptions<AnyRoute, TFrom, TTo, TMaskFrom, TMaskTo> & MatchRouteOptions\n\nexport type MakeMatchRouteOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouteTree,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => ReactNode)\n | React.ReactNode\n }\n\nexport type MakeLinkPropsOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>\n\nexport type MakeLinkOptions<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n> = LinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n }\n\nexport type PromptProps = {\n message: string\n condition?: boolean | any\n children?: ReactNode\n}\n\n//\n\nexport function useLinkProps<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(\n options: MakeLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const { buildLink, state: routerState } = useRouter()\n const match = useMatch({\n strict: false,\n })\n\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n hash,\n search,\n params,\n to,\n state,\n mask,\n preload,\n preloadDelay,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ...rest\n } = options\n\n const linkInfo = buildLink(routerState, {\n from: options.to ? match.pathname : undefined,\n ...options,\n } as any)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n handleTouchStart,\n isActive,\n next,\n } = linkInfo\n\n const handleReactClick = (e: Event) => {\n if (options.startTransition ?? true) {\n ;(React.startTransition || ((d) => d))(() => {\n handleClick(e)\n })\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps as any, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled\n ? undefined\n : next.maskedLocation\n ? next.maskedLocation.href\n : next.href,\n onClick: composeHandlers([onClick, handleReactClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkComponent<TProps extends Record<string, any> = {}> {\n <\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n props: MakeLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &\n TProps &\n React.RefAttributes<HTMLAnchorElement>,\n ): ReactNode\n}\n\nexport const Link: LinkComponent = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\nexport function Navigate<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(props: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const { navigate } = useRouter()\n const match = useMatch({ strict: false })\n\n useLayoutEffect(() => {\n navigate({\n from: props.to ? match.pathname : undefined,\n ...props,\n } as any)\n }, [])\n\n return null\n}\n\nexport const matchesContext = React.createContext<RouteMatch[]>(null!)\nexport type RouterProps<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & {\n router: Router<TRouteTree>\n context?: Partial<RouterOptions<TRouteTree, TDehydrated>['meta']>\n}\n\nexport function useRouter<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n>(): RouterContext<TRouteTree> {\n const resolvedContext = window.__TSR_ROUTER_CONTEXT__ || routerContext\n const value = React.useContext(resolvedContext)\n warning(value, 'useRouter must be used inside a <RouterProvider> component!')\n return value as any\n}\n\nexport function useRouterState<\n TSelected = RouterState<RegisteredRouter['routeTree']>,\n>(opts?: {\n select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected\n}): TSelected {\n const { state } = useRouter()\n // return useStore(router.__store, opts?.select as any)\n return opts?.select ? opts.select(state) : (state as any)\n}\n\nexport function useMatches<T = RouteMatch[]>(opts?: {\n select?: (matches: RouteMatch[]) => T\n}): T {\n const contextMatches = React.useContext(matchesContext)\n\n return useRouterState({\n select: (state) => {\n const matches = state.matches.slice(\n state.matches.findIndex((d) => d.id === contextMatches[0]?.id),\n )\n return opts?.select ? opts.select(matches) : (matches as T)\n },\n })\n}\n\ntype StrictOrFrom<TFrom> =\n | {\n from: TFrom\n strict?: true\n }\n | {\n from?: never\n strict: false\n }\n\nexport function useMatch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TRouteMatchState = RouteMatch<TRouteTree, TFrom>,\n TSelected = TRouteMatchState,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (match: TRouteMatchState) => TSelected\n },\n): TStrict extends true ? TRouteMatchState : TRouteMatchState | undefined {\n const nearestMatch = React.useContext(matchesContext)[0]!\n const nearestMatchRouteId = nearestMatch?.routeId\n\n const matchRouteId = useRouterState({\n select: (state) => {\n const match = opts?.from\n ? state.matches.find((d) => d.routeId === opts?.from)\n : state.matches.find((d) => d.id === nearestMatch.id)\n\n return match!.routeId\n },\n })\n\n if (opts?.strict ?? true) {\n invariant(\n nearestMatchRouteId == matchRouteId,\n `useMatch(\"${\n matchRouteId as string\n }\") is being called in a component that is meant to render the '${nearestMatchRouteId}' route. Did you mean to 'useMatch(\"${\n matchRouteId as string\n }\", { strict: false })' or 'useRoute(\"${\n matchRouteId as string\n }\")' instead?`,\n )\n }\n\n const matchSelection = useRouterState({\n select: (state) => {\n const match = opts?.from\n ? state.matches.find((d) => d.routeId === opts?.from)\n : state.matches.find((d) => d.id === nearestMatch.id)\n\n invariant(\n match,\n `Could not find ${\n opts?.from\n ? `an active match from \"${opts.from}\"`\n : 'a nearest match!'\n }`,\n )\n\n return opts?.select ? opts.select(match as any) : match\n },\n })\n\n return matchSelection as any\n}\n\nexport type RouteFromIdOrRoute<\n T,\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n> = T extends ParseRoute<TRouteTree>\n ? T\n : T extends RouteIds<TRouteTree>\n ? RoutesById<TRouteTree>[T]\n : T extends string\n ? RouteIds<TRouteTree>\n : never\n\nexport function useRouteMeta<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TRouteMeta = RouteById<TRouteTree, TFrom>['types']['allMeta'],\n TSelected = TRouteMeta,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TRouteMeta) => TSelected\n },\n): TStrict extends true ? TSelected : TSelected | undefined {\n return useMatch({\n ...(opts as any),\n select: (match: RouteMatch) =>\n opts?.select ? opts.select(match.meta as TRouteMeta) : match.meta,\n })\n}\n\nexport function useSearch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n TSearch = RouteById<TRouteTree, TFrom>['types']['fullSearchSchema'],\n TSelected = TSearch,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TSearch) => TSelected\n },\n): TStrict extends true ? TSelected : TSelected | undefined {\n return useMatch({\n ...(opts as any),\n select: (match: RouteMatch) => {\n return opts?.select ? opts.select(match.search as TSearch) : match.search\n },\n })\n}\n\nexport function useParams<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,\n TDefaultSelected = AllParams<TRouteTree> &\n RouteById<TRouteTree, TFrom>['types']['allParams'],\n TSelected = TDefaultSelected,\n>(\n opts: StrictOrFrom<TFrom> & {\n select?: (search: TDefaultSelected) => TSelected\n },\n): TSelected {\n return useRouterState({\n select: (state: any) => {\n const params = (last(state.matches) as any)?.params\n return opts?.select ? opts.select(params) : params\n },\n })\n}\n\nexport function useNavigate<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TDefaultFrom extends RoutePaths<TRouteTree> = '/',\n>(defaultOpts?: { from?: TDefaultFrom }) {\n const { navigate } = useRouter()\n const match = useMatch({\n strict: false,\n })\n return React.useCallback(\n <\n TFrom extends RoutePaths<TRouteTree> = TDefaultFrom,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n ) => {\n return navigate({\n from: opts?.to ? match.pathname : undefined,\n ...defaultOpts,\n ...(opts as any),\n })\n },\n [],\n )\n}\n\nexport function typedNavigate<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TDefaultFrom extends RoutePaths<TRouteTree> = '/',\n>(navigate: (opts: NavigateOptions<any>) => Promise<void>) {\n return navigate as <\n TFrom extends RoutePaths<TRouteTree> = TDefaultFrom,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n >(\n opts?: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n ) => Promise<void>\n}\n\nexport function useMatchRoute<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n>() {\n const { state, matchRoute } = useRouter()\n\n return React.useCallback(\n <\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n >(\n opts: MakeUseMatchRouteOptions<\n TRouteTree,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n >,\n ): false | RouteById<TRouteTree, TResolved>['types']['allParams'] => {\n const { pending, caseSensitive, ...rest } = opts\n\n return matchRoute(state, rest as any, {\n pending,\n caseSensitive,\n })\n },\n [],\n )\n}\n\nexport function Matches() {\n const { routesById, state } = useRouter()\n\n // const matches = useRouterState({\n // select: (state) => {\n // return state.matches\n // },\n // })\n\n const { matches } = state\n\n const locationKey = useRouterState({\n select: (d) => d.resolvedLocation.state?.key,\n })\n\n const route = routesById[rootRouteId]\n\n const errorComponent = React.useCallback(\n (props: any) => {\n return React.createElement(ErrorComponent, {\n ...props,\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })\n },\n [route],\n )\n\n return (\n <matchesContext.Provider value={matches}>\n <CatchBoundary\n resetKey={locationKey}\n errorComponent={errorComponent}\n onCatch={() => {\n warning(\n false,\n `Error in router! Consider setting an 'errorComponent' in your RootRoute! 👍`,\n )\n }}\n >\n {matches.length ? <Match matches={matches} /> : null}\n </CatchBoundary>\n </matchesContext.Provider>\n )\n}\n\nexport function MatchRoute<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TFrom extends RoutePaths<TRouteTree> = '/',\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouteTree> = '/',\n TMaskTo extends string = '',\n>(\n props: MakeMatchRouteOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,\n): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return !!params ? props.children : null\n}\n\nexport function Outlet() {\n const matches = React.useContext(matchesContext).slice(1)\n\n if (!matches[0]) {\n return null\n }\n\n return <Match matches={matches} />\n}\n\nconst defaultPending = () => null\n\nfunction Match({ matches }: { matches: RouteMatch[] }) {\n const { options, routesById } = useRouter()\n const match = matches[0]!\n const routeId = match?.routeId\n const route = routesById[routeId]\n const locationKey = useRouterState({\n select: (s) => s.resolvedLocation.state?.key,\n })\n\n const PendingComponent = (route.options.pendingComponent ??\n options.defaultPendingComponent ??\n defaultPending) as any\n\n const routeErrorComponent =\n route.options.errorComponent ??\n options.defaultErrorComponent ??\n ErrorComponent\n\n const ResolvedSuspenseBoundary =\n route.options.wrapInSuspense ?? !route.isRoot\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = !!routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const errorComponent = React.useCallback(\n (props: any) => {\n return React.createElement(routeErrorComponent, {\n ...props,\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })\n },\n [route],\n )\n\n return (\n <matchesContext.Provider value={matches}>\n <ResolvedSuspenseBoundary\n fallback={React.createElement(PendingComponent, {\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta,\n useSearch: route.useSearch,\n useParams: route.useParams,\n })}\n >\n <ResolvedCatchBoundary\n resetKey={locationKey}\n errorComponent={errorComponent}\n onCatch={() => {\n warning(false, `Error in route match: ${match.id}`)\n }}\n >\n <MatchInner match={match} />\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchesContext.Provider>\n )\n}\n\nfunction MatchInner({ match }: { match: RouteMatch }): any {\n const { options, routesById } = useRouter()\n const route = routesById[match.routeId]\n\n if (match.status === 'error') {\n throw match.error\n }\n\n if (match.status === 'pending') {\n throw match.loadPromise\n }\n\n if (match.status === 'success') {\n let comp = route.options.component ?? options.defaultComponent\n\n if (comp) {\n return React.createElement(comp, {\n useMatch: route.useMatch,\n useRouteMeta: route.useRouteMeta as any,\n useSearch: route.useSearch,\n useParams: route.useParams as any,\n } as any)\n }\n\n return <Outlet />\n }\n\n invariant(\n false,\n 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',\n )\n}\n\nfunction SafeFragment(props: any) {\n return <>{props.children}</>\n}\n\n// export function useInjectHtml() {\n// const { } = useRouter()\n\n// return React.useCallback(\n// (html: string | (() => Promise<string> | string)) => {\n// router.injectHtml(html)\n// },\n// [],\n// )\n// }\n\n// export function useDehydrate() {\n// const { } = useRouter()\n\n// return React.useCallback(function dehydrate<T>(\n// key: any,\n// data: T | (() => Promise<T> | T),\n// ) {\n// return router.dehydrateData(key, data)\n// },\n// [])\n// }\n\n// export function useHydrate() {\n// const { } = useRouter()\n\n// return function hydrate<T = unknown>(key: any) {\n// return router.hydrateData(key) as T\n// }\n// }\n\n// This is the messiest thing ever... I'm either seriously tired (likely) or\n// there has to be a better way to reset error boundaries when the\n// router's location key changes.\n\nexport function CatchBoundary(props: {\n resetKey: string\n children: any\n errorComponent?: any\n onCatch: (error: any) => void\n}) {\n const errorComponent = props.errorComponent ?? ErrorComponent\n\n return (\n <CatchBoundaryImpl\n resetKey={props.resetKey}\n onCatch={props.onCatch}\n children={({ error }) => {\n if (error) {\n return React.createElement(errorComponent, {\n error,\n })\n }\n\n return props.children\n }}\n />\n )\n}\n\nexport class CatchBoundaryImpl extends React.Component<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: (error: any) => void\n}> {\n state = { error: null } as any\n static getDerivedStateFromError(error: any) {\n return { error }\n }\n componentDidUpdate(\n prevProps: Readonly<{\n resetKey: string\n children: (props: { error: any; reset: () => void }) => any\n onCatch?: ((error: any, info: any) => void) | undefined\n }>,\n prevState: any,\n ): void {\n if (prevState.error && prevProps.resetKey !== this.props.resetKey) {\n this.setState({ error: null })\n }\n }\n componentDidCatch(error: any) {\n this.props.onCatch?.(error)\n }\n render() {\n return this.props.children(this.state)\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n\nexport function useBlocker(\n message: string,\n condition: boolean | any = true,\n): void {\n const { history } = useRouter()\n\n React.useEffect(() => {\n if (!condition) return\n\n let unblock = history.block((retry, cancel) => {\n if (window.confirm(message)) {\n unblock()\n retry()\n }\n })\n\n return unblock\n })\n}\n\nexport function Block({ message, condition, children }: PromptProps) {\n useBlocker(message, condition)\n return (children ?? null) as ReactNode\n}\n\nexport function shallow<T>(objA: T, objB: T) {\n if (Object.is(objA, objB)) {\n return true\n }\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return false\n }\n\n const keysA = Object.keys(objA)\n if (keysA.length !== Object.keys(objB).length) {\n return false\n }\n\n for (let i = 0; i < keysA.length; i++) {\n if (\n !Object.prototype.hasOwnProperty.call(objB, keysA[i] as string) ||\n !Object.is(objA[keysA[i] as keyof T], objB[keysA[i] as keyof T])\n ) {\n return false\n }\n }\n return true\n}\n"],"names":["useLayoutEffect","window","React","useEffect","lazyRouteComponent","importer","exportName","loadPromise","load","lazyComp","lazy","moduleExports","comp","default","preload","useLinkProps","options","buildLink","state","routerState","useRouter","match","useMatch","strict","type","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","mask","preloadDelay","replace","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","rest","linkInfo","from","pathname","undefined","href","handleClick","handleFocus","handleEnter","handleLeave","handleTouchStart","isActive","next","handleReactClick","e","startTransition","d","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","defaultPrevented","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","maskedLocation","join","role","Link","forwardRef","props","ref","linkProps","createElement","_extends","Navigate","navigate","matchesContext","createContext","resolvedContext","__TSR_ROUTER_CONTEXT__","routerContext","value","useContext","warning","useRouterState","opts","select","useMatches","contextMatches","matches","slice","findIndex","id","nearestMatch","nearestMatchRouteId","routeId","matchRouteId","find","invariant","matchSelection","useRouteMeta","meta","useSearch","useParams","last","useNavigate","defaultOpts","useCallback","typedNavigate","useMatchRoute","matchRoute","pending","caseSensitive","Matches","routesById","locationKey","resolvedLocation","key","route","rootRouteId","errorComponent","ErrorComponent","Provider","CatchBoundary","resetKey","onCatch","length","Match","MatchRoute","Outlet","defaultPending","s","PendingComponent","pendingComponent","defaultPendingComponent","routeErrorComponent","defaultErrorComponent","ResolvedSuspenseBoundary","wrapInSuspense","isRoot","Suspense","SafeFragment","ResolvedCatchBoundary","fallback","MatchInner","status","error","component","defaultComponent","Fragment","CatchBoundaryImpl","Component","getDerivedStateFromError","componentDidUpdate","prevProps","prevState","setState","componentDidCatch","render","show","setShow","useState","process","env","NODE_ENV","padding","maxWidth","display","alignItems","gap","fontSize","appearance","border","fontWeight","borderRadius","height","color","overflow","message","useBlocker","condition","history","unblock","block","retry","cancel","confirm","Block","shallow","objA","objB","Object","is","keysA","keys","i","prototype","hasOwnProperty","call"],"mappings":";;;;;;;;;;;;;;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AAI,CAACL,IAAI,CAAC,CAAA;AAC/B,EAAA,IAAII,KAAK,CAACnE,MAAM,KAAKiE,MAAM,CAACG,IAAI,CAACJ,IAAI,CAAC,CAAChE,MAAM,EAAE;AAC7C,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,KAAK,IAAIqE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,KAAK,CAACnE,MAAM,EAAEqE,CAAC,EAAE,EAAE;AACrC,IAAA,IACE,CAACJ,MAAM,CAACK,SAAS,CAACC,cAAc,CAACC,IAAI,CAACR,IAAI,EAAEG,KAAK,CAACE,CAAC,CAAW,CAAC,IAC/D,CAACJ,MAAM,CAACC,EAAE,CAACH,IAAI,CAACI,KAAK,CAACE,CAAC,CAAC,CAAY,EAAEL,IAAI,CAACG,KAAK,CAACE,CAAC,CAAC,CAAY,CAAC,EAChE;AACA,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACF,GAAA;AACA,EAAA,OAAO,IAAI,CAAA;AACb;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { RoutePaths } from './routeInfo'\nimport { joinPaths, trimPath } from './path'\nimport { AnyRouter } from './router'\nimport { AnyRouteMatch } from './RouteMatch'\nimport {\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n Assign,\n} from './utils'\nimport { ParsePathParams, ToSubOptions } from './link'\nimport {\n ErrorRouteComponent,\n PendingRouteComponent,\n RouteComponent,\n RouteProps,\n useMatch,\n useParams,\n useSearch,\n} from './react'\nimport { HistoryLocation } from '@tanstack/history'\nimport { ParsedLocation } from './location'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\nexport type AnySearchSchema = {}\nexport type AnyContext = {}\nexport interface RouteMeta {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\n// export type MetaOptions = keyof PickRequired<RouteMeta> extends never\n// ? {\n// meta?: RouteMeta\n// }\n// : {\n// meta: RouteMeta\n// }\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = AnyPathParams,\n TAllParams extends AnyPathParams = TParams,\n TRouteMeta extends RouteMeta = RouteMeta,\n TAllMeta extends Record<string, any> = AnyContext,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n> &\n NoInfer<UpdatableRouteOptions<TFullSearchSchema, TAllParams, TAllMeta>>\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\ntype Prefix<T extends string, U extends string> = U extends `${T}${infer _}`\n ? U\n : never\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteMeta extends RouteMeta = RouteMeta,\n TAllContext extends Record<string, any> = AnyContext,\n> = RoutePathOptions<TCustomId, TPath> & {\n getParentRoute: () => TParentRoute\n validateSearch?: SearchSchemaValidator<TSearchSchema>\n} & (keyof PickRequired<RouteMeta> extends never\n ? // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n {\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteMeta\n >\n }\n : {\n beforeLoad: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteMeta\n >\n }) & {\n load?: RouteLoadFn<\n TAllParams,\n TFullSearchSchema,\n NoInfer<TAllContext>,\n NoInfer<TRouteMeta>\n >\n } & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n )\n\ntype BeforeLoadFn<\n TFullSearchSchema extends Record<string, any>,\n TParentRoute extends AnyRoute,\n TAllParams,\n TRouteMeta,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n meta: TParentRoute['types']['allMeta']\n location: ParsedLocation\n}) => Promise<TRouteMeta> | TRouteMeta | void\n\nexport type UpdatableRouteOptions<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends AnyContext,\n> =\n // MetaOptions &\n {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent<TFullSearchSchema, TAllParams, TAllContext>\n // The content to be rendered when the route encounters an error\n errorComponent?: ErrorRouteComponent<\n TFullSearchSchema,\n TAllParams,\n {}\n // TAllContext // TODO: I have no idea why this breaks the universe,\n // so we'll come back to it later.\n > //\n // If supported by your framework, the content to be rendered as the fallback content until the route is ready to render\n pendingComponent?: PendingRouteComponent<\n TFullSearchSchema,\n TAllParams,\n TAllContext\n >\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: AnyRouteMatch) => void\n onTransition?: (match: AnyRouteMatch) => void\n onLeave?: (match: AnyRouteMatch) => void\n // Set this to true or false to specifically set whether or not this route should be preloaded. If unset, will\n // default to router.options.reloadOnWindowFocus\n reloadOnWindowFocus?: boolean\n }\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TReturn> =\n | SearchSchemaValidatorObj<TReturn>\n | SearchSchemaValidatorFn<TReturn>\n\nexport type SearchSchemaValidatorObj<TReturn> = {\n parse?: SearchSchemaValidatorFn<TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TReturn> = (\n searchObj: Record<string, unknown>,\n) => TReturn\n\nexport type DefinedPathParamWarning =\n 'Path params cannot be redefined by child routes!'\n\nexport type ParentParams<TParentParams> = AnyPathParams extends TParentParams\n ? {}\n : {\n [Key in keyof TParentParams]?: DefinedPathParamWarning\n }\n\nexport type RouteLoadFn<\n TAllParams = {},\n TFullSearchSchema extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteMeta extends Record<string, any> = AnyContext,\n> = (\n match: LoadFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteMeta\n > & {\n parentMatchPromise?: Promise<void>\n },\n) => any\n\nexport interface LoadFnContext<\n TAllParams = {},\n TFullSearchSchema extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteMeta extends Record<string, any> = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n search: TFullSearchSchema\n meta: Expand<Assign<TAllContext, TRouteMeta>>\n}\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<\n Assign<InferFullSearchSchema<TParentRoute>, TSearchSchema>\n>\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type StreamedPromise<T> = {\n promise: Promise<T>\n status: 'resolved' | 'pending'\n data: T\n resolve: (value: T) => void\n}\n\nexport type ResolveAllParams<\n TParentRoute extends AnyRoute,\n TParams extends AnyPathParams,\n> = Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : Expand<\n UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n >\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteMeta: RouteMeta\n TAllContext: AnyContext\n TRouterMeta: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport class Route<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteMeta extends RouteConstraints['TRouteMeta'] = RouteMeta,\n TAllMeta extends Expand<\n Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>\n > = Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>,\n TRouterMeta extends RouteConstraints['TRouterMeta'] = AnyContext,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n >\n\n test!: Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n\n constructor(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n >,\n ) {\n this.options = (options as any) || {}\n this.isRoot = !options?.getParentRoute as any\n Route.__onInit(this)\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n fullSearchSchema: TFullSearchSchema\n params: TParams\n allParams: TAllParams\n routeMeta: TRouteMeta\n allMeta: TAllMeta\n children: TChildren\n routeTree: TRouteTree\n routerMeta: TRouterMeta\n }\n\n init = (opts: { originalIndex: number }) => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPath(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n (this.parentRoute.id as any) === rootRouteId\n ? ''\n : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <TNewChildren extends AnyRoute[]>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta,\n TRouterMeta,\n TNewChildren,\n TRouteTree\n > => {\n this.children = children as any\n return this as any\n }\n\n update = (\n options: UpdatableRouteOptions<\n TFullSearchSchema,\n TAllParams,\n Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>\n >,\n ) => {\n Object.assign(this.options, options)\n return this\n }\n\n static __onInit = (route: any) => {\n // This is a dummy static method that should get\n // replaced by a framework specific implementation if necessary\n }\n\n useMatch = <TSelected = TAllMeta>(opts?: {\n select?: (search: TAllMeta) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id }) as any\n }\n useRouteMeta = <TSelected = TAllMeta>(opts?: {\n select?: (search: TAllMeta) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.meta) : d.meta),\n } as any)\n }\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id } as any)\n }\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id } as any)\n }\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any>\n\nexport class RouterMeta<TRouterMeta extends {}> {\n constructor() {}\n\n createRootRoute = <\n TSearchSchema extends Record<string, any> = {},\n TRouteMeta extends RouteMeta = RouteMeta,\n >(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Assign<TRouterMeta, TRouteMeta> // TAllContext\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ): RootRoute<TSearchSchema, TRouteMeta, TRouterMeta> => {\n return new RootRoute(options) as any\n }\n}\n\nexport class RootRoute<\n TSearchSchema extends Record<string, any> = {},\n TRouteMeta extends RouteMeta = RouteMeta,\n TRouterMeta extends {} = {},\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Expand<Assign<TRouterMeta, TRouteMeta>>, // TAllContext\n TRouterMeta, // TRouterMeta\n any, // TChildren\n any // TRouteTree\n> {\n constructor(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Assign<TRouterMeta, TRouteMeta> // TAllContext\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n"],"names":["rootRouteId","Route","constructor","options","isRoot","getParentRoute","__onInit","init","opts","originalIndex","path","id","parentRoute","invariant","trimPath","customId","joinPaths","fullPath","to","addChildren","children","update","Object","assign","route","useMatch","from","useRouteMeta","select","d","meta","useSearch","useParams","RouterMeta","createRootRoute","RootRoute","createRouteMask"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAMA,WAAW,GAAG,WAAmB;;AAoB9C;AACA;AACA;AACA;AACA;AACA;AACA;AAsKA;AA+HO,MAAMC,KAAK,CAgChB;AAgBA;;AAGA;;AAKA;;EAMAC,WAAWA,CACTC,OAUC,EACD;AACA,IAAA,IAAI,CAACA,OAAO,GAAIA,OAAO,IAAY,EAAE,CAAA;AACrC,IAAA,IAAI,CAACC,MAAM,GAAG,CAACD,OAAO,EAAEE,cAAqB,CAAA;AAC7CJ,IAAAA,KAAK,CAACK,QAAQ,CAAC,IAAI,CAAC,CAAA;AACtB,GAAA;EAoBAC,IAAI,GAAIC,IAA+B,IAAK;AAC1C,IAAA,IAAI,CAACC,aAAa,GAAGD,IAAI,CAACC,aAAa,CAAA;AAEvC,IAAA,MAAMN,OAAO,GAAG,IAAI,CAACA,OAW2B,CAAA;IAEhD,MAAMC,MAAM,GAAG,CAACD,OAAO,EAAEO,IAAI,IAAI,CAAC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Q,CAAC,CAAA;GACpD,CAAA;AACH,CAAA;AAIO,MAAMsB,UAAU,CAAyB;EAC9C/B,WAAWA,GAAG,EAAC;EAEfgC,eAAe,GAIb/B,OAkBC,IACqD;AACtD,IAAA,OAAO,IAAIgC,SAAS,CAAChC,OAAO,CAAC,CAAA;GAC9B,CAAA;AACH,CAAA;AAEO,MAAMgC,SAAS,SAIZlC,KAAK,CAeb;EACAC,WAAWA,CACTC,OAkBC,EACD;IACA,KAAK,CAACA,OAAc,CAAC,CAAA;AACvB,GAAA;AACF,CAAA;AAkDO,SAASiC,eAAeA,CAK7B5B,IAEwC,EACjB;AACvB,EAAA,OAAOA,IAAI,CAAA;AACb;;;;;;;;"}
1
+ {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { RoutePaths } from './routeInfo'\nimport { joinPaths, trimPath } from './path'\nimport { AnyRouter } from './router'\nimport { AnyRouteMatch } from './RouteMatch'\nimport {\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n Assign,\n} from './utils'\nimport { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport {\n ErrorRouteComponent,\n PendingRouteComponent,\n RouteComponent,\n RouteProps,\n useMatch,\n useParams,\n useSearch,\n} from './react'\nimport { HistoryLocation } from '@tanstack/history'\nimport { ParsedLocation } from './location'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\nexport type AnySearchSchema = {}\nexport type AnyContext = {}\nexport interface RouteMeta {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\n// export type MetaOptions = keyof PickRequired<RouteMeta> extends never\n// ? {\n// meta?: RouteMeta\n// }\n// : {\n// meta: RouteMeta\n// }\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = AnyPathParams,\n TAllParams extends AnyPathParams = TParams,\n TRouteMeta extends RouteMeta = RouteMeta,\n TAllMeta extends Record<string, any> = AnyContext,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n> &\n NoInfer<UpdatableRouteOptions<TFullSearchSchema, TAllParams, TAllMeta>>\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\ntype Prefix<T extends string, U extends string> = U extends `${T}${infer _}`\n ? U\n : never\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchema extends Record<string, any> = {},\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteMeta extends RouteMeta = RouteMeta,\n TAllContext extends Record<string, any> = AnyContext,\n> = RoutePathOptions<TCustomId, TPath> & {\n getParentRoute: () => TParentRoute\n validateSearch?: SearchSchemaValidator<TSearchSchema>\n} & (keyof PickRequired<RouteMeta> extends never\n ? // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n {\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteMeta\n >\n }\n : {\n beforeLoad: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteMeta\n >\n }) & {\n load?: RouteLoadFn<\n TAllParams,\n TFullSearchSchema,\n NoInfer<TAllContext>,\n NoInfer<TRouteMeta>\n >\n } & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n )\n\ntype BeforeLoadFn<\n TFullSearchSchema extends Record<string, any>,\n TParentRoute extends AnyRoute,\n TAllParams,\n TRouteMeta,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n meta: TParentRoute['types']['allMeta']\n location: ParsedLocation\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n}) => Promise<TRouteMeta> | TRouteMeta | void\n\nexport type UpdatableRouteOptions<\n TFullSearchSchema extends Record<string, any>,\n TAllParams extends AnyPathParams,\n TAllContext extends AnyContext,\n> =\n // MetaOptions &\n {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent<TFullSearchSchema, TAllParams, TAllContext>\n // The content to be rendered when the route encounters an error\n errorComponent?: ErrorRouteComponent<\n TFullSearchSchema,\n TAllParams,\n {}\n // TAllContext // TODO: I have no idea why this breaks the universe,\n // so we'll come back to it later.\n > //\n // If supported by your framework, the content to be rendered as the fallback content until the route is ready to render\n pendingComponent?: PendingRouteComponent<\n TFullSearchSchema,\n TAllParams,\n TAllContext\n >\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: AnyRouteMatch) => void\n onTransition?: (match: AnyRouteMatch) => void\n onLeave?: (match: AnyRouteMatch) => void\n // Set this to true or false to specifically set whether or not this route should be preloaded. If unset, will\n // default to router.options.reloadOnWindowFocus\n reloadOnWindowFocus?: boolean\n }\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TReturn> =\n | SearchSchemaValidatorObj<TReturn>\n | SearchSchemaValidatorFn<TReturn>\n\nexport type SearchSchemaValidatorObj<TReturn> = {\n parse?: SearchSchemaValidatorFn<TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TReturn> = (\n searchObj: Record<string, unknown>,\n) => TReturn\n\nexport type DefinedPathParamWarning =\n 'Path params cannot be redefined by child routes!'\n\nexport type ParentParams<TParentParams> = AnyPathParams extends TParentParams\n ? {}\n : {\n [Key in keyof TParentParams]?: DefinedPathParamWarning\n }\n\nexport type RouteLoadFn<\n TAllParams = {},\n TFullSearchSchema extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteMeta extends Record<string, any> = AnyContext,\n> = (\n match: LoadFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteMeta\n > & {\n parentMatchPromise?: Promise<void>\n },\n) => any\n\nexport interface LoadFnContext<\n TAllParams = {},\n TFullSearchSchema extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteMeta extends Record<string, any> = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n search: TFullSearchSchema\n meta: Expand<Assign<TAllContext, TRouteMeta>>\n location: ParsedLocation<TFullSearchSchema>\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n}\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<\n Assign<InferFullSearchSchema<TParentRoute>, TSearchSchema>\n>\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type StreamedPromise<T> = {\n promise: Promise<T>\n status: 'resolved' | 'pending'\n data: T\n resolve: (value: T) => void\n}\n\nexport type ResolveAllParams<\n TParentRoute extends AnyRoute,\n TParams extends AnyPathParams,\n> = Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : Expand<\n UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n >\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteMeta: RouteMeta\n TAllContext: AnyContext\n TRouterMeta: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\nexport class Route<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteMeta extends RouteConstraints['TRouteMeta'] = RouteMeta,\n TAllMeta extends Expand<\n Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>\n > = Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>,\n TRouterMeta extends RouteConstraints['TRouterMeta'] = AnyContext,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n >\n\n test!: Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n\n constructor(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n >,\n ) {\n this.options = (options as any) || {}\n this.isRoot = !options?.getParentRoute as any\n Route.__onInit(this)\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n fullSearchSchema: TFullSearchSchema\n params: TParams\n allParams: TAllParams\n routeMeta: TRouteMeta\n allMeta: TAllMeta\n children: TChildren\n routeTree: TRouteTree\n routerMeta: TRouterMeta\n }\n\n init = (opts: { originalIndex: number }) => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPath(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n (this.parentRoute.id as any) === rootRouteId\n ? ''\n : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <TNewChildren extends AnyRoute[]>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchema,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteMeta,\n TAllMeta,\n TRouterMeta,\n TNewChildren,\n TRouteTree\n > => {\n this.children = children as any\n return this as any\n }\n\n update = (\n options: UpdatableRouteOptions<\n TFullSearchSchema,\n TAllParams,\n Expand<Assign<IsAny<TParentRoute['types']['allMeta'], {}>, TRouteMeta>>\n >,\n ) => {\n Object.assign(this.options, options)\n return this\n }\n\n static __onInit = (route: any) => {\n // This is a dummy static method that should get\n // replaced by a framework specific implementation if necessary\n }\n\n useMatch = <TSelected = TAllMeta>(opts?: {\n select?: (search: TAllMeta) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id }) as any\n }\n useRouteMeta = <TSelected = TAllMeta>(opts?: {\n select?: (search: TAllMeta) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.meta) : d.meta),\n } as any)\n }\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id } as any)\n }\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id } as any)\n }\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any>\n\nexport class RouterMeta<TRouterMeta extends {}> {\n constructor() {}\n\n createRootRoute = <\n TSearchSchema extends Record<string, any> = {},\n TRouteMeta extends RouteMeta = RouteMeta,\n >(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Assign<TRouterMeta, TRouteMeta> // TAllContext\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ): RootRoute<TSearchSchema, TRouteMeta, TRouterMeta> => {\n return new RootRoute(options) as any\n }\n}\n\nexport class RootRoute<\n TSearchSchema extends Record<string, any> = {},\n TRouteMeta extends RouteMeta = RouteMeta,\n TRouterMeta extends {} = {},\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Expand<Assign<TRouterMeta, TRouteMeta>>, // TAllContext\n TRouterMeta, // TRouterMeta\n any, // TChildren\n any // TRouteTree\n> {\n constructor(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchema, // TSearchSchema\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteMeta, // TRouteMeta\n Assign<TRouterMeta, TRouteMeta> // TAllContext\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n"],"names":["rootRouteId","Route","constructor","options","isRoot","getParentRoute","__onInit","init","opts","originalIndex","path","id","parentRoute","invariant","trimPath","customId","joinPaths","fullPath","to","addChildren","children","update","Object","assign","route","useMatch","from","useRouteMeta","select","d","meta","useSearch","useParams","RouterMeta","createRootRoute","RootRoute","createRouteMask"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAMA,WAAW,GAAG,WAAmB;;AAoB9C;AACA;AACA;AACA;AACA;AACA;AACA;AAuKA;AAiIO,MAAMC,KAAK,CAgChB;AAgBA;;AAGA;;AAKA;;EAMAC,WAAWA,CACTC,OAUC,EACD;AACA,IAAA,IAAI,CAACA,OAAO,GAAIA,OAAO,IAAY,EAAE,CAAA;AACrC,IAAA,IAAI,CAACC,MAAM,GAAG,CAACD,OAAO,EAAEE,cAAqB,CAAA;AAC7CJ,IAAAA,KAAK,CAACK,QAAQ,CAAC,IAAI,CAAC,CAAA;AACtB,GAAA;EAoBAC,IAAI,GAAIC,IAA+B,IAAK;AAC1C,IAAA,IAAI,CAACC,aAAa,GAAGD,IAAI,CAACC,aAAa,CAAA;AAEvC,IAAA,MAAMN,OAAO,GAAG,IAAI,CAACA,OAW2B,CAAA;IAEhD,MAAMC,MAAM,GAAG,CAACD,OAAO,EAAEO,IAAI,IAAI,CAACP,OAAO,EAAEQ,EAAE,CAAA;IAE7C,IAAI,CAACC,WAAW,GAAG,IAAI,CAACT,OAAO,EAAEE,cAAc,IAAI,CAAA;AAEnD,IAAA,IAAID,M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,IACqD;AACtD,IAAA,OAAO,IAAIgC,SAAS,CAAChC,OAAO,CAAC,CAAA;GAC9B,CAAA;AACH,CAAA;AAEO,MAAMgC,SAAS,SAIZlC,KAAK,CAeb;EACAC,WAAWA,CACTC,OAkBC,EACD;IACA,KAAK,CAACA,OAAc,CAAC,CAAA;AACvB,GAAA;AACF,CAAA;AAkDO,SAASiC,eAAeA,CAK7B5B,IAEwC,EACjB;AACvB,EAAA,OAAOA,IAAI,CAAA;AACb;;;;;;;;"}
@@ -1173,7 +1173,12 @@ function RouterProvider({
1173
1173
  params: match.params,
1174
1174
  preload: !!preload,
1175
1175
  meta: parentMeta,
1176
- location: state.location // TODO: This might need to be latestLocationRef.current...?
1176
+ location: state.location,
1177
+ // TODO: This might need to be latestLocationRef.current...?
1178
+ navigate: opts => navigate({
1179
+ ...opts,
1180
+ from: match.pathname
1181
+ })
1177
1182
  })) ?? {};
1178
1183
  const meta = {
1179
1184
  ...parentMeta,
@@ -1227,7 +1232,12 @@ function RouterProvider({
1227
1232
  preload: !!preload,
1228
1233
  parentMatchPromise,
1229
1234
  abortController: match.abortController,
1230
- meta: match.meta
1235
+ meta: match.meta,
1236
+ location: state.location,
1237
+ navigate: opts => navigate({
1238
+ ...opts,
1239
+ from: match.pathname
1240
+ })
1231
1241
  });
1232
1242
  await Promise.all([componentsPromise, loaderPromise]);
1233
1243
  if (latestPromise = checkLatest()) return await latestPromise;
@@ -1814,6 +1824,9 @@ function useNavigate(defaultOpts) {
1814
1824
  });
1815
1825
  }, []);
1816
1826
  }
1827
+ function typedNavigate(navigate) {
1828
+ return navigate;
1829
+ }
1817
1830
  function useMatchRoute() {
1818
1831
  const {
1819
1832
  state,
@@ -2246,5 +2259,5 @@ class FileRoute {
2246
2259
  };
2247
2260
  }
2248
2261
 
2249
- export { Block, CatchBoundary, CatchBoundaryImpl, ErrorComponent, FileRoute, Link, MatchRoute, Matches, Navigate, Outlet, PathParamError, RootRoute, Route, Router, RouterMeta, RouterProvider, SearchParamError, cleanPath, componentTypes, createRouteMask, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, getInitialRouterState, getRouteMatch, interpolatePath, isPlainObject, isRedirect, isServer, joinPaths, last, lazyFn, lazyRouteComponent, matchByPath, matchPathname, matchesContext, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, routerContext, shallow, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, useBlocker, useLinkProps, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteMeta, useRouter, useRouterState, useSearch, useStableCallback };
2262
+ export { Block, CatchBoundary, CatchBoundaryImpl, ErrorComponent, FileRoute, Link, MatchRoute, Matches, Navigate, Outlet, PathParamError, RootRoute, Route, Router, RouterMeta, RouterProvider, SearchParamError, cleanPath, componentTypes, createRouteMask, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, getInitialRouterState, getRouteMatch, interpolatePath, isPlainObject, isRedirect, isServer, joinPaths, last, lazyFn, lazyRouteComponent, matchByPath, matchPathname, matchesContext, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, routerContext, shallow, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, typedNavigate, useBlocker, useLinkProps, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteMeta, useRouter, useRouterState, useSearch, useStableCallback };
2250
2263
  //# sourceMappingURL=index.js.map