@tanstack/vue-router 1.168.12 → 1.168.13

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.
Files changed (46) hide show
  1. package/dist/esm/Match.js +2 -2
  2. package/dist/esm/Match.js.map +1 -1
  3. package/dist/esm/Transitioner.js +11 -11
  4. package/dist/esm/Transitioner.js.map +1 -1
  5. package/dist/esm/link.js +1 -1
  6. package/dist/esm/link.js.map +1 -1
  7. package/dist/esm/routerStores.js +7 -7
  8. package/dist/esm/routerStores.js.map +1 -1
  9. package/dist/esm/ssr/RouterClient.js +1 -1
  10. package/dist/esm/ssr/RouterClient.js.map +1 -1
  11. package/dist/esm/ssr/renderRouterToStream.js +2 -2
  12. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  13. package/dist/esm/ssr/renderRouterToString.js +1 -1
  14. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  15. package/dist/esm/useMatch.js +1 -1
  16. package/dist/esm/useMatch.js.map +1 -1
  17. package/dist/esm/useRouterState.js +1 -1
  18. package/dist/esm/useRouterState.js.map +1 -1
  19. package/dist/source/Match.jsx +2 -2
  20. package/dist/source/Match.jsx.map +1 -1
  21. package/dist/source/Transitioner.jsx +11 -11
  22. package/dist/source/Transitioner.jsx.map +1 -1
  23. package/dist/source/link.jsx +1 -1
  24. package/dist/source/link.jsx.map +1 -1
  25. package/dist/source/routerStores.js +7 -7
  26. package/dist/source/routerStores.js.map +1 -1
  27. package/dist/source/ssr/RouterClient.jsx +1 -1
  28. package/dist/source/ssr/RouterClient.jsx.map +1 -1
  29. package/dist/source/ssr/renderRouterToStream.jsx +2 -2
  30. package/dist/source/ssr/renderRouterToStream.jsx.map +1 -1
  31. package/dist/source/ssr/renderRouterToString.jsx +1 -1
  32. package/dist/source/ssr/renderRouterToString.jsx.map +1 -1
  33. package/dist/source/useMatch.jsx +1 -1
  34. package/dist/source/useMatch.jsx.map +1 -1
  35. package/dist/source/useRouterState.jsx +1 -1
  36. package/dist/source/useRouterState.jsx.map +1 -1
  37. package/package.json +2 -2
  38. package/src/Match.tsx +3 -3
  39. package/src/Transitioner.tsx +14 -18
  40. package/src/link.tsx +1 -1
  41. package/src/routerStores.ts +7 -7
  42. package/src/ssr/RouterClient.tsx +1 -1
  43. package/src/ssr/renderRouterToStream.tsx +2 -2
  44. package/src/ssr/renderRouterToString.tsx +1 -1
  45. package/src/useMatch.tsx +1 -1
  46. package/src/useRouterState.tsx +1 -1
