@tanstack/solid-router 1.112.10 → 1.112.12

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 (184) hide show
  1. package/dist/cjs/Match.cjs.map +1 -1
  2. package/dist/cjs/Matches.cjs.map +1 -1
  3. package/dist/cjs/Matches.d.cts +1 -8
  4. package/dist/cjs/RouterProvider.cjs.map +1 -1
  5. package/dist/cjs/RouterProvider.d.cts +4 -4
  6. package/dist/cjs/Transitioner.cjs +1 -1
  7. package/dist/cjs/Transitioner.cjs.map +1 -1
  8. package/dist/cjs/fileRoute.cjs.map +1 -1
  9. package/dist/cjs/fileRoute.d.cts +4 -7
  10. package/dist/cjs/index.d.cts +3 -5
  11. package/dist/cjs/link.cjs.map +1 -1
  12. package/dist/cjs/link.d.cts +1 -2
  13. package/dist/cjs/not-found.cjs.map +1 -1
  14. package/dist/cjs/not-found.d.cts +1 -2
  15. package/dist/cjs/redirects.cjs.map +1 -1
  16. package/dist/cjs/redirects.d.cts +1 -2
  17. package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
  18. package/dist/cjs/renderRouteNotFound.d.cts +1 -2
  19. package/dist/cjs/route.cjs +15 -23
  20. package/dist/cjs/route.cjs.map +1 -1
  21. package/dist/cjs/route.d.cts +19 -50
  22. package/dist/cjs/router.cjs +25 -25
  23. package/dist/cjs/router.cjs.map +1 -1
  24. package/dist/cjs/router.d.cts +84 -454
  25. package/dist/cjs/routerContext.cjs.map +1 -1
  26. package/dist/cjs/routerContext.d.cts +2 -2
  27. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  28. package/dist/cjs/scroll-restoration.d.cts +1 -2
  29. package/dist/cjs/typePrimitives.d.cts +1 -2
  30. package/dist/cjs/useBlocker.cjs.map +1 -1
  31. package/dist/cjs/useBlocker.d.cts +2 -3
  32. package/dist/cjs/useLoaderData.cjs.map +1 -1
  33. package/dist/cjs/useLoaderData.d.cts +1 -3
  34. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  35. package/dist/cjs/useLoaderDeps.d.cts +1 -3
  36. package/dist/cjs/useLocation.cjs.map +1 -1
  37. package/dist/cjs/useLocation.d.cts +1 -1
  38. package/dist/cjs/useMatch.cjs.map +1 -1
  39. package/dist/cjs/useMatch.d.cts +1 -3
  40. package/dist/cjs/useNavigate.cjs.map +1 -1
  41. package/dist/cjs/useNavigate.d.cts +1 -2
  42. package/dist/cjs/useParams.cjs.map +1 -1
  43. package/dist/cjs/useParams.d.cts +1 -3
  44. package/dist/cjs/useRouteContext.cjs.map +1 -1
  45. package/dist/cjs/useRouteContext.d.cts +1 -2
  46. package/dist/cjs/useRouter.cjs.map +1 -1
  47. package/dist/cjs/useRouter.d.cts +1 -1
  48. package/dist/cjs/useRouterState.cjs.map +1 -1
  49. package/dist/cjs/useRouterState.d.cts +1 -1
  50. package/dist/cjs/useSearch.cjs.map +1 -1
  51. package/dist/cjs/useSearch.d.cts +1 -3
  52. package/dist/cjs/utils.cjs.map +1 -1
  53. package/dist/cjs/utils.d.cts +0 -9
  54. package/dist/esm/Match.js.map +1 -1
  55. package/dist/esm/Matches.d.ts +1 -8
  56. package/dist/esm/Matches.js.map +1 -1
  57. package/dist/esm/RouterProvider.d.ts +4 -4
  58. package/dist/esm/RouterProvider.js.map +1 -1
  59. package/dist/esm/Transitioner.js +1 -1
  60. package/dist/esm/Transitioner.js.map +1 -1
  61. package/dist/esm/fileRoute.d.ts +4 -7
  62. package/dist/esm/fileRoute.js.map +1 -1
  63. package/dist/esm/index.d.ts +3 -5
  64. package/dist/esm/link.d.ts +1 -2
  65. package/dist/esm/link.js.map +1 -1
  66. package/dist/esm/not-found.d.ts +1 -2
  67. package/dist/esm/not-found.js.map +1 -1
  68. package/dist/esm/redirects.d.ts +1 -2
  69. package/dist/esm/redirects.js.map +1 -1
  70. package/dist/esm/renderRouteNotFound.d.ts +1 -2
  71. package/dist/esm/renderRouteNotFound.js.map +1 -1
  72. package/dist/esm/route.d.ts +19 -50
  73. package/dist/esm/route.js +15 -23
  74. package/dist/esm/route.js.map +1 -1
  75. package/dist/esm/router.d.ts +84 -454
  76. package/dist/esm/router.js +25 -25
  77. package/dist/esm/router.js.map +1 -1
  78. package/dist/esm/routerContext.d.ts +2 -2
  79. package/dist/esm/routerContext.js.map +1 -1
  80. package/dist/esm/scroll-restoration.d.ts +1 -2
  81. package/dist/esm/scroll-restoration.js.map +1 -1
  82. package/dist/esm/typePrimitives.d.ts +1 -2
  83. package/dist/esm/useBlocker.d.ts +2 -3
  84. package/dist/esm/useBlocker.js.map +1 -1
  85. package/dist/esm/useLoaderData.d.ts +1 -3
  86. package/dist/esm/useLoaderData.js.map +1 -1
  87. package/dist/esm/useLoaderDeps.d.ts +1 -3
  88. package/dist/esm/useLoaderDeps.js.map +1 -1
  89. package/dist/esm/useLocation.d.ts +1 -1
  90. package/dist/esm/useLocation.js.map +1 -1
  91. package/dist/esm/useMatch.d.ts +1 -3
  92. package/dist/esm/useMatch.js.map +1 -1
  93. package/dist/esm/useNavigate.d.ts +1 -2
  94. package/dist/esm/useNavigate.js.map +1 -1
  95. package/dist/esm/useParams.d.ts +1 -3
  96. package/dist/esm/useParams.js.map +1 -1
  97. package/dist/esm/useRouteContext.d.ts +1 -2
  98. package/dist/esm/useRouteContext.js.map +1 -1
  99. package/dist/esm/useRouter.d.ts +1 -1
  100. package/dist/esm/useRouter.js.map +1 -1
  101. package/dist/esm/useRouterState.d.ts +1 -1
  102. package/dist/esm/useRouterState.js.map +1 -1
  103. package/dist/esm/useSearch.d.ts +1 -3
  104. package/dist/esm/useSearch.js.map +1 -1
  105. package/dist/esm/utils.d.ts +0 -9
  106. package/dist/esm/utils.js.map +1 -1
  107. package/dist/source/Matches.d.ts +1 -8
  108. package/dist/source/Matches.jsx.map +1 -1
  109. package/dist/source/RouterProvider.d.ts +4 -4
  110. package/dist/source/RouterProvider.jsx.map +1 -1
  111. package/dist/source/Transitioner.jsx +1 -1
  112. package/dist/source/Transitioner.jsx.map +1 -1
  113. package/dist/source/fileRoute.d.ts +4 -7
  114. package/dist/source/fileRoute.js.map +1 -1
  115. package/dist/source/index.d.ts +3 -5
  116. package/dist/source/index.jsx.map +1 -1
  117. package/dist/source/link.d.ts +1 -2
  118. package/dist/source/link.jsx.map +1 -1
  119. package/dist/source/not-found.d.ts +1 -2
  120. package/dist/source/not-found.jsx.map +1 -1
  121. package/dist/source/redirects.d.ts +1 -2
  122. package/dist/source/renderRouteNotFound.d.ts +1 -2
  123. package/dist/source/renderRouteNotFound.jsx.map +1 -1
  124. package/dist/source/route.d.ts +19 -50
  125. package/dist/source/route.js +15 -23
  126. package/dist/source/route.js.map +1 -1
  127. package/dist/source/router.d.ts +83 -454
  128. package/dist/source/router.js +33 -22
  129. package/dist/source/router.js.map +1 -1
  130. package/dist/source/routerContext.d.ts +2 -2
  131. package/dist/source/routerContext.jsx.map +1 -1
  132. package/dist/source/scroll-restoration.d.ts +1 -2
  133. package/dist/source/scroll-restoration.jsx.map +1 -1
  134. package/dist/source/typePrimitives.d.ts +1 -2
  135. package/dist/source/useBlocker.d.ts +2 -3
  136. package/dist/source/useBlocker.jsx.map +1 -1
  137. package/dist/source/useLoaderData.d.ts +1 -3
  138. package/dist/source/useLoaderData.jsx.map +1 -1
  139. package/dist/source/useLoaderDeps.d.ts +1 -3
  140. package/dist/source/useLoaderDeps.jsx.map +1 -1
  141. package/dist/source/useLocation.d.ts +1 -1
  142. package/dist/source/useLocation.jsx.map +1 -1
  143. package/dist/source/useMatch.d.ts +1 -3
  144. package/dist/source/useMatch.jsx.map +1 -1
  145. package/dist/source/useNavigate.d.ts +1 -2
  146. package/dist/source/useNavigate.jsx.map +1 -1
  147. package/dist/source/useParams.d.ts +1 -3
  148. package/dist/source/useParams.jsx.map +1 -1
  149. package/dist/source/useRouteContext.d.ts +1 -2
  150. package/dist/source/useRouter.d.ts +1 -1
  151. package/dist/source/useRouterState.d.ts +1 -1
  152. package/dist/source/useRouterState.jsx.map +1 -1
  153. package/dist/source/useSearch.d.ts +1 -3
  154. package/dist/source/useSearch.jsx.map +1 -1
  155. package/dist/source/utils.d.ts +1 -10
  156. package/dist/source/utils.js.map +1 -1
  157. package/package.json +2 -2
  158. package/src/Match.tsx +1 -1
  159. package/src/Matches.tsx +4 -8
  160. package/src/RouterProvider.tsx +4 -7
  161. package/src/Transitioner.tsx +1 -1
  162. package/src/fileRoute.ts +9 -25
  163. package/src/index.tsx +22 -28
  164. package/src/link.tsx +2 -1
  165. package/src/not-found.tsx +1 -2
  166. package/src/redirects.ts +1 -1
  167. package/src/renderRouteNotFound.tsx +1 -2
  168. package/src/route.ts +93 -222
  169. package/src/router.ts +154 -596
  170. package/src/routerContext.tsx +3 -3
  171. package/src/scroll-restoration.tsx +6 -2
  172. package/src/typePrimitives.ts +2 -1
  173. package/src/useBlocker.tsx +7 -3
  174. package/src/useLoaderData.tsx +3 -2
  175. package/src/useLoaderDeps.tsx +3 -2
  176. package/src/useLocation.tsx +5 -1
  177. package/src/useMatch.tsx +3 -2
  178. package/src/useNavigate.tsx +2 -1
  179. package/src/useParams.tsx +3 -2
  180. package/src/useRouteContext.ts +2 -2
  181. package/src/useRouter.tsx +1 -1
  182. package/src/useRouterState.tsx +5 -1
  183. package/src/useSearch.tsx +3 -2
  184. package/src/utils.ts +0 -16
