@tanstack/react-router 1.168.13 → 1.168.15

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 (144) hide show
  1. package/dist/cjs/Asset.cjs +1 -0
  2. package/dist/cjs/Asset.cjs.map +1 -1
  3. package/dist/cjs/CatchBoundary.cjs +1 -0
  4. package/dist/cjs/CatchBoundary.cjs.map +1 -1
  5. package/dist/cjs/ClientOnly.cjs +1 -0
  6. package/dist/cjs/ClientOnly.cjs.map +1 -1
  7. package/dist/cjs/HeadContent.cjs +1 -0
  8. package/dist/cjs/HeadContent.cjs.map +1 -1
  9. package/dist/cjs/HeadContent.dev.cjs +1 -0
  10. package/dist/cjs/HeadContent.dev.cjs.map +1 -1
  11. package/dist/cjs/Match.cjs +9 -8
  12. package/dist/cjs/Match.cjs.map +1 -1
  13. package/dist/cjs/Matches.cjs +6 -5
  14. package/dist/cjs/Matches.cjs.map +1 -1
  15. package/dist/cjs/RouterProvider.cjs +1 -0
  16. package/dist/cjs/RouterProvider.cjs.map +1 -1
  17. package/dist/cjs/Scripts.cjs +5 -4
  18. package/dist/cjs/Scripts.cjs.map +1 -1
  19. package/dist/cjs/Transitioner.cjs +9 -8
  20. package/dist/cjs/Transitioner.cjs.map +1 -1
  21. package/dist/cjs/headContentUtils.cjs +6 -6
  22. package/dist/cjs/headContentUtils.cjs.map +1 -1
  23. package/dist/cjs/index.cjs +1 -0
  24. package/dist/cjs/index.d.cts +1 -1
  25. package/dist/cjs/index.dev.cjs +1 -0
  26. package/dist/cjs/link.cjs +2 -1
  27. package/dist/cjs/link.cjs.map +1 -1
  28. package/dist/cjs/matchContext.cjs +1 -0
  29. package/dist/cjs/matchContext.cjs.map +1 -1
  30. package/dist/cjs/not-found.cjs +1 -1
  31. package/dist/cjs/not-found.cjs.map +1 -1
  32. package/dist/cjs/routerContext.cjs +1 -0
  33. package/dist/cjs/routerContext.cjs.map +1 -1
  34. package/dist/cjs/routerStores.cjs +2 -2
  35. package/dist/cjs/routerStores.cjs.map +1 -1
  36. package/dist/cjs/ssr/RouterClient.cjs +1 -1
  37. package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
  38. package/dist/cjs/ssr/renderRouterToStream.cjs +2 -2
  39. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
  40. package/dist/cjs/ssr/renderRouterToString.cjs +1 -1
  41. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
  42. package/dist/cjs/useBlocker.cjs +1 -0
  43. package/dist/cjs/useBlocker.cjs.map +1 -1
  44. package/dist/cjs/useCanGoBack.cjs +1 -1
  45. package/dist/cjs/useCanGoBack.cjs.map +1 -1
  46. package/dist/cjs/useLocation.cjs +1 -1
  47. package/dist/cjs/useLocation.cjs.map +1 -1
  48. package/dist/cjs/useMatch.cjs +4 -4
  49. package/dist/cjs/useMatch.cjs.map +1 -1
  50. package/dist/cjs/useNavigate.cjs +1 -0
  51. package/dist/cjs/useNavigate.cjs.map +1 -1
  52. package/dist/cjs/useRouter.cjs +1 -0
  53. package/dist/cjs/useRouter.cjs.map +1 -1
  54. package/dist/cjs/useRouterState.cjs +2 -1
  55. package/dist/cjs/useRouterState.cjs.map +1 -1
  56. package/dist/cjs/utils.cjs +1 -0
  57. package/dist/cjs/utils.cjs.map +1 -1
  58. package/dist/esm/Asset.js +1 -0
  59. package/dist/esm/Asset.js.map +1 -1
  60. package/dist/esm/CatchBoundary.js +1 -0
  61. package/dist/esm/CatchBoundary.js.map +1 -1
  62. package/dist/esm/ClientOnly.js +1 -0
  63. package/dist/esm/ClientOnly.js.map +1 -1
  64. package/dist/esm/HeadContent.dev.js +1 -0
  65. package/dist/esm/HeadContent.dev.js.map +1 -1
  66. package/dist/esm/HeadContent.js +1 -0
  67. package/dist/esm/HeadContent.js.map +1 -1
  68. package/dist/esm/Match.js +9 -8
  69. package/dist/esm/Match.js.map +1 -1
  70. package/dist/esm/Matches.js +6 -5
  71. package/dist/esm/Matches.js.map +1 -1
  72. package/dist/esm/RouterProvider.js +1 -0
  73. package/dist/esm/RouterProvider.js.map +1 -1
  74. package/dist/esm/Scripts.js +5 -4
  75. package/dist/esm/Scripts.js.map +1 -1
  76. package/dist/esm/Transitioner.js +9 -8
  77. package/dist/esm/Transitioner.js.map +1 -1
  78. package/dist/esm/headContentUtils.js +6 -6
  79. package/dist/esm/headContentUtils.js.map +1 -1
  80. package/dist/esm/index.d.ts +1 -1
  81. package/dist/esm/index.dev.js +1 -0
  82. package/dist/esm/index.js +1 -0
  83. package/dist/esm/link.js +2 -1
  84. package/dist/esm/link.js.map +1 -1
  85. package/dist/esm/matchContext.js +1 -0
  86. package/dist/esm/matchContext.js.map +1 -1
  87. package/dist/esm/not-found.js +1 -1
  88. package/dist/esm/not-found.js.map +1 -1
  89. package/dist/esm/routerContext.js +1 -0
  90. package/dist/esm/routerContext.js.map +1 -1
  91. package/dist/esm/routerStores.js +3 -3
  92. package/dist/esm/routerStores.js.map +1 -1
  93. package/dist/esm/ssr/RouterClient.js +1 -1
  94. package/dist/esm/ssr/RouterClient.js.map +1 -1
  95. package/dist/esm/ssr/renderRouterToStream.js +2 -2
  96. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  97. package/dist/esm/ssr/renderRouterToString.js +1 -1
  98. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  99. package/dist/esm/useBlocker.js +1 -0
  100. package/dist/esm/useBlocker.js.map +1 -1
  101. package/dist/esm/useCanGoBack.js +1 -1
  102. package/dist/esm/useCanGoBack.js.map +1 -1
  103. package/dist/esm/useLocation.js +1 -1
  104. package/dist/esm/useLocation.js.map +1 -1
  105. package/dist/esm/useMatch.js +4 -4
  106. package/dist/esm/useMatch.js.map +1 -1
  107. package/dist/esm/useNavigate.js +1 -0
  108. package/dist/esm/useNavigate.js.map +1 -1
  109. package/dist/esm/useRouter.js +1 -0
  110. package/dist/esm/useRouter.js.map +1 -1
  111. package/dist/esm/useRouterState.js +2 -1
  112. package/dist/esm/useRouterState.js.map +1 -1
  113. package/dist/esm/utils.js +1 -0
  114. package/dist/esm/utils.js.map +1 -1
  115. package/package.json +2 -2
  116. package/src/Asset.tsx +2 -0
  117. package/src/CatchBoundary.tsx +2 -0
  118. package/src/ClientOnly.tsx +2 -0
  119. package/src/HeadContent.dev.tsx +2 -0
  120. package/src/HeadContent.tsx +2 -0
  121. package/src/Match.tsx +11 -9
  122. package/src/Matches.tsx +8 -6
  123. package/src/RouterProvider.tsx +2 -0
  124. package/src/Scripts.tsx +5 -10
  125. package/src/Transitioner.tsx +13 -16
  126. package/src/headContentUtils.tsx +6 -6
  127. package/src/index.dev.tsx +2 -0
  128. package/src/index.tsx +5 -0
  129. package/src/link.tsx +3 -1
  130. package/src/matchContext.tsx +2 -0
  131. package/src/not-found.tsx +2 -2
  132. package/src/routerContext.tsx +2 -0
  133. package/src/routerStores.ts +3 -3
  134. package/src/ssr/RouterClient.tsx +1 -1
  135. package/src/ssr/renderRouterToStream.tsx +2 -2
  136. package/src/ssr/renderRouterToString.tsx +1 -1
  137. package/src/useBlocker.tsx +2 -0
  138. package/src/useCanGoBack.ts +1 -1
  139. package/src/useLocation.tsx +1 -1
  140. package/src/useMatch.tsx +6 -5
  141. package/src/useNavigate.tsx +2 -0
  142. package/src/useRouter.tsx +2 -0
  143. package/src/useRouterState.tsx +3 -1
  144. package/src/utils.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useBlocker.cjs","names":[],"sources":["../../src/useBlocker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useRouter } from './useRouter'\nimport type {\n BlockerFnArgs,\n HistoryAction,\n HistoryLocation,\n} from '@tanstack/history'\nimport type {\n AnyRoute,\n AnyRouter,\n ParseRoute,\n RegisteredRouter,\n} from '@tanstack/router-core'\n\ntype ShouldBlockFnLocation<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n> = {\n routeId: TRouteId\n fullPath: TFullPath\n pathname: string\n params: TAllParams\n search: TFullSearchSchema\n}\n\ntype AnyShouldBlockFnLocation = ShouldBlockFnLocation<any, any, any, any>\ntype MakeShouldBlockFnLocationUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? ShouldBlockFnLocation<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema']\n >\n : never\n\ntype BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> =\n | {\n status: 'blocked'\n current: MakeShouldBlockFnLocationUnion<TRouter>\n next: MakeShouldBlockFnLocationUnion<TRouter>\n action: HistoryAction\n proceed: () => void\n reset: () => void\n }\n | {\n status: 'idle'\n current: undefined\n next: undefined\n action: undefined\n proceed: undefined\n reset: undefined\n }\n\ntype ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {\n current: MakeShouldBlockFnLocationUnion<TRouter>\n next: MakeShouldBlockFnLocationUnion<TRouter>\n action: HistoryAction\n}\n\nexport type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (\n args: ShouldBlockFnArgs<TRouter>,\n) => boolean | Promise<boolean>\nexport type UseBlockerOpts<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n> = {\n shouldBlockFn: ShouldBlockFn<TRouter>\n enableBeforeUnload?: boolean | (() => boolean)\n disabled?: boolean\n withResolver?: TWithResolver\n}\n\ntype LegacyBlockerFn = () => Promise<any> | any\ntype LegacyBlockerOpts = {\n blockerFn?: LegacyBlockerFn\n condition?: boolean | any\n}\n\nfunction _resolveBlockerOpts(\n opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n condition?: boolean | any,\n): UseBlockerOpts {\n if (opts === undefined) {\n return {\n shouldBlockFn: () => true,\n withResolver: false,\n }\n }\n\n if ('shouldBlockFn' in opts) {\n return opts\n }\n\n if (typeof opts === 'function') {\n const shouldBlock = Boolean(condition ?? true)\n\n const _customBlockerFn = async () => {\n if (shouldBlock) return await opts()\n return false\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: false,\n }\n }\n\n const shouldBlock = Boolean(opts.condition ?? true)\n const fn = opts.blockerFn\n\n const _customBlockerFn = async () => {\n if (shouldBlock && fn !== undefined) {\n return await fn()\n }\n return shouldBlock\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: fn === undefined,\n }\n}\n\nexport function useBlocker<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = false,\n>(\n opts: UseBlockerOpts<TRouter, TWithResolver>,\n): TWithResolver extends true ? BlockerResolver<TRouter> : void\n\n/**\n * @deprecated Use the shouldBlockFn property instead\n */\nexport function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver\n\n/**\n * @deprecated Use the UseBlockerOpts object syntax instead\n */\nexport function useBlocker(\n blockerFn?: LegacyBlockerFn,\n condition?: boolean | any,\n): BlockerResolver\n\nexport function useBlocker(\n opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n condition?: boolean | any,\n): BlockerResolver | void {\n const {\n shouldBlockFn,\n enableBeforeUnload = true,\n disabled = false,\n withResolver = false,\n } = _resolveBlockerOpts(opts, condition)\n\n const router = useRouter()\n const { history } = router\n\n const [resolver, setResolver] = React.useState<BlockerResolver>({\n status: 'idle',\n current: undefined,\n next: undefined,\n action: undefined,\n proceed: undefined,\n reset: undefined,\n })\n\n React.useEffect(() => {\n const blockerFnComposed = async (blockerFnArgs: BlockerFnArgs) => {\n function getLocation(\n location: HistoryLocation,\n ): AnyShouldBlockFnLocation {\n const parsedLocation = router.parseLocation(location)\n const matchedRoutes = router.getMatchedRoutes(parsedLocation.pathname)\n if (matchedRoutes.foundRoute === undefined) {\n return {\n routeId: '__notFound__',\n fullPath: parsedLocation.pathname,\n pathname: parsedLocation.pathname,\n params: matchedRoutes.routeParams,\n search: router.options.parseSearch(location.search),\n }\n }\n\n return {\n routeId: matchedRoutes.foundRoute.id,\n fullPath: matchedRoutes.foundRoute.fullPath,\n pathname: parsedLocation.pathname,\n params: matchedRoutes.routeParams,\n search: router.options.parseSearch(location.search),\n }\n }\n\n const current = getLocation(blockerFnArgs.currentLocation)\n const next = getLocation(blockerFnArgs.nextLocation)\n\n if (\n current.routeId === '__notFound__' &&\n next.routeId !== '__notFound__'\n ) {\n return false\n }\n\n const shouldBlock = await shouldBlockFn({\n action: blockerFnArgs.action,\n current,\n next,\n })\n if (!withResolver) {\n return shouldBlock\n }\n\n if (!shouldBlock) {\n return false\n }\n\n const promise = new Promise<boolean>((resolve) => {\n setResolver({\n status: 'blocked',\n current,\n next,\n action: blockerFnArgs.action,\n proceed: () => resolve(false),\n reset: () => resolve(true),\n })\n })\n\n const canNavigateAsync = await promise\n setResolver({\n status: 'idle',\n current: undefined,\n next: undefined,\n action: undefined,\n proceed: undefined,\n reset: undefined,\n })\n\n return canNavigateAsync\n }\n\n return disabled\n ? undefined\n : history.block({ blockerFn: blockerFnComposed, enableBeforeUnload })\n }, [\n shouldBlockFn,\n enableBeforeUnload,\n disabled,\n withResolver,\n history,\n router,\n ])\n\n return resolver\n}\n\nconst _resolvePromptBlockerArgs = (\n props: PromptProps | LegacyPromptProps,\n): UseBlockerOpts => {\n if ('shouldBlockFn' in props) {\n return { ...props }\n }\n\n const shouldBlock = Boolean(props.condition ?? true)\n const fn = props.blockerFn\n\n const _customBlockerFn = async () => {\n if (shouldBlock && fn !== undefined) {\n return await fn()\n }\n return shouldBlock\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: fn === undefined,\n }\n}\n\nexport function Block<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n>(opts: PromptProps<TRouter, TWithResolver>): React.ReactNode\n\n/**\n * @deprecated Use the UseBlockerOpts property instead\n */\nexport function Block(opts: LegacyPromptProps): React.ReactNode\n\nexport function Block(opts: PromptProps | LegacyPromptProps): React.ReactNode {\n const { children, ...rest } = opts\n const args = _resolvePromptBlockerArgs(rest)\n\n const resolver = useBlocker(args)\n return children\n ? typeof children === 'function'\n ? children(resolver as any)\n : children\n : null\n}\n\ntype LegacyPromptProps = {\n blockerFn?: LegacyBlockerFn\n condition?: boolean | any\n children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode)\n}\n\ntype PromptProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void,\n> = UseBlockerOpts<TRouter, TWithResolver> & {\n children?: React.ReactNode | ((params: TParams) => React.ReactNode)\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"useBlocker.cjs","names":[],"sources":["../../src/useBlocker.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useRouter } from './useRouter'\nimport type {\n BlockerFnArgs,\n HistoryAction,\n HistoryLocation,\n} from '@tanstack/history'\nimport type {\n AnyRoute,\n AnyRouter,\n ParseRoute,\n RegisteredRouter,\n} from '@tanstack/router-core'\n\ntype ShouldBlockFnLocation<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n> = {\n routeId: TRouteId\n fullPath: TFullPath\n pathname: string\n params: TAllParams\n search: TFullSearchSchema\n}\n\ntype AnyShouldBlockFnLocation = ShouldBlockFnLocation<any, any, any, any>\ntype MakeShouldBlockFnLocationUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? ShouldBlockFnLocation<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema']\n >\n : never\n\ntype BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> =\n | {\n status: 'blocked'\n current: MakeShouldBlockFnLocationUnion<TRouter>\n next: MakeShouldBlockFnLocationUnion<TRouter>\n action: HistoryAction\n proceed: () => void\n reset: () => void\n }\n | {\n status: 'idle'\n current: undefined\n next: undefined\n action: undefined\n proceed: undefined\n reset: undefined\n }\n\ntype ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {\n current: MakeShouldBlockFnLocationUnion<TRouter>\n next: MakeShouldBlockFnLocationUnion<TRouter>\n action: HistoryAction\n}\n\nexport type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (\n args: ShouldBlockFnArgs<TRouter>,\n) => boolean | Promise<boolean>\nexport type UseBlockerOpts<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n> = {\n shouldBlockFn: ShouldBlockFn<TRouter>\n enableBeforeUnload?: boolean | (() => boolean)\n disabled?: boolean\n withResolver?: TWithResolver\n}\n\ntype LegacyBlockerFn = () => Promise<any> | any\ntype LegacyBlockerOpts = {\n blockerFn?: LegacyBlockerFn\n condition?: boolean | any\n}\n\nfunction _resolveBlockerOpts(\n opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n condition?: boolean | any,\n): UseBlockerOpts {\n if (opts === undefined) {\n return {\n shouldBlockFn: () => true,\n withResolver: false,\n }\n }\n\n if ('shouldBlockFn' in opts) {\n return opts\n }\n\n if (typeof opts === 'function') {\n const shouldBlock = Boolean(condition ?? true)\n\n const _customBlockerFn = async () => {\n if (shouldBlock) return await opts()\n return false\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: false,\n }\n }\n\n const shouldBlock = Boolean(opts.condition ?? true)\n const fn = opts.blockerFn\n\n const _customBlockerFn = async () => {\n if (shouldBlock && fn !== undefined) {\n return await fn()\n }\n return shouldBlock\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: fn === undefined,\n }\n}\n\nexport function useBlocker<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = false,\n>(\n opts: UseBlockerOpts<TRouter, TWithResolver>,\n): TWithResolver extends true ? BlockerResolver<TRouter> : void\n\n/**\n * @deprecated Use the shouldBlockFn property instead\n */\nexport function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver\n\n/**\n * @deprecated Use the UseBlockerOpts object syntax instead\n */\nexport function useBlocker(\n blockerFn?: LegacyBlockerFn,\n condition?: boolean | any,\n): BlockerResolver\n\nexport function useBlocker(\n opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n condition?: boolean | any,\n): BlockerResolver | void {\n const {\n shouldBlockFn,\n enableBeforeUnload = true,\n disabled = false,\n withResolver = false,\n } = _resolveBlockerOpts(opts, condition)\n\n const router = useRouter()\n const { history } = router\n\n const [resolver, setResolver] = React.useState<BlockerResolver>({\n status: 'idle',\n current: undefined,\n next: undefined,\n action: undefined,\n proceed: undefined,\n reset: undefined,\n })\n\n React.useEffect(() => {\n const blockerFnComposed = async (blockerFnArgs: BlockerFnArgs) => {\n function getLocation(\n location: HistoryLocation,\n ): AnyShouldBlockFnLocation {\n const parsedLocation = router.parseLocation(location)\n const matchedRoutes = router.getMatchedRoutes(parsedLocation.pathname)\n if (matchedRoutes.foundRoute === undefined) {\n return {\n routeId: '__notFound__',\n fullPath: parsedLocation.pathname,\n pathname: parsedLocation.pathname,\n params: matchedRoutes.routeParams,\n search: router.options.parseSearch(location.search),\n }\n }\n\n return {\n routeId: matchedRoutes.foundRoute.id,\n fullPath: matchedRoutes.foundRoute.fullPath,\n pathname: parsedLocation.pathname,\n params: matchedRoutes.routeParams,\n search: router.options.parseSearch(location.search),\n }\n }\n\n const current = getLocation(blockerFnArgs.currentLocation)\n const next = getLocation(blockerFnArgs.nextLocation)\n\n if (\n current.routeId === '__notFound__' &&\n next.routeId !== '__notFound__'\n ) {\n return false\n }\n\n const shouldBlock = await shouldBlockFn({\n action: blockerFnArgs.action,\n current,\n next,\n })\n if (!withResolver) {\n return shouldBlock\n }\n\n if (!shouldBlock) {\n return false\n }\n\n const promise = new Promise<boolean>((resolve) => {\n setResolver({\n status: 'blocked',\n current,\n next,\n action: blockerFnArgs.action,\n proceed: () => resolve(false),\n reset: () => resolve(true),\n })\n })\n\n const canNavigateAsync = await promise\n setResolver({\n status: 'idle',\n current: undefined,\n next: undefined,\n action: undefined,\n proceed: undefined,\n reset: undefined,\n })\n\n return canNavigateAsync\n }\n\n return disabled\n ? undefined\n : history.block({ blockerFn: blockerFnComposed, enableBeforeUnload })\n }, [\n shouldBlockFn,\n enableBeforeUnload,\n disabled,\n withResolver,\n history,\n router,\n ])\n\n return resolver\n}\n\nconst _resolvePromptBlockerArgs = (\n props: PromptProps | LegacyPromptProps,\n): UseBlockerOpts => {\n if ('shouldBlockFn' in props) {\n return { ...props }\n }\n\n const shouldBlock = Boolean(props.condition ?? true)\n const fn = props.blockerFn\n\n const _customBlockerFn = async () => {\n if (shouldBlock && fn !== undefined) {\n return await fn()\n }\n return shouldBlock\n }\n\n return {\n shouldBlockFn: _customBlockerFn,\n enableBeforeUnload: shouldBlock,\n withResolver: fn === undefined,\n }\n}\n\nexport function Block<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n>(opts: PromptProps<TRouter, TWithResolver>): React.ReactNode\n\n/**\n * @deprecated Use the UseBlockerOpts property instead\n */\nexport function Block(opts: LegacyPromptProps): React.ReactNode\n\nexport function Block(opts: PromptProps | LegacyPromptProps): React.ReactNode {\n const { children, ...rest } = opts\n const args = _resolvePromptBlockerArgs(rest)\n\n const resolver = useBlocker(args)\n return children\n ? typeof children === 'function'\n ? children(resolver as any)\n : children\n : null\n}\n\ntype LegacyPromptProps = {\n blockerFn?: LegacyBlockerFn\n condition?: boolean | any\n children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode)\n}\n\ntype PromptProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TWithResolver extends boolean = boolean,\n TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void,\n> = UseBlockerOpts<TRouter, TWithResolver> & {\n children?: React.ReactNode | ((params: TParams) => React.ReactNode)\n}\n"],"mappings":";;;;;;AAqFA,SAAS,oBACP,MACA,WACgB;AAChB,KAAI,SAAS,KAAA,EACX,QAAO;EACL,qBAAqB;EACrB,cAAc;EACf;AAGH,KAAI,mBAAmB,KACrB,QAAO;AAGT,KAAI,OAAO,SAAS,YAAY;EAC9B,MAAM,cAAc,QAAQ,aAAa,KAAK;EAE9C,MAAM,mBAAmB,YAAY;AACnC,OAAI,YAAa,QAAO,MAAM,MAAM;AACpC,UAAO;;AAGT,SAAO;GACL,eAAe;GACf,oBAAoB;GACpB,cAAc;GACf;;CAGH,MAAM,cAAc,QAAQ,KAAK,aAAa,KAAK;CACnD,MAAM,KAAK,KAAK;CAEhB,MAAM,mBAAmB,YAAY;AACnC,MAAI,eAAe,OAAO,KAAA,EACxB,QAAO,MAAM,IAAI;AAEnB,SAAO;;AAGT,QAAO;EACL,eAAe;EACf,oBAAoB;EACpB,cAAc,OAAO,KAAA;EACtB;;AAuBH,SAAgB,WACd,MACA,WACwB;CACxB,MAAM,EACJ,eACA,qBAAqB,MACrB,WAAW,OACX,eAAe,UACb,oBAAoB,MAAM,UAAU;CAExC,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,EAAE,YAAY;CAEpB,MAAM,CAAC,UAAU,eAAe,MAAM,SAA0B;EAC9D,QAAQ;EACR,SAAS,KAAA;EACT,MAAM,KAAA;EACN,QAAQ,KAAA;EACR,SAAS,KAAA;EACT,OAAO,KAAA;EACR,CAAC;AAEF,OAAM,gBAAgB;EACpB,MAAM,oBAAoB,OAAO,kBAAiC;GAChE,SAAS,YACP,UAC0B;IAC1B,MAAM,iBAAiB,OAAO,cAAc,SAAS;IACrD,MAAM,gBAAgB,OAAO,iBAAiB,eAAe,SAAS;AACtE,QAAI,cAAc,eAAe,KAAA,EAC/B,QAAO;KACL,SAAS;KACT,UAAU,eAAe;KACzB,UAAU,eAAe;KACzB,QAAQ,cAAc;KACtB,QAAQ,OAAO,QAAQ,YAAY,SAAS,OAAO;KACpD;AAGH,WAAO;KACL,SAAS,cAAc,WAAW;KAClC,UAAU,cAAc,WAAW;KACnC,UAAU,eAAe;KACzB,QAAQ,cAAc;KACtB,QAAQ,OAAO,QAAQ,YAAY,SAAS,OAAO;KACpD;;GAGH,MAAM,UAAU,YAAY,cAAc,gBAAgB;GAC1D,MAAM,OAAO,YAAY,cAAc,aAAa;AAEpD,OACE,QAAQ,YAAY,kBACpB,KAAK,YAAY,eAEjB,QAAO;GAGT,MAAM,cAAc,MAAM,cAAc;IACtC,QAAQ,cAAc;IACtB;IACA;IACD,CAAC;AACF,OAAI,CAAC,aACH,QAAO;AAGT,OAAI,CAAC,YACH,QAAO;GAcT,MAAM,mBAAmB,MAXT,IAAI,SAAkB,YAAY;AAChD,gBAAY;KACV,QAAQ;KACR;KACA;KACA,QAAQ,cAAc;KACtB,eAAe,QAAQ,MAAM;KAC7B,aAAa,QAAQ,KAAK;KAC3B,CAAC;KACF;AAGF,eAAY;IACV,QAAQ;IACR,SAAS,KAAA;IACT,MAAM,KAAA;IACN,QAAQ,KAAA;IACR,SAAS,KAAA;IACT,OAAO,KAAA;IACR,CAAC;AAEF,UAAO;;AAGT,SAAO,WACH,KAAA,IACA,QAAQ,MAAM;GAAE,WAAW;GAAmB;GAAoB,CAAC;IACtE;EACD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO;;AAGT,IAAM,6BACJ,UACmB;AACnB,KAAI,mBAAmB,MACrB,QAAO,EAAE,GAAG,OAAO;CAGrB,MAAM,cAAc,QAAQ,MAAM,aAAa,KAAK;CACpD,MAAM,KAAK,MAAM;CAEjB,MAAM,mBAAmB,YAAY;AACnC,MAAI,eAAe,OAAO,KAAA,EACxB,QAAO,MAAM,IAAI;AAEnB,SAAO;;AAGT,QAAO;EACL,eAAe;EACf,oBAAoB;EACpB,cAAc,OAAO,KAAA;EACtB;;AAaH,SAAgB,MAAM,MAAwD;CAC5E,MAAM,EAAE,UAAU,GAAG,SAAS;CAG9B,MAAM,WAAW,WAFJ,0BAA0B,KAAK,CAEX;AACjC,QAAO,WACH,OAAO,aAAa,aAClB,SAAS,SAAgB,GACzB,WACF"}
