@tanstack/react-router 1.141.4 → 1.141.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/cjs/ClientOnly.cjs.map +1 -1
  2. package/dist/cjs/ClientOnly.d.cts +0 -8
  3. package/dist/cjs/HeadContent.cjs.map +1 -1
  4. package/dist/cjs/HeadContent.d.cts +0 -4
  5. package/dist/cjs/Matches.cjs.map +1 -1
  6. package/dist/cjs/Matches.d.cts +0 -12
  7. package/dist/cjs/RouterProvider.cjs.map +1 -1
  8. package/dist/cjs/RouterProvider.d.cts +0 -9
  9. package/dist/cjs/Scripts.cjs.map +1 -1
  10. package/dist/cjs/Scripts.d.cts +0 -4
  11. package/dist/cjs/awaited.cjs.map +1 -1
  12. package/dist/cjs/awaited.d.cts +0 -5
  13. package/dist/cjs/fileRoute.cjs.map +1 -1
  14. package/dist/cjs/fileRoute.d.cts +0 -59
  15. package/dist/cjs/router.cjs.map +1 -1
  16. package/dist/cjs/router.d.cts +0 -5
  17. package/dist/cjs/useLoaderData.cjs.map +1 -1
  18. package/dist/cjs/useLoaderData.d.cts +0 -4
  19. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  20. package/dist/cjs/useLoaderDeps.d.cts +0 -4
  21. package/dist/cjs/useLocation.cjs.map +1 -1
  22. package/dist/cjs/useLocation.d.cts +0 -5
  23. package/dist/cjs/useParams.cjs.map +1 -1
  24. package/dist/cjs/useParams.d.cts +0 -4
  25. package/dist/cjs/useRouter.cjs.map +1 -1
  26. package/dist/cjs/useRouter.d.cts +0 -5
  27. package/dist/cjs/useRouterState.cjs.map +1 -1
  28. package/dist/cjs/useRouterState.d.cts +0 -5
  29. package/dist/cjs/useSearch.cjs.map +1 -1
  30. package/dist/cjs/useSearch.d.cts +0 -4
  31. package/dist/esm/ClientOnly.d.ts +0 -8
  32. package/dist/esm/ClientOnly.js.map +1 -1
  33. package/dist/esm/HeadContent.d.ts +0 -4
  34. package/dist/esm/HeadContent.js.map +1 -1
  35. package/dist/esm/Matches.d.ts +0 -12
  36. package/dist/esm/Matches.js.map +1 -1
  37. package/dist/esm/RouterProvider.d.ts +0 -9
  38. package/dist/esm/RouterProvider.js.map +1 -1
  39. package/dist/esm/Scripts.d.ts +0 -4
  40. package/dist/esm/Scripts.js.map +1 -1
  41. package/dist/esm/awaited.d.ts +0 -5
  42. package/dist/esm/awaited.js.map +1 -1
  43. package/dist/esm/fileRoute.d.ts +0 -59
  44. package/dist/esm/fileRoute.js.map +1 -1
  45. package/dist/esm/router.d.ts +0 -5
  46. package/dist/esm/router.js.map +1 -1
  47. package/dist/esm/useLoaderData.d.ts +0 -4
  48. package/dist/esm/useLoaderData.js.map +1 -1
  49. package/dist/esm/useLoaderDeps.d.ts +0 -4
  50. package/dist/esm/useLoaderDeps.js.map +1 -1
  51. package/dist/esm/useLocation.d.ts +0 -5
  52. package/dist/esm/useLocation.js.map +1 -1
  53. package/dist/esm/useParams.d.ts +0 -4
  54. package/dist/esm/useParams.js.map +1 -1
  55. package/dist/esm/useRouter.d.ts +0 -5
  56. package/dist/esm/useRouter.js.map +1 -1
  57. package/dist/esm/useRouterState.d.ts +0 -5
  58. package/dist/esm/useRouterState.js.map +1 -1
  59. package/dist/esm/useSearch.d.ts +0 -4
  60. package/dist/esm/useSearch.js.map +1 -1
  61. package/package.json +2 -2
  62. package/src/ClientOnly.tsx +0 -8
  63. package/src/HeadContent.tsx +0 -4
  64. package/src/Matches.tsx +0 -12
  65. package/src/RouterProvider.tsx +0 -9
  66. package/src/Scripts.tsx +0 -4
  67. package/src/awaited.tsx +0 -5
  68. package/src/fileRoute.ts +0 -59
  69. package/src/router.ts +0 -5
  70. package/src/useLoaderData.tsx +0 -4
  71. package/src/useLoaderDeps.tsx +0 -4
  72. package/src/useLocation.tsx +0 -5
  73. package/src/useParams.tsx +0 -4
  74. package/src/useRouter.tsx +0 -5
  75. package/src/useRouterState.tsx +0 -5
  76. package/src/useSearch.tsx +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ClientOnly.cjs","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 */\n/**\n * Render children only after client hydration; otherwise render `fallback`.\n * Useful for components that require browser-only APIs.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/clientOnlyComponent\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 */\n/**\n * Return a boolean indicating whether client hydration has occurred.\n */\nexport function useHydrated(): boolean {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n )\n}\n\nfunction subscribe() {\n return () => {}\n}\n"],"names":["jsx"],"mappings":";;;;AAmCO,SAAS,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,SAAO,YAAA,IACLA,2BAAAA,IAAC,MAAM,UAAN,EAAgB,SAAA,CAAS,IAE1BA,2BAAAA,IAAC,MAAM,UAAN,EAAgB,UAAA,SAAA,CAAS;AAE9B;AAwBO,SAAS,cAAuB;AACrC,SAAO,MAAM;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EAAA;AAEV;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;;;"}
1
+ {"version":3,"file":"ClientOnly.cjs","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"],"names":["jsx"],"mappings":";;;;AA8BO,SAAS,WAAW,EAAE,UAAU,WAAW,QAAyB;AACzE,SAAO,YAAA,IACLA,2BAAAA,IAAC,MAAM,UAAN,EAAgB,SAAA,CAAS,IAE1BA,2BAAAA,IAAC,MAAM,UAAN,EAAgB,UAAA,SAAA,CAAS;AAE9B;AAqBO,SAAS,cAAuB;AACrC,SAAO,MAAM;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EAAA;AAEV;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;;;"}
@@ -26,11 +26,6 @@ export interface ClientOnlyProps {
26
26
  * )
27
27
  * ```
28
28
  */
29
- /**
30
- * Render children only after client hydration; otherwise render `fallback`.
31
- * Useful for components that require browser-only APIs.
32
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/clientOnlyComponent
33
- */
34
29
  export declare function ClientOnly({ children, fallback }: ClientOnlyProps): import("react/jsx-runtime").JSX.Element;
35
30
  /**
36
31
  * Return a boolean indicating if the JS has been hydrated already.
@@ -51,7 +46,4 @@ export declare function ClientOnly({ children, fallback }: ClientOnlyProps): imp
51
46
  * ```
52
47
  * @returns True if the JS has been hydrated already, false otherwise.
53
48
  */