package/dist/esm/Match.js CHANGED
@@ -101,7 +101,7 @@ var OnRendered = Vue.defineComponent({
101
101
  if (prevHref === void 0 || prevHref !== currentHref) {
102
102
  router.emit({
103
103
  type: "onRendered",
104
- ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
104
+ ...getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get())
105
105
  });
106
106
  prevHref = currentHref;
107
107
  }
@@ -230,7 +230,7 @@ var Outlet = Vue.defineComponent({
230
230
  const childMatchData = Vue.computed(() => {
231
231
  const childId = childMatchIdMap.value[parentRouteId];
232
232
  if (!childId) return null;
233
- const child = router.stores.activeMatchStoresById.get(childId)?.state;
233
+ const child = router.stores.activeMatchStoresById.get(childId)?.get();
234
234
  if (!child) return null;
235
235
  return {
236
236
  id: child.id,
@@ -1 +1 @@
1
- {"version":3,"file":"Match.js","names":["Vue","createControlledPromise","getLocationChangeInfo","invariant","isNotFound","isRedirect","rootRouteId","isServer","useStore","CatchBoundary","ErrorComponent","ClientOnly","useRouter","CatchNotFound","matchContext","pendingMatchContext","routeIdContext","renderRouteNotFound","ScrollRestoration","Match","defineComponent","name","props","matchId","type","String","required","setup","router","routeId","stores","activeMatchStoresById","get","process","env","NODE_ENV","Error","isChildOfRoot","routesById","parentRoute","id","activeMatch","getMatchStoreByRouteId","value","isPendingMatchRef","pendingRouteIds","Boolean","equal","Object","is","loadedAt","matchData","computed","match","ssr","_displayPending","route","PendingComponent","options","pendingComponent","defaultPendingComponent","pendingElement","h","undefined","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","hasShellComponent","shellComponent","ShellComponent","provide","matchIdRef","actualMatchId","resolvedNoSsr","shouldClientOnly","renderMatchContent","matchInner","MatchInner","content","fallback","default","error","children","getResetKey","console","warn","withScrollRestoration","Fragment","OnRendered","scrollRestoration","filter","length","location","resolvedLocation","state","__TSR_key","prevHref","watch","currentHref","latestLocation","href","emit","immediate","inject","combinedState","matchRouteId","remountFn","remountDeps","defaultRemountDeps","remountKey","loaderDeps","params","_strictParams","search","_strictSearch","JSON","stringify","status","_forcePending","_nonReactive","getMatchPromise","key","getMatch","RouteErrorComponent","reset","invalidate","info","componentStack","pendingMinMs","defaultPendingMinMs","routerMatch","minPendingPromise","setTimeout","resolve","Comp","defaultComponent","Outlet","parentRouteId","parentMatch","v","parentGlobalNotFound","globalNotFound","childMatchIdMap","childMatchIdByRouteId","childMatchData","childId","child","paramsKey","nextMatch"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n invariant,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useStore } from '@tanstack/vue-store'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { ClientOnly } from './ClientOnly'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport {\n matchContext,\n pendingMatchContext,\n routeIdContext,\n} from './matchContext'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { VNode } from 'vue'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = Vue.defineComponent({\n name: 'Match',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Derive routeId from initial props.matchId — stable for this component's\n // lifetime. The routeId never changes for a given route position in the\n // tree, even when matchId changes (loaderDepsHash, etc).\n const routeId = router.stores.activeMatchStoresById.get(\n props.matchId,\n )?.routeId\n\n if (!routeId) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find routeId for matchId \"${props.matchId}\". Please file an issue!`,\n )\n }\n\n invariant()\n }\n\n // Static route-tree check: is this route a direct child of the root?\n // parentRoute is set at build time, so no reactive tracking needed.\n const isChildOfRoot =\n (router.routesById[routeId] as AnyRoute)?.parentRoute?.id === rootRouteId\n\n // Single stable store subscription — getMatchStoreByRouteId returns a\n // cached computed store that resolves routeId → current match state\n // through the signal graph. No bridge needed.\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n const isPendingMatchRef = useStore(\n router.stores.pendingRouteIds,\n (pendingRouteIds) => Boolean(pendingRouteIds[routeId]),\n { equal: Object.is },\n )\n const loadedAt = useStore(router.stores.loadedAt, (value) => value)\n\n const matchData = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n return null\n }\n\n return {\n matchId: match.id,\n routeId,\n loadedAt: loadedAt.value,\n ssr: match.ssr,\n _displayPending: match._displayPending,\n }\n })\n\n const route = Vue.computed(() =>\n matchData.value ? router.routesById[matchData.value.routeId] : null,\n )\n\n const PendingComponent = Vue.computed(\n () =>\n route.value?.options?.pendingComponent ??\n router?.options?.defaultPendingComponent,\n )\n\n const pendingElement = Vue.computed(() =>\n PendingComponent.value ? Vue.h(PendingComponent.value) : undefined,\n )\n\n const routeErrorComponent = Vue.computed(\n () =>\n route.value?.options?.errorComponent ??\n router?.options?.defaultErrorComponent,\n )\n\n const routeOnCatch = Vue.computed(\n () => route.value?.options?.onCatch ?? router?.options?.defaultOnCatch,\n )\n\n const routeNotFoundComponent = Vue.computed(() =>\n route.value?.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.value?.options?.notFoundComponent ??\n router?.options?.notFoundRoute?.options?.component)\n : route.value?.options?.notFoundComponent,\n )\n\n const hasShellComponent = Vue.computed(() => {\n if (!route.value?.isRoot) return false\n return !!(route.value.options as RootRouteOptions).shellComponent\n })\n\n const ShellComponent = Vue.computed(() =>\n hasShellComponent.value\n ? ((route.value!.options as RootRouteOptions).shellComponent as any)\n : null,\n )\n\n // Provide routeId context (stable string) for children.\n // MatchInner, Outlet, and useMatch all consume this.\n Vue.provide(routeIdContext, routeId)\n\n // Provide reactive nearest-match context for hooks that slice the active\n // matches array relative to the current match.\n const matchIdRef = Vue.computed(\n () => activeMatch.value?.id ?? props.matchId,\n )\n Vue.provide(matchContext, matchIdRef)\n\n Vue.provide(pendingMatchContext, isPendingMatchRef)\n\n return (): VNode => {\n const actualMatchId = matchData.value?.matchId ?? props.matchId\n\n const resolvedNoSsr =\n matchData.value?.ssr === false || matchData.value?.ssr === 'data-only'\n const shouldClientOnly =\n resolvedNoSsr || !!matchData.value?._displayPending\n\n const renderMatchContent = (): VNode => {\n const matchInner = Vue.h(MatchInner, { matchId: actualMatchId })\n\n let content: VNode = shouldClientOnly\n ? Vue.h(\n ClientOnly,\n {\n fallback: pendingElement.value,\n },\n {\n default: () => matchInner,\n },\n )\n : matchInner\n\n // Wrap in NotFound boundary if needed\n if (routeNotFoundComponent.value) {\n content = Vue.h(CatchNotFound, {\n fallback: (error: any) => {\n error.routeId ??= matchData.value?.routeId as any\n\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent.value ||\n (error.routeId && error.routeId !== matchData.value?.routeId) ||\n (!error.routeId && route.value && !route.value.isRoot)\n )\n throw error\n\n return Vue.h(routeNotFoundComponent.value, error)\n },\n children: content,\n })\n }\n\n // Wrap in error boundary if needed\n if (routeErrorComponent.value) {\n content = CatchBoundary({\n getResetKey: () => matchData.value?.loadedAt ?? 0,\n errorComponent: routeErrorComponent.value || ErrorComponent,\n onCatch: (error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= matchData.value?.routeId as any\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${actualMatchId}`)\n }\n routeOnCatch.value?.(error)\n },\n children: content,\n })\n }\n\n // Add scroll restoration if needed\n const withScrollRestoration: Array<VNode> = [\n content,\n isChildOfRoot\n ? Vue.h(Vue.Fragment, null, [\n Vue.h(OnRendered),\n router.options.scrollRestoration &&\n (isServer ?? router.isServer)\n ? Vue.h(ScrollRestoration)\n : null,\n ])\n : null,\n ].filter(Boolean) as Array<VNode>\n\n // Return single child directly to avoid Fragment wrapper that causes hydration mismatch\n if (withScrollRestoration.length === 1) {\n return withScrollRestoration[0]!\n }\n\n return Vue.h(Vue.Fragment, null, withScrollRestoration)\n }\n\n if (!hasShellComponent.value) {\n return renderMatchContent()\n }\n\n return Vue.h(ShellComponent.value, null, {\n // Important: return a fresh VNode on each slot invocation so that shell\n // components can re-render without reusing a cached VNode instance.\n default: () => renderMatchContent(),\n })\n }\n },\n})\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nconst OnRendered = Vue.defineComponent({\n name: 'OnRendered',\n setup() {\n const router = useRouter()\n\n const location = useStore(\n router.stores.resolvedLocation,\n (resolvedLocation) => resolvedLocation?.state.__TSR_key,\n )\n\n let prevHref: string | undefined\n\n Vue.watch(\n location,\n () => {\n if (location.value) {\n const currentHref = router.latestLocation.href\n if (prevHref === undefined || prevHref !== currentHref) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n prevHref = currentHref\n }\n }\n },\n { immediate: true },\n )\n\n return () => null\n },\n})\n\nexport const MatchInner = Vue.defineComponent({\n name: 'MatchInner',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Use routeId from context (provided by parent Match) — stable string.\n const routeId = Vue.inject(routeIdContext)!\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n\n // Combined selector for match state AND remount key\n // This ensures both are computed in the same selector call with consistent data\n const combinedState = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n // Route no longer exists - truly navigating away\n return null\n }\n\n const matchRouteId = match.routeId as string\n\n // Compute remount key\n const remountFn =\n (router.routesById[matchRouteId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n\n let remountKey: string | undefined\n if (remountFn) {\n const remountDeps = remountFn({\n routeId: matchRouteId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n remountKey = remountDeps ? JSON.stringify(remountDeps) : undefined\n }\n\n return {\n routeId: matchRouteId,\n match: {\n id: match.id,\n status: match.status,\n error: match.error,\n ssr: match.ssr,\n _forcePending: match._forcePending,\n _displayPending: match._displayPending,\n _nonReactive: match._nonReactive,\n },\n remountKey,\n }\n })\n\n const route = Vue.computed(() => {\n if (!combinedState.value) return null\n return router.routesById[combinedState.value.routeId]!\n })\n\n const match = Vue.computed(() => combinedState.value?.match)\n const remountKey = Vue.computed(() => combinedState.value?.remountKey)\n\n const getMatchPromise = (\n match: {\n id: string\n _nonReactive: {\n displayPendingPromise?: Promise<void>\n minPendingPromise?: Promise<void>\n loadPromise?: Promise<void>\n }\n },\n key: 'displayPendingPromise' | 'minPendingPromise' | 'loadPromise',\n ) => {\n return (\n router.getMatch(match.id)?._nonReactive[key] ?? match._nonReactive[key]\n )\n }\n\n return (): VNode | null => {\n // If match doesn't exist, return null (component is being unmounted or not ready)\n if (!combinedState.value || !match.value || !route.value) return null\n\n // Handle different match statuses\n if (match.value._displayPending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value._forcePending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value.status === 'notFound') {\n if (!isNotFound(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a notFound error')\n }\n\n invariant()\n }\n return renderRouteNotFound(router, route.value, match.value.error)\n }\n\n if (match.value.status === 'redirected') {\n if (!isRedirect(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a redirect error')\n }\n\n invariant()\n }\n throw getMatchPromise(match.value, 'loadPromise')\n }\n\n if (match.value.status === 'error') {\n // Check if this route or any parent has an error component\n const RouteErrorComponent =\n route.value.options.errorComponent ??\n router.options.defaultErrorComponent\n\n // If this route has an error component, render it directly\n // This is more reliable than relying on Vue's error boundary\n if (RouteErrorComponent) {\n return Vue.h(RouteErrorComponent, {\n error: match.value.error,\n reset: () => {\n router.invalidate()\n },\n info: {\n componentStack: '',\n },\n })\n }\n\n // If there's no error component for this route, throw the error\n // so it can bubble up to the nearest parent with an error component\n throw match.value.error\n }\n\n if (match.value.status === 'pending') {\n const pendingMinMs =\n route.value.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n const routerMatch = router.getMatch(match.value.id)\n if (\n pendingMinMs &&\n routerMatch &&\n !routerMatch._nonReactive.minPendingPromise\n ) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n\n // In Vue, we render the pending component directly instead of throwing a promise\n // because Vue's Suspense doesn't catch thrown promises like React does\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n if (PendingComponent) {\n return Vue.h(PendingComponent)\n }\n\n // If no pending component, return null while loading\n return null\n }\n\n // Success status - render the component with remount key\n const Comp =\n route.value.options.component ?? router.options.defaultComponent\n const key = remountKey.value\n\n if (Comp) {\n // Pass key as a prop - Vue.h properly handles 'key' as a special prop\n return Vue.h(Comp, key !== undefined ? { key } : undefined)\n }\n\n return Vue.h(Outlet, key !== undefined ? { key } : undefined)\n }\n },\n})\n\nexport const Outlet = Vue.defineComponent({\n name: 'Outlet',\n setup() {\n const router = useRouter()\n const parentRouteId = Vue.inject(routeIdContext)\n\n if (!parentRouteId) {\n return (): VNode | null => null\n }\n\n // Parent state via stable routeId store — single subscription\n const parentMatch = useStore(\n router.stores.getMatchStoreByRouteId(parentRouteId),\n (v) => v,\n )\n\n const route = Vue.computed(() =>\n parentMatch.value\n ? router.routesById[parentMatch.value.routeId as string]!\n : undefined,\n )\n\n const parentGlobalNotFound = Vue.computed(\n () => parentMatch.value?.globalNotFound ?? false,\n )\n\n // Child match lookup: read the child matchId from the shared derived\n // map (one reactive node for the whole tree), then grab match state\n // directly from the pool.\n const childMatchIdMap = useStore(\n router.stores.childMatchIdByRouteId,\n (v) => v,\n )\n\n const childMatchData = Vue.computed(() => {\n const childId = childMatchIdMap.value[parentRouteId]\n if (!childId) return null\n const child = router.stores.activeMatchStoresById.get(childId)?.state\n if (!child) return null\n\n return {\n id: child.id,\n // Key based on routeId + params only (not loaderDeps)\n // This ensures component recreates when params change,\n // but NOT when only loaderDeps change\n paramsKey: child.routeId + JSON.stringify(child._strictParams),\n }\n })\n\n return (): VNode | null => {\n if (parentGlobalNotFound.value) {\n if (!route.value) {\n return null\n }\n return renderRouteNotFound(router, route.value, undefined)\n }\n\n if (!childMatchData.value) {\n return null\n }\n\n const nextMatch = Vue.h(Match, {\n matchId: childMatchData.value.id,\n key: childMatchData.value.paramsKey,\n })\n\n // Note: We intentionally do NOT wrap in Suspense here.\n // The top-level Suspense in Matches already covers the root.\n // The old code compared matchId (e.g. \"__root__/\") with rootRouteId (\"__root__\")\n // which never matched, so this Suspense was effectively dead code.\n // With routeId-based lookup, parentRouteId === rootRouteId would match,\n // causing a double-Suspense that corrupts Vue's DOM during updates.\n return nextMatch\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAamB,QAAQnB,IAAIoB,gBAAgB;CACvCC,MAAM;CACNC,OAAO,EACLC,SAAS;EACPC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,SAAShB,WAAW;EAK1B,MAAMiB,UAAUD,OAAOE,OAAOC,sBAAsBC,IAClDV,MAAMC,QACP,EAAEM;AAEH,MAAI,CAACA,SAAS;AACZ,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAIO,MACR,yDAAyDd,MAAMC,QAAO,0BACvE;AAGHpB,cAAW;;EAKb,MAAMkC,gBACHT,OAAOU,WAAWT,UAAuBU,aAAaC,OAAOlC;EAKhE,MAAMmC,cAAcjC,SAClBoB,OAAOE,OAAOY,uBAAuBb,QAAQ,GAC5Cc,UAAUA,MACZ;EACD,MAAMC,oBAAoBpC,SACxBoB,OAAOE,OAAOe,kBACbA,oBAAoBC,QAAQD,gBAAgBhB,SAAS,EACtD,EAAEkB,OAAOC,OAAOC,IAClB,CAAC;EACD,MAAMC,WAAW1C,SAASoB,OAAOE,OAAOoB,WAAWP,UAAUA,MAAM;EAEnE,MAAMQ,YAAYnD,IAAIoD,eAAe;GACnC,MAAMC,QAAQZ,YAAYE;AAC1B,OAAI,CAACU,MACH,QAAO;AAGT,UAAO;IACL9B,SAAS8B,MAAMb;IACfX;IACAqB,UAAUA,SAASP;IACnBW,KAAKD,MAAMC;IACXC,iBAAiBF,MAAME;IACxB;IACD;EAEF,MAAMC,QAAQxD,IAAIoD,eAChBD,UAAUR,QAAQf,OAAOU,WAAWa,UAAUR,MAAMd,WAAW,KAChE;EAED,MAAM4B,mBAAmBzD,IAAIoD,eAEzBI,MAAMb,OAAOe,SAASC,oBACtB/B,Q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qBzG,OAAO;AAC9B,QAAI,CAACa,MAAMb,MACT,QAAO;AAET,WAAO1B,oBAAoBW,QAAQ4B,MAAMb,OAAOoB,KAAAA,EAAU;;AAG5D,OAAI,CAACyF,eAAe7G,MAClB,QAAO;AAcT,UAXkB3C,IAAI8D,EAAE3C,OAAO;IAC7BI,SAASiI,eAAe7G,MAAMH;IAC9ByF,KAAKuB,eAAe7G,MAAMgH;IAC3B,CAAC;;;CAWP,CAAC"}
1
+ {"version":3,"file":"Match.js","names":["Vue","createControlledPromise","getLocationChangeInfo","invariant","isNotFound","isRedirect","rootRouteId","isServer","useStore","CatchBoundary","ErrorComponent","ClientOnly","useRouter","CatchNotFound","matchContext","pendingMatchContext","routeIdContext","renderRouteNotFound","ScrollRestoration","Match","defineComponent","name","props","matchId","type","String","required","setup","router","routeId","stores","activeMatchStoresById","get","process","env","NODE_ENV","Error","isChildOfRoot","routesById","parentRoute","id","activeMatch","getMatchStoreByRouteId","value","isPendingMatchRef","pendingRouteIds","Boolean","equal","Object","is","loadedAt","matchData","computed","match","ssr","_displayPending","route","PendingComponent","options","pendingComponent","defaultPendingComponent","pendingElement","h","undefined","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","hasShellComponent","shellComponent","ShellComponent","provide","matchIdRef","actualMatchId","resolvedNoSsr","shouldClientOnly","renderMatchContent","matchInner","MatchInner","content","fallback","default","error","children","getResetKey","console","warn","withScrollRestoration","Fragment","OnRendered","scrollRestoration","filter","length","location","resolvedLocation","state","__TSR_key","prevHref","watch","currentHref","latestLocation","href","emit","immediate","inject","combinedState","matchRouteId","remountFn","remountDeps","defaultRemountDeps","remountKey","loaderDeps","params","_strictParams","search","_strictSearch","JSON","stringify","status","_forcePending","_nonReactive","getMatchPromise","key","getMatch","RouteErrorComponent","reset","invalidate","info","componentStack","pendingMinMs","defaultPendingMinMs","routerMatch","minPendingPromise","setTimeout","resolve","Comp","defaultComponent","Outlet","parentRouteId","parentMatch","v","parentGlobalNotFound","globalNotFound","childMatchIdMap","childMatchIdByRouteId","childMatchData","childId","child","paramsKey","nextMatch"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n invariant,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useStore } from '@tanstack/vue-store'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { ClientOnly } from './ClientOnly'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport {\n matchContext,\n pendingMatchContext,\n routeIdContext,\n} from './matchContext'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { VNode } from 'vue'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = Vue.defineComponent({\n name: 'Match',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Derive routeId from initial props.matchId — stable for this component's\n // lifetime. The routeId never changes for a given route position in the\n // tree, even when matchId changes (loaderDepsHash, etc).\n const routeId = router.stores.activeMatchStoresById.get(\n props.matchId,\n )?.routeId\n\n if (!routeId) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find routeId for matchId \"${props.matchId}\". Please file an issue!`,\n )\n }\n\n invariant()\n }\n\n // Static route-tree check: is this route a direct child of the root?\n // parentRoute is set at build time, so no reactive tracking needed.\n const isChildOfRoot =\n (router.routesById[routeId] as AnyRoute)?.parentRoute?.id === rootRouteId\n\n // Single stable store subscription — getMatchStoreByRouteId returns a\n // cached computed store that resolves routeId → current match state\n // through the signal graph. No bridge needed.\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n const isPendingMatchRef = useStore(\n router.stores.pendingRouteIds,\n (pendingRouteIds) => Boolean(pendingRouteIds[routeId]),\n { equal: Object.is },\n )\n const loadedAt = useStore(router.stores.loadedAt, (value) => value)\n\n const matchData = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n return null\n }\n\n return {\n matchId: match.id,\n routeId,\n loadedAt: loadedAt.value,\n ssr: match.ssr,\n _displayPending: match._displayPending,\n }\n })\n\n const route = Vue.computed(() =>\n matchData.value ? router.routesById[matchData.value.routeId] : null,\n )\n\n const PendingComponent = Vue.computed(\n () =>\n route.value?.options?.pendingComponent ??\n router?.options?.defaultPendingComponent,\n )\n\n const pendingElement = Vue.computed(() =>\n PendingComponent.value ? Vue.h(PendingComponent.value) : undefined,\n )\n\n const routeErrorComponent = Vue.computed(\n () =>\n route.value?.options?.errorComponent ??\n router?.options?.defaultErrorComponent,\n )\n\n const routeOnCatch = Vue.computed(\n () => route.value?.options?.onCatch ?? router?.options?.defaultOnCatch,\n )\n\n const routeNotFoundComponent = Vue.computed(() =>\n route.value?.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.value?.options?.notFoundComponent ??\n router?.options?.notFoundRoute?.options?.component)\n : route.value?.options?.notFoundComponent,\n )\n\n const hasShellComponent = Vue.computed(() => {\n if (!route.value?.isRoot) return false\n return !!(route.value.options as RootRouteOptions).shellComponent\n })\n\n const ShellComponent = Vue.computed(() =>\n hasShellComponent.value\n ? ((route.value!.options as RootRouteOptions).shellComponent as any)\n : null,\n )\n\n // Provide routeId context (stable string) for children.\n // MatchInner, Outlet, and useMatch all consume this.\n Vue.provide(routeIdContext, routeId)\n\n // Provide reactive nearest-match context for hooks that slice the active\n // matches array relative to the current match.\n const matchIdRef = Vue.computed(\n () => activeMatch.value?.id ?? props.matchId,\n )\n Vue.provide(matchContext, matchIdRef)\n\n Vue.provide(pendingMatchContext, isPendingMatchRef)\n\n return (): VNode => {\n const actualMatchId = matchData.value?.matchId ?? props.matchId\n\n const resolvedNoSsr =\n matchData.value?.ssr === false || matchData.value?.ssr === 'data-only'\n const shouldClientOnly =\n resolvedNoSsr || !!matchData.value?._displayPending\n\n const renderMatchContent = (): VNode => {\n const matchInner = Vue.h(MatchInner, { matchId: actualMatchId })\n\n let content: VNode = shouldClientOnly\n ? Vue.h(\n ClientOnly,\n {\n fallback: pendingElement.value,\n },\n {\n default: () => matchInner,\n },\n )\n : matchInner\n\n // Wrap in NotFound boundary if needed\n if (routeNotFoundComponent.value) {\n content = Vue.h(CatchNotFound, {\n fallback: (error: any) => {\n error.routeId ??= matchData.value?.routeId as any\n\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent.value ||\n (error.routeId && error.routeId !== matchData.value?.routeId) ||\n (!error.routeId && route.value && !route.value.isRoot)\n )\n throw error\n\n return Vue.h(routeNotFoundComponent.value, error)\n },\n children: content,\n })\n }\n\n // Wrap in error boundary if needed\n if (routeErrorComponent.value) {\n content = CatchBoundary({\n getResetKey: () => matchData.value?.loadedAt ?? 0,\n errorComponent: routeErrorComponent.value || ErrorComponent,\n onCatch: (error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= matchData.value?.routeId as any\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${actualMatchId}`)\n }\n routeOnCatch.value?.(error)\n },\n children: content,\n })\n }\n\n // Add scroll restoration if needed\n const withScrollRestoration: Array<VNode> = [\n content,\n isChildOfRoot\n ? Vue.h(Vue.Fragment, null, [\n Vue.h(OnRendered),\n router.options.scrollRestoration &&\n (isServer ?? router.isServer)\n ? Vue.h(ScrollRestoration)\n : null,\n ])\n : null,\n ].filter(Boolean) as Array<VNode>\n\n // Return single child directly to avoid Fragment wrapper that causes hydration mismatch\n if (withScrollRestoration.length === 1) {\n return withScrollRestoration[0]!\n }\n\n return Vue.h(Vue.Fragment, null, withScrollRestoration)\n }\n\n if (!hasShellComponent.value) {\n return renderMatchContent()\n }\n\n return Vue.h(ShellComponent.value, null, {\n // Important: return a fresh VNode on each slot invocation so that shell\n // components can re-render without reusing a cached VNode instance.\n default: () => renderMatchContent(),\n })\n }\n },\n})\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nconst OnRendered = Vue.defineComponent({\n name: 'OnRendered',\n setup() {\n const router = useRouter()\n\n const location = useStore(\n router.stores.resolvedLocation,\n (resolvedLocation) => resolvedLocation?.state.__TSR_key,\n )\n\n let prevHref: string | undefined\n\n Vue.watch(\n location,\n () => {\n if (location.value) {\n const currentHref = router.latestLocation.href\n if (prevHref === undefined || prevHref !== currentHref) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n ),\n })\n prevHref = currentHref\n }\n }\n },\n { immediate: true },\n )\n\n return () => null\n },\n})\n\nexport const MatchInner = Vue.defineComponent({\n name: 'MatchInner',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Use routeId from context (provided by parent Match) — stable string.\n const routeId = Vue.inject(routeIdContext)!\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n\n // Combined selector for match state AND remount key\n // This ensures both are computed in the same selector call with consistent data\n const combinedState = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n // Route no longer exists - truly navigating away\n return null\n }\n\n const matchRouteId = match.routeId as string\n\n // Compute remount key\n const remountFn =\n (router.routesById[matchRouteId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n\n let remountKey: string | undefined\n if (remountFn) {\n const remountDeps = remountFn({\n routeId: matchRouteId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n remountKey = remountDeps ? JSON.stringify(remountDeps) : undefined\n }\n\n return {\n routeId: matchRouteId,\n match: {\n id: match.id,\n status: match.status,\n error: match.error,\n ssr: match.ssr,\n _forcePending: match._forcePending,\n _displayPending: match._displayPending,\n _nonReactive: match._nonReactive,\n },\n remountKey,\n }\n })\n\n const route = Vue.computed(() => {\n if (!combinedState.value) return null\n return router.routesById[combinedState.value.routeId]!\n })\n\n const match = Vue.computed(() => combinedState.value?.match)\n const remountKey = Vue.computed(() => combinedState.value?.remountKey)\n\n const getMatchPromise = (\n match: {\n id: string\n _nonReactive: {\n displayPendingPromise?: Promise<void>\n minPendingPromise?: Promise<void>\n loadPromise?: Promise<void>\n }\n },\n key: 'displayPendingPromise' | 'minPendingPromise' | 'loadPromise',\n ) => {\n return (\n router.getMatch(match.id)?._nonReactive[key] ?? match._nonReactive[key]\n )\n }\n\n return (): VNode | null => {\n // If match doesn't exist, return null (component is being unmounted or not ready)\n if (!combinedState.value || !match.value || !route.value) return null\n\n // Handle different match statuses\n if (match.value._displayPending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value._forcePending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value.status === 'notFound') {\n if (!isNotFound(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a notFound error')\n }\n\n invariant()\n }\n return renderRouteNotFound(router, route.value, match.value.error)\n }\n\n if (match.value.status === 'redirected') {\n if (!isRedirect(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a redirect error')\n }\n\n invariant()\n }\n throw getMatchPromise(match.value, 'loadPromise')\n }\n\n if (match.value.status === 'error') {\n // Check if this route or any parent has an error component\n const RouteErrorComponent =\n route.value.options.errorComponent ??\n router.options.defaultErrorComponent\n\n // If this route has an error component, render it directly\n // This is more reliable than relying on Vue's error boundary\n if (RouteErrorComponent) {\n return Vue.h(RouteErrorComponent, {\n error: match.value.error,\n reset: () => {\n router.invalidate()\n },\n info: {\n componentStack: '',\n },\n })\n }\n\n // If there's no error component for this route, throw the error\n // so it can bubble up to the nearest parent with an error component\n throw match.value.error\n }\n\n if (match.value.status === 'pending') {\n const pendingMinMs =\n route.value.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n const routerMatch = router.getMatch(match.value.id)\n if (\n pendingMinMs &&\n routerMatch &&\n !routerMatch._nonReactive.minPendingPromise\n ) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n\n // In Vue, we render the pending component directly instead of throwing a promise\n // because Vue's Suspense doesn't catch thrown promises like React does\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n if (PendingComponent) {\n return Vue.h(PendingComponent)\n }\n\n // If no pending component, return null while loading\n return null\n }\n\n // Success status - render the component with remount key\n const Comp =\n route.value.options.component ?? router.options.defaultComponent\n const key = remountKey.value\n\n if (Comp) {\n // Pass key as a prop - Vue.h properly handles 'key' as a special prop\n return Vue.h(Comp, key !== undefined ? { key } : undefined)\n }\n\n return Vue.h(Outlet, key !== undefined ? { key } : undefined)\n }\n },\n})\n\nexport const Outlet = Vue.defineComponent({\n name: 'Outlet',\n setup() {\n const router = useRouter()\n const parentRouteId = Vue.inject(routeIdContext)\n\n if (!parentRouteId) {\n return (): VNode | null => null\n }\n\n // Parent state via stable routeId store — single subscription\n const parentMatch = useStore(\n router.stores.getMatchStoreByRouteId(parentRouteId),\n (v) => v,\n )\n\n const route = Vue.computed(() =>\n parentMatch.value\n ? router.routesById[parentMatch.value.routeId as string]!\n : undefined,\n )\n\n const parentGlobalNotFound = Vue.computed(\n () => parentMatch.value?.globalNotFound ?? false,\n )\n\n // Child match lookup: read the child matchId from the shared derived\n // map (one reactive node for the whole tree), then grab match state\n // directly from the pool.\n const childMatchIdMap = useStore(\n router.stores.childMatchIdByRouteId,\n (v) => v,\n )\n\n const childMatchData = Vue.computed(() => {\n const childId = childMatchIdMap.value[parentRouteId]\n if (!childId) return null\n const child = router.stores.activeMatchStoresById.get(childId)?.get()\n if (!child) return null\n\n return {\n id: child.id,\n // Key based on routeId + params only (not loaderDeps)\n // This ensures component recreates when params change,\n // but NOT when only loaderDeps change\n paramsKey: child.routeId + JSON.stringify(child._strictParams),\n }\n })\n\n return (): VNode | null => {\n if (parentGlobalNotFound.value) {\n if (!route.value) {\n return null\n }\n return renderRouteNotFound(router, route.value, undefined)\n }\n\n if (!childMatchData.value) {\n return null\n }\n\n const nextMatch = Vue.h(Match, {\n matchId: childMatchData.value.id,\n key: childMatchData.value.paramsKey,\n })\n\n // Note: We intentionally do NOT wrap in Suspense here.\n // The top-level Suspense in Matches already covers the root.\n // The old code compared matchId (e.g. \"__root__/\") with rootRouteId (\"__root__\")\n // which never matched, so this Suspense was effectively dead code.\n // With routeId-based lookup, parentRouteId === rootRouteId would match,\n // causing a double-Suspense that corrupts Vue's DOM during updates.\n return nextMatch\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAamB,QAAQnB,IAAIoB,gBAAgB;CACvCC,MAAM;CACNC,OAAO,EACLC,SAAS;EACPC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,SAAShB,WAAW;EAK1B,MAAMiB,UAAUD,OAAOE,OAAOC,sBAAsBC,IAClDV,MAAMC,QACP,EAAEM;AAEH,MAAI,CAACA,SAAS;AACZ,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAIO,MACR,yDAAyDd,MAAMC,QAAO,0BACvE;AAGHpB,cAAW;;EAK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/F,eAAe;AAEhD,MAAI,CAACiI,cACH,cAA2B;EAI7B,MAAMC,cAAc1I,SAClBoB,OAAOE,OAAOY,uBAAuBuG,cAAc,GAClDE,MAAMA,EACR;EAED,MAAM3F,QAAQxD,IAAIoD,eAChB8F,YAAYvG,QACRf,OAAOU,WAAW4G,YAAYvG,MAAMd,WACpCkC,KAAAA,EACL;EAED,MAAMqF,uBAAuBpJ,IAAIoD,eACzB8F,YAAYvG,OAAO0G,kBAAkB,MAC5C;EAKD,MAAMC,kBAAkB9I,SACtBoB,OAAOE,OAAOyH,wBACbJ,MAAMA,EACR;EAED,MAAMK,iBAAiBxJ,IAAIoD,eAAe;GACxC,MAAMqG,UAAUH,gBAAgB3G,MAAMsG;AACtC,OAAI,CAACQ,QAAS,QAAO;GACrB,MAAMC,QAAQ9H,OAAOE,OAAOC,sBAAsBC,IAAIyH,QAAQ,EAAEzH,KAAK;AACrE,OAAI,CAAC0H,MAAO,QAAO;AAEnB,UAAO;IACLlH,IAAIkH,MAAMlH;IAIVmH,WAAWD,MAAM7H,UAAU8F,KAAKC,UAAU8B,MAAMlC,cAAa;IAC9D;IACD;AAEF,eAA2B;AACzB,OAAI4B,qBAAqBzG,OAAO;AAC9B,QAAI,CAACa,MAAMb,MACT,QAAO;AAET,WAAO1B,oBAAoBW,QAAQ4B,MAAMb,OAAOoB,KAAAA,EAAU;;AAG5D,OAAI,CAACyF,eAAe7G,MAClB,QAAO;AAcT,UAXkB3C,IAAI8D,EAAE3C,OAAO;IAC7BI,SAASiI,eAAe7G,MAAMH;IAC9ByF,KAAKuB,eAAe7G,MAAMgH;IAC3B,CAAC;;;CAWP,CAAC"}
@@ -33,13 +33,13 @@ function useTransitionerSetup() {
33
33
  router.startTransition = (fn) => {
34
34
  isTransitioning.value = true;
35
35
  try {
36
- router.stores.isTransitioning.setState(() => true);
36
+ router.stores.isTransitioning.set(true);
37
37
  } catch {}
38
38
  const endTransition = () => {
39
39
  Vue.nextTick(() => {
40
40
  try {
41
41
  isTransitioning.value = false;
42
- router.stores.isTransitioning.setState(() => false);
42
+ router.stores.isTransitioning.set(false);
43
43
  } catch {}
44
44
  });
45
45
  };
@@ -74,9 +74,9 @@ function useTransitionerSetup() {
74
74
  Vue.onMounted(() => {
75
75
  isMounted.value = true;
76
76
  if (!isAnyPending.value) {
77
- if (router.stores.status.state === "pending") batch(() => {
78
- router.stores.status.setState(() => "idle");
79
- router.stores.resolvedLocation.setState(() => router.stores.location.state);
77
+ if (router.stores.status.get() === "pending") batch(() => {
78
+ router.stores.status.set("idle");
79
+ router.stores.resolvedLocation.set(router.stores.location.get());
80
80
  });
81
81
  }
82
82
  });
@@ -104,7 +104,7 @@ function useTransitionerSetup() {
104
104
  try {
105
105
  if (previousIsLoading.value.previous && !newValue) router.emit({
106
106
  type: "onLoad",
107
- ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
107
+ ...getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get())
108
108
  });
109
109
  } catch {}
110
110
  });
@@ -113,19 +113,19 @@ function useTransitionerSetup() {
113
113
  try {
114
114
  if (previousIsPagePending.value.previous && !newValue) router.emit({
115
115
  type: "onBeforeRouteMount",
116
- ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
116
+ ...getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get())
117
117
  });
118
118
  } catch {}
119
119
  });
120
120
  Vue.watch(isAnyPending, (newValue) => {
121
121
  if (!isMounted.value) return;
122
122
  try {
123
- if (!newValue && router.stores.status.state === "pending") batch(() => {
124
- router.stores.status.setState(() => "idle");
125
- router.stores.resolvedLocation.setState(() => router.stores.location.state);
123
+ if (!newValue && router.stores.status.get() === "pending") batch(() => {
124
+ router.stores.status.set("idle");
125
+ router.stores.resolvedLocation.set(router.stores.location.get());
126
126
  });
127
127
  if (previousIsAnyPending.value.previous && !newValue) {
128
- const changeInfo = getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state);
128
+ const changeInfo = getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get());
129
129
  router.emit({
130
130
  type: "onResolved",
131
131
  ...changeInfo
@@ -1 +1 @@
1
- {"version":3,"file":"Transitioner.js","names":["Vue","getLocationChangeInfo","handleHashScroll","trimPathRight","isServer","batch","useStore","useRouter","usePrevious","mountLoadForRouter","router","mounted","useTransitionerSetup","isLoading","stores","value","isTransitioning","ref","hasPendingMatches","previousIsLoading","isAnyPending","computed","previousIsAnyPending","isPagePending","previousIsPagePending","startTransition","fn","setState","endTransition","nextTick","originalStartViewTransition","__tsrOriginalStartViewTransition","startViewTransition","unsubscribe","onMounted","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","publicHref","commitLocation","replace","isMounted","status","resolvedLocation","location","onUnmounted","window","ssr","tryLoad","err","console","error","watch","newValue","previous","emit","type","changeInfo","hrefChanged","Transitioner","defineComponent","name","setup"],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { batch, useStore } from '@tanstack/vue-store'\nimport { useRouter } from './useRouter'\nimport { usePrevious } from './utils'\n\n// Track mount state per router to avoid double-loading\nlet mountLoadForRouter = { router: null as any, mounted: false }\n\n/**\n * Composable that sets up router transition logic.\n * This is called from MatchesContent to set up:\n * - router.startTransition\n * - router.startViewTransition\n * - History subscription\n * - Router event watchers\n *\n * Must be called during component setup phase.\n */\nexport function useTransitionerSetup() {\n const router = useRouter()\n\n // Skip on server - no transitions needed\n if (isServer ?? router.isServer) {\n return\n }\n\n const isLoading = useStore(router.stores.isLoading, (value) => value)\n\n // Track if we're in a transition - using a ref to track async transitions\n const isTransitioning = Vue.ref(false)\n\n // Track pending state changes\n const hasPendingMatches = useStore(\n router.stores.hasPendingMatches,\n (value) => value,\n )\n\n const previousIsLoading = usePrevious(() => isLoading.value)\n\n const isAnyPending = Vue.computed(\n () => isLoading.value || isTransitioning.value || hasPendingMatches.value,\n )\n const previousIsAnyPending = usePrevious(() => isAnyPending.value)\n\n const isPagePending = Vue.computed(\n () => isLoading.value || hasPendingMatches.value,\n )\n const previousIsPagePending = usePrevious(() => isPagePending.value)\n\n // Implement startTransition similar to React/Solid\n // Vue doesn't have a native useTransition like React 18, so we simulate it\n // We also update the router state's isTransitioning flag so useMatch can check it\n router.startTransition = (fn: () => void | Promise<void>) => {\n isTransitioning.value = true\n // Also update the router state so useMatch knows we're transitioning\n try {\n router.stores.isTransitioning.setState(() => true)\n } catch {\n // Ignore errors if component is unmounted\n }\n\n // Helper to end the transition\n const endTransition = () => {\n // Use nextTick to ensure Vue has processed all reactive updates\n Vue.nextTick(() => {\n try {\n isTransitioning.value = false\n router.stores.isTransitioning.setState(() => false)\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n }\n\n // Execute the function synchronously\n // The function internally may call startViewTransition which schedules async work\n // via document.startViewTransition, but we don't need to wait for it here\n // because Vue's reactivity will trigger re-renders when state changes\n fn()\n\n // End the transition on next tick to allow Vue to process reactive updates\n endTransition()\n }\n\n // Vue updates DOM asynchronously (next tick). The View Transitions API expects the\n // update callback promise to resolve only after the DOM has been updated.\n // Wrap the router-core implementation to await a Vue flush before resolving.\n const originalStartViewTransition:\n | undefined\n | ((fn: () => Promise<void>) => void) =\n (router as any).__tsrOriginalStartViewTransition ??\n router.startViewTransition\n\n ;(router as any).__tsrOriginalStartViewTransition =\n originalStartViewTransition\n\n router.startViewTransition = (fn: () => Promise<void>) => {\n return originalStartViewTransition?.(async () => {\n await fn()\n await Vue.nextTick()\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n let unsubscribe: (() => void) | undefined\n\n Vue.onMounted(() => {\n unsubscribe = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n })\n\n // Track if component is mounted to prevent updates after unmount\n const isMounted = Vue.ref(false)\n\n Vue.onMounted(() => {\n isMounted.value = true\n if (!isAnyPending.value) {\n if (router.stores.status.state === 'pending') {\n batch(() => {\n router.stores.status.setState(() => 'idle')\n router.stores.resolvedLocation.setState(\n () => router.stores.location.state,\n )\n })\n }\n }\n })\n\n Vue.onUnmounted(() => {\n isMounted.value = false\n if (unsubscribe) {\n unsubscribe()\n }\n })\n\n // Try to load the initial location\n Vue.onMounted(() => {\n if (\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n\n // Setup watchers for emitting events\n // All watchers check isMounted to prevent updates after unmount\n Vue.watch(\n () => isLoading.value,\n (newValue) => {\n if (!isMounted.value) return\n try {\n if (previousIsLoading.value.previous && !newValue) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n },\n )\n\n Vue.watch(isPagePending, (newValue) => {\n if (!isMounted.value) return\n try {\n // emit onBeforeRouteMount\n if (previousIsPagePending.value.previous && !newValue) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n\n Vue.watch(isAnyPending, (newValue) => {\n if (!isMounted.value) return\n try {\n if (!newValue && router.stores.status.state === 'pending') {\n batch(() => {\n router.stores.status.setState(() => 'idle')\n router.stores.resolvedLocation.setState(\n () => router.stores.location.state,\n )\n })\n }\n\n // The router was pending and now it's not\n if (previousIsAnyPending.value.previous && !newValue) {\n const changeInfo = getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n )\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n}\n\n/**\n * @deprecated Use useTransitionerSetup() composable instead.\n * This component is kept for backwards compatibility but the setup logic\n * has been moved to useTransitionerSetup() for better SSR hydration.\n */\nexport const Transitioner = Vue.defineComponent({\n name: 'Transitioner',\n setup() {\n useTransitionerSetup()\n return () => null\n },\n})\n"],"mappings":";;;;;;;AAYA,IAAIS,qBAAqB;CAAEC,QAAQ;CAAaC,SAAS;CAAO;;;;;;;;;;;AAYhE,SAAgBC,uBAAuB;CACrC,MAAMF,SAASH,WAAW;AAG1B,KAAIH,YAAYM,OAAON,SACrB;CAGF,MAAMS,YAAYP,SAASI,OAAOI,OAAOD,YAAYE,UAAUA,MAAM;CAGrE,MAAMC,kBAAkBhB,IAAIiB,IAAI,MAAM;CAGtC,MAAMC,oBAAoBZ,SACxBI,OAAOI,OAAOI,oBACbH,UAAUA,MACZ;CAED,MAAMI,oBAAoBX,kBAAkBK,UAAUE,MAAM;CAE5D,MAAMK,eAAepB,IAAIqB,eACjBR,UAAUE,SAASC,gBAAgBD,SAASG,kBAAkBH,MACrE;CACD,MAAMO,uBAAuBd,kBAAkBY,aAAaL,MAAM;CAElE,MAAMQ,gBAAgBvB,IAAIqB,eAClBR,UAAUE,SAASG,kBAAkBH,MAC5C;CACD,MAAMS,wBAAwBhB,kBAAkBe,cAAcR,MAAM;AAKpEL,QAAOe,mBAAmBC,OAAmC;AAC3DV,kBAAgBD,QAAQ;AAExB,MAAI;AACFL,UAAOI,OAAOE,gBAAgBW,eAAe,KAAK;UAC5C;EAKR,MAAMC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GAGR;;AAQwBV,IAAIsE,gBAAgB;CAC9CC,MAAM;CACNC,QAAQ;AACN5D,wBAAsB;AACtB,eAAa;;CAEhB,CAAC"}
1
+ {"version":3,"file":"Transitioner.js","names":["Vue","getLocationChangeInfo","handleHashScroll","trimPathRight","isServer","batch","useStore","useRouter","usePrevious","mountLoadForRouter","router","mounted","useTransitionerSetup","isLoading","stores","value","isTransitioning","ref","hasPendingMatches","previousIsLoading","isAnyPending","computed","previousIsAnyPending","isPagePending","previousIsPagePending","startTransition","fn","set","endTransition","nextTick","originalStartViewTransition","__tsrOriginalStartViewTransition","startViewTransition","unsubscribe","onMounted","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","publicHref","commitLocation","replace","isMounted","status","get","resolvedLocation","location","onUnmounted","window","ssr","tryLoad","err","console","error","watch","newValue","previous","emit","type","changeInfo","hrefChanged","Transitioner","defineComponent","name","setup"],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { batch, useStore } from '@tanstack/vue-store'\nimport { useRouter } from './useRouter'\nimport { usePrevious } from './utils'\n\n// Track mount state per router to avoid double-loading\nlet mountLoadForRouter = { router: null as any, mounted: false }\n\n/**\n * Composable that sets up router transition logic.\n * This is called from MatchesContent to set up:\n * - router.startTransition\n * - router.startViewTransition\n * - History subscription\n * - Router event watchers\n *\n * Must be called during component setup phase.\n */\nexport function useTransitionerSetup() {\n const router = useRouter()\n\n // Skip on server - no transitions needed\n if (isServer ?? router.isServer) {\n return\n }\n\n const isLoading = useStore(router.stores.isLoading, (value) => value)\n\n // Track if we're in a transition - using a ref to track async transitions\n const isTransitioning = Vue.ref(false)\n\n // Track pending state changes\n const hasPendingMatches = useStore(\n router.stores.hasPendingMatches,\n (value) => value,\n )\n\n const previousIsLoading = usePrevious(() => isLoading.value)\n\n const isAnyPending = Vue.computed(\n () => isLoading.value || isTransitioning.value || hasPendingMatches.value,\n )\n const previousIsAnyPending = usePrevious(() => isAnyPending.value)\n\n const isPagePending = Vue.computed(\n () => isLoading.value || hasPendingMatches.value,\n )\n const previousIsPagePending = usePrevious(() => isPagePending.value)\n\n // Implement startTransition similar to React/Solid\n // Vue doesn't have a native useTransition like React 18, so we simulate it\n // We also update the router state's isTransitioning flag so useMatch can check it\n router.startTransition = (fn: () => void | Promise<void>) => {\n isTransitioning.value = true\n // Also update the router state so useMatch knows we're transitioning\n try {\n router.stores.isTransitioning.set(true)\n } catch {\n // Ignore errors if component is unmounted\n }\n\n // Helper to end the transition\n const endTransition = () => {\n // Use nextTick to ensure Vue has processed all reactive updates\n Vue.nextTick(() => {\n try {\n isTransitioning.value = false\n router.stores.isTransitioning.set(false)\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n }\n\n // Execute the function synchronously\n // The function internally may call startViewTransition which schedules async work\n // via document.startViewTransition, but we don't need to wait for it here\n // because Vue's reactivity will trigger re-renders when state changes\n fn()\n\n // End the transition on next tick to allow Vue to process reactive updates\n endTransition()\n }\n\n // Vue updates DOM asynchronously (next tick). The View Transitions API expects the\n // update callback promise to resolve only after the DOM has been updated.\n // Wrap the router-core implementation to await a Vue flush before resolving.\n const originalStartViewTransition:\n | undefined\n | ((fn: () => Promise<void>) => void) =\n (router as any).__tsrOriginalStartViewTransition ??\n router.startViewTransition\n\n ;(router as any).__tsrOriginalStartViewTransition =\n originalStartViewTransition\n\n router.startViewTransition = (fn: () => Promise<void>) => {\n return originalStartViewTransition?.(async () => {\n await fn()\n await Vue.nextTick()\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n let unsubscribe: (() => void) | undefined\n\n Vue.onMounted(() => {\n unsubscribe = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n })\n\n // Track if component is mounted to prevent updates after unmount\n const isMounted = Vue.ref(false)\n\n Vue.onMounted(() => {\n isMounted.value = true\n if (!isAnyPending.value) {\n if (router.stores.status.get() === 'pending') {\n batch(() => {\n router.stores.status.set('idle')\n router.stores.resolvedLocation.set(router.stores.location.get())\n })\n }\n }\n })\n\n Vue.onUnmounted(() => {\n isMounted.value = false\n if (unsubscribe) {\n unsubscribe()\n }\n })\n\n // Try to load the initial location\n Vue.onMounted(() => {\n if (\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n\n // Setup watchers for emitting events\n // All watchers check isMounted to prevent updates after unmount\n Vue.watch(\n () => isLoading.value,\n (newValue) => {\n if (!isMounted.value) return\n try {\n if (previousIsLoading.value.previous && !newValue) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n ),\n })\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n },\n )\n\n Vue.watch(isPagePending, (newValue) => {\n if (!isMounted.value) return\n try {\n // emit onBeforeRouteMount\n if (previousIsPagePending.value.previous && !newValue) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n ),\n })\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n\n Vue.watch(isAnyPending, (newValue) => {\n if (!isMounted.value) return\n try {\n if (!newValue && router.stores.status.get() === 'pending') {\n batch(() => {\n router.stores.status.set('idle')\n router.stores.resolvedLocation.set(router.stores.location.get())\n })\n }\n\n // The router was pending and now it's not\n if (previousIsAnyPending.value.previous && !newValue) {\n const changeInfo = getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n )\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n } catch {\n // Ignore errors if component is unmounted\n }\n })\n}\n\n/**\n * @deprecated Use useTransitionerSetup() composable instead.\n * This component is kept for backwards compatibility but the setup logic\n * has been moved to useTransitionerSetup() for better SSR hydration.\n */\nexport const Transitioner = Vue.defineComponent({\n name: 'Transitioner',\n setup() {\n useTransitionerSetup()\n return () => null\n },\n})\n"],"mappings":";;;;;;;AAYA,IAAIS,qBAAqB;CAAEC,QAAQ;CAAaC,SAAS;CAAO;;;;;;;;;;;AAYhE,SAAgBC,uBAAuB;CACrC,MAAMF,SAASH,WAAW;AAG1B,KAAIH,YAAYM,OAAON,SACrB;CAGF,MAAMS,YAAYP,SAASI,OAAOI,OAAOD,YAAYE,UAAUA,MAAM;CAGrE,MAAMC,kBAAkBhB,IAAIiB,IAAI,MAAM;CAGtC,MAAMC,oBAAoBZ,SACxBI,OAAOI,OAAOI,oBACbH,UAAUA,MACZ;CAED,MAAMI,oBAAoBX,kBAAkBK,UAAUE,MAAM;CAE5D,MAAMK,eAAepB,IAAIqB,eACjBR,UAAUE,SAASC,gBAAgBD,SAASG,kBAAkBH,MACrE;CACD,MAAMO,uBAAuBd,kBAAkBY,aAAaL,MAAM;CAElE,MAAMQ,gBAAgBvB,IAAIqB,eAClBR,UAAUE,SAASG,kBAAkBH,MAC5C;CACD,MAAMS,wBAAwBhB,kBAAkBe,cAAcR,MAAM;AAKpEL,QAAOe,mBAAmBC,OAAmC;AAC3DV,kBAAgBD,QAAQ;AAExB,MAAI;AACFL,UAAOI,OAAOE,gBAAgBW,IAAI,KAAK;UACjC;EAKR,MAAMC,sBAAsB;AAE1B5B,OAAI6B,eAA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E,kBAAiBQ,OAAO;;UAGtB;GAGR;;AAQwBV,IAAIuE,gBAAgB;CAC9CC,MAAM;CACNC,QAAQ;AACN7D,wBAAsB;AACtB,eAAa;;CAEhB,CAAC"}
package/dist/esm/link.js CHANGED
@@ -78,7 +78,7 @@ function useLinkProps(options) {
78
78
  nextLocation: next
79
79
  });
80
80
  const isActive = getIsActive({
81
- loc: router.stores.location.state,
81
+ loc: router.stores.location.get(),
82
82
  nextLoc: next,
83
83
  activeOptions: options.activeOptions,
84
84
  router
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","names":["Vue","deepEqual","exactPathTest","isDangerousProtocol","preloadWarning","removeTrailingSlash","isServer","useStore","useRouter","useIntersectionObserver","timeoutMap","WeakMap","useLinkProps","options","router","isTransitioning","ref","hasRenderFetched","console","warn","computed","type","URL","to","eventHandlers","getLinkEventHandlers","value","protocolAllowlist","process","env","NODE_ENV","safeProps","getPropsSafeToSpread","target","disabled","style","class","onClick","onBlur","onFocus","onMouseenter","onMouseleave","onMouseover","onMouseout","onTouchstart","Object","keys","forEach","key","undefined","externalProps","href","next","buildLocation","getHref","nextLocation","isActive","getIsActive","loc","stores","location","state","nextLoc","activeOptions","resolvedActiveProps","resolvedInactiveProps","resolvedClassName","resolvedStyle","resolveStyleProps","result","combineResultProps","currentLocation","l","equal","prev","opts","_fromLocation","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","doPreload","preloadRoute","_builtLocation","catch","err","preloadViewportIoCallback","entry","isIntersecting","rootMargin","effect","handleClick","e","elementTarget","currentTarget","getAttribute","effectiveTarget","isCtrlEvent","defaultPrevented","button","preventDefault","unsub","subscribe","navigate","replace","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","enqueueIntentPreload","eventTarget","has","set","setTimeout","delete","handleTouchStart","_","handleLeave","id","get","clearTimeout","composeEventHandlers","handlers","event","handler","resolvedStyleProps","staticEventHandlers","computedProps","activeProps","inactiveProps","classes","filter","Boolean","length","join","assign","role","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","onTouchStart","_activeProps","_inactiveProps","_activeOptions","_to","_preload","_preloadDelay","preloadIntentProximity","_preloadIntentProximity","_hashScrollIntoView","_replace","_startTransition","_resetScroll","_viewTransition","children","_children","_target","_disabled","_style","_class","_onClick","_onBlur","_onFocus","_onMouseEnter","_onMouseenter","_onMouseLeave","_onMouseleave","_onMouseOver","_onMouseover","_onMouseOut","_onMouseout","_onTouchStart","_onTouchstart","_ignoreBlocker","params","_params","search","_search","hash","_hash","_state","mask","_mask","_reloadDocument","unsafeRelative","_unsafeRelative","_asChild","__asChild","from","_from","additionalProps","_additionalProps","propsSafeToSpread","exact","testExact","pathname","basepath","currentPath","nextPath","pathIsFuzzyEqual","startsWith","includeSearch","searchTest","partial","ignoreUndefined","explicitUndefined","includeHash","maskedLocation","publicHref","external","history","createHref","createLink","Comp","defineComponent","name","inheritAttrs","setup","attrs","slots","h","LinkImpl","props","allProps","linkPropsSource","Component","linkProps","unref","slotContent","default","svgLinkProps","Link","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"sources":["../../src/link.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n deepEqual,\n exactPathTest,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\n\nimport { useStore } from '@tanstack/vue-store'\nimport { useRouter } from './useRouter'\nimport { useIntersectionObserver } from './utils'\n\nimport type {\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { AnchorHTMLAttributes, ReservedProps } from '@vue/runtime-dom'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype EventHandler<TEvent = Event> = (e: TEvent) => void\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\ntype DataAttributes = {\n [K in `data-${string}`]?: unknown\n}\n\ntype LinkHTMLAttributes = AnchorHTMLAttributes &\n ReservedProps &\n DataAttributes & {\n // Vue's runtime-dom types use lowercase event names.\n // Also accept camelCase versions for external API compatibility.\n onMouseEnter?: EventHandler<MouseEvent>\n onMouseLeave?: EventHandler<MouseEvent>\n onMouseOver?: EventHandler<MouseEvent>\n onMouseOut?: EventHandler<MouseEvent>\n onTouchStart?: EventHandler<TouchEvent>\n\n // `disabled` is not a valid <a> attribute, but is useful when using `asChild`.\n disabled?: boolean\n }\n\ntype VueStyleLinkEventHandlers = {\n onMouseenter?: EventHandler<MouseEvent>\n onMouseleave?: EventHandler<MouseEvent>\n onMouseover?: EventHandler<MouseEvent>\n onMouseout?: EventHandler<MouseEvent>\n onTouchstart?: EventHandler<TouchEvent>\n}\n\ninterface StyledProps {\n class?: LinkHTMLAttributes['class']\n style?: LinkHTMLAttributes['style']\n [key: string]: unknown\n}\n\ntype PropsOfComponent<TComp> =\n // Functional components\n TComp extends (props: infer P, ...args: Array<unknown>) => any\n ? P\n : // Vue components (defineComponent, class components, etc)\n TComp extends Vue.Component<infer P>\n ? P\n : Record<string, unknown>\n\ntype AnyLinkPropsOptions = UseLinkPropsOptions<any, any, any, any, any>\ntype LinkEventOptions = AnyLinkPropsOptions & Partial<VueStyleLinkEventHandlers>\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): LinkHTMLAttributes {\n const router = useRouter()\n const isTransitioning = Vue.ref(false)\n let hasRenderFetched = false\n\n // Ensure router is defined before proceeding\n if (!router) {\n console.warn('useRouter must be used inside a <RouterProvider> component!')\n return Vue.computed(() => ({})) as unknown as LinkHTMLAttributes\n }\n\n // Determine if the link is external or internal\n const type = Vue.computed(() => {\n try {\n new URL(`${options.to}`)\n return 'external'\n } catch {\n return 'internal'\n }\n })\n\n const ref = Vue.ref<Element | null>(null)\n const eventHandlers = getLinkEventHandlers(options as LinkEventOptions)\n\n if (type.value === 'external') {\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(options.to as string, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${options.to}`)\n }\n // Return props without href to prevent navigation\n const safeProps: Record<string, unknown> = {\n ...getPropsSafeToSpread(options as AnyLinkPropsOptions),\n ref,\n // No href attribute - blocks the dangerous protocol\n target: options.target,\n disabled: options.disabled,\n style: options.style,\n class: options.class,\n onClick: options.onClick,\n onBlur: options.onBlur,\n onFocus: options.onFocus,\n onMouseenter: eventHandlers.onMouseenter,\n onMouseleave: eventHandlers.onMouseleave,\n onMouseover: eventHandlers.onMouseover,\n onMouseout: eventHandlers.onMouseout,\n onTouchstart: eventHandlers.onTouchstart,\n }\n\n // Remove undefined values\n Object.keys(safeProps).forEach((key) => {\n if (safeProps[key] === undefined) {\n delete safeProps[key]\n }\n })\n\n return Vue.computed(\n () => safeProps as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n // External links just have simple props\n const externalProps: Record<string, unknown> = {\n ...getPropsSafeToSpread(options as AnyLinkPropsOptions),\n ref,\n href: options.to,\n target: options.target,\n disabled: options.disabled,\n style: options.style,\n class: options.class,\n onClick: options.onClick,\n onBlur: options.onBlur,\n onFocus: options.onFocus,\n onMouseenter: eventHandlers.onMouseenter,\n onMouseleave: eventHandlers.onMouseleave,\n onMouseover: eventHandlers.onMouseover,\n onMouseout: eventHandlers.onMouseout,\n onTouchstart: eventHandlers.onTouchstart,\n }\n\n // Remove undefined values\n Object.keys(externalProps).forEach((key) => {\n if (externalProps[key] === undefined) {\n delete externalProps[key]\n }\n })\n\n return Vue.computed(\n () => externalProps as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n // During SSR we render exactly once and do not need reactivity.\n // Avoid store subscriptions, effects and observers on the server.\n if (isServer ?? router.isServer) {\n const next = router.buildLocation(options as any)\n const href = getHref({\n options: options as AnyLinkPropsOptions,\n router,\n nextLocation: next,\n })\n\n const isActive = getIsActive({\n loc: router.stores.location.state,\n nextLoc: next,\n activeOptions: options.activeOptions,\n router,\n })\n\n const {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n } = resolveStyleProps({\n options: options as AnyLinkPropsOptions,\n isActive,\n })\n\n const result = combineResultProps({\n href,\n options: options as AnyLinkPropsOptions,\n isActive,\n isTransitioning: false,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n })\n\n return Vue.ref(\n result as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n const currentLocation = useStore(router.stores.location, (l) => l, {\n equal: (prev, next) => prev.href === next.href,\n })\n\n const next = Vue.computed(() => {\n // Rebuild when inherited search/hash or the current route context changes.\n\n const opts = { _fromLocation: currentLocation.value, ...options }\n return router.buildLocation(opts as any)\n })\n\n const preload = Vue.computed(() => {\n if (options.reloadDocument) {\n return false\n }\n return options.preload ?? router.options.defaultPreload\n })\n\n const preloadDelay = Vue.computed(\n () => options.preloadDelay ?? router.options.defaultPreloadDelay ?? 0,\n )\n\n const isActive = Vue.computed(() =>\n getIsActive({\n activeOptions: options.activeOptions,\n loc: currentLocation.value,\n nextLoc: next.value,\n router,\n }),\n )\n\n const doPreload = () =>\n router\n .preloadRoute({ ...options, _builtLocation: next.value } as any)\n .catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: () => !!options.disabled || !(preload.value === 'viewport') },\n )\n\n Vue.effect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!options.disabled && preload.value === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n // The click handler\n const handleClick = (e: PointerEvent): void => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n )?.getAttribute('target')\n const effectiveTarget =\n options.target !== undefined ? options.target : elementTarget\n\n if (\n !options.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n // Don't prevent default or handle navigation if reloadDocument is true\n if (options.reloadDocument) {\n return\n }\n\n e.preventDefault()\n\n isTransitioning.value = true\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n isTransitioning.value = false\n })\n\n // All is well? Navigate!\n router.navigate({\n ...options,\n replace: options.replace,\n resetScroll: options.resetScroll,\n hashScrollIntoView: options.hashScrollIntoView,\n startTransition: options.startTransition,\n viewTransition: options.viewTransition,\n ignoreBlocker: options.ignoreBlocker,\n })\n }\n }\n\n const enqueueIntentPreload = (e: MouseEvent | FocusEvent) => {\n if (options.disabled || preload.value !== 'intent') return\n\n if (!preloadDelay.value) {\n doPreload()\n return\n }\n\n const eventTarget = e.currentTarget || e.target\n\n if (!eventTarget || timeoutMap.has(eventTarget)) return\n\n timeoutMap.set(\n eventTarget,\n setTimeout(() => {\n timeoutMap.delete(eventTarget)\n doPreload()\n }, preloadDelay.value),\n )\n }\n\n const handleTouchStart = (_: TouchEvent) => {\n if (options.disabled || preload.value !== 'intent') return\n doPreload()\n }\n\n const handleLeave = (e: MouseEvent | FocusEvent) => {\n if (options.disabled) return\n const eventTarget = e.currentTarget || e.target\n\n if (eventTarget) {\n const id = timeoutMap.get(eventTarget)\n clearTimeout(id)\n timeoutMap.delete(eventTarget)\n }\n }\n\n // Helper to compose event handlers - with explicit return type and better type handling\n function composeEventHandlers<T extends Event>(\n handlers: Array<EventHandler<T> | undefined>,\n ): (e: T) => void {\n return (event: T) => {\n for (const handler of handlers) {\n if (handler) {\n handler(event)\n }\n }\n }\n }\n\n // Get the active and inactive props\n const resolvedStyleProps = Vue.computed(() =>\n resolveStyleProps({\n options: options as AnyLinkPropsOptions,\n isActive: isActive.value,\n }),\n )\n\n const href = Vue.computed(() =>\n getHref({\n options: options as AnyLinkPropsOptions,\n router,\n nextLocation: next.value,\n }),\n )\n\n // Create static event handlers that don't change between renders\n const staticEventHandlers = {\n onClick: composeEventHandlers<PointerEvent>([\n options.onClick,\n handleClick,\n ]) as any,\n onBlur: composeEventHandlers<FocusEvent>([\n options.onBlur,\n handleLeave,\n ]) as any,\n onFocus: composeEventHandlers<FocusEvent>([\n options.onFocus,\n enqueueIntentPreload,\n ]) as any,\n onMouseenter: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseenter,\n enqueueIntentPreload,\n ]) as any,\n onMouseover: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseover,\n enqueueIntentPreload,\n ]) as any,\n onMouseleave: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseleave,\n handleLeave,\n ]) as any,\n onMouseout: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseout,\n handleLeave,\n ]) as any,\n onTouchstart: composeEventHandlers<TouchEvent>([\n eventHandlers.onTouchstart,\n handleTouchStart,\n ]) as any,\n }\n\n // Compute all props synchronously to avoid hydration mismatches\n // Using Vue.computed ensures props are calculated at render time, not after\n const computedProps = Vue.computed<LinkHTMLAttributes>(() => {\n const {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n } = resolvedStyleProps.value\n return combineResultProps({\n href: href.value,\n options: options as AnyLinkPropsOptions,\n ref,\n staticEventHandlers,\n isActive: isActive.value,\n isTransitioning: isTransitioning.value,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n })\n })\n\n // Return the computed ref itself - callers should access .value\n return computedProps as unknown as LinkHTMLAttributes\n}\n\nfunction resolveStyleProps({\n options,\n isActive,\n}: {\n options: AnyLinkPropsOptions\n isActive: boolean\n}) {\n const activeProps = options.activeProps || (() => ({ class: 'active' }))\n const resolvedActiveProps: StyledProps = (isActive\n ? typeof activeProps === 'function'\n ? activeProps()\n : activeProps\n : {}) || { class: undefined, style: undefined }\n\n const inactiveProps = options.inactiveProps || (() => ({}))\n\n const resolvedInactiveProps: StyledProps = (isActive\n ? {}\n : typeof inactiveProps === 'function'\n ? inactiveProps()\n : inactiveProps) || { class: undefined, style: undefined }\n\n const classes = [\n options.class,\n resolvedActiveProps?.class,\n resolvedInactiveProps?.class,\n ].filter(Boolean)\n const resolvedClassName = classes.length ? classes.join(' ') : undefined\n\n const result: Record<string, string | number> = {}\n\n // Merge styles from all sources\n if (options.style) {\n Object.assign(result, options.style)\n }\n\n if (resolvedActiveProps?.style) {\n Object.assign(result, resolvedActiveProps.style)\n }\n\n if (resolvedInactiveProps?.style) {\n Object.assign(result, resolvedInactiveProps.style)\n }\n\n const resolvedStyle = Object.keys(result).length > 0 ? result : undefined\n return {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n }\n}\n\nfunction combineResultProps({\n href,\n options,\n isActive,\n isTransitioning,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n ref,\n staticEventHandlers,\n}: {\n initial?: LinkHTMLAttributes\n href: string | undefined\n options: AnyLinkPropsOptions\n isActive: boolean\n isTransitioning: boolean\n resolvedActiveProps: StyledProps\n resolvedInactiveProps: StyledProps\n resolvedClassName?: string\n resolvedStyle?: Record<string, string | number>\n ref?: Vue.VNodeRef | undefined\n staticEventHandlers?: {\n onClick: any\n onBlur: any\n onFocus: any\n onMouseenter: any\n onMouseover: any\n onMouseleave: any\n onMouseout: any\n onTouchstart: any\n }\n}) {\n const result: Record<string, unknown> = {\n ...getPropsSafeToSpread(options),\n ref,\n ...staticEventHandlers,\n href,\n disabled: !!options.disabled,\n target: options.target,\n }\n\n if (resolvedStyle) {\n result.style = resolvedStyle\n }\n\n if (resolvedClassName) {\n result.class = resolvedClassName\n }\n\n if (options.disabled) {\n result.role = 'link'\n result['aria-disabled'] = true\n }\n\n if (isActive) {\n result['data-status'] = 'active'\n result['aria-current'] = 'page'\n }\n\n if (isTransitioning) {\n result['data-transitioning'] = 'transitioning'\n }\n\n for (const key of Object.keys(resolvedActiveProps)) {\n if (key !== 'class' && key !== 'style') {\n result[key] = resolvedActiveProps[key]\n }\n }\n\n for (const key of Object.keys(resolvedInactiveProps)) {\n if (key !== 'class' && key !== 'style') {\n result[key] = resolvedInactiveProps[key]\n }\n }\n return result\n}\n\nfunction getLinkEventHandlers(\n options: LinkEventOptions,\n): VueStyleLinkEventHandlers {\n return {\n onMouseenter: options.onMouseEnter ?? options.onMouseenter,\n onMouseleave: options.onMouseLeave ?? options.onMouseleave,\n onMouseover: options.onMouseOver ?? options.onMouseover,\n onMouseout: options.onMouseOut ?? options.onMouseout,\n onTouchstart: options.onTouchStart ?? options.onTouchstart,\n }\n}\n\nconst getPropsSafeToSpread = (options: AnyLinkPropsOptions) => {\n const {\n activeProps: _activeProps,\n inactiveProps: _inactiveProps,\n activeOptions: _activeOptions,\n to: _to,\n preload: _preload,\n preloadDelay: _preloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView: _hashScrollIntoView,\n replace: _replace,\n startTransition: _startTransition,\n resetScroll: _resetScroll,\n viewTransition: _viewTransition,\n children: _children,\n target: _target,\n disabled: _disabled,\n style: _style,\n class: _class,\n onClick: _onClick,\n onBlur: _onBlur,\n onFocus: _onFocus,\n onMouseEnter: _onMouseEnter,\n onMouseenter: _onMouseenter,\n onMouseLeave: _onMouseLeave,\n onMouseleave: _onMouseleave,\n onMouseOver: _onMouseOver,\n onMouseover: _onMouseover,\n onMouseOut: _onMouseOut,\n onMouseout: _onMouseout,\n onTouchStart: _onTouchStart,\n onTouchstart: _onTouchstart,\n ignoreBlocker: _ignoreBlocker,\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n _asChild: __asChild,\n from: _from,\n additionalProps: _additionalProps,\n ...propsSafeToSpread\n } = options as AnyLinkPropsOptions & {\n additionalProps?: unknown\n children?: unknown\n _asChild?: unknown\n }\n\n return propsSafeToSpread\n}\n\nfunction getIsActive({\n activeOptions,\n loc,\n nextLoc,\n router,\n}: {\n activeOptions: LinkOptions['activeOptions']\n loc: {\n pathname: string\n search: any\n hash: string\n }\n nextLoc: {\n pathname: string\n search: any\n hash: string\n }\n router: AnyRouter\n}) {\n if (activeOptions?.exact) {\n const testExact = exactPathTest(\n loc.pathname,\n nextLoc.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPath = removeTrailingSlash(loc.pathname, router.basepath)\n const nextPath = removeTrailingSlash(nextLoc.pathname, router.basepath)\n\n const pathIsFuzzyEqual =\n currentPath.startsWith(nextPath) &&\n (currentPath.length === nextPath.length ||\n currentPath[nextPath.length] === '/')\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(loc.search, nextLoc.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return loc.hash === nextLoc.hash\n }\n return true\n}\n\nfunction getHref({\n options,\n router,\n nextLocation,\n}: {\n options: AnyLinkPropsOptions\n router: AnyRouter\n nextLocation?: ParsedLocation\n}) {\n if (options.disabled) {\n return undefined\n }\n const location = nextLocation?.maskedLocation ?? nextLocation\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const publicHref = location?.publicHref\n if (!publicHref) return undefined\n\n const external = location?.external\n if (external) return publicHref\n\n return router.history.createHref(publicHref) || '/'\n}\n\n// Type definitions\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkHTMLAttributes\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n (TComp extends keyof HTMLElementTagNameMap\n ? LinkHTMLAttributes\n : PropsOfComponent<TComp>) & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\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 | Vue.VNodeChild\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Vue.VNodeChild)\n}\n\ntype LinkComponentVueProps<TComp> = TComp extends keyof HTMLElementTagNameMap\n ? Omit<LinkHTMLAttributes, keyof CreateLinkProps>\n : Omit<PropsOfComponent<TComp>, keyof CreateLinkProps>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentVueProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Vue.VNode\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): Vue.VNode\n}\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Vue.VNode>,\n): LinkComponent<TComp> {\n return Vue.defineComponent({\n name: 'CreatedLink',\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n return () => Vue.h(LinkImpl as any, { ...attrs, _asChild: Comp }, slots)\n },\n }) as any\n}\n\nconst LinkImpl = Vue.defineComponent({\n name: 'Link',\n inheritAttrs: false,\n props: [\n '_asChild',\n 'to',\n 'preload',\n 'preloadDelay',\n 'preloadIntentProximity',\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'from',\n 'search',\n 'params',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n 'disabled',\n 'additionalProps',\n 'viewTransition',\n 'resetScroll',\n 'startTransition',\n 'hashScrollIntoView',\n 'replace',\n 'ignoreBlocker',\n 'target',\n ],\n setup(props, { attrs, slots }) {\n // Call useLinkProps ONCE during setup with combined props and attrs\n const allProps = { ...props, ...attrs }\n const linkPropsSource = useLinkProps(allProps as any) as\n | LinkHTMLAttributes\n | Vue.ComputedRef<LinkHTMLAttributes>\n\n return () => {\n const Component = props._asChild || 'a'\n\n const linkProps = Vue.unref(linkPropsSource)\n\n const isActive = linkProps['data-status'] === 'active'\n const isTransitioning =\n linkProps['data-transitioning'] === 'transitioning'\n\n // Create the slot content or empty array if no default slot\n const slotContent = slots.default\n ? slots.default({\n isActive,\n isTransitioning,\n })\n : []\n\n // Special handling for SVG links - wrap an <a> inside the SVG\n if (Component === 'svg') {\n // Create props without class for svg link\n const svgLinkProps = { ...linkProps }\n delete svgLinkProps.class\n return Vue.h('svg', {}, [Vue.h('a', svgLinkProps, slotContent)])\n }\n\n // For custom functional components (non-string), pass children as a prop\n // since they may expect children as a prop like in Solid\n if (typeof Component !== 'string') {\n return Vue.h(\n Component,\n { ...linkProps, children: slotContent },\n slotContent,\n )\n }\n\n // Return the component with props and children\n return Vue.h(Component, linkProps, slotContent)\n }\n },\n})\n\n/**\n * Link component with proper TypeScript generics support\n */\nexport const Link = LinkImpl as unknown as Vue.Component<unknown> &\n Vue.Component<CreateLinkProps> &\n LinkComponent<'a'>\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"mappings":";;;;;;;AA8BA,IAAMU,6BAAa,IAAIC,SAAqD;AA+C5E,SAAgBC,aAOdC,SACoB;CACpB,MAAMC,SAASN,WAAW;CAC1B,MAAMO,kBAAkBf,IAAIgB,IAAI,MAAM;CACtC,IAAIC,mBAAmB;AAGvB,KAAI,CAACH,QAAQ;AACXI,UAAQC,KAAK,8DAA8D;AAC3E,SAAOnB,IAAIoB,gBAAgB,EAAE,EAAE;;CAIjC,MAAMC,OAAOrB,IAAIoB,eAAe;AAC9B,MAAI;AACF,OAAIE,IAAI,GAAGT,QAAQU,KAAK;AACxB,UAAO;UACD;AACN,UAAO;;GAET;CAEF,MAAMP,MAAMhB,IAAIgB,IAAoB,KAAK;CACzC,MAAMQ,gBAAgBC,qBAAqBZ,QAA4B;AAEvE,KAAIQ,KAAKK,UAAU,YAAY;AAE7B,MAAIvB,oBAAoBU,QAAQU,IAAcT,OAAOa,kBAAkB,EAAE;AACvE,OAAA,QAAA,IAAA,aAA6B,aAC3BT,SAAQC,KAAK,yCAAyCN,QAAQU,KAAK;GAGrE,MAAMQ,YAAqC;IACzC,GAAGC,qBAAqBnB,QAA+B;IACvDG;IAEAiB,QAAQpB,QAAQoB;IAChBC,UAAUrB,QAAQqB;IAClBC,OAAOtB,QAAQsB;IACfC,OAAOvB,QAAQuB;IACfC,SAASxB,QAAQwB;IACjBC,QAAQzB,QAAQyB;IAChBC,SAAS1B,QAAQ0B;IACjBC,cAAchB,cAAcgB;IAC5BC,cAAcjB,cAAciB;IAC5BC,aAAalB,cAAckB;IAC3BC,YAAYnB,cAAcmB;IAC1BC,cAAcpB,cAAcoB;IAC7B;AAGDC,UAAOC,KAAKf,UAAU,CAACgB,SAASC,QAAQ;AACtC,QAAIjB,UAAUiB,SAASC,KAAAA,EACrB,Q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;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACDL,MAAMK,OAAO,EAAEJ,OAAOC,SAAS;EAG7B,MAAMK,kBAAkBvN,aADP;GAAE,GAAGqN;GAAO,GAAGJ;GAAO,CAGA;AAEvC,eAAa;GACX,MAAMO,YAAYH,MAAMpC,YAAY;GAEpC,MAAMwC,YAAYrO,IAAIsO,MAAMH,gBAAgB;GAE5C,MAAM3K,WAAW6K,UAAU,mBAAmB;GAC9C,MAAMtN,kBACJsN,UAAU,0BAA0B;GAGtC,MAAME,cAAcT,MAAMU,UACtBV,MAAMU,QAAQ;IACZhL;IACAzC;IACD,CAAC,GACF,EAAE;AAGN,OAAIqN,cAAc,OAAO;IAEvB,MAAMK,eAAe,EAAE,GAAGJ,WAAW;AACrC,WAAOI,aAAarM;AACpB,WAAOpC,IAAI+N,EAAE,OAAO,EAAE,EAAE,CAAC/N,IAAI+N,EAAE,KAAKU,cAAcF,YAAY,CAAC,CAAC;;AAKlE,OAAI,OAAOH,cAAc,SACvB,QAAOpO,IAAI+N,EACTK,WACA;IAAE,GAAGC;IAAWxE,UAAU0E;IAAa,EACvCA,YACD;AAIH,UAAOvO,IAAI+N,EAAEK,WAAWC,WAAWE,YAAY;;;CAGpD,CAAC;;;;AAKF,IAAaG,OAAOV;AAIpB,SAAS9H,YAAYL,GAAe;AAClC,QAAO,CAAC,EAAEA,EAAE8I,WAAW9I,EAAE+I,UAAU/I,EAAEgJ,WAAWhJ,EAAEiJ;;AAmBpD,IAAaC,eAAmClO,YAAY;AAC1D,QAAOA"}
1
+ {"version":3,"file":"link.js","names":["Vue","deepEqual","exactPathTest","isDangerousProtocol","preloadWarning","removeTrailingSlash","isServer","useStore","useRouter","useIntersectionObserver","timeoutMap","WeakMap","useLinkProps","options","router","isTransitioning","ref","hasRenderFetched","console","warn","computed","type","URL","to","eventHandlers","getLinkEventHandlers","value","protocolAllowlist","process","env","NODE_ENV","safeProps","getPropsSafeToSpread","target","disabled","style","class","onClick","onBlur","onFocus","onMouseenter","onMouseleave","onMouseover","onMouseout","onTouchstart","Object","keys","forEach","key","undefined","externalProps","href","next","buildLocation","getHref","nextLocation","isActive","getIsActive","loc","stores","location","get","nextLoc","activeOptions","resolvedActiveProps","resolvedInactiveProps","resolvedClassName","resolvedStyle","resolveStyleProps","result","combineResultProps","currentLocation","l","equal","prev","opts","_fromLocation","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","doPreload","preloadRoute","_builtLocation","catch","err","preloadViewportIoCallback","entry","isIntersecting","rootMargin","effect","handleClick","e","elementTarget","currentTarget","getAttribute","effectiveTarget","isCtrlEvent","defaultPrevented","button","preventDefault","unsub","subscribe","navigate","replace","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","enqueueIntentPreload","eventTarget","has","set","setTimeout","delete","handleTouchStart","_","handleLeave","id","clearTimeout","composeEventHandlers","handlers","event","handler","resolvedStyleProps","staticEventHandlers","computedProps","activeProps","inactiveProps","classes","filter","Boolean","length","join","assign","role","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","onTouchStart","_activeProps","_inactiveProps","_activeOptions","_to","_preload","_preloadDelay","preloadIntentProximity","_preloadIntentProximity","_hashScrollIntoView","_replace","_startTransition","_resetScroll","_viewTransition","children","_children","_target","_disabled","_style","_class","_onClick","_onBlur","_onFocus","_onMouseEnter","_onMouseenter","_onMouseLeave","_onMouseleave","_onMouseOver","_onMouseover","_onMouseOut","_onMouseout","_onTouchStart","_onTouchstart","_ignoreBlocker","params","_params","search","_search","hash","_hash","state","_state","mask","_mask","_reloadDocument","unsafeRelative","_unsafeRelative","_asChild","__asChild","from","_from","additionalProps","_additionalProps","propsSafeToSpread","exact","testExact","pathname","basepath","currentPath","nextPath","pathIsFuzzyEqual","startsWith","includeSearch","searchTest","partial","ignoreUndefined","explicitUndefined","includeHash","maskedLocation","publicHref","external","history","createHref","createLink","Comp","defineComponent","name","inheritAttrs","setup","attrs","slots","h","LinkImpl","props","allProps","linkPropsSource","Component","linkProps","unref","slotContent","default","svgLinkProps","Link","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"sources":["../../src/link.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n deepEqual,\n exactPathTest,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\n\nimport { useStore } from '@tanstack/vue-store'\nimport { useRouter } from './useRouter'\nimport { useIntersectionObserver } from './utils'\n\nimport type {\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { AnchorHTMLAttributes, ReservedProps } from '@vue/runtime-dom'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype EventHandler<TEvent = Event> = (e: TEvent) => void\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\ntype DataAttributes = {\n [K in `data-${string}`]?: unknown\n}\n\ntype LinkHTMLAttributes = AnchorHTMLAttributes &\n ReservedProps &\n DataAttributes & {\n // Vue's runtime-dom types use lowercase event names.\n // Also accept camelCase versions for external API compatibility.\n onMouseEnter?: EventHandler<MouseEvent>\n onMouseLeave?: EventHandler<MouseEvent>\n onMouseOver?: EventHandler<MouseEvent>\n onMouseOut?: EventHandler<MouseEvent>\n onTouchStart?: EventHandler<TouchEvent>\n\n // `disabled` is not a valid <a> attribute, but is useful when using `asChild`.\n disabled?: boolean\n }\n\ntype VueStyleLinkEventHandlers = {\n onMouseenter?: EventHandler<MouseEvent>\n onMouseleave?: EventHandler<MouseEvent>\n onMouseover?: EventHandler<MouseEvent>\n onMouseout?: EventHandler<MouseEvent>\n onTouchstart?: EventHandler<TouchEvent>\n}\n\ninterface StyledProps {\n class?: LinkHTMLAttributes['class']\n style?: LinkHTMLAttributes['style']\n [key: string]: unknown\n}\n\ntype PropsOfComponent<TComp> =\n // Functional components\n TComp extends (props: infer P, ...args: Array<unknown>) => any\n ? P\n : // Vue components (defineComponent, class components, etc)\n TComp extends Vue.Component<infer P>\n ? P\n : Record<string, unknown>\n\ntype AnyLinkPropsOptions = UseLinkPropsOptions<any, any, any, any, any>\ntype LinkEventOptions = AnyLinkPropsOptions & Partial<VueStyleLinkEventHandlers>\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): LinkHTMLAttributes {\n const router = useRouter()\n const isTransitioning = Vue.ref(false)\n let hasRenderFetched = false\n\n // Ensure router is defined before proceeding\n if (!router) {\n console.warn('useRouter must be used inside a <RouterProvider> component!')\n return Vue.computed(() => ({})) as unknown as LinkHTMLAttributes\n }\n\n // Determine if the link is external or internal\n const type = Vue.computed(() => {\n try {\n new URL(`${options.to}`)\n return 'external'\n } catch {\n return 'internal'\n }\n })\n\n const ref = Vue.ref<Element | null>(null)\n const eventHandlers = getLinkEventHandlers(options as LinkEventOptions)\n\n if (type.value === 'external') {\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(options.to as string, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${options.to}`)\n }\n // Return props without href to prevent navigation\n const safeProps: Record<string, unknown> = {\n ...getPropsSafeToSpread(options as AnyLinkPropsOptions),\n ref,\n // No href attribute - blocks the dangerous protocol\n target: options.target,\n disabled: options.disabled,\n style: options.style,\n class: options.class,\n onClick: options.onClick,\n onBlur: options.onBlur,\n onFocus: options.onFocus,\n onMouseenter: eventHandlers.onMouseenter,\n onMouseleave: eventHandlers.onMouseleave,\n onMouseover: eventHandlers.onMouseover,\n onMouseout: eventHandlers.onMouseout,\n onTouchstart: eventHandlers.onTouchstart,\n }\n\n // Remove undefined values\n Object.keys(safeProps).forEach((key) => {\n if (safeProps[key] === undefined) {\n delete safeProps[key]\n }\n })\n\n return Vue.computed(\n () => safeProps as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n // External links just have simple props\n const externalProps: Record<string, unknown> = {\n ...getPropsSafeToSpread(options as AnyLinkPropsOptions),\n ref,\n href: options.to,\n target: options.target,\n disabled: options.disabled,\n style: options.style,\n class: options.class,\n onClick: options.onClick,\n onBlur: options.onBlur,\n onFocus: options.onFocus,\n onMouseenter: eventHandlers.onMouseenter,\n onMouseleave: eventHandlers.onMouseleave,\n onMouseover: eventHandlers.onMouseover,\n onMouseout: eventHandlers.onMouseout,\n onTouchstart: eventHandlers.onTouchstart,\n }\n\n // Remove undefined values\n Object.keys(externalProps).forEach((key) => {\n if (externalProps[key] === undefined) {\n delete externalProps[key]\n }\n })\n\n return Vue.computed(\n () => externalProps as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n // During SSR we render exactly once and do not need reactivity.\n // Avoid store subscriptions, effects and observers on the server.\n if (isServer ?? router.isServer) {\n const next = router.buildLocation(options as any)\n const href = getHref({\n options: options as AnyLinkPropsOptions,\n router,\n nextLocation: next,\n })\n\n const isActive = getIsActive({\n loc: router.stores.location.get(),\n nextLoc: next,\n activeOptions: options.activeOptions,\n router,\n })\n\n const {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n } = resolveStyleProps({\n options: options as AnyLinkPropsOptions,\n isActive,\n })\n\n const result = combineResultProps({\n href,\n options: options as AnyLinkPropsOptions,\n isActive,\n isTransitioning: false,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n })\n\n return Vue.ref(\n result as LinkHTMLAttributes,\n ) as unknown as LinkHTMLAttributes\n }\n\n const currentLocation = useStore(router.stores.location, (l) => l, {\n equal: (prev, next) => prev.href === next.href,\n })\n\n const next = Vue.computed(() => {\n // Rebuild when inherited search/hash or the current route context changes.\n\n const opts = { _fromLocation: currentLocation.value, ...options }\n return router.buildLocation(opts as any)\n })\n\n const preload = Vue.computed(() => {\n if (options.reloadDocument) {\n return false\n }\n return options.preload ?? router.options.defaultPreload\n })\n\n const preloadDelay = Vue.computed(\n () => options.preloadDelay ?? router.options.defaultPreloadDelay ?? 0,\n )\n\n const isActive = Vue.computed(() =>\n getIsActive({\n activeOptions: options.activeOptions,\n loc: currentLocation.value,\n nextLoc: next.value,\n router,\n }),\n )\n\n const doPreload = () =>\n router\n .preloadRoute({ ...options, _builtLocation: next.value } as any)\n .catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: () => !!options.disabled || !(preload.value === 'viewport') },\n )\n\n Vue.effect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!options.disabled && preload.value === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n // The click handler\n const handleClick = (e: PointerEvent): void => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n )?.getAttribute('target')\n const effectiveTarget =\n options.target !== undefined ? options.target : elementTarget\n\n if (\n !options.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n // Don't prevent default or handle navigation if reloadDocument is true\n if (options.reloadDocument) {\n return\n }\n\n e.preventDefault()\n\n isTransitioning.value = true\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n isTransitioning.value = false\n })\n\n // All is well? Navigate!\n router.navigate({\n ...options,\n replace: options.replace,\n resetScroll: options.resetScroll,\n hashScrollIntoView: options.hashScrollIntoView,\n startTransition: options.startTransition,\n viewTransition: options.viewTransition,\n ignoreBlocker: options.ignoreBlocker,\n })\n }\n }\n\n const enqueueIntentPreload = (e: MouseEvent | FocusEvent) => {\n if (options.disabled || preload.value !== 'intent') return\n\n if (!preloadDelay.value) {\n doPreload()\n return\n }\n\n const eventTarget = e.currentTarget || e.target\n\n if (!eventTarget || timeoutMap.has(eventTarget)) return\n\n timeoutMap.set(\n eventTarget,\n setTimeout(() => {\n timeoutMap.delete(eventTarget)\n doPreload()\n }, preloadDelay.value),\n )\n }\n\n const handleTouchStart = (_: TouchEvent) => {\n if (options.disabled || preload.value !== 'intent') return\n doPreload()\n }\n\n const handleLeave = (e: MouseEvent | FocusEvent) => {\n if (options.disabled) return\n const eventTarget = e.currentTarget || e.target\n\n if (eventTarget) {\n const id = timeoutMap.get(eventTarget)\n clearTimeout(id)\n timeoutMap.delete(eventTarget)\n }\n }\n\n // Helper to compose event handlers - with explicit return type and better type handling\n function composeEventHandlers<T extends Event>(\n handlers: Array<EventHandler<T> | undefined>,\n ): (e: T) => void {\n return (event: T) => {\n for (const handler of handlers) {\n if (handler) {\n handler(event)\n }\n }\n }\n }\n\n // Get the active and inactive props\n const resolvedStyleProps = Vue.computed(() =>\n resolveStyleProps({\n options: options as AnyLinkPropsOptions,\n isActive: isActive.value,\n }),\n )\n\n const href = Vue.computed(() =>\n getHref({\n options: options as AnyLinkPropsOptions,\n router,\n nextLocation: next.value,\n }),\n )\n\n // Create static event handlers that don't change between renders\n const staticEventHandlers = {\n onClick: composeEventHandlers<PointerEvent>([\n options.onClick,\n handleClick,\n ]) as any,\n onBlur: composeEventHandlers<FocusEvent>([\n options.onBlur,\n handleLeave,\n ]) as any,\n onFocus: composeEventHandlers<FocusEvent>([\n options.onFocus,\n enqueueIntentPreload,\n ]) as any,\n onMouseenter: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseenter,\n enqueueIntentPreload,\n ]) as any,\n onMouseover: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseover,\n enqueueIntentPreload,\n ]) as any,\n onMouseleave: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseleave,\n handleLeave,\n ]) as any,\n onMouseout: composeEventHandlers<MouseEvent>([\n eventHandlers.onMouseout,\n handleLeave,\n ]) as any,\n onTouchstart: composeEventHandlers<TouchEvent>([\n eventHandlers.onTouchstart,\n handleTouchStart,\n ]) as any,\n }\n\n // Compute all props synchronously to avoid hydration mismatches\n // Using Vue.computed ensures props are calculated at render time, not after\n const computedProps = Vue.computed<LinkHTMLAttributes>(() => {\n const {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n } = resolvedStyleProps.value\n return combineResultProps({\n href: href.value,\n options: options as AnyLinkPropsOptions,\n ref,\n staticEventHandlers,\n isActive: isActive.value,\n isTransitioning: isTransitioning.value,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n })\n })\n\n // Return the computed ref itself - callers should access .value\n return computedProps as unknown as LinkHTMLAttributes\n}\n\nfunction resolveStyleProps({\n options,\n isActive,\n}: {\n options: AnyLinkPropsOptions\n isActive: boolean\n}) {\n const activeProps = options.activeProps || (() => ({ class: 'active' }))\n const resolvedActiveProps: StyledProps = (isActive\n ? typeof activeProps === 'function'\n ? activeProps()\n : activeProps\n : {}) || { class: undefined, style: undefined }\n\n const inactiveProps = options.inactiveProps || (() => ({}))\n\n const resolvedInactiveProps: StyledProps = (isActive\n ? {}\n : typeof inactiveProps === 'function'\n ? inactiveProps()\n : inactiveProps) || { class: undefined, style: undefined }\n\n const classes = [\n options.class,\n resolvedActiveProps?.class,\n resolvedInactiveProps?.class,\n ].filter(Boolean)\n const resolvedClassName = classes.length ? classes.join(' ') : undefined\n\n const result: Record<string, string | number> = {}\n\n // Merge styles from all sources\n if (options.style) {\n Object.assign(result, options.style)\n }\n\n if (resolvedActiveProps?.style) {\n Object.assign(result, resolvedActiveProps.style)\n }\n\n if (resolvedInactiveProps?.style) {\n Object.assign(result, resolvedInactiveProps.style)\n }\n\n const resolvedStyle = Object.keys(result).length > 0 ? result : undefined\n return {\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n }\n}\n\nfunction combineResultProps({\n href,\n options,\n isActive,\n isTransitioning,\n resolvedActiveProps,\n resolvedInactiveProps,\n resolvedClassName,\n resolvedStyle,\n ref,\n staticEventHandlers,\n}: {\n initial?: LinkHTMLAttributes\n href: string | undefined\n options: AnyLinkPropsOptions\n isActive: boolean\n isTransitioning: boolean\n resolvedActiveProps: StyledProps\n resolvedInactiveProps: StyledProps\n resolvedClassName?: string\n resolvedStyle?: Record<string, string | number>\n ref?: Vue.VNodeRef | undefined\n staticEventHandlers?: {\n onClick: any\n onBlur: any\n onFocus: any\n onMouseenter: any\n onMouseover: any\n onMouseleave: any\n onMouseout: any\n onTouchstart: any\n }\n}) {\n const result: Record<string, unknown> = {\n ...getPropsSafeToSpread(options),\n ref,\n ...staticEventHandlers,\n href,\n disabled: !!options.disabled,\n target: options.target,\n }\n\n if (resolvedStyle) {\n result.style = resolvedStyle\n }\n\n if (resolvedClassName) {\n result.class = resolvedClassName\n }\n\n if (options.disabled) {\n result.role = 'link'\n result['aria-disabled'] = true\n }\n\n if (isActive) {\n result['data-status'] = 'active'\n result['aria-current'] = 'page'\n }\n\n if (isTransitioning) {\n result['data-transitioning'] = 'transitioning'\n }\n\n for (const key of Object.keys(resolvedActiveProps)) {\n if (key !== 'class' && key !== 'style') {\n result[key] = resolvedActiveProps[key]\n }\n }\n\n for (const key of Object.keys(resolvedInactiveProps)) {\n if (key !== 'class' && key !== 'style') {\n result[key] = resolvedInactiveProps[key]\n }\n }\n return result\n}\n\nfunction getLinkEventHandlers(\n options: LinkEventOptions,\n): VueStyleLinkEventHandlers {\n return {\n onMouseenter: options.onMouseEnter ?? options.onMouseenter,\n onMouseleave: options.onMouseLeave ?? options.onMouseleave,\n onMouseover: options.onMouseOver ?? options.onMouseover,\n onMouseout: options.onMouseOut ?? options.onMouseout,\n onTouchstart: options.onTouchStart ?? options.onTouchstart,\n }\n}\n\nconst getPropsSafeToSpread = (options: AnyLinkPropsOptions) => {\n const {\n activeProps: _activeProps,\n inactiveProps: _inactiveProps,\n activeOptions: _activeOptions,\n to: _to,\n preload: _preload,\n preloadDelay: _preloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView: _hashScrollIntoView,\n replace: _replace,\n startTransition: _startTransition,\n resetScroll: _resetScroll,\n viewTransition: _viewTransition,\n children: _children,\n target: _target,\n disabled: _disabled,\n style: _style,\n class: _class,\n onClick: _onClick,\n onBlur: _onBlur,\n onFocus: _onFocus,\n onMouseEnter: _onMouseEnter,\n onMouseenter: _onMouseenter,\n onMouseLeave: _onMouseLeave,\n onMouseleave: _onMouseleave,\n onMouseOver: _onMouseOver,\n onMouseover: _onMouseover,\n onMouseOut: _onMouseOut,\n onMouseout: _onMouseout,\n onTouchStart: _onTouchStart,\n onTouchstart: _onTouchstart,\n ignoreBlocker: _ignoreBlocker,\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n _asChild: __asChild,\n from: _from,\n additionalProps: _additionalProps,\n ...propsSafeToSpread\n } = options as AnyLinkPropsOptions & {\n additionalProps?: unknown\n children?: unknown\n _asChild?: unknown\n }\n\n return propsSafeToSpread\n}\n\nfunction getIsActive({\n activeOptions,\n loc,\n nextLoc,\n router,\n}: {\n activeOptions: LinkOptions['activeOptions']\n loc: {\n pathname: string\n search: any\n hash: string\n }\n nextLoc: {\n pathname: string\n search: any\n hash: string\n }\n router: AnyRouter\n}) {\n if (activeOptions?.exact) {\n const testExact = exactPathTest(\n loc.pathname,\n nextLoc.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPath = removeTrailingSlash(loc.pathname, router.basepath)\n const nextPath = removeTrailingSlash(nextLoc.pathname, router.basepath)\n\n const pathIsFuzzyEqual =\n currentPath.startsWith(nextPath) &&\n (currentPath.length === nextPath.length ||\n currentPath[nextPath.length] === '/')\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(loc.search, nextLoc.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return loc.hash === nextLoc.hash\n }\n return true\n}\n\nfunction getHref({\n options,\n router,\n nextLocation,\n}: {\n options: AnyLinkPropsOptions\n router: AnyRouter\n nextLocation?: ParsedLocation\n}) {\n if (options.disabled) {\n return undefined\n }\n const location = nextLocation?.maskedLocation ?? nextLocation\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const publicHref = location?.publicHref\n if (!publicHref) return undefined\n\n const external = location?.external\n if (external) return publicHref\n\n return router.history.createHref(publicHref) || '/'\n}\n\n// Type definitions\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkHTMLAttributes\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n (TComp extends keyof HTMLElementTagNameMap\n ? LinkHTMLAttributes\n : PropsOfComponent<TComp>) & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\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 | Vue.VNodeChild\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Vue.VNodeChild)\n}\n\ntype LinkComponentVueProps<TComp> = TComp extends keyof HTMLElementTagNameMap\n ? Omit<LinkHTMLAttributes, keyof CreateLinkProps>\n : Omit<PropsOfComponent<TComp>, keyof CreateLinkProps>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentVueProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Vue.VNode\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): Vue.VNode\n}\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Vue.VNode>,\n): LinkComponent<TComp> {\n return Vue.defineComponent({\n name: 'CreatedLink',\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n return () => Vue.h(LinkImpl as any, { ...attrs, _asChild: Comp }, slots)\n },\n }) as any\n}\n\nconst LinkImpl = Vue.defineComponent({\n name: 'Link',\n inheritAttrs: false,\n props: [\n '_asChild',\n 'to',\n 'preload',\n 'preloadDelay',\n 'preloadIntentProximity',\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'from',\n 'search',\n 'params',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n 'disabled',\n 'additionalProps',\n 'viewTransition',\n 'resetScroll',\n 'startTransition',\n 'hashScrollIntoView',\n 'replace',\n 'ignoreBlocker',\n 'target',\n ],\n setup(props, { attrs, slots }) {\n // Call useLinkProps ONCE during setup with combined props and attrs\n const allProps = { ...props, ...attrs }\n const linkPropsSource = useLinkProps(allProps as any) as\n | LinkHTMLAttributes\n | Vue.ComputedRef<LinkHTMLAttributes>\n\n return () => {\n const Component = props._asChild || 'a'\n\n const linkProps = Vue.unref(linkPropsSource)\n\n const isActive = linkProps['data-status'] === 'active'\n const isTransitioning =\n linkProps['data-transitioning'] === 'transitioning'\n\n // Create the slot content or empty array if no default slot\n const slotContent = slots.default\n ? slots.default({\n isActive,\n isTransitioning,\n })\n : []\n\n // Special handling for SVG links - wrap an <a> inside the SVG\n if (Component === 'svg') {\n // Create props without class for svg link\n const svgLinkProps = { ...linkProps }\n delete svgLinkProps.class\n return Vue.h('svg', {}, [Vue.h('a', svgLinkProps, slotContent)])\n }\n\n // For custom functional components (non-string), pass children as a prop\n // since they may expect children as a prop like in Solid\n if (typeof Component !== 'string') {\n return Vue.h(\n Component,\n { ...linkProps, children: slotContent },\n slotContent,\n )\n }\n\n // Return the component with props and children\n return Vue.h(Component, linkProps, slotContent)\n }\n },\n})\n\n/**\n * Link component with proper TypeScript generics support\n */\nexport const Link = LinkImpl as unknown as Vue.Component<unknown> &\n Vue.Component<CreateLinkProps> &\n LinkComponent<'a'>\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"mappings":";;;;;;;AA8BA,IAAMU,6BAAa,IAAIC,SAAqD;AA+C5E,SAAgBC,aAOdC,SACoB;CACpB,MAAMC,SAASN,WAAW;CAC1B,MAAMO,kBAAkBf,IAAIgB,IAAI,MAAM;CACtC,IAAIC,mBAAmB;AAGvB,KAAI,CAACH,QAAQ;AACXI,UAAQC,KAAK,8DAA8D;AAC3E,SAAOnB,IAAIoB,gBAAgB,EAAE,EAAE;;CAIjC,MAAMC,OAAOrB,IAAIoB,eAAe;AAC9B,MAAI;AACF,OAAIE,IAAI,GAAGT,QAAQU,KAAK;AACxB,UAAO;UACD;AACN,UAAO;;GAET;CAEF,MAAMP,MAAMhB,IAAIgB,IAAoB,KAAK;CACzC,M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IAAI+N,EAAE,KAAKU,cAAcF,YAAY,CAAC,CAAC;;AAKlE,OAAI,OAAOH,cAAc,SACvB,QAAOpO,IAAI+N,EACTK,WACA;IAAE,GAAGC;IAAWzE,UAAU2E;IAAa,EACvCA,YACD;AAIH,UAAOvO,IAAI+N,EAAEK,WAAWC,WAAWE,YAAY;;;CAGpD,CAAC;;;;AAKF,IAAaG,OAAOV;AAIpB,SAAS9H,YAAYL,GAAe;AAClC,QAAO,CAAC,EAAEA,EAAE8I,WAAW9I,EAAE+I,UAAU/I,EAAEgJ,WAAWhJ,EAAEiJ;;AAmBpD,IAAaC,eAAmClO,YAAY;AAC1D,QAAOA"}
@@ -1,13 +1,13 @@
1
- import { batch, createStore } from "@tanstack/vue-store";
1
+ import { batch, createAtom } from "@tanstack/vue-store";
2
2
  //#region src/routerStores.ts
3
3
  var getStoreFactory = (_opts) => {
4
4
  return {
5
- createMutableStore: createStore,
6
- createReadonlyStore: createStore,
5
+ createMutableStore: createAtom,
6
+ createReadonlyStore: createAtom,
7
7
  batch,
8
8
  init: (stores) => {
9
- stores.childMatchIdByRouteId = createStore(() => {
10
- const ids = stores.matchesId.state;
9
+ stores.childMatchIdByRouteId = createAtom(() => {
10
+ const ids = stores.matchesId.get();
11
11
  const obj = {};
12
12
  for (let i = 0; i < ids.length - 1; i++) {
13
13
  const parentStore = stores.activeMatchStoresById.get(ids[i]);
@@ -15,8 +15,8 @@ var getStoreFactory = (_opts) => {
15
15
  }
16
16
  return obj;
17
17
  });
18
- stores.pendingRouteIds = createStore(() => {
19
- const ids = stores.pendingMatchesId.state;
18
+ stores.pendingRouteIds = createAtom(() => {
19
+ const ids = stores.pendingMatchesId.get();
20
20
  const obj = {};
21
21
  for (const id of ids) {
22
22
  const store = stores.pendingMatchStoresById.get(id);
@@ -1 +1 @@
1
- {"version":3,"file":"routerStores.js","names":[],"sources":["../../src/routerStores.ts"],"sourcesContent":["import { batch, createStore } from '@tanstack/vue-store'\nimport type {\n AnyRoute,\n GetStoreConfig,\n RouterStores,\n} from '@tanstack/router-core'\nimport type { Readable } from '@tanstack/vue-store'\n\ndeclare module '@tanstack/router-core' {\n export interface RouterReadableStore<TValue> extends Readable<TValue> {}\n export interface RouterStores<in out TRouteTree extends AnyRoute> {\n /** Maps each active routeId to the matchId of its child in the match tree. */\n childMatchIdByRouteId: RouterReadableStore<Record<string, string>>\n /** Maps each pending routeId to true for quick lookup. */\n pendingRouteIds: RouterReadableStore<Record<string, boolean>>\n }\n}\n\nexport const getStoreFactory: GetStoreConfig = (_opts) => {\n return {\n createMutableStore: createStore,\n createReadonlyStore: createStore,\n batch,\n init: (stores: RouterStores<AnyRoute>) => {\n // Single derived store: one reactive node that maps every active\n // routeId to its child's matchId. Depends only on matchesId +\n // the pool's routeId tags (which are set during reconciliation).\n // Outlet reads the map and then does a direct pool lookup.\n stores.childMatchIdByRouteId = createStore(() => {\n const ids = stores.matchesId.state\n const obj: Record<string, string> = {}\n for (let i = 0; i < ids.length - 1; i++) {\n const parentStore = stores.activeMatchStoresById.get(ids[i]!)\n if (parentStore?.routeId) {\n obj[parentStore.routeId] = ids[i + 1]!\n }\n }\n return obj\n })\n\n stores.pendingRouteIds = createStore(() => {\n const ids = stores.pendingMatchesId.state\n const obj: Record<string, boolean> = {}\n for (const id of ids) {\n const store = stores.pendingMatchStoresById.get(id)\n if (store?.routeId) {\n obj[store.routeId] = true\n }\n }\n return obj\n })\n },\n }\n}\n"],"mappings":";;AAkBA,IAAa,mBAAmC,UAAU;AACxD,QAAO;EACL,oBAAoB;EACpB,qBAAqB;EACrB;EACA,OAAO,WAAmC;AAKxC,UAAO,wBAAwB,kBAAkB;IAC/C,MAAM,MAAM,OAAO,UAAU;IAC7B,MAAM,MAA8B,EAAE;AACtC,SAAK,IAAI,IAAI,GAAG,IAAI,IAAI,SAAS,GAAG,KAAK;KACvC,MAAM,cAAc,OAAO,sBAAsB,IAAI,IAAI,GAAI;AAC7D,SAAI,aAAa,QACf,KAAI,YAAY,WAAW,IAAI,IAAI;;AAGvC,WAAO;KACP;AAEF,UAAO,kBAAkB,kBAAkB;IACzC,MAAM,MAAM,OAAO,iBAAiB;IACpC,MAAM,MAA+B,EAAE;AACvC,SAAK,MAAM,MAAM,KAAK;KACpB,MAAM,QAAQ,OAAO,uBAAuB,IAAI,GAAG;AACnD,SAAI,OAAO,QACT,KAAI,MAAM,WAAW;;AAGzB,WAAO;KACP;;EAEL"}
1
+ {"version":3,"file":"routerStores.js","names":[],"sources":["../../src/routerStores.ts"],"sourcesContent":["import { batch, createAtom } from '@tanstack/vue-store'\nimport type {\n AnyRoute,\n GetStoreConfig,\n RouterStores,\n} from '@tanstack/router-core'\nimport type { Readable } from '@tanstack/vue-store'\n\ndeclare module '@tanstack/router-core' {\n export interface RouterReadableStore<TValue> extends Readable<TValue> {}\n export interface RouterStores<in out TRouteTree extends AnyRoute> {\n /** Maps each active routeId to the matchId of its child in the match tree. */\n childMatchIdByRouteId: RouterReadableStore<Record<string, string>>\n /** Maps each pending routeId to true for quick lookup. */\n pendingRouteIds: RouterReadableStore<Record<string, boolean>>\n }\n}\n\nexport const getStoreFactory: GetStoreConfig = (_opts) => {\n return {\n createMutableStore: createAtom,\n createReadonlyStore: createAtom,\n batch,\n init: (stores: RouterStores<AnyRoute>) => {\n // Single derived store: one reactive node that maps every active\n // routeId to its child's matchId. Depends only on matchesId +\n // the pool's routeId tags (which are set during reconciliation).\n // Outlet reads the map and then does a direct pool lookup.\n stores.childMatchIdByRouteId = createAtom(() => {\n const ids = stores.matchesId.get()\n const obj: Record<string, string> = {}\n for (let i = 0; i < ids.length - 1; i++) {\n const parentStore = stores.activeMatchStoresById.get(ids[i]!)\n if (parentStore?.routeId) {\n obj[parentStore.routeId] = ids[i + 1]!\n }\n }\n return obj\n })\n\n stores.pendingRouteIds = createAtom(() => {\n const ids = stores.pendingMatchesId.get()\n const obj: Record<string, boolean> = {}\n for (const id of ids) {\n const store = stores.pendingMatchStoresById.get(id)\n if (store?.routeId) {\n obj[store.routeId] = true\n }\n }\n return obj\n })\n },\n }\n}\n"],"mappings":";;AAkBA,IAAa,mBAAmC,UAAU;AACxD,QAAO;EACL,oBAAoB;EACpB,qBAAqB;EACrB;EACA,OAAO,WAAmC;AAKxC,UAAO,wBAAwB,iBAAiB;IAC9C,MAAM,MAAM,OAAO,UAAU,KAAK;IAClC,MAAM,MAA8B,EAAE;AACtC,SAAK,IAAI,IAAI,GAAG,IAAI,IAAI,SAAS,GAAG,KAAK;KACvC,MAAM,cAAc,OAAO,sBAAsB,IAAI,IAAI,GAAI;AAC7D,SAAI,aAAa,QACf,KAAI,YAAY,WAAW,IAAI,IAAI;;AAGvC,WAAO;KACP;AAEF,UAAO,kBAAkB,iBAAiB;IACxC,MAAM,MAAM,OAAO,iBAAiB,KAAK;IACzC,MAAM,MAA+B,EAAE;AACvC,SAAK,MAAM,MAAM,KAAK;KACpB,MAAM,QAAQ,OAAO,uBAAuB,IAAI,GAAG;AACnD,SAAI,OAAO,QACT,KAAI,MAAM,WAAW;;AAGzB,WAAO;KACP;;EAEL"}
@@ -12,7 +12,7 @@ var RouterClient = Vue.defineComponent({
12
12
  } },
13
13
  setup(props) {
14
14
  const isHydrated = Vue.ref(false);
15
- if (!hydrationPromise) if (!props.router.stores.matchesId.state.length) hydrationPromise = hydrate(props.router);
15
+ if (!hydrationPromise) if (!props.router.stores.matchesId.get().length) hydrationPromise = hydrate(props.router);
16
16
  else hydrationPromise = Promise.resolve();
17
17
  Vue.onMounted(() => {
18
18
  hydrationPromise.then(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"RouterClient.js","names":["Vue","hydrate","HeadContent","RouterProvider","hydrationPromise","RouterClient","defineComponent","name","props","router","type","Object","required","setup","isHydrated","ref","stores","matchesId","state","length","Promise","resolve","onMounted","then","value","window","h","innerWrap","innerProps","children"],"sources":["../../../src/ssr/RouterClient.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { hydrate } from '@tanstack/router-core/ssr/client'\nimport { HeadContent } from '../HeadContent'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nlet hydrationPromise: Promise<void | Array<Array<void>>> | undefined\n\nexport const RouterClient = Vue.defineComponent({\n name: 'RouterClient',\n props: {\n router: {\n type: Object as () => AnyRouter,\n required: true,\n },\n },\n setup(props) {\n const isHydrated = Vue.ref(false)\n\n if (!hydrationPromise) {\n if (!props.router.stores.matchesId.state.length) {\n hydrationPromise = hydrate(props.router)\n } else {\n hydrationPromise = Promise.resolve()\n }\n }\n\n Vue.onMounted(() => {\n hydrationPromise!.then(() => {\n isHydrated.value = true\n })\n })\n\n // For SSR, we're already hydrated\n if (typeof window === 'undefined') {\n isHydrated.value = true\n }\n\n return () => {\n if (!isHydrated.value) {\n return null\n }\n\n return Vue.h(\n RouterProvider,\n {\n router: props.router,\n },\n {\n innerWrap: (innerProps: { children: any }) => [\n Vue.h(HeadContent),\n innerProps.children,\n ],\n },\n )\n }\n },\n})\n"],"mappings":";;;;;AAMA,IAAII;AAEJ,IAAaC,eAAeL,IAAIM,gBAAgB;CAC9CC,MAAM;CACNC,OAAO,EACLC,QAAQ;EACNC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,aAAad,IAAIe,IAAI,MAAM;AAEjC,MAAI,CAACX,iBACH,KAAI,CAACI,MAAMC,OAAOO,OAAOC,UAAUC,MAAMC,OACvCf,oBAAmBH,QAAQO,MAAMC,OAAO;MAExCL,oBAAmBgB,QAAQC,SAAS;AAIxCrB,MAAIsB,gBAAgB;AAClBlB,oBAAkBmB,WAAW;AAC3BT,eAAWU,QAAQ;KACnB;IACF;AAGF,MAAI,OAAOC,WAAW,YACpBX,YAAWU,QAAQ;AAGrB,eAAa;AACX,OAAI,CAACV,WAAWU,MACd,QAAO;AAGT,UAAOxB,IAAI0B,EACTvB,gBACA,EACEM,QAAQD,MAAMC,QACf,EACD,EACEkB,YAAYC,eAAkC,CAC5C5B,IAAI0B,EAAExB,YAAY,EAClB0B,WAAWC,SAAQ,EAGzB,CAAC;;;CAGN,CAAC"}
1
+ {"version":3,"file":"RouterClient.js","names":["Vue","hydrate","HeadContent","RouterProvider","hydrationPromise","RouterClient","defineComponent","name","props","router","type","Object","required","setup","isHydrated","ref","stores","matchesId","get","length","Promise","resolve","onMounted","then","value","window","h","innerWrap","innerProps","children"],"sources":["../../../src/ssr/RouterClient.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { hydrate } from '@tanstack/router-core/ssr/client'\nimport { HeadContent } from '../HeadContent'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nlet hydrationPromise: Promise<void | Array<Array<void>>> | undefined\n\nexport const RouterClient = Vue.defineComponent({\n name: 'RouterClient',\n props: {\n router: {\n type: Object as () => AnyRouter,\n required: true,\n },\n },\n setup(props) {\n const isHydrated = Vue.ref(false)\n\n if (!hydrationPromise) {\n if (!props.router.stores.matchesId.get().length) {\n hydrationPromise = hydrate(props.router)\n } else {\n hydrationPromise = Promise.resolve()\n }\n }\n\n Vue.onMounted(() => {\n hydrationPromise!.then(() => {\n isHydrated.value = true\n })\n })\n\n // For SSR, we're already hydrated\n if (typeof window === 'undefined') {\n isHydrated.value = true\n }\n\n return () => {\n if (!isHydrated.value) {\n return null\n }\n\n return Vue.h(\n RouterProvider,\n {\n router: props.router,\n },\n {\n innerWrap: (innerProps: { children: any }) => [\n Vue.h(HeadContent),\n innerProps.children,\n ],\n },\n )\n }\n },\n})\n"],"mappings":";;;;;AAMA,IAAII;AAEJ,IAAaC,eAAeL,IAAIM,gBAAgB;CAC9CC,MAAM;CACNC,OAAO,EACLC,QAAQ;EACNC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,aAAad,IAAIe,IAAI,MAAM;AAEjC,MAAI,CAACX,iBACH,KAAI,CAACI,MAAMC,OAAOO,OAAOC,UAAUC,KAAK,CAACC,OACvCf,oBAAmBH,QAAQO,MAAMC,OAAO;MAExCL,oBAAmBgB,QAAQC,SAAS;AAIxCrB,MAAIsB,gBAAgB;AAClBlB,oBAAkBmB,WAAW;AAC3BT,eAAWU,QAAQ;KACnB;IACF;AAGF,MAAI,OAAOC,WAAW,YACpBX,YAAWU,QAAQ;AAGrB,eAAa;AACX,OAAI,CAACV,WAAWU,MACd,QAAO;AAGT,UAAOxB,IAAI0B,EACTvB,gBACA,EACEM,QAAQD,MAAMC,QACf,EACD,EACEkB,YAAYC,eAAkC,CAC5C5B,IAAI0B,EAAExB,YAAY,EAClB0B,WAAWC,SAAQ,EAGzB,CAAC;;;CAGN,CAAC"}