@@ -5,7 +5,7 @@ let _tanstack_router_core_isServer = require("@tanstack/router-core/isServer");
5
5
  //#region src/useCanGoBack.ts
6
6
  function useCanGoBack() {
7
7
  const router = require_useRouter.useRouter();
8
- if (_tanstack_router_core_isServer.isServer ?? router.isServer) return router.stores.location.state.state.__TSR_index !== 0;
8
+ if (_tanstack_router_core_isServer.isServer ?? router.isServer) return router.stores.location.get().state.__TSR_index !== 0;
9
9
  return (0, _tanstack_react_store.useStore)(router.stores.location, (location) => location.state.__TSR_index !== 0);
10
10
  }
11
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useCanGoBack.cjs","names":[],"sources":["../../src/useCanGoBack.ts"],"sourcesContent":["import { useStore } from '@tanstack/react-store'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function useCanGoBack() {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n return router.stores.location.state.state.__TSR_index !== 0\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(\n router.stores.location,\n (location) => location.state.__TSR_index !== 0,\n )\n}\n"],"mappings":";;;;;AAIA,SAAgB,eAAe;CAC7B,MAAM,SAAS,kBAAA,WAAW;AAE1B,KAAI,+BAAA,YAAY,OAAO,SACrB,QAAO,OAAO,OAAO,SAAS,MAAM,MAAM,gBAAgB;AAI5D,SAAA,GAAA,sBAAA,UACE,OAAO,OAAO,WACb,aAAa,SAAS,MAAM,gBAAgB,EAC9C"}
1
+ {"version":3,"file":"useCanGoBack.cjs","names":[],"sources":["../../src/useCanGoBack.ts"],"sourcesContent":["import { useStore } from '@tanstack/react-store'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function useCanGoBack() {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n return router.stores.location.get().state.__TSR_index !== 0\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(\n router.stores.location,\n (location) => location.state.__TSR_index !== 0,\n )\n}\n"],"mappings":";;;;;AAIA,SAAgB,eAAe;CAC7B,MAAM,SAAS,kBAAA,WAAW;AAE1B,KAAI,+BAAA,YAAY,OAAO,SACrB,QAAO,OAAO,OAAO,SAAS,KAAK,CAAC,MAAM,gBAAgB;AAI5D,SAAA,GAAA,sBAAA,UACE,OAAO,OAAO,WACb,aAAa,SAAS,MAAM,gBAAgB,EAC9C"}
@@ -19,7 +19,7 @@ let _tanstack_router_core_isServer = require("@tanstack/router-core/isServer");
19
19
  function useLocation(opts) {
20
20
  const router = require_useRouter.useRouter();
21
21
  if (_tanstack_router_core_isServer.isServer ?? router.isServer) {
22
- const location = router.stores.location.state;
22
+ const location = router.stores.location.get();
23
23
  return opts?.select ? opts.select(location) : location;
24
24
  }
25
25
  const previousResult = (0, react.useRef)(void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"useLocation.cjs","names":[],"sources":["../../src/useLocation.tsx"],"sourcesContent":["import { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterState,\n} from '@tanstack/router-core'\n\nexport interface UseLocationBaseOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing extends boolean = boolean,\n> {\n select?: (\n state: RouterState<TRouter['routeTree']>['location'],\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLocationResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected\n ? RouterState<TRouter['routeTree']>['location']\n : TSelected\n\n/**\n * Read the current location from the router state with optional selection.\n * Useful for subscribing to just the pieces of location you care about.\n *\n * Options:\n * - `select`: Project the `location` object to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The current location (or selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook\n */\nexport function useLocation<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseLocationResult<TRouter, TSelected> {\n const router = useRouter<TRouter>()\n\n if (isServer ?? router.isServer) {\n const location = router.stores.location.state\n return (\n opts?.select ? opts.select(location as any) : location\n ) as UseLocationResult<TRouter, TSelected>\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(router.stores.location, (location) => {\n const selected = (\n opts?.select ? opts.select(location as any) : location\n ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n if (opts?.structuralSharing ?? router.options.defaultStructuralSharing) {\n const shared = replaceEqualDeep(previousResult.current, selected)\n previousResult.current = shared\n return shared\n }\n\n return selected\n }) as UseLocationResult<TRouter, TSelected>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,SAAgB,YAKd,MAEuC;CACvC,MAAM,SAAS,kBAAA,WAAoB;AAEnC,KAAI,+BAAA,YAAY,OAAO,UAAU;EAC/B,MAAM,WAAW,OAAO,OAAO,SAAS;AACxC,SACE,MAAM,SAAS,KAAK,OAAO,SAAgB,GAAG;;CAIlD,MAAM,kBAAA,GAAA,MAAA,QAE6D,KAAA,EAAU;AAG7E,SAAA,GAAA,sBAAA,UAAgB,OAAO,OAAO,WAAW,aAAa;EACpD,MAAM,WACJ,MAAM,SAAS,KAAK,OAAO,SAAgB,GAAG;AAGhD,MAAI,MAAM,qBAAqB,OAAO,QAAQ,0BAA0B;GACtE,MAAM,UAAA,GAAA,sBAAA,kBAA0B,eAAe,SAAS,SAAS;AACjE,kBAAe,UAAU;AACzB,UAAO;;AAGT,SAAO;GACP"}
1
+ {"version":3,"file":"useLocation.cjs","names":[],"sources":["../../src/useLocation.tsx"],"sourcesContent":["import { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterState,\n} from '@tanstack/router-core'\n\nexport interface UseLocationBaseOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing extends boolean = boolean,\n> {\n select?: (\n state: RouterState<TRouter['routeTree']>['location'],\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLocationResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected\n ? RouterState<TRouter['routeTree']>['location']\n : TSelected\n\n/**\n * Read the current location from the router state with optional selection.\n * Useful for subscribing to just the pieces of location you care about.\n *\n * Options:\n * - `select`: Project the `location` object to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The current location (or selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook\n */\nexport function useLocation<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseLocationResult<TRouter, TSelected> {\n const router = useRouter<TRouter>()\n\n if (isServer ?? router.isServer) {\n const location = router.stores.location.get()\n return (\n opts?.select ? opts.select(location as any) : location\n ) as UseLocationResult<TRouter, TSelected>\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(router.stores.location, (location) => {\n const selected = (\n opts?.select ? opts.select(location as any) : location\n ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n if (opts?.structuralSharing ?? router.options.defaultStructuralSharing) {\n const shared = replaceEqualDeep(previousResult.current, selected)\n previousResult.current = shared\n return shared\n }\n\n return selected\n }) as UseLocationResult<TRouter, TSelected>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,SAAgB,YAKd,MAEuC;CACvC,MAAM,SAAS,kBAAA,WAAoB;AAEnC,KAAI,+BAAA,YAAY,OAAO,UAAU;EAC/B,MAAM,WAAW,OAAO,OAAO,SAAS,KAAK;AAC7C,SACE,MAAM,SAAS,KAAK,OAAO,SAAgB,GAAG;;CAIlD,MAAM,kBAAA,GAAA,MAAA,QAE6D,KAAA,EAAU;AAG7E,SAAA,GAAA,sBAAA,UAAgB,OAAO,OAAO,WAAW,aAAa;EACpD,MAAM,WACJ,MAAM,SAAS,KAAK,OAAO,SAAgB,GAAG;AAGhD,MAAI,MAAM,qBAAqB,OAAO,QAAQ,0BAA0B;GACtE,MAAM,UAAA,GAAA,sBAAA,kBAA0B,eAAe,SAAS,SAAS;AACjE,kBAAe,UAAU;AACzB,UAAO;;AAGT,SAAO;GACP"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
3
  const require_matchContext = require("./matchContext.cjs");
3
4
  const require_useRouter = require("./useRouter.cjs");
@@ -8,9 +9,8 @@ let _tanstack_react_store = require("@tanstack/react-store");
8
9
  let _tanstack_router_core_isServer = require("@tanstack/router-core/isServer");
9
10
  //#region src/useMatch.tsx
10
11
  var dummyStore = {
11
- state: void 0,
12
12
  get: () => void 0,
13
- subscribe: () => () => {}
13
+ subscribe: () => ({ unsubscribe: () => {} })
14
14
  };
15
15
  /**
16
16
  * Read and select the nearest or targeted route match.
@@ -20,9 +20,9 @@ function useMatch(opts) {
20
20
  const router = require_useRouter.useRouter();
21
21
  const nearestMatchId = react.useContext(opts.from ? require_matchContext.dummyMatchContext : require_matchContext.matchContext);
22
22
  const key = opts.from ?? nearestMatchId;
23
- const matchStore = key ? opts.from ? router.stores.getMatchStoreByRouteId(key) : router.stores.activeMatchStoresById.get(key) : void 0;
23
+ const matchStore = key ? opts.from ? router.stores.getRouteMatchStore(key) : router.stores.matchStores.get(key) : void 0;
24
24
  if (_tanstack_router_core_isServer.isServer ?? router.isServer) {
25
- const match = matchStore?.state;
25
+ const match = matchStore?.get();
26
26
  if ((opts.shouldThrow ?? true) && !match) {
27
27
  if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find ${opts.from ? `an active match from "${opts.from}"` : "a nearest match!"}`);
28
28
  (0, _tanstack_router_core.invariant)();
@@ -1 +1 @@
1
- {"version":3,"file":"useMatch.cjs","names":[],"sources":["../../src/useMatch.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { invariant, replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { dummyMatchContext, matchContext } from './matchContext'\nimport { useRouter } from './useRouter'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n MakeRouteMatch,\n MakeRouteMatchUnion,\n RegisteredRouter,\n StrictOrFrom,\n ThrowConstraint,\n ThrowOrOptional,\n} from '@tanstack/router-core'\n\nconst dummyStore = {\n state: undefined,\n get: () => undefined,\n subscribe: () => () => {},\n} as any\n\nexport interface UseMatchBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TThrow extends boolean,\n TSelected,\n TStructuralSharing extends boolean,\n> {\n select?: (\n match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n shouldThrow?: TThrow\n}\n\nexport type UseMatchRoute<out TFrom> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchBaseOptions<\n TRouter,\n TFrom,\n true,\n true,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseMatchResult<TRouter, TFrom, true, TSelected>\n\nexport type UseMatchOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TStrict extends boolean,\n TThrow extends boolean,\n TSelected,\n TStructuralSharing extends boolean,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n UseMatchBaseOptions<\n TRouter,\n TFrom,\n TStrict,\n TThrow,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseMatchResult<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TSelected,\n> = unknown extends TSelected\n ? TStrict extends true\n ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>\n : MakeRouteMatchUnion<TRouter>\n : TSelected\n\n/**\n * Read and select the nearest or targeted route match.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchHook\n */\nexport function useMatch<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TThrow extends boolean = true,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseMatchOptions<\n TRouter,\n TFrom,\n TStrict,\n ThrowConstraint<TStrict, TThrow>,\n TSelected,\n TStructuralSharing\n >,\n): ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow> {\n const router = useRouter<TRouter>()\n const nearestMatchId = React.useContext(\n opts.from ? dummyMatchContext : matchContext,\n )\n\n const key = opts.from ?? nearestMatchId\n const matchStore = key\n ? opts.from\n ? router.stores.getMatchStoreByRouteId(key)\n : router.stores.activeMatchStoresById.get(key)\n : undefined\n\n if (isServer ?? router.isServer) {\n const match = matchStore?.state\n if ((opts.shouldThrow ?? true) && !match) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n )\n }\n\n invariant()\n }\n\n if (match === undefined) {\n return undefined as any\n }\n\n return (opts.select ? opts.select(match as any) : match) as any\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n React.useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(\n undefined,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(matchStore ?? dummyStore, (match) => {\n if ((opts.shouldThrow ?? true) && !match) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n )\n }\n\n invariant()\n }\n\n if (match === undefined) {\n return undefined\n }\n\n const selected = (\n opts.select ? opts.select(match as any) : match\n ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n const shared = replaceEqualDeep(previousResult.current, selected)\n previousResult.current = shared\n return shared\n }\n\n return selected\n }) as any\n}\n"],"mappings":";;;;;;;;;AAoBA,IAAM,aAAa;CACjB,OAAO,KAAA;CACP,WAAW,KAAA;CACX,uBAAuB;CACxB;;;;;AAiED,SAAgB,SAQd,MAQ6E;CAC7E,MAAM,SAAS,kBAAA,WAAoB;CACnC,MAAM,iBAAiB,MAAM,WAC3B,KAAK,OAAO,qBAAA,oBAAoB,qBAAA,aACjC;CAED,MAAM,MAAM,KAAK,QAAQ;CACzB,MAAM,aAAa,MACf,KAAK,OACH,OAAO,OAAO,uBAAuB,IAAI,GACzC,OAAO,OAAO,sBAAsB,IAAI,IAAI,GAC9C,KAAA;AAEJ,KAAI,+BAAA,YAAY,OAAO,UAAU;EAC/B,MAAM,QAAQ,YAAY;AAC1B,OAAK,KAAK,eAAe,SAAS,CAAC,OAAO;AACxC,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAI,MACR,oCAAoC,KAAK,OAAO,yBAAyB,KAAK,KAAK,KAAK,qBACzF;AAGH,IAAA,GAAA,sBAAA,YAAW;;AAGb,MAAI,UAAU,KAAA,EACZ;AAGF,SAAQ,KAAK,SAAS,KAAK,OAAO,MAAa,GAAG;;CAGpD,MAAM,iBAEJ,MAAM,OACJ,KAAA,EACD;AAGH,SAAA,GAAA,sBAAA,UAAgB,cAAc,aAAa,UAAU;AACnD,OAAK,KAAK,eAAe,SAAS,CAAC,OAAO;AACxC,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAI,MACR,oCAAoC,KAAK,OAAO,yBAAyB,KAAK,KAAK,KAAK,qBACzF;AAGH,IAAA,GAAA,sBAAA,YAAW;;AAGb,MAAI,UAAU,KAAA,EACZ;EAGF,MAAM,WACJ,KAAK,SAAS,KAAK,OAAO,MAAa,GAAG;AAG5C,MAAI,KAAK,qBAAqB,OAAO,QAAQ,0BAA0B;GACrE,MAAM,UAAA,GAAA,sBAAA,kBAA0B,eAAe,SAAS,SAAS;AACjE,kBAAe,UAAU;AACzB,UAAO;;AAGT,SAAO;GACP"}
1
+ {"version":3,"file":"useMatch.cjs","names":[],"sources":["../../src/useMatch.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { invariant, replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { dummyMatchContext, matchContext } from './matchContext'\nimport { useRouter } from './useRouter'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n MakeRouteMatch,\n MakeRouteMatchUnion,\n RegisteredRouter,\n StrictOrFrom,\n ThrowConstraint,\n ThrowOrOptional,\n} from '@tanstack/router-core'\n\nconst dummyStore = {\n get: () => undefined,\n subscribe: () => ({ unsubscribe: () => {} }),\n} as any\n\nexport interface UseMatchBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TThrow extends boolean,\n TSelected,\n TStructuralSharing extends boolean,\n> {\n select?: (\n match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n shouldThrow?: TThrow\n}\n\nexport type UseMatchRoute<out TFrom> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchBaseOptions<\n TRouter,\n TFrom,\n true,\n true,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseMatchResult<TRouter, TFrom, true, TSelected>\n\nexport type UseMatchOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TStrict extends boolean,\n TThrow extends boolean,\n TSelected,\n TStructuralSharing extends boolean,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n UseMatchBaseOptions<\n TRouter,\n TFrom,\n TStrict,\n TThrow,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseMatchResult<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TSelected,\n> = unknown extends TSelected\n ? TStrict extends true\n ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>\n : MakeRouteMatchUnion<TRouter>\n : TSelected\n\n/**\n * Read and select the nearest or targeted route match.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchHook\n */\nexport function useMatch<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TThrow extends boolean = true,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseMatchOptions<\n TRouter,\n TFrom,\n TStrict,\n ThrowConstraint<TStrict, TThrow>,\n TSelected,\n TStructuralSharing\n >,\n): ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow> {\n const router = useRouter<TRouter>()\n const nearestMatchId = React.useContext(\n opts.from ? dummyMatchContext : matchContext,\n )\n\n const key = opts.from ?? nearestMatchId\n const matchStore = key\n ? opts.from\n ? router.stores.getRouteMatchStore(key)\n : router.stores.matchStores.get(key)\n : undefined\n\n if (isServer ?? router.isServer) {\n const match = matchStore?.get()\n if ((opts.shouldThrow ?? true) && !match) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n )\n }\n\n invariant()\n }\n\n if (match === undefined) {\n return undefined as any\n }\n\n return (opts.select ? opts.select(match as any) : match) as any\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n React.useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(\n undefined,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n return useStore(matchStore ?? dummyStore, (match) => {\n if ((opts.shouldThrow ?? true) && !match) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n )\n }\n\n invariant()\n }\n\n if (match === undefined) {\n return undefined\n }\n\n const selected = (\n opts.select ? opts.select(match as any) : match\n ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n const shared = replaceEqualDeep(previousResult.current, selected)\n previousResult.current = shared\n return shared\n }\n\n return selected\n }) as any\n}\n"],"mappings":";;;;;;;;;;AAsBA,IAAM,aAAa;CACjB,WAAW,KAAA;CACX,kBAAkB,EAAE,mBAAmB,IAAI;CAC5C;;;;;AAiED,SAAgB,SAQd,MAQ6E;CAC7E,MAAM,SAAS,kBAAA,WAAoB;CACnC,MAAM,iBAAiB,MAAM,WAC3B,KAAK,OAAO,qBAAA,oBAAoB,qBAAA,aACjC;CAED,MAAM,MAAM,KAAK,QAAQ;CACzB,MAAM,aAAa,MACf,KAAK,OACH,OAAO,OAAO,mBAAmB,IAAI,GACrC,OAAO,OAAO,YAAY,IAAI,IAAI,GACpC,KAAA;AAEJ,KAAI,+BAAA,YAAY,OAAO,UAAU;EAC/B,MAAM,QAAQ,YAAY,KAAK;AAC/B,OAAK,KAAK,eAAe,SAAS,CAAC,OAAO;AACxC,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAI,MACR,oCAAoC,KAAK,OAAO,yBAAyB,KAAK,KAAK,KAAK,qBACzF;AAGH,IAAA,GAAA,sBAAA,YAAW;;AAGb,MAAI,UAAU,KAAA,EACZ;AAGF,SAAQ,KAAK,SAAS,KAAK,OAAO,MAAa,GAAG;;CAGpD,MAAM,iBAEJ,MAAM,OACJ,KAAA,EACD;AAGH,SAAA,GAAA,sBAAA,UAAgB,cAAc,aAAa,UAAU;AACnD,OAAK,KAAK,eAAe,SAAS,CAAC,OAAO;AACxC,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAI,MACR,oCAAoC,KAAK,OAAO,yBAAyB,KAAK,KAAK,KAAK,qBACzF;AAGH,IAAA,GAAA,sBAAA,YAAW;;AAGb,MAAI,UAAU,KAAA,EACZ;EAGF,MAAM,WACJ,KAAK,SAAS,KAAK,OAAO,MAAa,GAAG;AAG5C,MAAI,KAAK,qBAAqB,OAAO,QAAQ,0BAA0B;GACrE,MAAM,UAAA,GAAA,sBAAA,kBAA0B,eAAe,SAAS,SAAS;AACjE,kBAAe,UAAU;AACzB,UAAO;;AAGT,SAAO;GACP"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
3
  const require_utils = require("./utils.cjs");
3
4
  const require_useRouter = require("./useRouter.cjs");
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigate.cjs","names":[],"sources":["../../src/useNavigate.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n FromPathOption,\n NavigateOptions,\n RegisteredRouter,\n UseNavigateResult,\n} from '@tanstack/router-core'\n\n/**\n * Imperative navigation hook.\n *\n * Returns a stable `navigate(options)` function to change the current location\n * programmatically. Prefer the `Link` component for user-initiated navigation,\n * and use this hook from effects, callbacks, or handlers where imperative\n * navigation is required.\n *\n * Options:\n * - `from`: Optional route base used to resolve relative `to` paths.\n *\n * @returns A function that accepts `NavigateOptions`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook\n */\nexport function useNavigate<\n TRouter extends AnyRouter = RegisteredRouter,\n TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n const router = useRouter()\n\n return React.useCallback(\n (options: NavigateOptions) => {\n return router.navigate({\n ...options,\n from: options.from ?? _defaultOpts?.from,\n })\n },\n [_defaultOpts?.from, router],\n ) as UseNavigateResult<TDefaultFrom>\n}\n\n/**\n * Component that triggers a navigation when rendered. Navigation executes\n * in an effect after mount/update.\n *\n * Props are the same as `NavigateOptions` used by `navigate()`.\n *\n * @returns null\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/navigateComponent\n */\nexport function Navigate<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const router = useRouter()\n const navigate = useNavigate()\n\n const previousPropsRef = React.useRef<NavigateOptions<\n TRouter,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > | null>(null)\n useLayoutEffect(() => {\n if (previousPropsRef.current !== props) {\n navigate(props)\n previousPropsRef.current = props\n }\n }, [router, props, navigate])\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,YAGd,cAEkC;CAClC,MAAM,SAAS,kBAAA,WAAW;AAE1B,QAAO,MAAM,aACV,YAA6B;AAC5B,SAAO,OAAO,SAAS;GACrB,GAAG;GACH,MAAM,QAAQ,QAAQ,cAAc;GACrC,CAAC;IAEJ,CAAC,cAAc,MAAM,OAAO,CAC7B;;;;;;;;;;;AAYH,SAAgB,SAMd,OAAuE;CACvE,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,WAAW,aAAa;CAE9B,MAAM,mBAAmB,MAAM,OAMrB,KAAK;AACf,eAAA,sBAAsB;AACpB,MAAI,iBAAiB,YAAY,OAAO;AACtC,YAAS,MAAM;AACf,oBAAiB,UAAU;;IAE5B;EAAC;EAAQ;EAAO;EAAS,CAAC;AAC7B,QAAO"}
1
+ {"version":3,"file":"useNavigate.cjs","names":[],"sources":["../../src/useNavigate.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n FromPathOption,\n NavigateOptions,\n RegisteredRouter,\n UseNavigateResult,\n} from '@tanstack/router-core'\n\n/**\n * Imperative navigation hook.\n *\n * Returns a stable `navigate(options)` function to change the current location\n * programmatically. Prefer the `Link` component for user-initiated navigation,\n * and use this hook from effects, callbacks, or handlers where imperative\n * navigation is required.\n *\n * Options:\n * - `from`: Optional route base used to resolve relative `to` paths.\n *\n * @returns A function that accepts `NavigateOptions`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook\n */\nexport function useNavigate<\n TRouter extends AnyRouter = RegisteredRouter,\n TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n const router = useRouter()\n\n return React.useCallback(\n (options: NavigateOptions) => {\n return router.navigate({\n ...options,\n from: options.from ?? _defaultOpts?.from,\n })\n },\n [_defaultOpts?.from, router],\n ) as UseNavigateResult<TDefaultFrom>\n}\n\n/**\n * Component that triggers a navigation when rendered. Navigation executes\n * in an effect after mount/update.\n *\n * Props are the same as `NavigateOptions` used by `navigate()`.\n *\n * @returns null\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/navigateComponent\n */\nexport function Navigate<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n const router = useRouter()\n const navigate = useNavigate()\n\n const previousPropsRef = React.useRef<NavigateOptions<\n TRouter,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > | null>(null)\n useLayoutEffect(() => {\n if (previousPropsRef.current !== props) {\n navigate(props)\n previousPropsRef.current = props\n }\n }, [router, props, navigate])\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,YAGd,cAEkC;CAClC,MAAM,SAAS,kBAAA,WAAW;AAE1B,QAAO,MAAM,aACV,YAA6B;AAC5B,SAAO,OAAO,SAAS;GACrB,GAAG;GACH,MAAM,QAAQ,QAAQ,cAAc;GACrC,CAAC;IAEJ,CAAC,cAAc,MAAM,OAAO,CAC7B;;;;;;;;;;;AAYH,SAAgB,SAMd,OAAuE;CACvE,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,WAAW,aAAa;CAE9B,MAAM,mBAAmB,MAAM,OAMrB,KAAK;AACf,eAAA,sBAAsB;AACpB,MAAI,iBAAiB,YAAY,OAAO;AACtC,YAAS,MAAM;AACf,oBAAiB,UAAU;;IAE5B;EAAC;EAAQ;EAAO;EAAS,CAAC;AAC7B,QAAO"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
3
  const require_routerContext = require("./routerContext.cjs");
3
4
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"useRouter.cjs","names":[],"sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as React from 'react'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\n/**\n * Access the current TanStack Router instance from React context.\n * Must be used within a `RouterProvider`.\n *\n * Options:\n * - `warn`: Log a warning if no router context is found (default: true).\n *\n * @returns The registered router instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook\n */\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = React.useContext(routerContext)\n if (process.env.NODE_ENV !== 'production') {\n if ((opts?.warn ?? true) && !value) {\n console.warn(\n 'Warning: useRouter must be used inside a <RouterProvider> component!',\n )\n }\n }\n return value as any\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,UAAwD,MAE5D;CACV,MAAM,QAAQ,MAAM,WAAW,sBAAA,cAAc;AAC7C,KAAA,QAAA,IAAA,aAA6B;OACtB,MAAM,QAAQ,SAAS,CAAC,MAC3B,SAAQ,KACN,uEACD;;AAGL,QAAO"}
1
+ {"version":3,"file":"useRouter.cjs","names":[],"sources":["../../src/useRouter.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\n/**\n * Access the current TanStack Router instance from React context.\n * Must be used within a `RouterProvider`.\n *\n * Options:\n * - `warn`: Log a warning if no router context is found (default: true).\n *\n * @returns The registered router instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook\n */\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = React.useContext(routerContext)\n if (process.env.NODE_ENV !== 'production') {\n if ((opts?.warn ?? true) && !value) {\n console.warn(\n 'Warning: useRouter must be used inside a <RouterProvider> component!',\n )\n }\n }\n return value as any\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,UAAwD,MAE5D;CACV,MAAM,QAAQ,MAAM,WAAW,sBAAA,cAAc;AAC7C,KAAA,QAAA,IAAA,aAA6B;OACtB,MAAM,QAAQ,SAAS,CAAC,MAC3B,SAAQ,KACN,uEACD;;AAGL,QAAO"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  require("./_virtual/_rolldown/runtime.cjs");
2
3
  const require_useRouter = require("./useRouter.cjs");
3
4
  let _tanstack_router_core = require("@tanstack/router-core");
@@ -21,7 +22,7 @@ function useRouterState(opts) {
21
22
  const contextRouter = require_useRouter.useRouter({ warn: opts?.router === void 0 });
22
23
  const router = opts?.router || contextRouter;
23
24
  if (_tanstack_router_core_isServer.isServer ?? router.isServer) {
24
- const state = router.stores.__store.state;
25
+ const state = router.stores.__store.get();
25
26
  return opts?.select ? opts.select(state) : state;
26
27
  }
27
28
  const previousResult = (0, react.useRef)(void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"useRouterState.cjs","names":[],"sources":["../../src/useRouterState.tsx"],"sourcesContent":["import { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterState,\n} from '@tanstack/router-core'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\n\nexport type UseRouterStateOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing,\n> = {\n router?: TRouter\n select?: (\n state: RouterState<TRouter['routeTree']>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseRouterStateResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected\n\n/**\n * Subscribe to the router's state store with optional selection and\n * structural sharing for render optimization.\n *\n * Options:\n * - `select`: Project the full router state to a derived slice\n * - `structuralSharing`: Replace-equal semantics for stable references\n * - `router`: Read state from a specific router instance instead of context\n *\n * @returns The selected router state (or the full state by default).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook\n */\nexport function useRouterState<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>,\n): UseRouterStateResult<TRouter, TSelected> {\n const contextRouter = useRouter<TRouter>({\n warn: opts?.router === undefined,\n })\n const router = opts?.router || contextRouter\n\n // During SSR we render exactly once and do not need reactivity.\n // Avoid subscribing to the store (and any structural sharing work) on the server.\n const _isServer = isServer ?? router.isServer\n if (_isServer) {\n const state = router.stores.__store.state as RouterState<\n TRouter['routeTree']\n >\n return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<\n TRouter,\n TSelected\n >\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(router.stores.__store, (state) => {\n if (opts?.select) {\n if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n const newSlice = replaceEqualDeep(\n previousResult.current,\n opts.select(state),\n )\n previousResult.current = newSlice\n return newSlice\n }\n return opts.select(state)\n }\n return state\n }) as UseRouterStateResult<TRouter, TSelected>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,eAKd,MAC0C;CAC1C,MAAM,gBAAgB,kBAAA,UAAmB,EACvC,MAAM,MAAM,WAAW,KAAA,GACxB,CAAC;CACF,MAAM,SAAS,MAAM,UAAU;AAK/B,KADkB,+BAAA,YAAY,OAAO,UACtB;EACb,MAAM,QAAQ,OAAO,OAAO,QAAQ;AAGpC,SAAQ,MAAM,SAAS,KAAK,OAAO,MAAM,GAAG;;CAM9C,MAAM,kBAAA,GAAA,MAAA,QAE6D,KAAA,EAAU;AAG7E,SAAA,GAAA,sBAAA,UAAgB,OAAO,OAAO,UAAU,UAAU;AAChD,MAAI,MAAM,QAAQ;AAChB,OAAI,KAAK,qBAAqB,OAAO,QAAQ,0BAA0B;IACrE,MAAM,YAAA,GAAA,sBAAA,kBACJ,eAAe,SACf,KAAK,OAAO,MAAM,CACnB;AACD,mBAAe,UAAU;AACzB,WAAO;;AAET,UAAO,KAAK,OAAO,MAAM;;AAE3B,SAAO;GACP"}
1
+ {"version":3,"file":"useRouterState.cjs","names":[],"sources":["../../src/useRouterState.tsx"],"sourcesContent":["'use client'\n\nimport { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterState,\n} from '@tanstack/router-core'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\n\nexport type UseRouterStateOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing,\n> = {\n router?: TRouter\n select?: (\n state: RouterState<TRouter['routeTree']>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseRouterStateResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected\n\n/**\n * Subscribe to the router's state store with optional selection and\n * structural sharing for render optimization.\n *\n * Options:\n * - `select`: Project the full router state to a derived slice\n * - `structuralSharing`: Replace-equal semantics for stable references\n * - `router`: Read state from a specific router instance instead of context\n *\n * @returns The selected router state (or the full state by default).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook\n */\nexport function useRouterState<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>,\n): UseRouterStateResult<TRouter, TSelected> {\n const contextRouter = useRouter<TRouter>({\n warn: opts?.router === undefined,\n })\n const router = opts?.router || contextRouter\n\n // During SSR we render exactly once and do not need reactivity.\n // Avoid subscribing to the store (and any structural sharing work) on the server.\n const _isServer = isServer ?? router.isServer\n if (_isServer) {\n const state = router.stores.__store.get() as RouterState<\n TRouter['routeTree']\n >\n return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<\n TRouter,\n TSelected\n >\n }\n\n const previousResult =\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(router.stores.__store, (state) => {\n if (opts?.select) {\n if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n const newSlice = replaceEqualDeep(\n previousResult.current,\n opts.select(state),\n )\n previousResult.current = newSlice\n return newSlice\n }\n return opts.select(state)\n }\n return state\n }) as UseRouterStateResult<TRouter, TSelected>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,eAKd,MAC0C;CAC1C,MAAM,gBAAgB,kBAAA,UAAmB,EACvC,MAAM,MAAM,WAAW,KAAA,GACxB,CAAC;CACF,MAAM,SAAS,MAAM,UAAU;AAK/B,KADkB,+BAAA,YAAY,OAAO,UACtB;EACb,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK;AAGzC,SAAQ,MAAM,SAAS,KAAK,OAAO,MAAM,GAAG;;CAM9C,MAAM,kBAAA,GAAA,MAAA,QAE6D,KAAA,EAAU;AAG7E,SAAA,GAAA,sBAAA,UAAgB,OAAO,OAAO,UAAU,UAAU;AAChD,MAAI,MAAM,QAAQ;AAChB,OAAI,KAAK,qBAAqB,OAAO,QAAQ,0BAA0B;IACrE,MAAM,YAAA,GAAA,sBAAA,kBACJ,eAAe,SACf,KAAK,OAAO,MAAM,CACnB;AACD,mBAAe,UAAU;AACzB,WAAO;;AAET,UAAO,KAAK,OAAO,MAAM;;AAE3B,SAAO;GACP"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
3
  let react = require("react");
3
4
  react = require_runtime.__toESM(react);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import * as React from 'react'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\nconst REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n options.disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n }\n }, [callback, intersectionObserverOptions, options.disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;AAYA,IAAa,WAEI,MARC;AAoBlB,IAAa,kBACX,OAAO,WAAW,cAAc,MAAM,kBAAkB,MAAM;;;;AAKhE,SAAgB,YAAe,OAAoB;CAEjD,MAAM,MAAM,MAAM,OAAqC;EAC9C;EACP,MAAM;EACP,CAAC;CAEF,MAAM,UAAU,IAAI,QAAQ;AAK5B,KAAI,UAAU,QACZ,KAAI,UAAU;EACL;EACP,MAAM;EACP;AAIH,QAAO,IAAI,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BrB,SAAgB,wBACd,KACA,UACA,8BAAwD,EAAE,EAC1D,UAAkC,EAAE,EACpC;AACA,OAAM,gBAAgB;AACpB,MACE,CAAC,IAAI,WACL,QAAQ,YACR,OAAO,yBAAyB,WAEhC;EAGF,MAAM,WAAW,IAAI,sBAAsB,CAAC,WAAW;AACrD,YAAS,MAAM;KACd,4BAA4B;AAE/B,WAAS,QAAQ,IAAI,QAAQ;AAE7B,eAAa;AACX,YAAS,YAAY;;IAEtB;EAAC;EAAU;EAA6B,QAAQ;EAAU;EAAI,CAAC;;;;;;;;;;;;;;;AAgBpE,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,MAAM,OAAU,KAAK;AACtC,OAAM,oBAAoB,WAAW,SAAS,SAAU,EAAE,CAAC;AAC3D,QAAO"}
1
+ {"version":3,"file":"utils.cjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\nconst REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n options.disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n }\n }, [callback, intersectionObserverOptions, options.disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,WAEI,MARC;AAoBlB,IAAa,kBACX,OAAO,WAAW,cAAc,MAAM,kBAAkB,MAAM;;;;AAKhE,SAAgB,YAAe,OAAoB;CAEjD,MAAM,MAAM,MAAM,OAAqC;EAC9C;EACP,MAAM;EACP,CAAC;CAEF,MAAM,UAAU,IAAI,QAAQ;AAK5B,KAAI,UAAU,QACZ,KAAI,UAAU;EACL;EACP,MAAM;EACP;AAIH,QAAO,IAAI,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BrB,SAAgB,wBACd,KACA,UACA,8BAAwD,EAAE,EAC1D,UAAkC,EAAE,EACpC;AACA,OAAM,gBAAgB;AACpB,MACE,CAAC,IAAI,WACL,QAAQ,YACR,OAAO,yBAAyB,WAEhC;EAGF,MAAM,WAAW,IAAI,sBAAsB,CAAC,WAAW;AACrD,YAAS,MAAM;KACd,4BAA4B;AAE/B,WAAS,QAAQ,IAAI,QAAQ;AAE7B,eAAa;AACX,YAAS,YAAY;;IAEtB;EAAC;EAAU;EAA6B,QAAQ;EAAU;EAAI,CAAC;;;;;;;;;;;;;;;AAgBpE,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,MAAM,OAAU,KAAK;AACtC,OAAM,oBAAoB,WAAW,SAAS,SAAU,EAAE,CAAC;AAC3D,QAAO"}
package/dist/esm/Asset.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useHydrated } from "./ClientOnly.js";
2
3
  import { useRouter } from "./useRouter.js";
3
4
  import * as React$1 from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"Asset.js","names":[],"sources":["../../src/Asset.tsx"],"sourcesContent":["import * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\ninterface ScriptAttrs {\n [key: string]: string | boolean | undefined\n src?: string\n suppressHydrationWarning?: boolean\n}\n\nexport function Asset({\n tag,\n attrs,\n children,\n nonce,\n}: RouterManagedTag & { nonce?: string }): React.ReactElement | null {\n switch (tag) {\n case 'title':\n return (\n <title {...attrs} suppressHydrationWarning>\n {children}\n </title>\n )\n case 'meta':\n return <meta {...attrs} suppressHydrationWarning />\n case 'link':\n return <link {...attrs} nonce={nonce} suppressHydrationWarning />\n case 'style':\n return (\n <style\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children as string }}\n nonce={nonce}\n />\n )\n case 'script':\n return <Script attrs={attrs}>{children}</Script>\n default:\n return null\n }\n}\n\nfunction Script({\n attrs,\n children,\n}: {\n attrs?: ScriptAttrs\n children?: string\n}) {\n const router = useRouter()\n const hydrated = useHydrated()\n const dataScript =\n typeof attrs?.type === 'string' &&\n attrs.type !== '' &&\n attrs.type !== 'text/javascript' &&\n attrs.type !== 'module'\n\n if (\n process.env.NODE_ENV !== 'production' &&\n attrs?.src &&\n typeof children === 'string' &&\n children.trim().length\n ) {\n console.warn(\n '[TanStack Router] <Script> received both `src` and `children`. The `children` content will be ignored. Remove `children` or remove `src`.',\n )\n }\n\n React.useEffect(() => {\n if (dataScript) return\n\n if (attrs?.src) {\n const normSrc = (() => {\n try {\n const base = document.baseURI || window.location.href\n return new URL(attrs.src, base).href\n } catch {\n return attrs.src\n }\n })()\n const existingScript = Array.from(\n document.querySelectorAll('script[src]'),\n ).find((el) => (el as HTMLScriptElement).src === normSrc)\n\n if (existingScript) {\n return\n }\n\n const script = document.createElement('script')\n\n for (const [key, value] of Object.entries(attrs)) {\n if (\n key !== 'suppressHydrationWarning' &&\n value !== undefined &&\n value !== false\n ) {\n script.setAttribute(\n key,\n typeof value === 'boolean' ? '' : String(value),\n )\n }\n }\n\n document.head.appendChild(script)\n\n return () => {\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n }\n }\n\n if (typeof children === 'string') {\n const typeAttr =\n typeof attrs?.type === 'string' ? attrs.type : 'text/javascript'\n const nonceAttr =\n typeof attrs?.nonce === 'string' ? attrs.nonce : undefined\n const existingScript = Array.from(\n document.querySelectorAll('script:not([src])'),\n ).find((el) => {\n if (!(el instanceof HTMLScriptElement)) return false\n const sType = el.getAttribute('type') ?? 'text/javascript'\n const sNonce = el.getAttribute('nonce') ?? undefined\n return (\n el.textContent === children &&\n sType === typeAttr &&\n sNonce === nonceAttr\n )\n })\n\n if (existingScript) {\n return\n }\n\n const script = document.createElement('script')\n script.textContent = children\n\n if (attrs) {\n for (const [key, value] of Object.entries(attrs)) {\n if (\n key !== 'suppressHydrationWarning' &&\n value !== undefined &&\n value !== false\n ) {\n script.setAttribute(\n key,\n typeof value === 'boolean' ? '' : String(value),\n )\n }\n }\n }\n\n document.head.appendChild(script)\n\n return () => {\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n }\n }\n\n return undefined\n }, [attrs, children, dataScript])\n\n // --- Server rendering ---\n if (isServer ?? router.isServer) {\n if (attrs?.src) {\n return <script {...attrs} suppressHydrationWarning />\n }\n\n if (typeof children === 'string') {\n return (\n <script\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children }}\n suppressHydrationWarning\n />\n )\n }\n\n return null\n }\n\n // --- Client rendering ---\n\n // Data scripts (e.g. application/ld+json) are rendered in the tree;\n // the useEffect intentionally skips them.\n if (dataScript && typeof children === 'string') {\n return (\n <script\n {...attrs}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: children }}\n />\n )\n }\n\n // During hydration (before useEffect has fired), render the script element\n // to match the server-rendered HTML and avoid structural hydration mismatches.\n // After hydration, return null — the useEffect handles imperative injection.\n if (!hydrated) {\n if (attrs?.src) {\n return <script {...attrs} suppressHydrationWarning />\n }\n if (typeof children === 'string') {\n return (\n <script\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children }}\n suppressHydrationWarning\n />\n )\n }\n }\n\n return null\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"Asset.js","names":[],"sources":["../../src/Asset.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\ninterface ScriptAttrs {\n [key: string]: string | boolean | undefined\n src?: string\n suppressHydrationWarning?: boolean\n}\n\nexport function Asset({\n tag,\n attrs,\n children,\n nonce,\n}: RouterManagedTag & { nonce?: string }): React.ReactElement | null {\n switch (tag) {\n case 'title':\n return (\n <title {...attrs} suppressHydrationWarning>\n {children}\n </title>\n )\n case 'meta':\n return <meta {...attrs} suppressHydrationWarning />\n case 'link':\n return <link {...attrs} nonce={nonce} suppressHydrationWarning />\n case 'style':\n return (\n <style\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children as string }}\n nonce={nonce}\n />\n )\n case 'script':\n return <Script attrs={attrs}>{children}</Script>\n default:\n return null\n }\n}\n\nfunction Script({\n attrs,\n children,\n}: {\n attrs?: ScriptAttrs\n children?: string\n}) {\n const router = useRouter()\n const hydrated = useHydrated()\n const dataScript =\n typeof attrs?.type === 'string' &&\n attrs.type !== '' &&\n attrs.type !== 'text/javascript' &&\n attrs.type !== 'module'\n\n if (\n process.env.NODE_ENV !== 'production' &&\n attrs?.src &&\n typeof children === 'string' &&\n children.trim().length\n ) {\n console.warn(\n '[TanStack Router] <Script> received both `src` and `children`. The `children` content will be ignored. Remove `children` or remove `src`.',\n )\n }\n\n React.useEffect(() => {\n if (dataScript) return\n\n if (attrs?.src) {\n const normSrc = (() => {\n try {\n const base = document.baseURI || window.location.href\n return new URL(attrs.src, base).href\n } catch {\n return attrs.src\n }\n })()\n const existingScript = Array.from(\n document.querySelectorAll('script[src]'),\n ).find((el) => (el as HTMLScriptElement).src === normSrc)\n\n if (existingScript) {\n return\n }\n\n const script = document.createElement('script')\n\n for (const [key, value] of Object.entries(attrs)) {\n if (\n key !== 'suppressHydrationWarning' &&\n value !== undefined &&\n value !== false\n ) {\n script.setAttribute(\n key,\n typeof value === 'boolean' ? '' : String(value),\n )\n }\n }\n\n document.head.appendChild(script)\n\n return () => {\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n }\n }\n\n if (typeof children === 'string') {\n const typeAttr =\n typeof attrs?.type === 'string' ? attrs.type : 'text/javascript'\n const nonceAttr =\n typeof attrs?.nonce === 'string' ? attrs.nonce : undefined\n const existingScript = Array.from(\n document.querySelectorAll('script:not([src])'),\n ).find((el) => {\n if (!(el instanceof HTMLScriptElement)) return false\n const sType = el.getAttribute('type') ?? 'text/javascript'\n const sNonce = el.getAttribute('nonce') ?? undefined\n return (\n el.textContent === children &&\n sType === typeAttr &&\n sNonce === nonceAttr\n )\n })\n\n if (existingScript) {\n return\n }\n\n const script = document.createElement('script')\n script.textContent = children\n\n if (attrs) {\n for (const [key, value] of Object.entries(attrs)) {\n if (\n key !== 'suppressHydrationWarning' &&\n value !== undefined &&\n value !== false\n ) {\n script.setAttribute(\n key,\n typeof value === 'boolean' ? '' : String(value),\n )\n }\n }\n }\n\n document.head.appendChild(script)\n\n return () => {\n if (script.parentNode) {\n script.parentNode.removeChild(script)\n }\n }\n }\n\n return undefined\n }, [attrs, children, dataScript])\n\n // --- Server rendering ---\n if (isServer ?? router.isServer) {\n if (attrs?.src) {\n return <script {...attrs} suppressHydrationWarning />\n }\n\n if (typeof children === 'string') {\n return (\n <script\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children }}\n suppressHydrationWarning\n />\n )\n }\n\n return null\n }\n\n // --- Client rendering ---\n\n // Data scripts (e.g. application/ld+json) are rendered in the tree;\n // the useEffect intentionally skips them.\n if (dataScript && typeof children === 'string') {\n return (\n <script\n {...attrs}\n suppressHydrationWarning\n dangerouslySetInnerHTML={{ __html: children }}\n />\n )\n }\n\n // During hydration (before useEffect has fired), render the script element\n // to match the server-rendered HTML and avoid structural hydration mismatches.\n // After hydration, return null — the useEffect handles imperative injection.\n if (!hydrated) {\n if (attrs?.src) {\n return <script {...attrs} suppressHydrationWarning />\n }\n if (typeof children === 'string') {\n return (\n <script\n {...attrs}\n dangerouslySetInnerHTML={{ __html: children }}\n suppressHydrationWarning\n />\n )\n }\n }\n\n return null\n}\n"],"mappings":"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"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React$1 from "react";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  //#region src/CatchBoundary.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"CatchBoundary.js","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => number | string\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n const errorComponent = props.errorComponent ?? ErrorComponent\n\n return (\n <CatchBoundaryImpl\n getResetKey={props.getResetKey}\n onCatch={props.onCatch}\n children={({ error, reset }) => {\n if (error) {\n return React.createElement(errorComponent, {\n error,\n reset,\n })\n }\n\n return props.children\n }}\n />\n )\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => number | string\n children: (props: {\n error: Error | null\n reset: () => void\n }) => React.ReactNode\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: string | number }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => string | number },\n state: { resetKey?: string | number; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset() {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n if (this.props.onCatch) {\n this.props.onCatch(error, errorInfo)\n }\n }\n render() {\n return this.props.children({\n error: this.state.error,\n reset: () => {\n this.reset()\n },\n })\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;AAIA,SAAgB,cAAc,OAK3B;CACD,MAAM,iBAAiB,MAAM,kBAAkB;AAE/C,QACE,oBAAC,mBAAD;EACE,aAAa,MAAM;EACnB,SAAS,MAAM;EACf,WAAW,EAAE,OAAO,YAAY;AAC9B,OAAI,MACF,QAAO,QAAM,cAAc,gBAAgB;IACzC;IACA;IACD,CAAC;AAGJ,UAAO,MAAM;;EAEf,CAAA;;AAIN,IAAM,oBAAN,cAAgC,QAAM,UAOnC;;;eACO,EAAE,OAAO,MAAM;;CAEvB,OAAO,yBACL,OACA,OACA;EACA,MAAM,WAAW,MAAM,aAAa;AAEpC,MAAI,MAAM,SAAS,MAAM,aAAa,SACpC,QAAO;GAAE;GAAU,OAAO;GAAM;AAGlC,SAAO,EAAE,UAAU;;CAErB,OAAO,yBAAyB,OAAc;AAC5C,SAAO,EAAE,OAAO;;CAElB,QAAQ;AACN,OAAK,SAAS,EAAE,OAAO,MAAM,CAAC;;CAEhC,kBAAkB,OAAc,WAAsB;AACpD,MAAI,KAAK,MAAM,QACb,MAAK,MAAM,QAAQ,OAAO,UAAU;;CAGxC,SAAS;AACP,SAAO,KAAK,MAAM,SAAS;GACzB,OAAO,KAAK,MAAM;GAClB,aAAa;AACX,SAAK,OAAO;;GAEf,CAAC;;;AAIN,SAAgB,eAAe,EAAE,SAAyB;CACxD,MAAM,CAAC,MAAM,WAAW,QAAM,SAAA,QAAA,IAAA,aAAkC,aAAa;AAE7E,QACE,qBAAC,OAAD;EAAK,OAAO;GAAE,SAAS;GAAS,UAAU;GAAQ;YAAlD;GACE,qBAAC,OAAD;IAAK,OAAO;KAAE,SAAS;KAAQ,YAAY;KAAU,KAAK;KAAS;cAAnE,CACE,oBAAC,UAAD;KAAQ,OAAO,EAAE,UAAU,QAAQ;eAAE;KAA8B,CAAA,EACnE,oBAAC,UAAD;KACE,OAAO;MACL,YAAY;MACZ,UAAU;MACV,QAAQ;MACR,SAAS;MACT,YAAY;MACZ,cAAc;MACf;KACD,eAAe,SAAS,MAAM,CAAC,EAAE;eAEhC,OAAO,eAAe;KAChB,CAAA,CACL;;GACN,oBAAC,OAAD,EAAK,OAAO,EAAE,QAAQ,UAAU,EAAI,CAAA;GACnC,OACC,oBAAC,OAAD,EAAA,UACE,oBAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;KACX;cAEA,MAAM,UAAU,oBAAC,QAAD,EAAA,UAAO,MAAM,SAAe,CAAA,GAAG;IAC5C,CAAA,EACF,CAAA,GACJ;GACA"}
1
+ {"version":3,"file":"CatchBoundary.js","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => number | string\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n const errorComponent = props.errorComponent ?? ErrorComponent\n\n return (\n <CatchBoundaryImpl\n getResetKey={props.getResetKey}\n onCatch={props.onCatch}\n children={({ error, reset }) => {\n if (error) {\n return React.createElement(errorComponent, {\n error,\n reset,\n })\n }\n\n return props.children\n }}\n />\n )\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => number | string\n children: (props: {\n error: Error | null\n reset: () => void\n }) => React.ReactNode\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: string | number }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => string | number },\n state: { resetKey?: string | number; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset() {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n if (this.props.onCatch) {\n this.props.onCatch(error, errorInfo)\n }\n }\n render() {\n return this.props.children({\n error: this.state.error,\n reset: () => {\n this.reset()\n },\n })\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;AAMA,SAAgB,cAAc,OAK3B;CACD,MAAM,iBAAiB,MAAM,kBAAkB;AAE/C,QACE,oBAAC,mBAAD;EACE,aAAa,MAAM;EACnB,SAAS,MAAM;EACf,WAAW,EAAE,OAAO,YAAY;AAC9B,OAAI,MACF,QAAO,QAAM,cAAc,gBAAgB;IACzC;IACA;IACD,CAAC;AAGJ,UAAO,MAAM;;EAEf,CAAA;;AAIN,IAAM,oBAAN,cAAgC,QAAM,UAOnC;;;eACO,EAAE,OAAO,MAAM;;CAEvB,OAAO,yBACL,OACA,OACA;EACA,MAAM,WAAW,MAAM,aAAa;AAEpC,MAAI,MAAM,SAAS,MAAM,aAAa,SACpC,QAAO;GAAE;GAAU,OAAO;GAAM;AAGlC,SAAO,EAAE,UAAU;;CAErB,OAAO,yBAAyB,OAAc;AAC5C,SAAO,EAAE,OAAO;;CAElB,QAAQ;AACN,OAAK,SAAS,EAAE,OAAO,MAAM,CAAC;;CAEhC,kBAAkB,OAAc,WAAsB;AACpD,MAAI,KAAK,MAAM,QACb,MAAK,MAAM,QAAQ,OAAO,UAAU;;CAGxC,SAAS;AACP,SAAO,KAAK,MAAM,SAAS;GACzB,OAAO,KAAK,MAAM;GAClB,aAAa;AACX,SAAK,OAAO;;GAEf,CAAC;;;AAIN,SAAgB,eAAe,EAAE,SAAyB;CACxD,MAAM,CAAC,MAAM,WAAW,QAAM,SAAA,QAAA,IAAA,aAAkC,aAAa;AAE7E,QACE,qBAAC,OAAD;EAAK,OAAO;GAAE,SAAS;GAAS,UAAU;GAAQ;YAAlD;GACE,qBAAC,OAAD;IAAK,OAAO;KAAE,SAAS;KAAQ,YAAY;KAAU,KAAK;KAAS;cAAnE,CACE,oBAAC,UAAD;KAAQ,OAAO,EAAE,UAAU,QAAQ;eAAE;KAA8B,CAAA,EACnE,oBAAC,UAAD;KACE,OAAO;MACL,YAAY;MACZ,UAAU;MACV,QAAQ;MACR,SAAS;MACT,YAAY;MACZ,cAAc;MACf;KACD,eAAe,SAAS,MAAM,CAAC,EAAE;eAEhC,OAAO,eAAe;KAChB,CAAA,CACL;;GACN,oBAAC,OAAD,EAAK,OAAO,EAAE,QAAQ,UAAU,EAAI,CAAA;GACnC,OACC,oBAAC,OAAD,EAAA,UACE,oBAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;KACX;cAEA,MAAM,UAAU,oBAAC,QAAD,EAAA,UAAO,MAAM,SAAe,CAAA,GAAG;IAC5C,CAAA,EACF,CAAA,GACJ;GACA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import React from "react";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/ClientOnly.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"ClientOnly.js","names":[],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: React.ReactNode\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: React.ReactNode\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n return useHydrated() ? (\n <React.Fragment>{children}</React.Fragment>\n ) : (\n <React.Fragment>{fallback}</React.Fragment>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * let hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nfunction subscribe() {\n return () => {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,QAAO,aAAa,GAClB,oBAAC,MAAM,UAAP,EAAiB,UAA0B,CAAA,GAE3C,oBAAC,MAAM,UAAP,EAAA,UAAiB,UAA0B,CAAA;;;;;;;;;;;;;;;;;;;;;AAuB/C,SAAgB,cAAuB;AACrC,QAAO,MAAM,qBACX,iBACM,YACA,MACP;;AAGH,SAAS,YAAY;AACnB,cAAa"}
1
+ {"version":3,"file":"ClientOnly.js","names":[],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: React.ReactNode\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: React.ReactNode\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n return useHydrated() ? (\n <React.Fragment>{children}</React.Fragment>\n ) : (\n <React.Fragment>{fallback}</React.Fragment>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * let hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nfunction subscribe() {\n return () => {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,QAAO,aAAa,GAClB,oBAAC,MAAM,UAAP,EAAiB,UAA0B,CAAA,GAE3C,oBAAC,MAAM,UAAP,EAAA,UAAiB,UAA0B,CAAA;;;;;;;;;;;;;;;;;;;;;AAuB/C,SAAgB,cAAuB;AACrC,QAAO,MAAM,qBACX,iBACM,YACA,MACP;;AAGH,SAAS,YAAY;AACnB,cAAa"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useHydrated } from "./ClientOnly.js";
2
3
  import { useRouter } from "./useRouter.js";
3
4
  import { Asset } from "./Asset.js";
@@ -1 +1 @@
1
- {"version":3,"file":"HeadContent.dev.js","names":[],"sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\nimport type { HeadContentProps } from './HeadContent'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const hydrated = useHydrated()\n\n // Fallback cleanup for hydration mismatch cases\n // Runs when hydration completes to remove any orphaned dev styles links from DOM\n React.useEffect(() => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\n }, [hydrated])\n\n // Filter out dev styles after hydration\n const filteredTags = hydrated\n ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n : tags\n\n return (\n <>\n {filteredTags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;AAOA,IAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,QAAQ,MAAM,iBAAiB;CAE5C,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;CAClC,MAAM,WAAW,aAAa;AAI9B,SAAM,gBAAgB;AACpB,MAAI,SACF,UACG,iBAAiB,QAAQ,gBAAgB,GAAG,CAC5C,SAAS,OAAO,GAAG,QAAQ,CAAC;IAEhC,CAAC,SAAS,CAAC;AAOd,QACE,oBAAA,UAAA,EAAA,WALmB,WACjB,KAAK,QAAQ,QAAQ,CAAC,IAAI,QAAQ,iBAAiB,GACnD,MAIc,KAAK,QACjB,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
1
+ {"version":3,"file":"HeadContent.dev.js","names":[],"sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\nimport type { HeadContentProps } from './HeadContent'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const hydrated = useHydrated()\n\n // Fallback cleanup for hydration mismatch cases\n // Runs when hydration completes to remove any orphaned dev styles links from DOM\n React.useEffect(() => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\n }, [hydrated])\n\n // Filter out dev styles after hydration\n const filteredTags = hydrated\n ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n : tags\n\n return (\n <>\n {filteredTags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;;AASA,IAAM,kBAAkB;;;;;;;;;;AAWxB,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,QAAQ,MAAM,iBAAiB;CAE5C,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;CAClC,MAAM,WAAW,aAAa;AAI9B,SAAM,gBAAgB;AACpB,MAAI,SACF,UACG,iBAAiB,QAAQ,gBAAgB,GAAG,CAC5C,SAAS,OAAO,GAAG,QAAQ,CAAC;IAEhC,CAAC,SAAS,CAAC;AAOd,QACE,oBAAA,UAAA,EAAA,WALmB,WACjB,KAAK,QAAQ,QAAQ,CAAC,IAAI,QAAQ,iBAAiB,GACnD,MAIc,KAAK,QACjB,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useRouter } from "./useRouter.js";
2
3
  import { Asset } from "./Asset.js";
3
4
  import { useTags } from "./headContentUtils.js";
@@ -1 +1 @@
1
- {"version":3,"file":"HeadContent.js","names":[],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\n}\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return (\n <>\n {tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,QAAQ,MAAM,iBAAiB;CAE5C,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;AAClC,QACE,oBAAA,UAAA,EAAA,UACG,KAAK,KAAK,QACT,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
1
+ {"version":3,"file":"HeadContent.js","names":[],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\n}\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return (\n <>\n {tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgB,YAAY,OAAyB;CACnD,MAAM,OAAO,QAAQ,MAAM,iBAAiB;CAE5C,MAAM,QADS,WAAW,CACL,QAAQ,KAAK;AAClC,QACE,oBAAA,UAAA,EAAA,UACG,KAAK,KAAK,QACT,8BAAC,OAAD;EAAO,GAAI;EAAK,KAAK,YAAY,KAAK,UAAU,IAAI;EAAW;EAAS,CAAA,CACxE,EACD,CAAA"}
package/dist/esm/Match.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useLayoutEffect } from "./utils.js";
2
3
  import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
3
4
  import { ClientOnly } from "./ClientOnly.js";
@@ -16,7 +17,7 @@ import { isServer } from "@tanstack/router-core/isServer";
16
17
  var Match = React$1.memo(function MatchImpl({ matchId }) {
17
18
  const router = useRouter();
18
19
  if (isServer ?? router.isServer) {
19
- const match = router.stores.activeMatchStoresById.get(matchId)?.state;
20
+ const match = router.stores.matchStores.get(matchId)?.get();
20
21
  if (!match) {
21
22
  if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
22
23
  invariant();
@@ -26,7 +27,7 @@ var Match = React$1.memo(function MatchImpl({ matchId }) {
26
27
  return /* @__PURE__ */ jsx(MatchView, {
27
28
  router,
28
29
  matchId,
29
- resetKey: router.stores.loadedAt.state,
30
+ resetKey: router.stores.loadedAt.get(),
30
31
  matchState: {
31
32
  routeId,
32
33
  ssr: match.ssr,
@@ -35,7 +36,7 @@ var Match = React$1.memo(function MatchImpl({ matchId }) {
35
36
  }
36
37
  });
37
38
  }
38
- const matchStore = router.stores.activeMatchStoresById.get(matchId);
39
+ const matchStore = router.stores.matchStores.get(matchId);
39
40
  if (!matchStore) {
40
41
  if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
41
42
  invariant();
@@ -113,7 +114,7 @@ function OnRendered({ resetKey }) {
113
114
  if (prevHrefRef.current === void 0 || prevHrefRef.current !== currentHref) {
114
115
  router.emit({
115
116
  type: "onRendered",
116
- ...getLocationChangeInfo(router.stores.location.state, router.stores.resolvedLocation.state)
117
+ ...getLocationChangeInfo(router.stores.location.get(), router.stores.resolvedLocation.get())
117
118
  });
118
119
  prevHrefRef.current = currentHref;
119
120
  }
@@ -130,7 +131,7 @@ var MatchInner = React$1.memo(function MatchInnerImpl({ matchId }) {
130
131
  return router.getMatch(match.id)?._nonReactive[key] ?? match._nonReactive[key];
131
132
  };
132
133
  if (isServer ?? router.isServer) {
133
- const match = router.stores.activeMatchStoresById.get(matchId)?.state;
134
+ const match = router.stores.matchStores.get(matchId)?.get();
134
135
  if (!match) {
135
136
  if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
136
137
  invariant();
@@ -170,7 +171,7 @@ var MatchInner = React$1.memo(function MatchInnerImpl({ matchId }) {
170
171
  });
171
172
  return out;
172
173
  }
173
- const matchStore = router.stores.activeMatchStoresById.get(matchId);
174
+ const matchStore = router.stores.matchStores.get(matchId);
174
175
  if (!matchStore) {
175
176
  if (process.env.NODE_ENV !== "production") throw new Error(`Invariant failed: Could not find match for matchId "${matchId}". Please file an issue!`);
176
177
  invariant();
@@ -259,14 +260,14 @@ var Outlet = React$1.memo(function OutletImpl() {
259
260
  let parentGlobalNotFound = false;
260
261
  let childMatchId;
261
262
  if (isServer ?? router.isServer) {
262
- const matches = router.stores.activeMatchesSnapshot.state;
263
+ const matches = router.stores.matches.get();
263
264
  const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
264
265
  const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
265
266
  routeId = parentMatch?.routeId;
266
267
  parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
267
268
  childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
268
269
  } else {
269
- const parentMatchStore = matchId ? router.stores.activeMatchStoresById.get(matchId) : void 0;
270
+ const parentMatchStore = matchId ? router.stores.matchStores.get(matchId) : void 0;
270
271
  [routeId, parentGlobalNotFound] = useStore(parentMatchStore, (match) => [match?.routeId, match?.globalNotFound ?? false]);
271
272
  childMatchId = useStore(router.stores.matchesId, (ids) => {
272
273
  return ids[ids.findIndex((id) => id === matchId) + 1];