54
- /**
55
- * Return a boolean indicating whether client hydration has occurred.
56
- */
57
49
  export declare function useHydrated(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"HeadContent.cjs","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Build the list of head/link/meta/script tags to render for active matches.\n * Used internally by `HeadContent`.\n */\nexport const useTags = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const routeMeta = useRouterState({\n select: (state) => {\n return state.matches.map((match) => match.meta!).filter(Boolean)\n },\n })\n\n const meta: Array<RouterManagedTag> = React.useMemo(() => {\n const resultMeta: Array<RouterManagedTag> = []\n const metaByAttribute: Record<string, true> = {}\n let title: RouterManagedTag | undefined\n for (let i = routeMeta.length - 1; i >= 0; i--) {\n const metas = routeMeta[i]!\n for (let j = metas.length - 1; j >= 0; j--) {\n const m = metas[j]\n if (!m) continue\n\n if (m.title) {\n if (!title) {\n title = {\n tag: 'title',\n children: m.title,\n }\n }\n } else {\n const attribute = m.name ?? m.property\n if (attribute) {\n if (metaByAttribute[attribute]) {\n continue\n } else {\n metaByAttribute[attribute] = true\n }\n }\n\n resultMeta.push({\n tag: 'meta',\n attrs: {\n ...m,\n nonce,\n },\n })\n }\n }\n }\n\n if (title) {\n resultMeta.push(title)\n }\n\n if (nonce) {\n resultMeta.push({\n tag: 'meta',\n attrs: {\n property: 'csp-nonce',\n content: nonce,\n },\n })\n }\n resultMeta.reverse()\n\n return resultMeta\n }, [routeMeta, nonce])\n\n const links = useRouterState({\n select: (state) => {\n const constructed = state.matches\n .map((match) => match.links!)\n .filter(Boolean)\n .flat(1)\n .map((link) => ({\n tag: 'link',\n attrs: {\n ...link,\n nonce,\n },\n })) satisfies Array<RouterManagedTag>\n\n const manifest = router.ssr?.manifest\n\n // These are the assets extracted from the ViteManifest\n // using the `startManifestPlugin`\n const assets = state.matches\n .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n .filter(Boolean)\n .flat(1)\n .filter((asset) => asset.tag === 'link')\n .map(\n (asset) =>\n ({\n tag: 'link',\n attrs: {\n ...asset.attrs,\n suppressHydrationWarning: true,\n nonce,\n },\n }) satisfies RouterManagedTag,\n )\n\n return [...constructed, ...assets]\n },\n structuralSharing: true as any,\n })\n\n const preloadLinks = useRouterState({\n select: (state) => {\n const preloadLinks: Array<RouterManagedTag> = []\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n router.ssr?.manifest?.routes[route.id]?.preloads\n ?.filter(Boolean)\n .forEach((preload) => {\n preloadLinks.push({\n tag: 'link',\n attrs: {\n rel: 'modulepreload',\n href: preload,\n nonce,\n },\n })\n }),\n )\n\n return preloadLinks\n },\n structuralSharing: true as any,\n })\n\n const styles = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.styles!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...attrs }) => ({\n tag: 'style',\n attrs,\n children,\n nonce,\n })),\n structuralSharing: true as any,\n })\n\n const headScripts: Array<RouterManagedTag> = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.headScripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n structuralSharing: true as any,\n })\n\n return uniqBy(\n [\n ...meta,\n ...preloadLinks,\n ...links,\n ...styles,\n ...headScripts,\n ] as Array<RouterManagedTag>,\n (d) => {\n return JSON.stringify(d)\n },\n )\n}\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * It should be rendered in the `<head>` of your document.\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() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))\n}\n\nfunction uniqBy<T>(arr: Array<T>, fn: (item: T) => string) {\n const seen = new Set<string>()\n return arr.filter((item) => {\n const key = fn(item)\n if (seen.has(key)) {\n return false\n }\n seen.add(key)\n return true\n })\n}\n"],"names":["useRouter","useRouterState","React","preloadLinks","createElement","Asset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,UAAU,MAAM;AAC3B,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,QAAM,YAAYC,eAAAA,eAAe;AAAA,IAC/B,QAAQ,CAAC,UAAU;AAC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React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Build the list of head/link/meta/script tags to render for active matches.\n * Used internally by `HeadContent`.\n */\nexport const useTags = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const routeMeta = useRouterState({\n select: (state) => {\n return state.matches.map((match) => match.meta!).filter(Boolean)\n },\n })\n\n const meta: Array<RouterManagedTag> = React.useMemo(() => {\n const resultMeta: Array<RouterManagedTag> = []\n const metaByAttribute: Record<string, true> = {}\n let title: RouterManagedTag | undefined\n for (let i = routeMeta.length - 1; i >= 0; i--) {\n const metas = routeMeta[i]!\n for (let j = metas.length - 1; j >= 0; j--) {\n const m = metas[j]\n if (!m) continue\n\n if (m.title) {\n if (!title) {\n title = {\n tag: 'title',\n children: m.title,\n }\n }\n } else {\n const attribute = m.name ?? m.property\n if (attribute) {\n if (metaByAttribute[attribute]) {\n continue\n } else {\n metaByAttribute[attribute] = true\n }\n }\n\n resultMeta.push({\n tag: 'meta',\n attrs: {\n ...m,\n nonce,\n },\n })\n }\n }\n }\n\n if (title) {\n resultMeta.push(title)\n }\n\n if (nonce) {\n resultMeta.push({\n tag: 'meta',\n attrs: {\n property: 'csp-nonce',\n content: nonce,\n },\n })\n }\n resultMeta.reverse()\n\n return resultMeta\n }, [routeMeta, nonce])\n\n const links = useRouterState({\n select: (state) => {\n const constructed = state.matches\n .map((match) => match.links!)\n .filter(Boolean)\n .flat(1)\n .map((link) => ({\n tag: 'link',\n attrs: {\n ...link,\n nonce,\n },\n })) satisfies Array<RouterManagedTag>\n\n const manifest = router.ssr?.manifest\n\n // These are the assets extracted from the ViteManifest\n // using the `startManifestPlugin`\n const assets = state.matches\n .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n .filter(Boolean)\n .flat(1)\n .filter((asset) => asset.tag === 'link')\n .map(\n (asset) =>\n ({\n tag: 'link',\n attrs: {\n ...asset.attrs,\n suppressHydrationWarning: true,\n nonce,\n },\n }) satisfies RouterManagedTag,\n )\n\n return [...constructed, ...assets]\n },\n structuralSharing: true as any,\n })\n\n const preloadLinks = useRouterState({\n select: (state) => {\n const preloadLinks: Array<RouterManagedTag> = []\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n router.ssr?.manifest?.routes[route.id]?.preloads\n ?.filter(Boolean)\n .forEach((preload) => {\n preloadLinks.push({\n tag: 'link',\n attrs: {\n rel: 'modulepreload',\n href: preload,\n nonce,\n },\n })\n }),\n )\n\n return preloadLinks\n },\n structuralSharing: true as any,\n })\n\n const styles = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.styles!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...attrs }) => ({\n tag: 'style',\n attrs,\n children,\n nonce,\n })),\n structuralSharing: true as any,\n })\n\n const headScripts: Array<RouterManagedTag> = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.headScripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n nonce,\n },\n children,\n })),\n structuralSharing: true as any,\n })\n\n return uniqBy(\n [\n ...meta,\n ...preloadLinks,\n ...links,\n ...styles,\n ...headScripts,\n ] as Array<RouterManagedTag>,\n (d) => {\n return JSON.stringify(d)\n },\n )\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() {\n const tags = useTags()\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n return tags.map((tag) => (\n <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n ))\n}\n\nfunction uniqBy<T>(arr: Array<T>, fn: (item: T) => string) {\n const seen = new Set<string>()\n return arr.filter((item) => {\n const key = fn(item)\n if (seen.has(key)) {\n return false\n }\n seen.add(key)\n return true\n })\n}\n"],"names":["useRouter","useRouterState","React","preloadLinks","createElement","Asset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,UAAU,MAAM;AAC3B,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,QAAM,YAAYC,eAAAA,eAAe;AAAA,IAC/B,QAAQ,CAAC,UAAU;AACjB,aAAO,MAAM,QAAQ,IAAI,CAAC,UAAU,MAAM,IAAK,EAAE,OAAO,OAAO;AAAA,IACjE;AAAA,EAAA,CACD;AAED,QAAM,OAAgCC,iBAAM,QAAQ,MAAM;AACxD,UAAM,aAAsC,CAAA;AAC5C,UAAM,kBAAwC,CAAA;AAC9C,QAAI;AACJ,aAAS,IAAI,UAAU,SAAS,GAAG,KAAK,GAAG,KAAK;AAC9C,YAAM,QAAQ,UAAU,CAAC;AACzB,eAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,cAAM,IAAI,MAAM,CAAC;AACjB,YAAI,CAAC,EAAG;AAER,YAAI,EAAE,OAAO;AACX,cAAI,CAAC,OAAO;AACV,oBAAQ;AAAA,cACN,KAAK;AAAA,cACL,UAAU,EAAE;AAAA,YAAA;AAAA,UAEhB;AAAA,QACF,OAAO;AACL,gBAAM,YAAY,EAAE,QAAQ,EAAE;AAC9B,cAAI,WAAW;AACb,gBAAI,gBAAgB,SAAS,GAAG;AAC9B;AAAA,YACF,OAAO;AACL,8BAAgB,SAAS,IAAI;AAAA,YAC/B;AAAA,UACF;AAEA,qBAAW,KAAK;AAAA,YACd,KAAK;AAAA,YACL,OAAO;AAAA,cACL,GAAG;AAAA,cACH;AAAA,YAAA;AAAA,UACF,CACD;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAEA,QAAI,OAAO;AACT,iBAAW,KAAK,KAAK;AAAA,IACvB;AAEA,QAAI,OAAO;AACT,iBAAW,KAAK;AAAA,QACd,KAAK;AAAA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QAAM,2BAAW,IAAA;AACjB,SAAO,IAAI,OAAO,CAAC,SAAS;AAC1B,UAAM,MAAM,GAAG,IAAI;AACnB,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AACZ,WAAO;AAAA,EACT,CAAC;AACH;;;"}
@@ -4,10 +4,6 @@ import { RouterManagedTag } from '@tanstack/router-core';
4
4
  * Used internally by `HeadContent`.
5
5
  */
6
6
  export declare const useTags: () => RouterManagedTag[];
