@tanstack/router-core 0.0.1-beta.3 → 0.0.1-beta.31
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/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -2
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/{packages/router-core/src/index.js → index.js} +23 -7
- package/build/cjs/{packages/router-core/src/index.js.map → index.js.map} +1 -1
- package/build/cjs/{packages/router-core/src/path.js → path.js} +7 -34
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/{packages/router-core/src/qss.js → qss.js} +9 -13
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/{packages/router-core/src/route.js → route.js} +15 -37
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/{packages/router-core/src/routeConfig.js → routeConfig.js} +13 -12
- package/build/cjs/routeConfig.js.map +1 -0
- package/build/cjs/routeMatch.js +200 -0
- package/build/cjs/routeMatch.js.map +1 -0
- package/build/cjs/{packages/router-core/src/router.js → router.js} +257 -221
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +7 -10
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/{packages/router-core/src/utils.js → utils.js} +17 -30
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +395 -1322
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +161 -168
- package/build/types/index.d.ts +247 -227
- package/build/umd/index.development.js +385 -495
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -2
- package/src/frameworks.ts +2 -2
- package/src/index.ts +0 -1
- package/src/link.ts +66 -31
- package/src/path.ts +2 -6
- package/src/qss.ts +1 -0
- package/src/route.ts +25 -33
- package/src/routeConfig.ts +100 -77
- package/src/routeInfo.ts +26 -8
- package/src/routeMatch.ts +100 -160
- package/src/router.ts +363 -141
- package/src/utils.ts +14 -7
- 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/path.js.map +0 -1
- package/build/cjs/packages/router-core/src/qss.js.map +0 -1
- package/build/cjs/packages/router-core/src/route.js.map +0 -1
- 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.map +0 -1
- package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
- package/build/cjs/packages/router-core/src/utils.js.map +0 -1
package/src/routeConfig.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
import invariant from 'tiny-invariant'
|
|
1
2
|
import { GetFrameworkGeneric } from './frameworks'
|
|
2
3
|
import { ParsePathParams } from './link'
|
|
3
4
|
import { joinPaths, trimPath, trimPathRight } from './path'
|
|
4
5
|
import { RouteInfo } from './routeInfo'
|
|
5
6
|
import { RouteMatch } from './routeMatch'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
Expand,
|
|
9
|
-
IsAny,
|
|
10
|
-
NoInfer,
|
|
11
|
-
PickUnsafe,
|
|
12
|
-
Values,
|
|
13
|
-
} from './utils'
|
|
7
|
+
import { RegisteredRouter, Router } from './router'
|
|
8
|
+
import { Expand, IsAny, NoInfer, PickUnsafe } from './utils'
|
|
14
9
|
|
|
15
10
|
export const rootRouteId = '__root__' as const
|
|
16
11
|
export type RootRouteId = typeof rootRouteId
|
|
@@ -50,12 +45,12 @@ export type ParentParams<TParentParams> = AnyPathParams extends TParentParams
|
|
|
50
45
|
}
|
|
51
46
|
|
|
52
47
|
export type LoaderFn<
|
|
53
|
-
TRouteLoaderData extends AnyLoaderData,
|
|
48
|
+
TRouteLoaderData extends AnyLoaderData = {},
|
|
54
49
|
TFullSearchSchema extends AnySearchSchema = {},
|
|
55
50
|
TAllParams extends AnyPathParams = {},
|
|
56
51
|
> = (
|
|
57
52
|
loaderContext: LoaderContext<TFullSearchSchema, TAllParams>,
|
|
58
|
-
) => Promise<TRouteLoaderData>
|
|
53
|
+
) => TRouteLoaderData | Promise<TRouteLoaderData>
|
|
59
54
|
|
|
60
55
|
export interface LoaderContext<
|
|
61
56
|
TFullSearchSchema extends AnySearchSchema = {},
|
|
@@ -64,6 +59,7 @@ export interface LoaderContext<
|
|
|
64
59
|
params: TAllParams
|
|
65
60
|
search: TFullSearchSchema
|
|
66
61
|
signal?: AbortSignal
|
|
62
|
+
// parentLoaderPromise?: Promise<TParentRouteLoaderData>
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
export type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (
|
|
@@ -77,7 +73,9 @@ export type UnloaderFn<TPath extends string> = (
|
|
|
77
73
|
export type RouteOptions<
|
|
78
74
|
TRouteId extends string = string,
|
|
79
75
|
TPath extends string = string,
|
|
76
|
+
TParentRouteLoaderData extends AnyLoaderData = {},
|
|
80
77
|
TRouteLoaderData extends AnyLoaderData = {},
|
|
78
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
81
79
|
TLoaderData extends AnyLoaderData = {},
|
|
82
80
|
TActionPayload = unknown,
|
|
83
81
|
TActionResponse = unknown,
|
|
@@ -108,18 +106,12 @@ export type RouteOptions<
|
|
|
108
106
|
// Filter functions that can manipulate search params *after* they are passed to links and navigate
|
|
109
107
|
// calls that match this route.
|
|
110
108
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[]
|
|
111
|
-
// The
|
|
112
|
-
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
// The content to be rendered when `loader` encounters an error
|
|
118
|
-
errorElement?: GetFrameworkGeneric<'SyncOrAsyncElement'> // , NoInfer<TLoaderData>>
|
|
119
|
-
// The content to be rendered when rendering encounters an error
|
|
120
|
-
catchElement?: GetFrameworkGeneric<'SyncOrAsyncElement'> // , NoInfer<TLoaderData>>
|
|
121
|
-
// The content to be rendered when the duration of `loader` execution surpasses the `pendingMs` duration
|
|
122
|
-
pendingElement?: GetFrameworkGeneric<'SyncOrAsyncElement'> //, NoInfer<TLoaderData>>
|
|
109
|
+
// The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
|
|
110
|
+
component?: GetFrameworkGeneric<'Component'> // , NoInfer<TParentLoaderData>>
|
|
111
|
+
// The content to be rendered when the route encounters an error
|
|
112
|
+
errorComponent?: GetFrameworkGeneric<'ErrorComponent'> // , NoInfer<TParentLoaderData>>
|
|
113
|
+
// If supported by your framework, the content to be rendered as the fallback content until the route is ready to render
|
|
114
|
+
pendingComponent?: GetFrameworkGeneric<'Component'> //, NoInfer<TParentLoaderData>>
|
|
123
115
|
// An asynchronous function responsible for preparing or fetching data for the route before it is rendered
|
|
124
116
|
loader?: LoaderFn<TRouteLoaderData, TFullSearchSchema, TAllParams>
|
|
125
117
|
// The max age to consider loader data fresh (not-stale) for this route in milliseconds from the time of fetch
|
|
@@ -131,13 +123,16 @@ export type RouteOptions<
|
|
|
131
123
|
// An asynchronous function made available to the route for performing asynchronous or mutative actions that
|
|
132
124
|
// might invalidate the route's data.
|
|
133
125
|
action?: ActionFn<TActionPayload, TActionResponse>
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
|
|
126
|
+
// This async function is called before a route is loaded. If an error is thrown, the navigation is cancelled.
|
|
127
|
+
// If you want to redirect instead, throw a call to the `router.navigate()` function
|
|
128
|
+
beforeLoad?: (opts: {
|
|
129
|
+
router: Router<any, any, unknown>
|
|
130
|
+
match: RouteMatch
|
|
131
|
+
}) => Promise<void> | void
|
|
137
132
|
// This function is called
|
|
138
133
|
// when moving from an inactive state to an active one. Likewise, when moving from
|
|
139
134
|
// an active to an inactive state, the return function (if provided) is called.
|
|
140
|
-
|
|
135
|
+
onLoaded?: (matchContext: {
|
|
141
136
|
params: TAllParams
|
|
142
137
|
search: TFullSearchSchema
|
|
143
138
|
}) =>
|
|
@@ -177,7 +172,9 @@ export interface RouteConfig<
|
|
|
177
172
|
TRouteId extends string = string,
|
|
178
173
|
TPath extends string = string,
|
|
179
174
|
TFullPath extends string = string,
|
|
175
|
+
TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
180
176
|
TRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
177
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
181
178
|
TLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
182
179
|
TActionPayload = unknown,
|
|
183
180
|
TActionResponse = unknown,
|
|
@@ -185,10 +182,7 @@ export interface RouteConfig<
|
|
|
185
182
|
TSearchSchema extends AnySearchSchema = {},
|
|
186
183
|
TFullSearchSchema extends AnySearchSchema = {},
|
|
187
184
|
TParentParams extends AnyPathParams = {},
|
|
188
|
-
TParams extends
|
|
189
|
-
ParsePathParams<TPath>,
|
|
190
|
-
string
|
|
191
|
-
>,
|
|
185
|
+
TParams extends AnyPathParams = {},
|
|
192
186
|
TAllParams extends AnyPathParams = {},
|
|
193
187
|
TKnownChildren = unknown,
|
|
194
188
|
> {
|
|
@@ -199,7 +193,9 @@ export interface RouteConfig<
|
|
|
199
193
|
options: RouteOptions<
|
|
200
194
|
TRouteId,
|
|
201
195
|
TPath,
|
|
196
|
+
TParentRouteLoaderData,
|
|
202
197
|
TRouteLoaderData,
|
|
198
|
+
TParentLoaderData,
|
|
203
199
|
TLoaderData,
|
|
204
200
|
TActionPayload,
|
|
205
201
|
TActionResponse,
|
|
@@ -223,7 +219,9 @@ export interface RouteConfig<
|
|
|
223
219
|
TRouteId,
|
|
224
220
|
TPath,
|
|
225
221
|
TFullPath,
|
|
222
|
+
TParentRouteLoaderData,
|
|
226
223
|
TRouteLoaderData,
|
|
224
|
+
TParentLoaderData,
|
|
227
225
|
TLoaderData,
|
|
228
226
|
TActionPayload,
|
|
229
227
|
TActionResponse,
|
|
@@ -236,55 +234,74 @@ export interface RouteConfig<
|
|
|
236
234
|
TNewChildren
|
|
237
235
|
>
|
|
238
236
|
>
|
|
239
|
-
|
|
237
|
+
createRoute: CreateRouteConfigFn<
|
|
238
|
+
false,
|
|
240
239
|
TId,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
240
|
+
TFullPath,
|
|
241
|
+
TRouteLoaderData,
|
|
242
|
+
TLoaderData,
|
|
243
|
+
TFullSearchSchema,
|
|
244
|
+
TAllParams
|
|
245
|
+
>
|
|
246
|
+
generate: GenerateFn<
|
|
247
|
+
TRouteId,
|
|
248
|
+
TPath,
|
|
249
|
+
TParentRouteLoaderData,
|
|
250
|
+
TParentLoaderData,
|
|
251
|
+
TParentSearchSchema,
|
|
252
|
+
TParentParams
|
|
253
|
+
>
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
type GenerateFn<
|
|
257
|
+
TRouteId extends string = string,
|
|
258
|
+
TPath extends string = string,
|
|
259
|
+
TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
260
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
261
|
+
TParentSearchSchema extends {} = {},
|
|
262
|
+
TParentParams extends AnyPathParams = {},
|
|
263
|
+
> = <
|
|
264
|
+
TRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
265
|
+
TActionPayload = unknown,
|
|
266
|
+
TActionResponse = unknown,
|
|
267
|
+
TSearchSchema extends AnySearchSchema = {},
|
|
268
|
+
TParams extends Record<ParsePathParams<TPath>, unknown> = Record<
|
|
269
|
+
ParsePathParams<TPath>,
|
|
270
|
+
string
|
|
271
|
+
>,
|
|
272
|
+
TAllParams extends AnyPathParams extends TParams
|
|
273
|
+
? Record<ParsePathParams<TPath>, string>
|
|
274
|
+
: NoInfer<TParams> = AnyPathParams extends TParams
|
|
275
|
+
? Record<ParsePathParams<TPath>, string>
|
|
276
|
+
: NoInfer<TParams>,
|
|
277
|
+
>(
|
|
278
|
+
options: Omit<
|
|
279
|
+
RouteOptions<
|
|
257
280
|
TRouteId,
|
|
258
281
|
TPath,
|
|
259
|
-
|
|
282
|
+
TParentRouteLoaderData,
|
|
260
283
|
TRouteLoaderData,
|
|
261
|
-
|
|
284
|
+
TParentLoaderData,
|
|
285
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
262
286
|
TActionPayload,
|
|
263
287
|
TActionResponse,
|
|
264
288
|
TParentSearchSchema,
|
|
265
289
|
TSearchSchema,
|
|
266
|
-
|
|
290
|
+
Expand<TParentSearchSchema & TSearchSchema>,
|
|
267
291
|
TParentParams,
|
|
268
292
|
TParams,
|
|
269
|
-
TAllParams
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
false,
|
|
275
|
-
TId,
|
|
276
|
-
TFullPath,
|
|
277
|
-
TLoaderData,
|
|
278
|
-
TFullSearchSchema,
|
|
279
|
-
TAllParams
|
|
280
|
-
>
|
|
281
|
-
}
|
|
293
|
+
Expand<TParentParams & TAllParams>
|
|
294
|
+
>,
|
|
295
|
+
'path'
|
|
296
|
+
>,
|
|
297
|
+
) => void
|
|
282
298
|
|
|
283
299
|
type CreateRouteConfigFn<
|
|
284
300
|
TIsRoot extends boolean = false,
|
|
285
301
|
TParentId extends string = string,
|
|
286
302
|
TParentPath extends string = string,
|
|
287
|
-
|
|
303
|
+
TParentRouteLoaderData extends AnyLoaderData = {},
|
|
304
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
288
305
|
TParentSearchSchema extends AnySearchSchema = {},
|
|
289
306
|
TParentParams extends AnyPathParams = {},
|
|
290
307
|
> = <
|
|
@@ -315,8 +332,10 @@ type CreateRouteConfigFn<
|
|
|
315
332
|
RouteOptions<
|
|
316
333
|
TRouteId,
|
|
317
334
|
TPath,
|
|
335
|
+
TParentRouteLoaderData,
|
|
318
336
|
TRouteLoaderData,
|
|
319
|
-
|
|
337
|
+
TParentLoaderData,
|
|
338
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
320
339
|
TActionPayload,
|
|
321
340
|
TActionResponse,
|
|
322
341
|
TParentSearchSchema,
|
|
@@ -331,8 +350,10 @@ type CreateRouteConfigFn<
|
|
|
331
350
|
: RouteOptions<
|
|
332
351
|
TRouteId,
|
|
333
352
|
TPath,
|
|
353
|
+
TParentRouteLoaderData,
|
|
334
354
|
TRouteLoaderData,
|
|
335
|
-
|
|
355
|
+
TParentLoaderData,
|
|
356
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
336
357
|
TActionPayload,
|
|
337
358
|
TActionResponse,
|
|
338
359
|
TParentSearchSchema,
|
|
@@ -351,8 +372,10 @@ type CreateRouteConfigFn<
|
|
|
351
372
|
TResolvedId,
|
|
352
373
|
TPath,
|
|
353
374
|
string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>,
|
|
375
|
+
TParentRouteLoaderData,
|
|
354
376
|
TRouteLoaderData,
|
|
355
|
-
|
|
377
|
+
TParentLoaderData,
|
|
378
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
356
379
|
TActionPayload,
|
|
357
380
|
TActionResponse,
|
|
358
381
|
TParentSearchSchema,
|
|
@@ -395,6 +418,8 @@ export interface AnyRouteConfig
|
|
|
395
418
|
any,
|
|
396
419
|
any,
|
|
397
420
|
any,
|
|
421
|
+
any,
|
|
422
|
+
any,
|
|
398
423
|
any
|
|
399
424
|
> {}
|
|
400
425
|
|
|
@@ -414,6 +439,8 @@ export interface AnyRouteConfigWithChildren<TChildren>
|
|
|
414
439
|
any,
|
|
415
440
|
any,
|
|
416
441
|
any,
|
|
442
|
+
any,
|
|
443
|
+
any,
|
|
417
444
|
TChildren
|
|
418
445
|
> {}
|
|
419
446
|
|
|
@@ -477,19 +504,15 @@ export const createRouteConfig: CreateRouteConfigFn<true> = (
|
|
|
477
504
|
fullPath: fullPath as any,
|
|
478
505
|
options: options as any,
|
|
479
506
|
children,
|
|
480
|
-
createChildren: (cb: any) =>
|
|
481
|
-
createRouteConfig(
|
|
482
|
-
options,
|
|
483
|
-
cb((childOptions: any) =>
|
|
484
|
-
createRouteConfig(childOptions, undefined, false, id, fullPath),
|
|
485
|
-
),
|
|
486
|
-
false,
|
|
487
|
-
parentId,
|
|
488
|
-
parentPath,
|
|
489
|
-
),
|
|
490
507
|
addChildren: (children: any) =>
|
|
491
508
|
createRouteConfig(options, children, false, parentId, parentPath),
|
|
492
509
|
createRoute: (childOptions: any) =>
|
|
493
510
|
createRouteConfig(childOptions, undefined, false, id, fullPath) as any,
|
|
511
|
+
generate: () => {
|
|
512
|
+
invariant(
|
|
513
|
+
false,
|
|
514
|
+
`routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
|
|
515
|
+
)
|
|
516
|
+
},
|
|
494
517
|
}
|
|
495
518
|
}
|
package/src/routeInfo.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
RouteConfig,
|
|
11
11
|
RouteOptions,
|
|
12
12
|
} from './routeConfig'
|
|
13
|
-
import { IsAny, Values } from './utils'
|
|
13
|
+
import { IsAny, UnionToIntersection, Values } from './utils'
|
|
14
14
|
|
|
15
15
|
export interface AnyAllRouteInfo {
|
|
16
16
|
routeConfig: AnyRouteConfig
|
|
@@ -19,6 +19,8 @@ export interface AnyAllRouteInfo {
|
|
|
19
19
|
routeInfoByFullPath: Record<string, AnyRouteInfo>
|
|
20
20
|
routeIds: any
|
|
21
21
|
routePaths: any
|
|
22
|
+
fullSearchSchema: Record<string, any>
|
|
23
|
+
allParams: Record<string, any>
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export interface DefaultAllRouteInfo {
|
|
@@ -28,6 +30,8 @@ export interface DefaultAllRouteInfo {
|
|
|
28
30
|
routeInfoByFullPath: Record<string, RouteInfo>
|
|
29
31
|
routeIds: string
|
|
30
32
|
routePaths: string
|
|
33
|
+
fullSearchSchema: AnySearchSchema
|
|
34
|
+
allParams: AnyPathParams
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export interface AllRouteInfo<TRouteConfig extends AnyRouteConfig = RouteConfig>
|
|
@@ -58,12 +62,15 @@ type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
|
|
|
58
62
|
? ParseRouteConfig<TRouteConfig>
|
|
59
63
|
: never
|
|
60
64
|
|
|
65
|
+
// Generics!
|
|
61
66
|
export type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<
|
|
62
67
|
infer TId,
|
|
63
68
|
infer TRouteId,
|
|
64
69
|
infer TPath,
|
|
65
70
|
infer TFullPath,
|
|
71
|
+
infer TParentRouteLoaderData,
|
|
66
72
|
infer TRouteLoaderData,
|
|
73
|
+
infer TParentLoaderData,
|
|
67
74
|
infer TLoaderData,
|
|
68
75
|
infer TActionPayload,
|
|
69
76
|
infer TActionResponse,
|
|
@@ -82,7 +89,9 @@ export type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<
|
|
|
82
89
|
TRouteId,
|
|
83
90
|
TPath,
|
|
84
91
|
TFullPath,
|
|
92
|
+
TParentRouteLoaderData,
|
|
85
93
|
TRouteLoaderData,
|
|
94
|
+
TParentLoaderData,
|
|
86
95
|
TLoaderData,
|
|
87
96
|
TActionPayload,
|
|
88
97
|
TActionResponse,
|
|
@@ -111,12 +120,14 @@ export interface RoutesInfoInner<
|
|
|
111
120
|
any,
|
|
112
121
|
any,
|
|
113
122
|
any,
|
|
123
|
+
any,
|
|
124
|
+
any,
|
|
114
125
|
any
|
|
115
126
|
> = RouteInfo,
|
|
116
|
-
TRouteInfoById = {
|
|
127
|
+
TRouteInfoById = { '/': TRouteInfo } & {
|
|
117
128
|
[TInfo in TRouteInfo as TInfo['id']]: TInfo
|
|
118
129
|
},
|
|
119
|
-
TRouteInfoByFullPath = {
|
|
130
|
+
TRouteInfoByFullPath = { '/': TRouteInfo } & {
|
|
120
131
|
[TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId
|
|
121
132
|
? never
|
|
122
133
|
: string extends TInfo['fullPath']
|
|
@@ -130,6 +141,8 @@ export interface RoutesInfoInner<
|
|
|
130
141
|
routeInfoByFullPath: TRouteInfoByFullPath
|
|
131
142
|
routeIds: keyof TRouteInfoById
|
|
132
143
|
routePaths: keyof TRouteInfoByFullPath
|
|
144
|
+
fullSearchSchema: Partial<UnionToIntersection<TRouteInfo['fullSearchSchema']>>
|
|
145
|
+
allParams: Partial<UnionToIntersection<TRouteInfo['allParams']>>
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
export interface AnyRouteInfo
|
|
@@ -147,6 +160,8 @@ export interface AnyRouteInfo
|
|
|
147
160
|
any,
|
|
148
161
|
any,
|
|
149
162
|
any,
|
|
163
|
+
any,
|
|
164
|
+
any,
|
|
150
165
|
any
|
|
151
166
|
> {}
|
|
152
167
|
|
|
@@ -154,8 +169,10 @@ export interface RouteInfo<
|
|
|
154
169
|
TId extends string = string,
|
|
155
170
|
TRouteId extends string = string,
|
|
156
171
|
TPath extends string = string,
|
|
157
|
-
TFullPath extends string =
|
|
172
|
+
TFullPath extends string = '/',
|
|
173
|
+
TParentRouteLoaderData extends AnyLoaderData = {},
|
|
158
174
|
TRouteLoaderData extends AnyLoaderData = {},
|
|
175
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
159
176
|
TLoaderData extends AnyLoaderData = {},
|
|
160
177
|
TActionPayload = unknown,
|
|
161
178
|
TActionResponse = unknown,
|
|
@@ -163,17 +180,16 @@ export interface RouteInfo<
|
|
|
163
180
|
TSearchSchema extends AnySearchSchema = {},
|
|
164
181
|
TFullSearchSchema extends AnySearchSchema = {},
|
|
165
182
|
TParentParams extends AnyPathParams = {},
|
|
166
|
-
TParams extends
|
|
167
|
-
ParsePathParams<TPath>,
|
|
168
|
-
string
|
|
169
|
-
>,
|
|
183
|
+
TParams extends AnyPathParams = {},
|
|
170
184
|
TAllParams extends AnyPathParams = {},
|
|
171
185
|
> {
|
|
172
186
|
id: TId
|
|
173
187
|
routeId: TRouteId
|
|
174
188
|
path: TPath
|
|
175
189
|
fullPath: TFullPath
|
|
190
|
+
parentRouteLoaderData: TParentRouteLoaderData
|
|
176
191
|
routeLoaderData: TRouteLoaderData
|
|
192
|
+
parentLoaderData: TParentLoaderData
|
|
177
193
|
loaderData: TLoaderData
|
|
178
194
|
actionPayload: TActionPayload
|
|
179
195
|
actionResponse: TActionResponse
|
|
@@ -185,7 +201,9 @@ export interface RouteInfo<
|
|
|
185
201
|
options: RouteOptions<
|
|
186
202
|
TRouteId,
|
|
187
203
|
TPath,
|
|
204
|
+
TParentRouteLoaderData,
|
|
188
205
|
TRouteLoaderData,
|
|
206
|
+
TParentLoaderData,
|
|
189
207
|
TLoaderData,
|
|
190
208
|
TActionPayload,
|
|
191
209
|
TActionResponse,
|