@tanstack/solid-router 1.162.4 → 1.162.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/dist/cjs/Matches.cjs +5 -3
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs +12 -8
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -24
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -4
- package/dist/cjs/index.dev.cjs +0 -24
- package/dist/cjs/index.dev.cjs.map +1 -1
- package/dist/cjs/utils.cjs +0 -2
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +0 -1
- package/dist/esm/Matches.js +5 -3
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/fileRoute.js +12 -8
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +2 -4
- package/dist/esm/index.dev.js +1 -10
- package/dist/esm/index.dev.js.map +1 -1
- package/dist/esm/index.js +1 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -2
- package/dist/esm/utils.js.map +1 -1
- package/dist/source/Matches.jsx +6 -4
- package/dist/source/Matches.jsx.map +1 -1
- package/dist/source/fileRoute.js +6 -2
- package/dist/source/fileRoute.js.map +1 -1
- package/dist/source/index.d.ts +2 -4
- package/dist/source/index.jsx +2 -4
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/utils.d.ts +0 -1
- package/dist/source/utils.js +0 -1
- package/dist/source/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +11 -7
- package/src/fileRoute.ts +12 -8
- package/src/index.tsx +1 -12
- package/src/utils.ts +0 -3
package/dist/cjs/Matches.cjs
CHANGED
|
@@ -78,10 +78,12 @@ function MatchesInner() {
|
|
|
78
78
|
return Solid$1.memo(() => !!router.options.disableGlobalCatchBoundary)() ? matchComponent() : Solid$1.createComponent(CatchBoundary.CatchBoundary, {
|
|
79
79
|
getResetKey: () => resetKey(),
|
|
80
80
|
errorComponent: CatchBoundary.ErrorComponent,
|
|
81
|
-
onCatch
|
|
82
|
-
|
|
81
|
+
get onCatch() {
|
|
82
|
+
return process.env.NODE_ENV !== "production" ? (error) => {
|
|
83
|
+
warning(false, `The following error wasn't caught by any route! At the very leas
|
|
83
84
|
t, consider setting an 'errorComponent' in your RootRoute!`);
|
|
84
|
-
|
|
85
|
+
warning(false, error.message || error.toString());
|
|
86
|
+
} : void 0;
|
|
85
87
|
},
|
|
86
88
|
get children() {
|
|
87
89
|
return matchComponent();
|
package/dist/cjs/Matches.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.cjs","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very leas\n t, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n const child = props.children\n if (typeof child === 'function') {\n return (child as any)(params)\n }\n\n return params ? child : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","ResolvedSuspense","isServer","document","ssr","SafeFragment","Solid","Suspense","rootRoute","routesById","rootRouteId","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","Transitioner","MatchesInner","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchComponent","Show","when","Match","matchContext","Provider","value","_$memo","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","error","warning","message","toString","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","keyed","_","params","child","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAAA,UAAAA;AAEf,QAAMC,oBACHC,qBAAYH,OAAOG,aACnB,OAAOC,aAAa,eAAeJ,OAAOK,MACvCC,aAAAA,eACAC,iBAAMC;AAEZ,QAAMC,YAA4BA,MAAMT,OAAOU,WAAWC,WAAAA,WAAW;AACrE,QAAMC,mBACJH,YAAYI,QAAQC,oBACpBd,OAAOa,QAAQE;AAEjB,QAAMC,kBAAkBhB,OAAOa,QAAQI,aAAaX,aAAAA;AAEpD,SAAAY,QAAAA,gBACGF,iBAAe;AAAA,IAAA,IAAAG,WAAA;AAAA,aAAAD,QAAAA,gBACbhB,kBAAgB;AAAA,QAAA,IACfkB,WAAQ;AAAA,iBAAER,mBAAgBM,QAAAA,gBAAIN,wBAAsB;AAAA,QAAI;AAAA,QAAA,IAAAO,WAAA;AAAA,iBAAA,CAAAD,QAAAA,gBAEvDG,2BAAY,CAAA,CAAA,GAAAH,wBACZI,cAAY,CAAA,CAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAIrB;AAEA,SAASA,eAAe;AACtB,QAAMtB,SAASC,UAAAA,UAAAA;AACf,QAAMsB,UAAUC,eAAAA,eAAe;AAAA,IAC7BC,QAASC,CAAAA,MAAM;AACb,aAAOA,EAAEC,QAAQ,CAAC,GAAGC;AAAAA,IACvB;AAAA,EAAA,CACD;AAED,QAAMC,WAAWL,eAAAA,eAAe;AA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B,MACsD;AACtD,QAAMiB,iBAAiB7D,iBAAM8D,WAAWlC,yBAAY;AAEpD,SAAO8B,WAAW;AAAA,IAChBxC,QAAQA,CAACE,YAAiD;AACxDA,gBAAUA,QAAQ2C,MAChB3C,QAAQ4C,UAAWC,CAAAA,MAAMA,EAAE5C,OAAOwC,eAAAA,CAAgB,IAAI,CACxD;AACA,aAAOjB,MAAM1B,SAAS0B,KAAK1B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EAAA,CACM;AACV;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Matches.cjs","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={\n process.env.NODE_ENV !== 'production'\n ? (error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very leas\n t, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }\n : undefined\n }\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n const child = props.children\n if (typeof child === 'function') {\n return (child as any)(params)\n }\n\n return params ? child : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","ResolvedSuspense","isServer","document","ssr","SafeFragment","Solid","Suspense","rootRoute","routesById","rootRouteId","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","Transitioner","MatchesInner","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchComponent","Show","when","Match","matchContext","Provider","value","_$memo","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","process","env","NODE_ENV","error","warning","message","toString","undefined","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","keyed","_","params","child","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAAA,UAAAA;AAEf,QAAMC,oBACHC,qBAAYH,OAAOG,aACnB,OAAOC,aAAa,eAAeJ,OAAOK,MACvCC,aAAAA,eACAC,iBAAMC;AAEZ,QAAMC,YAA4BA,MAAMT,OAAOU,WAAWC,WAAAA,WAAW;AACrE,QAAMC,mBACJH,YAAYI,QAAQC,oBACpBd,OAAOa,QAAQE;AAEjB,QAAMC,kBAAkBhB,OAAOa,QAAQI,aAAaX,aAAAA;AAEpD,SAAAY,QAAAA,gBACGF,iBAAe;AAAA,IAAA,IAAAG,WAAA;AAAA,aAAAD,QAAAA,gBACbhB,kBAAgB;AAAA,QAAA,IACfkB,WAAQ;AAAA,iBAAER,mBAAgBM,QAAAA,gBAAIN,wBAAsB;AAAA,QAAI;AAAA,QAAA,IAAAO,WAAA;AAAA,iBAAA,CAAAD,QAAAA,gBAEvDG,2BAAY,CAAA,CAAA,GAAAH,wBACZI,cAAY,CAAA,CAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAIrB;AAEA,SAASA,eAAe;AACtB,QAAMtB,SAASC,UAAAA,UAAAA;AACf,QAAMsB,UAAUC,eAAAA,eAAe;AAAA,IAC7BC,QAASC,CAAAA,MAAM;AACb,aAAOA,EAAEC,QAAQ,CAAC,GAAGC;AAAAA,IACvB;AAAA,EAAA,CACD;AAED,QAAMC,WAAWL,eAAAA,eAAe;AAAA,IAC9BC,QAASC,OAAMA,EAAEI;AAAAA,EAAAA,CAClB;AAED,QAAMC,iB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ACsD;AACtD,QAAMiB,iBAAiBjE,iBAAMkE,WAAWtC,yBAAY;AAEpD,SAAOkC,WAAW;AAAA,IAChB5C,QAAQA,CAACE,YAAiD;AACxDA,gBAAUA,QAAQ+C,MAChB/C,QAAQgD,UAAWC,CAAAA,MAAMA,EAAEhD,OAAO4C,eAAAA,CAAgB,IAAI,CACxD;AACA,aAAOjB,MAAM9B,SAAS8B,KAAK9B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EAAA,CACM;AACV;;;;;;;"}
|
package/dist/cjs/fileRoute.cjs
CHANGED
|
@@ -23,10 +23,12 @@ class FileRoute {
|
|
|
23
23
|
constructor(path, _opts) {
|
|
24
24
|
this.path = path;
|
|
25
25
|
this.createRoute = (options) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (process.env.NODE_ENV !== "production") {
|
|
27
|
+
warning(
|
|
28
|
+
this.silent,
|
|
29
|
+
"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
30
32
|
const route$1 = route.createRoute(options);
|
|
31
33
|
route$1.isRoot = false;
|
|
32
34
|
return route$1;
|
|
@@ -35,10 +37,12 @@ class FileRoute {
|
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
function FileRouteLoader(_path) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
|
41
|
+
warning(
|
|
42
|
+
false,
|
|
43
|
+
`FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
42
46
|
return (loaderFn) => loaderFn;
|
|
43
47
|
}
|
|
44
48
|
class LazyRoute {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n Register,\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;AAqCO,SAAS,gBAQd,MAC0E;AAC1E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,IAAI,UAA0D,MAAM;AAAA,MACzE,QAAQ;AAAA,IAAA,CACT,EAAE,YAAY,IAAI;AAAA,EACrB;AACA,SAAO,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EAAA,CACT,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CAaZ,YAgDG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEF,YAAMA,UAAQC,MAAAA,YAAY,OAAc;AACtCD,cAAc,SAAS;AACzB,aAA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AA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AACO,SAAS,oBAGd,IAA8D;AAC9D,MAAI,OAAO,OAAO,UAAU;AAC1B,WAAO,IAAI,UAAkB,EAAE;AAAA,EACjC;AAEA,SAAO,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n if (process.env.NODE_ENV !== 'production') {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n }\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n Register,\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n if (process.env.NODE_ENV !== 'production') {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n }\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;AAqCO,SAAS,gBAQd,MAC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ACf,QAAQH,OAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAOI,cAAAA,cAAc,EAAE,GAAGJ,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAOK,cAAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAA6C;AACzD,YAAM,SAASM,UAAAA,UAAA;AACf,aAAOC,YAAAA,YAAY,EAAE,MAAM,OAAO,WAAW,KAAK,QAAQ,EAAE,EAAE,UAAU;AAAA,IAC1E;AA1CE,SAAK,UAAU;AAAA,EACjB;AA0CF;AAEO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AACO,SAAS,oBAGd,IAA8D;AAC9D,MAAI,OAAO,OAAO,UAAU;AAC1B,WAAO,IAAI,UAAkB,EAAE;AAAA,EACjC;AAEA,SAAO,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const fileRoute = require("./fileRoute.cjs");
|
|
|
9
9
|
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
10
10
|
const link = require("./link.cjs");
|
|
11
11
|
const Matches = require("./Matches.cjs");
|
|
12
|
-
const matchContext = require("./matchContext.cjs");
|
|
13
12
|
const Match = require("./Match.cjs");
|
|
14
13
|
const useMatch = require("./useMatch.cjs");
|
|
15
14
|
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
@@ -27,7 +26,6 @@ const useRouter = require("./useRouter.cjs");
|
|
|
27
26
|
const useRouterState = require("./useRouterState.cjs");
|
|
28
27
|
const useLocation = require("./useLocation.cjs");
|
|
29
28
|
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
30
|
-
const utils = require("./utils.cjs");
|
|
31
29
|
const notFound = require("./not-found.cjs");
|
|
32
30
|
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
33
31
|
const Asset = require("./Asset.cjs");
|
|
@@ -38,26 +36,14 @@ Object.defineProperty(exports, "DEFAULT_PROTOCOL_ALLOWLIST", {
|
|
|
38
36
|
enumerable: true,
|
|
39
37
|
get: () => routerCore.DEFAULT_PROTOCOL_ALLOWLIST
|
|
40
38
|
});
|
|
41
|
-
Object.defineProperty(exports, "PathParamError", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: () => routerCore.PathParamError
|
|
44
|
-
});
|
|
45
39
|
Object.defineProperty(exports, "SearchParamError", {
|
|
46
40
|
enumerable: true,
|
|
47
41
|
get: () => routerCore.SearchParamError
|
|
48
42
|
});
|
|
49
|
-
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
52
|
-
});
|
|
53
43
|
Object.defineProperty(exports, "cleanPath", {
|
|
54
44
|
enumerable: true,
|
|
55
45
|
get: () => routerCore.cleanPath
|
|
56
46
|
});
|
|
57
|
-
Object.defineProperty(exports, "componentTypes", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: () => routerCore.componentTypes
|
|
60
|
-
});
|
|
61
47
|
Object.defineProperty(exports, "composeRewrites", {
|
|
62
48
|
enumerable: true,
|
|
63
49
|
get: () => routerCore.composeRewrites
|
|
@@ -78,10 +64,6 @@ Object.defineProperty(exports, "defaultParseSearch", {
|
|
|
78
64
|
enumerable: true,
|
|
79
65
|
get: () => routerCore.defaultParseSearch
|
|
80
66
|
});
|
|
81
|
-
Object.defineProperty(exports, "defaultSerializeError", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: () => routerCore.defaultSerializeError
|
|
84
|
-
});
|
|
85
67
|
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
86
68
|
enumerable: true,
|
|
87
69
|
get: () => routerCore.defaultStringifySearch
|
|
@@ -94,10 +76,6 @@ Object.defineProperty(exports, "functionalUpdate", {
|
|
|
94
76
|
enumerable: true,
|
|
95
77
|
get: () => routerCore.functionalUpdate
|
|
96
78
|
});
|
|
97
|
-
Object.defineProperty(exports, "getInitialRouterState", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: () => routerCore.getInitialRouterState
|
|
100
|
-
});
|
|
101
79
|
Object.defineProperty(exports, "interpolatePath", {
|
|
102
80
|
enumerable: true,
|
|
103
81
|
get: () => routerCore.interpolatePath
|
|
@@ -217,7 +195,6 @@ exports.useChildMatches = Matches.useChildMatches;
|
|
|
217
195
|
exports.useMatchRoute = Matches.useMatchRoute;
|
|
218
196
|
exports.useMatches = Matches.useMatches;
|
|
219
197
|
exports.useParentMatches = Matches.useParentMatches;
|
|
220
|
-
exports.matchContext = matchContext.matchContext;
|
|
221
198
|
exports.Match = Match.Match;
|
|
222
199
|
exports.Outlet = Match.Outlet;
|
|
223
200
|
exports.useMatch = useMatch.useMatch;
|
|
@@ -250,7 +227,6 @@ exports.useRouter = useRouter.useRouter;
|
|
|
250
227
|
exports.useRouterState = useRouterState.useRouterState;
|
|
251
228
|
exports.useLocation = useLocation.useLocation;
|
|
252
229
|
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
253
|
-
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
254
230
|
exports.CatchNotFound = notFound.CatchNotFound;
|
|
255
231
|
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
256
232
|
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link.cjs';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.cjs';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.cjs';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.cjs';
|
|
16
|
-
export { matchContext } from './matchContext.cjs';
|
|
17
16
|
export { Match, Outlet } from './Match.cjs';
|
|
18
17
|
export { useMatch } from './useMatch.cjs';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps.cjs';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.cjs';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.cjs';
|
|
24
23
|
export { createRouter, Router } from './router.cjs';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider.cjs';
|
|
27
26
|
export type { RouterProps } from './RouterProvider.cjs';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.cjs';
|
|
@@ -36,7 +35,6 @@ export { useRouter } from './useRouter.cjs';
|
|
|
36
35
|
export { useRouterState } from './useRouterState.cjs';
|
|
37
36
|
export { useLocation } from './useLocation.cjs';
|
|
38
37
|
export { useCanGoBack } from './useCanGoBack.cjs';
|
|
39
|
-
export { useLayoutEffect } from './utils.cjs';
|
|
40
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found.cjs';
|
|
41
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
42
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/cjs/index.dev.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const fileRoute = require("./fileRoute.cjs");
|
|
|
9
9
|
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
10
10
|
const link = require("./link.cjs");
|
|
11
11
|
const Matches = require("./Matches.cjs");
|
|
12
|
-
const matchContext = require("./matchContext.cjs");
|
|
13
12
|
const Match = require("./Match.cjs");
|
|
14
13
|
const useMatch = require("./useMatch.cjs");
|
|
15
14
|
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
@@ -27,7 +26,6 @@ const useRouter = require("./useRouter.cjs");
|
|
|
27
26
|
const useRouterState = require("./useRouterState.cjs");
|
|
28
27
|
const useLocation = require("./useLocation.cjs");
|
|
29
28
|
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
30
|
-
const utils = require("./utils.cjs");
|
|
31
29
|
const notFound = require("./not-found.cjs");
|
|
32
30
|
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
33
31
|
const Asset = require("./Asset.cjs");
|
|
@@ -38,26 +36,14 @@ Object.defineProperty(exports, "DEFAULT_PROTOCOL_ALLOWLIST", {
|
|
|
38
36
|
enumerable: true,
|
|
39
37
|
get: () => routerCore.DEFAULT_PROTOCOL_ALLOWLIST
|
|
40
38
|
});
|
|
41
|
-
Object.defineProperty(exports, "PathParamError", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: () => routerCore.PathParamError
|
|
44
|
-
});
|
|
45
39
|
Object.defineProperty(exports, "SearchParamError", {
|
|
46
40
|
enumerable: true,
|
|
47
41
|
get: () => routerCore.SearchParamError
|
|
48
42
|
});
|
|
49
|
-
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
52
|
-
});
|
|
53
43
|
Object.defineProperty(exports, "cleanPath", {
|
|
54
44
|
enumerable: true,
|
|
55
45
|
get: () => routerCore.cleanPath
|
|
56
46
|
});
|
|
57
|
-
Object.defineProperty(exports, "componentTypes", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: () => routerCore.componentTypes
|
|
60
|
-
});
|
|
61
47
|
Object.defineProperty(exports, "composeRewrites", {
|
|
62
48
|
enumerable: true,
|
|
63
49
|
get: () => routerCore.composeRewrites
|
|
@@ -78,10 +64,6 @@ Object.defineProperty(exports, "defaultParseSearch", {
|
|
|
78
64
|
enumerable: true,
|
|
79
65
|
get: () => routerCore.defaultParseSearch
|
|
80
66
|
});
|
|
81
|
-
Object.defineProperty(exports, "defaultSerializeError", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: () => routerCore.defaultSerializeError
|
|
84
|
-
});
|
|
85
67
|
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
86
68
|
enumerable: true,
|
|
87
69
|
get: () => routerCore.defaultStringifySearch
|
|
@@ -94,10 +76,6 @@ Object.defineProperty(exports, "functionalUpdate", {
|
|
|
94
76
|
enumerable: true,
|
|
95
77
|
get: () => routerCore.functionalUpdate
|
|
96
78
|
});
|
|
97
|
-
Object.defineProperty(exports, "getInitialRouterState", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: () => routerCore.getInitialRouterState
|
|
100
|
-
});
|
|
101
79
|
Object.defineProperty(exports, "interpolatePath", {
|
|
102
80
|
enumerable: true,
|
|
103
81
|
get: () => routerCore.interpolatePath
|
|
@@ -217,7 +195,6 @@ exports.useChildMatches = Matches.useChildMatches;
|
|
|
217
195
|
exports.useMatchRoute = Matches.useMatchRoute;
|
|
218
196
|
exports.useMatches = Matches.useMatches;
|
|
219
197
|
exports.useParentMatches = Matches.useParentMatches;
|
|
220
|
-
exports.matchContext = matchContext.matchContext;
|
|
221
198
|
exports.Match = Match.Match;
|
|
222
199
|
exports.Outlet = Match.Outlet;
|
|
223
200
|
exports.useMatch = useMatch.useMatch;
|
|
@@ -250,7 +227,6 @@ exports.useRouter = useRouter.useRouter;
|
|
|
250
227
|
exports.useRouterState = useRouterState.useRouterState;
|
|
251
228
|
exports.useLocation = useLocation.useLocation;
|
|
252
229
|
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
253
|
-
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
254
230
|
exports.CatchNotFound = notFound.CatchNotFound;
|
|
255
231
|
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
256
232
|
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/utils.cjs
CHANGED
|
@@ -18,7 +18,6 @@ function _interopNamespaceDefault(e) {
|
|
|
18
18
|
return Object.freeze(n);
|
|
19
19
|
}
|
|
20
20
|
const Solid__namespace = /* @__PURE__ */ _interopNamespaceDefault(Solid);
|
|
21
|
-
const useLayoutEffect = typeof window !== "undefined" ? Solid__namespace.createRenderEffect : Solid__namespace.createEffect;
|
|
22
21
|
const usePrevious = (fn) => {
|
|
23
22
|
return Solid__namespace.createMemo(
|
|
24
23
|
(prev = {
|
|
@@ -53,6 +52,5 @@ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}
|
|
|
53
52
|
return () => observerRef;
|
|
54
53
|
}
|
|
55
54
|
exports.useIntersectionObserver = useIntersectionObserver;
|
|
56
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
57
55
|
exports.usePrevious = usePrevious;
|
|
58
56
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/cjs/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const usePrevious = (fn: () => boolean) => {\n return Solid.createMemo(\n (\n prev: { current: boolean | null; previous: boolean | null } = {\n current: null,\n previous: null,\n },\n ) => {\n const current = fn()\n\n if (prev.current !== current) {\n prev.previous = prev.current\n prev.current = current\n }\n\n return prev\n },\n )\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: Solid.Accessor<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n): Solid.Accessor<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n let observerRef: IntersectionObserver | null = null\n\n Solid.createEffect(() => {\n const r = ref()\n if (!r || !isIntersectionObserverAvailable || options.disabled) {\n return\n }\n\n observerRef = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.observe(r)\n\n Solid.onCleanup(() => {\n observerRef?.disconnect()\n })\n })\n\n return () => observerRef\n}\n"],"names":["Solid"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEO,MAAM,cAAc,CAAC,OAAsB;AAChD,SAAOA,iBAAM;AAAA,IACX,CACE,OAA8D;AAAA,MAC5D,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,MAET;AACH,YAAM,UAAU,GAAA;AAEhB,UAAI,KAAK,YAAY,SAAS;AAC5B,aAAK,WAAW,KAAK;AACrB,aAAK,UAAU;AAAA,MACjB;AAEA,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AA2BO,SAAS,wBACd,KACA,UACA,8BAAwD,CAAA,GACxD,UAAkC,IACW;AAC7C,QAAM,kCACJ,OAAO,yBAAyB;AAClC,MAAI,cAA2C;AAE/CA,mBAAM,aAAa,MAAM;AACvB,UAAM,IAAI,IAAA;AACV,QAAI,CAAC,KAAK,CAAC,mCAAmC,QAAQ,UAAU;AAC9D;AAAA,IACF;AAEA,kBAAc,IAAI,qBAAqB,CAAC,CAAC,KAAK,MAAM;AAClD,eAAS,KAAK;AAAA,IAChB,GAAG,2BAA2B;AAE9B,gBAAY,QAAQ,CAAC;AAErBA,qBAAM,UAAU,MAAM;AACpB,mBAAa,WAAA;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AAED,SAAO,MAAM;AACf;;;"}
|
package/dist/cjs/utils.d.cts
CHANGED
package/dist/esm/Matches.js
CHANGED
|
@@ -59,10 +59,12 @@ function MatchesInner() {
|
|
|
59
59
|
return memo(() => !!router.options.disableGlobalCatchBoundary)() ? matchComponent() : createComponent(CatchBoundary, {
|
|
60
60
|
getResetKey: () => resetKey(),
|
|
61
61
|
errorComponent: ErrorComponent,
|
|
62
|
-
onCatch
|
|
63
|
-
|
|
62
|
+
get onCatch() {
|
|
63
|
+
return process.env.NODE_ENV !== "production" ? (error) => {
|
|
64
|
+
warning(false, `The following error wasn't caught by any route! At the very leas
|
|
64
65
|
t, consider setting an 'errorComponent' in your RootRoute!`);
|
|
65
|
-
|
|
66
|
+
warning(false, error.message || error.toString());
|
|
67
|
+
} : void 0;
|
|
66
68
|
},
|
|
67
69
|
get children() {
|
|
68
70
|
return matchComponent();
|
package/dist/esm/Matches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very leas\n t, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n const child = props.children\n if (typeof child === 'function') {\n return (child as any)(params)\n }\n\n return params ? child : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","ResolvedSuspense","isServer","document","ssr","SafeFragment","Solid","Suspense","rootRoute","routesById","rootRouteId","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","Transitioner","MatchesInner","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchComponent","Show","when","Match","matchContext","Provider","value","_$memo","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","error","warning","message","toString","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","keyed","_","params","child","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;;;AAwCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAAA;AAEf,QAAMC,oBACHC,YAAYH,OAAOG,aACnB,OAAOC,aAAa,eAAeJ,OAAOK,MACvCC,eACAC,MAAMC;AAEZ,QAAMC,YAA4BA,MAAMT,OAAOU,WAAWC,WAAW;AACrE,QAAMC,mBACJH,YAAYI,QAAQC,oBACpBd,OAAOa,QAAQE;AAEjB,QAAMC,kBAAkBhB,OAAOa,QAAQI,aAAaX;AAEpD,SAAAY,gBACGF,iBAAe;AAAA,IAAA,IAAAG,WAAA;AAAA,aAAAD,gBACbhB,kBAAgB;AAAA,QAAA,IACfkB,WAAQ;AAAA,iBAAER,mBAAgBM,gBAAIN,wBAAsB;AAAA,QAAI;AAAA,QAAA,IAAAO,WAAA;AAAA,iBAAA,CAAAD,gBAEvDG,cAAY,CAAA,CAAA,GAAAH,gBACZI,cAAY,CAAA,CAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAIrB;AAEA,SAASA,eAAe;AACtB,QAAMtB,SAASC,UAAAA;AACf,QAAMsB,UAAUC,eAAe;AAAA,IAC7BC,QAASC,CAAAA,MAAM;AACb,aAAOA,EAAEC,QAAQ,CAAC,GAAGC;AAAAA,IACvB;AAAA,EAAA,CACD;AAED,QAAMC,WAAWL,eAAe;AAAA,IAC9BC,QAASC,OAAMA,EAAEI;AAAAA,EAAAA,CAClB;AAED,QAAMC,iBAAiBA,MAAM;AAC3B,WAAAb,gBACGX,MAAMyB,MAAI;AAAA,MAAA,IAACC,OAAI;AAAA,eAAEV,QAAAA;AAAAA,MAAS;AAAA,MAAA,IAAAJ,WAAA;AAAA,eAAAD,gBAC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,CACM;AACV;"}
|
|
1
|
+
{"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const ResolvedSuspense =\n (isServer ?? router.isServer) ||\n (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : Solid.Suspense\n\n const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n const PendingComponent =\n rootRoute().options.pendingComponent ??\n router.options.defaultPendingComponent\n\n const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <ResolvedSuspense\n fallback={PendingComponent ? <PendingComponent /> : null}\n >\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n </OptionalWrapper>\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = () => {\n return (\n <Solid.Show when={matchId()}>\n <Match matchId={matchId()!} />\n </Solid.Show>\n )\n }\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent()\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={\n process.env.NODE_ENV !== 'production'\n ? (error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very leas\n t, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }\n : undefined\n }\n >\n {matchComponent()}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n const child = props.children\n if (typeof child === 'function') {\n return (child as any)(params)\n }\n\n return params ? child : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","ResolvedSuspense","isServer","document","ssr","SafeFragment","Solid","Suspense","rootRoute","routesById","rootRouteId","PendingComponent","options","pendingComponent","defaultPendingComponent","OptionalWrapper","InnerWrap","_$createComponent","children","fallback","Transitioner","MatchesInner","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchComponent","Show","when","Match","matchContext","Provider","value","_$memo","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","process","env","NODE_ENV","error","warning","message","toString","undefined","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","keyed","_","params","child","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;;;AAwCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAAA;AAEf,QAAMC,oBACHC,YAAYH,OAAOG,aACnB,OAAOC,a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AAMI,QAAQJ,MAAM7C;AACpB,UAAI,OAAOiD,UAAU,YAAY;AAC/B,eAAQA,MAAcD,MAAM;AAAA,MAC9B;AAEA,aAAOA,SAASC,QAAQ;AAAA,IAC1B;AAAA,EAAA,CAAC;AAGP;AAWO,SAASC,WAIdd,MACsD;AACtD,SAAO/B,eAAe;AAAA,IACpBC,QAAQA,CAAC6C,UAA6C;AACpD,YAAM3C,UAAU2C,MAAM3C;AACtB,aAAO4B,MAAM9B,SACT8B,KAAK9B,OAAOE,OAA8C,IAC1DA;AAAAA,IACN;AAAA,EAAA,CACM;AACV;AAEO,SAAS4C,iBAIdhB,MACsD;AACtD,QAAMiB,iBAAiBjE,MAAMkE,WAAWtC,YAAY;AAEpD,SAAOkC,WAAW;AAAA,IAChB5C,QAAQA,CAACE,YAAiD;AACxDA,gBAAUA,QAAQ+C,MAChB,GACA/C,QAAQgD,UAAWC,OAAMA,EAAEhD,OAAO4C,eAAAA,CAAgB,CACpD;AACA,aAAOjB,MAAM9B,SAAS8B,KAAK9B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EAAA,CACM;AACV;AAEO,SAASkD,gBAIdtB,MACsD;AACtD,QAAMiB,iBAAiBjE,MAAMkE,WAAWtC,YAAY;AAEpD,SAAOkC,WAAW;AAAA,IAChB5C,QAAQA,CAACE,YAAiD;AACxDA,gBAAUA,QAAQ+C,MAChB/C,QAAQgD,UAAWC,CAAAA,MAAMA,EAAEhD,OAAO4C,eAAAA,CAAgB,IAAI,CACxD;AACA,aAAOjB,MAAM9B,SAAS8B,KAAK9B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EAAA,CACM;AACV;"}
|
package/dist/esm/fileRoute.js
CHANGED
|
@@ -21,10 +21,12 @@ class FileRoute {
|
|
|
21
21
|
constructor(path, _opts) {
|
|
22
22
|
this.path = path;
|
|
23
23
|
this.createRoute = (options) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (process.env.NODE_ENV !== "production") {
|
|
25
|
+
warning(
|
|
26
|
+
this.silent,
|
|
27
|
+
"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
|
|
28
|
+
);
|
|
29
|
+
}
|
|
28
30
|
const route = createRoute(options);
|
|
29
31
|
route.isRoot = false;
|
|
30
32
|
return route;
|
|
@@ -33,10 +35,12 @@ class FileRoute {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
function FileRouteLoader(_path) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (process.env.NODE_ENV !== "production") {
|
|
39
|
+
warning(
|
|
40
|
+
false,
|
|
41
|
+
`FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
40
44
|
return (loaderFn) => loaderFn;
|
|
41
45
|
}
|
|
42
46
|
class LazyRoute {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n warning(\n
|
|
1
|
+
{"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends RouteConstraints['TFullPath'] =\n FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n if (process.env.NODE_ENV !== 'production') {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n }\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n Register,\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n if (process.env.NODE_ENV !== 'production') {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n }\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (op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,MAAA,CACb;AAAA,IACV;AAEA,SAAA,YAA0C,CAACA,UAAS;AAClD,aAAO,UAAU;AAAA,QACf,QAAQA,OAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAO,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAO,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAA6C;AACzD,YAAM,SAAS,UAAA;AACf,aAAO,YAAY,EAAE,MAAM,OAAO,WAAW,KAAK,QAAQ,EAAE,EAAE,UAAU;AAAA,IAC1E;AA1CE,SAAK,UAAU;AAAA,EACjB;AA0CF;AAEO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AACO,SAAS,oBAGd,IAA8D;AAC9D,MAAI,OAAO,OAAO,UAAU;AAC1B,WAAO,IAAI,UAAkB,EAAE;AAAA,EACjC;AAEA,SAAO,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link.js';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.js';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.js';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.js';
|
|
16
|
-
export { matchContext } from './matchContext.js';
|
|
17
16
|
export { Match, Outlet } from './Match.js';
|
|
18
17
|
export { useMatch } from './useMatch.js';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps.js';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.js';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.js';
|
|
24
23
|
export { createRouter, Router } from './router.js';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider.js';
|
|
27
26
|
export type { RouterProps } from './RouterProvider.js';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.js';
|
|
@@ -36,7 +35,6 @@ export { useRouter } from './useRouter.js';
|
|
|
36
35
|
export { useRouterState } from './useRouterState.js';
|
|
37
36
|
export { useLocation } from './useLocation.js';
|
|
38
37
|
export { useCanGoBack } from './useCanGoBack.js';
|
|
39
|
-
export { useLayoutEffect } from './utils.js';
|
|
40
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found.js';
|
|
41
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
42
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/esm/index.dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST,
|
|
1
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
2
|
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
3
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
4
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
@@ -7,7 +7,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
7
7
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
8
8
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
9
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { matchContext } from "./matchContext.js";
|
|
11
10
|
import { Match, Outlet } from "./Match.js";
|
|
12
11
|
import { useMatch } from "./useMatch.js";
|
|
13
12
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -25,7 +24,6 @@ import { useRouter } from "./useRouter.js";
|
|
|
25
24
|
import { useRouterState } from "./useRouterState.js";
|
|
26
25
|
import { useLocation } from "./useLocation.js";
|
|
27
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
28
|
-
import { useLayoutEffect } from "./utils.js";
|
|
29
27
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
30
28
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
31
29
|
import { Asset } from "./Asset.js";
|
|
@@ -53,7 +51,6 @@ export {
|
|
|
53
51
|
Navigate,
|
|
54
52
|
NotFoundRoute,
|
|
55
53
|
Outlet,
|
|
56
|
-
PathParamError,
|
|
57
54
|
RootRoute,
|
|
58
55
|
Route,
|
|
59
56
|
RouteApi,
|
|
@@ -64,9 +61,7 @@ export {
|
|
|
64
61
|
Scripts,
|
|
65
62
|
ScrollRestoration,
|
|
66
63
|
SearchParamError,
|
|
67
|
-
TSR_DEFERRED_PROMISE,
|
|
68
64
|
cleanPath,
|
|
69
|
-
componentTypes,
|
|
70
65
|
composeRewrites,
|
|
71
66
|
createBrowserHistory,
|
|
72
67
|
createControlledPromise,
|
|
@@ -85,11 +80,9 @@ export {
|
|
|
85
80
|
createSerializationAdapter,
|
|
86
81
|
deepEqual,
|
|
87
82
|
defaultParseSearch,
|
|
88
|
-
defaultSerializeError,
|
|
89
83
|
defaultStringifySearch,
|
|
90
84
|
defer,
|
|
91
85
|
functionalUpdate,
|
|
92
|
-
getInitialRouterState,
|
|
93
86
|
getRouteApi,
|
|
94
87
|
interpolatePath,
|
|
95
88
|
isMatch,
|
|
@@ -101,7 +94,6 @@ export {
|
|
|
101
94
|
lazyFn,
|
|
102
95
|
lazyRouteComponent,
|
|
103
96
|
linkOptions,
|
|
104
|
-
matchContext,
|
|
105
97
|
notFound,
|
|
106
98
|
parseSearchWith,
|
|
107
99
|
redirect,
|
|
@@ -121,7 +113,6 @@ export {
|
|
|
121
113
|
useChildMatches,
|
|
122
114
|
useElementScrollRestoration,
|
|
123
115
|
useHydrated,
|
|
124
|
-
useLayoutEffect,
|
|
125
116
|
useLinkProps,
|
|
126
117
|
useLoaderData,
|
|
127
118
|
useLoaderDeps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.dev.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.dev.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST,
|
|
1
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
2
|
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
3
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
4
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
@@ -7,7 +7,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
7
7
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
8
8
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
9
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { matchContext } from "./matchContext.js";
|
|
11
10
|
import { Match, Outlet } from "./Match.js";
|
|
12
11
|
import { useMatch } from "./useMatch.js";
|
|
13
12
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -25,7 +24,6 @@ import { useRouter } from "./useRouter.js";
|
|
|
25
24
|
import { useRouterState } from "./useRouterState.js";
|
|
26
25
|
import { useLocation } from "./useLocation.js";
|
|
27
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
28
|
-
import { useLayoutEffect } from "./utils.js";
|
|
29
27
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
30
28
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
31
29
|
import { Asset } from "./Asset.js";
|
|
@@ -53,7 +51,6 @@ export {
|
|
|
53
51
|
Navigate,
|
|
54
52
|
NotFoundRoute,
|
|
55
53
|
Outlet,
|
|
56
|
-
PathParamError,
|
|
57
54
|
RootRoute,
|
|
58
55
|
Route,
|
|
59
56
|
RouteApi,
|
|
@@ -64,9 +61,7 @@ export {
|
|
|
64
61
|
Scripts,
|
|
65
62
|
ScrollRestoration,
|
|
66
63
|
SearchParamError,
|
|
67
|
-
TSR_DEFERRED_PROMISE,
|
|
68
64
|
cleanPath,
|
|
69
|
-
componentTypes,
|
|
70
65
|
composeRewrites,
|
|
71
66
|
createBrowserHistory,
|
|
72
67
|
createControlledPromise,
|
|
@@ -85,11 +80,9 @@ export {
|
|
|
85
80
|
createSerializationAdapter,
|
|
86
81
|
deepEqual,
|
|
87
82
|
defaultParseSearch,
|
|
88
|
-
defaultSerializeError,
|
|
89
83
|
defaultStringifySearch,
|
|
90
84
|
defer,
|
|
91
85
|
functionalUpdate,
|
|
92
|
-
getInitialRouterState,
|
|
93
86
|
getRouteApi,
|
|
94
87
|
interpolatePath,
|
|
95
88
|
isMatch,
|
|
@@ -101,7 +94,6 @@ export {
|
|
|
101
94
|
lazyFn,
|
|
102
95
|
lazyRouteComponent,
|
|
103
96
|
linkOptions,
|
|
104
|
-
matchContext,
|
|
105
97
|
notFound,
|
|
106
98
|
parseSearchWith,
|
|
107
99
|
redirect,
|
|
@@ -121,7 +113,6 @@ export {
|
|
|
121
113
|
useChildMatches,
|
|
122
114
|
useElementScrollRestoration,
|
|
123
115
|
useHydrated,
|
|
124
|
-
useLayoutEffect,
|
|
125
116
|
useLinkProps,
|
|
126
117
|
useLoaderData,
|
|
127
118
|
useLoaderDeps,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/utils.d.ts
CHANGED
package/dist/esm/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Solid from "solid-js";
|
|
2
|
-
const useLayoutEffect = typeof window !== "undefined" ? Solid.createRenderEffect : Solid.createEffect;
|
|
3
2
|
const usePrevious = (fn) => {
|
|
4
3
|
return Solid.createMemo(
|
|
5
4
|
(prev = {
|
|
@@ -35,7 +34,6 @@ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}
|
|
|
35
34
|
}
|
|
36
35
|
export {
|
|
37
36
|
useIntersectionObserver,
|
|
38
|
-
useLayoutEffect,
|
|
39
37
|
usePrevious
|
|
40
38
|
};
|
|
41
39
|
//# sourceMappingURL=utils.js.map
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const usePrevious = (fn: () => boolean) => {\n return Solid.createMemo(\n (\n prev: { current: boolean | null; previous: boolean | null } = {\n current: null,\n previous: null,\n },\n ) => {\n const current = fn()\n\n if (prev.current !== current) {\n prev.previous = prev.current\n prev.current = current\n }\n\n return prev\n },\n )\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: Solid.Accessor<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n): Solid.Accessor<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n let observerRef: IntersectionObserver | null = null\n\n Solid.createEffect(() => {\n const r = ref()\n if (!r || !isIntersectionObserverAvailable || options.disabled) {\n return\n }\n\n observerRef = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.observe(r)\n\n Solid.onCleanup(() => {\n observerRef?.disconnect()\n })\n })\n\n return () => observerRef\n}\n"],"names":[],"mappings":";AAEO,MAAM,cAAc,CAAC,OAAsB;AAChD,SAAO,MAAM;AAAA,IACX,CACE,OAA8D;AAAA,MAC5D,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,MAET;AACH,YAAM,UAAU,GAAA;AAEhB,UAAI,KAAK,YAAY,SAAS;AAC5B,aAAK,WAAW,KAAK;AACrB,aAAK,UAAU;AAAA,MACjB;AAEA,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AA2BO,SAAS,wBACd,KACA,UACA,8BAAwD,CAAA,GACxD,UAAkC,IACW;AAC7C,QAAM,kCACJ,OAAO,yBAAyB;AAClC,MAAI,cAA2C;AAE/C,QAAM,aAAa,MAAM;AACvB,UAAM,IAAI,IAAA;AACV,QAAI,CAAC,KAAK,CAAC,mCAAmC,QAAQ,UAAU;AAC9D;AAAA,IACF;AAEA,kBAAc,IAAI,qBAAqB,CAAC,CAAC,KAAK,MAAM;AAClD,eAAS,KAAK;AAAA,IAChB,GAAG,2BAA2B;AAE9B,gBAAY,QAAQ,CAAC;AAErB,UAAM,UAAU,MAAM;AACpB,mBAAa,WAAA;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AAED,SAAO,MAAM;AACf;"}
|
package/dist/source/Matches.jsx
CHANGED
|
@@ -42,11 +42,13 @@ function MatchesInner() {
|
|
|
42
42
|
</Solid.Show>);
|
|
43
43
|
};
|
|
44
44
|
return (<matchContext.Provider value={matchId}>
|
|
45
|
-
{router.options.disableGlobalCatchBoundary ? (matchComponent()) : (<CatchBoundary getResetKey={() => resetKey()} errorComponent={ErrorComponent} onCatch={
|
|
46
|
-
|
|
45
|
+
{router.options.disableGlobalCatchBoundary ? (matchComponent()) : (<CatchBoundary getResetKey={() => resetKey()} errorComponent={ErrorComponent} onCatch={process.env.NODE_ENV !== 'production'
|
|
46
|
+
? (error) => {
|
|
47
|
+
warning(false, `The following error wasn't caught by any route! At the very leas
|
|
47
48
|
t, consider setting an 'errorComponent' in your RootRoute!`);
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
warning(false, error.message || error.toString());
|
|
50
|
+
}
|
|
51
|
+
: undefined}>
|
|
50
52
|
{matchComponent()}
|
|
51
53
|
</CatchBoundary>)}
|
|
52
54
|
</matchContext.Provider>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.jsx","sourceRoot":"","sources":["../../src/Matches.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AA8B/B,MAAM,UAAU,OAAO;IACrB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,gBAAgB,GACpB,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;QAC7B,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC;QAC7C,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAA;IAEpB,MAAM,SAAS,GAAmB,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;IACtE,MAAM,gBAAgB,GACpB,SAAS,EAAE,CAAC,OAAO,CAAC,gBAAgB;QACpC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAA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YACD,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,CAAC;KACK,CAAC,CAAA;AACX,CAAC;AAED,MAAM,UAAU,eAAe,CAI7B,IAAgD;IAEhD,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IAErD,OAAO,UAAU,CAAC;QAChB,MAAM,EAAE,CAAC,OAA4C,EAAE,EAAE;YACvD,OAAO,GAAG,OAAO,CAAC,KAAK,CACrB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,cAAc,EAAE,CAAC,GAAG,CAAC,CACxD,CAAA;YACD,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,CAAC;KACK,CAAC,CAAA;AACX,CAAC"}
|
package/dist/source/fileRoute.js
CHANGED
|
@@ -25,7 +25,9 @@ export class FileRoute {
|
|
|
25
25
|
constructor(path, _opts) {
|
|
26
26
|
this.path = path;
|
|
27
27
|
this.createRoute = (options) => {
|
|
28
|
-
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
warning(this.silent, 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.');
|
|
30
|
+
}
|
|
29
31
|
const route = createRoute(options);
|
|
30
32
|
route.isRoot = false;
|
|
31
33
|
return route;
|
|
@@ -39,7 +41,9 @@ export class FileRoute {
|
|
|
39
41
|
`createFileRoute('/path/to/file)(options)` options.
|
|
40
42
|
*/
|
|
41
43
|
export function FileRouteLoader(_path) {
|
|
42
|
-
|
|
44
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
warning(false, `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`);
|
|
46
|
+
}
|
|
43
47
|
return (loaderFn) => loaderFn;
|
|
44
48
|
}
|
|
45
49
|
export class LazyRoute {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileRoute.js","sourceRoot":"","sources":["../../src/fileRoute.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AA4BvC,MAAM,UAAU,eAAe,CAQ7B,IAAgB;IAEhB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,SAAS,CAAiD,IAAI,EAAE;YACzE,MAAM,EAAE,IAAI;SACb,CAAC,CAAC,WAAW,CAAC,IAAI,CAAQ,CAAA;IAC7B,CAAC;IACD,OAAO,IAAI,SAAS,CAAiD,IAAI,EAAE;QACzE,MAAM,EAAE,IAAI;KACb,CAAC,CAAC,WAAW,CAAA;AAChB,CAAC;AAED;;;EAGE;AACF,MAAM,OAAO,SAAS;IAUpB,YACS,IAAgB,EACvB,KAA2B;QADpB,SAAI,GAAJ,IAAI,CAAY;QAMzB,gBAAW,GAAG,CAaZ,OA4BG,EAoBH,EAAE;YACF,OAAO,CACL,IAAI,CAAC,MAAM,EACX,iIAAiI,CAClI,CAAA;YACD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAc,CAAC,CACxC;YAA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AAA;AAC3E,CAAC"}
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches';
|
|
16
|
-
export { matchContext } from './matchContext';
|
|
17
16
|
export { Match, Outlet } from './Match';
|
|
18
17
|
export { useMatch } from './useMatch';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route';
|
|
24
23
|
export { createRouter, Router } from './router';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider';
|
|
27
26
|
export type { RouterProps } from './RouterProvider';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration';
|
|
@@ -36,7 +35,6 @@ export { useRouter } from './useRouter';
|
|
|
36
35
|
export { useRouterState } from './useRouterState';
|
|
37
36
|
export { useLocation } from './useLocation';
|
|
38
37
|
export { useCanGoBack } from './useCanGoBack';
|
|
39
|
-
export { useLayoutEffect } from './utils';
|
|
40
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found';
|
|
41
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
42
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/source/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
3
3
|
export { useAwaited, Await } from './awaited';
|
|
4
4
|
export { CatchBoundary, ErrorComponent } from './CatchBoundary';
|
|
@@ -8,7 +8,6 @@ export * from './history';
|
|
|
8
8
|
export { lazyRouteComponent } from './lazyRouteComponent';
|
|
9
9
|
export { useLinkProps, createLink, Link, linkOptions } from './link';
|
|
10
10
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches';
|
|
11
|
-
export { matchContext } from './matchContext';
|
|
12
11
|
export { Match, Outlet } from './Match';
|
|
13
12
|
export { useMatch } from './useMatch';
|
|
14
13
|
export { useLoaderDeps } from './useLoaderDeps';
|
|
@@ -16,7 +15,7 @@ export { useLoaderData } from './useLoaderData';
|
|
|
16
15
|
export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/router-core';
|
|
17
16
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
18
17
|
export { createRouter, Router } from './router';
|
|
19
|
-
export {
|
|
18
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
20
19
|
export { RouterProvider, RouterContextProvider } from './RouterProvider';
|
|
21
20
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration';
|
|
22
21
|
export { useBlocker, Block } from './useBlocker';
|
|
@@ -28,7 +27,6 @@ export { useRouter } from './useRouter';
|
|
|
28
27
|
export { useRouterState } from './useRouterState';
|
|
29
28
|
export { useLocation } from './useLocation';
|
|
30
29
|
export { useCanGoBack } from './useCanGoBack';
|
|
31
|
-
export { useLayoutEffect } from './utils';
|
|
32
30
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found';
|
|
33
31
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
34
32
|
export { ScriptOnce } from './ScriptOnce';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAA;AAqK9B,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAG7C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,SAAS,EACT,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAEpB,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAUpE,OAAO,EACL,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,WAAW,C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M,aAAa,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AA+B5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/source/utils.d.ts
CHANGED
package/dist/source/utils.js
CHANGED
package/dist/source/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAiB,EAAE,EAAE;IAC/C,OAAO,KAAK,CAAC,UAAU,CACrB,CACE,OAA8D;QAC5D,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,EACD,EAAE;QACF,MAAM,OAAO,GAAG,EAAE,EAAE,CAAA;QAEpB,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAA;YAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAA6B,EAC7B,QAAgE,EAChE,8BAAwD,EAAE,EAC1D,UAAkC,EAAE;IAEpC,MAAM,+BAA+B,GACnC,OAAO,oBAAoB,KAAK,UAAU,CAAA;IAC5C,IAAI,WAAW,GAAgC,IAAI,CAAA;IAEnD,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,CAAC,IAAI,CAAC,+BAA+B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC/D,OAAM;QACR,CAAC;QAED,WAAW,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE;YACjD,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC,EAAE,2BAA2B,CAAC,CAAA;QAE/B,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAEtB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,WAAW,EAAE,UAAU,EAAE,CAAA;QAC3B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,EAAE,CAAC,WAAW,CAAA;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "1.162.
|
|
3
|
+
"version": "1.162.6",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"tiny-invariant": "^1.3.3",
|
|
93
93
|
"tiny-warning": "^1.0.3",
|
|
94
94
|
"@tanstack/history": "1.161.4",
|
|
95
|
-
"@tanstack/router-core": "1.162.
|
|
95
|
+
"@tanstack/router-core": "1.162.6"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@solidjs/testing-library": "^0.8.10",
|
package/src/Matches.tsx
CHANGED
|
@@ -94,14 +94,18 @@ function MatchesInner() {
|
|
|
94
94
|
<CatchBoundary
|
|
95
95
|
getResetKey={() => resetKey()}
|
|
96
96
|
errorComponent={ErrorComponent}
|
|
97
|
-
onCatch={
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
onCatch={
|
|
98
|
+
process.env.NODE_ENV !== 'production'
|
|
99
|
+
? (error) => {
|
|
100
|
+
warning(
|
|
101
|
+
false,
|
|
102
|
+
`The following error wasn't caught by any route! At the very leas
|
|
101
103
|
t, consider setting an 'errorComponent' in your RootRoute!`,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
)
|
|
105
|
+
warning(false, error.message || error.toString())
|
|
106
|
+
}
|
|
107
|
+
: undefined
|
|
108
|
+
}
|
|
105
109
|
>
|
|
106
110
|
{matchComponent()}
|
|
107
111
|
</CatchBoundary>
|
package/src/fileRoute.ts
CHANGED
|
@@ -138,10 +138,12 @@ export class FileRoute<
|
|
|
138
138
|
TMiddlewares,
|
|
139
139
|
THandlers
|
|
140
140
|
> => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
142
|
+
warning(
|
|
143
|
+
this.silent,
|
|
144
|
+
'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',
|
|
145
|
+
)
|
|
146
|
+
}
|
|
145
147
|
const route = createRoute(options as any)
|
|
146
148
|
;(route as any).isRoot = false
|
|
147
149
|
return route as any
|
|
@@ -173,10 +175,12 @@ export function FileRouteLoader<
|
|
|
173
175
|
>
|
|
174
176
|
>,
|
|
175
177
|
) => TLoaderFn {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
179
|
+
warning(
|
|
180
|
+
false,
|
|
181
|
+
`FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \`createFileRoute('/path/to/file')(options)\` options`,
|
|
182
|
+
)
|
|
183
|
+
}
|
|
180
184
|
return (loaderFn) => loaderFn as any
|
|
181
185
|
}
|
|
182
186
|
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
2
|
defer,
|
|
3
|
-
TSR_DEFERRED_PROMISE,
|
|
4
3
|
isMatch,
|
|
5
4
|
joinPaths,
|
|
6
5
|
cleanPath,
|
|
@@ -10,7 +9,6 @@ export {
|
|
|
10
9
|
resolvePath,
|
|
11
10
|
interpolatePath,
|
|
12
11
|
rootRouteId,
|
|
13
|
-
defaultSerializeError,
|
|
14
12
|
defaultParseSearch,
|
|
15
13
|
defaultStringifySearch,
|
|
16
14
|
parseSearchWith,
|
|
@@ -244,7 +242,6 @@ export {
|
|
|
244
242
|
|
|
245
243
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'
|
|
246
244
|
|
|
247
|
-
export { matchContext } from './matchContext'
|
|
248
245
|
export { Match, Outlet } from './Match'
|
|
249
246
|
|
|
250
247
|
export { useMatch } from './useMatch'
|
|
@@ -280,13 +277,7 @@ export type {
|
|
|
280
277
|
|
|
281
278
|
export { createRouter, Router } from './router'
|
|
282
279
|
|
|
283
|
-
export {
|
|
284
|
-
componentTypes,
|
|
285
|
-
lazyFn,
|
|
286
|
-
SearchParamError,
|
|
287
|
-
PathParamError,
|
|
288
|
-
getInitialRouterState,
|
|
289
|
-
} from '@tanstack/router-core'
|
|
280
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core'
|
|
290
281
|
|
|
291
282
|
export { RouterProvider, RouterContextProvider } from './RouterProvider'
|
|
292
283
|
export type { RouterProps } from './RouterProvider'
|
|
@@ -310,8 +301,6 @@ export { useRouterState } from './useRouterState'
|
|
|
310
301
|
export { useLocation } from './useLocation'
|
|
311
302
|
export { useCanGoBack } from './useCanGoBack'
|
|
312
303
|
|
|
313
|
-
export { useLayoutEffect } from './utils'
|
|
314
|
-
|
|
315
304
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found'
|
|
316
305
|
export { notFound, isNotFound } from '@tanstack/router-core'
|
|
317
306
|
export type { NotFoundError } from '@tanstack/router-core'
|