7
- /**
8
- * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
9
- * It should be rendered in the `<head>` of your document.
10
- */
11
7
  /**
12
8
  * Render route-managed head tags (title, meta, links, styles, head scripts).
13
9
  * Place inside the document head of your app shell.
@@ -1 +1 @@
1
- {"version":3,"file":"Matches.cjs","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport { SafeFragment } from './SafeFragment'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<React.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<React.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<React.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\n/**\n * Internal component that renders the router's active match tree with\n * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.\n */\n/**\n * Internal component that renders the router's active match tree with\n * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.\n */\nexport function Matches() {\n const router = useRouter()\n const rootRoute: AnyRoute = router.routesById[rootRouteId]\n\n const PendingComponent =\n rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent\n\n const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const ResolvedSuspense =\n router.isServer || (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : React.Suspense\n\n const inner = (\n <ResolvedSuspense fallback={pendingElement}>\n {!router.isServer && <Transitioner />}\n <MatchesInner />\n </ResolvedSuspense>\n )\n\n return router.options.InnerWrap ? (\n <router.options.InnerWrap>{inner}</router.options.InnerWrap>\n ) : (\n inner\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = matchId ? <Match matchId={matchId} /> : null\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchComponent}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\n/**\n * Create a matcher function for testing locations against route definitions.\n *\n * The returned function accepts standard navigation options (`to`, `params`,\n * `search`, etc.) and returns either `false` (no match) or the matched params\n * object when the route matches the current or pending location.\n *\n * Useful for conditional rendering and active UI states.\n *\n * @returns A `matchRoute(options)` function that returns `false` or params.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchRouteHook\n */\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n useRouterState({\n select: (s) => [s.location.href, s.resolvedLocation?.href, s.status],\n structuralSharing: true as any,\n })\n\n return React.useCallback(\n <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ):\n | false\n | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']> => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n },\n [router],\n )\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => React.ReactNode)\n | React.ReactNode\n}\n\n/**\n * Component that conditionally renders its children based on whether a route\n * matches the provided `from`/`to` options. If `children` is a function, it\n * receives the matched params object.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/matchRouteComponent\n */\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any) as boolean\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return params ? props.children : null\n}\n\nexport interface UseMatchesBaseOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n matches: Array<MakeRouteMatchUnion<TRouter>>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any) as UseMatchesResult<TRouter, TSelected>\n}\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @returns The array of matches (or the selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\n/**\n * Read the full array of active route matches or select a derived subset\n * from the parent boundary up to (but not including) the current match.\n */\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n const contextMatchId = React.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any)\n}\n\n/**\n * Read the array of active route matches that are children of the current\n * match (or selected parent) in the match tree.\n */\n/**\n * Read the array of active route matches that are children of the current\n * match (or selected parent) in the match tree.\n */\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n const contextMatchId = React.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any)\n}\n"],"names":["useRouter","rootRouteId","jsx","SafeFragment","React","jsxs","Transitioner","useRouterState","Match","matchContext","CatchBoundary","ErrorComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDO,SAAS,UAAU;AACxB,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,YAAsB,OAAO,WAAWC,sBAAW;AAEzD,QAAM,mBACJ,UAAU,QAAQ,oBAAoB,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D,gBAAU,QAAQ;AAAA,QAChB,QAAQ,UAAU,CAAC,MAAM,EAAE,OAAO,cAAc,IAAI;AAAA,MAAA;AAEtD,aAAO,MAAM,SAAS,KAAK,OAAO,OAAO,IAAI;AAAA,IAC/C;AAAA,IACA,mBAAmB,MAAM;AAAA,EAAA,CACnB;AACV;;;;;;;"}
1
+ {"version":3,"file":"Matches.cjs","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport { SafeFragment } from './SafeFragment'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRoute,\n AnyRouter,\n DeepPartial,\n Expand,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<React.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<React.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n styles?: Array<React.JSX.IntrinsicElements['style'] | undefined>\n headScripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\n/**\n * Internal component that renders the router's active match tree with\n * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.\n */\nexport function Matches() {\n const router = useRouter()\n const rootRoute: AnyRoute = router.routesById[rootRouteId]\n\n const PendingComponent =\n rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent\n\n const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const ResolvedSuspense =\n router.isServer || (typeof document !== 'undefined' && router.ssr)\n ? SafeFragment\n : React.Suspense\n\n const inner = (\n <ResolvedSuspense fallback={pendingElement}>\n {!router.isServer && <Transitioner />}\n <MatchesInner />\n </ResolvedSuspense>\n )\n\n return router.options.InnerWrap ? (\n <router.options.InnerWrap>{inner}</router.options.InnerWrap>\n ) : (\n inner\n )\n}\n\nfunction MatchesInner() {\n const router = useRouter()\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n const matchComponent = matchId ? <Match matchId={matchId} /> : null\n\n return (\n <matchContext.Provider value={matchId}>\n {router.options.disableGlobalCatchBoundary ? (\n matchComponent\n ) : (\n <CatchBoundary\n getResetKey={() => resetKey}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchComponent}\n </CatchBoundary>\n )}\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\n/**\n * Create a matcher function for testing locations against route definitions.\n *\n * The returned function accepts standard navigation options (`to`, `params`,\n * `search`, etc.) and returns either `false` (no match) or the matched params\n * object when the route matches the current or pending location.\n *\n * Useful for conditional rendering and active UI states.\n *\n * @returns A `matchRoute(options)` function that returns `false` or params.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchRouteHook\n */\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n useRouterState({\n select: (s) => [s.location.href, s.resolvedLocation?.href, s.status],\n structuralSharing: true as any,\n })\n\n return React.useCallback(\n <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ):\n | false\n | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']> => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n },\n [router],\n )\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => React.ReactNode)\n | React.ReactNode\n}\n\n/**\n * Component that conditionally renders its children based on whether a route\n * matches the provided `from`/`to` options. If `children` is a function, it\n * receives the matched params object.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/matchRouteComponent\n */\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any) as boolean\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return params ? props.children : null\n}\n\nexport interface UseMatchesBaseOptions<\n TRouter extends AnyRouter,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n matches: Array<MakeRouteMatchUnion<TRouter>>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any) as UseMatchesResult<TRouter, TSelected>\n}\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @returns The array of matches (or the selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n const contextMatchId = React.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any)\n}\n\n/**\n * Read the array of active route matches that are children of the current\n * match (or selected parent) in the match tree.\n */\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n const contextMatchId = React.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n structuralSharing: opts?.structuralSharing,\n } as any)\n}\n"],"names":["useRouter","rootRouteId","jsx","SafeFragment","React","jsxs","Transitioner","useRouterState","Match","matchContext","CatchBoundary","ErrorComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,SAAS,UAAU;AACxB,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,YAAsB,OAAO,WAAWC,sBAAW;AAEzD,QAAM,mBACJ,UAAU,QAAQ,oBAAoB,OAAO,QAAQ;AAEvD,QAAM,iBAAiB,mBAAmBC,2BAAAA,IAAC,kBAAA,CAAA,CAAiB,IAAK;AAGjE,QAAM,mBACJ,OAAO,YAAa,OAAO,aAAa,eAAe,OAAO,MAC1DC,4BACAC,iBAAM;AAEZ,QAAM,QACJC,2BAAAA,KAAC,kBAAA,EAAiB,UAAU,gBACzB,UAAA;AAAA,IAAA,CAAC,OAAO,YAAYH,+BAACI,aAAAA,cAAA,CAAA,CAAa;AAAA,mCAClC,cAAA,CAAA,CAAa;AAAA,EAAA,GAChB;AAGF,SAAO,OAAO,QAAQ,YACpBJ,2BAAAA,IAAC,OAAO,QAAQ,WAAf,EAA0B,UAAA,MAAA,CAAM,IAEjC;AAEJ;A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MAAI,OAAO,MAAM,aAAa,YAAY;AACxC,WAAQ,MAAM,SAAiB,MAAM;AAAA,EACvC;AAEA,SAAO,SAAS,MAAM,WAAW;AACnC;AAiBO,SAAS,WAKd,MAEsC;AACtC,SAAOG,8BAAe;AAAA,IACpB,QAAQ,CAAC,UAA6C;AACpD,YAAM,UAAU,MAAM;AACtB,aAAO,MAAM,SACT,KAAK,OAAO,OAA8C,IAC1D;AAAA,IACN;AAAA,IACA,mBAAmB,MAAM;AAAA,EAAA,CACnB;AACV;AAkBO,SAAS,iBAKd,MAEsC;AACtC,QAAM,iBAAiBH,iBAAM,WAAWK,yBAAY;AAEpD,SAAO,WAAW;AAAA,IAChB,QAAQ,CAAC,YAAiD;AACxD,gBAAU,QAAQ;AAAA,QAChB;AAAA,QACA,QAAQ,UAAU,CAAC,MAAM,EAAE,OAAO,cAAc;AAAA,MAAA;AAElD,aAAO,MAAM,SAAS,KAAK,OAAO,OAAO,IAAI;AAAA,IAC/C;AAAA,IACA,mBAAmB,MAAM;AAAA,EAAA,CACnB;AACV;AAMO,SAAS,gBAKd,MAEsC;AACtC,QAAM,iBAAiBL,iBAAM,WAAWK,yBAAY;AAEpD,SAAO,WAAW;AAAA,IAChB,QAAQ,CAAC,YAAiD;AACxD,gBAAU,QAAQ;AAAA,QAChB,QAAQ,UAAU,CAAC,MAAM,EAAE,OAAO,cAAc,IAAI;AAAA,MAAA;AAEtD,aAAO,MAAM,SAAS,KAAK,OAAO,OAAO,IAAI;AAAA,IAC/C;AAAA,IACA,mBAAmB,MAAM;AAAA,EAAA,CACnB;AACV;;;;;;;"}
@@ -10,10 +10,6 @@ declare module '@tanstack/router-core' {
10
10
  headScripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>;
11
11
  }
12
12
  }
13
- /**
14
- * Internal component that renders the router's active match tree with
15
- * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
16
- */
17
13
  /**
18
14
  * Internal component that renders the router's active match tree with
19
15
  * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.
@@ -64,15 +60,7 @@ export declare function useMatches<TRouter extends AnyRouter = RegisteredRouter,
64
60
  *
65
61
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook
66
62
  */
67
- /**
68
- * Read the full array of active route matches or select a derived subset
69
- * from the parent boundary up to (but not including) the current match.
70
- */
71
63
  export declare function useParentMatches<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>): UseMatchesResult<TRouter, TSelected>;
