@tanstack/react-router 0.0.1-alpha.4 → 0.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/react-router/src/index.js +12 -12
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +66 -47
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +79 -56
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -29
- package/build/types/index.d.ts +1 -5
- package/build/umd/index.development.js +78 -59
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +13 -13
|
@@ -217,29 +217,33 @@ function RouterProvider(_ref2) {
|
|
|
217
217
|
value: router.state.matches
|
|
218
218
|
}, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
|
|
219
219
|
}
|
|
220
|
+
|
|
220
221
|
function useRouter() {
|
|
221
222
|
const value = React__namespace.useContext(routerContext);
|
|
222
223
|
index.warning(!value, 'useRouter must be used inside a <Router> component!');
|
|
223
224
|
useRouterSubscription(value.router);
|
|
224
225
|
return value.router;
|
|
225
226
|
}
|
|
227
|
+
|
|
226
228
|
function useMatches() {
|
|
227
229
|
return React__namespace.useContext(matchesContext);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
} // function useParentMatches(): RouteMatch[] {
|
|
231
|
+
// const router = useRouter()
|
|
232
|
+
// const match = useMatch()
|
|
233
|
+
// const matches = router.state.matches
|
|
234
|
+
// return matches.slice(
|
|
235
|
+
// 0,
|
|
236
|
+
// matches.findIndex((d) => d.matchId === match.matchId) - 1,
|
|
237
|
+
// )
|
|
238
|
+
// }
|
|
231
239
|
|
|
232
|
-
const match = _useMatch();
|
|
233
|
-
|
|
234
|
-
const matches = router.state.matches;
|
|
235
|
-
return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
|
|
236
|
-
}
|
|
237
240
|
|
|
238
241
|
function _useMatch() {
|
|
239
242
|
var _useMatches;
|
|
240
243
|
|
|
241
244
|
return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
|
|
242
245
|
}
|
|
246
|
+
|
|
243
247
|
function Outlet() {
|
|
244
248
|
var _ref3, _childMatch$options$c;
|
|
245
249
|
|
|
@@ -399,8 +403,4 @@ exports.MatchesProvider = MatchesProvider;
|
|
|
399
403
|
exports.Outlet = Outlet;
|
|
400
404
|
exports.RouterProvider = RouterProvider;
|
|
401
405
|
exports.createReactRouter = createReactRouter;
|
|
402
|
-
exports.useMatch = _useMatch;
|
|
403
|
-
exports.useMatches = useMatches;
|
|
404
|
-
exports.useParentMatches = useParentMatches;
|
|
405
|
-
exports.useRouter = useRouter;
|
|
406
406
|
//# sourceMappingURL=index.js.map
|
|
@@ -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 RootRouteId,\n rootRouteId,\n Router,\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} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', 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 ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', 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<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], 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 ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], 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<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\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\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\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 )\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, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\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)\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 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([handleClick, 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 // useRouterSubscription(router)\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>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n invariant(\n route,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return route\n },\n useMatch: (routeId) => {\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\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 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n useRouterSubscription(router)\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), 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 })\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 useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\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 as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useParentMatches(): RouteMatch[] {\n const router = useRouter()\n const match = useMatch()\n const matches = router.state.matches\n return matches.slice(\n 0,\n matches.findIndex((d) => d.matchId === match.matchId) - 1,\n )\n}\n\nexport function useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = (((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultCatchBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element) ?? <Outlet />\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: 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 reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultCatchBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultCatchBoundary({ 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 style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useRoute","routeId","getRoute","invariant","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","useParentMatches","slice","findIndex","matchId","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA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,MAAAA,MAAM,EAAE,MAAA;AAAV,KAAA;AAAZ,GAAA,CApBF,eAqBE/H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL8H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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 RootRouteId,\n rootRouteId,\n Router,\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} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', 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 ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', 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<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], 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 ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], 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<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\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\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\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 )\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, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\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)\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 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([handleClick, 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 // useRouterSubscription(router)\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>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n invariant(\n route,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return route\n },\n useMatch: (routeId) => {\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\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 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n useRouterSubscription(router)\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), 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 })\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 useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nfunction useRouter(): Router {\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 as Router\n}\n\nfunction useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\n// function useParentMatches(): RouteMatch[] {\n// const router = useRouter()\n// const match = useMatch()\n// const matches = router.state.matches\n// return matches.slice(\n// 0,\n// matches.findIndex((d) => d.matchId === match.matchId) - 1,\n// )\n// }\n\nfunction useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = (((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultCatchBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element) ?? <Outlet />\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: 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 reset = () => {\n this.setState({\n error: false,\n info: false,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultCatchBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultCatchBoundary({ 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 style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div>\n </div>\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useRoute","routeId","getRoute","invariant","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","matchId","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAAS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A,uBAAA,CADF,eAEE3H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,KAAK,EAAE;AAAE4H,MAAAA,MAAM,EAAE,OAAA;AAAV,KAAA;AAAZ,GAAA,CAFF,eAGE5H,gBACE,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,eAAAA,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EACGuG,KAAK,CAACsB,OAAN,gBACC7H,gBAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL2H,MAAAA,QAAQ,EAAE,MADL;AAELG,MAAAA,MAAM,EAAE,eAFH;AAGLC,MAAAA,YAAY,EAAE,QAHT;AAILN,MAAAA,OAAO,EAAE,OAJJ;AAKLO,MAAAA,KAAK,EAAE,KAAA;AALF,KAAA;GAQNzB,EAAAA,KAAK,CAACsB,OATT,CADD,GAYG,IAbN,CADF,CAHF,eAoBE7H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,KAAK,EAAE;AAAE4H,MAAAA,MAAM,EAAE,MAAA;AAAV,KAAA;AAAZ,GAAA,CApBF,eAqBE5H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL2H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -982,6 +982,7 @@ function createRouter(userOptions) {
|
|
|
982
982
|
let router = {
|
|
983
983
|
options: originalOptions,
|
|
984
984
|
listeners: [],
|
|
985
|
+
removeActionQueue: [],
|
|
985
986
|
// Resolved after construction
|
|
986
987
|
basepath: '',
|
|
987
988
|
routeTree: undefined,
|
|
@@ -1105,12 +1106,14 @@ function createRouter(userOptions) {
|
|
|
1105
1106
|
strictParseParams: true
|
|
1106
1107
|
});
|
|
1107
1108
|
const toMatches = router.matchRoutes(pathname);
|
|
1108
|
-
|
|
1109
|
+
|
|
1110
|
+
const prevParams = _extends$1({}, (_last = last(fromMatches)) == null ? void 0 : _last.params);
|
|
1111
|
+
|
|
1109
1112
|
let nextParams = ((_dest$params = dest.params) != null ? _dest$params : true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
|
|
1110
1113
|
|
|
1111
1114
|
if (nextParams) {
|
|
1112
1115
|
toMatches.map(d => d.options.stringifyParams).filter(Boolean).forEach(fn => {
|
|
1113
|
-
Object.assign(nextParams, fn(nextParams));
|
|
1116
|
+
Object.assign({}, nextParams, fn(nextParams));
|
|
1114
1117
|
});
|
|
1115
1118
|
}
|
|
1116
1119
|
|
|
@@ -1215,20 +1218,30 @@ function createRouter(userOptions) {
|
|
|
1215
1218
|
if (next) {
|
|
1216
1219
|
// Ingest the new location
|
|
1217
1220
|
router.location = next;
|
|
1218
|
-
} //
|
|
1221
|
+
} // Clear out old actions
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
router.removeActionQueue.forEach(_ref => {
|
|
1225
|
+
let {
|
|
1226
|
+
action,
|
|
1227
|
+
actionState
|
|
1228
|
+
} = _ref;
|
|
1219
1229
|
|
|
1230
|
+
if (router.state.currentAction === actionState) {
|
|
1231
|
+
router.state.currentAction = undefined;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
if (action.current === actionState) {
|
|
1235
|
+
action.current = undefined;
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
router.removeActionQueue = []; // Cancel any pending matches
|
|
1220
1239
|
|
|
1221
1240
|
router.cancelMatches(); // Match the routes
|
|
1222
1241
|
|
|
1223
1242
|
const unloadedMatches = router.matchRoutes(location.pathname, {
|
|
1224
1243
|
strictParseParams: true
|
|
1225
1244
|
});
|
|
1226
|
-
unloadedMatches.forEach((match, index) => {
|
|
1227
|
-
const parent = unloadedMatches[index - 1];
|
|
1228
|
-
const child = unloadedMatches[index + 1];
|
|
1229
|
-
if (parent) match.__.setParentMatch(parent);
|
|
1230
|
-
if (child) match.__.addChildMatch(child);
|
|
1231
|
-
});
|
|
1232
1245
|
router.state = _extends$1({}, router.state, {
|
|
1233
1246
|
pending: {
|
|
1234
1247
|
matches: unloadedMatches,
|
|
@@ -1409,6 +1422,7 @@ function createRouter(userOptions) {
|
|
|
1409
1422
|
};
|
|
1410
1423
|
|
|
1411
1424
|
recurse([router.routeTree]);
|
|
1425
|
+
cascadeLoaderData(matches);
|
|
1412
1426
|
return matches;
|
|
1413
1427
|
},
|
|
1414
1428
|
loadMatches: async (resolvedMatches, loaderOpts) => {
|
|
@@ -1446,7 +1460,7 @@ function createRouter(userOptions) {
|
|
|
1446
1460
|
const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
|
|
1447
1461
|
[...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
|
|
1448
1462
|
if (unloadedMatchIds.includes(match.matchId)) {
|
|
1449
|
-
match.
|
|
1463
|
+
match.invalidate();
|
|
1450
1464
|
}
|
|
1451
1465
|
});
|
|
1452
1466
|
},
|
|
@@ -1487,14 +1501,15 @@ function createRouter(userOptions) {
|
|
|
1487
1501
|
const next = router.buildNext(location);
|
|
1488
1502
|
return router.commitLocation(next, location.replace);
|
|
1489
1503
|
},
|
|
1490
|
-
navigate: async
|
|
1504
|
+
navigate: async _ref2 => {
|
|
1491
1505
|
let {
|
|
1492
1506
|
from,
|
|
1493
1507
|
to = '.',
|
|
1494
1508
|
search,
|
|
1495
1509
|
hash,
|
|
1496
|
-
replace
|
|
1497
|
-
|
|
1510
|
+
replace,
|
|
1511
|
+
params
|
|
1512
|
+
} = _ref2;
|
|
1498
1513
|
// If this link simply reloads the current route,
|
|
1499
1514
|
// make sure it has a new key so it will trigger a data refresh
|
|
1500
1515
|
// If this `to` is a valid external URL, return
|
|
@@ -1513,11 +1528,13 @@ function createRouter(userOptions) {
|
|
|
1513
1528
|
from: fromString,
|
|
1514
1529
|
to: toString,
|
|
1515
1530
|
search,
|
|
1516
|
-
hash
|
|
1531
|
+
hash,
|
|
1532
|
+
replace,
|
|
1533
|
+
params
|
|
1517
1534
|
});
|
|
1518
1535
|
},
|
|
1519
|
-
buildLink:
|
|
1520
|
-
var _preload,
|
|
1536
|
+
buildLink: _ref3 => {
|
|
1537
|
+
var _preload, _ref4, _ref5;
|
|
1521
1538
|
|
|
1522
1539
|
let {
|
|
1523
1540
|
from,
|
|
@@ -1532,7 +1549,7 @@ function createRouter(userOptions) {
|
|
|
1532
1549
|
preloadMaxAge: userPreloadMaxAge,
|
|
1533
1550
|
preloadDelay: userPreloadDelay,
|
|
1534
1551
|
disabled
|
|
1535
|
-
} =
|
|
1552
|
+
} = _ref3;
|
|
1536
1553
|
|
|
1537
1554
|
// If this link simply reloads the current route,
|
|
1538
1555
|
// make sure it has a new key so it will trigger a data refresh
|
|
@@ -1556,8 +1573,8 @@ function createRouter(userOptions) {
|
|
|
1556
1573
|
};
|
|
1557
1574
|
const next = router.buildNext(nextOpts);
|
|
1558
1575
|
preload = (_preload = preload) != null ? _preload : router.options.defaultLinkPreload;
|
|
1559
|
-
const preloadMaxAge = (
|
|
1560
|
-
const preloadDelay = (
|
|
1576
|
+
const preloadMaxAge = (_ref4 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref4 : 2000;
|
|
1577
|
+
const preloadDelay = (_ref5 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref5 : 50; // Compare path/hash for matches
|
|
1561
1578
|
|
|
1562
1579
|
const pathIsEqual = router.state.location.pathname === next.pathname;
|
|
1563
1580
|
const currentPathSplit = router.state.location.pathname.split('/');
|
|
@@ -1631,11 +1648,11 @@ function createRouter(userOptions) {
|
|
|
1631
1648
|
},
|
|
1632
1649
|
__experimental__createSnapshot: () => {
|
|
1633
1650
|
return _extends$1({}, router.state, {
|
|
1634
|
-
matches: router.state.matches.map(
|
|
1651
|
+
matches: router.state.matches.map(_ref6 => {
|
|
1635
1652
|
let {
|
|
1636
1653
|
routeLoaderData: loaderData,
|
|
1637
1654
|
matchId
|
|
1638
|
-
} =
|
|
1655
|
+
} = _ref6;
|
|
1639
1656
|
return {
|
|
1640
1657
|
matchId,
|
|
1641
1658
|
loaderData
|
|
@@ -1685,10 +1702,12 @@ function createRoute(routeConfig, options, parent, router) {
|
|
|
1685
1702
|
status: 'pending',
|
|
1686
1703
|
submission
|
|
1687
1704
|
};
|
|
1705
|
+
action.current = actionState;
|
|
1688
1706
|
action.latest = actionState;
|
|
1689
1707
|
action.pending.push(actionState);
|
|
1690
1708
|
router.state = _extends$1({}, router.state, {
|
|
1691
|
-
|
|
1709
|
+
currentAction: actionState,
|
|
1710
|
+
latestAction: actionState
|
|
1692
1711
|
});
|
|
1693
1712
|
router.notify();
|
|
1694
1713
|
|
|
@@ -1712,11 +1731,10 @@ function createRoute(routeConfig, options, parent, router) {
|
|
|
1712
1731
|
actionState.status = 'error';
|
|
1713
1732
|
} finally {
|
|
1714
1733
|
action.pending = action.pending.filter(d => d !== actionState);
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1734
|
+
router.removeActionQueue.push({
|
|
1735
|
+
action,
|
|
1736
|
+
actionState
|
|
1737
|
+
});
|
|
1720
1738
|
router.notify();
|
|
1721
1739
|
}
|
|
1722
1740
|
}
|
|
@@ -1803,16 +1821,17 @@ function createRouteMatch(router, route, opts) {
|
|
|
1803
1821
|
clearTimeout(routeMatch.__.pendingMinTimeout);
|
|
1804
1822
|
delete routeMatch.__.pendingMinPromise;
|
|
1805
1823
|
},
|
|
1806
|
-
setParentMatch: parentMatch => {
|
|
1807
|
-
|
|
1808
|
-
},
|
|
1809
|
-
addChildMatch: childMatch => {
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1824
|
+
// setParentMatch: (parentMatch?: RouteMatch) => {
|
|
1825
|
+
// routeMatch.parentMatch = parentMatch
|
|
1826
|
+
// },
|
|
1827
|
+
// addChildMatch: (childMatch: RouteMatch) => {
|
|
1828
|
+
// if (
|
|
1829
|
+
// routeMatch.childMatches.find((d) => d.matchId === childMatch.matchId)
|
|
1830
|
+
// ) {
|
|
1831
|
+
// return
|
|
1832
|
+
// }
|
|
1833
|
+
// routeMatch.childMatches.push(childMatch)
|
|
1834
|
+
// },
|
|
1816
1835
|
validate: () => {
|
|
1817
1836
|
var _routeMatch$parentMat, _routeMatch$parentMat2;
|
|
1818
1837
|
|
|
@@ -1849,6 +1868,9 @@ function createRouteMatch(router, route, opts) {
|
|
|
1849
1868
|
|
|
1850
1869
|
routeMatch.__.cancelPending();
|
|
1851
1870
|
},
|
|
1871
|
+
invalidate: () => {
|
|
1872
|
+
routeMatch.isInvalid = true;
|
|
1873
|
+
},
|
|
1852
1874
|
load: async () => {
|
|
1853
1875
|
const id = '' + Date.now() + Math.random();
|
|
1854
1876
|
routeMatch.__.latestId = id; // If the match was in an error state, set it
|
|
@@ -1916,7 +1938,6 @@ function createRouteMatch(router, route, opts) {
|
|
|
1916
1938
|
}
|
|
1917
1939
|
|
|
1918
1940
|
routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
|
|
1919
|
-
cascadeLoaderData(routeMatch);
|
|
1920
1941
|
routeMatch.error = undefined;
|
|
1921
1942
|
routeMatch.status = 'success';
|
|
1922
1943
|
routeMatch.updatedAt = Date.now();
|
|
@@ -1976,16 +1997,14 @@ function createRouteMatch(router, route, opts) {
|
|
|
1976
1997
|
return routeMatch;
|
|
1977
1998
|
}
|
|
1978
1999
|
|
|
1979
|
-
function cascadeLoaderData(
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
}
|
|
2000
|
+
function cascadeLoaderData(matches) {
|
|
2001
|
+
matches.forEach((match, index) => {
|
|
2002
|
+
const parent = matches[index - 1];
|
|
1983
2003
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
}
|
|
2004
|
+
if (parent) {
|
|
2005
|
+
match.loaderData = replaceEqualDeep(match.loaderData, _extends$1({}, parent.loaderData, match.routeLoaderData));
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
1989
2008
|
}
|
|
1990
2009
|
|
|
1991
2010
|
function matchPathname(currentPathname, matchLocation) {
|