@@ -1,12 +1,10 @@
1
- import { AnyContext, AnySchema, Constrain, ConstrainLiteral, RootRoute as CoreRootRoute, Route as CoreRoute, ErrorComponentProps, NotFoundRouteProps, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteById, RouteContext, RouteIds, RouteLoaderFn, RouteOptions, RoutePaths, RoutePrefix, RouteTypes, ToMaskOptions, TrimPathRight, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
1
+ import { AnyContext, AnyRoute, AnyRouter, Constrain, ConstrainLiteral, LazyRoute as CoreLazyRoute, Route as CoreRoute, ErrorComponentProps, NotFoundRouteProps, RegisteredRouter, ResolveFullPath, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, RouteConstraints, RouteIds, RouteLazyFn, RouteLoaderFn, RouteMask, RouteOptions, RouteTypes, RouteTypesById, Router, ToMaskOptions, TrimPathRight, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
2
2
  import { UseLoaderDataRoute } from './useLoaderData.js';
3
3
  import { UseMatchRoute } from './useMatch.js';
4
4
  import { UseLoaderDepsRoute } from './useLoaderDeps.js';
5
5
  import { UseParamsRoute } from './useParams.js';
6
6
  import { UseSearchRoute } from './useSearch.js';
7
- import { AnyRouter, RegisteredRouter, Router } from './router.js';
8
7
  import { NotFoundError } from './not-found.js';
9
- import { LazyRoute } from './fileRoute.js';
10
8
  import { UseRouteContextRoute } from './useRouteContext.js';
11
9
  import type * as Solid from 'solid-js';
12
10
  declare module '@tanstack/router-core' {
@@ -16,32 +14,16 @@ declare module '@tanstack/router-core' {
16
14
  notFoundComponent?: NotFoundRouteComponent;
17
15
  pendingComponent?: RouteComponent;
18
16
  }
17
+ interface RouteExtensions<TId extends string, TFullPath extends string> {
18
+ useMatch: UseMatchRoute<TId>;
19
+ useRouteContext: UseRouteContextRoute<TId>;
20
+ useSearch: UseSearchRoute<TId>;
21
+ useParams: UseParamsRoute<TId>;
22
+ useLoaderDeps: UseLoaderDepsRoute<TId>;
23
+ useLoaderData: UseLoaderDataRoute<TId>;
24
+ useNavigate: () => UseNavigateResult<TFullPath>;
25
+ }
19
26
  }
20
- export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
21
- }
22
- export type AnyRouteWithContext<TContext> = AnyRoute & {
23
- types: {
24
- allContext: TContext;
25
- };
26
- };
27
- export type RouteConstraints = {
28
- TParentRoute: AnyRoute;
29
- TPath: string;
30
- TFullPath: string;
31
- TCustomId: string;
32
- TId: string;
33
- TSearchSchema: AnySchema;
34
- TFullSearchSchema: AnySchema;
35
- TParams: Record<string, any>;
36
- TAllParams: Record<string, any>;
37
- TParentContext: AnyContext;
38
- TRouteContext: RouteContext;
39
- TAllContext: AnyContext;
40
- TRouterContext: AnyContext;
41
- TChildren: unknown;
42
- TRouteTree: AnyRoute;
43
- };
44
- export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<TRouter['routeTree'], TId>['types'];
45
27
  export declare function getRouteApi<const TId, TRouter extends AnyRouter = RegisteredRouter>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): RouteApi<TId, TRouter>;