72
- /**
73
- * Read the array of active route matches that are children of the current
74
- * match (or selected parent) in the match tree.
75
- */
76
64
  /**
77
65
  * Read the array of active route matches that are children of the current
78
66
  * match (or selected parent) in the match tree.
@@ -1 +1 @@
1
- {"version":3,"file":"RouterProvider.cjs","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Matches } from './Matches'\nimport { getRouterContext } from './routerContext'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\n/**\n * Low-level provider that places the router into React context and optionally\n * updates router options from props. Most apps should use `RouterProvider`.\n */\n/**\n * Low-level provider that places the router into React context and optionally\n * updates router options from props. Most apps should use `RouterProvider`.\n */\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: React.ReactNode\n}) {\n if (Object.keys(rest).length > 0) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n }\n\n const routerContext = getRouterContext()\n\n const provider = (\n <routerContext.Provider value={router as AnyRouter}>\n {children}\n </routerContext.Provider>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\n/**\n * Top-level component that renders the active route matches and provides the\n * router to the React tree via context.\n *\n * Accepts the same options as `createRouter` via props to update the router\n * instance after creation.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\n/**\n * Top-level component that renders the active route matches and provides the\n * router to the React tree via context. Accepts the same options as\n * `createRouter` via props to update the router instance.\n */\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n <Matches />\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["routerContext","getRouterContext","jsx","Matches"],"mappings":";;;;;AAiBO,SAAS,sBAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAEG;AACD,MAAI,OAAO,KAAK,IAAI,EAAE,SAAS,GAAG;AAEhC,WAAO,OAAO;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,GAAG;AAAA,MACH,SAAS;AAAA,QACP,GAAG,OAAO,QAAQ;AAAA,QAClB,GAAG,KAAK;AAAA,MAAA;AAAA,IACV,CACM;AAAA,EACV;AAEA,QAAMA,kBAAgBC,cAAAA,iBAAA;AAEtB,QAAM,WACJC,2BAAAA,IAACF,gBAAc,UAAd,EAAuB,OAAO,QAC5B,UACH;AAGF,MAAI,OAAO,QAAQ,MAAM;AACvB,WAAOE,2BAAAA,IAAC,OAAO,QAAQ,MAAf,EAAqB,UAAA,UAAS;AAAA,EACxC;AAEA,SAAO;AACT;AAgBO,SAAS,eAGd,EAAE,QAAQ,GAAG,QAA2C;AACxD,wCACG,uBAAA,EAAsB,QAAiB,GAAG,MACzC,UAAAA,+BAACC,QAAAA,WAAQ,GACX;AAEJ;;;"}
1
+ {"version":3,"file":"RouterProvider.cjs","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Matches } from './Matches'\nimport { getRouterContext } from './routerContext'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\n/**\n * Low-level provider that places the router into React context and optionally\n * updates router options from props. Most apps should use `RouterProvider`.\n */\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: React.ReactNode\n}) {\n if (Object.keys(rest).length > 0) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n }\n\n const routerContext = getRouterContext()\n\n const provider = (\n <routerContext.Provider value={router as AnyRouter}>\n {children}\n </routerContext.Provider>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\n/**\n * Top-level component that renders the active route matches and provides the\n * router to the React tree via context.\n *\n * Accepts the same options as `createRouter` via props to update the router\n * instance after creation.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n <Matches />\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n NonNullable<TRouter['options']['defaultStructuralSharing']>,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["routerContext","getRouterContext","jsx","Matches"],"mappings":";;;;;AAaO,SAAS,sBAGd;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAEG;AACD,MAAI,OAAO,KAAK,IAAI,EAAE,SAAS,GAAG;AAEhC,WAAO,OAAO;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,GAAG;AAAA,MACH,SAAS;AAAA,QACP,GAAG,OAAO,QAAQ;AAAA,QAClB,GAAG,KAAK;AAAA,MAAA;AAAA,IACV,CACM;AAAA,EACV;AAEA,QAAMA,kBAAgBC,cAAAA,iBAAA;AAEtB,QAAM,WACJC,2BAAAA,IAACF,gBAAc,UAAd,EAAuB,OAAO,QAC5B,UACH;AAGF,MAAI,OAAO,QAAQ,MAAM;AACvB,WAAOE,2BAAAA,IAAC,OAAO,QAAQ,MAAf,EAAqB,UAAA,UAAS;AAAA,EACxC;AAEA,SAAO;AACT;AAWO,SAAS,eAGd,EAAE,QAAQ,GAAG,QAA2C;AACxD,wCACG,uBAAA,EAAsB,QAAiB,GAAG,MACzC,UAAAA,+BAACC,QAAAA,WAAQ,GACX;AAEJ;;;"}
@@ -1,9 +1,5 @@
1
1
  import { AnyRouter, RegisteredRouter, RouterOptions } from '@tanstack/router-core';
2
2
  import * as React from 'react';
3
- /**
4
- * Low-level provider that places the router into React context and optionally
5
- * updates router options from props. Most apps should use `RouterProvider`.
6
- */
7
3
  /**
8
4
  * Low-level provider that places the router into React context and optionally
9
5
  * updates router options from props. Most apps should use `RouterProvider`.
@@ -20,11 +16,6 @@ export declare function RouterContextProvider<TRouter extends AnyRouter = Regist
20
16
  *
21
17
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
22
18
  */
23
- /**
24
- * Top-level component that renders the active route matches and provides the
25
- * router to the React tree via context. Accepts the same options as
26
- * `createRouter` via props to update the router instance.
27
- */
28
19
  export declare function RouterProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouter, TDehydrated>): import("react/jsx-runtime").JSX.Element;
