@tanstack/router-core 0.0.1-beta.9 → 1.20.3-alpha.1
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.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/cjs/Matches.cjs +13 -0
- package/dist/cjs/Matches.cjs.map +1 -0
- package/dist/cjs/Matches.d.cts +109 -0
- package/dist/cjs/RouterProvider.d.cts +26 -0
- package/dist/cjs/defer.cjs +25 -0
- package/dist/cjs/defer.cjs.map +1 -0
- package/dist/cjs/defer.d.cts +20 -0
- package/dist/cjs/fileRoute.d.cts +23 -0
- package/dist/cjs/history.d.cts +8 -0
- package/dist/cjs/index.cjs +80 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +41 -0
- package/dist/cjs/link.cjs +5 -0
- package/dist/cjs/link.cjs.map +1 -0
- package/dist/cjs/link.d.cts +200 -0
- package/dist/cjs/location.d.cts +12 -0
- package/dist/cjs/manifest.d.cts +24 -0
- package/dist/cjs/not-found.cjs +13 -0
- package/dist/cjs/not-found.cjs.map +1 -0
- package/dist/cjs/not-found.d.cts +20 -0
- package/dist/cjs/path.cjs +412 -0
- package/dist/cjs/path.cjs.map +1 -0
- package/dist/cjs/path.d.cts +56 -0
- package/dist/cjs/qss.cjs +38 -0
- package/dist/cjs/qss.cjs.map +1 -0
- package/dist/cjs/qss.d.cts +22 -0
- package/dist/cjs/redirect.cjs +34 -0
- package/dist/cjs/redirect.cjs.map +1 -0
- package/dist/cjs/redirect.d.cts +38 -0
- package/dist/cjs/root.cjs +5 -0
- package/dist/cjs/root.cjs.map +1 -0
- package/dist/cjs/root.d.cts +2 -0
- package/dist/cjs/route.cjs +119 -0
- package/dist/cjs/route.cjs.map +1 -0
- package/dist/cjs/route.d.cts +422 -0
- package/dist/cjs/routeInfo.d.cts +54 -0
- package/dist/cjs/router.cjs +1800 -0
- package/dist/cjs/router.cjs.map +1 -0
- package/dist/cjs/router.d.cts +630 -0
- package/dist/cjs/scroll-restoration.cjs +196 -0
- package/dist/cjs/scroll-restoration.cjs.map +1 -0
- package/dist/cjs/scroll-restoration.d.cts +38 -0
- package/dist/cjs/searchMiddleware.cjs +42 -0
- package/dist/cjs/searchMiddleware.cjs.map +1 -0
- package/dist/cjs/searchMiddleware.d.cts +5 -0
- package/dist/cjs/searchParams.cjs +61 -0
- package/dist/cjs/searchParams.cjs.map +1 -0
- package/dist/cjs/searchParams.d.cts +7 -0
- package/dist/cjs/serializer.d.cts +22 -0
- package/dist/cjs/structuralSharing.d.cts +4 -0
- package/dist/cjs/typePrimitives.d.cts +65 -0
- package/dist/cjs/useLoaderData.d.cts +5 -0
- package/dist/cjs/useLoaderDeps.d.cts +5 -0
- package/dist/cjs/useNavigate.d.cts +3 -0
- package/dist/cjs/useParams.d.cts +5 -0
- package/dist/cjs/useRouteContext.d.cts +9 -0
- package/dist/cjs/useSearch.d.cts +5 -0
- package/dist/cjs/utils.cjs +160 -0
- package/dist/cjs/utils.cjs.map +1 -0
- package/dist/cjs/utils.d.cts +105 -0
- package/dist/cjs/validators.d.cts +51 -0
- package/dist/esm/Matches.d.ts +109 -0
- package/dist/esm/Matches.js +13 -0
- package/dist/esm/Matches.js.map +1 -0
- package/dist/esm/RouterProvider.d.ts +26 -0
- package/dist/esm/defer.d.ts +20 -0
- package/dist/esm/defer.js +25 -0
- package/dist/esm/defer.js.map +1 -0
- package/dist/esm/fileRoute.d.ts +23 -0
- package/dist/esm/history.d.ts +8 -0
- package/dist/esm/index.d.ts +41 -0
- package/dist/esm/index.js +80 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/link.d.ts +200 -0
- package/dist/esm/link.js +5 -0
- package/dist/esm/link.js.map +1 -0
- package/dist/esm/location.d.ts +12 -0
- package/dist/esm/manifest.d.ts +24 -0
- package/dist/esm/not-found.d.ts +20 -0
- package/dist/esm/not-found.js +13 -0
- package/dist/esm/not-found.js.map +1 -0
- package/dist/esm/path.d.ts +56 -0
- package/dist/esm/path.js +412 -0
- package/dist/esm/path.js.map +1 -0
- package/dist/esm/qss.d.ts +22 -0
- package/dist/esm/qss.js +38 -0
- package/dist/esm/qss.js.map +1 -0
- package/dist/esm/redirect.d.ts +38 -0
- package/dist/esm/redirect.js +34 -0
- package/dist/esm/redirect.js.map +1 -0
- package/dist/esm/root.d.ts +2 -0
- package/dist/esm/root.js +5 -0
- package/dist/esm/root.js.map +1 -0
- package/dist/esm/route.d.ts +422 -0
- package/dist/esm/route.js +119 -0
- package/dist/esm/route.js.map +1 -0
- package/dist/esm/routeInfo.d.ts +54 -0
- package/dist/esm/router.d.ts +630 -0
- package/dist/esm/router.js +1800 -0
- package/dist/esm/router.js.map +1 -0
- package/dist/esm/scroll-restoration.d.ts +38 -0
- package/dist/esm/scroll-restoration.js +196 -0
- package/dist/esm/scroll-restoration.js.map +1 -0
- package/dist/esm/searchMiddleware.d.ts +5 -0
- package/dist/esm/searchMiddleware.js +42 -0
- package/dist/esm/searchMiddleware.js.map +1 -0
- package/dist/esm/searchParams.d.ts +7 -0
- package/dist/esm/searchParams.js +61 -0
- package/dist/esm/searchParams.js.map +1 -0
- package/dist/esm/serializer.d.ts +22 -0
- package/dist/esm/structuralSharing.d.ts +4 -0
- package/dist/esm/typePrimitives.d.ts +65 -0
- package/dist/esm/useLoaderData.d.ts +5 -0
- package/dist/esm/useLoaderDeps.d.ts +5 -0
- package/dist/esm/useNavigate.d.ts +3 -0
- package/dist/esm/useParams.d.ts +5 -0
- package/dist/esm/useRouteContext.d.ts +9 -0
- package/dist/esm/useSearch.d.ts +5 -0
- package/dist/esm/utils.d.ts +105 -0
- package/dist/esm/utils.js +160 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/validators.d.ts +51 -0
- package/package.json +36 -32
- package/src/Matches.ts +239 -0
- package/src/RouterProvider.ts +50 -0
- package/src/defer.ts +52 -0
- package/src/fileRoute.ts +140 -0
- package/src/history.ts +9 -0
- package/src/index.ts +421 -19
- package/src/link.ts +580 -286
- package/src/location.ts +13 -0
- package/src/manifest.ts +32 -0
- package/src/not-found.ts +29 -0
- package/src/path.ts +425 -49
- package/src/qss.ts +70 -41
- package/src/redirect.ts +100 -0
- package/src/root.ts +2 -0
- package/src/route.ts +1682 -218
- package/src/routeInfo.ts +224 -217
- package/src/router.ts +3100 -1073
- package/src/scroll-restoration.ts +340 -0
- package/src/searchMiddleware.ts +54 -0
- package/src/searchParams.ts +43 -20
- package/src/serializer.ts +32 -0
- package/src/structuralSharing.ts +7 -0
- package/src/typePrimitives.ts +181 -0
- package/src/useLoaderData.ts +20 -0
- package/src/useLoaderDeps.ts +13 -0
- package/src/useNavigate.ts +13 -0
- package/src/useParams.ts +20 -0
- package/src/useRouteContext.ts +39 -0
- package/src/useSearch.ts +20 -0
- package/src/utils.ts +369 -75
- package/src/validators.ts +121 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -33
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
- package/build/cjs/node_modules/history/index.js +0 -815
- package/build/cjs/node_modules/history/index.js.map +0 -1
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -30
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +0 -1
- package/build/cjs/packages/router-core/src/index.js +0 -58
- package/build/cjs/packages/router-core/src/index.js.map +0 -1
- package/build/cjs/packages/router-core/src/path.js +0 -222
- package/build/cjs/packages/router-core/src/path.js.map +0 -1
- package/build/cjs/packages/router-core/src/qss.js +0 -71
- package/build/cjs/packages/router-core/src/qss.js.map +0 -1
- package/build/cjs/packages/router-core/src/route.js +0 -150
- package/build/cjs/packages/router-core/src/route.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeConfig.js +0 -69
- package/build/cjs/packages/router-core/src/routeConfig.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeMatch.js +0 -266
- package/build/cjs/packages/router-core/src/routeMatch.js.map +0 -1
- package/build/cjs/packages/router-core/src/router.js +0 -822
- package/build/cjs/packages/router-core/src/router.js.map +0 -1
- package/build/cjs/packages/router-core/src/searchParams.js +0 -70
- package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
- package/build/cjs/packages/router-core/src/utils.js +0 -125
- package/build/cjs/packages/router-core/src/utils.js.map +0 -1
- package/build/esm/index.js +0 -2481
- package/build/esm/index.js.map +0 -1
- package/build/stats-html.html +0 -4034
- package/build/stats-react.json +0 -493
- package/build/types/index.d.ts +0 -618
- package/build/umd/index.development.js +0 -2514
- package/build/umd/index.development.js.map +0 -1
- package/build/umd/index.production.js +0 -12
- package/build/umd/index.production.js.map +0 -1
- package/src/frameworks.ts +0 -12
- package/src/routeConfig.ts +0 -495
- package/src/routeMatch.ts +0 -374
package/src/route.ts
CHANGED
|
@@ -1,230 +1,1694 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from './link'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from './
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import invariant from 'tiny-invariant'
|
|
2
|
+
import { joinPaths, trimPathLeft } from './path'
|
|
3
|
+
import { notFound } from './not-found'
|
|
4
|
+
import { rootRouteId } from './root'
|
|
5
|
+
import type { LazyRoute } from './fileRoute'
|
|
6
|
+
import type { NotFoundError } from './not-found'
|
|
7
|
+
import type { NavigateOptions, ParsePathParams } from './link'
|
|
8
|
+
import type { ParsedLocation } from './location'
|
|
9
|
+
import type {
|
|
10
|
+
AnyRouteMatch,
|
|
11
|
+
MakeRouteMatchFromRoute,
|
|
12
|
+
MakeRouteMatchUnion,
|
|
13
|
+
RouteMatch,
|
|
14
|
+
} from './Matches'
|
|
15
|
+
import type { RootRouteId } from './root'
|
|
16
|
+
import type { ParseRoute, RouteById, RoutePaths } from './routeInfo'
|
|
17
|
+
import type { AnyRouter, RegisteredRouter } from './router'
|
|
18
|
+
import type { BuildLocationFn, NavigateFn } from './RouterProvider'
|
|
19
|
+
import type {
|
|
20
|
+
Assign,
|
|
21
|
+
Constrain,
|
|
22
|
+
Expand,
|
|
23
|
+
IntersectAssign,
|
|
24
|
+
LooseAsyncReturnType,
|
|
25
|
+
LooseReturnType,
|
|
26
|
+
NoInfer,
|
|
27
|
+
} from './utils'
|
|
28
|
+
import type {
|
|
29
|
+
AnySchema,
|
|
30
|
+
AnyStandardSchemaValidator,
|
|
31
|
+
AnyValidator,
|
|
32
|
+
AnyValidatorAdapter,
|
|
33
|
+
AnyValidatorObj,
|
|
34
|
+
DefaultValidator,
|
|
35
|
+
ResolveSearchValidatorInput,
|
|
36
|
+
ResolveValidatorOutput,
|
|
37
|
+
StandardSchemaValidator,
|
|
38
|
+
ValidatorAdapter,
|
|
39
|
+
ValidatorFn,
|
|
40
|
+
ValidatorObj,
|
|
41
|
+
} from './validators'
|
|
42
|
+
|
|
43
|
+
export type AnyPathParams = {}
|
|
44
|
+
|
|
45
|
+
export type SearchSchemaInput = {
|
|
46
|
+
__TSearchSchemaInput__: 'TSearchSchemaInput'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type AnyContext = {}
|
|
50
|
+
|
|
51
|
+
export interface RouteContext {}
|
|
52
|
+
|
|
53
|
+
export type PreloadableObj = { preload?: () => Promise<void> }
|
|
54
|
+
|
|
55
|
+
export type RoutePathOptions<TCustomId, TPath> =
|
|
56
|
+
| {
|
|
57
|
+
path: TPath
|
|
58
|
+
}
|
|
59
|
+
| {
|
|
60
|
+
id: TCustomId
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface StaticDataRouteOption {}
|
|
64
|
+
|
|
65
|
+
export type RoutePathOptionsIntersection<TCustomId, TPath> = {
|
|
66
|
+
path: TPath
|
|
67
|
+
id: TCustomId
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult
|
|
71
|
+
|
|
72
|
+
export type SearchMiddlewareContext<TSearchSchema> = {
|
|
73
|
+
search: TSearchSchema
|
|
74
|
+
next: (newSearch: TSearchSchema) => TSearchSchema
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type SearchMiddleware<TSearchSchema> = (
|
|
78
|
+
ctx: SearchMiddlewareContext<TSearchSchema>,
|
|
79
|
+
) => TSearchSchema
|
|
80
|
+
|
|
81
|
+
export type ResolveId<
|
|
82
|
+
TParentRoute,
|
|
83
|
+
TCustomId extends string,
|
|
84
|
+
TPath extends string,
|
|
85
|
+
> = TParentRoute extends { id: infer TParentId extends string }
|
|
86
|
+
? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>
|
|
87
|
+
: RootRouteId
|
|
88
|
+
|
|
89
|
+
export type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
90
|
+
types: {
|
|
91
|
+
fullSearchSchema: infer TFullSearchSchema
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
? TFullSearchSchema
|
|
95
|
+
: {}
|
|
96
|
+
|
|
97
|
+
export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
|
|
98
|
+
types: {
|
|
99
|
+
fullSearchSchemaInput: infer TFullSearchSchemaInput
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
? TFullSearchSchemaInput
|
|
103
|
+
: {}
|
|
104
|
+
|
|
105
|
+
export type InferAllParams<TRoute> = TRoute extends {
|
|
106
|
+
types: {
|
|
107
|
+
allParams: infer TAllParams
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
? TAllParams
|
|
111
|
+
: {}
|
|
112
|
+
|
|
113
|
+
export type InferAllContext<TRoute> = unknown extends TRoute
|
|
114
|
+
? TRoute
|
|
115
|
+
: TRoute extends {
|
|
116
|
+
types: {
|
|
117
|
+
allContext: infer TAllContext
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
? TAllContext
|
|
121
|
+
: {}
|
|
122
|
+
|
|
123
|
+
export type ResolveSearchSchemaFnInput<TSearchValidator> =
|
|
124
|
+
TSearchValidator extends (input: infer TSearchSchemaInput) => any
|
|
125
|
+
? TSearchSchemaInput extends SearchSchemaInput
|
|
126
|
+
? Omit<TSearchSchemaInput, keyof SearchSchemaInput>
|
|
127
|
+
: ResolveSearchSchemaFn<TSearchValidator>
|
|
128
|
+
: AnySchema
|
|
129
|
+
|
|
130
|
+
export type ResolveSearchSchemaInput<TSearchValidator> =
|
|
131
|
+
TSearchValidator extends AnyStandardSchemaValidator
|
|
132
|
+
? NonNullable<TSearchValidator['~standard']['types']>['input']
|
|
133
|
+
: TSearchValidator extends AnyValidatorAdapter
|
|
134
|
+
? TSearchValidator['types']['input']
|
|
135
|
+
: TSearchValidator extends AnyValidatorObj
|
|
136
|
+
? ResolveSearchSchemaFnInput<TSearchValidator['parse']>
|
|
137
|
+
: ResolveSearchSchemaFnInput<TSearchValidator>
|
|
138
|
+
|
|
139
|
+
export type ResolveSearchSchemaFn<TSearchValidator> = TSearchValidator extends (
|
|
140
|
+
...args: any
|
|
141
|
+
) => infer TSearchSchema
|
|
142
|
+
? TSearchSchema
|
|
143
|
+
: AnySchema
|
|
144
|
+
|
|
145
|
+
export type ResolveSearchSchema<TSearchValidator> =
|
|
146
|
+
unknown extends TSearchValidator
|
|
147
|
+
? TSearchValidator
|
|
148
|
+
: TSearchValidator extends AnyStandardSchemaValidator
|
|
149
|
+
? NonNullable<TSearchValidator['~standard']['types']>['output']
|
|
150
|
+
: TSearchValidator extends AnyValidatorAdapter
|
|
151
|
+
? TSearchValidator['types']['output']
|
|
152
|
+
: TSearchValidator extends AnyValidatorObj
|
|
153
|
+
? ResolveSearchSchemaFn<TSearchValidator['parse']>
|
|
154
|
+
: ResolveSearchSchemaFn<TSearchValidator>
|
|
155
|
+
|
|
156
|
+
export type ParseSplatParams<TPath extends string> = TPath &
|
|
157
|
+
`${string}$` extends never
|
|
158
|
+
? TPath & `${string}$/${string}` extends never
|
|
159
|
+
? never
|
|
160
|
+
: '_splat'
|
|
161
|
+
: '_splat'
|
|
162
|
+
|
|
163
|
+
export interface SplatParams {
|
|
164
|
+
_splat?: string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type ResolveParams<TPath extends string> =
|
|
168
|
+
ParseSplatParams<TPath> extends never
|
|
169
|
+
? Record<ParsePathParams<TPath>, string>
|
|
170
|
+
: Record<ParsePathParams<TPath>, string> & SplatParams
|
|
171
|
+
|
|
172
|
+
export type ParseParamsFn<in out TPath extends string, in out TParams> = (
|
|
173
|
+
rawParams: ResolveParams<TPath>,
|
|
174
|
+
) => TParams extends Record<ParsePathParams<TPath>, any>
|
|
175
|
+
? TParams
|
|
176
|
+
: Record<ParsePathParams<TPath>, any>
|
|
177
|
+
|
|
178
|
+
export type StringifyParamsFn<in out TPath extends string, in out TParams> = (
|
|
179
|
+
params: TParams,
|
|
180
|
+
) => ResolveParams<TPath>
|
|
181
|
+
|
|
182
|
+
export type ParamsOptions<in out TPath extends string, in out TParams> = {
|
|
183
|
+
params?: {
|
|
184
|
+
parse?: ParseParamsFn<TPath, TParams>
|
|
185
|
+
stringify?: StringifyParamsFn<TPath, TParams>
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
@deprecated Use params.parse instead
|
|
190
|
+
*/
|
|
191
|
+
parseParams?: ParseParamsFn<TPath, TParams>
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
@deprecated Use params.stringify instead
|
|
195
|
+
*/
|
|
196
|
+
stringifyParams?: StringifyParamsFn<TPath, TParams>
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface RequiredStaticDataRouteOption {
|
|
200
|
+
staticData: StaticDataRouteOption
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface OptionalStaticDataRouteOption {
|
|
204
|
+
staticData?: StaticDataRouteOption
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export type UpdatableStaticRouteOption = {} extends StaticDataRouteOption
|
|
208
|
+
? OptionalStaticDataRouteOption
|
|
209
|
+
: RequiredStaticDataRouteOption
|
|
210
|
+
|
|
211
|
+
export type MetaDescriptor =
|
|
212
|
+
| { charSet: 'utf-8' }
|
|
213
|
+
| { title: string }
|
|
214
|
+
| { name: string; content: string }
|
|
215
|
+
| { property: string; content: string }
|
|
216
|
+
| { httpEquiv: string; content: string }
|
|
217
|
+
| { 'script:ld+json': LdJsonObject }
|
|
218
|
+
| { tagName: 'meta' | 'link'; [name: string]: string }
|
|
219
|
+
| Record<string, unknown>
|
|
220
|
+
|
|
221
|
+
type LdJsonObject = { [Key in string]: LdJsonValue } & {
|
|
222
|
+
[Key in string]?: LdJsonValue | undefined
|
|
223
|
+
}
|
|
224
|
+
type LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>
|
|
225
|
+
type LdJsonPrimitive = string | number | boolean | null
|
|
226
|
+
type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray
|
|
227
|
+
|
|
228
|
+
export type RouteLinkEntry = {}
|
|
229
|
+
|
|
230
|
+
export type SearchValidator<TInput, TOutput> =
|
|
231
|
+
| ValidatorObj<TInput, TOutput>
|
|
232
|
+
| ValidatorFn<TInput, TOutput>
|
|
233
|
+
| ValidatorAdapter<TInput, TOutput>
|
|
234
|
+
| StandardSchemaValidator<TInput, TOutput>
|
|
235
|
+
| undefined
|
|
236
|
+
|
|
237
|
+
export type AnySearchValidator = SearchValidator<any, any>
|
|
238
|
+
|
|
239
|
+
export type DefaultSearchValidator = SearchValidator<
|
|
240
|
+
Record<string, unknown>,
|
|
241
|
+
AnySchema
|
|
242
|
+
>
|
|
243
|
+
|
|
244
|
+
export type RoutePrefix<
|
|
245
|
+
TPrefix extends string,
|
|
246
|
+
TPath extends string,
|
|
247
|
+
> = string extends TPath
|
|
248
|
+
? RootRouteId
|
|
249
|
+
: TPath extends string
|
|
250
|
+
? TPrefix extends RootRouteId
|
|
251
|
+
? TPath extends '/'
|
|
252
|
+
? '/'
|
|
253
|
+
: `/${TrimPath<TPath>}`
|
|
254
|
+
: `${TPrefix}/${TPath}` extends '/'
|
|
255
|
+
? '/'
|
|
256
|
+
: `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`
|
|
257
|
+
: never
|
|
258
|
+
|
|
259
|
+
export type TrimPath<T extends string> = '' extends T
|
|
260
|
+
? ''
|
|
261
|
+
: TrimPathRight<TrimPathLeft<T>>
|
|
262
|
+
|
|
263
|
+
export type TrimPathLeft<T extends string> =
|
|
264
|
+
T extends `${RootRouteId}/${infer U}`
|
|
265
|
+
? TrimPathLeft<U>
|
|
266
|
+
: T extends `/${infer U}`
|
|
267
|
+
? TrimPathLeft<U>
|
|
268
|
+
: T
|
|
269
|
+
|
|
270
|
+
export type TrimPathRight<T extends string> = T extends '/'
|
|
271
|
+
? '/'
|
|
272
|
+
: T extends `${infer U}/`
|
|
273
|
+
? TrimPathRight<U>
|
|
274
|
+
: T
|
|
275
|
+
|
|
276
|
+
export type ContextReturnType<TContextFn> = unknown extends TContextFn
|
|
277
|
+
? TContextFn
|
|
278
|
+
: LooseReturnType<TContextFn> extends never
|
|
279
|
+
? AnyContext
|
|
280
|
+
: LooseReturnType<TContextFn>
|
|
281
|
+
|
|
282
|
+
export type ContextAsyncReturnType<TContextFn> = unknown extends TContextFn
|
|
283
|
+
? TContextFn
|
|
284
|
+
: LooseAsyncReturnType<TContextFn> extends never
|
|
285
|
+
? AnyContext
|
|
286
|
+
: LooseAsyncReturnType<TContextFn>
|
|
287
|
+
|
|
288
|
+
export type ResolveRouteContext<TRouteContextFn, TBeforeLoadFn> = Assign<
|
|
289
|
+
ContextReturnType<TRouteContextFn>,
|
|
290
|
+
ContextAsyncReturnType<TBeforeLoadFn>
|
|
291
|
+
>
|
|
292
|
+
|
|
293
|
+
export type ResolveLoaderData<TLoaderFn> = unknown extends TLoaderFn
|
|
294
|
+
? TLoaderFn
|
|
295
|
+
: LooseAsyncReturnType<TLoaderFn> extends never
|
|
296
|
+
? undefined
|
|
297
|
+
: LooseAsyncReturnType<TLoaderFn>
|
|
298
|
+
|
|
299
|
+
export type ResolveFullSearchSchema<
|
|
300
|
+
TParentRoute extends AnyRoute,
|
|
301
|
+
TSearchValidator,
|
|
302
|
+
> = unknown extends TParentRoute
|
|
303
|
+
? ResolveValidatorOutput<TSearchValidator>
|
|
304
|
+
: IntersectAssign<
|
|
305
|
+
InferFullSearchSchema<TParentRoute>,
|
|
306
|
+
ResolveValidatorOutput<TSearchValidator>
|
|
307
|
+
>
|
|
308
|
+
|
|
309
|
+
export type ResolveFullSearchSchemaInput<
|
|
310
|
+
TParentRoute extends AnyRoute,
|
|
311
|
+
TSearchValidator,
|
|
312
|
+
> = IntersectAssign<
|
|
313
|
+
InferFullSearchSchemaInput<TParentRoute>,
|
|
314
|
+
ResolveSearchValidatorInput<TSearchValidator>
|
|
315
|
+
>
|
|
316
|
+
|
|
317
|
+
export type ResolveAllParamsFromParent<
|
|
318
|
+
TParentRoute extends AnyRoute,
|
|
319
|
+
TParams,
|
|
320
|
+
> = Assign<InferAllParams<TParentRoute>, TParams>
|
|
321
|
+
|
|
322
|
+
export type RouteContextParameter<
|
|
323
|
+
TParentRoute extends AnyRoute,
|
|
324
|
+
TRouterContext,
|
|
325
|
+
> = unknown extends TParentRoute
|
|
326
|
+
? TRouterContext
|
|
327
|
+
: Assign<TRouterContext, InferAllContext<TParentRoute>>
|
|
328
|
+
|
|
329
|
+
export type BeforeLoadContextParameter<
|
|
330
|
+
TParentRoute extends AnyRoute,
|
|
331
|
+
TRouterContext,
|
|
332
|
+
TRouteContextFn,
|
|
333
|
+
> = Assign<
|
|
334
|
+
RouteContextParameter<TParentRoute, TRouterContext>,
|
|
335
|
+
ContextReturnType<TRouteContextFn>
|
|
336
|
+
>
|
|
337
|
+
|
|
338
|
+
export type ResolveAllContext<
|
|
339
|
+
TParentRoute extends AnyRoute,
|
|
340
|
+
TRouterContext,
|
|
341
|
+
TRouteContextFn,
|
|
342
|
+
TBeforeLoadFn,
|
|
343
|
+
> = Assign<
|
|
344
|
+
BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>,
|
|
345
|
+
ContextAsyncReturnType<TBeforeLoadFn>
|
|
346
|
+
>
|
|
347
|
+
export interface FullSearchSchemaOption<
|
|
348
|
+
in out TParentRoute extends AnyRoute,
|
|
349
|
+
in out TSearchValidator,
|
|
350
|
+
> {
|
|
351
|
+
search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface RemountDepsOptions<
|
|
355
|
+
in out TRouteId,
|
|
356
|
+
in out TFullSearchSchema,
|
|
357
|
+
in out TAllParams,
|
|
358
|
+
in out TLoaderDeps,
|
|
359
|
+
> {
|
|
360
|
+
routeId: TRouteId
|
|
361
|
+
search: TFullSearchSchema
|
|
362
|
+
params: TAllParams
|
|
363
|
+
loaderDeps: TLoaderDeps
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export type MakeRemountDepsOptionsUnion<
|
|
367
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
368
|
+
> =
|
|
369
|
+
ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute
|
|
370
|
+
? TRoute extends any
|
|
371
|
+
? RemountDepsOptions<
|
|
372
|
+
TRoute['id'],
|
|
373
|
+
TRoute['types']['fullSearchSchema'],
|
|
374
|
+
TRoute['types']['allParams'],
|
|
375
|
+
TRoute['types']['loaderDeps']
|
|
376
|
+
>
|
|
377
|
+
: never
|
|
378
|
+
: never
|
|
379
|
+
|
|
380
|
+
export interface RouteTypes<
|
|
381
|
+
in out TParentRoute extends AnyRoute,
|
|
382
|
+
in out TPath extends string,
|
|
383
|
+
in out TFullPath extends string,
|
|
384
|
+
in out TCustomId extends string,
|
|
385
|
+
in out TId extends string,
|
|
386
|
+
in out TSearchValidator,
|
|
387
|
+
in out TParams,
|
|
388
|
+
in out TRouterContext,
|
|
389
|
+
in out TRouteContextFn,
|
|
390
|
+
in out TBeforeLoadFn,
|
|
391
|
+
in out TLoaderDeps,
|
|
392
|
+
in out TLoaderFn,
|
|
393
|
+
in out TChildren,
|
|
394
|
+
in out TFileRouteTypes,
|
|
395
|
+
> {
|
|
396
|
+
parentRoute: TParentRoute
|
|
397
|
+
path: TPath
|
|
398
|
+
to: TrimPathRight<TFullPath>
|
|
399
|
+
fullPath: TFullPath
|
|
400
|
+
customId: TCustomId
|
|
401
|
+
id: TId
|
|
402
|
+
searchSchema: ResolveValidatorOutput<TSearchValidator>
|
|
403
|
+
searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>
|
|
404
|
+
searchValidator: TSearchValidator
|
|
405
|
+
fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>
|
|
406
|
+
fullSearchSchemaInput: ResolveFullSearchSchemaInput<
|
|
407
|
+
TParentRoute,
|
|
408
|
+
TSearchValidator
|
|
409
|
+
>
|
|
410
|
+
params: TParams
|
|
411
|
+
allParams: ResolveAllParamsFromParent<TParentRoute, TParams>
|
|
412
|
+
routerContext: TRouterContext
|
|
413
|
+
routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>
|
|
414
|
+
routeContextFn: TRouteContextFn
|
|
415
|
+
beforeLoadFn: TBeforeLoadFn
|
|
416
|
+
allContext: ResolveAllContext<
|
|
417
|
+
TParentRoute,
|
|
418
|
+
TRouterContext,
|
|
419
|
+
TRouteContextFn,
|
|
420
|
+
TBeforeLoadFn
|
|
421
|
+
>
|
|
422
|
+
children: TChildren
|
|
423
|
+
loaderData: ResolveLoaderData<TLoaderFn>
|
|
424
|
+
loaderDeps: TLoaderDeps
|
|
425
|
+
fileRouteTypes: TFileRouteTypes
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export type ResolveFullPath<
|
|
429
|
+
TParentRoute extends AnyRoute,
|
|
430
|
+
TPath extends string,
|
|
431
|
+
TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,
|
|
432
|
+
> = TPrefixed extends RootRouteId ? '/' : TPrefixed
|
|
433
|
+
|
|
434
|
+
export interface RouteExtensions<in out TId, in out TFullPath> {
|
|
435
|
+
id: TId
|
|
436
|
+
fullPath: TFullPath
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export type RouteLazyFn<TRoute extends AnyRoute> = (
|
|
440
|
+
lazyFn: () => Promise<LazyRoute<TRoute>>,
|
|
441
|
+
) => TRoute
|
|
442
|
+
|
|
443
|
+
export type RouteAddChildrenFn<
|
|
444
|
+
in out TParentRoute extends AnyRoute,
|
|
445
|
+
in out TPath extends string,
|
|
446
|
+
in out TFullPath extends string,
|
|
447
|
+
in out TCustomId extends string,
|
|
448
|
+
in out TId extends string,
|
|
449
|
+
in out TSearchValidator,
|
|
450
|
+
in out TParams,
|
|
451
|
+
in out TRouterContext,
|
|
452
|
+
in out TRouteContextFn,
|
|
453
|
+
in out TBeforeLoadFn,
|
|
454
|
+
in out TLoaderDeps extends Record<string, any>,
|
|
455
|
+
in out TLoaderFn,
|
|
456
|
+
in out TFileRouteTypes,
|
|
457
|
+
> = <const TNewChildren>(
|
|
458
|
+
children: Constrain<
|
|
459
|
+
TNewChildren,
|
|
460
|
+
ReadonlyArray<AnyRoute> | Record<string, AnyRoute>
|
|
461
|
+
>,
|
|
462
|
+
) => Route<
|
|
463
|
+
TParentRoute,
|
|
464
|
+
TPath,
|
|
465
|
+
TFullPath,
|
|
466
|
+
TCustomId,
|
|
467
|
+
TId,
|
|
468
|
+
TSearchValidator,
|
|
469
|
+
TParams,
|
|
470
|
+
TRouterContext,
|
|
471
|
+
TRouteContextFn,
|
|
472
|
+
TBeforeLoadFn,
|
|
473
|
+
TLoaderDeps,
|
|
474
|
+
TLoaderFn,
|
|
475
|
+
TNewChildren,
|
|
476
|
+
TFileRouteTypes
|
|
477
|
+
>
|
|
478
|
+
|
|
479
|
+
export type RouteAddFileChildrenFn<
|
|
480
|
+
in out TParentRoute extends AnyRoute,
|
|
481
|
+
in out TPath extends string,
|
|
482
|
+
in out TFullPath extends string,
|
|
483
|
+
in out TCustomId extends string,
|
|
484
|
+
in out TId extends string,
|
|
485
|
+
in out TSearchValidator,
|
|
486
|
+
in out TParams,
|
|
487
|
+
in out TRouterContext,
|
|
488
|
+
in out TRouteContextFn,
|
|
489
|
+
in out TBeforeLoadFn,
|
|
490
|
+
in out TLoaderDeps extends Record<string, any>,
|
|
491
|
+
in out TLoaderFn,
|
|
492
|
+
in out TFileRouteTypes,
|
|
493
|
+
> = <const TNewChildren>(
|
|
494
|
+
children: TNewChildren,
|
|
495
|
+
) => Route<
|
|
496
|
+
TParentRoute,
|
|
497
|
+
TPath,
|
|
498
|
+
TFullPath,
|
|
499
|
+
TCustomId,
|
|
500
|
+
TId,
|
|
501
|
+
TSearchValidator,
|
|
502
|
+
TParams,
|
|
503
|
+
TRouterContext,
|
|
504
|
+
TRouteContextFn,
|
|
505
|
+
TBeforeLoadFn,
|
|
506
|
+
TLoaderDeps,
|
|
507
|
+
TLoaderFn,
|
|
508
|
+
TNewChildren,
|
|
509
|
+
TFileRouteTypes
|
|
510
|
+
>
|
|
511
|
+
|
|
512
|
+
export type RouteAddFileTypesFn<
|
|
513
|
+
TParentRoute extends AnyRoute,
|
|
514
|
+
TPath extends string,
|
|
515
|
+
TFullPath extends string,
|
|
516
|
+
TCustomId extends string,
|
|
517
|
+
TId extends string,
|
|
518
|
+
TSearchValidator,
|
|
519
|
+
TParams,
|
|
520
|
+
TRouterContext,
|
|
521
|
+
TRouteContextFn,
|
|
522
|
+
TBeforeLoadFn,
|
|
523
|
+
TLoaderDeps extends Record<string, any>,
|
|
524
|
+
TLoaderFn,
|
|
525
|
+
TChildren,
|
|
526
|
+
> = <TNewFileRouteTypes>() => Route<
|
|
527
|
+
TParentRoute,
|
|
528
|
+
TPath,
|
|
529
|
+
TFullPath,
|
|
530
|
+
TCustomId,
|
|
531
|
+
TId,
|
|
532
|
+
TSearchValidator,
|
|
533
|
+
TParams,
|
|
534
|
+
TRouterContext,
|
|
535
|
+
TRouteContextFn,
|
|
536
|
+
TBeforeLoadFn,
|
|
537
|
+
TLoaderDeps,
|
|
538
|
+
TLoaderFn,
|
|
539
|
+
TChildren,
|
|
540
|
+
TNewFileRouteTypes
|
|
541
|
+
>
|
|
28
542
|
|
|
29
543
|
export interface Route<
|
|
30
|
-
|
|
31
|
-
|
|
544
|
+
in out TParentRoute extends AnyRoute,
|
|
545
|
+
in out TPath extends string,
|
|
546
|
+
in out TFullPath extends string,
|
|
547
|
+
in out TCustomId extends string,
|
|
548
|
+
in out TId extends string,
|
|
549
|
+
in out TSearchValidator,
|
|
550
|
+
in out TParams,
|
|
551
|
+
in out TRouterContext,
|
|
552
|
+
in out TRouteContextFn,
|
|
553
|
+
in out TBeforeLoadFn,
|
|
554
|
+
in out TLoaderDeps extends Record<string, any>,
|
|
555
|
+
in out TLoaderFn,
|
|
556
|
+
in out TChildren,
|
|
557
|
+
in out TFileRouteTypes,
|
|
558
|
+
> extends RouteExtensions<TId, TFullPath> {
|
|
559
|
+
path: TPath
|
|
560
|
+
parentRoute: TParentRoute
|
|
561
|
+
children?: TChildren
|
|
562
|
+
types: RouteTypes<
|
|
563
|
+
TParentRoute,
|
|
564
|
+
TPath,
|
|
565
|
+
TFullPath,
|
|
566
|
+
TCustomId,
|
|
567
|
+
TId,
|
|
568
|
+
TSearchValidator,
|
|
569
|
+
TParams,
|
|
570
|
+
TRouterContext,
|
|
571
|
+
TRouteContextFn,
|
|
572
|
+
TBeforeLoadFn,
|
|
573
|
+
TLoaderDeps,
|
|
574
|
+
TLoaderFn,
|
|
575
|
+
TChildren,
|
|
576
|
+
TFileRouteTypes
|
|
577
|
+
>
|
|
578
|
+
options: RouteOptions<
|
|
579
|
+
TParentRoute,
|
|
580
|
+
TId,
|
|
581
|
+
TCustomId,
|
|
582
|
+
TFullPath,
|
|
583
|
+
TPath,
|
|
584
|
+
TSearchValidator,
|
|
585
|
+
TParams,
|
|
586
|
+
TLoaderDeps,
|
|
587
|
+
TLoaderFn,
|
|
588
|
+
TRouterContext,
|
|
589
|
+
TRouteContextFn,
|
|
590
|
+
TBeforeLoadFn
|
|
591
|
+
>
|
|
592
|
+
isRoot: TParentRoute extends AnyRoute ? true : false
|
|
593
|
+
_componentsPromise?: Promise<Array<void>>
|
|
594
|
+
lazyFn?: () => Promise<
|
|
595
|
+
LazyRoute<
|
|
596
|
+
Route<
|
|
597
|
+
TParentRoute,
|
|
598
|
+
TPath,
|
|
599
|
+
TFullPath,
|
|
600
|
+
TCustomId,
|
|
601
|
+
TId,
|
|
602
|
+
TSearchValidator,
|
|
603
|
+
TParams,
|
|
604
|
+
TRouterContext,
|
|
605
|
+
TRouteContextFn,
|
|
606
|
+
TBeforeLoadFn,
|
|
607
|
+
TLoaderDeps,
|
|
608
|
+
TLoaderFn,
|
|
609
|
+
TChildren,
|
|
610
|
+
TFileRouteTypes
|
|
611
|
+
>
|
|
612
|
+
>
|
|
613
|
+
>
|
|
614
|
+
_lazyPromise?: Promise<void>
|
|
615
|
+
rank: number
|
|
616
|
+
to: TrimPathRight<TFullPath>
|
|
617
|
+
init: (opts: { originalIndex: number; defaultSsr?: boolean }) => void
|
|
618
|
+
update: (
|
|
619
|
+
options: UpdatableRouteOptions<
|
|
620
|
+
TParentRoute,
|
|
621
|
+
TCustomId,
|
|
622
|
+
TFullPath,
|
|
623
|
+
TParams,
|
|
624
|
+
TSearchValidator,
|
|
625
|
+
TLoaderFn,
|
|
626
|
+
TLoaderDeps,
|
|
627
|
+
TRouterContext,
|
|
628
|
+
TRouteContextFn,
|
|
629
|
+
TBeforeLoadFn
|
|
630
|
+
>,
|
|
631
|
+
) => this
|
|
632
|
+
lazy: RouteLazyFn<
|
|
633
|
+
Route<
|
|
634
|
+
TParentRoute,
|
|
635
|
+
TPath,
|
|
636
|
+
TFullPath,
|
|
637
|
+
TCustomId,
|
|
638
|
+
TId,
|
|
639
|
+
TSearchValidator,
|
|
640
|
+
TParams,
|
|
641
|
+
TRouterContext,
|
|
642
|
+
TRouteContextFn,
|
|
643
|
+
TBeforeLoadFn,
|
|
644
|
+
TLoaderDeps,
|
|
645
|
+
TLoaderFn,
|
|
646
|
+
TChildren,
|
|
647
|
+
TFileRouteTypes
|
|
648
|
+
>
|
|
649
|
+
>
|
|
650
|
+
addChildren: RouteAddChildrenFn<
|
|
651
|
+
TParentRoute,
|
|
652
|
+
TPath,
|
|
653
|
+
TFullPath,
|
|
654
|
+
TCustomId,
|
|
655
|
+
TId,
|
|
656
|
+
TSearchValidator,
|
|
657
|
+
TParams,
|
|
658
|
+
TRouterContext,
|
|
659
|
+
TRouteContextFn,
|
|
660
|
+
TBeforeLoadFn,
|
|
661
|
+
TLoaderDeps,
|
|
662
|
+
TLoaderFn,
|
|
663
|
+
TFileRouteTypes
|
|
664
|
+
>
|
|
665
|
+
_addFileChildren: RouteAddFileChildrenFn<
|
|
666
|
+
TParentRoute,
|
|
667
|
+
TPath,
|
|
668
|
+
TFullPath,
|
|
669
|
+
TCustomId,
|
|
670
|
+
TId,
|
|
671
|
+
TSearchValidator,
|
|
672
|
+
TParams,
|
|
673
|
+
TRouterContext,
|
|
674
|
+
TRouteContextFn,
|
|
675
|
+
TBeforeLoadFn,
|
|
676
|
+
TLoaderDeps,
|
|
677
|
+
TLoaderFn,
|
|
678
|
+
TFileRouteTypes
|
|
679
|
+
>
|
|
680
|
+
_addFileTypes: RouteAddFileTypesFn<
|
|
681
|
+
TParentRoute,
|
|
682
|
+
TPath,
|
|
683
|
+
TFullPath,
|
|
684
|
+
TCustomId,
|
|
685
|
+
TId,
|
|
686
|
+
TSearchValidator,
|
|
687
|
+
TParams,
|
|
688
|
+
TRouterContext,
|
|
689
|
+
TRouteContextFn,
|
|
690
|
+
TBeforeLoadFn,
|
|
691
|
+
TLoaderDeps,
|
|
692
|
+
TLoaderFn,
|
|
693
|
+
TChildren
|
|
694
|
+
>
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export type AnyRoute = Route<
|
|
698
|
+
any,
|
|
699
|
+
any,
|
|
700
|
+
any,
|
|
701
|
+
any,
|
|
702
|
+
any,
|
|
703
|
+
any,
|
|
704
|
+
any,
|
|
705
|
+
any,
|
|
706
|
+
any,
|
|
707
|
+
any,
|
|
708
|
+
any,
|
|
709
|
+
any,
|
|
710
|
+
any,
|
|
711
|
+
any
|
|
712
|
+
>
|
|
713
|
+
|
|
714
|
+
export type AnyRouteWithContext<TContext> = AnyRoute & {
|
|
715
|
+
types: { allContext: TContext }
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export type RouteOptions<
|
|
719
|
+
TParentRoute extends AnyRoute = AnyRoute,
|
|
720
|
+
TId extends string = string,
|
|
721
|
+
TCustomId extends string = string,
|
|
722
|
+
TFullPath extends string = string,
|
|
723
|
+
TPath extends string = string,
|
|
724
|
+
TSearchValidator = undefined,
|
|
725
|
+
TParams = AnyPathParams,
|
|
726
|
+
TLoaderDeps extends Record<string, any> = {},
|
|
727
|
+
TLoaderFn = undefined,
|
|
728
|
+
TRouterContext = {},
|
|
729
|
+
TRouteContextFn = AnyContext,
|
|
730
|
+
TBeforeLoadFn = AnyContext,
|
|
731
|
+
> = BaseRouteOptions<
|
|
732
|
+
TParentRoute,
|
|
733
|
+
TId,
|
|
734
|
+
TCustomId,
|
|
735
|
+
TPath,
|
|
736
|
+
TSearchValidator,
|
|
737
|
+
TParams,
|
|
738
|
+
TLoaderDeps,
|
|
739
|
+
TLoaderFn,
|
|
740
|
+
TRouterContext,
|
|
741
|
+
TRouteContextFn,
|
|
742
|
+
TBeforeLoadFn
|
|
743
|
+
> &
|
|
744
|
+
UpdatableRouteOptions<
|
|
745
|
+
NoInfer<TParentRoute>,
|
|
746
|
+
NoInfer<TCustomId>,
|
|
747
|
+
NoInfer<TFullPath>,
|
|
748
|
+
NoInfer<TParams>,
|
|
749
|
+
NoInfer<TSearchValidator>,
|
|
750
|
+
NoInfer<TLoaderFn>,
|
|
751
|
+
NoInfer<TLoaderDeps>,
|
|
752
|
+
NoInfer<TRouterContext>,
|
|
753
|
+
NoInfer<TRouteContextFn>,
|
|
754
|
+
NoInfer<TBeforeLoadFn>
|
|
755
|
+
>
|
|
756
|
+
|
|
757
|
+
export type RouteContextFn<
|
|
758
|
+
in out TParentRoute extends AnyRoute,
|
|
759
|
+
in out TSearchValidator,
|
|
760
|
+
in out TParams,
|
|
761
|
+
in out TRouterContext,
|
|
762
|
+
> = (
|
|
763
|
+
ctx: RouteContextOptions<
|
|
764
|
+
TParentRoute,
|
|
765
|
+
TSearchValidator,
|
|
766
|
+
TParams,
|
|
767
|
+
TRouterContext
|
|
768
|
+
>,
|
|
769
|
+
) => any
|
|
770
|
+
|
|
771
|
+
export type BeforeLoadFn<
|
|
772
|
+
in out TParentRoute extends AnyRoute,
|
|
773
|
+
in out TSearchValidator,
|
|
774
|
+
in out TParams,
|
|
775
|
+
in out TRouterContext,
|
|
776
|
+
in out TRouteContextFn,
|
|
777
|
+
> = (
|
|
778
|
+
ctx: BeforeLoadContextOptions<
|
|
779
|
+
TParentRoute,
|
|
780
|
+
TSearchValidator,
|
|
781
|
+
TParams,
|
|
782
|
+
TRouterContext,
|
|
783
|
+
TRouteContextFn
|
|
784
|
+
>,
|
|
785
|
+
) => any
|
|
786
|
+
|
|
787
|
+
export type FileBaseRouteOptions<
|
|
788
|
+
TParentRoute extends AnyRoute = AnyRoute,
|
|
789
|
+
TId extends string = string,
|
|
790
|
+
TPath extends string = string,
|
|
791
|
+
TSearchValidator = undefined,
|
|
792
|
+
TParams = {},
|
|
793
|
+
TLoaderDeps extends Record<string, any> = {},
|
|
794
|
+
TLoaderFn = undefined,
|
|
795
|
+
TRouterContext = {},
|
|
796
|
+
TRouteContextFn = AnyContext,
|
|
797
|
+
TBeforeLoadFn = AnyContext,
|
|
798
|
+
TRemountDepsFn = AnyContext,
|
|
799
|
+
> = ParamsOptions<TPath, TParams> & {
|
|
800
|
+
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>
|
|
801
|
+
|
|
802
|
+
shouldReload?:
|
|
803
|
+
| boolean
|
|
804
|
+
| ((
|
|
805
|
+
match: LoaderFnContext<
|
|
806
|
+
TParentRoute,
|
|
807
|
+
TId,
|
|
808
|
+
TParams,
|
|
809
|
+
TLoaderDeps,
|
|
810
|
+
TRouterContext,
|
|
811
|
+
TRouteContextFn,
|
|
812
|
+
TBeforeLoadFn
|
|
813
|
+
>,
|
|
814
|
+
) => any)
|
|
815
|
+
|
|
816
|
+
context?: Constrain<
|
|
817
|
+
TRouteContextFn,
|
|
818
|
+
(
|
|
819
|
+
ctx: RouteContextOptions<
|
|
820
|
+
TParentRoute,
|
|
821
|
+
TParams,
|
|
822
|
+
TRouterContext,
|
|
823
|
+
TLoaderDeps
|
|
824
|
+
>,
|
|
825
|
+
) => any
|
|
826
|
+
>
|
|
827
|
+
|
|
828
|
+
// This async function is called before a route is loaded.
|
|
829
|
+
// If an error is thrown here, the route's loader will not be called.
|
|
830
|
+
// If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.
|
|
831
|
+
// If thrown during a preload event, the error will be logged to the console.
|
|
832
|
+
beforeLoad?: Constrain<
|
|
833
|
+
TBeforeLoadFn,
|
|
834
|
+
(
|
|
835
|
+
ctx: BeforeLoadContextOptions<
|
|
836
|
+
TParentRoute,
|
|
837
|
+
TSearchValidator,
|
|
838
|
+
TParams,
|
|
839
|
+
TRouterContext,
|
|
840
|
+
TRouteContextFn
|
|
841
|
+
>,
|
|
842
|
+
) => any
|
|
843
|
+
>
|
|
844
|
+
|
|
845
|
+
loaderDeps?: (
|
|
846
|
+
opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>,
|
|
847
|
+
) => TLoaderDeps
|
|
848
|
+
|
|
849
|
+
remountDeps?: Constrain<
|
|
850
|
+
TRemountDepsFn,
|
|
851
|
+
(
|
|
852
|
+
opt: RemountDepsOptions<
|
|
853
|
+
TId,
|
|
854
|
+
FullSearchSchemaOption<TParentRoute, TSearchValidator>,
|
|
855
|
+
Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>,
|
|
856
|
+
TLoaderDeps
|
|
857
|
+
>,
|
|
858
|
+
) => any
|
|
859
|
+
>
|
|
860
|
+
|
|
861
|
+
loader?: Constrain<
|
|
862
|
+
TLoaderFn,
|
|
863
|
+
(
|
|
864
|
+
ctx: LoaderFnContext<
|
|
865
|
+
TParentRoute,
|
|
866
|
+
TId,
|
|
867
|
+
TParams,
|
|
868
|
+
TLoaderDeps,
|
|
869
|
+
TRouterContext,
|
|
870
|
+
TRouteContextFn,
|
|
871
|
+
TBeforeLoadFn
|
|
872
|
+
>,
|
|
873
|
+
) => any
|
|
874
|
+
>
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export type BaseRouteOptions<
|
|
878
|
+
TParentRoute extends AnyRoute = AnyRoute,
|
|
879
|
+
TId extends string = string,
|
|
880
|
+
TCustomId extends string = string,
|
|
881
|
+
TPath extends string = string,
|
|
882
|
+
TSearchValidator = undefined,
|
|
883
|
+
TParams = {},
|
|
884
|
+
TLoaderDeps extends Record<string, any> = {},
|
|
885
|
+
TLoaderFn = undefined,
|
|
886
|
+
TRouterContext = {},
|
|
887
|
+
TRouteContextFn = AnyContext,
|
|
888
|
+
TBeforeLoadFn = AnyContext,
|
|
889
|
+
> = RoutePathOptions<TCustomId, TPath> &
|
|
890
|
+
FileBaseRouteOptions<
|
|
891
|
+
TParentRoute,
|
|
892
|
+
TId,
|
|
893
|
+
TPath,
|
|
894
|
+
TSearchValidator,
|
|
895
|
+
TParams,
|
|
896
|
+
TLoaderDeps,
|
|
897
|
+
TLoaderFn,
|
|
898
|
+
TRouterContext,
|
|
899
|
+
TRouteContextFn,
|
|
900
|
+
TBeforeLoadFn
|
|
901
|
+
> & {
|
|
902
|
+
getParentRoute: () => TParentRoute
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
export interface ContextOptions<
|
|
906
|
+
in out TParentRoute extends AnyRoute,
|
|
907
|
+
in out TParams,
|
|
32
908
|
> {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
909
|
+
abortController: AbortController
|
|
910
|
+
preload: boolean
|
|
911
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
|
|
912
|
+
location: ParsedLocation
|
|
913
|
+
/**
|
|
914
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
915
|
+
**/
|
|
916
|
+
navigate: NavigateFn
|
|
917
|
+
buildLocation: BuildLocationFn
|
|
918
|
+
cause: 'preload' | 'enter' | 'stay'
|
|
919
|
+
matches: Array<MakeRouteMatchUnion>
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export interface RouteContextOptions<
|
|
923
|
+
in out TParentRoute extends AnyRoute,
|
|
924
|
+
in out TParams,
|
|
925
|
+
in out TRouterContext,
|
|
926
|
+
in out TLoaderDeps,
|
|
927
|
+
> extends ContextOptions<TParentRoute, TParams> {
|
|
928
|
+
deps: TLoaderDeps
|
|
929
|
+
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
export interface BeforeLoadContextOptions<
|
|
933
|
+
in out TParentRoute extends AnyRoute,
|
|
934
|
+
in out TSearchValidator,
|
|
935
|
+
in out TParams,
|
|
936
|
+
in out TRouterContext,
|
|
937
|
+
in out TRouteContextFn,
|
|
938
|
+
> extends ContextOptions<TParentRoute, TParams>,
|
|
939
|
+
FullSearchSchemaOption<TParentRoute, TSearchValidator> {
|
|
940
|
+
context: Expand<
|
|
941
|
+
BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>
|
|
942
|
+
>
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
type AssetFnContextOptions<
|
|
946
|
+
in out TRouteId,
|
|
947
|
+
in out TFullPath,
|
|
948
|
+
in out TParentRoute extends AnyRoute,
|
|
949
|
+
in out TParams,
|
|
950
|
+
in out TSearchValidator,
|
|
951
|
+
in out TLoaderFn,
|
|
952
|
+
in out TRouterContext,
|
|
953
|
+
in out TRouteContextFn,
|
|
954
|
+
in out TBeforeLoadFn,
|
|
955
|
+
in out TLoaderDeps,
|
|
956
|
+
> = {
|
|
957
|
+
matches: Array<
|
|
958
|
+
RouteMatch<
|
|
959
|
+
TRouteId,
|
|
960
|
+
TFullPath,
|
|
961
|
+
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
962
|
+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
963
|
+
ResolveLoaderData<TLoaderFn>,
|
|
964
|
+
ResolveAllContext<
|
|
965
|
+
TParentRoute,
|
|
966
|
+
TRouterContext,
|
|
967
|
+
TRouteContextFn,
|
|
968
|
+
TBeforeLoadFn
|
|
969
|
+
>,
|
|
970
|
+
TLoaderDeps
|
|
971
|
+
>
|
|
972
|
+
>
|
|
973
|
+
match: RouteMatch<
|
|
974
|
+
TRouteId,
|
|
975
|
+
TFullPath,
|
|
976
|
+
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
977
|
+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
978
|
+
ResolveLoaderData<TLoaderFn>,
|
|
979
|
+
ResolveAllContext<
|
|
980
|
+
TParentRoute,
|
|
981
|
+
TRouterContext,
|
|
982
|
+
TRouteContextFn,
|
|
983
|
+
TBeforeLoadFn
|
|
45
984
|
>,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
985
|
+
TLoaderDeps
|
|
986
|
+
>
|
|
987
|
+
params: ResolveAllParamsFromParent<TParentRoute, TParams>
|
|
988
|
+
loaderData: ResolveLoaderData<TLoaderFn>
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export interface DefaultUpdatableRouteOptionsExtensions {
|
|
992
|
+
component?: unknown
|
|
993
|
+
errorComponent?: unknown
|
|
994
|
+
notFoundComponent?: unknown
|
|
995
|
+
pendingComponent?: unknown
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export interface UpdatableRouteOptionsExtensions
|
|
999
|
+
extends DefaultUpdatableRouteOptionsExtensions {}
|
|
1000
|
+
|
|
1001
|
+
export interface UpdatableRouteOptions<
|
|
1002
|
+
in out TParentRoute extends AnyRoute,
|
|
1003
|
+
in out TRouteId,
|
|
1004
|
+
in out TFullPath,
|
|
1005
|
+
in out TParams,
|
|
1006
|
+
in out TSearchValidator,
|
|
1007
|
+
in out TLoaderFn,
|
|
1008
|
+
in out TLoaderDeps,
|
|
1009
|
+
in out TRouterContext,
|
|
1010
|
+
in out TRouteContextFn,
|
|
1011
|
+
in out TBeforeLoadFn,
|
|
1012
|
+
> extends UpdatableStaticRouteOption,
|
|
1013
|
+
UpdatableRouteOptionsExtensions {
|
|
1014
|
+
// If true, this route will be matched as case-sensitive
|
|
1015
|
+
caseSensitive?: boolean
|
|
1016
|
+
// If true, this route will be forcefully wrapped in a suspense boundary
|
|
1017
|
+
wrapInSuspense?: boolean
|
|
1018
|
+
// The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
|
|
1019
|
+
|
|
1020
|
+
pendingMs?: number
|
|
1021
|
+
pendingMinMs?: number
|
|
1022
|
+
staleTime?: number
|
|
1023
|
+
gcTime?: number
|
|
1024
|
+
preload?: boolean
|
|
1025
|
+
preloadStaleTime?: number
|
|
1026
|
+
preloadGcTime?: number
|
|
1027
|
+
search?: {
|
|
1028
|
+
middlewares?: Array<
|
|
1029
|
+
SearchMiddleware<
|
|
1030
|
+
ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>
|
|
81
1031
|
>
|
|
1032
|
+
>
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
@deprecated Use search.middlewares instead
|
|
1036
|
+
*/
|
|
1037
|
+
preSearchFilters?: Array<
|
|
1038
|
+
SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
|
|
1039
|
+
>
|
|
1040
|
+
/**
|
|
1041
|
+
@deprecated Use search.middlewares instead
|
|
1042
|
+
*/
|
|
1043
|
+
postSearchFilters?: Array<
|
|
1044
|
+
SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
|
|
1045
|
+
>
|
|
1046
|
+
onCatch?: (error: Error) => void
|
|
1047
|
+
onError?: (err: any) => void
|
|
1048
|
+
// These functions are called as route matches are loaded, stick around and leave the active
|
|
1049
|
+
// matches
|
|
1050
|
+
onEnter?: (
|
|
1051
|
+
match: RouteMatch<
|
|
1052
|
+
TRouteId,
|
|
1053
|
+
TFullPath,
|
|
1054
|
+
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
1055
|
+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
1056
|
+
ResolveLoaderData<TLoaderFn>,
|
|
1057
|
+
ResolveAllContext<
|
|
1058
|
+
TParentRoute,
|
|
1059
|
+
TRouterContext,
|
|
1060
|
+
TRouteContextFn,
|
|
1061
|
+
TBeforeLoadFn
|
|
1062
|
+
>,
|
|
1063
|
+
TLoaderDeps
|
|
1064
|
+
>,
|
|
1065
|
+
) => void
|
|
1066
|
+
onStay?: (
|
|
1067
|
+
match: RouteMatch<
|
|
1068
|
+
TRouteId,
|
|
1069
|
+
TFullPath,
|
|
1070
|
+
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
1071
|
+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
1072
|
+
ResolveLoaderData<TLoaderFn>,
|
|
1073
|
+
ResolveAllContext<
|
|
1074
|
+
TParentRoute,
|
|
1075
|
+
TRouterContext,
|
|
1076
|
+
TRouteContextFn,
|
|
1077
|
+
TBeforeLoadFn
|
|
1078
|
+
>,
|
|
1079
|
+
TLoaderDeps
|
|
1080
|
+
>,
|
|
1081
|
+
) => void
|
|
1082
|
+
onLeave?: (
|
|
1083
|
+
match: RouteMatch<
|
|
1084
|
+
TRouteId,
|
|
1085
|
+
TFullPath,
|
|
1086
|
+
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
1087
|
+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
1088
|
+
ResolveLoaderData<TLoaderFn>,
|
|
1089
|
+
ResolveAllContext<
|
|
1090
|
+
TParentRoute,
|
|
1091
|
+
TRouterContext,
|
|
1092
|
+
TRouteContextFn,
|
|
1093
|
+
TBeforeLoadFn
|
|
1094
|
+
>,
|
|
1095
|
+
TLoaderDeps
|
|
1096
|
+
>,
|
|
1097
|
+
) => void
|
|
1098
|
+
headers?: (ctx: {
|
|
1099
|
+
loaderData: ResolveLoaderData<TLoaderFn>
|
|
1100
|
+
}) => Record<string, string>
|
|
1101
|
+
head?: (
|
|
1102
|
+
ctx: AssetFnContextOptions<
|
|
1103
|
+
TRouteId,
|
|
1104
|
+
TFullPath,
|
|
1105
|
+
TParentRoute,
|
|
1106
|
+
TParams,
|
|
1107
|
+
TSearchValidator,
|
|
1108
|
+
TLoaderFn,
|
|
1109
|
+
TRouterContext,
|
|
1110
|
+
TRouteContextFn,
|
|
1111
|
+
TBeforeLoadFn,
|
|
1112
|
+
TLoaderDeps
|
|
1113
|
+
>,
|
|
1114
|
+
) => {
|
|
1115
|
+
links?: AnyRouteMatch['links']
|
|
1116
|
+
scripts?: AnyRouteMatch['headScripts']
|
|
1117
|
+
meta?: AnyRouteMatch['meta']
|
|
1118
|
+
}
|
|
1119
|
+
scripts?: (
|
|
1120
|
+
ctx: AssetFnContextOptions<
|
|
1121
|
+
TRouteId,
|
|
1122
|
+
TFullPath,
|
|
1123
|
+
TParentRoute,
|
|
1124
|
+
TParams,
|
|
1125
|
+
TSearchValidator,
|
|
1126
|
+
TLoaderFn,
|
|
1127
|
+
TRouterContext,
|
|
1128
|
+
TRouteContextFn,
|
|
1129
|
+
TBeforeLoadFn,
|
|
1130
|
+
TLoaderDeps
|
|
1131
|
+
>,
|
|
1132
|
+
) => AnyRouteMatch['scripts']
|
|
1133
|
+
ssr?: boolean
|
|
1134
|
+
codeSplitGroupings?: Array<
|
|
1135
|
+
Array<
|
|
1136
|
+
| 'loader'
|
|
1137
|
+
| 'component'
|
|
1138
|
+
| 'pendingComponent'
|
|
1139
|
+
| 'notFoundComponent'
|
|
1140
|
+
| 'errorComponent'
|
|
1141
|
+
>
|
|
1142
|
+
>
|
|
82
1143
|
}
|
|
83
1144
|
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
1145
|
+
export type RouteLoaderFn<
|
|
1146
|
+
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1147
|
+
in out TId extends string = string,
|
|
1148
|
+
in out TParams = {},
|
|
1149
|
+
in out TLoaderDeps = {},
|
|
1150
|
+
in out TRouterContext = {},
|
|
1151
|
+
in out TRouteContextFn = AnyContext,
|
|
1152
|
+
in out TBeforeLoadFn = AnyContext,
|
|
1153
|
+
> = (
|
|
1154
|
+
match: LoaderFnContext<
|
|
1155
|
+
TParentRoute,
|
|
1156
|
+
TId,
|
|
1157
|
+
TParams,
|
|
1158
|
+
TLoaderDeps,
|
|
1159
|
+
TRouterContext,
|
|
1160
|
+
TRouteContextFn,
|
|
1161
|
+
TBeforeLoadFn
|
|
1162
|
+
>,
|
|
1163
|
+
) => any
|
|
1164
|
+
|
|
1165
|
+
export interface LoaderFnContext<
|
|
1166
|
+
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1167
|
+
in out TId extends string = string,
|
|
1168
|
+
in out TParams = {},
|
|
1169
|
+
in out TLoaderDeps = {},
|
|
1170
|
+
in out TRouterContext = {},
|
|
1171
|
+
in out TRouteContextFn = AnyContext,
|
|
1172
|
+
in out TBeforeLoadFn = AnyContext,
|
|
1173
|
+
> {
|
|
1174
|
+
abortController: AbortController
|
|
1175
|
+
preload: boolean
|
|
1176
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
|
|
1177
|
+
deps: TLoaderDeps
|
|
1178
|
+
context: Expand<
|
|
1179
|
+
ResolveAllContext<
|
|
1180
|
+
TParentRoute,
|
|
1181
|
+
TRouterContext,
|
|
1182
|
+
TRouteContextFn,
|
|
1183
|
+
TBeforeLoadFn
|
|
1184
|
+
>
|
|
1185
|
+
>
|
|
1186
|
+
location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps
|
|
1187
|
+
/**
|
|
1188
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
1189
|
+
**/
|
|
1190
|
+
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void
|
|
1191
|
+
// root route does not have a parent match
|
|
1192
|
+
parentMatchPromise: TId extends RootRouteId
|
|
1193
|
+
? never
|
|
1194
|
+
: Promise<MakeRouteMatchFromRoute<TParentRoute>>
|
|
1195
|
+
cause: 'preload' | 'enter' | 'stay'
|
|
1196
|
+
route: AnyRoute
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
export type RootRouteOptions<
|
|
1200
|
+
TSearchValidator = undefined,
|
|
1201
|
+
TRouterContext = {},
|
|
1202
|
+
TRouteContextFn = AnyContext,
|
|
1203
|
+
TBeforeLoadFn = AnyContext,
|
|
1204
|
+
TLoaderDeps extends Record<string, any> = {},
|
|
1205
|
+
TLoaderFn = undefined,
|
|
1206
|
+
> = Omit<
|
|
1207
|
+
RouteOptions<
|
|
1208
|
+
any, // TParentRoute
|
|
1209
|
+
RootRouteId, // TId
|
|
1210
|
+
RootRouteId, // TCustomId
|
|
1211
|
+
'', // TFullPath
|
|
1212
|
+
'', // TPath
|
|
1213
|
+
TSearchValidator,
|
|
1214
|
+
{}, // TParams
|
|
1215
|
+
TLoaderDeps,
|
|
1216
|
+
TLoaderFn,
|
|
1217
|
+
TRouterContext,
|
|
1218
|
+
TRouteContextFn,
|
|
1219
|
+
TBeforeLoadFn
|
|
1220
|
+
>,
|
|
1221
|
+
| 'path'
|
|
1222
|
+
| 'id'
|
|
1223
|
+
| 'getParentRoute'
|
|
1224
|
+
| 'caseSensitive'
|
|
1225
|
+
| 'parseParams'
|
|
1226
|
+
| 'stringifyParams'
|
|
1227
|
+
| 'params'
|
|
1228
|
+
>
|
|
1229
|
+
|
|
1230
|
+
export type RouteConstraints = {
|
|
1231
|
+
TParentRoute: AnyRoute
|
|
1232
|
+
TPath: string
|
|
1233
|
+
TFullPath: string
|
|
1234
|
+
TCustomId: string
|
|
1235
|
+
TId: string
|
|
1236
|
+
TSearchSchema: AnySchema
|
|
1237
|
+
TFullSearchSchema: AnySchema
|
|
1238
|
+
TParams: Record<string, any>
|
|
1239
|
+
TAllParams: Record<string, any>
|
|
1240
|
+
TParentContext: AnyContext
|
|
1241
|
+
TRouteContext: RouteContext
|
|
1242
|
+
TAllContext: AnyContext
|
|
1243
|
+
TRouterContext: AnyContext
|
|
1244
|
+
TChildren: unknown
|
|
1245
|
+
TRouteTree: AnyRoute
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<
|
|
1249
|
+
TRouter['routeTree'],
|
|
1250
|
+
TId
|
|
1251
|
+
>['types']
|
|
1252
|
+
|
|
1253
|
+
export type RouteMask<TRouteTree extends AnyRoute> = {
|
|
1254
|
+
routeTree: TRouteTree
|
|
1255
|
+
from: RoutePaths<TRouteTree>
|
|
1256
|
+
to?: any
|
|
1257
|
+
params?: any
|
|
1258
|
+
search?: any
|
|
1259
|
+
hash?: any
|
|
1260
|
+
state?: any
|
|
1261
|
+
unmaskOnReload?: boolean
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* @deprecated Use `ErrorComponentProps` instead.
|
|
1266
|
+
*/
|
|
1267
|
+
export type ErrorRouteProps = {
|
|
1268
|
+
error: unknown
|
|
1269
|
+
info?: { componentStack: string }
|
|
1270
|
+
reset: () => void
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
export type ErrorComponentProps = {
|
|
1274
|
+
error: Error
|
|
1275
|
+
info?: { componentStack: string }
|
|
1276
|
+
reset: () => void
|
|
1277
|
+
}
|
|
1278
|
+
export type NotFoundRouteProps = {
|
|
1279
|
+
// TODO: Make sure this is `| null | undefined` (this is for global not-founds)
|
|
1280
|
+
data: unknown
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
export class BaseRoute<
|
|
1284
|
+
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1285
|
+
in out TPath extends string = '/',
|
|
1286
|
+
in out TFullPath extends string = ResolveFullPath<TParentRoute, TPath>,
|
|
1287
|
+
in out TCustomId extends string = string,
|
|
1288
|
+
in out TId extends string = ResolveId<TParentRoute, TCustomId, TPath>,
|
|
1289
|
+
in out TSearchValidator = undefined,
|
|
1290
|
+
in out TParams = ResolveParams<TPath>,
|
|
1291
|
+
in out TRouterContext = AnyContext,
|
|
1292
|
+
in out TRouteContextFn = AnyContext,
|
|
1293
|
+
in out TBeforeLoadFn = AnyContext,
|
|
1294
|
+
in out TLoaderDeps extends Record<string, any> = {},
|
|
1295
|
+
in out TLoaderFn = undefined,
|
|
1296
|
+
in out TChildren = unknown,
|
|
1297
|
+
in out TFileRouteTypes = unknown,
|
|
1298
|
+
> implements
|
|
1299
|
+
Route<
|
|
1300
|
+
TParentRoute,
|
|
1301
|
+
TPath,
|
|
1302
|
+
TFullPath,
|
|
1303
|
+
TCustomId,
|
|
1304
|
+
TId,
|
|
1305
|
+
TSearchValidator,
|
|
1306
|
+
TParams,
|
|
1307
|
+
TRouterContext,
|
|
1308
|
+
TRouteContextFn,
|
|
1309
|
+
TBeforeLoadFn,
|
|
1310
|
+
TLoaderDeps,
|
|
1311
|
+
TLoaderFn,
|
|
1312
|
+
TChildren,
|
|
1313
|
+
TFileRouteTypes
|
|
1314
|
+
>
|
|
1315
|
+
{
|
|
1316
|
+
isRoot: TParentRoute extends AnyRoute ? true : false
|
|
1317
|
+
options: RouteOptions<
|
|
1318
|
+
TParentRoute,
|
|
1319
|
+
TId,
|
|
1320
|
+
TCustomId,
|
|
1321
|
+
TFullPath,
|
|
1322
|
+
TPath,
|
|
1323
|
+
TSearchValidator,
|
|
1324
|
+
TParams,
|
|
1325
|
+
TLoaderDeps,
|
|
1326
|
+
TLoaderFn,
|
|
1327
|
+
TRouterContext,
|
|
1328
|
+
TRouteContextFn,
|
|
1329
|
+
TBeforeLoadFn
|
|
1330
|
+
>
|
|
1331
|
+
|
|
1332
|
+
// The following properties are set up in this.init()
|
|
1333
|
+
parentRoute!: TParentRoute
|
|
1334
|
+
private _id!: TId
|
|
1335
|
+
private _path!: TPath
|
|
1336
|
+
private _fullPath!: TFullPath
|
|
1337
|
+
private _to!: TrimPathRight<TFullPath>
|
|
1338
|
+
private _ssr!: boolean
|
|
1339
|
+
|
|
1340
|
+
public get to() {
|
|
1341
|
+
return this._to
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
public get id() {
|
|
1345
|
+
return this._id
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
public get path() {
|
|
1349
|
+
return this._path
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
public get fullPath() {
|
|
1353
|
+
return this._fullPath
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
public get ssr() {
|
|
1357
|
+
return this._ssr
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// Optional
|
|
1361
|
+
children?: TChildren
|
|
1362
|
+
originalIndex?: number
|
|
1363
|
+
rank!: number
|
|
1364
|
+
lazyFn?: () => Promise<
|
|
1365
|
+
LazyRoute<
|
|
1366
|
+
Route<
|
|
1367
|
+
TParentRoute,
|
|
1368
|
+
TPath,
|
|
1369
|
+
TFullPath,
|
|
1370
|
+
TCustomId,
|
|
1371
|
+
TId,
|
|
1372
|
+
TSearchValidator,
|
|
1373
|
+
TParams,
|
|
1374
|
+
TRouterContext,
|
|
1375
|
+
TRouteContextFn,
|
|
1376
|
+
TBeforeLoadFn,
|
|
1377
|
+
TLoaderDeps,
|
|
1378
|
+
TLoaderFn,
|
|
1379
|
+
TChildren,
|
|
1380
|
+
TFileRouteTypes
|
|
1381
|
+
>
|
|
1382
|
+
>
|
|
1383
|
+
>
|
|
1384
|
+
_lazyPromise?: Promise<void>
|
|
1385
|
+
_componentsPromise?: Promise<Array<void>>
|
|
1386
|
+
|
|
1387
|
+
constructor(
|
|
1388
|
+
options?: RouteOptions<
|
|
1389
|
+
TParentRoute,
|
|
1390
|
+
TId,
|
|
1391
|
+
TCustomId,
|
|
1392
|
+
TFullPath,
|
|
1393
|
+
TPath,
|
|
1394
|
+
TSearchValidator,
|
|
1395
|
+
TParams,
|
|
1396
|
+
TLoaderDeps,
|
|
1397
|
+
TLoaderFn,
|
|
1398
|
+
TRouterContext,
|
|
1399
|
+
TRouteContextFn,
|
|
1400
|
+
TBeforeLoadFn
|
|
1401
|
+
>,
|
|
1402
|
+
) {
|
|
1403
|
+
this.options = (options as any) || {}
|
|
1404
|
+
this.isRoot = !options?.getParentRoute as any
|
|
1405
|
+
|
|
1406
|
+
if ((options as any)?.id && (options as any)?.path) {
|
|
1407
|
+
throw new Error(`Route cannot have both an 'id' and a 'path' option.`)
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
types!: RouteTypes<
|
|
1412
|
+
TParentRoute,
|
|
1413
|
+
TPath,
|
|
1414
|
+
TFullPath,
|
|
1415
|
+
TCustomId,
|
|
1416
|
+
TId,
|
|
1417
|
+
TSearchValidator,
|
|
1418
|
+
TParams,
|
|
1419
|
+
TRouterContext,
|
|
1420
|
+
TRouteContextFn,
|
|
1421
|
+
TBeforeLoadFn,
|
|
1422
|
+
TLoaderDeps,
|
|
1423
|
+
TLoaderFn,
|
|
1424
|
+
TChildren,
|
|
1425
|
+
TFileRouteTypes
|
|
1426
|
+
>
|
|
1427
|
+
|
|
1428
|
+
init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {
|
|
1429
|
+
this.originalIndex = opts.originalIndex
|
|
1430
|
+
|
|
1431
|
+
const options = this.options as
|
|
1432
|
+
| (RouteOptions<
|
|
1433
|
+
TParentRoute,
|
|
1434
|
+
TId,
|
|
1435
|
+
TCustomId,
|
|
1436
|
+
TFullPath,
|
|
1437
|
+
TPath,
|
|
1438
|
+
TSearchValidator,
|
|
1439
|
+
TParams,
|
|
1440
|
+
TLoaderDeps,
|
|
1441
|
+
TLoaderFn,
|
|
1442
|
+
TRouterContext,
|
|
1443
|
+
TRouteContextFn,
|
|
1444
|
+
TBeforeLoadFn
|
|
1445
|
+
> &
|
|
1446
|
+
RoutePathOptionsIntersection<TCustomId, TPath>)
|
|
1447
|
+
| undefined
|
|
1448
|
+
|
|
1449
|
+
const isRoot = !options?.path && !options?.id
|
|
1450
|
+
|
|
1451
|
+
this.parentRoute = this.options.getParentRoute?.()
|
|
1452
|
+
|
|
1453
|
+
if (isRoot) {
|
|
1454
|
+
this._path = rootRouteId as TPath
|
|
1455
|
+
} else if (!this.parentRoute) {
|
|
1456
|
+
invariant(
|
|
1457
|
+
false,
|
|
1458
|
+
`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,
|
|
223
1459
|
)
|
|
224
|
-
}
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
let path: undefined | string = isRoot ? rootRouteId : options?.path
|
|
1463
|
+
|
|
1464
|
+
// If the path is anything other than an index path, trim it up
|
|
1465
|
+
if (path && path !== '/') {
|
|
1466
|
+
path = trimPathLeft(path)
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
const customId = options?.id || path
|
|
1470
|
+
|
|
1471
|
+
// Strip the parentId prefix from the first level of children
|
|
1472
|
+
let id = isRoot
|
|
1473
|
+
? rootRouteId
|
|
1474
|
+
: joinPaths([
|
|
1475
|
+
this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,
|
|
1476
|
+
customId,
|
|
1477
|
+
])
|
|
1478
|
+
|
|
1479
|
+
if (path === rootRouteId) {
|
|
1480
|
+
path = '/'
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
if (id !== rootRouteId) {
|
|
1484
|
+
id = joinPaths(['/', id])
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
const fullPath =
|
|
1488
|
+
id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])
|
|
1489
|
+
|
|
1490
|
+
this._path = path as TPath
|
|
1491
|
+
this._id = id as TId
|
|
1492
|
+
this._fullPath = fullPath as TFullPath
|
|
1493
|
+
this._to = fullPath as TrimPathRight<TFullPath>
|
|
1494
|
+
this._ssr = options?.ssr ?? opts.defaultSsr ?? true
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
clone = (other: typeof this) => {
|
|
1498
|
+
this._path = other._path
|
|
1499
|
+
this._id = other._id
|
|
1500
|
+
this._fullPath = other._fullPath
|
|
1501
|
+
this._to = other._to
|
|
1502
|
+
this._ssr = other._ssr
|
|
1503
|
+
this.options.getParentRoute = other.options.getParentRoute
|
|
1504
|
+
this.children = other.children
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
addChildren: RouteAddChildrenFn<
|
|
1508
|
+
TParentRoute,
|
|
1509
|
+
TPath,
|
|
1510
|
+
TFullPath,
|
|
1511
|
+
TCustomId,
|
|
1512
|
+
TId,
|
|
1513
|
+
TSearchValidator,
|
|
1514
|
+
TParams,
|
|
1515
|
+
TRouterContext,
|
|
1516
|
+
TRouteContextFn,
|
|
1517
|
+
TBeforeLoadFn,
|
|
1518
|
+
TLoaderDeps,
|
|
1519
|
+
TLoaderFn,
|
|
1520
|
+
TFileRouteTypes
|
|
1521
|
+
> = (children) => {
|
|
1522
|
+
return this._addFileChildren(children) as any
|
|
225
1523
|
}
|
|
226
1524
|
|
|
227
|
-
|
|
1525
|
+
_addFileChildren: RouteAddFileChildrenFn<
|
|
1526
|
+
TParentRoute,
|
|
1527
|
+
TPath,
|
|
1528
|
+
TFullPath,
|
|
1529
|
+
TCustomId,
|
|
1530
|
+
TId,
|
|
1531
|
+
TSearchValidator,
|
|
1532
|
+
TParams,
|
|
1533
|
+
TRouterContext,
|
|
1534
|
+
TRouteContextFn,
|
|
1535
|
+
TBeforeLoadFn,
|
|
1536
|
+
TLoaderDeps,
|
|
1537
|
+
TLoaderFn,
|
|
1538
|
+
TFileRouteTypes
|
|
1539
|
+
> = (children) => {
|
|
1540
|
+
if (Array.isArray(children)) {
|
|
1541
|
+
this.children = children as TChildren
|
|
1542
|
+
}
|
|
228
1543
|
|
|
229
|
-
|
|
1544
|
+
if (typeof children === 'object' && children !== null) {
|
|
1545
|
+
this.children = Object.values(children) as TChildren
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
return this as any
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
_addFileTypes: RouteAddFileTypesFn<
|
|
1552
|
+
TParentRoute,
|
|
1553
|
+
TPath,
|
|
1554
|
+
TFullPath,
|
|
1555
|
+
TCustomId,
|
|
1556
|
+
TId,
|
|
1557
|
+
TSearchValidator,
|
|
1558
|
+
TParams,
|
|
1559
|
+
TRouterContext,
|
|
1560
|
+
TRouteContextFn,
|
|
1561
|
+
TBeforeLoadFn,
|
|
1562
|
+
TLoaderDeps,
|
|
1563
|
+
TLoaderFn,
|
|
1564
|
+
TChildren
|
|
1565
|
+
> = () => {
|
|
1566
|
+
return this as any
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
updateLoader = <TNewLoaderFn>(options: {
|
|
1570
|
+
loader: Constrain<
|
|
1571
|
+
TNewLoaderFn,
|
|
1572
|
+
RouteLoaderFn<
|
|
1573
|
+
TParentRoute,
|
|
1574
|
+
TCustomId,
|
|
1575
|
+
TParams,
|
|
1576
|
+
TLoaderDeps,
|
|
1577
|
+
TRouterContext,
|
|
1578
|
+
TRouteContextFn,
|
|
1579
|
+
TBeforeLoadFn
|
|
1580
|
+
>
|
|
1581
|
+
>
|
|
1582
|
+
}) => {
|
|
1583
|
+
Object.assign(this.options, options)
|
|
1584
|
+
return this as unknown as BaseRoute<
|
|
1585
|
+
TParentRoute,
|
|
1586
|
+
TPath,
|
|
1587
|
+
TFullPath,
|
|
1588
|
+
TCustomId,
|
|
1589
|
+
TId,
|
|
1590
|
+
TSearchValidator,
|
|
1591
|
+
TParams,
|
|
1592
|
+
TRouterContext,
|
|
1593
|
+
TRouteContextFn,
|
|
1594
|
+
TBeforeLoadFn,
|
|
1595
|
+
TLoaderDeps,
|
|
1596
|
+
TNewLoaderFn,
|
|
1597
|
+
TChildren,
|
|
1598
|
+
TFileRouteTypes
|
|
1599
|
+
>
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
update = (
|
|
1603
|
+
options: UpdatableRouteOptions<
|
|
1604
|
+
TParentRoute,
|
|
1605
|
+
TCustomId,
|
|
1606
|
+
TFullPath,
|
|
1607
|
+
TParams,
|
|
1608
|
+
TSearchValidator,
|
|
1609
|
+
TLoaderFn,
|
|
1610
|
+
TLoaderDeps,
|
|
1611
|
+
TRouterContext,
|
|
1612
|
+
TRouteContextFn,
|
|
1613
|
+
TBeforeLoadFn
|
|
1614
|
+
>,
|
|
1615
|
+
): this => {
|
|
1616
|
+
Object.assign(this.options, options)
|
|
1617
|
+
return this
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
lazy: RouteLazyFn<
|
|
1621
|
+
Route<
|
|
1622
|
+
TParentRoute,
|
|
1623
|
+
TPath,
|
|
1624
|
+
TFullPath,
|
|
1625
|
+
TCustomId,
|
|
1626
|
+
TId,
|
|
1627
|
+
TSearchValidator,
|
|
1628
|
+
TParams,
|
|
1629
|
+
TRouterContext,
|
|
1630
|
+
TRouteContextFn,
|
|
1631
|
+
TBeforeLoadFn,
|
|
1632
|
+
TLoaderDeps,
|
|
1633
|
+
TLoaderFn,
|
|
1634
|
+
TChildren,
|
|
1635
|
+
TFileRouteTypes
|
|
1636
|
+
>
|
|
1637
|
+
> = (lazyFn) => {
|
|
1638
|
+
this.lazyFn = lazyFn
|
|
1639
|
+
return this
|
|
1640
|
+
}
|
|
230
1641
|
}
|
|
1642
|
+
|
|
1643
|
+
export class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
|
|
1644
|
+
id: TId
|
|
1645
|
+
|
|
1646
|
+
constructor({ id }: { id: TId }) {
|
|
1647
|
+
this.id = id as any
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
notFound = (opts?: NotFoundError) => {
|
|
1651
|
+
return notFound({ routeId: this.id as string, ...opts })
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
export class BaseRootRoute<
|
|
1656
|
+
in out TSearchValidator = undefined,
|
|
1657
|
+
in out TRouterContext = {},
|
|
1658
|
+
in out TRouteContextFn = AnyContext,
|
|
1659
|
+
in out TBeforeLoadFn = AnyContext,
|
|
1660
|
+
in out TLoaderDeps extends Record<string, any> = {},
|
|
1661
|
+
in out TLoaderFn = undefined,
|
|
1662
|
+
in out TChildren = unknown,
|
|
1663
|
+
in out TFileRouteTypes = unknown,
|
|
1664
|
+
> extends BaseRoute<
|
|
1665
|
+
any, // TParentRoute
|
|
1666
|
+
'/', // TPath
|
|
1667
|
+
'/', // TFullPath
|
|
1668
|
+
string, // TCustomId
|
|
1669
|
+
RootRouteId, // TId
|
|
1670
|
+
TSearchValidator, // TSearchValidator
|
|
1671
|
+
{}, // TParams
|
|
1672
|
+
TRouterContext,
|
|
1673
|
+
TRouteContextFn,
|
|
1674
|
+
TBeforeLoadFn,
|
|
1675
|
+
TLoaderDeps,
|
|
1676
|
+
TLoaderFn,
|
|
1677
|
+
TChildren, // TChildren
|
|
1678
|
+
TFileRouteTypes
|
|
1679
|
+
> {
|
|
1680
|
+
constructor(
|
|
1681
|
+
options?: RootRouteOptions<
|
|
1682
|
+
TSearchValidator,
|
|
1683
|
+
TRouterContext,
|
|
1684
|
+
TRouteContextFn,
|
|
1685
|
+
TBeforeLoadFn,
|
|
1686
|
+
TLoaderDeps,
|
|
1687
|
+
TLoaderFn
|
|
1688
|
+
>,
|
|
1689
|
+
) {
|
|
1690
|
+
super(options as any)
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
//
|