46
28
  export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
47
29
  id: TId;
@@ -61,7 +43,7 @@ export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter>
61
43
  notFound: (opts?: NotFoundError) => NotFoundError;
62
44
  }
63
45
  export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> implements CoreRoute<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
64
- isRoot: TParentRoute extends Route<any> ? true : false;
46
+ isRoot: TParentRoute extends AnyRoute ? true : false;
65
47
  options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
66
48
  parentRoute: TParentRoute;
67
49
  private _id;
@@ -77,7 +59,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
77
59
  children?: TChildren;
78
60
  originalIndex?: number;
79
61
  rank: number;
80
- lazyFn?: () => Promise<LazyRoute<any>>;
62
+ lazyFn?: () => Promise<CoreLazyRoute>;
81
63
  _lazyPromise?: Promise<void>;
82
64
  _componentsPromise?: Promise<Array<void>>;
83
65
  /**
@@ -89,13 +71,14 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
89
71
  originalIndex: number;
90
72
  defaultSsr?: boolean;
91
73
  }) => void;
92
- addChildren<const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
93
- _addFileChildren<const TNewChildren>(children: TNewChildren): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
74
+ addChildren: RouteAddChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
75
+ _addFileChildren: RouteAddFileChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
76
+ _addFileTypes: RouteAddFileTypesFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
94
77
  updateLoader: <TNewLoaderFn>(options: {
95
78
  loader: Constrain<TNewLoaderFn, RouteLoaderFn<TParentRoute, TCustomId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
96
79
  }) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TNewLoaderFn, TChildren, TFileRouteTypes>;
97
80
  update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
98
- lazy: (lazyFn: () => Promise<LazyRoute<any>>) => this;
81
+ lazy: RouteLazyFn<this>;
99
82
  useMatch: UseMatchRoute<TId>;
100
83
  useRouteContext: UseRouteContextRoute<TId>;
101
84
  useSearch: UseSearchRoute<TId>;
@@ -104,7 +87,7 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
104
87
  useLoaderData: UseLoaderDataRoute<TId>;
105
88
  useNavigate: () => UseNavigateResult<TFullPath>;
106
89
  }
107
- export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
90
+ export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn>): CoreRoute<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
108
91
  export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
109
92
  export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>) => RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
110
93
  /**
@@ -119,30 +102,16 @@ RootRouteId, // TId
119
102
  TSearchValidator, // TSearchValidator
120
103
  {}, // TParams
121
104
  TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
122
- TFileRouteTypes> implements CoreRootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
105
+ TFileRouteTypes> {
123
106
  /**
124
107
  * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
125
108
  */
