@tanstack/react-router 0.0.1-beta.4 → 0.0.1-beta.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 +1 -7
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +42 -12
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +42 -20
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -29
- package/build/umd/index.development.js +42 -19
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +0 -6
|
@@ -331,13 +331,6 @@ class CatchBoundary extends React__namespace.Component {
|
|
|
331
331
|
this.state = {
|
|
332
332
|
error: false
|
|
333
333
|
};
|
|
334
|
-
|
|
335
|
-
this.reset = () => {
|
|
336
|
-
this.setState({
|
|
337
|
-
error: false,
|
|
338
|
-
info: false
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
334
|
}
|
|
342
335
|
|
|
343
336
|
componentDidCatch(error, info) {
|
|
@@ -447,6 +440,7 @@ exports.matchByPath = index.matchByPath;
|
|
|
447
440
|
exports.matchPathname = index.matchPathname;
|
|
448
441
|
exports.parsePathname = index.parsePathname;
|
|
449
442
|
exports.parseSearchWith = index.parseSearchWith;
|
|
443
|
+
exports.pick = index.pick;
|
|
450
444
|
exports.replaceEqualDeep = index.replaceEqualDeep;
|
|
451
445
|
exports.resolvePath = index.resolvePath;
|
|
452
446
|
exports.rootRouteId = index.rootRouteId;
|
|
@@ -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 Router,\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} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n // Any is required here so import() will work without having to do import().then(d => d.default)\n SyncOrAsyncElement: React.ReactNode | (() => Promise<any>)\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 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 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 ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\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 () => 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)\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 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) => {\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 = 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 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 createElement: async (element) => {\n if (typeof element === 'function') {\n const res = (await element()) as any\n\n // Support direct import() calls\n if (typeof res === 'object' && res.default) {\n return React.createElement(res.default)\n } else {\n return res\n }\n }\n\n return element\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 useRouterSubscription(router)\n\n useLayoutEffect(() => {\n return router.mount()\n }, [router])\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 <DefaultErrorBoundary 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\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 ?? DefaultErrorBoundary\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 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 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\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":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","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","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","useState","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","element","res","default","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","Outlet","childMatch","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","matchId","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity","usePrompt","when","unblock","history","block","transition","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JA;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,CA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IAA1C;IAAEjB,OAAF;IAAWQ,IAAX;AAAiBtE,IAAAA,QAAAA;GAAyB,GAAA,KAAA,CAAA;EAC/DqE,SAAS,CAACP,OAAD,EAAUQ,IAAV,WAAUA,IAAV,GAAkB,IAAlB,CAAT,CAAA;AACA,EAAA,OAAQtE,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 Router,\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} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n // Any is required here so import() will work without having to do import().then(d => d.default)\n SyncOrAsyncElement: React.ReactNode | (() => Promise<any>)\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 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 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 ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\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 () => 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)\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 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) => {\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 = 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 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 createElement: async (element) => {\n if (typeof element === 'function') {\n const res = (await element()) as any\n\n // Support direct import() calls\n if (typeof res === 'object' && res.default) {\n return React.createElement(res.default)\n } else {\n return res\n }\n }\n\n return element\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 useRouterSubscription(router)\n\n useLayoutEffect(() => {\n return router.mount()\n }, [router])\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 <DefaultErrorBoundary 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\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 render() {\n const catchElement = this.props.catchElement ?? DefaultErrorBoundary\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 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 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\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":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","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","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","useState","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","element","res","default","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","Outlet","childMatch","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","matchId","CatchBoundary","Component","componentDidCatch","info","console","setState","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity","usePrompt","when","unblock","history","block","transition","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JA;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,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,MAAMC,qBAAqB,GAAIC,MAAD,IAA8B;EAC1DC,yBAAoB,CACjBC,EAAD,IAAQF,MAAM,CAACG,SAAP,CAAiB,MAAMD,EAAE,EAAzB,CADU,EAElB,MAAMF,MAAM,CAACI,KAFK,EAGlB,MAAMJ,MAAM,CAACI,KAHK,CAApB,CAAA;AAKD,CAND,CAAA;;AAQO,SAASC,iBAAT,CAELC,IAFK,EAEoD;AACzD,EAAA,MAAMC,YAAY,GAAG,CACnBC,KADmB,EAEnBR,MAFmB,KAGkD;IACrE,OAAO;MACLS,QAAQ,EAAE,SAACC,QAAAA,CAAAA,UAAD,EAA6B;AAAA,QAAA,IAA5BA,UAA4B,KAAA,KAAA,CAAA,EAAA;AAA5BA,UAAAA,UAA4B,GAAf,GAAe,CAAA;AAAA,SAAA;;QACrC,MAAMC,eAAe,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QAAhB,GAA2B9I,MAAM,CAAC6I,QAAP,CAAgBC,QAA3C,CAAA;AACD,OAAA;AACF,KAPa,CAAd,CAAA;AASA,IAAA,OAAOP,OAAP,CAAA;AACD,GAbD,EAaG,CAACD,IAAD,EAAOO,QAAP,EAAiBf,OAAjB,CAbH,CAAA,CAAA;AAcD,CAAA;AAEM,SAASiB,MAAT,CAA0D,KAAA,EAAA;EAAA,IAA1C;IAAEjB,OAAF;IAAWQ,IAAX;AAAiBrE,IAAAA,QAAAA;GAAyB,GAAA,KAAA,CAAA;EAC/DoE,SAAS,CAACP,OAAD,EAAUQ,IAAV,WAAUA,IAAV,GAAkB,IAAlB,CAAT,CAAA;AACA,EAAA,OAAQrE,QAAR,IAAA,IAAA,GAAQA,QAAR,GAAoB,IAApB,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -944,6 +944,11 @@ function functionalUpdate(updater, previous) {
|
|
|
944
944
|
|
|
945
945
|
return updater;
|
|
946
946
|
}
|
|
947
|
+
function pick(parent, keys) {
|
|
948
|
+
return keys.reduce((obj, key) => {
|
|
949
|
+
obj[key] = parent[key];
|
|
950
|
+
}, {});
|
|
951
|
+
}
|
|
947
952
|
|
|
948
953
|
function joinPaths(paths) {
|
|
949
954
|
return cleanPath(paths.filter(Boolean).join('/'));
|
|
@@ -1739,7 +1744,6 @@ function createRouter(userOptions) {
|
|
|
1739
1744
|
matches: [],
|
|
1740
1745
|
actions: {},
|
|
1741
1746
|
loaders: {},
|
|
1742
|
-
loaderData: {},
|
|
1743
1747
|
lastUpdated: Date.now(),
|
|
1744
1748
|
isFetching: false,
|
|
1745
1749
|
isPreloading: false
|
|
@@ -1762,6 +1766,26 @@ function createRouter(userOptions) {
|
|
|
1762
1766
|
cascadeLoaderData(router.state.matches);
|
|
1763
1767
|
router.listeners.forEach(listener => listener(router));
|
|
1764
1768
|
},
|
|
1769
|
+
dehydrateState: () => {
|
|
1770
|
+
router.state;
|
|
1771
|
+
return _extends({}, pick(router.state, ['status', 'location', 'lastUpdated']), {
|
|
1772
|
+
matches: router.state.matches.map(match => pick(match, ['matchId', 'status', 'routeLoaderData', 'loaderData', 'isInvalid', 'invalidAt']))
|
|
1773
|
+
});
|
|
1774
|
+
},
|
|
1775
|
+
hydrateState: dehydratedState => {
|
|
1776
|
+
// Match the routes
|
|
1777
|
+
const matches = router.matchRoutes(router.location.pathname, {
|
|
1778
|
+
strictParseParams: true
|
|
1779
|
+
});
|
|
1780
|
+
router.state = _extends({}, router.state, dehydratedState, {
|
|
1781
|
+
matches: matches.map(match => {
|
|
1782
|
+
const dehydratedMatch = dehydratedState.matches.find(d => d.matchId === match.matchId);
|
|
1783
|
+
invariant(dehydratedMatch, 'Oh no! Dehydrated route matches did not match the active state of the router 😬');
|
|
1784
|
+
Object.assign(match, dehydratedMatch);
|
|
1785
|
+
return match;
|
|
1786
|
+
})
|
|
1787
|
+
});
|
|
1788
|
+
},
|
|
1765
1789
|
mount: () => {
|
|
1766
1790
|
const next = router.__.buildLocation({
|
|
1767
1791
|
to: '.',
|
|
@@ -1773,11 +1797,11 @@ function createRouter(userOptions) {
|
|
|
1773
1797
|
|
|
1774
1798
|
if (next.href !== router.location.href) {
|
|
1775
1799
|
router.__.commitLocation(next, true);
|
|
1776
|
-
} else {
|
|
1777
|
-
router.loadLocation();
|
|
1778
1800
|
}
|
|
1779
1801
|
|
|
1780
|
-
|
|
1802
|
+
router.loadLocation();
|
|
1803
|
+
const unsub = router.history.listen(event => {
|
|
1804
|
+
console.log(event.location);
|
|
1781
1805
|
router.loadLocation(router.__.parseLocation(event.location, router.location));
|
|
1782
1806
|
}); // addEventListener does not exist in React Native, but window does
|
|
1783
1807
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
@@ -1799,6 +1823,17 @@ function createRouter(userOptions) {
|
|
|
1799
1823
|
router.loadLocation();
|
|
1800
1824
|
},
|
|
1801
1825
|
update: opts => {
|
|
1826
|
+
const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
|
|
1827
|
+
|
|
1828
|
+
if (!router.location || newHistory) {
|
|
1829
|
+
if (opts != null && opts.history) {
|
|
1830
|
+
router.history = opts.history;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
router.location = router.__.parseLocation(router.history.location);
|
|
1834
|
+
router.state.location = router.location;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1802
1837
|
Object.assign(router.options, opts);
|
|
1803
1838
|
const {
|
|
1804
1839
|
basepath,
|
|
@@ -1847,7 +1882,7 @@ function createRouter(userOptions) {
|
|
|
1847
1882
|
|
|
1848
1883
|
router.cancelMatches(); // Match the routes
|
|
1849
1884
|
|
|
1850
|
-
const matches = router.matchRoutes(location.pathname, {
|
|
1885
|
+
const matches = router.matchRoutes(router.location.pathname, {
|
|
1851
1886
|
strictParseParams: true
|
|
1852
1887
|
});
|
|
1853
1888
|
router.state = _extends({}, router.state, {
|
|
@@ -2310,11 +2345,7 @@ function createRouter(userOptions) {
|
|
|
2310
2345
|
const recurseRoutes = (routeConfigs, parent) => {
|
|
2311
2346
|
return routeConfigs.map(routeConfig => {
|
|
2312
2347
|
const routeOptions = routeConfig.options;
|
|
2313
|
-
const route = createRoute(routeConfig, routeOptions, parent, router);
|
|
2314
|
-
// pendingMs: routeOptions.pendingMs ?? router.defaultPendingMs,
|
|
2315
|
-
// pendingMinMs: routeOptions.pendingMinMs ?? router.defaultPendingMinMs,
|
|
2316
|
-
// }
|
|
2317
|
-
|
|
2348
|
+
const route = createRoute(routeConfig, routeOptions, parent, router);
|
|
2318
2349
|
const existingRoute = router.routesById[route.routeId];
|
|
2319
2350
|
|
|
2320
2351
|
if (existingRoute) {
|
|
@@ -2449,8 +2480,6 @@ function createRouter(userOptions) {
|
|
|
2449
2480
|
}
|
|
2450
2481
|
}
|
|
2451
2482
|
};
|
|
2452
|
-
router.location = router.__.parseLocation(history.location);
|
|
2453
|
-
router.state.location = router.location;
|
|
2454
2483
|
router.update(userOptions); // Allow frameworks to hook into the router creation
|
|
2455
2484
|
|
|
2456
2485
|
router.options.createRouter == null ? void 0 : router.options.createRouter(router);
|
|
@@ -2483,6 +2512,7 @@ exports.matchByPath = matchByPath;
|
|
|
2483
2512
|
exports.matchPathname = matchPathname;
|
|
2484
2513
|
exports.parsePathname = parsePathname;
|
|
2485
2514
|
exports.parseSearchWith = parseSearchWith;
|
|
2515
|
+
exports.pick = pick;
|
|
2486
2516
|
exports.replaceEqualDeep = replaceEqualDeep;
|
|
2487
2517
|
exports.resolvePath = resolvePath;
|
|
2488
2518
|
exports.rootRouteId = rootRouteId;
|