@tanstack/react-router 1.121.20 → 1.121.24

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 (242) hide show
  1. package/dist/cjs/Asset.cjs +108 -0
  2. package/dist/cjs/Asset.cjs.map +1 -0
  3. package/dist/cjs/Asset.d.cts +3 -0
  4. package/dist/cjs/CatchBoundary.cjs +114 -0
  5. package/dist/cjs/CatchBoundary.cjs.map +1 -0
  6. package/dist/cjs/CatchBoundary.d.cts +12 -0
  7. package/dist/cjs/ClientOnly.cjs +20 -0
  8. package/dist/cjs/ClientOnly.cjs.map +1 -0
  9. package/dist/cjs/ClientOnly.d.cts +29 -0
  10. package/dist/cjs/HeadContent.cjs +155 -0
  11. package/dist/cjs/HeadContent.cjs.map +1 -0
  12. package/dist/cjs/HeadContent.d.cts +7 -0
  13. package/dist/cjs/Match.cjs +257 -0
  14. package/dist/cjs/Match.cjs.map +1 -0
  15. package/dist/cjs/Match.d.cts +8 -0
  16. package/dist/cjs/Matches.cjs +136 -0
  17. package/dist/cjs/Matches.cjs.map +1 -0
  18. package/dist/cjs/Matches.d.cts +26 -0
  19. package/dist/cjs/RouterProvider.cjs +33 -0
  20. package/dist/cjs/RouterProvider.cjs.map +1 -0
  21. package/dist/cjs/RouterProvider.d.cts +10 -0
  22. package/dist/cjs/SafeFragment.cjs +8 -0
  23. package/dist/cjs/SafeFragment.cjs.map +1 -0
  24. package/dist/cjs/SafeFragment.d.cts +1 -0
  25. package/dist/cjs/ScriptOnce.cjs +28 -0
  26. package/dist/cjs/ScriptOnce.cjs.map +1 -0
  27. package/dist/cjs/ScriptOnce.d.cts +5 -0
  28. package/dist/cjs/Scripts.cjs +51 -0
  29. package/dist/cjs/Scripts.cjs.map +1 -0
  30. package/dist/cjs/Scripts.d.cts +1 -0
  31. package/dist/cjs/ScrollRestoration.cjs +39 -0
  32. package/dist/cjs/ScrollRestoration.cjs.map +1 -0
  33. package/dist/cjs/ScrollRestoration.d.cts +14 -0
  34. package/dist/cjs/Transitioner.cjs +115 -0
  35. package/dist/cjs/Transitioner.cjs.map +1 -0
  36. package/dist/cjs/Transitioner.d.cts +1 -0
  37. package/dist/cjs/awaited.cjs +48 -0
  38. package/dist/cjs/awaited.cjs.map +1 -0
  39. package/dist/cjs/awaited.d.cts +10 -0
  40. package/dist/cjs/fileRoute.cjs +107 -0
  41. package/dist/cjs/fileRoute.cjs.map +1 -0
  42. package/dist/cjs/fileRoute.d.cts +54 -0
  43. package/dist/cjs/history.d.cts +8 -0
  44. package/dist/cjs/index.cjs +289 -0
  45. package/dist/cjs/index.cjs.map +1 -0
  46. package/dist/cjs/index.d.cts +55 -0
  47. package/dist/cjs/lazyRouteComponent.cjs +78 -0
  48. package/dist/cjs/lazyRouteComponent.cjs.map +1 -0
  49. package/dist/cjs/lazyRouteComponent.d.cts +2 -0
  50. package/dist/cjs/link.cjs +324 -0
  51. package/dist/cjs/link.cjs.map +1 -0
  52. package/dist/cjs/link.d.cts +48 -0
  53. package/dist/cjs/matchContext.cjs +27 -0
  54. package/dist/cjs/matchContext.cjs.map +1 -0
  55. package/dist/cjs/matchContext.d.cts +3 -0
  56. package/dist/cjs/not-found.cjs +40 -0
  57. package/dist/cjs/not-found.cjs.map +1 -0
  58. package/dist/cjs/not-found.d.cts +9 -0
  59. package/dist/cjs/renderRouteNotFound.cjs +22 -0
  60. package/dist/cjs/renderRouteNotFound.cjs.map +1 -0
  61. package/dist/cjs/renderRouteNotFound.d.cts +2 -0
  62. package/dist/cjs/route.cjs +205 -0
  63. package/dist/cjs/route.cjs.map +1 -0
  64. package/dist/cjs/route.d.cts +95 -0
  65. package/dist/cjs/router.cjs +22 -0
  66. package/dist/cjs/router.cjs.map +1 -0
  67. package/dist/cjs/router.d.cts +72 -0
  68. package/dist/cjs/routerContext.cjs +33 -0
  69. package/dist/cjs/routerContext.cjs.map +1 -0
  70. package/dist/cjs/routerContext.d.cts +8 -0
  71. package/dist/cjs/scroll-restoration.cjs +24 -0
  72. package/dist/cjs/scroll-restoration.cjs.map +1 -0
  73. package/dist/cjs/scroll-restoration.d.cts +1 -0
  74. package/dist/cjs/serializer.d.cts +6 -0
  75. package/dist/cjs/structuralSharing.d.cts +8 -0
  76. package/dist/cjs/typePrimitives.d.cts +16 -0
  77. package/dist/cjs/useBlocker.cjs +165 -0
  78. package/dist/cjs/useBlocker.cjs.map +1 -0
  79. package/dist/cjs/useBlocker.d.cts +66 -0
  80. package/dist/cjs/useCanGoBack.cjs +8 -0
  81. package/dist/cjs/useCanGoBack.cjs.map +1 -0
  82. package/dist/cjs/useCanGoBack.d.cts +1 -0
  83. package/dist/cjs/useLoaderData.cjs +15 -0
  84. package/dist/cjs/useLoaderData.cjs.map +1 -0
  85. package/dist/cjs/useLoaderData.d.cts +8 -0
  86. package/dist/cjs/useLoaderDeps.cjs +14 -0
  87. package/dist/cjs/useLoaderDeps.cjs.map +1 -0
  88. package/dist/cjs/useLoaderDeps.d.cts +8 -0
  89. package/dist/cjs/useLocation.cjs +10 -0
  90. package/dist/cjs/useLocation.cjs.map +1 -0
  91. package/dist/cjs/useLocation.d.cts +7 -0
  92. package/dist/cjs/useMatch.cjs +47 -0
  93. package/dist/cjs/useMatch.cjs.map +1 -0
  94. package/dist/cjs/useMatch.d.cts +10 -0
  95. package/dist/cjs/useNavigate.cjs +55 -0
  96. package/dist/cjs/useNavigate.cjs.map +1 -0
  97. package/dist/cjs/useNavigate.d.cts +5 -0
  98. package/dist/cjs/useParams.cjs +16 -0
  99. package/dist/cjs/useParams.cjs.map +1 -0
  100. package/dist/cjs/useParams.d.cts +9 -0
  101. package/dist/cjs/useRouteContext.cjs +11 -0
  102. package/dist/cjs/useRouteContext.cjs.map +1 -0
  103. package/dist/cjs/useRouteContext.d.cts +3 -0
  104. package/dist/cjs/useRouter.cjs +32 -0
  105. package/dist/cjs/useRouter.cjs.map +1 -0
  106. package/dist/cjs/useRouter.d.cts +4 -0
  107. package/dist/cjs/useRouterState.cjs +29 -0
  108. package/dist/cjs/useRouterState.cjs.map +1 -0
  109. package/dist/cjs/useRouterState.d.cts +8 -0
  110. package/dist/cjs/useSearch.cjs +16 -0
  111. package/dist/cjs/useSearch.cjs.map +1 -0
  112. package/dist/cjs/useSearch.d.cts +9 -0
  113. package/dist/cjs/utils.cjs +72 -0
  114. package/dist/cjs/utils.cjs.map +1 -0
  115. package/dist/cjs/utils.d.cts +49 -0
  116. package/dist/esm/Asset.d.ts +3 -0
  117. package/dist/esm/Asset.js +91 -0
  118. package/dist/esm/Asset.js.map +1 -0
  119. package/dist/esm/CatchBoundary.d.ts +12 -0
  120. package/dist/esm/CatchBoundary.js +97 -0
  121. package/dist/esm/CatchBoundary.js.map +1 -0
  122. package/dist/esm/ClientOnly.d.ts +29 -0
  123. package/dist/esm/ClientOnly.js +20 -0
  124. package/dist/esm/ClientOnly.js.map +1 -0
  125. package/dist/esm/HeadContent.d.ts +7 -0
  126. package/dist/esm/HeadContent.js +139 -0
  127. package/dist/esm/HeadContent.js.map +1 -0
  128. package/dist/esm/Match.d.ts +8 -0
  129. package/dist/esm/Match.js +240 -0
  130. package/dist/esm/Match.js.map +1 -0
  131. package/dist/esm/Matches.d.ts +26 -0
  132. package/dist/esm/Matches.js +119 -0
  133. package/dist/esm/Matches.js.map +1 -0
  134. package/dist/esm/RouterProvider.d.ts +10 -0
  135. package/dist/esm/RouterProvider.js +33 -0
  136. package/dist/esm/RouterProvider.js.map +1 -0
  137. package/dist/esm/SafeFragment.d.ts +1 -0
  138. package/dist/esm/SafeFragment.js +8 -0
  139. package/dist/esm/SafeFragment.js.map +1 -0
  140. package/dist/esm/ScriptOnce.d.ts +5 -0
  141. package/dist/esm/ScriptOnce.js +28 -0
  142. package/dist/esm/ScriptOnce.js.map +1 -0
  143. package/dist/esm/Scripts.d.ts +1 -0
  144. package/dist/esm/Scripts.js +51 -0
  145. package/dist/esm/Scripts.js.map +1 -0
  146. package/dist/esm/ScrollRestoration.d.ts +14 -0
  147. package/dist/esm/ScrollRestoration.js +39 -0
  148. package/dist/esm/ScrollRestoration.js.map +1 -0
  149. package/dist/esm/Transitioner.d.ts +1 -0
  150. package/dist/esm/Transitioner.js +98 -0
  151. package/dist/esm/Transitioner.js.map +1 -0
  152. package/dist/esm/awaited.d.ts +10 -0
  153. package/dist/esm/awaited.js +31 -0
  154. package/dist/esm/awaited.js.map +1 -0
  155. package/dist/esm/fileRoute.d.ts +54 -0
  156. package/dist/esm/fileRoute.js +107 -0
  157. package/dist/esm/fileRoute.js.map +1 -0
  158. package/dist/esm/history.d.ts +8 -0
  159. package/dist/esm/index.d.ts +55 -0
  160. package/dist/esm/index.js +151 -0
  161. package/dist/esm/index.js.map +1 -0
  162. package/dist/esm/lazyRouteComponent.d.ts +2 -0
  163. package/dist/esm/lazyRouteComponent.js +61 -0
  164. package/dist/esm/lazyRouteComponent.js.map +1 -0
  165. package/dist/esm/link.d.ts +48 -0
  166. package/dist/esm/link.js +307 -0
  167. package/dist/esm/link.js.map +1 -0
  168. package/dist/esm/matchContext.d.ts +3 -0
  169. package/dist/esm/matchContext.js +10 -0
  170. package/dist/esm/matchContext.js.map +1 -0
  171. package/dist/esm/not-found.d.ts +9 -0
  172. package/dist/esm/not-found.js +40 -0
  173. package/dist/esm/not-found.js.map +1 -0
  174. package/dist/esm/renderRouteNotFound.d.ts +2 -0
  175. package/dist/esm/renderRouteNotFound.js +22 -0
  176. package/dist/esm/renderRouteNotFound.js.map +1 -0
  177. package/dist/esm/route.d.ts +95 -0
  178. package/dist/esm/route.js +205 -0
  179. package/dist/esm/route.js.map +1 -0
  180. package/dist/esm/router.d.ts +72 -0
  181. package/dist/esm/router.js +22 -0
  182. package/dist/esm/router.js.map +1 -0
  183. package/dist/esm/routerContext.d.ts +8 -0
  184. package/dist/esm/routerContext.js +16 -0
  185. package/dist/esm/routerContext.js.map +1 -0
  186. package/dist/esm/scroll-restoration.d.ts +1 -0
  187. package/dist/esm/scroll-restoration.js +24 -0
  188. package/dist/esm/scroll-restoration.js.map +1 -0
  189. package/dist/esm/serializer.d.ts +6 -0
  190. package/dist/esm/structuralSharing.d.ts +8 -0
  191. package/dist/esm/typePrimitives.d.ts +16 -0
  192. package/dist/esm/useBlocker.d.ts +66 -0
  193. package/dist/esm/useBlocker.js +148 -0
  194. package/dist/esm/useBlocker.js.map +1 -0
  195. package/dist/esm/useCanGoBack.d.ts +1 -0
  196. package/dist/esm/useCanGoBack.js +8 -0
  197. package/dist/esm/useCanGoBack.js.map +1 -0
  198. package/dist/esm/useLoaderData.d.ts +8 -0
  199. package/dist/esm/useLoaderData.js +15 -0
  200. package/dist/esm/useLoaderData.js.map +1 -0
  201. package/dist/esm/useLoaderDeps.d.ts +8 -0
  202. package/dist/esm/useLoaderDeps.js +14 -0
  203. package/dist/esm/useLoaderDeps.js.map +1 -0
  204. package/dist/esm/useLocation.d.ts +7 -0
  205. package/dist/esm/useLocation.js +10 -0
  206. package/dist/esm/useLocation.js.map +1 -0
  207. package/dist/esm/useMatch.d.ts +10 -0
  208. package/dist/esm/useMatch.js +30 -0
  209. package/dist/esm/useMatch.js.map +1 -0
  210. package/dist/esm/useNavigate.d.ts +5 -0
  211. package/dist/esm/useNavigate.js +38 -0
  212. package/dist/esm/useNavigate.js.map +1 -0
  213. package/dist/esm/useParams.d.ts +9 -0
  214. package/dist/esm/useParams.js +16 -0
  215. package/dist/esm/useParams.js.map +1 -0
  216. package/dist/esm/useRouteContext.d.ts +3 -0
  217. package/dist/esm/useRouteContext.js +11 -0
  218. package/dist/esm/useRouteContext.js.map +1 -0
  219. package/dist/esm/useRouter.d.ts +4 -0
  220. package/dist/esm/useRouter.js +15 -0
  221. package/dist/esm/useRouter.js.map +1 -0
  222. package/dist/esm/useRouterState.d.ts +8 -0
  223. package/dist/esm/useRouterState.js +29 -0
  224. package/dist/esm/useRouterState.js.map +1 -0
  225. package/dist/esm/useSearch.d.ts +9 -0
  226. package/dist/esm/useSearch.js +16 -0
  227. package/dist/esm/useSearch.js.map +1 -0
  228. package/dist/esm/utils.d.ts +49 -0
  229. package/dist/esm/utils.js +55 -0
  230. package/dist/esm/utils.js.map +1 -0
  231. package/dist/llms/index.d.ts +3 -0
  232. package/dist/llms/index.js +35 -0
  233. package/dist/llms/rules/api.d.ts +2 -0
  234. package/dist/llms/rules/api.js +4241 -0
  235. package/dist/llms/rules/guide.d.ts +2 -0
  236. package/dist/llms/rules/guide.js +6227 -0
  237. package/dist/llms/rules/routing.d.ts +2 -0
  238. package/dist/llms/rules/routing.js +1946 -0
  239. package/dist/llms/rules/setup-and-architecture.d.ts +2 -0
  240. package/dist/llms/rules/setup-and-architecture.js +932 -0
  241. package/package.json +3 -3
  242. package/src/Asset.tsx +95 -16
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scripts.js","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\nexport const Scripts = () => {\n const router = useRouter()\n\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,\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 },\n children,\n })),\n }),\n structuralSharing: true as any,\n })\n\n const allScripts = [...scripts, ...assetScripts] as Array<RouterManagedTag>\n\n return (\n <>\n {allScripts.map((asset, i) => (\n <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n ))}\n </>\n )\n}\n"],"names":["assetScripts","_a"],"mappings":";;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,SAAS,UAAU;AAEzB,QAAM,eAAe,eAAe;AAAA,IAClC,QAAQ,CAAC,UAAU;;AACjB,YAAMA,gBAAwC,CAAC;AACzC,YAAA,YAAW,YAAO,QAAP,mBAAY;AAE7B,UAAI,CAAC,UAAU;AACb,eAAO,CAAC;AAAA,MAAA;AAGJ,YAAA,QACH,IAAI,CAAC,UAAU,OAAO,gBAAgB,MAAM,OAAO,CAAE,EACrD;AAAA,QAAQ,CAAC,UACR;;AAAA,wBAAAC,MAAA,SAAS,OAAO,MAAM,EAAE,MAAxB,gBAAAA,IAA2B,WAA3B,mBACI,OAAO,CAAC,MAAM,EAAE,QAAQ,UACzB,QAAQ,CAAC,UAAU;AAClBD,0BAAa,KAAK;AAAA,cAChB,KAAK;AAAA,cACL,OAAO,MAAM;AAAA,cACb,UAAU,MAAM;AAAA,YAAA,CACV;AAAA,UACT;AAAA;AAAA,MACL;AAEKA,aAAAA;AAAAA,IACT;AAAA,IACA,mBAAmB;AAAA,EAAA,CACpB;AAEK,QAAA,EAAE,QAAQ,IAAI,eAAe;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,QAC5B;AAAA,QACA;AAAA,MAAA,EACA;AAAA,IAAA;AAAA,IAEJ,mBAAmB;AAAA,EAAA,CACpB;AAED,QAAM,aAAa,CAAC,GAAG,SAAS,GAAG,YAAY;AAE/C,yCAEK,UAAW,WAAA,IAAI,CAAC,OAAO,oCACrB,OAAO,EAAA,GAAG,OAAO,KAAK,eAAe,MAAM,GAAG,IAAI,CAAC,IAAI,CACzD,GACH;AAEJ;"}
@@ -0,0 +1,14 @@
1
+ import { ParsedLocation, ScrollRestorationEntry, ScrollRestorationOptions } from '@tanstack/router-core';
2
+ /**
3
+ * @deprecated use createRouter's `scrollRestoration` option instead
4
+ */
5
+ export declare function ScrollRestoration(_props: ScrollRestorationOptions): null;
6
+ export declare function useElementScrollRestoration(options: ({
7
+ id: string;
8
+ getElement?: () => Window | Element | undefined | null;
9
+ } | {
10
+ id?: string;
11
+ getElement: () => Window | Element | undefined | null;
12
+ }) & {
13
+ getKey?: (location: ParsedLocation) => string;
14
+ }): ScrollRestorationEntry | undefined;
@@ -0,0 +1,39 @@
1
+ import { defaultGetScrollRestorationKey, getCssSelector, scrollRestorationCache, setupScrollRestoration } from "@tanstack/router-core";
2
+ import { useRouter } from "./useRouter.js";
3
+ function useScrollRestoration() {
4
+ const router = useRouter();
5
+ setupScrollRestoration(router, true);
6
+ }
7
+ function ScrollRestoration(_props) {
8
+ useScrollRestoration();
9
+ if (process.env.NODE_ENV === "development") {
10
+ console.warn(
11
+ "The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead."
12
+ );
13
+ }
14
+ return null;
15
+ }
16
+ function useElementScrollRestoration(options) {
17
+ var _a, _b;
18
+ useScrollRestoration();
19
+ const router = useRouter();
20
+ const getKey = options.getKey || defaultGetScrollRestorationKey;
21
+ let elementSelector = "";
22
+ if (options.id) {
23
+ elementSelector = `[data-scroll-restoration-id="${options.id}"]`;
24
+ } else {
25
+ const element = (_a = options.getElement) == null ? void 0 : _a.call(options);
26
+ if (!element) {
27
+ return;
28
+ }
29
+ elementSelector = element instanceof Window ? "window" : getCssSelector(element);
30
+ }
31
+ const restoreKey = getKey(router.latestLocation);
32
+ const byKey = (_b = scrollRestorationCache) == null ? void 0 : _b.state[restoreKey];
33
+ return byKey == null ? void 0 : byKey[elementSelector];
34
+ }
35
+ export {
36
+ ScrollRestoration,
37
+ useElementScrollRestoration
38
+ };
39
+ //# sourceMappingURL=ScrollRestoration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollRestoration.js","sources":["../../src/ScrollRestoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n getCssSelector,\n scrollRestorationCache,\n setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n ParsedLocation,\n ScrollRestorationEntry,\n ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n const router = useRouter()\n setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated use createRouter's `scrollRestoration` option instead\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n useScrollRestoration()\n\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n )\n }\n\n return null\n}\n\nexport function useElementScrollRestoration(\n options: (\n | {\n id: string\n getElement?: () => Window | Element | undefined | null\n }\n | {\n id?: string\n getElement: () => Window | Element | undefined | null\n }\n ) & {\n getKey?: (location: ParsedLocation) => string\n },\n): ScrollRestorationEntry | undefined {\n useScrollRestoration()\n\n const router = useRouter()\n const getKey = options.getKey || defaultGetScrollRestorationKey\n\n let elementSelector = ''\n\n if (options.id) {\n elementSelector = `[data-scroll-restoration-id=\"${options.id}\"]`\n } else {\n const element = options.getElement?.()\n if (!element) {\n return\n }\n elementSelector =\n element instanceof Window ? 'window' : getCssSelector(element)\n }\n\n const restoreKey = getKey(router.latestLocation)\n const byKey = scrollRestorationCache?.state[restoreKey]\n return byKey?.[elementSelector]\n}\n"],"names":[],"mappings":";;AAaA,SAAS,uBAAuB;AAC9B,QAAM,SAAS,UAAU;AACzB,yBAAuB,QAAQ,IAAI;AACrC;AAKO,SAAS,kBAAkB,QAAkC;AAC7C,uBAAA;AAEjB,MAAA,QAAQ,IAAI,aAAa,eAAe;AAClC,YAAA;AAAA,MACN;AAAA,IACF;AAAA,EAAA;AAGK,SAAA;AACT;AAEO,SAAS,4BACd,SAYoC;;AACf,uBAAA;AAErB,QAAM,SAAS,UAAU;AACnB,QAAA,SAAS,QAAQ,UAAU;AAEjC,MAAI,kBAAkB;AAEtB,MAAI,QAAQ,IAAI;AACI,sBAAA,gCAAgC,QAAQ,EAAE;AAAA,EAAA,OACvD;AACC,UAAA,WAAU,aAAQ,eAAR;AAChB,QAAI,CAAC,SAAS;AACZ;AAAA,IAAA;AAEF,sBACE,mBAAmB,SAAS,WAAW,eAAe,OAAO;AAAA,EAAA;AAG3D,QAAA,aAAa,OAAO,OAAO,cAAc;AACzC,QAAA,SAAQ,mDAAwB,MAAM;AAC5C,SAAO,+BAAQ;AACjB;"}
@@ -0,0 +1 @@
1
+ export declare function Transitioner(): null;
@@ -0,0 +1,98 @@
1
+ import * as React from "react";
2
+ import { trimPathRight, getLocationChangeInfo, handleHashScroll } from "@tanstack/router-core";
3
+ import { usePrevious, useLayoutEffect } from "./utils.js";
4
+ import { useRouter } from "./useRouter.js";
5
+ import { useRouterState } from "./useRouterState.js";
6
+ function Transitioner() {
7
+ const router = useRouter();
8
+ const mountLoadForRouter = React.useRef({ router, mounted: false });
9
+ const isLoading = useRouterState({
10
+ select: ({ isLoading: isLoading2 }) => isLoading2
11
+ });
12
+ const [isTransitioning, setIsTransitioning] = React.useState(false);
13
+ const hasPendingMatches = useRouterState({
14
+ select: (s) => s.matches.some((d) => d.status === "pending"),
15
+ structuralSharing: true
16
+ });
17
+ const previousIsLoading = usePrevious(isLoading);
18
+ const isAnyPending = isLoading || isTransitioning || hasPendingMatches;
19
+ const previousIsAnyPending = usePrevious(isAnyPending);
20
+ const isPagePending = isLoading || hasPendingMatches;
21
+ const previousIsPagePending = usePrevious(isPagePending);
22
+ if (!router.isServer) {
23
+ router.startTransition = (fn) => {
24
+ setIsTransitioning(true);
25
+ React.startTransition(() => {
26
+ fn();
27
+ setIsTransitioning(false);
28
+ });
29
+ };
30
+ }
31
+ React.useEffect(() => {
32
+ const unsub = router.history.subscribe(router.load);
33
+ const nextLocation = router.buildLocation({
34
+ to: router.latestLocation.pathname,
35
+ search: true,
36
+ params: true,
37
+ hash: true,
38
+ state: true,
39
+ _includeValidateSearch: true
40
+ });
41
+ if (trimPathRight(router.latestLocation.href) !== trimPathRight(nextLocation.href)) {
42
+ router.commitLocation({ ...nextLocation, replace: true });
43
+ }
44
+ return () => {
45
+ unsub();
46
+ };
47
+ }, [router, router.history]);
48
+ useLayoutEffect(() => {
49
+ if (typeof window !== "undefined" && router.clientSsr || mountLoadForRouter.current.router === router && mountLoadForRouter.current.mounted) {
50
+ return;
51
+ }
52
+ mountLoadForRouter.current = { router, mounted: true };
53
+ const tryLoad = async () => {
54
+ try {
55
+ await router.load();
56
+ } catch (err) {
57
+ console.error(err);
58
+ }
59
+ };
60
+ tryLoad();
61
+ }, [router]);
62
+ useLayoutEffect(() => {
63
+ if (previousIsLoading && !isLoading) {
64
+ router.emit({
65
+ type: "onLoad",
66
+ // When the new URL has committed, when the new matches have been loaded into state.matches
67
+ ...getLocationChangeInfo(router.state)
68
+ });
69
+ }
70
+ }, [previousIsLoading, router, isLoading]);
71
+ useLayoutEffect(() => {
72
+ if (previousIsPagePending && !isPagePending) {
73
+ router.emit({
74
+ type: "onBeforeRouteMount",
75
+ ...getLocationChangeInfo(router.state)
76
+ });
77
+ }
78
+ }, [isPagePending, previousIsPagePending, router]);
79
+ useLayoutEffect(() => {
80
+ if (previousIsAnyPending && !isAnyPending) {
81
+ router.emit({
82
+ type: "onResolved",
83
+ ...getLocationChangeInfo(router.state)
84
+ });
85
+ router.__store.setState((s) => ({
86
+ ...s,
87
+ status: "idle",
88
+ resolvedLocation: s.location
89
+ }));
90
+ handleHashScroll(router);
91
+ }
92
+ }, [isAnyPending, previousIsAnyPending, router]);
93
+ return null;
94
+ }
95
+ export {
96
+ Transitioner
97
+ };
98
+ //# sourceMappingURL=Transitioner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transitioner.js","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as React from 'react'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useLayoutEffect, usePrevious } from './utils'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\n\nexport function Transitioner() {\n const router = useRouter()\n const mountLoadForRouter = React.useRef({ router, mounted: false })\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n const [isTransitioning, setIsTransitioning] = React.useState(false)\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n structuralSharing: true,\n })\n\n const previousIsLoading = usePrevious(isLoading)\n\n const isAnyPending = isLoading || isTransitioning || hasPendingMatches\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = isLoading || hasPendingMatches\n const previousIsPagePending = usePrevious(isPagePending)\n\n if (!router.isServer) {\n router.startTransition = (fn: () => void) => {\n setIsTransitioning(true)\n React.startTransition(() => {\n fn()\n setIsTransitioning(false)\n })\n }\n }\n\n // Subscribe to location changes\n // and try to load the new location\n React.useEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n if (\n trimPathRight(router.latestLocation.href) !==\n trimPathRight(nextLocation.href)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n return () => {\n unsub()\n }\n }, [router, router.history])\n\n // Try to load the initial location\n useLayoutEffect(() => {\n if (\n (typeof window !== 'undefined' && router.clientSsr) ||\n (mountLoadForRouter.current.router === router &&\n mountLoadForRouter.current.mounted)\n ) {\n return\n }\n mountLoadForRouter.current = { router, mounted: true }\n\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n\n tryLoad()\n }, [router])\n\n useLayoutEffect(() => {\n // The router was loading and now it's not\n if (previousIsLoading && !isLoading) {\n router.emit({\n type: 'onLoad', // When the new URL has committed, when the new matches have been loaded into state.matches\n ...getLocationChangeInfo(router.state),\n })\n }\n }, [previousIsLoading, router, isLoading])\n\n useLayoutEffect(() => {\n // emit onBeforeRouteMount\n if (previousIsPagePending && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n }, [isPagePending, previousIsPagePending, router])\n\n useLayoutEffect(() => {\n // The router was pending and now it's not\n if (previousIsAnyPending && !isAnyPending) {\n router.emit({\n type: 'onResolved',\n ...getLocationChangeInfo(router.state),\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n handleHashScroll(router)\n }\n }, [isAnyPending, previousIsAnyPending, router])\n\n return null\n}\n"],"names":["isLoading"],"mappings":";;;;;AAUO,SAAS,eAAe;AAC7B,QAAM,SAAS,UAAU;AACzB,QAAM,qBAAqB,MAAM,OAAO,EAAE,QAAQ,SAAS,OAAO;AAClE,QAAM,YAAY,eAAe;AAAA,IAC/B,QAAQ,CAAC,EAAE,WAAAA,iBAAgBA;AAAAA,EAAA,CAC5B;AAED,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,MAAM,SAAS,KAAK;AAElE,QAAM,oBAAoB,eAAe;AAAA,IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,SAAS;AAAA,IAC3D,mBAAmB;AAAA,EAAA,CACpB;AAEK,QAAA,oBAAoB,YAAY,SAAS;AAEzC,QAAA,eAAe,aAAa,mBAAmB;AAC/C,QAAA,uBAAuB,YAAY,YAAY;AAErD,QAAM,gBAAgB,aAAa;AAC7B,QAAA,wBAAwB,YAAY,aAAa;AAEnD,MAAA,CAAC,OAAO,UAAU;AACb,WAAA,kBAAkB,CAAC,OAAmB;AAC3C,yBAAmB,IAAI;AACvB,YAAM,gBAAgB,MAAM;AACvB,WAAA;AACH,2BAAmB,KAAK;AAAA,MAAA,CACzB;AAAA,IACH;AAAA,EAAA;AAKF,QAAM,UAAU,MAAM;AACpB,UAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO,IAAI;AAE5C,UAAA,eAAe,OAAO,cAAc;AAAA,MACxC,IAAI,OAAO,eAAe;AAAA,MAC1B,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,wBAAwB;AAAA,IAAA,CACzB;AAGC,QAAA,cAAc,OAAO,eAAe,IAAI,MACxC,cAAc,aAAa,IAAI,GAC/B;AACA,aAAO,eAAe,EAAE,GAAG,cAAc,SAAS,MAAM;AAAA,IAAA;AAG1D,WAAO,MAAM;AACL,YAAA;AAAA,IACR;AAAA,EACC,GAAA,CAAC,QAAQ,OAAO,OAAO,CAAC;AAG3B,kBAAgB,MAAM;AAEjB,QAAA,OAAO,WAAW,eAAe,OAAO,aACxC,mBAAmB,QAAQ,WAAW,UACrC,mBAAmB,QAAQ,SAC7B;AACA;AAAA,IAAA;AAEF,uBAAmB,UAAU,EAAE,QAAQ,SAAS,KAAK;AAErD,UAAM,UAAU,YAAY;AACtB,UAAA;AACF,cAAM,OAAO,KAAK;AAAA,eACX,KAAK;AACZ,gBAAQ,MAAM,GAAG;AAAA,MAAA;AAAA,IAErB;AAEQ,YAAA;AAAA,EAAA,GACP,CAAC,MAAM,CAAC;AAEX,kBAAgB,MAAM;AAEhB,QAAA,qBAAqB,CAAC,WAAW;AACnC,aAAO,KAAK;AAAA,QACV,MAAM;AAAA;AAAA,QACN,GAAG,sBAAsB,OAAO,KAAK;AAAA,MAAA,CACtC;AAAA,IAAA;AAAA,EAEF,GAAA,CAAC,mBAAmB,QAAQ,SAAS,CAAC;AAEzC,kBAAgB,MAAM;AAEhB,QAAA,yBAAyB,CAAC,eAAe;AAC3C,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,GAAG,sBAAsB,OAAO,KAAK;AAAA,MAAA,CACtC;AAAA,IAAA;AAAA,EAEF,GAAA,CAAC,eAAe,uBAAuB,MAAM,CAAC;AAEjD,kBAAgB,MAAM;AAEhB,QAAA,wBAAwB,CAAC,cAAc;AACzC,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN,GAAG,sBAAsB,OAAO,KAAK;AAAA,MAAA,CACtC;AAEM,aAAA,QAAQ,SAAS,CAAC,OAAO;AAAA,QAC9B,GAAG;AAAA,QACH,QAAQ;AAAA,QACR,kBAAkB,EAAE;AAAA,MAAA,EACpB;AAEF,uBAAiB,MAAM;AAAA,IAAA;AAAA,EAExB,GAAA,CAAC,cAAc,sBAAsB,MAAM,CAAC;AAExC,SAAA;AACT;"}
@@ -0,0 +1,10 @@
1
+ import { DeferredPromise } from '@tanstack/router-core';
2
+ import * as React from 'react';
3
+ export type AwaitOptions<T> = {
4
+ promise: Promise<T>;
5
+ };
6
+ export declare function useAwaited<T>({ promise: _promise, }: AwaitOptions<T>): [T, DeferredPromise<T>];
7
+ export declare function Await<T>(props: AwaitOptions<T> & {
8
+ fallback?: React.ReactNode;
9
+ children: (result: T) => React.ReactNode;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { defer, TSR_DEFERRED_PROMISE } from "@tanstack/router-core";
4
+ function useAwaited({
5
+ promise: _promise
6
+ }) {
7
+ const promise = defer(_promise);
8
+ if (promise[TSR_DEFERRED_PROMISE].status === "pending") {
9
+ throw promise;
10
+ }
11
+ if (promise[TSR_DEFERRED_PROMISE].status === "error") {
12
+ throw promise[TSR_DEFERRED_PROMISE].error;
13
+ }
14
+ return [promise[TSR_DEFERRED_PROMISE].data, promise];
15
+ }
16
+ function Await(props) {
17
+ const inner = /* @__PURE__ */ jsx(AwaitInner, { ...props });
18
+ if (props.fallback) {
19
+ return /* @__PURE__ */ jsx(React.Suspense, { fallback: props.fallback, children: inner });
20
+ }
21
+ return inner;
22
+ }
23
+ function AwaitInner(props) {
24
+ const [data] = useAwaited(props);
25
+ return props.children(data);
26
+ }
27
+ export {
28
+ Await,
29
+ useAwaited
30
+ };
31
+ //# sourceMappingURL=awaited.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awaited.js","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\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\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":[],"mappings":";;;AASO,SAAS,WAAc;AAAA,EAC5B,SAAS;AACX,GAA6C;AACrC,QAAA,UAAU,MAAM,QAAQ;AAE9B,MAAI,QAAQ,oBAAoB,EAAE,WAAW,WAAW;AAChD,UAAA;AAAA,EAAA;AAGR,MAAI,QAAQ,oBAAoB,EAAE,WAAW,SAAS;AAC9C,UAAA,QAAQ,oBAAoB,EAAE;AAAA,EAAA;AAGtC,SAAO,CAAC,QAAQ,oBAAoB,EAAE,MAAM,OAAO;AACrD;AAEO,SAAS,MACd,OAIA;AACA,QAAM,QAAQ,oBAAC,YAAY,EAAA,GAAG,MAAO,CAAA;AACrC,MAAI,MAAM,UAAU;AAClB,+BAAQ,MAAM,UAAN,EAAe,UAAU,MAAM,UAAW,UAAM,OAAA;AAAA,EAAA;AAEnD,SAAA;AACT;AAEA,SAAS,WACP,OAImB;AACnB,QAAM,CAAC,IAAI,IAAI,WAAW,KAAK;AAExB,SAAA,MAAM,SAAS,IAAI;AAC5B;"}
@@ -0,0 +1,54 @@
1
+ import { UseParamsRoute } from './useParams.js';
2
+ import { UseMatchRoute } from './useMatch.js';
3
+ import { UseSearchRoute } from './useSearch.js';
4
+ import { AnyContext, AnyRoute, AnyRouter, Constrain, ConstrainLiteral, FileBaseRouteOptions, FileRoutesByPath, LazyRouteOptions, RegisteredRouter, ResolveParams, Route, RouteById, RouteConstraints, RouteIds, RouteLoaderFn, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
5
+ import { UseLoaderDepsRoute } from './useLoaderDeps.js';
6
+ import { UseLoaderDataRoute } from './useLoaderData.js';
7
+ import { UseRouteContextRoute } from './useRouteContext.js';
8
+ 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'];
9
+ /**
10
+ @deprecated It's no longer recommended to use the `FileRoute` class directly.
11
+ Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.
12
+ */
13
+ export declare class FileRoute<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']> {
14
+ path?: TFilePath | undefined;
15
+ silent?: boolean;
16
+ constructor(path?: TFilePath | undefined, _opts?: {
17
+ silent: boolean;
18
+ });
19
+ createRoute: <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
20
+ }
21
+ /**
22
+ @deprecated It's recommended not to split loaders into separate files.
23
+ Instead, place the loader function in the the main route file, inside the
24
+ `createFileRoute('/path/to/file)(options)` options.
25
+ */
26
+ export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderFn>(loaderFn: Constrain<TLoaderFn, RouteLoaderFn<TRoute['parentRoute'], TRoute['types']['id'], TRoute['types']['params'], TRoute['types']['loaderDeps'], TRoute['types']['routerContext'], TRoute['types']['routeContextFn'], TRoute['types']['beforeLoadFn']>>) => TLoaderFn;
27
+ declare module '@tanstack/router-core' {
28
+ interface LazyRoute<in out TRoute extends AnyRoute> {
29
+ useMatch: UseMatchRoute<TRoute['id']>;
30
+ useRouteContext: UseRouteContextRoute<TRoute['id']>;
31
+ useSearch: UseSearchRoute<TRoute['id']>;
32
+ useParams: UseParamsRoute<TRoute['id']>;
33
+ useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>;
34
+ useLoaderData: UseLoaderDataRoute<TRoute['id']>;
35
+ useNavigate: () => UseNavigateResult<TRoute['fullPath']>;
36
+ }
37
+ }
38
+ export declare class LazyRoute<TRoute extends AnyRoute> {
39
+ options: {
40
+ id: string;
41
+ } & LazyRouteOptions;
42
+ constructor(opts: {
43
+ id: string;
44
+ } & LazyRouteOptions);
45
+ useMatch: UseMatchRoute<TRoute['id']>;
46
+ useRouteContext: UseRouteContextRoute<TRoute['id']>;
47
+ useSearch: UseSearchRoute<TRoute['id']>;
48
+ useParams: UseParamsRoute<TRoute['id']>;
49
+ useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>;
50
+ useLoaderData: UseLoaderDataRoute<TRoute['id']>;
51
+ useNavigate: () => UseNavigateResult<TRoute["fullPath"]>;
52
+ }
53
+ 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>;
54
+ export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -0,0 +1,107 @@
1
+ import warning from "tiny-warning";
2
+ import { createRoute } from "./route.js";
3
+ import { useMatch } from "./useMatch.js";
4
+ import { useLoaderDeps } from "./useLoaderDeps.js";
5
+ import { useLoaderData } from "./useLoaderData.js";
6
+ import { useSearch } from "./useSearch.js";
7
+ import { useParams } from "./useParams.js";
8
+ import { useNavigate } from "./useNavigate.js";
9
+ import { useRouter } from "./useRouter.js";
10
+ function createFileRoute(path) {
11
+ if (typeof path === "object") {
12
+ return new FileRoute(path, {
13
+ silent: true
14
+ }).createRoute(path);
15
+ }
16
+ return new FileRoute(path, {
17
+ silent: true
18
+ }).createRoute;
19
+ }
20
+ class FileRoute {
21
+ constructor(path, _opts) {
22
+ this.path = path;
23
+ this.createRoute = (options) => {
24
+ warning(
25
+ this.silent,
26
+ "FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
27
+ );
28
+ const route = createRoute(options);
29
+ route.isRoot = false;
30
+ return route;
31
+ };
32
+ this.silent = _opts == null ? void 0 : _opts.silent;
33
+ }
34
+ }
35
+ function FileRouteLoader(_path) {
36
+ warning(
37
+ false,
38
+ `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`
39
+ );
40
+ return (loaderFn) => loaderFn;
41
+ }
42
+ class LazyRoute {
43
+ constructor(opts) {
44
+ this.useMatch = (opts2) => {
45
+ return useMatch({
46
+ select: opts2 == null ? void 0 : opts2.select,
47
+ from: this.options.id,
48
+ structuralSharing: opts2 == null ? void 0 : opts2.structuralSharing
49
+ });
50
+ };
51
+ this.useRouteContext = (opts2) => {
52
+ return useMatch({
53
+ from: this.options.id,
54
+ select: (d) => (opts2 == null ? void 0 : opts2.select) ? opts2.select(d.context) : d.context
55
+ });
56
+ };
57
+ this.useSearch = (opts2) => {
58
+ return useSearch({
59
+ select: opts2 == null ? void 0 : opts2.select,
60
+ structuralSharing: opts2 == null ? void 0 : opts2.structuralSharing,
61
+ from: this.options.id
62
+ });
63
+ };
64
+ this.useParams = (opts2) => {
65
+ return useParams({
66
+ select: opts2 == null ? void 0 : opts2.select,
67
+ structuralSharing: opts2 == null ? void 0 : opts2.structuralSharing,
68
+ from: this.options.id
69
+ });
70
+ };
71
+ this.useLoaderDeps = (opts2) => {
72
+ return useLoaderDeps({ ...opts2, from: this.options.id });
73
+ };
74
+ this.useLoaderData = (opts2) => {
75
+ return useLoaderData({ ...opts2, from: this.options.id });
76
+ };
77
+ this.useNavigate = () => {
78
+ const router = useRouter();
79
+ return useNavigate({ from: router.routesById[this.options.id].fullPath });
80
+ };
81
+ this.options = opts;
82
+ this.$$typeof = Symbol.for("react.memo");
83
+ }
84
+ }
85
+ function createLazyRoute(id) {
86
+ return (opts) => {
87
+ return new LazyRoute({
88
+ id,
89
+ ...opts
90
+ });
91
+ };
92
+ }
93
+ function createLazyFileRoute(id) {
94
+ if (typeof id === "object") {
95
+ return new LazyRoute(id);
96
+ }
97
+ return (opts) => new LazyRoute({ id, ...opts });
98
+ }
99
+ export {
100
+ FileRoute,
101
+ FileRouteLoader,
102
+ LazyRoute,
103
+ createFileRoute,
104
+ createLazyFileRoute,
105
+ createLazyRoute
106
+ };
107
+ //# sourceMappingURL=fileRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\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 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 >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\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 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 > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n 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\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\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["opts"],"mappings":";;;;;;;;;AAoCO,SAAS,gBAQd,MAC0E;AACtE,MAAA,OAAO,SAAS,UAAU;AACrB,WAAA,IAAI,UAA0D,MAAM;AAAA,MACzE,QAAQ;AAAA,IAAA,CACT,EAAE,YAAY,IAAI;AAAA,EAAA;AAEd,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAuCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MACF;AACM,YAAA,QAAQ,YAAY,OAAc;AACtC,YAAc,SAAS;AAClB,aAAA;AAAA,IACT;AA3DE,SAAK,SAAS,+BAAO;AAAA,EAAA;AA4DzB;AAOO,SAAS,gBAId,OAca;AACb;AAAA,IACE;AAAA,IACA;AAAA,EACF;AACA,SAAO,CAAC,aAAa;AACvB;AAcO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAwC,CAACA,UAAS;AAChD,aAAO,SAAS;AAAA,QACd,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,mBAAmBA,SAAA,gBAAAA,MAAM;AAAA,MAAA,CACnB;AAAA,IACV;AAEA,SAAA,kBAAsD,CAACA,UAAS;AAC9D,aAAO,SAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYA,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IACH;AAEA,SAAA,YAA0C,CAACA,UAAS;AAElD,aAAO,UAAU;AAAA,QACf,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,mBAAmBA,SAAA,gBAAAA,MAAM;AAAA,QACzB,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,YAA0C,CAACA,UAAS;AAElD,aAAO,UAAU;AAAA,QACf,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,mBAAmBA,SAAA,gBAAAA,MAAM;AAAA,QACzB,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,gBAAkD,CAACA,UAAS;AACnD,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,gBAAkD,CAACA,UAAS;AACnD,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAA6C;AACzD,YAAM,SAAS,UAAU;AAClB,aAAA,YAAY,EAAE,MAAM,OAAO,WAAW,KAAK,QAAQ,EAAE,EAAE,UAAU;AAAA,IAC1E;AAhDE,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EAAA;AAgDrD;AAEO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AAEO,SAAS,oBAGd,IAA8D;AAC1D,MAAA,OAAO,OAAO,UAAU;AACnB,WAAA,IAAI,UAAkB,EAAE;AAAA,EAAA;AAG1B,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;"}
@@ -0,0 +1,8 @@
1
+ declare module '@tanstack/history' {
2
+ interface HistoryState {
3
+ __tempLocation?: HistoryLocation;
4
+ __tempKey?: string;
5
+ __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
6
+ }
7
+ }
8
+ export {};
@@ -0,0 +1,55 @@
1
+ export { default as invariant } from 'tiny-invariant';
2
+ export { default as warning } from 'tiny-warning';
3
+ export { defer, TSR_DEFERRED_PROMISE, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, encode, decode, rootRouteId, defaultSerializeError, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, escapeJSON, // SSR
4
+ pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, shallow, createControlledPromise, retainSearchParams, stripSearchParams, } from '@tanstack/router-core';
5
+ export type { AnyRoute, StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, ExtractedEntry, ExtractedStream, ExtractedPromise, StreamState, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, Register, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, FileRoutesByPath, RouteById, RootRouteOptions, SerializerExtensions, CreateFileRoute, } from '@tanstack/router-core';
6
+ export type * from './serializer.js';
7
+ export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
8
+ export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
9
+ export { useAwaited, Await } from './awaited.js';
10
+ export type { AwaitOptions } from './awaited.js';
11
+ export { CatchBoundary, ErrorComponent } from './CatchBoundary.js';
12
+ export { ClientOnly } from './ClientOnly.js';
13
+ export { FileRoute, createFileRoute, FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute.js';
14
+ export * from './history.js';
15
+ export { lazyRouteComponent } from './lazyRouteComponent.js';
16
+ export { useLinkProps, createLink, Link, linkOptions } from './link.js';
17
+ export type { InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, FileRouteTypes, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, ResolveAllParamsFromParent, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, RouteIds, NavigateFn, BuildLocationFn, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, ResolveFullPath, AnyRouteWithContext, AnyRouterWithContext, CommitLocationOptions, MatchLocation, UseNavigateResult, AnyRedirect, Redirect, ResolvedRedirect, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, LazyRouteOptions, AnyRouter, RegisteredRouter, RouterContextOptions, ControllablePromise, InjectedHtmlEntry, RouterOptions, RouterErrorSerializer, RouterState, ListenerFn, BuildNextOptions, RouterConstructorOptions, RouterEvents, RouterEvent, RouterListener, RouteConstraints, RouteMask, MatchRouteOptions, CreateLazyFileRoute, } from '@tanstack/router-core';
18
+ export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.js';
19
+ export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.js';
20
+ export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.js';
21
+ export { matchContext } from './matchContext.js';
22
+ export { Match, Outlet } from './Match.js';
23
+ export { useMatch } from './useMatch.js';
24
+ export { useLoaderDeps } from './useLoaderDeps.js';
25
+ export { useLoaderData } from './useLoaderData.js';
26
+ export { redirect, isRedirect } from '@tanstack/router-core';
27
+ export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.js';
28
+ export type { AnyRootRoute, ReactNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.js';
29
+ export { createRouter, Router } from './router.js';
30
+ export { componentTypes, lazyFn, SearchParamError, PathParamError, getInitialRouterState, } from '@tanstack/router-core';
31
+ export { RouterProvider, RouterContextProvider } from './RouterProvider.js';
32
+ export type { RouterProps } from './RouterProvider.js';
33
+ export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.js';
34
+ export type { UseBlockerOpts, ShouldBlockFn } from './useBlocker.js';
35
+ export { useBlocker, Block } from './useBlocker.js';
36
+ export { useNavigate, Navigate } from './useNavigate.js';
37
+ export { useParams } from './useParams.js';
38
+ export { useSearch } from './useSearch.js';
39
+ export { getRouterContext, } from './routerContext.js';
40
+ export { useRouteContext } from './useRouteContext.js';
41
+ export { useRouter } from './useRouter.js';
42
+ export { useRouterState } from './useRouterState.js';
43
+ export { useLocation } from './useLocation.js';
44
+ export { useCanGoBack } from './useCanGoBack.js';
45
+ export { useLayoutEffect, // SSR
46
+ useStableCallback, } from './utils.js';
47
+ export { CatchNotFound, DefaultGlobalNotFound } from './not-found.js';
48
+ export { notFound, isNotFound } from '@tanstack/router-core';
49
+ export type { NotFoundError } from '@tanstack/router-core';
50
+ export type { ValidateLinkOptions, InferStructuralSharing, ValidateUseSearchOptions, ValidateUseParamsOptions, ValidateLinkOptionsArray, } from './typePrimitives.js';
51
+ export type { ValidateFromPath, ValidateToPath, ValidateSearch, ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, ValidateNavigateOptionsArray, ValidateRedirectOptions, ValidateRedirectOptionsArray, ValidateId, InferStrict, InferShouldThrow, InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from '@tanstack/router-core';
52
+ export { ScriptOnce } from './ScriptOnce.js';
53
+ export { Asset } from './Asset.js';
54
+ export { HeadContent } from './HeadContent.js';
55
+ export { Scripts } from './Scripts.js';
@@ -0,0 +1,151 @@
1
+ import { default as default2 } from "tiny-invariant";
2
+ import { default as default3 } from "tiny-warning";
3
+ import { PathParamError, SearchParamError, TSR_DEFERRED_PROMISE, cleanPath, componentTypes, createControlledPromise, decode, deepEqual, defaultParseSearch, defaultSerializeError, defaultStringifySearch, defer, encode, escapeJSON, functionalUpdate, getInitialRouterState, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, matchByPath, matchPathname, notFound, parsePathname, parseSearchWith, pick, redirect, removeBasepath, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, shallow, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
4
+ import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
5
+ import { Await, useAwaited } from "./awaited.js";
6
+ import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
7
+ import { ClientOnly } from "./ClientOnly.js";
8
+ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileRoute, createLazyRoute } from "./fileRoute.js";
9
+ import { lazyRouteComponent } from "./lazyRouteComponent.js";
10
+ import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
11
+ import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
12
+ import { matchContext } from "./matchContext.js";
13
+ import { Match, Outlet } from "./Match.js";
14
+ import { useMatch } from "./useMatch.js";
15
+ import { useLoaderDeps } from "./useLoaderDeps.js";
16
+ import { useLoaderData } from "./useLoaderData.js";
17
+ import { NotFoundRoute, RootRoute, Route, RouteApi, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, getRouteApi, rootRouteWithContext } from "./route.js";
18
+ import { Router, createRouter } from "./router.js";
19
+ import { RouterContextProvider, RouterProvider } from "./RouterProvider.js";
20
+ import { ScrollRestoration, useElementScrollRestoration } from "./ScrollRestoration.js";
21
+ import { Block, useBlocker } from "./useBlocker.js";
22
+ import { Navigate, useNavigate } from "./useNavigate.js";
23
+ import { useParams } from "./useParams.js";
24
+ import { useSearch } from "./useSearch.js";
25
+ import { getRouterContext } from "./routerContext.js";
26
+ import { useRouteContext } from "./useRouteContext.js";
27
+ import { useRouter } from "./useRouter.js";
28
+ import { useRouterState } from "./useRouterState.js";
29
+ import { useLocation } from "./useLocation.js";
30
+ import { useCanGoBack } from "./useCanGoBack.js";
31
+ import { useLayoutEffect, useStableCallback } from "./utils.js";
32
+ import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
33
+ import { ScriptOnce } from "./ScriptOnce.js";
34
+ import { Asset } from "./Asset.js";
35
+ import { HeadContent } from "./HeadContent.js";
36
+ import { Scripts } from "./Scripts.js";
37
+ export {
38
+ Asset,
39
+ Await,
40
+ Block,
41
+ CatchBoundary,
42
+ CatchNotFound,
43
+ ClientOnly,
44
+ DefaultGlobalNotFound,
45
+ ErrorComponent,
46
+ FileRoute,
47
+ FileRouteLoader,
48
+ HeadContent,
49
+ LazyRoute,
50
+ Link,
51
+ Match,
52
+ MatchRoute,
53
+ Matches,
54
+ Navigate,
55
+ NotFoundRoute,
56
+ Outlet,
57
+ PathParamError,
58
+ RootRoute,
59
+ Route,
60
+ RouteApi,
61
+ Router,
62
+ RouterContextProvider,
63
+ RouterProvider,
64
+ ScriptOnce,
65
+ Scripts,
66
+ ScrollRestoration,
67
+ SearchParamError,
68
+ TSR_DEFERRED_PROMISE,
69
+ cleanPath,
70
+ componentTypes,
71
+ createBrowserHistory,
72
+ createControlledPromise,
73
+ createFileRoute,
74
+ createHashHistory,
75
+ createHistory,
76
+ createLazyFileRoute,
77
+ createLazyRoute,
78
+ createLink,
79
+ createMemoryHistory,
80
+ createRootRoute,
81
+ createRootRouteWithContext,
82
+ createRoute,
83
+ createRouteMask,
84
+ createRouter,
85
+ decode,
86
+ deepEqual,
87
+ defaultParseSearch,
88
+ defaultSerializeError,
89
+ defaultStringifySearch,
90
+ defer,
91
+ encode,
92
+ escapeJSON,
93
+ functionalUpdate,
94
+ getInitialRouterState,
95
+ getRouteApi,
96
+ getRouterContext,
97
+ interpolatePath,
98
+ default2 as invariant,
99
+ isMatch,
100
+ isNotFound,
101
+ isPlainArray,
102
+ isPlainObject,
103
+ isRedirect,
104
+ joinPaths,
105
+ lazyFn,
106
+ lazyRouteComponent,
107
+ linkOptions,
108
+ matchByPath,
109
+ matchContext,
110
+ matchPathname,
111
+ notFound,
112
+ parsePathname,
113
+ parseSearchWith,
114
+ pick,
115
+ redirect,
116
+ removeBasepath,
117
+ replaceEqualDeep,
118
+ resolvePath,
119
+ retainSearchParams,
120
+ rootRouteId,
121
+ rootRouteWithContext,
122
+ shallow,
123
+ stringifySearchWith,
124
+ stripSearchParams,
125
+ trimPath,
126
+ trimPathLeft,
127
+ trimPathRight,
128
+ useAwaited,
129
+ useBlocker,
130
+ useCanGoBack,
131
+ useChildMatches,
132
+ useElementScrollRestoration,
133
+ useLayoutEffect,
134
+ useLinkProps,
135
+ useLoaderData,
136
+ useLoaderDeps,
137
+ useLocation,
138
+ useMatch,
139
+ useMatchRoute,
140
+ useMatches,
141
+ useNavigate,
142
+ useParams,
143
+ useParentMatches,
144
+ useRouteContext,
145
+ useRouter,
146
+ useRouterState,
147
+ useSearch,
148
+ useStableCallback,
149
+ default3 as warning
150
+ };
151
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}