@tanstack/react-router 0.0.1-beta.26 → 0.0.1-beta.28

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.
@@ -136,9 +136,10 @@ function createReactRouter(opts) {
136
136
  } = linkInfo;
137
137
 
138
138
  const reactHandleClick = e => {
139
- React__namespace.startTransition(() => {
140
- handleClick(e);
141
- });
139
+ if (React__namespace.startTransition) // This is a hack for react < 18
140
+ React__namespace.startTransition(() => {
141
+ handleClick(e);
142
+ });else handleClick(e);
142
143
  };
143
144
 
144
145
  const composeHandlers = handlers => e => {
@@ -323,7 +324,8 @@ function Outlet() {
323
324
  }, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
324
325
  fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
325
326
  }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
326
- errorComponent: errorComponent
327
+ errorComponent: errorComponent,
328
+ key: match.routeId
327
329
  }, (() => {
328
330
  if (match.status === 'error') {
329
331
  throw match.error;
@@ -343,7 +345,8 @@ class CatchBoundary extends React__namespace.Component {
343
345
  constructor() {
344
346
  super(...arguments);
345
347
  this.state = {
346
- error: false
348
+ error: false,
349
+ info: undefined
347
350
  };
348
351
  }
349
352
 
@@ -356,17 +359,49 @@ class CatchBoundary extends React__namespace.Component {
356
359
  }
357
360
 
358
361
  render() {
359
- var _this$props$errorComp;
362
+ return /*#__PURE__*/React__namespace.createElement(CatchBoundaryInner, _rollupPluginBabelHelpers["extends"]({}, this.props, {
363
+ errorState: this.state,
364
+ reset: () => this.setState({})
365
+ }));
366
+ }
367
+
368
+ } // This is the messiest thing ever... I'm either seriously tired (likely) or
369
+ // there has to be a better way to reset error boundaries when the
370
+ // router's location key changes.
360
371
 
361
- const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
362
372
 
363
- if (this.state.error) {
364
- return /*#__PURE__*/React__namespace.createElement(errorComponent, this.state);
373
+ function CatchBoundaryInner(props) {
374
+ var _props$errorComponent;
375
+
376
+ const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState);
377
+ const router = useRouter();
378
+ const errorComponent = (_props$errorComponent = props.errorComponent) != null ? _props$errorComponent : DefaultErrorBoundary;
379
+ React__namespace.useEffect(() => {
380
+ if (activeErrorState) {
381
+ let prevKey = router.state.location.key;
382
+ return router.subscribe(() => {
383
+ if (router.state.location.key !== prevKey) {
384
+ prevKey = router.state.location.key;
385
+ setActiveErrorState({});
386
+ }
387
+ });
388
+ }
389
+
390
+ return;
391
+ }, [activeErrorState]);
392
+ React__namespace.useEffect(() => {
393
+ if (props.errorState.error) {
394
+ setActiveErrorState(props.errorState);
365
395
  }
366
396
 
367
- return this.props.children;
397
+ props.reset();
398
+ }, [props.errorState.error]);
399
+
400
+ if (activeErrorState.error) {
401
+ return /*#__PURE__*/React__namespace.createElement(errorComponent, activeErrorState);
368
402
  }
369
403
 
404
+ return props.children;
370
405
  }
371
406
 
372
407
  function DefaultErrorBoundary(_ref6) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n CheckId,\n rootRouteId,\n Route,\n RouterContext,\n RouterState,\n ToIdOption,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n Router,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\nexport interface RegisterRouter {\n // router: Router\n}\n\nexport type RegisteredRouter = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? Router<TRouteConfig, TAllRouteInfo>\n : Router\n\nexport type RegisteredAllRouteInfo = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? TAllRouteInfo\n : AnyAllRouteInfo\n\nexport type SyncRouteComponent<TProps = {}> = (\n props: TProps,\n) => JSX.Element | React.ReactNode\n\nexport type RouteComponent<TProps = {}> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<SyncRouteComponent<TProps>>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let promise: Promise<SyncRouteComponent>\n let resolvedComp: SyncRouteComponent\n\n const forwardedComp = React.forwardRef((props, ref) => {\n const resolvedCompRef = React.useRef(resolvedComp || lazyComp)\n return React.createElement(\n resolvedCompRef.current as any,\n { ...(ref ? { ref } : {}), ...props } as any,\n )\n })\n\n const finalComp = forwardedComp as unknown as RouteComponent\n\n finalComp.preload = () => {\n if (!promise) {\n promise = importer().then((module) => {\n resolvedComp = module.default\n return resolvedComp\n })\n }\n\n return promise\n }\n\n return finalComp\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\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}\n\ntype MakeMatchRouteOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = ToOptions<TAllRouteInfo, TFrom, TTo> &\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 | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n }\n\ntype MakeLinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkPropsOptions<TAllRouteInfo, TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>\n\ntype MakeLinkOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkPropsOptions<TAllRouteInfo, TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\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\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n ErrorComponent: RouteComponent<{\n error: unknown\n info: { componentStack: string }\n }>\n }\n\n interface RouterOptions<TRouteConfig extends AnyRouteConfig> {\n useContext?: () => RouterContext\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > {\n useState: () => RouterState\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useNearestMatch: () => RouteMatch<TAllRouteInfo, RouteInfo>\n useMatch: <\n TId extends keyof TAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n >(\n routeId: TId,\n opts?: { strict?: TStrict },\n ) => TStrict extends true\n ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n :\n | RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n | undefined\n linkProps: <TTo extends string = '.'>(\n props: MakeLinkPropsOptions<TAllRouteInfo, '/', TTo>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: MakeLinkOptions<TAllRouteInfo, '/', TTo>,\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: MakeMatchRouteOptions<TAllRouteInfo, '/', TTo>,\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n useRoute: <\n TTo extends string = '.',\n TResolved extends string = ResolveRelativePath<\n TRouteInfo['id'],\n NoInfer<TTo>\n >,\n >(\n routeId: CheckId<\n TAllRouteInfo,\n TResolved,\n ToIdOption<TAllRouteInfo, TRouteInfo['id'], TTo>\n >,\n opts?: { strict?: boolean },\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\n linkProps: <TTo extends string = '.'>(\n props: MakeLinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: MakeLinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: MakeMatchRouteOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => JSX.Element\n }\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nexport function Link<TTo extends string = '.'>(\n props: MakeLinkOptions<RegisteredAllRouteInfo, '/', TTo>,\n): JSX.Element {\n const router = useRouter()\n return <router.Link {...(props as any)} />\n}\n\nexport const matchesContext = React.createContext<RouteMatch[]>(null!)\nexport const routerContext = React.createContext<{ router: RegisteredRouter }>(\n null!,\n)\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'useRoute' | 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n useRoute: (subRouteId = '.' as any) => {\n const resolvedRouteId = router.resolvePath(\n route.routeId,\n subRouteId as string,\n )\n const resolvedRoute = router.getRoute(resolvedRouteId)\n useRouterSubscription(router)\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n resolvedRouteId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return resolvedRoute\n },\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options 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 isActive,\n next,\n } = linkInfo\n\n const reactHandleClick = (e: Event) => {\n React.startTransition(() => {\n handleClick(e)\n })\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps, {}) ?? {} : {}\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 ? undefined : next.href,\n onClick: composeHandlers([reactHandleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\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 Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\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 MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useMatch' | 'useState'> = {\n useState: () => {\n useRouterSubscription(router)\n return router.state\n },\n useMatch: (routeId, opts) => {\n useRouterSubscription(router)\n\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatches()?.[0]!\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n if (opts?.strict ?? true) {\n invariant(\n match,\n `Could not find an active match for \"${routeId as string}\"!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch(\"${\n match?.routeId as string\n }\") is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useMatch(\"${\n match?.routeId as string\n }\", { strict: false })' or 'useRoute(\"${\n match?.routeId as string\n }\")' instead?`,\n )\n }\n\n return match as any\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute(rootRouteId), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n loadComponent: async (component) => {\n if (component.preload && typeof document !== 'undefined') {\n component.preload()\n // return await component.preload()\n }\n\n return component as any\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n const defaultRouterContext = React.useRef({})\n\n const userContext =\n router.options.useContext?.() ?? defaultRouterContext.current\n\n router.context = userContext\n\n useRouterSubscription(router)\n React.useEffect(() => {\n return router.mount()\n }, [router])\n\n return (\n <routerContext.Provider value={{ router: router as any }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): RegisteredRouter {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n>(\n routeId: TId,\n opts?: { strict?: TStrict },\n): TStrict extends true\n ? RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TId]\n >\n :\n | RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TId]\n >\n | undefined {\n const router = useRouter()\n return router.useMatch(routeId as any, opts) as any\n}\n\nexport function useNearestMatch(): RouteMatch<\n RegisteredAllRouteInfo,\n RouteInfo\n> {\n const runtimeMatch = useMatches()?.[0]!\n\n invariant(runtimeMatch, `Could not find a nearest match!`)\n\n return runtimeMatch as any\n}\n\nexport function useRoute<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'],\n>(\n routeId: TId,\n): Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]> {\n const router = useRouter()\n return router.useRoute(routeId as any) as any\n}\n\nexport function useSearch<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = keyof RegisteredAllRouteInfo['routeInfoById'],\n>(_routeId?: TId): RegisteredAllRouteInfo['fullSearchSchema'] {\n return useRouter().state.location.search\n}\n\nexport function linkProps<TTo extends string = '.'>(\n props: MakeLinkPropsOptions<RegisteredAllRouteInfo, '/', TTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n return router.linkProps(props as any)\n}\n\nexport function MatchRoute<TTo extends string = '.'>(\n props: MakeMatchRouteOptions<RegisteredAllRouteInfo, '/', TTo>,\n): JSX.Element {\n const router = useRouter()\n return React.createElement(router.MatchRoute, props as any)\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n const defaultPending = React.useCallback(() => null, [])\n\n if (!match) {\n return null\n }\n\n const PendingComponent = (match.__.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.__.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <MatchesProvider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary errorComponent={errorComponent}>\n {\n ((): React.ReactNode => {\n if (match.status === 'error') {\n throw match.error\n }\n\n if (match.status === 'success') {\n return React.createElement(\n (match.__.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n throw match.__.loadPromise\n })() as JSX.Element\n }\n </CatchBoundary>\n </React.Suspense>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n render() {\n const errorComponent = this.props.errorComponent ?? DefaultErrorBoundary\n\n if (this.state.error) {\n return React.createElement(errorComponent, this.state)\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.location.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, location, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as React.ReactNode\n}\n"],"names":["lazy","importer","lazyComp","React","promise","resolvedComp","forwardedComp","forwardRef","props","ref","resolvedCompRef","useRef","createElement","current","finalComp","preload","then","module","default","Link","router","useRouter","matchesContext","createContext","routerContext","MatchesProvider","useRouterSubscription","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","useRoute","subRouteId","resolvedRouteId","resolvePath","routeId","resolvedRoute","getRoute","invariant","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","Boolean","join","role","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useState","useMatch","rootRouteId","runtimeMatch","useMatches","match","matches","find","d","strict","routeExt","Object","assign","createRoute","loadComponent","component","document","RouterProvider","_objectWithoutPropertiesLoose","update","defaultRouterContext","userContext","useContext","context","useEffect","mount","value","warning","useNearestMatch","useSearch","_routeId","location","search","Outlet","slice","defaultPending","useCallback","PendingComponent","__","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","status","error","defaultComponent","loadPromise","CatchBoundary","Component","componentDidCatch","info","console","setState","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","window","confirm","retry","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DO,SAASA,IAAT,CACLC,QADK,EAEW;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAN,CAAWC,QAAX,CAAjB,CAAA;AACA,EAAA,IAAIG,OAAJ,CAAA;AACA,EAAA,IAAIC,YAAJ,CAAA;EAEA,MAAMC,aAAa,gBAAGH,gBA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,KAPa,CAAd,CAAA;AASA,IAAA,OAAOP,OAAP,CAAA;AACD,GAbD,EAaG,CAACD,IAAD,EAAOjC,QAAP,EAAiB4B,OAAjB,CAbH,CAAA,CAAA;AAcD,CAAA;AAEM,SAASc,MAAT,CAA0D,KAAA,EAAA;EAAA,IAA1C;IAAEd,OAAF;IAAWK,IAAX;AAAiBzE,IAAAA,QAAAA;GAAyB,GAAA,KAAA,CAAA;EAC/DwE,SAAS,CAACJ,OAAD,EAAUK,IAAV,WAAUA,IAAV,GAAkB,IAAlB,CAAT,CAAA;AACA,EAAA,OAAQzE,QAAR,IAAA,IAAA,GAAQA,QAAR,GAAoB,IAApB,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n CheckId,\n rootRouteId,\n Route,\n RouterContext,\n RouterState,\n ToIdOption,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n Router,\n} from '@tanstack/router-core'\nimport { restElement } from '@babel/types'\n\nexport * from '@tanstack/router-core'\n\nexport interface RegisterRouter {\n // router: Router\n}\n\nexport type RegisteredRouter = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? Router<TRouteConfig, TAllRouteInfo>\n : Router\n\nexport type RegisteredAllRouteInfo = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? TAllRouteInfo\n : AnyAllRouteInfo\n\nexport type SyncRouteComponent<TProps = {}> = (\n props: TProps,\n) => JSX.Element | React.ReactNode\n\nexport type RouteComponent<TProps = {}> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<SyncRouteComponent<TProps>>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let promise: Promise<SyncRouteComponent>\n let resolvedComp: SyncRouteComponent\n\n const forwardedComp = React.forwardRef((props, ref) => {\n const resolvedCompRef = React.useRef(resolvedComp || lazyComp)\n return React.createElement(\n resolvedCompRef.current as any,\n { ...(ref ? { ref } : {}), ...props } as any,\n )\n })\n\n const finalComp = forwardedComp as unknown as RouteComponent\n\n finalComp.preload = () => {\n if (!promise) {\n promise = importer().then((module) => {\n resolvedComp = module.default\n return resolvedComp\n })\n }\n\n return promise\n }\n\n return finalComp\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\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}\n\ntype MakeMatchRouteOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = ToOptions<TAllRouteInfo, TFrom, TTo> &\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 | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n }\n\ntype MakeLinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkPropsOptions<TAllRouteInfo, TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>\n\ntype MakeLinkOptions<\n TAllRouteInfo extends AnyAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo>,\n TTo extends string,\n> = LinkPropsOptions<TAllRouteInfo, TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\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\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n ErrorComponent: RouteComponent<{\n error: unknown\n info: { componentStack: string }\n }>\n }\n\n interface RouterOptions<TRouteConfig extends AnyRouteConfig> {\n useContext?: () => RouterContext\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > {\n useState: () => RouterState\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useNearestMatch: () => RouteMatch<TAllRouteInfo, RouteInfo>\n useMatch: <\n TId extends keyof TAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n >(\n routeId: TId,\n opts?: { strict?: TStrict },\n ) => TStrict extends true\n ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n :\n | RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n | undefined\n linkProps: <TTo extends string = '.'>(\n props: MakeLinkPropsOptions<TAllRouteInfo, '/', TTo>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: MakeLinkOptions<TAllRouteInfo, '/', TTo>,\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: MakeMatchRouteOptions<TAllRouteInfo, '/', TTo>,\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n useRoute: <\n TTo extends string = '.',\n TResolved extends string = ResolveRelativePath<\n TRouteInfo['id'],\n NoInfer<TTo>\n >,\n >(\n routeId: CheckId<\n TAllRouteInfo,\n TResolved,\n ToIdOption<TAllRouteInfo, TRouteInfo['id'], TTo>\n >,\n opts?: { strict?: boolean },\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\n linkProps: <TTo extends string = '.'>(\n props: MakeLinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: MakeLinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: MakeMatchRouteOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>,\n ) => JSX.Element\n }\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nexport function Link<TTo extends string = '.'>(\n props: MakeLinkOptions<RegisteredAllRouteInfo, '/', TTo>,\n): JSX.Element {\n const router = useRouter()\n return <router.Link {...(props as any)} />\n}\n\nexport const matchesContext = React.createContext<RouteMatch[]>(null!)\nexport const routerContext = React.createContext<{ router: RegisteredRouter }>(\n null!,\n)\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'useRoute' | 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n useRoute: (subRouteId = '.' as any) => {\n const resolvedRouteId = router.resolvePath(\n route.routeId,\n subRouteId as string,\n )\n const resolvedRoute = router.getRoute(resolvedRouteId)\n useRouterSubscription(router)\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n resolvedRouteId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return resolvedRoute\n },\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options 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 isActive,\n next,\n } = linkInfo\n\n const reactHandleClick = (e: Event) => {\n if (React.startTransition) // This is a hack for react < 18\n React.startTransition(() => {handleClick(e)})\n else handleClick(e)\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps, {}) ?? {} : {}\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 ? undefined : next.href,\n onClick: composeHandlers([reactHandleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\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 Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\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 MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useMatch' | 'useState'> = {\n useState: () => {\n useRouterSubscription(router)\n return router.state\n },\n useMatch: (routeId, opts) => {\n useRouterSubscription(router)\n\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatches()?.[0]!\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n if (opts?.strict ?? true) {\n invariant(\n match,\n `Could not find an active match for \"${routeId as string}\"!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch(\"${\n match?.routeId as string\n }\") is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useMatch(\"${\n match?.routeId as string\n }\", { strict: false })' or 'useRoute(\"${\n match?.routeId as string\n }\")' instead?`,\n )\n }\n\n return match as any\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute(rootRouteId), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n loadComponent: async (component) => {\n if (component.preload && typeof document !== 'undefined') {\n component.preload()\n // return await component.preload()\n }\n\n return component as any\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n const defaultRouterContext = React.useRef({})\n\n const userContext =\n router.options.useContext?.() ?? defaultRouterContext.current\n\n router.context = userContext\n\n useRouterSubscription(router)\n React.useEffect(() => {\n return router.mount()\n }, [router])\n\n return (\n <routerContext.Provider value={{ router: router as any }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): RegisteredRouter {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n>(\n routeId: TId,\n opts?: { strict?: TStrict },\n): TStrict extends true\n ? RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TId]\n >\n :\n | RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TId]\n >\n | undefined {\n const router = useRouter()\n return router.useMatch(routeId as any, opts) as any\n}\n\nexport function useNearestMatch(): RouteMatch<\n RegisteredAllRouteInfo,\n RouteInfo\n> {\n const runtimeMatch = useMatches()?.[0]!\n\n invariant(runtimeMatch, `Could not find a nearest match!`)\n\n return runtimeMatch as any\n}\n\nexport function useRoute<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'],\n>(\n routeId: TId,\n): Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]> {\n const router = useRouter()\n return router.useRoute(routeId as any) as any\n}\n\nexport function useSearch<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = keyof RegisteredAllRouteInfo['routeInfoById'],\n>(_routeId?: TId): RegisteredAllRouteInfo['fullSearchSchema'] {\n return useRouter().state.location.search\n}\n\nexport function linkProps<TTo extends string = '.'>(\n props: MakeLinkPropsOptions<RegisteredAllRouteInfo, '/', TTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n return router.linkProps(props as any)\n}\n\nexport function MatchRoute<TTo extends string = '.'>(\n props: MakeMatchRouteOptions<RegisteredAllRouteInfo, '/', TTo>,\n): JSX.Element {\n const router = useRouter()\n return React.createElement(router.MatchRoute, props as any)\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n const defaultPending = React.useCallback(() => null, [])\n\n if (!match) {\n return null\n }\n\n const PendingComponent = (match.__.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.__.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <MatchesProvider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary errorComponent={errorComponent} key={match.routeId}>\n {\n ((): React.ReactNode => {\n if (match.status === 'error') {\n throw match.error\n }\n\n if (match.status === 'success') {\n return React.createElement(\n (match.__.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n throw match.__.loadPromise\n })() as JSX.Element\n }\n </CatchBoundary>\n </React.Suspense>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n}> {\n state = {\n error: false,\n info: undefined,\n }\n\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n\n render() {\n return (\n <CatchBoundaryInner\n {...this.props}\n errorState={this.state}\n reset={() => this.setState({})}\n />\n )\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.\nfunction CatchBoundaryInner(props: {\n children: any\n errorComponent: any\n errorState: { error: unknown; info: any }\n reset: () => void\n}) {\n const [activeErrorState, setActiveErrorState] = React.useState(\n props.errorState,\n )\n const router = useRouter()\n const errorComponent = props.errorComponent ?? DefaultErrorBoundary\n\n React.useEffect(() => {\n if (activeErrorState) {\n let prevKey = router.state.location.key\n return router.subscribe(() => {\n if (router.state.location.key !== prevKey) {\n prevKey = router.state.location.key\n setActiveErrorState({} as any)\n }\n })\n }\n\n return\n }, [activeErrorState])\n\n React.useEffect(() => {\n if (props.errorState.error) {\n setActiveErrorState(props.errorState)\n }\n props.reset()\n }, [props.errorState.error])\n\n if (activeErrorState.error) {\n return React.createElement(errorComponent, activeErrorState)\n }\n\n return props.children\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.location.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, location, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as React.ReactNode\n}\n"],"names":["lazy","importer","lazyComp","React","promise","resolvedComp","forwardedComp","forwardRef","props","ref","resolvedCompRef","useRef","createElement","current","finalComp","preload","then","module","default","Link","router","useRouter","matchesContext","createContext","routerContext","MatchesProvider","useRouterSubscription","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","useRoute","subRouteId","resolvedRouteId","resolvePath","routeId","resolvedRoute","getRoute","invariant","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","Boolean","join","role","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useState","useMatch","rootRouteId","runtimeMatch","useMatches","match","matches","find","d","strict","routeExt","Object","assign","createRoute","loadComponent","component","document","RouterProvider","_objectWithoutPropertiesLoose","update","defaultRouterContext","userContext","useContext","context","useEffect","mount","value","warning","useNearestMatch","useSearch","_routeId","location","search","Outlet","slice","defaultPending","useCallback","PendingComponent","__","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","status","error","defaultComponent","loadPromise","CatchBoundary","Component","info","componentDidCatch","console","setState","render","CatchBoundaryInner","activeErrorState","setActiveErrorState","errorState","DefaultErrorBoundary","prevKey","key","reset","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","window","confirm","retry","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEO,SAASA,IAAT,CACLC,QADK,EAEW;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAN,CAAWC,QAAX,CAAjB,CAAA;AACA,EAAA,IAAIG,OAAJ,CAAA;AACA,EAAA,IAAIC,YAAJ,CAAA;EAEA,MAAMC,aAAa,gBAAGH,gBAAK,CAACI,UAAN,CAAiB,CAACC,KAAD,EAAQC,GAAR,KAAgB;IACrD,MAAMC,eAAe,GAAGP,gBAAK,CAACQ,MAAN,CAAaN,YAAY,IAAIH,QAA7B,CAAxB,CAAA;IACA,oBAAOC,gBAAK,CAACS,aAAN,CACLF,eAAe,CAACG,OADX,EAECJ,oCAAAA,CAAAA,EAAAA,EAAAA,GAAG,GAAG;AAAEA,MAAAA,GAAAA;AAAF,KAAH,GAAa,EAFjB,EAEyBD,KAFzB,CAAP,CAAA,CAAA;AAID,GANqB,CAAtB,CAAA;EAQA,MAAMM,SAAS,GAAGR,aAAlB,CAAA;;EAEAQ,SAAS,CAACC,OAAV,GAAoB,MAAM;IACxB,IAAI,CAACX,OAAL,EAAc;AACZA,MAAAA,OAAO,GAAGH,QAAQ,EAAA,CAAGe,IAAX,CAAiBC,MAAD,IAAY;QACpCZ,YAAY,GAAGY,MAAM,CAACC,OAAtB,CAAA;AACA,QAAA,OAAOb,YAAP,CAAA;AACD,OAHS,CAAV,CAAA;AAID,KAAA;;AAED,IAAA,OAAOD,OAAP,CAAA;GARF,CAAA;;AAWA,EAAA,OAAOU,SAAP,CAAA;AACD,CAAA;AAsID;AAEO,SAASK,IAAT,CACLX,KADK,EA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ick = e => {
2630
- React.startTransition(() => {
2631
- handleClick(e);
2632
- });
2630
+ if (React.startTransition) // This is a hack for react < 18
2631
+ React.startTransition(() => {
2632
+ handleClick(e);
2633
+ });else handleClick(e);
2633
2634
  };
2634
2635
 
2635
2636
  const composeHandlers = handlers => e => {
@@ -2814,7 +2815,8 @@ function Outlet() {
2814
2815
  }, /*#__PURE__*/React.createElement(React.Suspense, {
2815
2816
  fallback: /*#__PURE__*/React.createElement(PendingComponent, null)
2816
2817
  }, /*#__PURE__*/React.createElement(CatchBoundary, {
2817
- errorComponent: errorComponent
2818
+ errorComponent: errorComponent,
2819
+ key: match.routeId
2818
2820
  }, (() => {
2819
2821
  if (match.status === 'error') {
2820
2822
  throw match.error;
@@ -2834,7 +2836,8 @@ class CatchBoundary extends React.Component {
2834
2836
  constructor() {
2835
2837
  super(...arguments);
2836
2838
  this.state = {
2837
- error: false
2839
+ error: false,
2840
+ info: undefined
2838
2841
  };
2839
2842
  }
2840
2843
 
@@ -2847,17 +2850,49 @@ class CatchBoundary extends React.Component {
2847
2850
  }
2848
2851
 
2849
2852
  render() {
2850
- var _this$props$errorComp;
2853
+ return /*#__PURE__*/React.createElement(CatchBoundaryInner, _extends$2({}, this.props, {
2854
+ errorState: this.state,
2855
+ reset: () => this.setState({})
2856
+ }));
2857
+ }
2858
+
2859
+ } // This is the messiest thing ever... I'm either seriously tired (likely) or
2860
+ // there has to be a better way to reset error boundaries when the
2861
+ // router's location key changes.
2851
2862
 
2852
- const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
2853
2863
 
2854
- if (this.state.error) {
2855
- return /*#__PURE__*/React.createElement(errorComponent, this.state);
2864
+ function CatchBoundaryInner(props) {
2865
+ var _props$errorComponent;
2866
+
2867
+ const [activeErrorState, setActiveErrorState] = React.useState(props.errorState);
2868
+ const router = useRouter();
2869
+ const errorComponent = (_props$errorComponent = props.errorComponent) != null ? _props$errorComponent : DefaultErrorBoundary;
2870
+ React.useEffect(() => {
2871
+ if (activeErrorState) {
2872
+ let prevKey = router.state.location.key;
2873
+ return router.subscribe(() => {
2874
+ if (router.state.location.key !== prevKey) {
2875
+ prevKey = router.state.location.key;
2876
+ setActiveErrorState({});
2877
+ }
2878
+ });
2879
+ }
2880
+
2881
+ return;
2882
+ }, [activeErrorState]);
2883
+ React.useEffect(() => {
2884
+ if (props.errorState.error) {
2885
+ setActiveErrorState(props.errorState);
2856
2886
  }
2857
2887
 
2858
- return this.props.children;
2888
+ props.reset();
2889
+ }, [props.errorState.error]);
2890
+
2891
+ if (activeErrorState.error) {
2892
+ return /*#__PURE__*/React.createElement(errorComponent, activeErrorState);
2859
2893
  }
2860
2894
 
2895
+ return props.children;
2861
2896
  }
2862
2897
 
2863
2898
  function DefaultErrorBoundary(_ref6) {