@tanstack/vue-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/esm/Matches.js +2 -2
- 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.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/package.json +3 -3
- package/src/Matches.tsx +10 -7
- package/src/fileRoute.ts +12 -8
- package/src/index.tsx +1 -12
package/dist/esm/Matches.js
CHANGED
|
@@ -62,10 +62,10 @@ const MatchesInner = Vue.defineComponent({
|
|
|
62
62
|
return Vue.h(CatchBoundary, {
|
|
63
63
|
getResetKey: () => resetKey.value,
|
|
64
64
|
errorComponent: errorComponentFn,
|
|
65
|
-
onCatch: (error) => {
|
|
65
|
+
onCatch: process.env.NODE_ENV !== "production" ? (error) => {
|
|
66
66
|
warning(false, `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`);
|
|
67
67
|
warning(false, error.message || error.toString());
|
|
68
|
-
},
|
|
68
|
+
} : void 0,
|
|
69
69
|
children: childElement
|
|
70
70
|
});
|
|
71
71
|
};
|
package/dist/esm/Matches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport warning from 'tiny-warning'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { useTransitionerSetup } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport type {\n AnyRouter,\n DeepPartial,\n ErrorComponentProps,\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\n// Define a type for the error component function\ntype ErrorRouteComponentType = (props: ErrorComponentProps) => Vue.VNode\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Vue.ComponentOptions['meta'] | undefined>\n links?: Array<Vue.ComponentOptions['link'] | undefined>\n scripts?: Array<Vue.ComponentOptions['script'] | undefined>\n headScripts?: Array<Vue.ComponentOptions['script'] | undefined>\n }\n}\n\n// Create a component that renders MatchesInner with Transitioner's setup logic inlined.\n// This is critical for proper hydration - we call useTransitionerSetup() as a composable\n// rather than rendering it as a component, which avoids Fragment/element mismatches.\nconst MatchesContent = Vue.defineComponent({\n name: 'MatchesContent',\n setup() {\n // IMPORTANT: We need to ensure Transitioner's setup() runs.\n // Transitioner sets up critical functionality:\n // - router.startTransition\n // - History subscription via router.history.subscribe(router.load)\n // - Watchers for router events\n //\n // We inline Transitioner's setup logic here. Since Transitioner returns null,\n // we can call its setup function directly without affecting the render tree.\n // This is done by importing and calling useTransitionerSetup.\n useTransitionerSetup()\n\n return () => Vue.h(MatchesInner)\n },\n})\n\nexport const Matches = Vue.defineComponent({\n name: 'Matches',\n setup() {\n const router = useRouter()\n\n return () => {\n const pendingElement = router?.options?.defaultPendingComponent\n ? Vue.h(router.options.defaultPendingComponent)\n : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const inner =\n (isServer ?? router?.isServer ?? false) ||\n (typeof document !== 'undefined' && router?.ssr)\n ? Vue.h(MatchesContent)\n : Vue.h(\n Vue.Suspense,\n { fallback: pendingElement },\n {\n default: () => Vue.h(MatchesContent),\n },\n )\n\n return router?.options?.InnerWrap\n ? Vue.h(router.options.InnerWrap, null, { default: () => inner })\n : inner\n }\n },\n})\n\n// Create a simple error component function that matches ErrorRouteComponent\nconst errorComponentFn: ErrorRouteComponentType = (\n props: ErrorComponentProps,\n) => {\n return Vue.h('div', { class: 'error' }, [\n Vue.h('h1', null, 'Error'),\n Vue.h('p', null, props.error.message || String(props.error)),\n Vue.h('button', { onClick: props.reset }, 'Try Again'),\n ])\n}\n\nconst MatchesInner = Vue.defineComponent({\n name: 'MatchesInner',\n setup() {\n const router = useRouter()\n\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 // Create a ref for the match id to provide\n const matchIdRef = Vue.computed(() => matchId.value)\n\n // Provide the matchId for child components using the InjectionKey\n Vue.provide(matchContext, matchIdRef)\n\n return () => {\n // Generate a placeholder element if matchId.value is not present\n const childElement = matchId.value\n ? Vue.h(Match, { matchId: matchId.value })\n : Vue.h('div')\n\n // If disableGlobalCatchBoundary is true, don't wrap in CatchBoundary\n if (router.options.disableGlobalCatchBoundary) {\n return childElement\n }\n\n return Vue.h(CatchBoundary, {\n getResetKey: () => resetKey.value,\n errorComponent: errorComponentFn,\n onCatch: (error: Error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n },\n children: childElement,\n })\n }\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 // Track state changes to trigger re-computation\n // Use multiple state values like React does for complete reactivity\n const routerState = useRouterState({\n select: (s) => ({\n locationHref: s.location.href,\n resolvedLocationHref: s.resolvedLocation?.href,\n status: s.status,\n }),\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 ): Vue.Ref<\n false | ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Vue.computed(() => {\n // Access routerState to establish dependency\n\n routerState.value\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 ) => Vue.VNode)\n | Vue.VNode\n}\n\n// Create a type for the MatchRoute component that includes the generics\nexport interface MatchRouteComponentType {\n <\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n >(\n props: MakeMatchRouteOptions<TRouter, TFrom, TTo>,\n ): Vue.VNode\n new (): {\n $props: {\n from?: string\n to?: string\n fuzzy?: boolean\n caseSensitive?: boolean\n includeSearch?: boolean\n pending?: boolean\n }\n }\n}\n\nexport const MatchRoute = Vue.defineComponent({\n name: 'MatchRoute',\n props: {\n // Define props to match MakeMatchRouteOptions\n from: {\n type: String,\n required: false,\n },\n to: {\n type: String,\n required: false,\n },\n fuzzy: {\n type: Boolean,\n required: false,\n },\n caseSensitive: {\n type: Boolean,\n required: false,\n },\n includeSearch: {\n type: Boolean,\n required: false,\n },\n pending: {\n type: Boolean,\n required: false,\n },\n },\n setup(props, { slots }) {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return () => {\n if (!status.value) return null\n\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any).value as boolean\n\n // Create a component that renders the slot in a reactive manner\n if (!params || !slots.default) {\n return null\n }\n\n // For function slots, pass the params\n if (typeof slots.default === 'function') {\n // Use h to create a wrapper component that will call the slot function\n return Vue.h(Vue.Fragment, null, slots.default(params))\n }\n\n // For normal slots, just render them\n return Vue.h(Vue.Fragment, null, slots.default)\n }\n },\n}) as unknown as MatchRouteComponentType\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): Vue.Ref<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 Vue.Ref<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Vue.Ref<UseMatchesResult<TRouter, TSelected>> {\n // Use matchContext with proper type\n const contextMatchId = Vue.inject<Vue.Ref<string | undefined>>(matchContext)\n const safeMatchId = Vue.computed(() => contextMatchId?.value || '')\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === safeMatchId.value),\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): Vue.Ref<UseMatchesResult<TRouter, TSelected>> {\n // Use matchContext with proper type\n const contextMatchId = Vue.inject<Vue.Ref<string | undefined>>(matchContext)\n const safeMatchId = Vue.computed(() => contextMatchId?.value || '')\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === safeMatchId.value) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["MatchesContent","Vue","defineComponent","name","setup","useTransitionerSetup","h","MatchesInner","Matches","router","useRouter","pendingElement","options","defaultPendingComponent","inner","isServer","document","ssr","Suspense","fallback","default","InnerWrap","errorComponentFn","props","class","error","message","String","onClick","reset","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchIdRef","computed","value","provide","matchContext","childElement","Match","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","onCatch","warning","toString","children","useMatchRoute","routerState","locationHref","location","href","resolvedLocationHref","resolvedLocation","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","MatchRoute","from","type","required","to","Boolean","slots","params","Fragment","useMatches","state","useParentMatches","contextMatchId","inject","safeMatchId","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;AA0CA,MAAMA,iBAAiBC,IAAIC,gBAAgB;AAAA,EACzCC,MAAM;AAA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AA,IACN;AAAA,EACF,CAAQ;AACV;AAEO,SAAS6C,iBAIdlB,MAC+C;AAE/C,QAAMmB,iBAAiB/E,IAAIgF,OAAoCvC,YAAY;AAC3E,QAAMwC,cAAcjF,IAAIsC,SAAS,MAAMyC,gBAAgBxC,SAAS,EAAE;AAElE,SAAOqC,WAAW;AAAA,IAChB7C,QAASE,aAAiD;AACxDA,gBAAUA,QAAQiD,MAChB,GACAjD,QAAQkD,UAAWC,OAAMA,EAAElD,OAAO+C,YAAY1C,KAAK,CACrD;AACA,aAAOqB,MAAM7B,SAAS6B,KAAK7B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EACF,CAAQ;AACV;AAEO,SAASoD,gBAIdzB,MAC+C;AAE/C,QAAMmB,iBAAiB/E,IAAIgF,OAAoCvC,YAAY;AAC3E,QAAMwC,cAAcjF,IAAIsC,SAAS,MAAMyC,gBAAgBxC,SAAS,EAAE;AAElE,SAAOqC,WAAW;AAAA,IAChB7C,QAASE,aAAiD;AACxDA,gBAAUA,QAAQiD,MAChBjD,QAAQkD,UAAWC,OAAMA,EAAElD,OAAO+C,YAAY1C,KAAK,IAAI,CACzD;AACA,aAAOqB,MAAM7B,SAAS6B,KAAK7B,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EACF,CAAQ;AACV;"}
|
|
1
|
+
{"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport warning from 'tiny-warning'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { useTransitionerSetup } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport type {\n AnyRouter,\n DeepPartial,\n ErrorComponentProps,\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\n// Define a type for the error component function\ntype ErrorRouteComponentType = (props: ErrorComponentProps) => Vue.VNode\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Vue.ComponentOptions['meta'] | undefined>\n links?: Array<Vue.ComponentOptions['link'] | undefined>\n scripts?: Array<Vue.ComponentOptions['script'] | undefined>\n headScripts?: Array<Vue.ComponentOptions['script'] | undefined>\n }\n}\n\n// Create a component that renders MatchesInner with Transitioner's setup logic inlined.\n// This is critical for proper hydration - we call useTransitionerSetup() as a composable\n// rather than rendering it as a component, which avoids Fragment/element mismatches.\nconst MatchesContent = Vue.defineComponent({\n name: 'MatchesContent',\n setup() {\n // IMPORTANT: We need to ensure Transitioner's setup() runs.\n // Transitioner sets up critical functionality:\n // - router.startTransition\n // - History subscription via router.history.subscribe(router.load)\n // - Watchers for router events\n //\n // We inline Transitioner's setup logic here. Since Transitioner returns null,\n // we can call its setup function directly without affecting the render tree.\n // This is done by importing and calling useTransitionerSetup.\n useTransitionerSetup()\n\n return () => Vue.h(MatchesInner)\n },\n})\n\nexport const Matches = Vue.defineComponent({\n name: 'Matches',\n setup() {\n const router = useRouter()\n\n return () => {\n const pendingElement = router?.options?.defaultPendingComponent\n ? Vue.h(router.options.defaultPendingComponent)\n : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const inner =\n (isServer ?? router?.isServer ?? false) ||\n (typeof document !== 'undefined' && router?.ssr)\n ? Vue.h(MatchesContent)\n : Vue.h(\n Vue.Suspense,\n { fallback: pendingElement },\n {\n default: () => Vue.h(MatchesContent),\n },\n )\n\n return router?.options?.InnerWrap\n ? Vue.h(router.options.InnerWrap, null, { default: () => inner })\n : inner\n }\n },\n})\n\n// Create a simple error component function that matches ErrorRouteComponent\nconst errorComponentFn: ErrorRouteComponentType = (\n props: ErrorComponentProps,\n) => {\n return Vue.h('div', { class: 'error' }, [\n Vue.h('h1', null, 'Error'),\n Vue.h('p', null, props.error.message || String(props.error)),\n Vue.h('button', { onClick: props.reset }, 'Try Again'),\n ])\n}\n\nconst MatchesInner = Vue.defineComponent({\n name: 'MatchesInner',\n setup() {\n const router = useRouter()\n\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 // Create a ref for the match id to provide\n const matchIdRef = Vue.computed(() => matchId.value)\n\n // Provide the matchId for child components using the InjectionKey\n Vue.provide(matchContext, matchIdRef)\n\n return () => {\n // Generate a placeholder element if matchId.value is not present\n const childElement = matchId.value\n ? Vue.h(Match, { matchId: matchId.value })\n : Vue.h('div')\n\n // If disableGlobalCatchBoundary is true, don't wrap in CatchBoundary\n if (router.options.disableGlobalCatchBoundary) {\n return childElement\n }\n\n return Vue.h(CatchBoundary, {\n getResetKey: () => resetKey.value,\n errorComponent: errorComponentFn,\n onCatch:\n process.env.NODE_ENV !== 'production'\n ? (error: Error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }\n : undefined,\n children: childElement,\n })\n }\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 // Track state changes to trigger re-computation\n // Use multiple state values like React does for complete reactivity\n const routerState = useRouterState({\n select: (s) => ({\n locationHref: s.location.href,\n resolvedLocationHref: s.resolvedLocation?.href,\n status: s.status,\n }),\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 ): Vue.Ref<\n false | ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Vue.computed(() => {\n // Access routerState to establish dependency\n\n routerState.value\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 ) => Vue.VNode)\n | Vue.VNode\n}\n\n// Create a type for the MatchRoute component that includes the generics\nexport interface MatchRouteComponentType {\n <\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n >(\n props: MakeMatchRouteOptions<TRouter, TFrom, TTo>,\n ): Vue.VNode\n new (): {\n $props: {\n from?: string\n to?: string\n fuzzy?: boolean\n caseSensitive?: boolean\n includeSearch?: boolean\n pending?: boolean\n }\n }\n}\n\nexport const MatchRoute = Vue.defineComponent({\n name: 'MatchRoute',\n props: {\n // Define props to match MakeMatchRouteOptions\n from: {\n type: String,\n required: false,\n },\n to: {\n type: String,\n required: false,\n },\n fuzzy: {\n type: Boolean,\n required: false,\n },\n caseSensitive: {\n type: Boolean,\n required: false,\n },\n includeSearch: {\n type: Boolean,\n required: false,\n },\n pending: {\n type: Boolean,\n required: false,\n },\n },\n setup(props, { slots }) {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return () => {\n if (!status.value) return null\n\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any).value as boolean\n\n // Create a component that renders the slot in a reactive manner\n if (!params || !slots.default) {\n return null\n }\n\n // For function slots, pass the params\n if (typeof slots.default === 'function') {\n // Use h to create a wrapper component that will call the slot function\n return Vue.h(Vue.Fragment, null, slots.default(params))\n }\n\n // For normal slots, just render them\n return Vue.h(Vue.Fragment, null, slots.default)\n }\n },\n}) as unknown as MatchRouteComponentType\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): Vue.Ref<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 Vue.Ref<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Vue.Ref<UseMatchesResult<TRouter, TSelected>> {\n // Use matchContext with proper type\n const contextMatchId = Vue.inject<Vue.Ref<string | undefined>>(matchContext)\n const safeMatchId = Vue.computed(() => contextMatchId?.value || '')\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === safeMatchId.value),\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): Vue.Ref<UseMatchesResult<TRouter, TSelected>> {\n // Use matchContext with proper type\n const contextMatchId = Vue.inject<Vue.Ref<string | undefined>>(matchContext)\n const safeMatchId = Vue.computed(() => contextMatchId?.value || '')\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === safeMatchId.value) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["MatchesContent","Vue","defineComponent","name","setup","useTransitionerSetup","h","MatchesInner","Matches","router","useRouter","pendingElement","options","defaultPendingComponent","inner","isServer","document","ssr","Suspense","fallback","default","InnerWrap","errorComponentFn","props","class","error","message","String","onClick","reset","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchIdRef","computed","value","provide","matchContext","childElement","Match","disableGlobalCatchBoundary","CatchBoundary","getResetKey","errorComponent","onCatch","process","env","NODE_ENV","warning","toString","undefined","children","useMatchRoute","routerState","locationHref","location","href","resolvedLocationHref","resolvedLocation","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","MatchRoute","from","type","required","to","Boolean","slots","params","Fragment","useMatches","state","useParentMatches","contextMatchId","inject","safeMatchId","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;AA0CA,MAAMA,iBAAiBC,IAAIC,gBAAgB;AAAA,EACzCC,MAAM;AAAA,EACNC,QAAQ;AAUNC,yBAAoB;AAEpB,WAAO,MAAMJ,IAAIK,EAAEC,YAAY;AAAA,EACjC;AACF,CAAC;MAEYC,UAAUP,IAAIC,gBAAgB;AAAA,EACzCC,MAAM;AAAA,EACNC,QAAQ;AACN,UAAMK,SAASC,UAAS;AAExB,WAAO,MAAM;AACX,YAAMC,iBAAiBF,QAAQG,SAASC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AAAA,IAChBjD,QAASE,aAAiD;AACxDA,gBAAUA,QAAQqD,MAChB,GACArD,QAAQsD,UAAWC,OAAMA,EAAEtD,OAAOmD,YAAY9C,KAAK,CACrD;AACA,aAAOyB,MAAMjC,SAASiC,KAAKjC,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EACF,CAAQ;AACV;AAEO,SAASwD,gBAIdzB,MAC+C;AAE/C,QAAMmB,iBAAiBnF,IAAIoF,OAAoC3C,YAAY;AAC3E,QAAM4C,cAAcrF,IAAIsC,SAAS,MAAM6C,gBAAgB5C,SAAS,EAAE;AAElE,SAAOyC,WAAW;AAAA,IAChBjD,QAASE,aAAiD;AACxDA,gBAAUA,QAAQqD,MAChBrD,QAAQsD,UAAWC,OAAMA,EAAEtD,OAAOmD,YAAY9C,KAAK,IAAI,CACzD;AACA,aAAOyB,MAAMjC,SAASiC,KAAKjC,OAAOE,OAAO,IAAIA;AAAAA,IAC/C;AAAA,EACF,CAAQ;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 (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["opts"],"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,UAAI,QAA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ACf,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 { AnyRoute, 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, Register, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, FileRoutesByPath, RouteById, RootRouteOptions, CreateFileRoute, SerializationAdapter, AnySerializationAdapter, 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 type { InferDescendantToPaths, RelativeToPath, RelativeToParentPath, Rela
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentRoute, 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, createRouterConfig, DEFAULT_PROTOCOL_ALLOWLIST, }
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.js';
|
|
23
22
|
export type { AnyRootRoute, VueNode, SyncRouteComponent, 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, createRouterConfig, 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";
|
|
@@ -6,7 +6,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
6
6
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
7
7
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
8
8
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
9
|
-
import { matchContext } from "./matchContext.js";
|
|
10
9
|
import { Match, Outlet } from "./Match.js";
|
|
11
10
|
import { useMatch } from "./useMatch.js";
|
|
12
11
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -24,7 +23,6 @@ import { useRouter } from "./useRouter.js";
|
|
|
24
23
|
import { useRouterState } from "./useRouterState.js";
|
|
25
24
|
import { useLocation } from "./useLocation.js";
|
|
26
25
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
27
|
-
import { useLayoutEffect } from "./utils.js";
|
|
28
26
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
29
27
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
30
28
|
import { Asset } from "./Asset.js";
|
|
@@ -57,7 +55,6 @@ export {
|
|
|
57
55
|
Navigate,
|
|
58
56
|
NotFoundRoute,
|
|
59
57
|
Outlet,
|
|
60
|
-
PathParamError,
|
|
61
58
|
RootRoute,
|
|
62
59
|
Route,
|
|
63
60
|
RouteApi,
|
|
@@ -68,9 +65,7 @@ export {
|
|
|
68
65
|
Scripts,
|
|
69
66
|
ScrollRestoration,
|
|
70
67
|
SearchParamError,
|
|
71
|
-
TSR_DEFERRED_PROMISE,
|
|
72
68
|
cleanPath,
|
|
73
|
-
componentTypes,
|
|
74
69
|
composeRewrites,
|
|
75
70
|
createBrowserHistory,
|
|
76
71
|
createControlledPromise,
|
|
@@ -90,11 +85,9 @@ export {
|
|
|
90
85
|
createSerializationAdapter,
|
|
91
86
|
deepEqual,
|
|
92
87
|
defaultParseSearch,
|
|
93
|
-
defaultSerializeError,
|
|
94
88
|
defaultStringifySearch,
|
|
95
89
|
defer,
|
|
96
90
|
functionalUpdate,
|
|
97
|
-
getInitialRouterState,
|
|
98
91
|
getRouteApi,
|
|
99
92
|
interpolatePath,
|
|
100
93
|
isMatch,
|
|
@@ -106,7 +99,6 @@ export {
|
|
|
106
99
|
lazyFn,
|
|
107
100
|
lazyRouteComponent,
|
|
108
101
|
linkOptions,
|
|
109
|
-
matchContext,
|
|
110
102
|
notFound,
|
|
111
103
|
parseSearchWith,
|
|
112
104
|
redirect,
|
|
@@ -125,7 +117,6 @@ export {
|
|
|
125
117
|
useCanGoBack,
|
|
126
118
|
useChildMatches,
|
|
127
119
|
useElementScrollRestoration,
|
|
128
|
-
useLayoutEffect,
|
|
129
120
|
useLinkProps,
|
|
130
121
|
useLoaderData,
|
|
131
122
|
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, createRouterConfig, 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";
|
|
@@ -6,7 +6,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
6
6
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
7
7
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
8
8
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
9
|
-
import { matchContext } from "./matchContext.js";
|
|
10
9
|
import { Match, Outlet } from "./Match.js";
|
|
11
10
|
import { useMatch } from "./useMatch.js";
|
|
12
11
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -24,7 +23,6 @@ import { useRouter } from "./useRouter.js";
|
|
|
24
23
|
import { useRouterState } from "./useRouterState.js";
|
|
25
24
|
import { useLocation } from "./useLocation.js";
|
|
26
25
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
27
|
-
import { useLayoutEffect } from "./utils.js";
|
|
28
26
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
29
27
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
30
28
|
import { Asset } from "./Asset.js";
|
|
@@ -57,7 +55,6 @@ export {
|
|
|
57
55
|
Navigate,
|
|
58
56
|
NotFoundRoute,
|
|
59
57
|
Outlet,
|
|
60
|
-
PathParamError,
|
|
61
58
|
RootRoute,
|
|
62
59
|
Route,
|
|
63
60
|
RouteApi,
|
|
@@ -68,9 +65,7 @@ export {
|
|
|
68
65
|
Scripts,
|
|
69
66
|
ScrollRestoration,
|
|
70
67
|
SearchParamError,
|
|
71
|
-
TSR_DEFERRED_PROMISE,
|
|
72
68
|
cleanPath,
|
|
73
|
-
componentTypes,
|
|
74
69
|
composeRewrites,
|
|
75
70
|
createBrowserHistory,
|
|
76
71
|
createControlledPromise,
|
|
@@ -90,11 +85,9 @@ export {
|
|
|
90
85
|
createSerializationAdapter,
|
|
91
86
|
deepEqual,
|
|
92
87
|
defaultParseSearch,
|
|
93
|
-
defaultSerializeError,
|
|
94
88
|
defaultStringifySearch,
|
|
95
89
|
defer,
|
|
96
90
|
functionalUpdate,
|
|
97
|
-
getInitialRouterState,
|
|
98
91
|
getRouteApi,
|
|
99
92
|
interpolatePath,
|
|
100
93
|
isMatch,
|
|
@@ -106,7 +99,6 @@ export {
|
|
|
106
99
|
lazyFn,
|
|
107
100
|
lazyRouteComponent,
|
|
108
101
|
linkOptions,
|
|
109
|
-
matchContext,
|
|
110
102
|
notFound,
|
|
111
103
|
parseSearchWith,
|
|
112
104
|
redirect,
|
|
@@ -125,7 +117,6 @@ export {
|
|
|
125
117
|
useCanGoBack,
|
|
126
118
|
useChildMatches,
|
|
127
119
|
useElementScrollRestoration,
|
|
128
|
-
useLayoutEffect,
|
|
129
120
|
useLinkProps,
|
|
130
121
|
useLoaderData,
|
|
131
122
|
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.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Vue from "vue";
|
|
2
|
-
const useLayoutEffect = typeof window !== "undefined" ? Vue.effect : Vue.effect;
|
|
3
2
|
const usePrevious = (fn) => {
|
|
4
3
|
return Vue.computed(
|
|
5
4
|
(prev = {
|
|
@@ -38,7 +37,6 @@ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}
|
|
|
38
37
|
}
|
|
39
38
|
export {
|
|
40
39
|
useIntersectionObserver,
|
|
41
|
-
useLayoutEffect,
|
|
42
40
|
usePrevious
|
|
43
41
|
};
|
|
44
42
|
//# 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 Vue from 'vue'\n\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? Vue.effect : Vue.effect\n\nexport const usePrevious = (fn: () => boolean) => {\n return Vue.computed(\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: Vue.Ref<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean | (() => boolean) } = {},\n): Vue.Ref<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n const observerRef = Vue.ref<IntersectionObserver | null>(null)\n\n // Use watchEffect with cleanup to properly manage the observer lifecycle\n Vue.watchEffect((onCleanup) => {\n const r = ref.value\n // Support both static boolean and function for disabled check\n const isDisabled =\n typeof options.disabled === 'function'\n ? options.disabled()\n : options.disabled\n if (!r || !isIntersectionObserverAvailable || isDisabled) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.value = observer\n observer.observe(r)\n\n onCleanup(() => {\n observer.disconnect()\n observerRef.value = null\n })\n })\n\n return observerRef\n}\n\nexport function splitProps<T extends Record<string, any>>(\n props: T,\n keys: Array<keyof T>,\n) {\n // Get the specified props\n const selectedProps = Vue.computed(() => {\n return Object.fromEntries(keys.map((key) => [key, props[key]]))\n })\n\n // Get remaining props as attrs\n const remainingAttrs = Vue.computed(() => {\n const attrs = Vue.useAttrs()\n return Object.fromEntries(\n Object.entries(attrs).filter(([key]) => !keys.includes(key as keyof T)),\n )\n })\n\n return [selectedProps, remainingAttrs]\n}\n\nexport type ParentProps<T = {}> = T & {\n children?: Vue.VNode | Array<Vue.VNode> | string\n}\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as Vue from 'vue'\n\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? Vue.effect : Vue.effect\n\nexport const usePrevious = (fn: () => boolean) => {\n return Vue.computed(\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: Vue.Ref<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean | (() => boolean) } = {},\n): Vue.Ref<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n const observerRef = Vue.ref<IntersectionObserver | null>(null)\n\n // Use watchEffect with cleanup to properly manage the observer lifecycle\n Vue.watchEffect((onCleanup) => {\n const r = ref.value\n // Support both static boolean and function for disabled check\n const isDisabled =\n typeof options.disabled === 'function'\n ? options.disabled()\n : options.disabled\n if (!r || !isIntersectionObserverAvailable || isDisabled) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.value = observer\n observer.observe(r)\n\n onCleanup(() => {\n observer.disconnect()\n observerRef.value = null\n })\n })\n\n return observerRef\n}\n\nexport function splitProps<T extends Record<string, any>>(\n props: T,\n keys: Array<keyof T>,\n) {\n // Get the specified props\n const selectedProps = Vue.computed(() => {\n return Object.fromEntries(keys.map((key) => [key, props[key]]))\n })\n\n // Get remaining props as attrs\n const remainingAttrs = Vue.computed(() => {\n const attrs = Vue.useAttrs()\n return Object.fromEntries(\n Object.entries(attrs).filter(([key]) => !keys.includes(key as keyof T)),\n )\n })\n\n return [selectedProps, remainingAttrs]\n}\n\nexport type ParentProps<T = {}> = T & {\n children?: Vue.VNode | Array<Vue.VNode> | string\n}\n"],"names":[],"mappings":";AAKO,MAAM,cAAc,CAAC,OAAsB;AAChD,SAAO,IAAI;AAAA,IACT,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,UAAoD,IACd;AACtC,QAAM,kCACJ,OAAO,yBAAyB;AAClC,QAAM,cAAc,IAAI,IAAiC,IAAI;AAG7D,MAAI,YAAY,CAAC,cAAc;AAC7B,UAAM,IAAI,IAAI;AAEd,UAAM,aACJ,OAAO,QAAQ,aAAa,aACxB,QAAQ,aACR,QAAQ;AACd,QAAI,CAAC,KAAK,CAAC,mCAAmC,YAAY;AACxD;AAAA,IACF;AAEA,UAAM,WAAW,IAAI,qBAAqB,CAAC,CAAC,KAAK,MAAM;AACrD,eAAS,KAAK;AAAA,IAChB,GAAG,2BAA2B;AAE9B,gBAAY,QAAQ;AACpB,aAAS,QAAQ,CAAC;AAElB,cAAU,MAAM;AACd,eAAS,WAAA;AACT,kBAAY,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;"}
|
package/dist/source/Matches.jsx
CHANGED
|
@@ -83,10 +83,12 @@ const MatchesInner = Vue.defineComponent({
|
|
|
83
83
|
return Vue.h(CatchBoundary, {
|
|
84
84
|
getResetKey: () => resetKey.value,
|
|
85
85
|
errorComponent: errorComponentFn,
|
|
86
|
-
onCatch:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
onCatch: process.env.NODE_ENV !== 'production'
|
|
87
|
+
? (error) => {
|
|
88
|
+
warning(false, `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`);
|
|
89
|
+
warning(false, error.message || error.toString());
|
|
90
|
+
}
|
|
91
|
+
: undefined,
|
|
90
92
|
children: childElement,
|
|
91
93
|
});
|
|
92
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.jsx","sourceRoot":"","sources":["../../src/Matches.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,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AU,CAAC;QAChB,MAAM,EAAE,CAAC,OAA4C,EAAE,EAAE;YACvD,OAAO,GAAG,OAAO,CAAC,KAAK,CACrB,CAAC,EACD,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,KAAK,CAAC,CACrD,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;AAED,MAAM,UAAU,eAAe,CAI7B,IAAgD;IAEhD,oCAAoC;IACpC,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAA8B,YAAY,CAAC,CAAA;IAC5E,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,CAAA;IAEnE,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,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CACzD,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,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,SAAS,CAAS;YAC3B,EAAE,EAAE,EAAE;YACN,GAAG,IAAI;SACR,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC;AACD,MAAM,UAAU,mBAAmB,CAGjC,EAAa;IACb,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAI,SAAS,CAAS,EAAE,CAAQ,CAAA;IACzC,CAAC;IAED,OAAO,CAAC,IAAsB,EAAE,EAAE,CAAC,IAAI,SAAS,CAAS,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;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 { AnyRoute, 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, Register, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, FileRoutesByPath, RouteById, RootRouteOptions, CreateFileRoute, SerializationAdapter, AnySerializationAdapter, 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 type { InferDescendantToPaths, RelativeToPath, RelativeToParentPath, Rela
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentRoute, 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, createRouterConfig, DEFAULT_PROTOCOL_ALLOWLIST, }
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
23
22
|
export type { AnyRootRoute, VueNode, SyncRouteComponent, 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';
|
|
@@ -7,7 +7,6 @@ export * from './history';
|
|
|
7
7
|
export { lazyRouteComponent } from './lazyRouteComponent';
|
|
8
8
|
export { useLinkProps, createLink, Link, linkOptions } from './link';
|
|
9
9
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches';
|
|
10
|
-
export { matchContext } from './matchContext';
|
|
11
10
|
export { Match, Outlet } from './Match';
|
|
12
11
|
export { useMatch } from './useMatch';
|
|
13
12
|
export { useLoaderDeps } from './useLoaderDeps';
|
|
@@ -15,7 +14,7 @@ export { useLoaderData } from './useLoaderData';
|
|
|
15
14
|
export { redirect, isRedirect, createRouterConfig, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/router-core';
|
|
16
15
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
17
16
|
export { createRouter, Router } from './router';
|
|
18
|
-
export {
|
|
17
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
19
18
|
export { RouterProvider, RouterContextProvider } from './RouterProvider';
|
|
20
19
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration';
|
|
21
20
|
export { useBlocker, Block } from './useBlocker';
|
|
@@ -27,7 +26,6 @@ export { useRouter } from './useRouter';
|
|
|
27
26
|
export { useRouterState } from './useRouterState';
|
|
28
27
|
export { useLocation } from './useLocation';
|
|
29
28
|
export { useCanGoBack } from './useCanGoBack';
|
|
30
|
-
export { useLayoutEffect } from './utils';
|
|
31
29
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found';
|
|
32
30
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
33
31
|
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,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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-router",
|
|
3
|
-
"version": "1.162.
|
|
3
|
+
"version": "1.162.6",
|
|
4
4
|
"description": "Modern and scalable routing for Vue applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"jsesc": "^3.0.2",
|
|
64
64
|
"tiny-invariant": "^1.3.3",
|
|
65
65
|
"tiny-warning": "^1.0.3",
|
|
66
|
-
"@tanstack/
|
|
67
|
-
"@tanstack/
|
|
66
|
+
"@tanstack/history": "1.161.4",
|
|
67
|
+
"@tanstack/router-core": "1.162.6"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@testing-library/jest-dom": "^6.6.3",
|
package/src/Matches.tsx
CHANGED
|
@@ -134,13 +134,16 @@ const MatchesInner = Vue.defineComponent({
|
|
|
134
134
|
return Vue.h(CatchBoundary, {
|
|
135
135
|
getResetKey: () => resetKey.value,
|
|
136
136
|
errorComponent: errorComponentFn,
|
|
137
|
-
onCatch:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
onCatch:
|
|
138
|
+
process.env.NODE_ENV !== 'production'
|
|
139
|
+
? (error: Error) => {
|
|
140
|
+
warning(
|
|
141
|
+
false,
|
|
142
|
+
`The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,
|
|
143
|
+
)
|
|
144
|
+
warning(false, error.message || error.toString())
|
|
145
|
+
}
|
|
146
|
+
: undefined,
|
|
144
147
|
children: childElement,
|
|
145
148
|
})
|
|
146
149
|
}
|
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,
|
|
@@ -236,7 +234,6 @@ export {
|
|
|
236
234
|
|
|
237
235
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'
|
|
238
236
|
|
|
239
|
-
export { matchContext } from './matchContext'
|
|
240
237
|
export { Match, Outlet } from './Match'
|
|
241
238
|
|
|
242
239
|
export { useMatch } from './useMatch'
|
|
@@ -274,13 +271,7 @@ export type {
|
|
|
274
271
|
|
|
275
272
|
export { createRouter, Router } from './router'
|
|
276
273
|
|
|
277
|
-
export {
|
|
278
|
-
componentTypes,
|
|
279
|
-
lazyFn,
|
|
280
|
-
SearchParamError,
|
|
281
|
-
PathParamError,
|
|
282
|
-
getInitialRouterState,
|
|
283
|
-
} from '@tanstack/router-core'
|
|
274
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core'
|
|
284
275
|
|
|
285
276
|
export { RouterProvider, RouterContextProvider } from './RouterProvider'
|
|
286
277
|
export type { RouterProps } from './RouterProvider'
|
|
@@ -304,8 +295,6 @@ export { useRouterState } from './useRouterState'
|
|
|
304
295
|
export { useLocation } from './useLocation'
|
|
305
296
|
export { useCanGoBack } from './useCanGoBack'
|
|
306
297
|
|
|
307
|
-
export { useLayoutEffect } from './utils'
|
|
308
|
-
|
|
309
298
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found'
|
|
310
299
|
export { notFound, isNotFound } from '@tanstack/router-core'
|
|
311
300
|
export type { NotFoundError } from '@tanstack/router-core'
|