@tanstack/react-router 1.7.0 → 1.8.0

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 (200) hide show
  1. package/dist/cjs/CatchBoundary.cjs +106 -0
  2. package/dist/cjs/CatchBoundary.cjs.map +1 -0
  3. package/dist/cjs/Matches.cjs +278 -0
  4. package/dist/cjs/Matches.cjs.map +1 -0
  5. package/{build/cjs/RouterProvider.js → dist/cjs/RouterProvider.cjs} +55 -58
  6. package/dist/cjs/RouterProvider.cjs.map +1 -0
  7. package/dist/cjs/awaited.cjs +51 -0
  8. package/dist/cjs/awaited.cjs.map +1 -0
  9. package/dist/cjs/defer.cjs +30 -0
  10. package/dist/cjs/defer.cjs.map +1 -0
  11. package/dist/cjs/fileRoute.cjs +19 -0
  12. package/dist/cjs/fileRoute.cjs.map +1 -0
  13. package/dist/cjs/history.d.cts +7 -0
  14. package/{build/cjs/index.js → dist/cjs/index.cjs} +39 -51
  15. package/dist/cjs/index.cjs.map +1 -0
  16. package/dist/cjs/lazyRouteComponent.cjs +40 -0
  17. package/dist/cjs/lazyRouteComponent.cjs.map +1 -0
  18. package/dist/cjs/link.cjs +196 -0
  19. package/dist/cjs/link.cjs.map +1 -0
  20. package/dist/cjs/link.d.cts +85 -0
  21. package/{build/cjs/path.js → dist/cjs/path.cjs} +77 -94
  22. package/dist/cjs/path.cjs.map +1 -0
  23. package/dist/cjs/qss.cjs +45 -0
  24. package/dist/cjs/qss.cjs.map +1 -0
  25. package/dist/cjs/redirects.cjs +15 -0
  26. package/dist/cjs/redirects.cjs.map +1 -0
  27. package/dist/cjs/route.cjs +143 -0
  28. package/dist/cjs/route.cjs.map +1 -0
  29. package/dist/cjs/router.cjs +1070 -0
  30. package/dist/cjs/router.cjs.map +1 -0
  31. package/dist/cjs/routerContext.cjs +29 -0
  32. package/dist/cjs/routerContext.cjs.map +1 -0
  33. package/{build/cjs/scroll-restoration.js → dist/cjs/scroll-restoration.cjs} +58 -75
  34. package/dist/cjs/scroll-restoration.cjs.map +1 -0
  35. package/{build/cjs/searchParams.js → dist/cjs/searchParams.cjs} +18 -36
  36. package/dist/cjs/searchParams.cjs.map +1 -0
  37. package/dist/cjs/useBlocker.cjs +36 -0
  38. package/dist/cjs/useBlocker.cjs.map +1 -0
  39. package/dist/cjs/useNavigate.cjs +55 -0
  40. package/dist/cjs/useNavigate.cjs.map +1 -0
  41. package/dist/cjs/useParams.cjs +16 -0
  42. package/dist/cjs/useParams.cjs.map +1 -0
  43. package/dist/cjs/useRouteContext.cjs +11 -0
  44. package/dist/cjs/useRouteContext.cjs.map +1 -0
  45. package/dist/cjs/useRouter.cjs +33 -0
  46. package/dist/cjs/useRouter.cjs.map +1 -0
  47. package/dist/cjs/useRouterState.cjs +12 -0
  48. package/dist/cjs/useRouterState.cjs.map +1 -0
  49. package/dist/cjs/useSearch.cjs +13 -0
  50. package/dist/cjs/useSearch.cjs.map +1 -0
  51. package/{build/cjs/utils.js → dist/cjs/utils.cjs} +25 -116
  52. package/dist/cjs/utils.cjs.map +1 -0
  53. package/dist/esm/CatchBoundary.d.ts +36 -0
  54. package/dist/esm/CatchBoundary.js +89 -0
  55. package/dist/esm/CatchBoundary.js.map +1 -0
  56. package/dist/esm/Matches.d.ts +71 -0
  57. package/dist/esm/Matches.js +261 -0
  58. package/{build/cjs → dist/esm}/Matches.js.map +1 -1
  59. package/dist/esm/RouterProvider.d.ts +27 -0
  60. package/dist/esm/RouterProvider.js +136 -0
  61. package/{build/cjs → dist/esm}/RouterProvider.js.map +1 -1
  62. package/dist/esm/awaited.d.ts +9 -0
  63. package/dist/esm/awaited.js +51 -0
  64. package/dist/esm/awaited.js.map +1 -0
  65. package/dist/esm/defer.d.ts +22 -0
  66. package/dist/esm/defer.js +30 -0
  67. package/{build/cjs → dist/esm}/defer.js.map +1 -1
  68. package/dist/esm/fileRoute.d.ts +21 -0
  69. package/dist/esm/fileRoute.js +19 -0
  70. package/dist/esm/fileRoute.js.map +1 -0
  71. package/{build/types → dist/esm}/history.d.ts +1 -1
  72. package/dist/esm/index.d.ts +30 -0
  73. package/dist/esm/index.js +118 -0
  74. package/dist/esm/index.js.map +1 -0
  75. package/dist/esm/lazyRouteComponent.d.ts +2 -0
  76. package/dist/esm/lazyRouteComponent.js +23 -0
  77. package/{build/cjs → dist/esm}/lazyRouteComponent.js.map +1 -1
  78. package/{build/types → dist/esm}/link.d.ts +5 -1
  79. package/dist/esm/link.js +179 -0
  80. package/dist/esm/link.js.map +1 -0
  81. package/dist/esm/location.d.ts +12 -0
  82. package/dist/esm/path.d.ts +17 -0
  83. package/dist/esm/path.js +200 -0
  84. package/dist/esm/path.js.map +1 -0
  85. package/dist/esm/qss.d.ts +2 -0
  86. package/dist/esm/qss.js +45 -0
  87. package/dist/esm/qss.js.map +1 -0
  88. package/dist/esm/redirects.d.ts +11 -0
  89. package/dist/esm/redirects.js +15 -0
  90. package/{build/cjs → dist/esm}/redirects.js.map +1 -1
  91. package/dist/esm/route.d.ts +300 -0
  92. package/dist/esm/route.js +143 -0
  93. package/dist/esm/route.js.map +1 -0
  94. package/dist/esm/routeInfo.d.ts +31 -0
  95. package/dist/esm/router.d.ts +201 -0
  96. package/dist/esm/router.js +1070 -0
  97. package/{build/cjs → dist/esm}/router.js.map +1 -1
  98. package/dist/esm/routerContext.d.ts +3 -0
  99. package/dist/esm/routerContext.js +13 -0
  100. package/{build/cjs → dist/esm}/routerContext.js.map +1 -1
  101. package/dist/esm/scroll-restoration.d.ts +18 -0
  102. package/dist/esm/scroll-restoration.js +168 -0
  103. package/dist/esm/scroll-restoration.js.map +1 -0
  104. package/dist/esm/searchParams.d.ts +7 -0
  105. package/dist/esm/searchParams.js +63 -0
  106. package/{build/cjs → dist/esm}/searchParams.js.map +1 -1
  107. package/dist/esm/useBlocker.d.ts +9 -0
  108. package/dist/esm/useBlocker.js +19 -0
  109. package/{build/cjs → dist/esm}/useBlocker.js.map +1 -1
  110. package/dist/esm/useNavigate.d.ts +20 -0
  111. package/dist/esm/useNavigate.js +38 -0
  112. package/{build/cjs → dist/esm}/useNavigate.js.map +1 -1
  113. package/dist/esm/useParams.d.ts +7 -0
  114. package/dist/esm/useParams.js +16 -0
  115. package/{build/cjs → dist/esm}/useParams.js.map +1 -1
  116. package/dist/esm/useRouteContext.d.ts +7 -0
  117. package/dist/esm/useRouteContext.js +11 -0
  118. package/{build/cjs → dist/esm}/useRouteContext.js.map +1 -1
  119. package/dist/esm/useRouter.d.ts +5 -0
  120. package/dist/esm/useRouter.js +16 -0
  121. package/{build/cjs → dist/esm}/useRouter.js.map +1 -1
  122. package/dist/esm/useRouterState.d.ts +6 -0
  123. package/dist/esm/useRouterState.js +12 -0
  124. package/{build/cjs → dist/esm}/useRouterState.js.map +1 -1
  125. package/dist/esm/useSearch.d.ts +7 -0
  126. package/dist/esm/useSearch.js +13 -0
  127. package/dist/esm/useSearch.js.map +1 -0
  128. package/dist/esm/utils.d.ts +46 -0
  129. package/dist/esm/utils.js +137 -0
  130. package/{build/cjs → dist/esm}/utils.js.map +1 -1
  131. package/package.json +43 -22
  132. package/src/fileRoute.ts +4 -5
  133. package/src/link.tsx +25 -16
  134. package/src/route.ts +5 -6
  135. package/src/useSearch.tsx +5 -2
  136. package/build/cjs/CatchBoundary.js +0 -128
  137. package/build/cjs/CatchBoundary.js.map +0 -1
  138. package/build/cjs/Matches.js +0 -260
  139. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -29
  140. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  141. package/build/cjs/awaited.js +0 -60
  142. package/build/cjs/awaited.js.map +0 -1
  143. package/build/cjs/defer.js +0 -42
  144. package/build/cjs/fileRoute.js +0 -31
  145. package/build/cjs/fileRoute.js.map +0 -1
  146. package/build/cjs/index.js.map +0 -1
  147. package/build/cjs/lazyRouteComponent.js +0 -54
  148. package/build/cjs/link.js +0 -224
  149. package/build/cjs/link.js.map +0 -1
  150. package/build/cjs/path.js.map +0 -1
  151. package/build/cjs/qss.js +0 -63
  152. package/build/cjs/qss.js.map +0 -1
  153. package/build/cjs/redirects.js +0 -28
  154. package/build/cjs/route.js +0 -292
  155. package/build/cjs/route.js.map +0 -1
  156. package/build/cjs/router.js +0 -1116
  157. package/build/cjs/routerContext.js +0 -42
  158. package/build/cjs/scroll-restoration.js.map +0 -1
  159. package/build/cjs/useBlocker.js +0 -55
  160. package/build/cjs/useNavigate.js +0 -88
  161. package/build/cjs/useParams.js +0 -27
  162. package/build/cjs/useRouteContext.js +0 -23
  163. package/build/cjs/useRouter.js +0 -44
  164. package/build/cjs/useRouterState.js +0 -24
  165. package/build/cjs/useSearch.js +0 -25
  166. package/build/cjs/useSearch.js.map +0 -1
  167. package/build/esm/index.js +0 -2874
  168. package/build/esm/index.js.map +0 -1
  169. package/build/stats-html.html +0 -4838
  170. package/build/stats-react.json +0 -1471
  171. package/build/umd/index.development.js +0 -3573
  172. package/build/umd/index.development.js.map +0 -1
  173. package/build/umd/index.production.js +0 -22
  174. package/build/umd/index.production.js.map +0 -1
  175. /package/{build/types/CatchBoundary.d.ts → dist/cjs/CatchBoundary.d.cts} +0 -0
  176. /package/{build/types/Matches.d.ts → dist/cjs/Matches.d.cts} +0 -0
  177. /package/{build/types/RouterProvider.d.ts → dist/cjs/RouterProvider.d.cts} +0 -0
  178. /package/{build/types/awaited.d.ts → dist/cjs/awaited.d.cts} +0 -0
  179. /package/{build/types/defer.d.ts → dist/cjs/defer.d.cts} +0 -0
  180. /package/{build/types/fileRoute.d.ts → dist/cjs/fileRoute.d.cts} +0 -0
  181. /package/{build/types/index.d.ts → dist/cjs/index.d.cts} +0 -0
  182. /package/{build/types/lazyRouteComponent.d.ts → dist/cjs/lazyRouteComponent.d.cts} +0 -0
  183. /package/{build/types/location.d.ts → dist/cjs/location.d.cts} +0 -0
  184. /package/{build/types/path.d.ts → dist/cjs/path.d.cts} +0 -0
  185. /package/{build/types/qss.d.ts → dist/cjs/qss.d.cts} +0 -0
  186. /package/{build/types/redirects.d.ts → dist/cjs/redirects.d.cts} +0 -0
  187. /package/{build/types/route.d.ts → dist/cjs/route.d.cts} +0 -0
  188. /package/{build/types/routeInfo.d.ts → dist/cjs/routeInfo.d.cts} +0 -0
  189. /package/{build/types/router.d.ts → dist/cjs/router.d.cts} +0 -0
  190. /package/{build/types/routerContext.d.ts → dist/cjs/routerContext.d.cts} +0 -0
  191. /package/{build/types/scroll-restoration.d.ts → dist/cjs/scroll-restoration.d.cts} +0 -0
  192. /package/{build/types/searchParams.d.ts → dist/cjs/searchParams.d.cts} +0 -0
  193. /package/{build/types/useBlocker.d.ts → dist/cjs/useBlocker.d.cts} +0 -0
  194. /package/{build/types/useNavigate.d.ts → dist/cjs/useNavigate.d.cts} +0 -0
  195. /package/{build/types/useParams.d.ts → dist/cjs/useParams.d.cts} +0 -0
  196. /package/{build/types/useRouteContext.d.ts → dist/cjs/useRouteContext.d.cts} +0 -0
  197. /package/{build/types/useRouter.d.ts → dist/cjs/useRouter.d.cts} +0 -0
  198. /package/{build/types/useRouterState.d.ts → dist/cjs/useRouterState.d.cts} +0 -0
  199. /package/{build/types/useSearch.d.ts → dist/cjs/useSearch.d.cts} +0 -0
  200. /package/{build/types/utils.d.ts → dist/cjs/utils.d.cts} +0 -0
