@tanstack/router-core 0.0.1-beta.4 → 0.0.1-beta.41
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/{packages/router-core/src/index.js → index.js} +25 -8
- 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} +19 -43
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/{packages/router-core/src/qss.js → qss.js} +8 -13
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/route.js +155 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/{packages/router-core/src/routeConfig.js → routeConfig.js} +14 -13
- package/build/cjs/routeConfig.js.map +1 -0
- package/build/cjs/routeMatch.js +242 -0
- package/build/cjs/routeMatch.js.map +1 -0
- package/build/cjs/router.js +807 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +10 -12
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/sharedClone.js +122 -0
- package/build/cjs/sharedClone.js.map +1 -0
- package/build/cjs/utils.js +47 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +890 -1739
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +196 -178
- package/build/types/index.d.ts +287 -283
- package/build/umd/index.development.js +1233 -922
- 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 +4 -2
- package/src/frameworks.ts +2 -2
- package/src/index.ts +1 -1
- package/src/link.ts +86 -43
- package/src/path.ts +12 -8
- package/src/route.ts +170 -158
- package/src/routeConfig.ts +105 -77
- package/src/routeInfo.ts +26 -8
- package/src/routeMatch.ts +204 -217
- package/src/router.ts +680 -503
- package/src/sharedClone.ts +118 -0
- package/src/utils.ts +14 -72
- 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/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 +0 -161
- 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 +0 -789
- 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 +0 -118
- 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,21 @@ 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.
|
|
127
|
+
// If an error is thrown here, the route's loader will not be called.
|
|
128
|
+
// If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onLoadError` function.
|
|
129
|
+
// If thrown during a preload event, the error will be logged to the console.
|
|
130
|
+
beforeLoad?: (opts: {
|
|
131
|
+
router: Router<any, any, unknown>
|
|
132
|
+
match: RouteMatch
|
|
133
|
+
}) => Promise<void> | void
|
|
134
|
+
// This function will be called if the route's loader throws an error **during an attempted navigation**.
|
|
135
|
+
// If you want to redirect due to an error, call `router.navigate()` from within this function.
|
|
136
|
+
onLoadError?: (err: any) => void
|
|
137
137
|
// This function is called
|
|
138
138
|
// when moving from an inactive state to an active one. Likewise, when moving from
|
|
139
139
|
// an active to an inactive state, the return function (if provided) is called.
|
|
140
|
-
|
|
140
|
+
onLoaded?: (matchContext: {
|
|
141
141
|
params: TAllParams
|
|
142
142
|
search: TFullSearchSchema
|
|
143
143
|
}) =>
|
|
@@ -177,7 +177,9 @@ export interface RouteConfig<
|
|
|
177
177
|
TRouteId extends string = string,
|
|
178
178
|
TPath extends string = string,
|
|
179
179
|
TFullPath extends string = string,
|
|
180
|
+
TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
180
181
|
TRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
182
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
181
183
|
TLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
182
184
|
TActionPayload = unknown,
|
|
183
185
|
TActionResponse = unknown,
|
|
@@ -185,10 +187,7 @@ export interface RouteConfig<
|
|
|
185
187
|
TSearchSchema extends AnySearchSchema = {},
|
|
186
188
|
TFullSearchSchema extends AnySearchSchema = {},
|
|
187
189
|
TParentParams extends AnyPathParams = {},
|
|
188
|
-
TParams extends
|
|
189
|
-
ParsePathParams<TPath>,
|
|
190
|
-
string
|
|
191
|
-
>,
|
|
190
|
+
TParams extends AnyPathParams = {},
|
|
192
191
|
TAllParams extends AnyPathParams = {},
|
|
193
192
|
TKnownChildren = unknown,
|
|
194
193
|
> {
|
|
@@ -199,7 +198,9 @@ export interface RouteConfig<
|
|
|
199
198
|
options: RouteOptions<
|
|
200
199
|
TRouteId,
|
|
201
200
|
TPath,
|
|
201
|
+
TParentRouteLoaderData,
|
|
202
202
|
TRouteLoaderData,
|
|
203
|
+
TParentLoaderData,
|
|
203
204
|
TLoaderData,
|
|
204
205
|
TActionPayload,
|
|
205
206
|
TActionResponse,
|
|
@@ -223,7 +224,9 @@ export interface RouteConfig<
|
|
|
223
224
|
TRouteId,
|
|
224
225
|
TPath,
|
|
225
226
|
TFullPath,
|
|
227
|
+
TParentRouteLoaderData,
|
|
226
228
|
TRouteLoaderData,
|
|
229
|
+
TParentLoaderData,
|
|
227
230
|
TLoaderData,
|
|
228
231
|
TActionPayload,
|
|
229
232
|
TActionResponse,
|
|
@@ -236,55 +239,74 @@ export interface RouteConfig<
|
|
|
236
239
|
TNewChildren
|
|
237
240
|
>
|
|
238
241
|
>
|
|
239
|
-
|
|
242
|
+
createRoute: CreateRouteConfigFn<
|
|
243
|
+
false,
|
|
240
244
|
TId,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
245
|
+
TFullPath,
|
|
246
|
+
TRouteLoaderData,
|
|
247
|
+
TLoaderData,
|
|
248
|
+
TFullSearchSchema,
|
|
249
|
+
TAllParams
|
|
250
|
+
>
|
|
251
|
+
generate: GenerateFn<
|
|
252
|
+
TRouteId,
|
|
253
|
+
TPath,
|
|
254
|
+
TParentRouteLoaderData,
|
|
255
|
+
TParentLoaderData,
|
|
256
|
+
TParentSearchSchema,
|
|
257
|
+
TParentParams
|
|
258
|
+
>
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
type GenerateFn<
|
|
262
|
+
TRouteId extends string = string,
|
|
263
|
+
TPath extends string = string,
|
|
264
|
+
TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
265
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
266
|
+
TParentSearchSchema extends {} = {},
|
|
267
|
+
TParentParams extends AnyPathParams = {},
|
|
268
|
+
> = <
|
|
269
|
+
TRouteLoaderData extends AnyLoaderData = AnyLoaderData,
|
|
270
|
+
TActionPayload = unknown,
|
|
271
|
+
TActionResponse = unknown,
|
|
272
|
+
TSearchSchema extends AnySearchSchema = {},
|
|
273
|
+
TParams extends Record<ParsePathParams<TPath>, unknown> = Record<
|
|
274
|
+
ParsePathParams<TPath>,
|
|
275
|
+
string
|
|
276
|
+
>,
|
|
277
|
+
TAllParams extends AnyPathParams extends TParams
|
|
278
|
+
? Record<ParsePathParams<TPath>, string>
|
|
279
|
+
: NoInfer<TParams> = AnyPathParams extends TParams
|
|
280
|
+
? Record<ParsePathParams<TPath>, string>
|
|
281
|
+
: NoInfer<TParams>,
|
|
282
|
+
>(
|
|
283
|
+
options: Omit<
|
|
284
|
+
RouteOptions<
|
|
257
285
|
TRouteId,
|
|
258
286
|
TPath,
|
|
259
|
-
|
|
287
|
+
TParentRouteLoaderData,
|
|
260
288
|
TRouteLoaderData,
|
|
261
|
-
|
|
289
|
+
TParentLoaderData,
|
|
290
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
262
291
|
TActionPayload,
|
|
263
292
|
TActionResponse,
|
|
264
293
|
TParentSearchSchema,
|
|
265
294
|
TSearchSchema,
|
|
266
|
-
|
|
295
|
+
Expand<TParentSearchSchema & TSearchSchema>,
|
|
267
296
|
TParentParams,
|
|
268
297
|
TParams,
|
|
269
|
-
TAllParams
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
false,
|
|
275
|
-
TId,
|
|
276
|
-
TFullPath,
|
|
277
|
-
TLoaderData,
|
|
278
|
-
TFullSearchSchema,
|
|
279
|
-
TAllParams
|
|
280
|
-
>
|
|
281
|
-
}
|
|
298
|
+
Expand<TParentParams & TAllParams>
|
|
299
|
+
>,
|
|
300
|
+
'path'
|
|
301
|
+
>,
|
|
302
|
+
) => void
|
|
282
303
|
|
|
283
304
|
type CreateRouteConfigFn<
|
|
284
305
|
TIsRoot extends boolean = false,
|
|
285
306
|
TParentId extends string = string,
|
|
286
307
|
TParentPath extends string = string,
|
|
287
|
-
|
|
308
|
+
TParentRouteLoaderData extends AnyLoaderData = {},
|
|
309
|
+
TParentLoaderData extends AnyLoaderData = {},
|
|
288
310
|
TParentSearchSchema extends AnySearchSchema = {},
|
|
289
311
|
TParentParams extends AnyPathParams = {},
|
|
290
312
|
> = <
|
|
@@ -315,8 +337,10 @@ type CreateRouteConfigFn<
|
|
|
315
337
|
RouteOptions<
|
|
316
338
|
TRouteId,
|
|
317
339
|
TPath,
|
|
340
|
+
TParentRouteLoaderData,
|
|
318
341
|
TRouteLoaderData,
|
|
319
|
-
|
|
342
|
+
TParentLoaderData,
|
|
343
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
320
344
|
TActionPayload,
|
|
321
345
|
TActionResponse,
|
|
322
346
|
TParentSearchSchema,
|
|
@@ -331,8 +355,10 @@ type CreateRouteConfigFn<
|
|
|
331
355
|
: RouteOptions<
|
|
332
356
|
TRouteId,
|
|
333
357
|
TPath,
|
|
358
|
+
TParentRouteLoaderData,
|
|
334
359
|
TRouteLoaderData,
|
|
335
|
-
|
|
360
|
+
TParentLoaderData,
|
|
361
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
336
362
|
TActionPayload,
|
|
337
363
|
TActionResponse,
|
|
338
364
|
TParentSearchSchema,
|
|
@@ -351,8 +377,10 @@ type CreateRouteConfigFn<
|
|
|
351
377
|
TResolvedId,
|
|
352
378
|
TPath,
|
|
353
379
|
string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>,
|
|
380
|
+
TParentRouteLoaderData,
|
|
354
381
|
TRouteLoaderData,
|
|
355
|
-
|
|
382
|
+
TParentLoaderData,
|
|
383
|
+
Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>,
|
|
356
384
|
TActionPayload,
|
|
357
385
|
TActionResponse,
|
|
358
386
|
TParentSearchSchema,
|
|
@@ -395,6 +423,8 @@ export interface AnyRouteConfig
|
|
|
395
423
|
any,
|
|
396
424
|
any,
|
|
397
425
|
any,
|
|
426
|
+
any,
|
|
427
|
+
any,
|
|
398
428
|
any
|
|
399
429
|
> {}
|
|
400
430
|
|
|
@@ -414,6 +444,8 @@ export interface AnyRouteConfigWithChildren<TChildren>
|
|
|
414
444
|
any,
|
|
415
445
|
any,
|
|
416
446
|
any,
|
|
447
|
+
any,
|
|
448
|
+
any,
|
|
417
449
|
TChildren
|
|
418
450
|
> {}
|
|
419
451
|
|
|
@@ -477,19 +509,15 @@ export const createRouteConfig: CreateRouteConfigFn<true> = (
|
|
|
477
509
|
fullPath: fullPath as any,
|
|
478
510
|
options: options as any,
|
|
479
511
|
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
512
|
addChildren: (children: any) =>
|
|
491
513
|
createRouteConfig(options, children, false, parentId, parentPath),
|
|
492
514
|
createRoute: (childOptions: any) =>
|
|
493
515
|
createRouteConfig(childOptions, undefined, false, id, fullPath) as any,
|
|
516
|
+
generate: () => {
|
|
517
|
+
invariant(
|
|
518
|
+
false,
|
|
519
|
+
`routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
|
|
520
|
+
)
|
|
521
|
+
},
|
|
494
522
|
}
|
|
495
523
|
}
|
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,
|