126
109
  constructor(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>);
127
- addChildren<const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
128
- _addFileChildren<const TNewChildren>(children: TNewChildren): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
129
- _addFileTypes<TFileRouteTypes>(): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>;
130
110
  }
131
111
  export declare function createRootRoute<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
132
- export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
133
- export type RouteMask<TRouteTree extends AnyRoute> = {
134
- routeTree: TRouteTree;
135
- from: RoutePaths<TRouteTree>;
136
- to?: any;
137
- params?: any;
138
- search?: any;
139
- hash?: any;
140
- state?: any;
141
- unmaskOnReload?: boolean;
142
- };
143
112
  export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string>(opts: {
144
113
  routeTree: TRouteTree;
145
- } & ToMaskOptions<Router<TRouteTree, 'never'>, TFrom, TTo>): RouteMask<TRouteTree>;
114
+ } & ToMaskOptions<Router<TRouteTree, 'never', false>, TFrom, TTo>): RouteMask<TRouteTree>;
146
115
  export type SolidNode = Solid.JSX.Element;
147
116
  export type SyncRouteComponent<TProps> = (props: TProps) => Solid.JSX.Element;
148
117
  export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
package/dist/esm/route.js CHANGED
@@ -95,6 +95,21 @@ class Route {
95
95
  this._to = fullPath;
96
96
  this._ssr = (options2 == null ? void 0 : options2.ssr) ?? opts.defaultSsr ?? true;
97
97
  };