@@ -0,0 +1,143 @@
1
+ import invariant from "tiny-invariant";
2
+ import { useMatch, useLoaderDeps, useLoaderData } from "./Matches.js";
3
+ import { trimPath, joinPaths } from "./path.js";
4
+ import { useParams } from "./useParams.js";
5
+ import { useSearch } from "./useSearch.js";
6
+ const rootRouteId = "__root__";
7
+ class RouteApi {
8
+ constructor({ id }) {
9
+ this.useMatch = (opts) => {
10
+ return useMatch({ select: opts == null ? void 0 : opts.select, from: this.id });
11
+ };
12
+ this.useRouteContext = (opts) => {
13
+ return useMatch({
14
+ from: this.id,
15
+ select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
16
+ });
17
+ };
18
+ this.useSearch = (opts) => {
19
+ return useSearch({ ...opts, from: this.id });
20
+ };
21
+ this.useParams = (opts) => {
22
+ return useParams({ ...opts, from: this.id });
23
+ };
24
+ this.useLoaderDeps = (opts) => {
25
+ return useLoaderDeps({ ...opts, from: this.id });
26
+ };
27
+ this.useLoaderData = (opts) => {
28
+ return useLoaderData({ ...opts, from: this.id });
29
+ };
30
+ this.id = id;
31
+ }
32
+ }
33
+ class Route {
34
+ constructor(options) {
35
+ this.init = (opts) => {
36
+ var _a, _b;
37
+ this.originalIndex = opts.originalIndex;
38
+ const options2 = this.options;
39
+ const isRoot = !(options2 == null ? void 0 : options2.path) && !(options2 == null ? void 0 : options2.id);
40
+ this.parentRoute = (_b = (_a = this.options) == null ? void 0 : _a.getParentRoute) == null ? void 0 : _b.call(_a);
41
+ if (isRoot) {
42
+ this.path = rootRouteId;
43
+ } else {
44
+ invariant(
45
+ this.parentRoute,
46
+ `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`
47
+ );
48
+ }
49
+ let path = isRoot ? rootRouteId : options2.path;
50
+ if (path && path !== "/") {
51
+ path = trimPath(path);
52
+ }
53
+ const customId = (options2 == null ? void 0 : options2.id) || path;
54
+ let id = isRoot ? rootRouteId : joinPaths([
55
+ this.parentRoute.id === rootRouteId ? "" : this.parentRoute.id,
56
+ customId
57
+ ]);
58
+ if (path === rootRouteId) {
59
+ path = "/";
60
+ }
61
+ if (id !== rootRouteId) {
62
+ id = joinPaths(["/", id]);
63
+ }
64
+ const fullPath = id === rootRouteId ? "/" : joinPaths([this.parentRoute.fullPath, path]);
65
+ this.path = path;
66
+ this.id = id;
67
+ this.fullPath = fullPath;
68
+ this.to = fullPath;
69
+ };
70
+ this.addChildren = (children) => {
71
+ this.children = children;
72
+ return this;
73
+ };
74
+ this.updateLoader = (options2) => {
75
+ Object.assign(this.options, options2);
76
+ return this;
77
+ };
78
+ this.update = (options2) => {
79
+ Object.assign(this.options, options2);
80
+ return this;
81
+ };
82
+ this.useMatch = (opts) => {
83
+ return useMatch({ ...opts, from: this.id });
84
+ };
85
+ this.useRouteContext = (opts) => {
86
+ return useMatch({
87
+ ...opts,
88
+ from: this.id,
89
+ select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
90
+ });
91
+ };
92
+ this.useSearch = (opts) => {
93
+ return useSearch({ ...opts, from: this.id });
94
+ };
95
+ this.useParams = (opts) => {
96
+ return useParams({ ...opts, from: this.id });
97
+ };
98
+ this.useLoaderDeps = (opts) => {
99
+ return useLoaderDeps({ ...opts, from: this.id });
100
+ };
101
+ this.useLoaderData = (opts) => {
102
+ return useLoaderData({ ...opts, from: this.id });
103
+ };
104
+ this.options = options || {};
105
+ this.isRoot = !(options == null ? void 0 : options.getParentRoute);
106
+ invariant(
107
+ !((options == null ? void 0 : options.id) && (options == null ? void 0 : options.path)),
108
+ `Route cannot have both an 'id' and a 'path' option.`
109
+ );
110
+ this.$$typeof = Symbol.for("react.memo");
111
+ }
112
+ }
113
+ function rootRouteWithContext() {
114
+ return (options) => {
115
+ return new RootRoute(options);
116
+ };
117
+ }
118
+ class RootRoute extends Route {
119
+ constructor(options) {
120
+ super(options);
121
+ }
122
+ }
123
+ function createRouteMask(opts) {
124
+ return opts;
125
+ }
126
+ class NotFoundRoute extends Route {
127
+ constructor(options) {
128
+ super({
129
+ ...options,
130
+ id: "404"
131
+ });
132
+ }
133
+ }
134
+ export {
135
+ NotFoundRoute,
136
+ RootRoute,
137
+ Route,
138
+ RouteApi,
139
+ createRouteMask,
140
+ rootRouteId,
141
+ rootRouteWithContext
142
+ };
143
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\nimport { useLoaderData, useLoaderDeps, useMatch } from './Matches'\nimport { AnyRouteMatch } from './Matches'\nimport { NavigateOptions, ParsePathParams, ToSubOptions } from './link'\nimport { ParsedLocation } from './location'\nimport { joinPaths, trimPath } from './path'\nimport { RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport { AnyRouter, RegisteredRouter } from './router'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport {\n Assign,\n Expand,\n IsAny,\n NoInfer,\n PickRequired,\n UnionToIntersection,\n} from './utils'\nimport { BuildLocationFn, NavigateFn } from './RouterProvider'\n\nexport const rootRouteId = '__root__' as const\nexport type RootRouteId = typeof rootRouteId\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnySearchSchema = {}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n | {\n path: TPath\n }\n | {\n id: TCustomId\n }\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> =\n UnionToIntersection<RoutePathOptions<TCustomId, TPath>>\n\nexport type RouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = AnyPathParams,\n TAllParams extends AnyPathParams = TParams,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = BaseRouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n> &\n UpdatableRouteOptions<NoInfer<TFullSearchSchema>>\n\nexport type ParamsFallback<\n TPath extends string,\n TParams,\n> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams\n\nexport type BaseRouteOptions<\n TParentRoute extends AnyRoute = AnyRoute,\n TCustomId extends string = string,\n TPath extends string = string,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends Record<string, any> = {},\n TSearchSchemaUsed extends Record<string, any> = {},\n TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed,\n TFullSearchSchema extends Record<string, any> = TSearchSchema,\n TParams extends AnyPathParams = {},\n TAllParams = ParamsFallback<TPath, TParams>,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TAllContext extends Record<string, any> = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> = RoutePathOptions<TCustomId, TPath> & {\n getParentRoute: () => TParentRoute\n validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>\n shouldReload?:\n | boolean\n | ((\n match: LoaderFnContext<\n TAllParams,\n TFullSearchSchema,\n TAllContext,\n TRouteContext\n >,\n ) => any)\n} & {\n // This async function is called before a route is loaded.\n // If an error is thrown here, the route's loader will not be called.\n // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n // If thrown during a preload event, the error will be logged to the console.\n beforeLoad?: BeforeLoadFn<\n TFullSearchSchema,\n TParentRoute,\n TAllParams,\n TRouteContextReturn,\n TRouterContext\n >\n} & {\n loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps\n loader?: RouteLoaderFn<\n TAllParams,\n NoInfer<TLoaderDeps>,\n NoInfer<TAllContext>,\n NoInfer<TRouteContext>,\n TLoaderData\n >\n} & (\n | {\n // Both or none\n parseParams?: (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n ) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n stringifyParams?: (\n params: NoInfer<ParamsFallback<TPath, TParams>>,\n ) => Record<ParsePathParams<TPath>, string>\n }\n | {\n stringifyParams?: never\n parseParams?: never\n }\n )\n\ntype BeforeLoadFn<\n TFullSearchSchema extends Record<string, any>,\n TParentRoute extends AnyRoute,\n TAllParams,\n TRouteContextReturn extends RouteContext,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,\n> = (opts: {\n search: TFullSearchSchema\n abortController: AbortController\n preload: boolean\n params: TAllParams\n context: TContext\n location: ParsedLocation\n navigate: NavigateFn<AnyRoute>\n buildLocation: BuildLocationFn<TParentRoute>\n cause: 'preload' | 'enter' | 'stay'\n}) => Promise<TRouteContextReturn> | TRouteContextReturn | void\n\nexport type UpdatableRouteOptions<\n TFullSearchSchema extends Record<string, any>,\n> = {\n // test?: (args: TAllContext) => void\n // If true, this route will be matched as case-sensitive\n caseSensitive?: boolean\n // If true, this route will be forcefully wrapped in a suspense boundary\n wrapInSuspense?: boolean\n // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n pendingComponent?: RouteComponent\n pendingMs?: number\n pendingMinMs?: number\n staleTime?: number\n gcTime?: number\n preloadStaleTime?: number\n preloadGcTime?: number\n // Filter functions that can manipulate search params *before* they are passed to links and navigate\n // calls that match this route.\n preSearchFilters?: SearchFilter<TFullSearchSchema>[]\n // Filter functions that can manipulate search params *after* they are passed to links and navigate\n // calls that match this route.\n postSearchFilters?: SearchFilter<TFullSearchSchema>[]\n onError?: (err: any) => void\n // These functions are called as route matches are loaded, stick around and leave the active\n // matches\n onEnter?: (match: AnyRouteMatch) => void\n onStay?: (match: AnyRouteMatch) => void\n onLeave?: (match: AnyRouteMatch) => void\n}\n\nexport type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<\n TPath,\n TParams\n>\n\nexport type ParseParamsFn<TPath extends string, TParams> = (\n rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>,\n) => TParams extends Record<ParsePathParams<TPath>, any>\n ? TParams\n : 'parseParams must return an object'\n\nexport type ParseParamsObj<TPath extends string, TParams> = {\n parse?: ParseParamsFn<TPath, TParams>\n}\n\n// The parse type here allows a zod schema to be passed directly to the validator\nexport type SearchSchemaValidator<TInput, TReturn> =\n | SearchSchemaValidatorObj<TInput, TReturn>\n | SearchSchemaValidatorFn<TInput, TReturn>\n\nexport type SearchSchemaValidatorObj<TInput, TReturn> = {\n parse?: SearchSchemaValidatorFn<TInput, TReturn>\n}\n\nexport type SearchSchemaValidatorFn<TInput, TReturn> = (\n searchObj: TInput,\n) => TReturn\n\nexport type DefinedPathParamWarning =\n 'Path params cannot be redefined by child routes!'\n\nexport type ParentParams<TParentParams> = AnyPathParams extends TParentParams\n ? {}\n : {\n [Key in keyof TParentParams]?: DefinedPathParamWarning\n }\n\nexport type RouteLoaderFn<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n TLoaderData extends any = unknown,\n> = (\n match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>,\n) => Promise<TLoaderData> | TLoaderData\n\nexport interface LoaderFnContext<\n TAllParams = {},\n TLoaderDeps extends Record<string, any> = {},\n TAllContext extends Record<string, any> = AnyContext,\n TRouteContext extends Record<string, any> = AnyContext,\n> {\n abortController: AbortController\n preload: boolean\n params: TAllParams\n deps: TLoaderDeps\n context: Expand<Assign<TAllContext, TRouteContext>>\n location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>\n parentMatchPromise?: Promise<void>\n cause: 'preload' | 'enter' | 'stay'\n}\n\nexport type SearchFilter<T, U = T> = (prev: T) => U\n\nexport type ResolveId<\n TParentRoute,\n TCustomId extends string,\n TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n types: {\n fullSearchSchema: infer TFullSearchSchema\n }\n}\n ? TFullSearchSchema\n : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n types: {\n fullSearchSchemaInput: infer TFullSearchSchemaInput\n }\n}\n ? TFullSearchSchemaInput\n : {}\n\nexport type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<\n Assign<\n Omit<InferFullSearchSchema<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchema\n >\n>\n\nexport type ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed> =\n Expand<\n Assign<\n Omit<InferFullSearchSchemaInput<TParentRoute>, keyof RootSearchSchema>,\n TSearchSchemaUsed\n >\n >\n\nexport interface AnyRoute\n extends Route<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > {}\n\nexport type MergeFromFromParent<T, U> = IsAny<T, U, T & U>\n\nexport type ResolveAllParams<\n TParentRoute extends AnyRoute,\n TParams extends AnyPathParams,\n> = Record<never, string> extends TParentRoute['types']['allParams']\n ? TParams\n : Expand<\n UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}\n >\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySearchSchema\n TFullSearchSchema: AnySearchSchema\n TParams: Record<string, any>\n TAllParams: Record<string, any>\n TParentContext: AnyContext\n TRouteContext: RouteContext\n TAllContext: AnyContext\n TRouterContext: AnyContext\n TChildren: unknown\n TRouteTree: AnyRoute\n}\n\n// TODO: This is part of a future APi to move away from classes and\n// towards a more functional API. It's not ready yet.\n\n// type RouteApiInstance<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// > = {\n// id: TId\n// useMatch: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useRouteContext: <TSelected = TAllContext>(opts?: {\n// select?: (s: TAllContext) => TSelected\n// }) => TSelected\n\n// useSearch: <TSelected = TFullSearchSchema>(opts?: {\n// select?: (s: TFullSearchSchema) => TSelected\n// }) => TSelected\n\n// useParams: <TSelected = TAllParams>(opts?: {\n// select?: (s: TAllParams) => TSelected\n// }) => TSelected\n\n// useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {\n// select?: (s: TLoaderDeps) => TSelected\n// }) => TSelected\n\n// useLoaderData: <TSelected = TLoaderData>(opts?: {\n// select?: (s: TLoaderData) => TSelected\n// }) => TSelected\n// }\n\n// export function RouteApi_v2<\n// TId extends RouteIds<RegisteredRouter['routeTree']>,\n// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n// TFullSearchSchema extends Record<\n// string,\n// any\n// > = TRoute['types']['fullSearchSchema'],\n// TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n// TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n// TLoaderData extends any = TRoute['types']['loaderData'],\n// >({\n// id,\n// }: {\n// id: TId\n// }): RouteApiInstance<\n// TId,\n// TRoute,\n// TFullSearchSchema,\n// TAllParams,\n// TAllContext,\n// TLoaderDeps,\n// TLoaderData\n// > {\n// return {\n// id,\n\n// useMatch: (opts) => {\n// return useMatch({ ...opts, from: id })\n// },\n\n// useRouteContext: (opts) => {\n// return useMatch({\n// ...opts,\n// from: id,\n// select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n// } as any)\n// },\n\n// useSearch: (opts) => {\n// return useSearch({ ...opts, from: id } as any)\n// },\n\n// useParams: (opts) => {\n// return useParams({ ...opts, from: id } as any)\n// },\n\n// useLoaderDeps: (opts) => {\n// return useLoaderDeps({ ...opts, from: id } as any) as any\n// },\n\n// useLoaderData: (opts) => {\n// return useLoaderData({ ...opts, from: id } as any) as any\n// },\n// }\n// }\n\nexport class RouteApi<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n TFullSearchSchema extends Record<\n string,\n any\n > = TRoute['types']['fullSearchSchema'],\n TAllParams extends AnyPathParams = TRoute['types']['allParams'],\n TAllContext extends Record<string, any> = TRoute['types']['allContext'],\n TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],\n TLoaderData extends any = TRoute['types']['loaderData'],\n> {\n id: TId\n\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (s: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (s: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (s: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (s: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n}\n\nexport class Route<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends Record<\n string,\n any\n > = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<\n TParentRoute,\n TParams\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> {\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >\n\n test!: Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >\n\n // Set up in this.init()\n parentRoute!: TParentRoute\n id!: TId\n // customId!: TCustomId\n path!: TPath\n fullPath!: TFullPath\n to!: TrimPathRight<TFullPath>\n\n // Optional\n children?: TChildren\n originalIndex?: number\n router?: AnyRouter\n rank!: number\n\n constructor(\n options: RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n ) {\n this.options = (options as any) || {}\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n types!: {\n parentRoute: TParentRoute\n path: TPath\n to: TrimPathRight<TFullPath>\n fullPath: TFullPath\n customId: TCustomId\n id: TId\n searchSchema: TSearchSchema\n searchSchemaInput: TSearchSchemaInput\n searchSchemaUsed: TSearchSchemaUsed\n fullSearchSchema: TFullSearchSchema\n fullSearchSchemaInput: TFullSearchSchemaInput\n params: TParams\n allParams: TAllParams\n routeContext: TRouteContext\n allContext: TAllContext\n children: TChildren\n routeTree: TRouteTree\n routerContext: TRouterContext\n loaderData: TLoaderData\n loaderDeps: TLoaderDeps\n }\n\n init = (opts: { originalIndex: number }) => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as RouteOptions<\n TParentRoute,\n TCustomId,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options?.getParentRoute?.()\n\n if (isRoot) {\n this.path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPath(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n (this.parentRoute.id as any) === rootRouteId\n ? ''\n : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this.path = path as TPath\n this.id = id as TId\n // this.customId = customId as TCustomId\n this.fullPath = fullPath as TFullPath\n this.to = fullPath as TrimPathRight<TFullPath>\n }\n\n addChildren = <TNewChildren extends AnyRoute[]>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TNewChildren,\n TRouteTree\n > => {\n this.children = children as any\n return this as any\n }\n\n updateLoader = <TNewLoaderData extends any = unknown>(options: {\n loader: RouteLoaderFn<\n TAllParams,\n TLoaderDeps,\n TAllContext,\n TRouteContext,\n TNewLoaderData\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TNewLoaderData,\n TChildren,\n TRouteTree\n >\n }\n\n update = (options: UpdatableRouteOptions<TFullSearchSchema>) => {\n Object.assign(this.options, options)\n return this\n }\n\n useMatch = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({ ...opts, from: this.id })\n }\n\n useRouteContext = <TSelected = TAllContext>(opts?: {\n select?: (search: TAllContext) => TSelected\n }): TSelected => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TFullSearchSchema>(opts?: {\n select?: (search: TFullSearchSchema) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.id })\n }\n\n useParams = <TSelected = TAllParams>(opts?: {\n select?: (search: TAllParams) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.id })\n }\n\n useLoaderDeps = <TSelected = TLoaderDeps>(opts?: {\n select?: (s: TLoaderDeps) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData = <TSelected = TLoaderData>(opts?: {\n select?: (search: TLoaderData) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function rootRouteWithContext<TRouterContext extends {}>() {\n return <\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n >(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, //TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData // TLoaderData,\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ): RootRoute<\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext\n > => {\n return new RootRoute(options) as any\n }\n}\n\nexport type RootSearchSchema = {\n __TRootSearchSchema__: '__TRootSearchSchema__'\n}\n\nexport class RootRoute<\n TSearchSchemaInput extends Record<string, any> = RootSearchSchema,\n TSearchSchema extends Record<string, any> = RootSearchSchema,\n TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,\n TRouteContextReturn extends RouteContext = RouteContext,\n TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TRouterContext extends {} = {},\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext\n TRouterContext, // TRouterContext\n TLoaderDeps,\n TLoaderData,\n any, // TChildren\n any // TRouteTree\n> {\n constructor(\n options?: Omit<\n RouteOptions<\n AnyRoute, // TParentRoute\n RootRouteId, // TCustomId\n '', // TPath\n TSearchSchemaInput, // TSearchSchemaInput\n TSearchSchema, // TSearchSchema\n TSearchSchemaUsed,\n TSearchSchemaUsed, // TFullSearchSchemaInput\n TSearchSchema, // TFullSearchSchema\n {}, // TParams\n {}, // TAllParams\n TRouteContextReturn, // TRouteContextReturn\n TRouteContext, // TRouteContext\n TRouterContext,\n Assign<TRouterContext, TRouteContext>, // TAllContext\n TLoaderDeps,\n TLoaderData\n >,\n | 'path'\n | 'id'\n | 'getParentRoute'\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n >,\n ) {\n super(options as any)\n }\n}\n\nexport type ResolveFullPath<\n TParentRoute extends AnyRoute,\n TPath extends string,\n TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\ntype RoutePrefix<\n TPrefix extends string,\n TPath extends string,\n> = string extends TPath\n ? RootRouteId\n : TPath extends string\n ? TPrefix extends RootRouteId\n ? TPath extends '/'\n ? '/'\n : `/${TrimPath<TPath>}`\n : `${TPrefix}/${TPath}` extends '/'\n ? '/'\n : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n : never\n\nexport type TrimPath<T extends string> = '' extends T\n ? ''\n : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n T extends `${RootRouteId}/${infer U}`\n ? TrimPathLeft<U>\n : T extends `/${infer U}`\n ? TrimPathLeft<U>\n : T\nexport type TrimPathRight<T extends string> = T extends '/'\n ? '/'\n : T extends `${infer U}/`\n ? TrimPathRight<U>\n : T\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n routeTree: TRouteTree\n from: RoutePaths<TRouteTree>\n to?: any\n params?: any\n search?: any\n hash?: any\n state?: any\n unmaskOnReload?: boolean\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends RoutePaths<TRouteTree>,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToSubOptions<TRouteTree, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type ErrorRouteProps = {\n error: unknown\n info: { componentStack: string }\n}\n//\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = SyncRouteComponent<TProps> &\n AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TSearchSchemaInput extends Record<string, any> = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {},\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n {},\n {},\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["options"],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ import { AnyRoute, Route } from './route';
2
+ import { Expand, UnionToIntersection, UnionToTuple } from './utils';
3
+ export type ParseRoute<TRouteTree extends AnyRoute> = TRouteTree | ParseRouteChildren<TRouteTree>;
4
+ export type ParseRouteChildren<TRouteTree extends AnyRoute> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? {
5
+ [TId in TChildren[number]['id'] as string]: ParseRoute<TChildren[number]>;
6
+ }[string] : never : never;
7
+ export type RoutesById<TRouteTree extends AnyRoute> = {
8
+ [K in ParseRoute<TRouteTree> as K['id']]: K;
9
+ };
10
+ export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<ParseRoute<TRouteTree>, {
11
+ id: TId;
12
+ }>;
13
+ export type RouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['id'];
14
+ export type RoutesByPath<TRouteTree extends AnyRoute> = {
15
+ [K in ParseRoute<TRouteTree> as K['fullPath']]: K;
16
+ };
17
+ export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<ParseRoute<TRouteTree>, {
18
+ fullPath: TPath;
19
+ }>;
20
+ export type RoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['fullPath'] | '/';
21
+ type UnionizeCollisions<T, U> = {
22
+ [P in keyof T & keyof U]: T[P] extends U[P] ? T[P] : T[P] | U[P];
23
+ };
24
+ type Reducer<T, U, C = UnionizeCollisions<T, U>> = C & Omit<T, keyof C> & Omit<U, keyof C>;
25
+ type Reduce<T extends any[], Result = unknown> = T extends [
26
+ infer First,
27
+ ...infer Rest
28
+ ] ? Reduce<Rest, Reducer<Result, First>> : Result;
29
+ export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<Expand<Reduce<UnionToTuple<ParseRoute<TRouteTree>['types']['fullSearchSchema']>>>>;
30
+ export type AllParams<TRouteTree extends AnyRoute> = Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['allParams']>>;
31
+ export {};
@@ -0,0 +1,201 @@
1
+ /// <reference types="react" />
2
+ import { HistoryState, RouterHistory } from '@tanstack/history';
3
+ import { Store } from '@tanstack/store';
4
+ import { AnySearchSchema, AnyRoute, AnyContext, RouteMask } from './route';
5
+ import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo';
6
+ import { PickAsRequired, Updater, NonNullableUpdater, Timeout } from './utils';
7
+ import { RouteComponent } from './route';
8
+ import { AnyRouteMatch, MatchRouteOptions, RouteMatch } from './Matches';
9
+ import { ParsedLocation } from './location';
10
+ import { SearchSerializer, SearchParser } from './searchParams';
11
+ import { BuildLocationFn, CommitLocationOptions, InjectedHtmlEntry, NavigateFn } from './RouterProvider';
12
+ import { ResolveRelativePath, ToOptions } from './link';
13
+ import { NoInfer } from '@tanstack/react-store';
14
+ declare global {
15
+ interface Window {
16
+ __TSR_DEHYDRATED__?: HydrationCtx;
17
+ __TSR_ROUTER_CONTEXT__?: React.Context<Router<any>>;
18
+ }
19
+ }
20
+ export interface Register {
21
+ }
22
+ export type AnyRouter = Router<AnyRoute, any>;
23
+ export type RegisteredRouter = Register extends {
24
+ router: infer TRouter extends AnyRouter;
25
+ } ? TRouter : AnyRouter;
26
+ export type HydrationCtx = {
27
+ router: DehydratedRouter;
28
+ payload: Record<string, any>;
29
+ };
30
+ export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends TRouteTree['types']['routerContext'] ? {
31
+ context?: TRouteTree['types']['routerContext'];
32
+ } : {
33
+ context: TRouteTree['types']['routerContext'];
34
+ };
35
+ export interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<string, any> = Record<string, any>, TSerializedError extends Record<string, any> = Record<string, any>> {
36
+ history?: RouterHistory;
37
+ stringifySearch?: SearchSerializer;
38
+ parseSearch?: SearchParser;
39
+ defaultPreload?: false | 'intent';
40
+ defaultPreloadDelay?: number;
41
+ defaultComponent?: RouteComponent;
42
+ defaultErrorComponent?: RouteComponent;
43
+ defaultPendingComponent?: RouteComponent;
44
+ defaultPendingMs?: number;
45
+ defaultPendingMinMs?: number;
46
+ defaultStaleTime?: number;
47
+ defaultPreloadStaleTime?: number;
48
+ defaultPreloadGcTime?: number;
49
+ defaultGcTime?: number;
50
+ caseSensitive?: boolean;
51
+ routeTree?: TRouteTree;
52
+ basepath?: string;
53
+ context?: TRouteTree['types']['routerContext'];
54
+ dehydrate?: () => TDehydrated;
55
+ hydrate?: (dehydrated: TDehydrated) => void;
56
+ routeMasks?: RouteMask<TRouteTree>[];
57
+ unmaskOnReload?: boolean;
58
+ Wrap?: (props: {
59
+ children: any;
60
+ }) => JSX.Element;
61
+ InnerWrap?: (props: {
62
+ children: any;
63
+ }) => JSX.Element;
64
+ notFoundRoute?: AnyRoute;
65
+ errorSerializer?: RouterErrorSerializer<TSerializedError>;
66
+ }
67
+ export interface RouterErrorSerializer<TSerializedError> {
68
+ serialize: (err: unknown) => TSerializedError;
69
+ deserialize: (err: TSerializedError) => unknown;
70
+ }
71
+ export interface RouterState<TRouteTree extends AnyRoute = AnyRoute> {
72
+ status: 'pending' | 'idle';
73
+ isLoading: boolean;
74
+ isTransitioning: boolean;
75
+ matches: RouteMatch<TRouteTree>[];
76
+ pendingMatches?: RouteMatch<TRouteTree>[];
77
+ cachedMatches: RouteMatch<TRouteTree>[];
78
+ location: ParsedLocation<FullSearchSchema<TRouteTree>>;
79
+ resolvedLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
80
+ lastUpdated: number;
81
+ }
82
+ export type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
83
+ export interface BuildNextOptions {
84
+ to?: string | number | null;
85
+ params?: true | Updater<unknown>;
86
+ search?: true | Updater<unknown>;
87
+ hash?: true | Updater<string>;
88
+ state?: true | NonNullableUpdater<HistoryState>;
89
+ mask?: {
90
+ to?: string | number | null;
91
+ params?: true | Updater<unknown>;
92
+ search?: true | Updater<unknown>;
93
+ hash?: true | Updater<string>;
94
+ state?: true | NonNullableUpdater<HistoryState>;
95
+ unmaskOnReload?: boolean;
96
+ };
97
+ from?: string;
98
+ }
99
+ export interface DehydratedRouterState {
100
+ dehydratedMatches: DehydratedRouteMatch[];
101
+ }
102
+ export type DehydratedRouteMatch = Pick<RouteMatch, 'id' | 'status' | 'updatedAt'>;
103
+ export interface DehydratedRouter {
104
+ state: DehydratedRouterState;
105
+ }
106
+ export type RouterConstructorOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<string, any>, TSerializedError extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TDehydrated, TSerializedError>, 'context'> & RouterContextOptions<TRouteTree>;
107
+ export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent"];
108
+ export type RouterEvents = {
109
+ onBeforeLoad: {
110
+ type: 'onBeforeLoad';
111
+ fromLocation: ParsedLocation;
112
+ toLocation: ParsedLocation;
113
+ pathChanged: boolean;
114
+ };
115
+ onLoad: {
116
+ type: 'onLoad';
117
+ fromLocation: ParsedLocation;
118
+ toLocation: ParsedLocation;
119
+ pathChanged: boolean;
120
+ };
121
+ onResolved: {
122
+ type: 'onResolved';
123
+ fromLocation: ParsedLocation;
124
+ toLocation: ParsedLocation;
125
+ pathChanged: boolean;
126
+ };
127
+ };
128
+ export type RouterEvent = RouterEvents[keyof RouterEvents];
129
+ export type RouterListener<TRouterEvent extends RouterEvent> = {
130
+ eventType: TRouterEvent['type'];
131
+ fn: ListenerFn<TRouterEvent>;
132
+ };
133
+ export declare class Router<TRouteTree extends AnyRoute = AnyRoute, TDehydrated extends Record<string, any> = Record<string, any>, TSerializedError extends Record<string, any> = Record<string, any>> {
134
+ tempLocationKey: string | undefined;
135
+ resetNextScroll: boolean;
136
+ navigateTimeout: Timeout | null;
137
+ latestLoadPromise: Promise<void>;
138
+ subscribers: Set<RouterListener<RouterEvent>>;
139
+ injectedHtml: InjectedHtmlEntry[];
140
+ dehydratedData?: TDehydrated;
141
+ __store: Store<RouterState<TRouteTree>>;
142
+ options: PickAsRequired<RouterOptions<TRouteTree, TDehydrated, TSerializedError>, 'stringifySearch' | 'parseSearch' | 'context'>;
143
+ history: RouterHistory;
144
+ latestLocation: ParsedLocation;
145
+ basepath: string;
146
+ routeTree: TRouteTree;
147
+ routesById: RoutesById<TRouteTree>;
148
+ routesByPath: RoutesByPath<TRouteTree>;
149
+ flatRoutes: AnyRoute[];
150
+ constructor(options: RouterConstructorOptions<TRouteTree, TDehydrated, TSerializedError>);
151
+ startReactTransition: (fn: () => void) => void;
152
+ update: (newOptions: RouterConstructorOptions<TRouteTree, TDehydrated, TSerializedError>) => void;
153
+ get state(): RouterState<TRouteTree>;
154
+ buildRouteTree: () => void;
155
+ subscribe: <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
156
+ emit: (routerEvent: RouterEvent) => void;
157
+ checkLatest: (promise: Promise<void>) => undefined | Promise<void>;
158
+ parseLocation: (previousLocation?: ParsedLocation) => ParsedLocation<FullSearchSchema<TRouteTree>>;
159
+ resolvePathWithBase: (from: string, path: string) => string;
160
+ get looseRoutesById(): Record<string, AnyRoute>;
161
+ matchRoutes: <TRouteTree_1 extends AnyRoute>(pathname: string, locationSearch: AnySearchSchema, opts?: {
162
+ throwOnError?: boolean;
163
+ debug?: boolean;
164
+ }) => RouteMatch<TRouteTree_1, import("./routeInfo").ParseRoute<TRouteTree_1>["id"]>[];
165
+ cancelMatch: (id: string) => void;
166
+ cancelMatches: () => void;
167
+ buildLocation: BuildLocationFn<TRouteTree>;
168
+ commitLocation: ({ startTransition, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
169
+ buildAndCommitLocation: ({ replace, resetScroll, startTransition, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
170
+ navigate: NavigateFn<TRouteTree>;
171
+ loadMatches: ({ checkLatest, matches, preload, }: {
172
+ checkLatest: () => Promise<void> | undefined;
173
+ matches: AnyRouteMatch[];
174
+ preload?: boolean | undefined;
175
+ }) => Promise<RouteMatch[]>;
176
+ invalidate: () => void;
177
+ load: () => Promise<void>;
178
+ cleanCache: () => void;
179
+ preloadRoute: (navigateOpts?: ToOptions<TRouteTree>) => Promise<RouteMatch<AnyRoute, any>[]>;
180
+ matchRoute: <TFrom extends RoutePaths<TRouteTree> = "/", TTo extends string = "", TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRouteTree, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>["types"]["allParams"];
181
+ injectHtml: (html: string | (() => Promise<string> | string)) => Promise<void>;
182
+ dehydrateData: <T>(key: any, getData: T | (() => T | Promise<T>)) => () => T | undefined;
183
+ hydrateData: <T extends unknown = unknown>(key: any) => T | undefined;
184
+ dehydrate: () => DehydratedRouter;
185
+ hydrate: (__do_not_use_server_ctx?: HydrationCtx) => Promise<void>;
186
+ }
187
+ export declare function lazyFn<T extends Record<string, (...args: any[]) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
188
+ export declare class SearchParamError extends Error {
189
+ }
190
+ export declare class PathParamError extends Error {
191
+ }
192
+ export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
193
+ export declare function defaultSerializeError(err: unknown): {
194
+ name: string;
195
+ message: string;
196
+ data?: undefined;
197
+ } | {
198
+ data: unknown;
199
+ name?: undefined;
200
+ message?: undefined;
201
+ };