@tanstack/solid-router 1.111.6 → 1.111.8
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/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +8 -44
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +2 -2
- package/dist/cjs/index.d.cts +3 -3
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +8 -108
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +4 -4
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useMatch.d.cts +1 -2
- package/dist/esm/Matches.d.ts +8 -44
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +2 -2
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/route.d.ts +8 -108
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +4 -4
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/useMatch.d.ts +1 -2
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/source/Matches.d.ts +8 -44
- package/dist/source/Matches.jsx.map +1 -1
- package/dist/source/fileRoute.d.ts +2 -2
- package/dist/source/fileRoute.js.map +1 -1
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/route.d.ts +8 -108
- package/dist/source/route.js.map +1 -1
- package/dist/source/router.d.ts +4 -4
- package/dist/source/router.js.map +1 -1
- package/dist/source/useMatch.d.ts +1 -2
- package/dist/source/useMatch.jsx.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +8 -105
- package/src/fileRoute.ts +4 -8
- package/src/index.tsx +16 -16
- package/src/route.ts +10 -530
- package/src/router.ts +7 -9
- package/src/useMatch.tsx +5 -2
package/src/route.ts
CHANGED
|
@@ -9,48 +9,29 @@ import { useNavigate } from './useNavigate'
|
|
|
9
9
|
import { useMatch } from './useMatch'
|
|
10
10
|
import type {
|
|
11
11
|
AnyContext,
|
|
12
|
-
AnyPathParams,
|
|
13
12
|
AnySchema,
|
|
14
|
-
AnyValidator,
|
|
15
|
-
BeforeLoadContextParameter,
|
|
16
|
-
BuildLocationFn,
|
|
17
13
|
Constrain,
|
|
18
14
|
ConstrainLiteral,
|
|
19
15
|
RootRoute as CoreRootRoute,
|
|
20
16
|
Route as CoreRoute,
|
|
21
|
-
DefaultValidator,
|
|
22
17
|
ErrorComponentProps,
|
|
23
|
-
Expand,
|
|
24
|
-
FullSearchSchemaOption,
|
|
25
|
-
NavigateFn,
|
|
26
|
-
NavigateOptions,
|
|
27
|
-
NoInfer,
|
|
28
18
|
NotFoundRouteProps,
|
|
29
|
-
ParamsOptions,
|
|
30
|
-
ParsedLocation,
|
|
31
|
-
RemountDepsOptions,
|
|
32
|
-
ResolveAllContext,
|
|
33
|
-
ResolveAllParamsFromParent,
|
|
34
|
-
ResolveFullSearchSchema,
|
|
35
|
-
ResolveFullSearchSchemaInput,
|
|
36
19
|
ResolveId,
|
|
37
|
-
ResolveLoaderData,
|
|
38
20
|
ResolveParams,
|
|
39
21
|
RootRouteId,
|
|
22
|
+
RootRouteOptions,
|
|
40
23
|
RouteById,
|
|
41
24
|
RouteContext,
|
|
42
|
-
RouteContextParameter,
|
|
43
25
|
RouteIds,
|
|
44
|
-
|
|
26
|
+
RouteLoaderFn,
|
|
27
|
+
RouteOptions,
|
|
45
28
|
RoutePathOptionsIntersection,
|
|
46
29
|
RoutePaths,
|
|
47
30
|
RoutePrefix,
|
|
48
31
|
RouteTypes,
|
|
49
|
-
SearchFilter,
|
|
50
|
-
SearchMiddleware,
|
|
51
32
|
ToMaskOptions,
|
|
52
33
|
TrimPathRight,
|
|
53
|
-
|
|
34
|
+
UpdatableRouteOptions,
|
|
54
35
|
UseNavigateResult,
|
|
55
36
|
} from '@tanstack/router-core'
|
|
56
37
|
import type { UseLoaderDataRoute } from './useLoaderData'
|
|
@@ -59,488 +40,18 @@ import type { UseLoaderDepsRoute } from './useLoaderDeps'
|
|
|
59
40
|
import type { UseParamsRoute } from './useParams'
|
|
60
41
|
import type { UseSearchRoute } from './useSearch'
|
|
61
42
|
import type * as Solid from 'solid-js'
|
|
62
|
-
import type {
|
|
63
|
-
AnyRouteMatch,
|
|
64
|
-
MakeRouteMatchFromRoute,
|
|
65
|
-
MakeRouteMatchUnion,
|
|
66
|
-
RouteMatch,
|
|
67
|
-
} from './Matches'
|
|
68
43
|
import type { AnyRouter, RegisteredRouter, Router } from './router'
|
|
69
44
|
import type { NotFoundError } from './not-found'
|
|
70
45
|
import type { LazyRoute } from './fileRoute'
|
|
71
46
|
import type { UseRouteContextRoute } from './useRouteContext'
|
|
72
47
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
TSearchValidator = undefined,
|
|
80
|
-
TParams = AnyPathParams,
|
|
81
|
-
TLoaderDeps extends Record<string, any> = {},
|
|
82
|
-
TLoaderFn = undefined,
|
|
83
|
-
TRouterContext = {},
|
|
84
|
-
TRouteContextFn = AnyContext,
|
|
85
|
-
TBeforeLoadFn = AnyContext,
|
|
86
|
-
> = BaseRouteOptions<
|
|
87
|
-
TParentRoute,
|
|
88
|
-
TId,
|
|
89
|
-
TCustomId,
|
|
90
|
-
TPath,
|
|
91
|
-
TSearchValidator,
|
|
92
|
-
TParams,
|
|
93
|
-
TLoaderDeps,
|
|
94
|
-
TLoaderFn,
|
|
95
|
-
TRouterContext,
|
|
96
|
-
TRouteContextFn,
|
|
97
|
-
TBeforeLoadFn
|
|
98
|
-
> &
|
|
99
|
-
UpdatableRouteOptions<
|
|
100
|
-
NoInfer<TParentRoute>,
|
|
101
|
-
NoInfer<TCustomId>,
|
|
102
|
-
NoInfer<TFullPath>,
|
|
103
|
-
NoInfer<TParams>,
|
|
104
|
-
NoInfer<TSearchValidator>,
|
|
105
|
-
NoInfer<TLoaderFn>,
|
|
106
|
-
NoInfer<TLoaderDeps>,
|
|
107
|
-
NoInfer<TRouterContext>,
|
|
108
|
-
NoInfer<TRouteContextFn>,
|
|
109
|
-
NoInfer<TBeforeLoadFn>
|
|
110
|
-
>
|
|
111
|
-
|
|
112
|
-
export type RouteContextFn<
|
|
113
|
-
in out TParentRoute extends AnyRoute,
|
|
114
|
-
in out TSearchValidator,
|
|
115
|
-
in out TParams,
|
|
116
|
-
in out TRouterContext,
|
|
117
|
-
> = (
|
|
118
|
-
ctx: RouteContextOptions<
|
|
119
|
-
TParentRoute,
|
|
120
|
-
TSearchValidator,
|
|
121
|
-
TParams,
|
|
122
|
-
TRouterContext
|
|
123
|
-
>,
|
|
124
|
-
) => any
|
|
125
|
-
|
|
126
|
-
export type BeforeLoadFn<
|
|
127
|
-
in out TParentRoute extends AnyRoute,
|
|
128
|
-
in out TSearchValidator,
|
|
129
|
-
in out TParams,
|
|
130
|
-
in out TRouterContext,
|
|
131
|
-
in out TRouteContextFn,
|
|
132
|
-
> = (
|
|
133
|
-
ctx: BeforeLoadContextOptions<
|
|
134
|
-
TParentRoute,
|
|
135
|
-
TSearchValidator,
|
|
136
|
-
TParams,
|
|
137
|
-
TRouterContext,
|
|
138
|
-
TRouteContextFn
|
|
139
|
-
>,
|
|
140
|
-
) => any
|
|
141
|
-
|
|
142
|
-
export type FileBaseRouteOptions<
|
|
143
|
-
TParentRoute extends AnyRoute = AnyRoute,
|
|
144
|
-
TId extends string = string,
|
|
145
|
-
TPath extends string = string,
|
|
146
|
-
TSearchValidator = undefined,
|
|
147
|
-
TParams = {},
|
|
148
|
-
TLoaderDeps extends Record<string, any> = {},
|
|
149
|
-
TLoaderFn = undefined,
|
|
150
|
-
TRouterContext = {},
|
|
151
|
-
TRouteContextFn = AnyContext,
|
|
152
|
-
TBeforeLoadFn = AnyContext,
|
|
153
|
-
TRemountDepsFn = AnyContext,
|
|
154
|
-
> = ParamsOptions<TPath, TParams> & {
|
|
155
|
-
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>
|
|
156
|
-
|
|
157
|
-
shouldReload?:
|
|
158
|
-
| boolean
|
|
159
|
-
| ((
|
|
160
|
-
match: LoaderFnContext<
|
|
161
|
-
TParentRoute,
|
|
162
|
-
TId,
|
|
163
|
-
TParams,
|
|
164
|
-
TLoaderDeps,
|
|
165
|
-
TRouterContext,
|
|
166
|
-
TRouteContextFn,
|
|
167
|
-
TBeforeLoadFn
|
|
168
|
-
>,
|
|
169
|
-
) => any)
|
|
170
|
-
|
|
171
|
-
context?: Constrain<
|
|
172
|
-
TRouteContextFn,
|
|
173
|
-
(
|
|
174
|
-
ctx: RouteContextOptions<
|
|
175
|
-
TParentRoute,
|
|
176
|
-
TParams,
|
|
177
|
-
TRouterContext,
|
|
178
|
-
TLoaderDeps
|
|
179
|
-
>,
|
|
180
|
-
) => any
|
|
181
|
-
>
|
|
182
|
-
|
|
183
|
-
// This async function is called before a route is loaded.
|
|
184
|
-
// If an error is thrown here, the route's loader will not be called.
|
|
185
|
-
// If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.
|
|
186
|
-
// If thrown during a preload event, the error will be logged to the console.
|
|
187
|
-
beforeLoad?: Constrain<
|
|
188
|
-
TBeforeLoadFn,
|
|
189
|
-
(
|
|
190
|
-
ctx: BeforeLoadContextOptions<
|
|
191
|
-
TParentRoute,
|
|
192
|
-
TSearchValidator,
|
|
193
|
-
TParams,
|
|
194
|
-
TRouterContext,
|
|
195
|
-
TRouteContextFn
|
|
196
|
-
>,
|
|
197
|
-
) => any
|
|
198
|
-
>
|
|
199
|
-
|
|
200
|
-
loaderDeps?: (
|
|
201
|
-
opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>,
|
|
202
|
-
) => TLoaderDeps
|
|
203
|
-
|
|
204
|
-
remountDeps?: Constrain<
|
|
205
|
-
TRemountDepsFn,
|
|
206
|
-
(
|
|
207
|
-
opt: RemountDepsOptions<
|
|
208
|
-
TId,
|
|
209
|
-
FullSearchSchemaOption<TParentRoute, TSearchValidator>,
|
|
210
|
-
Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>,
|
|
211
|
-
TLoaderDeps
|
|
212
|
-
>,
|
|
213
|
-
) => any
|
|
214
|
-
>
|
|
215
|
-
|
|
216
|
-
loader?: Constrain<
|
|
217
|
-
TLoaderFn,
|
|
218
|
-
(
|
|
219
|
-
ctx: LoaderFnContext<
|
|
220
|
-
TParentRoute,
|
|
221
|
-
TId,
|
|
222
|
-
TParams,
|
|
223
|
-
TLoaderDeps,
|
|
224
|
-
TRouterContext,
|
|
225
|
-
TRouteContextFn,
|
|
226
|
-
TBeforeLoadFn
|
|
227
|
-
>,
|
|
228
|
-
) => any
|
|
229
|
-
>
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export type BaseRouteOptions<
|
|
233
|
-
TParentRoute extends AnyRoute = AnyRoute,
|
|
234
|
-
TId extends string = string,
|
|
235
|
-
TCustomId extends string = string,
|
|
236
|
-
TPath extends string = string,
|
|
237
|
-
TSearchValidator = undefined,
|
|
238
|
-
TParams = {},
|
|
239
|
-
TLoaderDeps extends Record<string, any> = {},
|
|
240
|
-
TLoaderFn = undefined,
|
|
241
|
-
TRouterContext = {},
|
|
242
|
-
TRouteContextFn = AnyContext,
|
|
243
|
-
TBeforeLoadFn = AnyContext,
|
|
244
|
-
> = RoutePathOptions<TCustomId, TPath> &
|
|
245
|
-
FileBaseRouteOptions<
|
|
246
|
-
TParentRoute,
|
|
247
|
-
TId,
|
|
248
|
-
TPath,
|
|
249
|
-
TSearchValidator,
|
|
250
|
-
TParams,
|
|
251
|
-
TLoaderDeps,
|
|
252
|
-
TLoaderFn,
|
|
253
|
-
TRouterContext,
|
|
254
|
-
TRouteContextFn,
|
|
255
|
-
TBeforeLoadFn
|
|
256
|
-
> & {
|
|
257
|
-
getParentRoute: () => TParentRoute
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface ContextOptions<
|
|
261
|
-
in out TParentRoute extends AnyRoute,
|
|
262
|
-
in out TParams,
|
|
263
|
-
> {
|
|
264
|
-
abortController: AbortController
|
|
265
|
-
preload: boolean
|
|
266
|
-
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
|
|
267
|
-
location: ParsedLocation
|
|
268
|
-
/**
|
|
269
|
-
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
270
|
-
**/
|
|
271
|
-
navigate: NavigateFn
|
|
272
|
-
buildLocation: BuildLocationFn
|
|
273
|
-
cause: 'preload' | 'enter' | 'stay'
|
|
274
|
-
matches: Array<MakeRouteMatchUnion>
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export interface RouteContextOptions<
|
|
278
|
-
in out TParentRoute extends AnyRoute,
|
|
279
|
-
in out TParams,
|
|
280
|
-
in out TRouterContext,
|
|
281
|
-
in out TLoaderDeps,
|
|
282
|
-
> extends ContextOptions<TParentRoute, TParams> {
|
|
283
|
-
deps: TLoaderDeps
|
|
284
|
-
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export interface BeforeLoadContextOptions<
|
|
288
|
-
in out TParentRoute extends AnyRoute,
|
|
289
|
-
in out TSearchValidator,
|
|
290
|
-
in out TParams,
|
|
291
|
-
in out TRouterContext,
|
|
292
|
-
in out TRouteContextFn,
|
|
293
|
-
> extends ContextOptions<TParentRoute, TParams>,
|
|
294
|
-
FullSearchSchemaOption<TParentRoute, TSearchValidator> {
|
|
295
|
-
context: Expand<
|
|
296
|
-
BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>
|
|
297
|
-
>
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
type AssetFnContextOptions<
|
|
301
|
-
in out TRouteId,
|
|
302
|
-
in out TFullPath,
|
|
303
|
-
in out TParentRoute extends AnyRoute,
|
|
304
|
-
in out TParams,
|
|
305
|
-
in out TSearchValidator,
|
|
306
|
-
in out TLoaderFn,
|
|
307
|
-
in out TRouterContext,
|
|
308
|
-
in out TRouteContextFn,
|
|
309
|
-
in out TBeforeLoadFn,
|
|
310
|
-
in out TLoaderDeps,
|
|
311
|
-
> = {
|
|
312
|
-
matches: Array<
|
|
313
|
-
RouteMatch<
|
|
314
|
-
TRouteId,
|
|
315
|
-
TFullPath,
|
|
316
|
-
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
317
|
-
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
318
|
-
ResolveLoaderData<TLoaderFn>,
|
|
319
|
-
ResolveAllContext<
|
|
320
|
-
TParentRoute,
|
|
321
|
-
TRouterContext,
|
|
322
|
-
TRouteContextFn,
|
|
323
|
-
TBeforeLoadFn
|
|
324
|
-
>,
|
|
325
|
-
TLoaderDeps
|
|
326
|
-
>
|
|
327
|
-
>
|
|
328
|
-
match: RouteMatch<
|
|
329
|
-
TRouteId,
|
|
330
|
-
TFullPath,
|
|
331
|
-
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
332
|
-
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
333
|
-
ResolveLoaderData<TLoaderFn>,
|
|
334
|
-
ResolveAllContext<
|
|
335
|
-
TParentRoute,
|
|
336
|
-
TRouterContext,
|
|
337
|
-
TRouteContextFn,
|
|
338
|
-
TBeforeLoadFn
|
|
339
|
-
>,
|
|
340
|
-
TLoaderDeps
|
|
341
|
-
>
|
|
342
|
-
params: ResolveAllParamsFromParent<TParentRoute, TParams>
|
|
343
|
-
loaderData: ResolveLoaderData<TLoaderFn>
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export interface UpdatableRouteOptions<
|
|
347
|
-
in out TParentRoute extends AnyRoute,
|
|
348
|
-
in out TRouteId,
|
|
349
|
-
in out TFullPath,
|
|
350
|
-
in out TParams,
|
|
351
|
-
in out TSearchValidator,
|
|
352
|
-
in out TLoaderFn,
|
|
353
|
-
in out TLoaderDeps,
|
|
354
|
-
in out TRouterContext,
|
|
355
|
-
in out TRouteContextFn,
|
|
356
|
-
in out TBeforeLoadFn,
|
|
357
|
-
> extends UpdatableStaticRouteOption {
|
|
358
|
-
// If true, this route will be matched as case-sensitive
|
|
359
|
-
caseSensitive?: boolean
|
|
360
|
-
// If true, this route will be forcefully wrapped in a suspense boundary
|
|
361
|
-
wrapInSuspense?: boolean
|
|
362
|
-
// The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`
|
|
363
|
-
component?: RouteComponent
|
|
364
|
-
errorComponent?: false | null | ErrorRouteComponent
|
|
365
|
-
notFoundComponent?: NotFoundRouteComponent
|
|
366
|
-
pendingComponent?: RouteComponent
|
|
367
|
-
pendingMs?: number
|
|
368
|
-
pendingMinMs?: number
|
|
369
|
-
staleTime?: number
|
|
370
|
-
gcTime?: number
|
|
371
|
-
preload?: boolean
|
|
372
|
-
preloadStaleTime?: number
|
|
373
|
-
preloadGcTime?: number
|
|
374
|
-
search?: {
|
|
375
|
-
middlewares?: Array<
|
|
376
|
-
SearchMiddleware<
|
|
377
|
-
ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>
|
|
378
|
-
>
|
|
379
|
-
>
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
@deprecated Use search.middlewares instead
|
|
383
|
-
*/
|
|
384
|
-
preSearchFilters?: Array<
|
|
385
|
-
SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
|
|
386
|
-
>
|
|
387
|
-
/**
|
|
388
|
-
@deprecated Use search.middlewares instead
|
|
389
|
-
*/
|
|
390
|
-
postSearchFilters?: Array<
|
|
391
|
-
SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>
|
|
392
|
-
>
|
|
393
|
-
onCatch?: (error: Error) => void
|
|
394
|
-
onError?: (err: any) => void
|
|
395
|
-
// These functions are called as route matches are loaded, stick around and leave the active
|
|
396
|
-
// matches
|
|
397
|
-
onEnter?: (
|
|
398
|
-
match: RouteMatch<
|
|
399
|
-
TRouteId,
|
|
400
|
-
TFullPath,
|
|
401
|
-
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
402
|
-
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
403
|
-
ResolveLoaderData<TLoaderFn>,
|
|
404
|
-
ResolveAllContext<
|
|
405
|
-
TParentRoute,
|
|
406
|
-
TRouterContext,
|
|
407
|
-
TRouteContextFn,
|
|
408
|
-
TBeforeLoadFn
|
|
409
|
-
>,
|
|
410
|
-
TLoaderDeps
|
|
411
|
-
>,
|
|
412
|
-
) => void
|
|
413
|
-
onStay?: (
|
|
414
|
-
match: RouteMatch<
|
|
415
|
-
TRouteId,
|
|
416
|
-
TFullPath,
|
|
417
|
-
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
418
|
-
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
419
|
-
ResolveLoaderData<TLoaderFn>,
|
|
420
|
-
ResolveAllContext<
|
|
421
|
-
TParentRoute,
|
|
422
|
-
TRouterContext,
|
|
423
|
-
TRouteContextFn,
|
|
424
|
-
TBeforeLoadFn
|
|
425
|
-
>,
|
|
426
|
-
TLoaderDeps
|
|
427
|
-
>,
|
|
428
|
-
) => void
|
|
429
|
-
onLeave?: (
|
|
430
|
-
match: RouteMatch<
|
|
431
|
-
TRouteId,
|
|
432
|
-
TFullPath,
|
|
433
|
-
ResolveAllParamsFromParent<TParentRoute, TParams>,
|
|
434
|
-
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
|
|
435
|
-
ResolveLoaderData<TLoaderFn>,
|
|
436
|
-
ResolveAllContext<
|
|
437
|
-
TParentRoute,
|
|
438
|
-
TRouterContext,
|
|
439
|
-
TRouteContextFn,
|
|
440
|
-
TBeforeLoadFn
|
|
441
|
-
>,
|
|
442
|
-
TLoaderDeps
|
|
443
|
-
>,
|
|
444
|
-
) => void
|
|
445
|
-
headers?: (ctx: {
|
|
446
|
-
loaderData: ResolveLoaderData<TLoaderFn>
|
|
447
|
-
}) => Record<string, string>
|
|
448
|
-
head?: (
|
|
449
|
-
ctx: AssetFnContextOptions<
|
|
450
|
-
TRouteId,
|
|
451
|
-
TFullPath,
|
|
452
|
-
TParentRoute,
|
|
453
|
-
TParams,
|
|
454
|
-
TSearchValidator,
|
|
455
|
-
TLoaderFn,
|
|
456
|
-
TRouterContext,
|
|
457
|
-
TRouteContextFn,
|
|
458
|
-
TBeforeLoadFn,
|
|
459
|
-
TLoaderDeps
|
|
460
|
-
>,
|
|
461
|
-
) => {
|
|
462
|
-
links?: AnyRouteMatch['links']
|
|
463
|
-
scripts?: AnyRouteMatch['headScripts']
|
|
464
|
-
meta?: AnyRouteMatch['meta']
|
|
48
|
+
declare module '@tanstack/router-core' {
|
|
49
|
+
export interface UpdatableRouteOptionsExtensions {
|
|
50
|
+
component?: RouteComponent
|
|
51
|
+
errorComponent?: false | null | ErrorRouteComponent
|
|
52
|
+
notFoundComponent?: NotFoundRouteComponent
|
|
53
|
+
pendingComponent?: RouteComponent
|
|
465
54
|
}
|
|
466
|
-
scripts?: (
|
|
467
|
-
ctx: AssetFnContextOptions<
|
|
468
|
-
TRouteId,
|
|
469
|
-
TFullPath,
|
|
470
|
-
TParentRoute,
|
|
471
|
-
TParams,
|
|
472
|
-
TSearchValidator,
|
|
473
|
-
TLoaderFn,
|
|
474
|
-
TRouterContext,
|
|
475
|
-
TRouteContextFn,
|
|
476
|
-
TBeforeLoadFn,
|
|
477
|
-
TLoaderDeps
|
|
478
|
-
>,
|
|
479
|
-
) => AnyRouteMatch['scripts']
|
|
480
|
-
ssr?: boolean
|
|
481
|
-
codeSplitGroupings?: Array<
|
|
482
|
-
Array<
|
|
483
|
-
| 'loader'
|
|
484
|
-
| 'component'
|
|
485
|
-
| 'pendingComponent'
|
|
486
|
-
| 'notFoundComponent'
|
|
487
|
-
| 'errorComponent'
|
|
488
|
-
>
|
|
489
|
-
>
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
export type RouteLoaderFn<
|
|
493
|
-
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
494
|
-
in out TId extends string = string,
|
|
495
|
-
in out TParams = {},
|
|
496
|
-
in out TLoaderDeps = {},
|
|
497
|
-
in out TRouterContext = {},
|
|
498
|
-
in out TRouteContextFn = AnyContext,
|
|
499
|
-
in out TBeforeLoadFn = AnyContext,
|
|
500
|
-
> = (
|
|
501
|
-
match: LoaderFnContext<
|
|
502
|
-
TParentRoute,
|
|
503
|
-
TId,
|
|
504
|
-
TParams,
|
|
505
|
-
TLoaderDeps,
|
|
506
|
-
TRouterContext,
|
|
507
|
-
TRouteContextFn,
|
|
508
|
-
TBeforeLoadFn
|
|
509
|
-
>,
|
|
510
|
-
) => any
|
|
511
|
-
|
|
512
|
-
export interface LoaderFnContext<
|
|
513
|
-
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
514
|
-
in out TId extends string = string,
|
|
515
|
-
in out TParams = {},
|
|
516
|
-
in out TLoaderDeps = {},
|
|
517
|
-
in out TRouterContext = {},
|
|
518
|
-
in out TRouteContextFn = AnyContext,
|
|
519
|
-
in out TBeforeLoadFn = AnyContext,
|
|
520
|
-
> {
|
|
521
|
-
abortController: AbortController
|
|
522
|
-
preload: boolean
|
|
523
|
-
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
|
|
524
|
-
deps: TLoaderDeps
|
|
525
|
-
context: Expand<
|
|
526
|
-
ResolveAllContext<
|
|
527
|
-
TParentRoute,
|
|
528
|
-
TRouterContext,
|
|
529
|
-
TRouteContextFn,
|
|
530
|
-
TBeforeLoadFn
|
|
531
|
-
>
|
|
532
|
-
>
|
|
533
|
-
location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps
|
|
534
|
-
/**
|
|
535
|
-
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
536
|
-
**/
|
|
537
|
-
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void
|
|
538
|
-
// root route does not have a parent match
|
|
539
|
-
parentMatchPromise: TId extends RootRouteId
|
|
540
|
-
? never
|
|
541
|
-
: Promise<MakeRouteMatchFromRoute<TParentRoute>>
|
|
542
|
-
cause: 'preload' | 'enter' | 'stay'
|
|
543
|
-
route: Route
|
|
544
55
|
}
|
|
545
56
|
|
|
546
57
|
export interface AnyRoute
|
|
@@ -1112,37 +623,6 @@ export function createRoute<
|
|
|
1112
623
|
|
|
1113
624
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>
|
|
1114
625
|
|
|
1115
|
-
export type RootRouteOptions<
|
|
1116
|
-
TSearchValidator = undefined,
|
|
1117
|
-
TRouterContext = {},
|
|
1118
|
-
TRouteContextFn = AnyContext,
|
|
1119
|
-
TBeforeLoadFn = AnyContext,
|
|
1120
|
-
TLoaderDeps extends Record<string, any> = {},
|
|
1121
|
-
TLoaderFn = undefined,
|
|
1122
|
-
> = Omit<
|
|
1123
|
-
RouteOptions<
|
|
1124
|
-
any, // TParentRoute
|
|
1125
|
-
RootRouteId, // TId
|
|
1126
|
-
RootRouteId, // TCustomId
|
|
1127
|
-
'', // TFullPath
|
|
1128
|
-
'', // TPath
|
|
1129
|
-
TSearchValidator,
|
|
1130
|
-
{}, // TParams
|
|
1131
|
-
TLoaderDeps,
|
|
1132
|
-
TLoaderFn,
|
|
1133
|
-
TRouterContext,
|
|
1134
|
-
TRouteContextFn,
|
|
1135
|
-
TBeforeLoadFn
|
|
1136
|
-
>,
|
|
1137
|
-
| 'path'
|
|
1138
|
-
| 'id'
|
|
1139
|
-
| 'getParentRoute'
|
|
1140
|
-
| 'caseSensitive'
|
|
1141
|
-
| 'parseParams'
|
|
1142
|
-
| 'stringifyParams'
|
|
1143
|
-
| 'params'
|
|
1144
|
-
>
|
|
1145
|
-
|
|
1146
626
|
export function createRootRouteWithContext<TRouterContext extends {}>() {
|
|
1147
627
|
return <
|
|
1148
628
|
TRouteContextFn = AnyContext,
|
package/src/router.ts
CHANGED
|
@@ -41,13 +41,18 @@ import type { NoInfer } from '@tanstack/solid-store'
|
|
|
41
41
|
import type {
|
|
42
42
|
AnyContext,
|
|
43
43
|
AnyRedirect,
|
|
44
|
+
AnyRouteMatch,
|
|
44
45
|
AnySchema,
|
|
45
46
|
AnyValidator,
|
|
47
|
+
BeforeLoadContextOptions,
|
|
46
48
|
BuildLocationFn,
|
|
47
49
|
CommitLocationOptions,
|
|
48
50
|
ControlledPromise,
|
|
49
51
|
FullSearchSchema,
|
|
52
|
+
LoaderFnContext,
|
|
50
53
|
MakeRemountDepsOptionsUnion,
|
|
54
|
+
MakeRouteMatch,
|
|
55
|
+
MakeRouteMatchUnion,
|
|
51
56
|
Manifest,
|
|
52
57
|
NavigateFn,
|
|
53
58
|
NavigateOptions,
|
|
@@ -58,6 +63,7 @@ import type {
|
|
|
58
63
|
ResolveRelativePath,
|
|
59
64
|
ResolvedRedirect,
|
|
60
65
|
RouteById,
|
|
66
|
+
RouteContextOptions,
|
|
61
67
|
RoutePaths,
|
|
62
68
|
RoutesById,
|
|
63
69
|
RoutesByPath,
|
|
@@ -72,21 +78,13 @@ import type {
|
|
|
72
78
|
} from '@tanstack/router-core'
|
|
73
79
|
import type {
|
|
74
80
|
AnyRoute,
|
|
75
|
-
BeforeLoadContextOptions,
|
|
76
81
|
ErrorRouteComponent,
|
|
77
|
-
LoaderFnContext,
|
|
78
82
|
NotFoundRouteComponent,
|
|
79
83
|
RootRoute,
|
|
80
84
|
RouteComponent,
|
|
81
|
-
RouteContextOptions,
|
|
82
85
|
RouteMask,
|
|
83
86
|
} from './route'
|
|
84
|
-
import type {
|
|
85
|
-
AnyRouteMatch,
|
|
86
|
-
MakeRouteMatch,
|
|
87
|
-
MakeRouteMatchUnion,
|
|
88
|
-
MatchRouteOptions,
|
|
89
|
-
} from './Matches'
|
|
87
|
+
import type { MatchRouteOptions } from './Matches'
|
|
90
88
|
|
|
91
89
|
import type { NotFoundError } from './not-found'
|
|
92
90
|
|
package/src/useMatch.tsx
CHANGED
|
@@ -3,9 +3,12 @@ import invariant from 'tiny-invariant'
|
|
|
3
3
|
import { useRouterState } from './useRouterState'
|
|
4
4
|
import { dummyMatchContext, matchContext } from './matchContext'
|
|
5
5
|
import type { AnyRouter, RegisteredRouter } from './router'
|
|
6
|
-
import type { MakeRouteMatch, MakeRouteMatchUnion } from './Matches'
|
|
7
6
|
import type { StrictOrFrom } from './utils'
|
|
8
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
MakeRouteMatch,
|
|
9
|
+
MakeRouteMatchUnion,
|
|
10
|
+
ThrowOrOptional,
|
|
11
|
+
} from '@tanstack/router-core'
|
|
9
12
|
|
|
10
13
|
export interface UseMatchBaseOptions<
|
|
11
14
|
TRouter extends AnyRouter,
|