29
20
  export type RouterProps<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, NonNullable<TRouter['options']['defaultStructuralSharing']>, TRouter['history'], TDehydrated>, 'context'> & {
30
21
  router: TRouter;
@@ -1 +1 @@
1
- {"version":3,"file":"Scripts.cjs","sources":["../../src/Scripts.tsx"],"sourcesContent":["import { Asset } from './Asset'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Render body script tags collected from route matches and SSR manifests.\n * Should be placed near the end of the document body.\n */\n/**\n * Render body script tags collected from route matches and SSR manifests.\n * Should be placed near the end of the document body.\n */\nexport const Scripts = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const assetScripts = useRouterState({\n select: (state) => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as any)\n }),\n )\n\n return assetScripts\n },\n structuralSharing: true as any,\n })\n\n const { scripts } = useRouterState({\n select: (state) => ({\n scripts: (\n state.matches\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n suppressHydrationWarning: true,\n nonce,\n },\n children,\n })),\n }),\n structuralSharing: true as any,\n })\n\n let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n if (router.serverSsr) {\n serverBufferedScript = router.serverSsr.takeBufferedScripts()\n }\n\n const allScripts = [...scripts, ...assetScripts] as Array<RouterManagedTag>\n\n if (serverBufferedScript) {\n allScripts.unshift(serverBufferedScript)\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n ))}\n </>\n )\n}\n"],"names":["useRouter","useRouterState","assetScripts","Asset"],"mappings":";;;;;;;AAaO,MAAM,UAAU,MAAM;AAC3B,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,QAAM,eAAeC,eAAAA,eAAe;AAAA,IAClC,QAAQ,CAAC,UAAU;AACjB,YAAMC,gBAAwC,CAAA;AAC9C,YAAM,WAAW,OAAO,KAAK;AAE7B,UAAI,CAAC,UAAU;AACb,eAAO,CAAA;AAAA,MACT;AAEA,YAAM,QACH,IAAI,CAAC,UAAU,OAAO,gBAAgB,MAAM,OAAO,CAAE,EACrD;AAAA,QAAQ,CAAC,UACR,SAAS,OAAO,MAAM,EAAE,GAAG,QACvB,OAAO,CAAC,MAAM,EAAE,QAAQ,QAAQ,EACjC,QAAQ,CAAC,UAAU;AAClBA,wBAAa,KAAK;AAAA,YAChB,KAAK;AAAA,YACL,OAAO,EAAE,GAAG,MAAM,OAAO,MAAA;AAAA,YACzB,UAAU,MAAM;AAAA,UAAA,CACV;AAAA,QACV,CAAC;AAAA,MAAA;AAGP,aAAOA;AAAAA,IACT;AAAA,IACA,mBAAmB;AAAA,EAAA,CACpB;AAED,QAAM,EAAE,QAAA,IAAYD,8BAAe;AAAA,IACjC,QAAQ,CAAC,WAAW;AAAA,MAClB,SACE,MAAM,QACH,IAAI,CAAC,UAAU,MAAM,OAAQ,EAC7B,KAAK,CAAC,EACN,OAAO,OAAO,EACjB,IAAI,CAAC,EAAE,UAAU,GAAG,cAAc;AAAA,QAClC,KAAK;AAAA,QACL,OAAO;AAAA,UACL,GAAG;AAAA,UACH,0BAA0B;AAAA,UAC1B;AAAA,QAAA;AAAA,QAEF;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,IAEJ,mBAAmB;AAAA,EAAA,CACpB;AAED,MAAI,uBAAqD;AAEzD,MAAI,OAAO,WAAW;AACpB,2BAAuB,OAAO,UAAU,oBAAA;AAAA,EAC1C;AAEA,QAAM,aAAa,CAAC,GAAG,SAAS,GAAG,YAAY;AAE/C,MAAI,sBAAsB;AACxB,eAAW,QAAQ,oBAAoB;AAAA,EACzC;AAEA,+DAEK,UAAA,WAAW,IAAI,CAAC,OAAO,0CACrBE,MAAAA,OAAA,EAAO,GAAG,OAAO,KAAK,eAAe,MAAM,GAAG,IAAI,CAAC,IAAI,CACzD,GACH;AAEJ;;"}
1
+ {"version":3,"file":"Scripts.cjs","sources":["../../src/Scripts.tsx"],"sourcesContent":["import { Asset } from './Asset'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Render body script tags collected from route matches and SSR manifests.\n * Should be placed near the end of the document body.\n */\nexport const Scripts = () => {\n const router = useRouter()\n const nonce = router.options.ssr?.nonce\n const assetScripts = useRouterState({\n select: (state) => {\n const assetScripts: Array<RouterManagedTag> = []\n const manifest = router.ssr?.manifest\n\n if (!manifest) {\n return []\n }\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n manifest.routes[route.id]?.assets\n ?.filter((d) => d.tag === 'script')\n .forEach((asset) => {\n assetScripts.push({\n tag: 'script',\n attrs: { ...asset.attrs, nonce },\n children: asset.children,\n } as any)\n }),\n )\n\n return assetScripts\n },\n structuralSharing: true as any,\n })\n\n const { scripts } = useRouterState({\n select: (state) => ({\n scripts: (\n state.matches\n .map((match) => match.scripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n suppressHydrationWarning: true,\n nonce,\n },\n children,\n })),\n }),\n structuralSharing: true as any,\n })\n\n let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n if (router.serverSsr) {\n serverBufferedScript = router.serverSsr.takeBufferedScripts()\n }\n\n const allScripts = [...scripts, ...assetScripts] as Array<RouterManagedTag>\n\n if (serverBufferedScript) {\n allScripts.unshift(serverBufferedScript)\n }\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n ))}\n </>\n )\n}\n"],"names":["useRouter","useRouterState","assetScripts","Asset"],"mappings":";;;;;;;AASO,MAAM,UAAU,MAAM;AAC3B,QAAM,SAASA,UAAAA,UAAA;AACf,QAAM,QAAQ,OAAO,QAAQ,KAAK;AAClC,QAAM,eAAeC,eAAAA,eAAe;AAAA,IAClC,QAAQ,CAAC,UAAU;AACjB,YAAMC,gBAAwC,CAAA;AAC9C,YAAM,WAAW,OAAO,KAAK;AAE7B,UAAI,CAAC,UAAU;AACb,eAAO,CAAA;AAAA,MACT;AAEA,YAAM,QACH,IAAI,CAAC,UAAU,OAAO,gBAAgB,MAAM,OAAO,CAAE,EACrD;AAAA,QAAQ,CAAC,UACR,SAAS,OAAO,MAAM,EAAE,GAAG,QACvB,OAAO,CAAC,MAAM,EAAE,QAAQ,QAAQ,EACjC,QAAQ,CAAC,UAAU;AAClBA,wBAAa,KAAK;AAAA,YAChB,KAAK;AAAA,YACL,OAAO,EAAE,GAAG,MAAM,OAAO,MAAA;AAAA,YACzB,UAAU,MAAM;AAAA,UAAA,CACV;AAAA,QACV,CAAC;AAAA,MAAA;AAGP,aAAOA;AAAAA,IACT;AAAA,IACA,mBAAmB;AAAA,EAAA,CACpB;AAED,QAAM,EAAE,QAAA,IAAYD,8BAAe;AAAA,IACjC,QAAQ,CAAC,WAAW;AAAA,MAClB,SACE,MAAM,QACH,IAAI,CAAC,UAAU,MAAM,OAAQ,EAC7B,KAAK,CAAC,EACN,OAAO,OAAO,EACjB,IAAI,CAAC,EAAE,UAAU,GAAG,cAAc;AAAA,QAClC,KAAK;AAAA,QACL,OAAO;AAAA,UACL,GAAG;AAAA,UACH,0BAA0B;AAAA,UAC1B;AAAA,QAAA;AAAA,QAEF;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,IAEJ,mBAAmB;AAAA,EAAA,CACpB;AAED,MAAI,uBAAqD;AAEzD,MAAI,OAAO,WAAW;AACpB,2BAAuB,OAAO,UAAU,oBAAA;AAAA,EAC1C;AAEA,QAAM,aAAa,CAAC,GAAG,SAAS,GAAG,YAAY;AAE/C,MAAI,sBAAsB;AACxB,eAAW,QAAQ,oBAAoB;AAAA,EACzC;AAEA,+DAEK,UAAA,WAAW,IAAI,CAAC,OAAO,0CACrBE,MAAAA,OAAA,EAAO,GAAG,OAAO,KAAK,eAAe,MAAM,GAAG,IAAI,CAAC,IAAI,CACzD,GACH;AAEJ;;"}
@@ -1,7 +1,3 @@
1
- /**
2
- * Render body script tags collected from route matches and SSR manifests.
3
- * Should be placed near the end of the document body.
4
- */
5
1
  /**
6
2
  * Render body script tags collected from route matches and SSR manifests.
7
3
  * Should be placed near the end of the document body.
@@ -1 +1 @@
1
- {"version":3,"file":"awaited.cjs","sources":["../../src/awaited.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { TSR_DEFERRED_PROMISE, defer } from '@tanstack/router-core'\nimport type { DeferredPromise } from '@tanstack/router-core'\n\nexport type AwaitOptions<T> = {\n promise: Promise<T>\n}\n\n/** Suspend until a deferred promise resolves/rejects and return its data. */\n/** Suspend until a deferred promise resolves or rejects and return its data. */\nexport function useAwaited<T>({\n promise: _promise,\n}: AwaitOptions<T>): [T, DeferredPromise<T>] {\n const promise = defer(_promise)\n\n if (promise[TSR_DEFERRED_PROMISE].status === 'pending') {\n throw promise\n }\n\n if (promise[TSR_DEFERRED_PROMISE].status === 'error') {\n throw promise[TSR_DEFERRED_PROMISE].error\n }\n\n return [promise[TSR_DEFERRED_PROMISE].data, promise]\n}\n\n/**\n * Component that suspends on a deferred promise and renders its child with\n * the resolved value. Optionally provides a Suspense fallback.\n */\n/**\n * Component that suspends on a deferred promise and renders its child with\n * the resolved value. Optionally provides a Suspense fallback.\n */\nexport function Await<T>(\n props: AwaitOptions<T> & {\n fallback?: React.ReactNode\n children: (result: T) => React.ReactNode\n },\n) {\n const inner = <AwaitInner {...props} />\n if (props.fallback) {\n return <React.Suspense fallback={props.fallback}>{inner}</React.Suspense>\n }\n return inner\n}\n\nfunction AwaitInner<T>(\n props: AwaitOptions<T> & {\n fallback?: React.ReactNode\n children: (result: T) => React.ReactNode\n },\n): React.JSX.Element {\n const [data] = useAwaited(props)\n\n return props.children(data) as React.JSX.Element\n}\n"],"names":["defer","TSR_DEFERRED_PROMISE","jsx","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,WAAc;AAAA,EAC5B,SAAS;AACX,GAA6C;AAC3C,QAAM,UAAUA,WAAAA,MAAM,QAAQ;AAE9B,MAAI,QAAQC,WAAAA,oBAAoB,EAAE,WAAW,WAAW;AACtD,UAAM;AAAA,EACR;AAEA,MAAI,QAAQA,WAAAA,oBAAoB,EAAE,WAAW,SAAS;AACpD,UAAM,QAAQA,WAAAA,oBAAoB,EAAE;AAAA,EACtC;AAEA,SAAO,CAAC,QAAQA,WAAAA,oBAAoB,EAAE,MAAM,OAAO;AACrD;AAUO,SAAS,MACd,OAIA;AACA,QAAM,QAAQC,2BAAAA,IAAC,YAAA,EAAY,GAAG,MAAA,CAAO;AACrC,MAAI,MAAM,UAAU;AAClB,0CAAQC,iBAAM,UAAN,EAAe,UAAU,MAAM,UAAW,UAAA,OAAM;AAAA,EAC1D;AACA,SAAO;AACT;AAEA,SAAS,WACP,OAImB;AACnB,QAAM,CAAC,IAAI,IAAI,WAAW,KAAK;AAE/B,SAAO,MAAM,SAAS,IAAI;AAC5B;;;"}
1
+ {"version":3,"file":"awaited.cjs","sources":["../../src/awaited.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { TSR_DEFERRED_PROMISE, defer } from '@tanstack/router-core'\nimport type { DeferredPromise } from '@tanstack/router-core'\n\nexport type AwaitOptions<T> = {\n promise: Promise<T>\n}\n\n/** Suspend until a deferred promise resolves or rejects and return its data. */\nexport function useAwaited<T>({\n promise: _promise,\n}: AwaitOptions<T>): [T, DeferredPromise<T>] {\n const promise = defer(_promise)\n\n if (promise[TSR_DEFERRED_PROMISE].status === 'pending') {\n throw promise\n }\n\n if (promise[TSR_DEFERRED_PROMISE].status === 'error') {\n throw promise[TSR_DEFERRED_PROMISE].error\n }\n\n return [promise[TSR_DEFERRED_PROMISE].data, promise]\n}\n\n/**\n * Component that suspends on a deferred promise and renders its child with\n * the resolved value. Optionally provides a Suspense fallback.\n */\nexport function Await<T>(\n props: AwaitOptions<T> & {\n fallback?: React.ReactNode\n children: (result: T) => React.ReactNode\n },\n) {\n const inner = <AwaitInner {...props} />\n if (props.fallback) {\n return <React.Suspense fallback={props.fallback}>{inner}</React.Suspense>\n }\n return inner\n}\n\nfunction AwaitInner<T>(\n props: AwaitOptions<T> & {\n fallback?: React.ReactNode\n children: (result: T) => React.ReactNode\n },\n): React.JSX.Element {\n const [data] = useAwaited(props)\n\n return props.children(data) as React.JSX.Element\n}\n"],"names":["defer","TSR_DEFERRED_PROMISE","jsx","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUO,SAAS,WAAc;AAAA,EAC5B,SAAS;AACX,GAA6C;AAC3C,QAAM,UAAUA,WAAAA,MAAM,QAAQ;AAE9B,MAAI,QAAQC,WAAAA,oBAAoB,EAAE,WAAW,WAAW;AACtD,UAAM;AAAA,EACR;AAEA,MAAI,QAAQA,WAAAA,oBAAoB,EAAE,WAAW,SAAS;AACpD,UAAM,QAAQA,WAAAA,oBAAoB,EAAE;AAAA,EACtC;AAEA,SAAO,CAAC,QAAQA,WAAAA,oBAAoB,EAAE,MAAM,OAAO;AACrD;AAMO,SAAS,MACd,OAIA;AACA,QAAM,QAAQC,2BAAAA,IAAC,YAAA,EAAY,GAAG,MAAA,CAAO;AACrC,MAAI,MAAM,UAAU;AAClB,0CAAQC,iBAAM,UAAN,EAAe,UAAU,MAAM,UAAW,UAAA,OAAM;AAAA,EAC1D;AACA,SAAO;AACT;AAEA,SAAS,WACP,OAImB;AACnB,QAAM,CAAC,IAAI,IAAI,WAAW,KAAK;AAE/B,SAAO,MAAM,SAAS,IAAI;AAC5B;;;"}
@@ -3,13 +3,8 @@ import * as React from 'react';
3
3
  export type AwaitOptions<T> = {
4
4
  promise: Promise<T>;
5
5
  };
6
- /** Suspend until a deferred promise resolves/rejects and return its data. */
7
6
  /** Suspend until a deferred promise resolves or rejects and return its data. */
8
7
  export declare function useAwaited<T>({ promise: _promise, }: AwaitOptions<T>): [T, DeferredPromise<T>];
9
- /**
10
- * Component that suspends on a deferred promise and renders its child with
11
- * the resolved value. Optionally provides a Suspense fallback.
12
- */
13
8
  /**
14
9
  * Component that suspends on a deferred promise and renders its child with
15
10
  * the resolved value. Optionally provides a Suspense fallback.
@@ -1 +1 @@
1
- {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\n/**\n * Creates a file-based Route factory for a given path.\n *\n * Used by TanStack Router's file-based routing to associate a file with a\n * route. The returned function accepts standard route options. In normal usage\n * the `path` string is inserted and maintained by the `tsr` generator.\n *\n * @param path File path literal for the route (usually auto-generated).\n * @returns A function that accepts Route options and returns a Route instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction\n */\n/**\n * Creates a file-based Route factory for a given path.\n *\n * Used by TanStack Router's file-based routing to associate a file with a\n * route. The returned function accepts standard route options. In normal usage\n * the `path` string is inserted and maintained by the `tsr` generator.\n *\n * @param path File path literal for the route (usually auto-generated).\n * @returns A function that accepts Route options and returns a Route instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction\n */\n/**\n * Creates a file-based Route factory for a given path.\n * Used by file-based routing to associate a file with a route. The returned\n * function accepts standard route options; the path is typically auto-managed\n * by the generator.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction\n */\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n const TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\n/**\n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the main route file via `createFileRoute`.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n Register,\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n structuralSharing: opts?.structuralSharing,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useSearch({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useParams({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\n/**\n * Creates a lazily-configurable code-based route stub by ID.\n *\n * Use this for code-splitting with code-based routes. The returned function\n * accepts only non-critical route options like `component`, `pendingComponent`,\n * `errorComponent`, and `notFoundComponent` which are applied when the route\n * is matched.\n *\n * @param id Route ID string literal to associate with the lazy route.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction\n */\n/**\n * Creates a lazily-configurable code-based route stub by ID.\n *\n * Use this for code-splitting with code-based routes. The returned function\n * accepts only non-critical route options like `component`, `pendingComponent`,\n * `errorComponent`, and `notFoundComponent` which are applied when the route\n * is matched.\n *\n * @param id Route ID string literal to associate with the lazy route.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction\n */\n/**\n * Create a lazily-configurable code-based route stub by ID.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction\n */\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\n\n/**\n * Creates a lazily-configurable file-based route stub by file path.\n *\n * Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).\n * The returned function accepts only non-critical route options like\n * `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.\n *\n * @param id File path literal for the route file.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction\n */\n/**\n * Creates a lazily-configurable file-based route stub by file path.\n *\n * Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).\n * The returned function accepts only non-critical route options like\n * `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.\n *\n * @param id File path literal for the route file.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction\n */\n/**\n * Create a lazily-configurable file-based route stub by file path.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction\n */\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;AAkEO,SAAS,gBAQd,MAC0E;AAC1E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,IAAI,UAA0D,MAAM;AAAA,MACzE,QAAQ;AAAA,IAAA,CACT,EAAE,YAAY,IAAI;AAAA,EACrB;AACA,SAAO,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EAAA,CACT,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CAaZ,YAgDG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEF,YAAMA,UAAQC,MAAAA,YAAY,OAAc;AACtCD,cAAc,SAAS;AACzB,aAAOA;AAAAA,IACT;AAxEE,SAAK,SAAS,OAAO;AAAA,EACvB;AAwEF;AAgBO,SAAS,gBAId,OAea;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAcO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAwC,CAACE,UAAS;AAChD,aAAOC,kBAAS;AAAA,QACd,QAAQD,OAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,mBAAmBA,OAAM;AAAA,MAAA,CACnB;AAAA,IACV;AAEA,SAAA,kBAAsD,CAACA,UAAS;AAC9D,aAAOC,kBAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,MAAYD,OAAM,SAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IACH;AAEA,SAAA,YAA0C,CAACA,UAAS;AAElD,aAAOE,oBAAU;AAAA,QACf,QAAQF,OAAM;AAAA,QACd,mBAAmBA,OAAM;AAAA,QACzB,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,YAA0C,CAACA,UAAS;AAElD,aAAOG,oBAAU;AAAA,QACf,QAAQH,OAAM;AAAA,QACd,mBAAmBA,OAAM;AAAA,QACzB,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAOI,cAAAA,cAAc,EAAE,GAAGJ,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,gBAAkD,CAACA,UAAS;AAC1D,aAAOK,cAAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAA6C;AACzD,YAAM,SAASM,UAAAA,UAAA;AACf,aAAOC,YAAAA,YAAY,EAAE,MAAM,OAAO,WAAW,KAAK,QAAQ,EAAE,EAAE,UAAU;AAAA,IAC1E;AAhDE,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AA+CF;AA8BO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AA4BO,SAAS,oBAGd,IAA8D;AAC9D,MAAI,OAAO,OAAO,UAAU;AAC1B,WAAO,IAAI,UAAkB,EAAE;AAAA,EACjC;AAEA,SAAO,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
1
+ {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\n/**\n * Creates a file-based Route factory for a given path.\n *\n * Used by TanStack Router's file-based routing to associate a file with a\n * route. The returned function accepts standard route options. In normal usage\n * the `path` string is inserted and maintained by the `tsr` generator.\n *\n * @param path File path literal for the route (usually auto-generated).\n * @returns A function that accepts Route options and returns a Route instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction\n */\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n const TMiddlewares = unknown,\n THandlers = undefined,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR,\n TMiddlewares,\n THandlers\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR,\n TMiddlewares,\n THandlers\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/**\n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the main route file via `createFileRoute`.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n Register,\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n structuralSharing: opts?.structuralSharing,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useSearch({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useParams({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\n/**\n * Creates a lazily-configurable code-based route stub by ID.\n *\n * Use this for code-splitting with code-based routes. The returned function\n * accepts only non-critical route options like `component`, `pendingComponent`,\n * `errorComponent`, and `notFoundComponent` which are applied when the route\n * is matched.\n *\n * @param id Route ID string literal to associate with the lazy route.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction\n */\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\n\n/**\n * Creates a lazily-configurable file-based route stub by file path.\n *\n * Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).\n * The returned function accepts only non-critical route options like\n * `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.\n *\n * @param id File path literal for the route file.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction\n */\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;AAgDO,SAAS,gBAQd,MAC0E;AAC1E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,IAAI,UAA0D,MAAM;AAAA,MACzE,QAAQ;AAAA,IAAA,CACT,EAAE,YAAY,IAAI;AAAA,EACrB;AACA,SAAO,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EAAA,CACT,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CAaZ,YAgDG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEF,YAAMA,UAAQC,MAAAA,YAAY,OAAc;AACtCD,cAAc,SAAS;AACzB,aAAOA;AAAAA,IACT;AAxEE,SAAK,SAAS,OAAO;AAAA,EACvB;AAwEF;AAMO,SAAS,gBAId,OAea;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAcO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAwC,CAACE,UAAS;AAChD,aAAOC,kBAAS;AAAA,QACd,QAAQD,OAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,mBAAmBA,OAAM;AAAA,MAAA,CACnB;AAAA,IACV;AAEA,SAAA,kBAAsD,CAACA,UAAS;AAC9D,aAAOC,kBAAS;AAAA,QACd,MAAM,KAAK,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16,6 @@ import { UseRouteContextRoute } from './useRouteContext.cjs';
16
16
  * @returns A function that accepts Route options and returns a Route instance.
17
17
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
18
18
  */
19
- /**
20
- * Creates a file-based Route factory for a given path.
21
- *
22
- * Used by TanStack Router's file-based routing to associate a file with a
23
- * route. The returned function accepts standard route options. In normal usage
24
- * the `path` string is inserted and maintained by the `tsr` generator.
25
- *
26
- * @param path File path literal for the route (usually auto-generated).
27
- * @returns A function that accepts Route options and returns a Route instance.
28
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
29
- */
30
- /**
31
- * Creates a file-based Route factory for a given path.
32
- * Used by file-based routing to associate a file with a route. The returned
33
- * function accepts standard route options; the path is typically auto-managed
34
- * by the generator.
35
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction
36
- */
37
19
  export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath']>(path?: TFilePath): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'];
38
20
  /**
39
21
  @deprecated It's no longer recommended to use the `FileRoute` class directly.
@@ -47,16 +29,6 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
47
29
  });
48
30
  createRoute: <TRegister = Register, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown, const TMiddlewares = unknown, THandlers = undefined>(options?: FileBaseRouteOptions<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn, AnyContext, TSSR, TMiddlewares, THandlers> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TRegister, TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown, TSSR, TMiddlewares, THandlers>;
49
31
  }
50
- /**
51
- @deprecated It's recommended not to split loaders into separate files.
52
- Instead, place the loader function in the the main route file, inside the
53
- `createFileRoute('/path/to/file)(options)` options.
54
- */
55
- /**
56
- @deprecated It's recommended not to split loaders into separate files.
57
- Instead, place the loader function in the the main route file, inside the
58
- `createFileRoute('/path/to/file)(options)` options.
59
- */
60
32
  /**
61
33
  @deprecated It's recommended not to split loaders into separate files.
62
34
  Instead, place the loader function in the main route file via `createFileRoute`.
@@ -100,22 +72,6 @@ export declare class LazyRoute<TRoute extends AnyRoute> {
100
72
  * @returns A function that accepts lazy route options and returns a `LazyRoute`.
101
73
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
102
74
  */
103
- /**
104
- * Creates a lazily-configurable code-based route stub by ID.
105
- *
106
- * Use this for code-splitting with code-based routes. The returned function
107
- * accepts only non-critical route options like `component`, `pendingComponent`,
108
- * `errorComponent`, and `notFoundComponent` which are applied when the route
109
- * is matched.
110
- *
111
- * @param id Route ID string literal to associate with the lazy route.
112
- * @returns A function that accepts lazy route options and returns a `LazyRoute`.
113
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
114
- */
115
- /**
116
- * Create a lazily-configurable code-based route stub by ID.
117
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction
118
- */
119
75
  export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string, TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
120
76
  /**
121
77
  * Creates a lazily-configurable file-based route stub by file path.
@@ -128,19 +84,4 @@ export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRo
128
84
  * @returns A function that accepts lazy route options and returns a `LazyRoute`.
129
85
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
130
86
  */
131
- /**
132
- * Creates a lazily-configurable file-based route stub by file path.
133
- *
134
- * Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).
135
- * The returned function accepts only non-critical route options like
136
- * `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.
137
- *
138
- * @param id File path literal for the route file.
139
- * @returns A function that accepts lazy route options and returns a `LazyRoute`.
140
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
141
- */
142
- /**
143
- * Create a lazily-configurable file-based route stub by file path.
144
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction
145
- */
146
87
  export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -1 +1 @@
1
- {"version":3,"file":"router.cjs","sources":["../../src/router.ts"],"sourcesContent":["import { RouterCore } from '@tanstack/router-core'\nimport { createFileRoute, createLazyFileRoute } from './fileRoute'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n AnyRoute,\n CreateRouterFn,\n RouterConstructorOptions,\n TrailingSlashOption,\n} from '@tanstack/router-core'\n\nimport type {\n ErrorRouteComponent,\n NotFoundRouteComponent,\n RouteComponent,\n} from './route'\n\ndeclare module '@tanstack/router-core' {\n export interface RouterOptionsExtensions {\n /**\n * The default `component` a route should use if no component is provided.\n *\n * @default Outlet\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)\n */\n defaultComponent?: RouteComponent\n /**\n * The default `errorComponent` a route should use if no error component is provided.\n *\n * @default ErrorComponent\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)\n */\n defaultErrorComponent?: ErrorRouteComponent\n /**\n * The default `pendingComponent` a route should use if no pending component is provided.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)\n */\n defaultPendingComponent?: RouteComponent\n /**\n * The default `notFoundComponent` a route should use if no notFound component is provided.\n *\n * @default NotFound\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)\n */\n defaultNotFoundComponent?: NotFoundRouteComponent\n /**\n * A component that will be used to wrap the entire router.\n *\n * This is useful for providing a context to the entire router.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)\n */\n Wrap?: (props: { children: any }) => React.JSX.Element\n /**\n * A component that will be used to wrap the inner contents of the router.\n *\n * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)\n */\n InnerWrap?: (props: { children: any }) => React.JSX.Element\n\n /**\n * The default `onCatch` handler for errors caught by the Router ErrorBoundary\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)\n */\n defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n }\n}\n\n/**\n * Creates a new Router instance for React.\n *\n * Pass the returned router to `RouterProvider` to enable routing.\n * Notable options: `routeTree` (your route definitions) and `context`\n * (required if the root route was created with `createRootRouteWithContext`).\n *\n * @param options Router options used to configure the router.\n * @returns A Router instance to be provided to `RouterProvider`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\n/**\n * Create a new React router instance from `RouterOptions`.\n * Pass the resulting router to `RouterProvider`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport const createRouter: CreateRouterFn = (options) => {\n return new Router(options)\n}\n\nexport class Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption = 'never',\n in out TDefaultStructuralSharingOption extends boolean = false,\n in out TRouterHistory extends RouterHistory = RouterHistory,\n in out TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterCore<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n> {\n constructor(\n options: RouterConstructorOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n ) {\n super(options)\n }\n}\n\nif (typeof globalThis !== 'undefined') {\n ;(globalThis as any).createFileRoute = createFileRoute\n ;(globalThis as any).createLazyFileRoute = createLazyFileRoute\n} else if (typeof window !== 'undefined') {\n ;(window as any).createFileRoute = createFileRoute\n ;(window as any).createLazyFileRoute = createLazyFileRoute\n}\n"],"names":["RouterCore","createFileRoute","createLazyFileRoute"],"mappings":";;;;AA+FO,MAAM,eAA+B,CAAC,YAAY;AACvD,SAAO,IAAI,OAAO,OAAO;AAC3B;AAEO,MAAM,eAMHA,WAAAA,WAMR;AAAA,EACA,YACE,SAOA;AACA,UAAM,OAAO;AAAA,EACf;AACF;AAEA,IAAI,OAAO,eAAe,aAAa;AACnC,aAAmB,kBAAkBC,UAAAA;AACrC,aAAmB,sBAAsBC,UAAAA;AAC7C,WAAW,OAAO,WAAW,aAAa;AACtC,SAAe,kBAAkBD,UAAAA;AACjC,SAAe,sBAAsBC,UAAAA;AACzC;;;"}
1
+ {"version":3,"file":"router.cjs","sources":["../../src/router.ts"],"sourcesContent":["import { RouterCore } from '@tanstack/router-core'\nimport { createFileRoute, createLazyFileRoute } from './fileRoute'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n AnyRoute,\n CreateRouterFn,\n RouterConstructorOptions,\n TrailingSlashOption,\n} from '@tanstack/router-core'\n\nimport type {\n ErrorRouteComponent,\n NotFoundRouteComponent,\n RouteComponent,\n} from './route'\n\ndeclare module '@tanstack/router-core' {\n export interface RouterOptionsExtensions {\n /**\n * The default `component` a route should use if no component is provided.\n *\n * @default Outlet\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)\n */\n defaultComponent?: RouteComponent\n /**\n * The default `errorComponent` a route should use if no error component is provided.\n *\n * @default ErrorComponent\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)\n */\n defaultErrorComponent?: ErrorRouteComponent\n /**\n * The default `pendingComponent` a route should use if no pending component is provided.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)\n */\n defaultPendingComponent?: RouteComponent\n /**\n * The default `notFoundComponent` a route should use if no notFound component is provided.\n *\n * @default NotFound\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)\n */\n defaultNotFoundComponent?: NotFoundRouteComponent\n /**\n * A component that will be used to wrap the entire router.\n *\n * This is useful for providing a context to the entire router.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)\n */\n Wrap?: (props: { children: any }) => React.JSX.Element\n /**\n * A component that will be used to wrap the inner contents of the router.\n *\n * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)\n */\n InnerWrap?: (props: { children: any }) => React.JSX.Element\n\n /**\n * The default `onCatch` handler for errors caught by the Router ErrorBoundary\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)\n */\n defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n }\n}\n\n/**\n * Creates a new Router instance for React.\n *\n * Pass the returned router to `RouterProvider` to enable routing.\n * Notable options: `routeTree` (your route definitions) and `context`\n * (required if the root route was created with `createRootRouteWithContext`).\n *\n * @param options Router options used to configure the router.\n * @returns A Router instance to be provided to `RouterProvider`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport const createRouter: CreateRouterFn = (options) => {\n return new Router(options)\n}\n\nexport class Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption = 'never',\n in out TDefaultStructuralSharingOption extends boolean = false,\n in out TRouterHistory extends RouterHistory = RouterHistory,\n in out TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterCore<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n> {\n constructor(\n options: RouterConstructorOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n ) {\n super(options)\n }\n}\n\nif (typeof globalThis !== 'undefined') {\n ;(globalThis as any).createFileRoute = createFileRoute\n ;(globalThis as any).createLazyFileRoute = createLazyFileRoute\n} else if (typeof window !== 'undefined') {\n ;(window as any).createFileRoute = createFileRoute\n ;(window as any).createLazyFileRoute = createLazyFileRoute\n}\n"],"names":["RouterCore","createFileRoute","createLazyFileRoute"],"mappings":";;;;AA0FO,MAAM,eAA+B,CAAC,YAAY;AACvD,SAAO,IAAI,OAAO,OAAO;AAC3B;AAEO,MAAM,eAMHA,WAAAA,WAMR;AAAA,EACA,YACE,SAOA;AACA,UAAM,OAAO;AAAA,EACf;AACF;AAEA,IAAI,OAAO,eAAe,aAAa;AACnC,aAAmB,kBAAkBC,UAAAA;AACrC,aAAmB,sBAAsBC,UAAAA;AAC7C,WAAW,OAAO,WAAW,aAAa;AACtC,SAAe,kBAAkBD,UAAAA;AACjC,SAAe,sBAAsBC,UAAAA;AACzC;;;"}
@@ -77,11 +77,6 @@ declare module '@tanstack/router-core' {
77
77
  * @returns A Router instance to be provided to `RouterProvider`.
78
78
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
79
79
  */
80
- /**
81
- * Create a new React router instance from `RouterOptions`.
82
- * Pass the resulting router to `RouterProvider`.
83
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
84
- */
85
80
  export declare const createRouter: CreateRouterFn;
86
81
  export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption = 'never', in out TDefaultStructuralSharingOption extends boolean = false, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> extends RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated> {
87
82
  constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
@@ -1 +1 @@
1
- {"version":3,"file":"useLoaderData.cjs","sources":["../../src/useLoaderData.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderData,\n StrictOrFrom,\n UseLoaderDataResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDataBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n match: ResolveUseLoaderData<TRouter, TFrom, TStrict>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDataOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n UseLoaderDataBaseOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDataRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDataBaseOptions<\n TRouter,\n TId,\n true,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseLoaderDataResult<TRouter, TId, true, TSelected>\n\n/**\n * Read and select the current route's loader data with type‑safety.\n *\n * Options:\n * - `from`/`strict`: Choose which route's data to read and strictness\n * - `select`: Map the loader data to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader data (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook\n */\n/**\n * Read and select the current route's loader data with type‑safety.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook\n */\nexport function useLoaderData<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDataOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n >,\n): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected> {\n return useMatch({\n from: opts.from!,\n strict: opts.strict,\n structuralSharing: opts.structuralSharing,\n select: (s: any) => {\n return opts.select ? opts.select(s.loaderData) : s.loaderData\n },\n } as any) as UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>\n}\n"],"names":["useMatch"],"mappings":";;;AAuEO,SAAS,cAOd,MAOyD;AACzD,SAAOA,kBAAS;AAAA,IACd,MAAM,KAAK;AAAA,IACX,QAAQ,KAAK;AAAA,IACb,mBAAmB,KAAK;AAAA,IACxB,QAAQ,CAAC,MAAW;AAClB,aAAO,KAAK,SAAS,KAAK,OAAO,EAAE,UAAU,IAAI,EAAE;AAAA,IACrD;AAAA,EAAA,CACM;AACV;;"}
1
+ {"version":3,"file":"useLoaderData.cjs","sources":["../../src/useLoaderData.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderData,\n StrictOrFrom,\n UseLoaderDataResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDataBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n match: ResolveUseLoaderData<TRouter, TFrom, TStrict>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDataOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n UseLoaderDataBaseOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDataRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDataBaseOptions<\n TRouter,\n TId,\n true,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseLoaderDataResult<TRouter, TId, true, TSelected>\n\n/**\n * Read and select the current route's loader data with type‑safety.\n *\n * Options:\n * - `from`/`strict`: Choose which route's data to read and strictness\n * - `select`: Map the loader data to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader data (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook\n */\nexport function useLoaderData<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDataOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n >,\n): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected> {\n return useMatch({\n from: opts.from!,\n strict: opts.strict,\n structuralSharing: opts.structuralSharing,\n select: (s: any) => {\n return opts.select ? opts.select(s.loaderData) : s.loaderData\n },\n } as any) as UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>\n}\n"],"names":["useMatch"],"mappings":";;;AAmEO,SAAS,cAOd,MAOyD;AACzD,SAAOA,kBAAS;AAAA,IACd,MAAM,KAAK;AAAA,IACX,QAAQ,KAAK;AAAA,IACb,mBAAmB,KAAK;AAAA,IACxB,QAAQ,CAAC,MAAW;AAClB,aAAO,KAAK,SAAS,KAAK,OAAO,EAAE,UAAU,IAAI,EAAE;AAAA,IACrD;AAAA,EAAA,CACM;AACV;;"}
@@ -16,8 +16,4 @@ export type UseLoaderDataRoute<out TId> = <TRouter extends AnyRouter = Registere
16
16
  * @returns The loader data (or selected value) for the matched route.
17
17
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
18
18
  */
19
- /**
20
- * Read and select the current route's loader data with type‑safety.
21
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
22
- */
23
19
  export declare function useLoaderData<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing>): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>;
@@ -1 +1 @@
1
- {"version":3,"file":"useLoaderDeps.cjs","sources":["../../src/useLoaderDeps.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderDeps,\n StrictOrFrom,\n UseLoaderDepsResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDepsBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n deps: ResolveUseLoaderDeps<TRouter, TFrom>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDepsOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom> &\n UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDepsRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, false>,\n) => UseLoaderDepsResult<TRouter, TId, TSelected>\n\n/**\n * Read and select the current route's loader dependencies object.\n *\n * Options:\n * - `from`: Choose which route's loader deps to read\n * - `select`: Map the deps to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader deps (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook\n */\n/**\n * Read and select the current route's loader dependencies object.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook\n */\nexport function useLoaderDeps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>,\n): UseLoaderDepsResult<TRouter, TFrom, TSelected> {\n const { select, ...rest } = opts\n return useMatch({\n ...rest,\n select: (s) => {\n return select ? select(s.loaderDeps) : s.loaderDeps\n },\n }) as UseLoaderDepsResult<TRouter, TFrom, TSelected>\n}\n"],"names":["useMatch"],"mappings":";;;AAyDO,SAAS,cAMd,MACgD;AAChD,QAAM,EAAE,QAAQ,GAAG,KAAA,IAAS;AAC5B,SAAOA,kBAAS;AAAA,IACd,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM;AACb,aAAO,SAAS,OAAO,EAAE,UAAU,IAAI,EAAE;AAAA,IAC3C;AAAA,EAAA,CACD;AACH;;"}
1
+ {"version":3,"file":"useLoaderDeps.cjs","sources":["../../src/useLoaderDeps.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderDeps,\n StrictOrFrom,\n UseLoaderDepsResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDepsBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n deps: ResolveUseLoaderDeps<TRouter, TFrom>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDepsOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom> &\n UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDepsRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, false>,\n) => UseLoaderDepsResult<TRouter, TId, TSelected>\n\n/**\n * Read and select the current route's loader dependencies object.\n *\n * Options:\n * - `from`: Choose which route's loader deps to read\n * - `select`: Map the deps to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader deps (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook\n */\nexport function useLoaderDeps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>,\n): UseLoaderDepsResult<TRouter, TFrom, TSelected> {\n const { select, ...rest } = opts\n return useMatch({\n ...rest,\n select: (s) => {\n return select ? select(s.loaderDeps) : s.loaderDeps\n },\n }) as UseLoaderDepsResult<TRouter, TFrom, TSelected>\n}\n"],"names":["useMatch"],"mappings":";;;AAqDO,SAAS,cAMd,MACgD;AAChD,QAAM,EAAE,QAAQ,GAAG,KAAA,IAAS;AAC5B,SAAOA,kBAAS;AAAA,IACd,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM;AACb,aAAO,SAAS,OAAO,EAAE,UAAU,IAAI,EAAE;AAAA,IAC3C;AAAA,EAAA,CACD;AACH;;"}
@@ -16,8 +16,4 @@ export type UseLoaderDepsRoute<out TId> = <TRouter extends AnyRouter = Registere
16
16
  * @returns The loader deps (or selected value) for the matched route.
17
17
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook
18
18
  */
19
- /**
20
- * Read and select the current route's loader dependencies object.
21
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook
22
- */
23
19
  export declare function useLoaderDeps<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>): UseLoaderDepsResult<TRouter, TFrom, TSelected>;
@@ -1 +1 @@
1
- {"version":3,"file":"useLocation.cjs","sources":["../../src/useLocation.tsx"],"sourcesContent":["import { useRouterState } from './useRouterState'\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 */\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 * @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 return useRouterState({\n select: (state: any) =>\n opts?.select ? opts.select(state.location) : state.location,\n } as any) as UseLocationResult<TRouter, TSelected>\n}\n"],"names":["useRouterState"],"mappings":";;;AA4CO,SAAS,YAKd,MAEuC;AACvC,SAAOA,8BAAe;AAAA,IACpB,QAAQ,CAAC,UACP,MAAM,SAAS,KAAK,OAAO,MAAM,QAAQ,IAAI,MAAM;AAAA,EAAA,CAC/C;AACV;;"}
1
+ {"version":3,"file":"useLocation.cjs","sources":["../../src/useLocation.tsx"],"sourcesContent":["import { useRouterState } from './useRouterState'\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 return useRouterState({\n select: (state: any) =>\n opts?.select ? opts.select(state.location) : state.location,\n } as any) as UseLocationResult<TRouter, TSelected>\n}\n"],"names":["useRouterState"],"mappings":";;;AAuCO,SAAS,YAKd,MAEuC;AACvC,SAAOA,8BAAe;AAAA,IACpB,QAAQ,CAAC,UACP,MAAM,SAAS,KAAK,OAAO,MAAM,QAAQ,IAAI,MAAM;AAAA,EAAA,CAC/C;AACV;;"}
@@ -15,9 +15,4 @@ export type UseLocationResult<TRouter extends AnyRouter, TSelected> = unknown ex
15
15
  * @returns The current location (or selected value).
16
16
  * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
17
17
  */
18
- /**
19
- * Read the current location from the router state with optional selection.
20
- * Useful for subscribing to just the pieces of location you care about.
21
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
22
- */
23
18
  export declare function useLocation<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>): UseLocationResult<TRouter, TSelected>;