98
+ this.addChildren = (children) => {
99
+ return this._addFileChildren(children);
100
+ };
101
+ this._addFileChildren = (children) => {
102
+ if (Array.isArray(children)) {
103
+ this.children = children;
104
+ }
105
+ if (typeof children === "object" && children !== null) {
106
+ this.children = Object.values(children);
107
+ }
108
+ return this;
109
+ };
110
+ this._addFileTypes = () => {
111
+ return this;
112
+ };
98
113
  this.updateLoader = (options2) => {
99
114
  Object.assign(this.options, options2);
100
115
  return this;
@@ -163,18 +178,6 @@ class Route {
163
178
  get ssr() {
164
179
  return this._ssr;
165
180
  }
166
- addChildren(children) {
167
- return this._addFileChildren(children);
168
- }
169
- _addFileChildren(children) {
170
- if (Array.isArray(children)) {
171
- this.children = children;
172
- }
173
- if (typeof children === "object" && children !== null) {
174
- this.children = Object.values(children);
175
- }
176
- return this;
177
- }
178
181
  }
179
182
  function createRoute(options) {
180
183
  return new Route(options);
@@ -192,17 +195,6 @@ class RootRoute extends Route {
192
195
  constructor(options) {
193
196
  super(options);
194
197
  }
195
- addChildren(children) {
196
- super.addChildren(children);
197
- return this;
198
- }
199
- _addFileChildren(children) {
200
- super._addFileChildren(children);
201
- return this;
202
- }
203
- _addFileTypes() {
204
- return this;
205
- }
206
198
  }
207
199
  function createRootRoute(options) {
208
200
  return new RootRoute(options);
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { joinPaths, rootRouteId, trimPathLeft } from '@tanstack/router-core'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport type {\n AnyContext,\n AnySchema,\n Constrain,\n ConstrainLiteral,\n RootRoute as CoreRootRoute,\n Route as CoreRoute,\n ErrorComponentProps,\n NotFoundRouteProps,\n ResolveId,\n ResolveParams,\n RootRouteId,\n RootRouteOptions,\n RouteById,\n RouteContext,\n RouteIds,\n RouteLoaderFn,\n RouteOptions,\n RoutePathOptionsIntersection,\n RoutePaths,\n RoutePrefix,\n RouteTypes,\n ToMaskOptions,\n TrimPathRight,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type * as Solid from 'solid-js'\nimport type { AnyRouter, RegisteredRouter, Router } from './router'\nimport type { NotFoundError } from './not-found'\nimport type { LazyRoute } from './fileRoute'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\ndeclare module '@tanstack/router-core' {\n export interface UpdatableRouteOptionsExtensions {\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\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 > {}\n\nexport type AnyRouteWithContext<TContext> = AnyRoute & {\n types: { allContext: TContext }\n}\n\nexport type RouteConstraints = {\n TParentRoute: AnyRoute\n TPath: string\n TFullPath: string\n TCustomId: string\n TId: string\n TSearchSchema: AnySchema\n TFullSearchSchema: AnySchema\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\nexport type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<\n TRouter['routeTree'],\n TId\n>['types']\n\nexport function getRouteApi<\n const TId,\n TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n return useMatch({\n from: this.id as any,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<\n RouteTypesById<TRouter, TId>['fullPath']\n > => {\n return useNavigate({ from: this.id as string })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchValidator = undefined,\n in out TParams = ResolveParams<TPath>,\n in out TRouterContext = AnyContext,\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> implements\n CoreRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n{\n isRoot: TParentRoute extends Route<any> ? true : false\n options: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\n\n // The following properties are set up in this.init()\n parentRoute!: TParentRoute\n private _id!: TId\n private _path!: TPath\n private _fullPath!: TFullPath\n private _to!: TrimPathRight<TFullPath>\n private _ssr!: boolean\n\n public get to() {\n /* invariant(\n this._to,\n `trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._to\n }\n\n public get id() {\n /* invariant(\n this._id,\n `trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._id\n }\n\n public get path() {\n /* invariant(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.isRoot || this._id || this._path,\n `trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._path\n }\n\n public get fullPath() {\n /* invariant(\n this._fullPath,\n `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._fullPath\n }\n\n public get ssr() {\n return this._ssr\n }\n\n // Optional\n children?: TChildren\n originalIndex?: number\n rank!: number\n lazyFn?: () => Promise<LazyRoute<any>>\n _lazyPromise?: Promise<void>\n _componentsPromise?: Promise<Array<void>>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ) {\n this.options = (options as any) || {}\n\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 }\n\n types!: RouteTypes<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n\n init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\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 = trimPathLeft(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 === rootRouteId ? '' : 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 this._ssr = options?.ssr ?? opts.defaultSsr ?? true\n }\n\n addChildren<const TNewChildren>(\n children: Constrain<\n TNewChildren,\n ReadonlyArray<AnyRoute> | Record<string, AnyRoute>\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n > {\n return this._addFileChildren(children) as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n >\n }\n\n _addFileChildren<const TNewChildren>(\n children: TNewChildren,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n > {\n if (Array.isArray(children)) {\n this.children = children as TChildren\n }\n\n if (typeof children === 'object' && children !== null) {\n this.children = Object.values(children) as TChildren\n }\n\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n >\n }\n\n updateLoader = <TNewLoaderFn>(options: {\n loader: Constrain<\n TNewLoaderFn,\n RouteLoaderFn<\n TParentRoute,\n TCustomId,\n TParams,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\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 TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TNewLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TParentRoute,\n TCustomId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy = (lazyFn: () => Promise<LazyRoute<any>>): this => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\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 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: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n) {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n >(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) => {\n return createRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchValidator = undefined,\n in out TRouterContext = {},\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n >\n extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchValidator, // TSearchValidator\n {}, // TParams\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren, // TChildren\n TFileRouteTypes\n >\n implements\n CoreRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n{\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) {\n super(options as any)\n }\n\n addChildren<const TNewChildren>(\n children: Constrain<\n TNewChildren,\n ReadonlyArray<AnyRoute> | Record<string, AnyRoute>\n >,\n ): RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n > {\n super.addChildren(children)\n return this as unknown as RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n >\n }\n\n _addFileChildren<const TNewChildren>(\n children: TNewChildren,\n ): RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n > {\n super._addFileChildren(children)\n return this as unknown as RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TNewChildren,\n TFileRouteTypes\n >\n }\n\n _addFileTypes<TFileRouteTypes>(): RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n > {\n return this as any\n }\n}\n\nexport function createRootRoute<\n TSearchValidator = undefined,\n TRouterContext = {},\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n>(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n) {\n return new RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options)\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\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 string,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never'>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type SolidNode = Solid.JSX.Element\n\nexport type SyncRouteComponent<TProps> = (props: TProps) => Solid.JSX.Element\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TRouterContext = AnyContext,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchValidator,\n {},\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n string,\n string,\n TSearchValidator,\n {},\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["options"],"mappings":";;;;;;;;;AAqGO,SAAS,YAGd,IAA2D;AAC3D,SAAO,IAAI,SAAuB,EAAE,IAAI;AAC1C;AAEO,MAAM,SAA4D;AAAA;AAAA;AAAA;AAAA,EAMvE,YAAY,EAAE,MAAmB;AAIjC,SAAA,WAA+B,CAAC,SAAS;AACvC,aAAO,SAAS;AAAA,QACd,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,kBAA6C,CAAC,SAAS;AACrD,aAAO,SAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAO,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAC3D;AAAA,IACH;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,gBAAyC,CAAC,SAAS;AAC1C,aAAA,cAAc,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,QAAQ,OAAc;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B;AAChB,SAAA;AACT;AAgBO,MAAM,sBASH,MAcR;AAAA,EACA,YACE,SAsBA;AACM,UAAA;AAAA,MACJ,GAAI;AAAA,MACJ,IAAI;AAAA,IAAA,CACL;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport { joinPaths, rootRouteId, trimPathLeft } from '@tanstack/router-core'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { notFound } from './not-found'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n LazyRoute as CoreLazyRoute,\n Route as CoreRoute,\n ErrorComponentProps,\n NotFoundRouteProps,\n RegisteredRouter,\n ResolveFullPath,\n ResolveId,\n ResolveParams,\n RootRouteId,\n RootRouteOptions,\n RouteAddChildrenFn,\n RouteAddFileChildrenFn,\n RouteAddFileTypesFn,\n RouteConstraints,\n RouteIds,\n RouteLazyFn,\n RouteLoaderFn,\n RouteMask,\n RouteOptions,\n RoutePathOptionsIntersection,\n RouteTypes,\n RouteTypesById,\n Router,\n ToMaskOptions,\n TrimPathRight,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type * as Solid from 'solid-js'\nimport type { NotFoundError } from './not-found'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\ndeclare module '@tanstack/router-core' {\n export interface UpdatableRouteOptionsExtensions {\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n }\n\n export interface RouteExtensions<\n TId extends string,\n TFullPath extends string,\n > {\n useMatch: UseMatchRoute<TId>\n useRouteContext: UseRouteContextRoute<TId>\n useSearch: UseSearchRoute<TId>\n useParams: UseParamsRoute<TId>\n useLoaderDeps: UseLoaderDepsRoute<TId>\n useLoaderData: UseLoaderDataRoute<TId>\n useNavigate: () => UseNavigateResult<TFullPath>\n }\n}\n\nexport function getRouteApi<\n const TId,\n TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n return useMatch({\n from: this.id as any,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<\n RouteTypesById<TRouter, TId>['fullPath']\n > => {\n return useNavigate({ from: this.id as string })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchValidator = undefined,\n in out TParams = ResolveParams<TPath>,\n in out TRouterContext = AnyContext,\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> implements\n CoreRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n{\n isRoot: TParentRoute extends AnyRoute ? true : false\n options: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\n\n // The following properties are set up in this.init()\n parentRoute!: TParentRoute\n private _id!: TId\n private _path!: TPath\n private _fullPath!: TFullPath\n private _to!: TrimPathRight<TFullPath>\n private _ssr!: boolean\n\n public get to() {\n /* invariant(\n this._to,\n `trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._to\n }\n\n public get id() {\n /* invariant(\n this._id,\n `trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._id\n }\n\n public get path() {\n /* invariant(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.isRoot || this._id || this._path,\n `trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._path\n }\n\n public get fullPath() {\n /* invariant(\n this._fullPath,\n `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._fullPath\n }\n\n public get ssr() {\n return this._ssr\n }\n\n // Optional\n children?: TChildren\n originalIndex?: number\n rank!: number\n lazyFn?: () => Promise<CoreLazyRoute>\n _lazyPromise?: Promise<void>\n _componentsPromise?: Promise<Array<void>>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ) {\n this.options = (options as any) || {}\n\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 }\n\n types!: RouteTypes<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n\n init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\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 = trimPathLeft(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 === rootRouteId ? '' : 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 this._ssr = options?.ssr ?? opts.defaultSsr ?? true\n }\n\n addChildren: RouteAddChildrenFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TFileRouteTypes\n > = (children) => {\n return this._addFileChildren(children) as any\n }\n\n _addFileChildren: RouteAddFileChildrenFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TFileRouteTypes\n > = (children) => {\n if (Array.isArray(children)) {\n this.children = children as TChildren\n }\n\n if (typeof children === 'object' && children !== null) {\n this.children = Object.values(children) as TChildren\n }\n\n return this as any\n }\n\n _addFileTypes: RouteAddFileTypesFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > = () => {\n return this as any\n }\n\n updateLoader = <TNewLoaderFn>(options: {\n loader: Constrain<\n TNewLoaderFn,\n RouteLoaderFn<\n TParentRoute,\n TCustomId,\n TParams,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\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 TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TNewLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TParentRoute,\n TCustomId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy: RouteLazyFn<this> = (lazyFn) => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.id })\n }\n}\n\nexport function createRoute<\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 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: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n): CoreRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n> {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n >(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) => {\n return createRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchValidator = undefined,\n in out TRouterContext = {},\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchValidator, // TSearchValidator\n {}, // TParams\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren, // TChildren\n TFileRouteTypes\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchValidator = undefined,\n TRouterContext = {},\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n>(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n) {\n return new RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options)\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends string,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never', false>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type SolidNode = Solid.JSX.Element\n\nexport type SyncRouteComponent<TProps> = (props: TProps) => Solid.JSX.Element\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TRouterContext = AnyContext,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchValidator,\n {},\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n string,\n string,\n TSearchValidator,\n {},\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["options"],"mappings":";;;;;;;;;AA0EO,SAAS,YAGd,IAA2D;AAC3D,SAAO,IAAI,SAAuB,EAAE,IAAI;AAC1C;AAEO,MAAM,SAA4D;AAAA;AAAA;AAAA;AAAA,EAMvE,YAAY,EAAE,MAAmB;AAIjC,SAAA,WAA+B,CAAC,SAAS;AACvC,aAAO,SAAS;AAAA,QACd,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,kBAA6C,CAAC,SAAS;AACrD,aAAO,SAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAO,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAC3D;AAAA,IACH;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;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