@tanstack/router-core 0.0.1-alpha.8 → 0.0.1-beta.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/build/cjs/packages/router-core/src/route.js +35 -0
- package/build/cjs/packages/router-core/src/route.js.map +1 -1
- package/build/cjs/packages/router-core/src/routeConfig.js.map +1 -1
- package/build/cjs/packages/router-core/src/routeMatch.js +33 -27
- package/build/cjs/packages/router-core/src/routeMatch.js.map +1 -1
- package/build/cjs/packages/router-core/src/router.js +214 -211
- package/build/cjs/packages/router-core/src/router.js.map +1 -1
- package/build/esm/index.js +282 -238
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +136 -136
- package/build/types/index.d.ts +85 -37
- package/build/umd/index.development.js +282 -238
- 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 +1 -1
- package/src/frameworks.ts +0 -1
- package/src/link.ts +48 -18
- package/src/route.ts +64 -2
- package/src/routeConfig.ts +27 -55
- package/src/routeMatch.ts +54 -37
- package/src/router.ts +347 -301
package/build/types/index.d.ts
CHANGED
|
@@ -81,9 +81,10 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
|
|
|
81
81
|
stringifySearch?: SearchSerializer;
|
|
82
82
|
parseSearch?: SearchParser;
|
|
83
83
|
filterRoutes?: FilterRoutesFn;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
defaultPreload?: false | 'intent';
|
|
85
|
+
defaultPreloadMaxAge?: number;
|
|
86
|
+
defaultPreloadGcMaxAge?: number;
|
|
87
|
+
defaultPreloadDelay?: number;
|
|
87
88
|
useErrorBoundary?: boolean;
|
|
88
89
|
defaultElement?: GetFrameworkGeneric<'Element'>;
|
|
89
90
|
defaultErrorElement?: GetFrameworkGeneric<'Element'>;
|
|
@@ -101,6 +102,7 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
|
|
|
101
102
|
route: AnyRoute;
|
|
102
103
|
router: Router<any, any>;
|
|
103
104
|
}) => void;
|
|
105
|
+
createElement?: (element: GetFrameworkGeneric<'Element'> | (() => Promise<GetFrameworkGeneric<'Element'>>)) => Promise<GetFrameworkGeneric<'Element'>>;
|
|
104
106
|
}
|
|
105
107
|
interface Action<TPayload = unknown, TResponse = unknown> {
|
|
106
108
|
submit: (submission?: TPayload) => Promise<TResponse>;
|
|
@@ -115,6 +117,29 @@ interface ActionState<TPayload = unknown, TResponse = unknown> {
|
|
|
115
117
|
data?: TResponse;
|
|
116
118
|
error?: unknown;
|
|
117
119
|
}
|
|
120
|
+
interface Loader<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}, TRouteLoaderData = AnyLoaderData> {
|
|
121
|
+
fetch: keyof PickRequired<TFullSearchSchema> extends never ? keyof TAllParams extends never ? (loaderContext: {
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
}) => Promise<TRouteLoaderData> : (loaderContext: {
|
|
124
|
+
params: TAllParams;
|
|
125
|
+
search?: TFullSearchSchema;
|
|
126
|
+
signal?: AbortSignal;
|
|
127
|
+
}) => Promise<TRouteLoaderData> : keyof TAllParams extends never ? (loaderContext: {
|
|
128
|
+
search: TFullSearchSchema;
|
|
129
|
+
params: TAllParams;
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
}) => Promise<TRouteLoaderData> : (loaderContext: {
|
|
132
|
+
search: TFullSearchSchema;
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
}) => Promise<TRouteLoaderData>;
|
|
135
|
+
current?: LoaderState<TFullSearchSchema, TAllParams>;
|
|
136
|
+
latest?: LoaderState<TFullSearchSchema, TAllParams>;
|
|
137
|
+
pending: LoaderState<TFullSearchSchema, TAllParams>[];
|
|
138
|
+
}
|
|
139
|
+
interface LoaderState<TFullSearchSchema = unknown, TAllParams = unknown> {
|
|
140
|
+
loadedAt: number;
|
|
141
|
+
loaderContext: LoaderContext<TFullSearchSchema, TAllParams>;
|
|
142
|
+
}
|
|
118
143
|
interface RouterState {
|
|
119
144
|
status: 'idle' | 'loading';
|
|
120
145
|
location: Location;
|
|
@@ -124,6 +149,7 @@ interface RouterState {
|
|
|
124
149
|
currentAction?: ActionState;
|
|
125
150
|
latestAction?: ActionState;
|
|
126
151
|
actions: Record<string, Action>;
|
|
152
|
+
loaders: Record<string, Loader>;
|
|
127
153
|
pending?: PendingState;
|
|
128
154
|
isFetching: boolean;
|
|
129
155
|
isPreloading: boolean;
|
|
@@ -161,6 +187,7 @@ interface MatchRouteOptions {
|
|
|
161
187
|
caseSensitive?: boolean;
|
|
162
188
|
}
|
|
163
189
|
interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
|
|
190
|
+
history: BrowserHistory | MemoryHistory | HashHistory;
|
|
164
191
|
options: PickAsRequired<RouterOptions<TRouteConfig>, 'stringifySearch' | 'parseSearch'>;
|
|
165
192
|
basepath: string;
|
|
166
193
|
allRouteInfo: TAllRouteInfo;
|
|
@@ -183,18 +210,16 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
|
|
|
183
210
|
mount: () => () => void;
|
|
184
211
|
onFocus: () => void;
|
|
185
212
|
update: <TRouteConfig extends RouteConfig = RouteConfig>(opts?: RouterOptions<TRouteConfig>) => Router<TRouteConfig>;
|
|
186
|
-
buildRouteTree: (routeConfig: RouteConfig) => Route<TAllRouteInfo, AnyRouteInfo>;
|
|
187
|
-
parseLocation: (location: History['location'], previousLocation?: Location) => Location;
|
|
188
|
-
buildLocation: (dest: BuildNextOptions) => Location;
|
|
189
|
-
commitLocation: (next: Location, replace?: boolean) => Promise<void>;
|
|
190
213
|
buildNext: (opts: BuildNextOptions) => Location;
|
|
191
214
|
cancelMatches: () => void;
|
|
192
215
|
loadLocation: (next?: Location) => Promise<void>;
|
|
193
216
|
matchCache: Record<string, MatchCacheEntry>;
|
|
194
217
|
cleanMatchCache: () => void;
|
|
195
218
|
getRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(id: TId) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
|
|
196
|
-
loadRoute: (navigateOpts: BuildNextOptions
|
|
197
|
-
|
|
219
|
+
loadRoute: (navigateOpts: BuildNextOptions) => Promise<RouteMatch[]>;
|
|
220
|
+
preloadRoute: (navigateOpts: BuildNextOptions, loaderOpts: {
|
|
221
|
+
maxAge?: number;
|
|
222
|
+
gcMaxAge?: number;
|
|
198
223
|
}) => Promise<RouteMatch[]>;
|
|
199
224
|
matchRoutes: (pathname: string, opts?: {
|
|
200
225
|
strictParseParams?: boolean;
|
|
@@ -204,26 +229,34 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
|
|
|
204
229
|
} & ({
|
|
205
230
|
preload: true;
|
|
206
231
|
maxAge: number;
|
|
232
|
+
gcMaxAge: number;
|
|
207
233
|
} | {
|
|
208
234
|
preload?: false;
|
|
209
235
|
maxAge?: never;
|
|
236
|
+
gcMaxAge?: never;
|
|
210
237
|
})) => Promise<void>;
|
|
211
238
|
invalidateRoute: (opts: MatchLocation) => void;
|
|
212
239
|
reload: () => Promise<void>;
|
|
213
240
|
resolvePath: (from: string, path: string) => string;
|
|
214
|
-
_navigate: (location: BuildNextOptions & {
|
|
215
|
-
replace?: boolean;
|
|
216
|
-
}) => Promise<void>;
|
|
217
241
|
navigate: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(opts: NavigateOptionsAbsolute<TAllRouteInfo, TFrom, TTo>) => Promise<void>;
|
|
218
242
|
matchRoute: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(matchLocation: ToOptions<TAllRouteInfo, TFrom, TTo>, opts?: MatchRouteOptions) => boolean;
|
|
219
243
|
buildLink: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(opts: LinkOptions<TAllRouteInfo, TFrom, TTo>) => LinkInfo;
|
|
244
|
+
__: {
|
|
245
|
+
buildRouteTree: (routeConfig: RouteConfig) => Route<TAllRouteInfo, AnyRouteInfo>;
|
|
246
|
+
parseLocation: (location: History['location'], previousLocation?: Location) => Location;
|
|
247
|
+
buildLocation: (dest: BuildNextOptions) => Location;
|
|
248
|
+
commitLocation: (next: Location, replace?: boolean) => Promise<void>;
|
|
249
|
+
navigate: (location: BuildNextOptions & {
|
|
250
|
+
replace?: boolean;
|
|
251
|
+
}) => Promise<void>;
|
|
252
|
+
};
|
|
220
253
|
}
|
|
221
254
|
declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
|
|
222
255
|
|
|
223
256
|
interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
|
|
224
257
|
matchId: string;
|
|
225
258
|
pathname: string;
|
|
226
|
-
params:
|
|
259
|
+
params: TRouteInfo['params'];
|
|
227
260
|
parentMatch?: RouteMatch;
|
|
228
261
|
childMatches: RouteMatch[];
|
|
229
262
|
routeSearch: TRouteInfo['searchSchema'];
|
|
@@ -237,6 +270,7 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
237
270
|
routeLoaderData: TRouteInfo['routeLoaderData'];
|
|
238
271
|
isFetching: boolean;
|
|
239
272
|
isPending: boolean;
|
|
273
|
+
invalidAt: number;
|
|
240
274
|
__: {
|
|
241
275
|
element?: GetFrameworkGeneric<'Element'>;
|
|
242
276
|
errorElement?: GetFrameworkGeneric<'Element'>;
|
|
@@ -244,7 +278,6 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
244
278
|
pendingElement?: GetFrameworkGeneric<'Element'>;
|
|
245
279
|
loadPromise?: Promise<void>;
|
|
246
280
|
loaderPromise?: Promise<void>;
|
|
247
|
-
importPromise?: Promise<void>;
|
|
248
281
|
elementsPromise?: Promise<void>;
|
|
249
282
|
dataPromise?: Promise<void>;
|
|
250
283
|
pendingTimeout?: Timeout;
|
|
@@ -263,7 +296,20 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
263
296
|
resolve: () => void;
|
|
264
297
|
};
|
|
265
298
|
cancel: () => void;
|
|
266
|
-
load: (
|
|
299
|
+
load: (loaderOpts?: {
|
|
300
|
+
withPending?: boolean;
|
|
301
|
+
} & ({
|
|
302
|
+
preload: true;
|
|
303
|
+
maxAge: number;
|
|
304
|
+
gcMaxAge: number;
|
|
305
|
+
} | {
|
|
306
|
+
preload?: false;
|
|
307
|
+
maxAge?: never;
|
|
308
|
+
gcMaxAge?: never;
|
|
309
|
+
})) => Promise<TRouteInfo['routeLoaderData']>;
|
|
310
|
+
fetch: (opts?: {
|
|
311
|
+
maxAge?: number;
|
|
312
|
+
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
267
313
|
invalidate: () => void;
|
|
268
314
|
hasLoaders: () => boolean;
|
|
269
315
|
}
|
|
@@ -288,6 +334,7 @@ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRo
|
|
|
288
334
|
matchRoute: <TTo extends string = '.', TResolved extends string = ResolveRelativePath<TRouteInfo['id'], TTo>>(matchLocation: CheckRelativePath<TAllRouteInfo, TRouteInfo['fullPath'], NoInfer<TTo>> & Omit<ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>, opts?: MatchRouteOptions) => RouteInfoByPath<TAllRouteInfo, TResolved>['allParams'];
|
|
289
335
|
navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['id'], TTo>, 'from'>) => Promise<void>;
|
|
290
336
|
action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
|
|
337
|
+
loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
|
|
291
338
|
}
|
|
292
339
|
declare function createRoute<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(routeConfig: RouteConfig, options: TRouteInfo['options'], parent: undefined | Route<TAllRouteInfo, any>, router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo>): Route<TAllRouteInfo, TRouteInfo>;
|
|
293
340
|
declare function cascadeLoaderData(matches: RouteMatch<any, any>[]): void;
|
|
@@ -373,11 +420,12 @@ declare type DefinedPathParamWarning = 'Path params cannot be redefined by child
|
|
|
373
420
|
declare type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
374
421
|
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
375
422
|
};
|
|
376
|
-
declare type LoaderFn<TRouteLoaderData extends AnyLoaderData, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext:
|
|
423
|
+
declare type LoaderFn<TRouteLoaderData extends AnyLoaderData, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TFullSearchSchema, TAllParams>) => Promise<TRouteLoaderData>;
|
|
424
|
+
interface LoaderContext<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
377
425
|
params: TAllParams;
|
|
378
426
|
search: TFullSearchSchema;
|
|
379
427
|
signal?: AbortSignal;
|
|
380
|
-
}
|
|
428
|
+
}
|
|
381
429
|
declare type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (submission: TActionPayload) => TActionResponse | Promise<TActionResponse>;
|
|
382
430
|
declare type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, RouteInfo<string, TPath>>) => void;
|
|
383
431
|
declare type RouteOptions<TRouteId extends string = string, TPath extends string = string, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
|
|
@@ -391,18 +439,6 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
|
|
|
391
439
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
392
440
|
pendingMs?: number;
|
|
393
441
|
pendingMinMs?: number;
|
|
394
|
-
} & ({
|
|
395
|
-
parseParams?: never;
|
|
396
|
-
stringifyParams?: never;
|
|
397
|
-
} | {
|
|
398
|
-
parseParams: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams;
|
|
399
|
-
stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
|
|
400
|
-
}) & RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams> & {
|
|
401
|
-
import?: (opts: {
|
|
402
|
-
params: AnyPathParams;
|
|
403
|
-
}) => Promise<RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams>>;
|
|
404
|
-
} & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
|
|
405
|
-
interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
406
442
|
element?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
407
443
|
errorElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
408
444
|
catchElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
@@ -424,7 +460,13 @@ interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData
|
|
|
424
460
|
search: TFullSearchSchema;
|
|
425
461
|
}) => void;
|
|
426
462
|
meta?: RouteMeta;
|
|
427
|
-
}
|
|
463
|
+
} & ({
|
|
464
|
+
parseParams?: never;
|
|
465
|
+
stringifyParams?: never;
|
|
466
|
+
} | {
|
|
467
|
+
parseParams: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams;
|
|
468
|
+
stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
|
|
469
|
+
}) & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
|
|
428
470
|
declare type SearchFilter<T, U = T> = (prev: T) => U;
|
|
429
471
|
interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
|
|
430
472
|
id: TId;
|
|
@@ -472,7 +514,7 @@ declare type LinkInfo = {
|
|
|
472
514
|
};
|
|
473
515
|
declare type StartsWith<A, B> = A extends `${B extends string ? B : never}${infer _}` ? true : false;
|
|
474
516
|
declare type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
|
|
475
|
-
declare type Split<S,
|
|
517
|
+
declare type Split<S, TIncludeTrailingSlash = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TIncludeTrailingSlash extends true ? CleanPath<S> extends `${infer T}/` ? [...Split<T>, '/'] : CleanPath<S> extends `/${infer U}` ? Split<U> : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : S extends string ? [S] : never : never : never;
|
|
476
518
|
declare type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `:${infer V}` ? V : never : never;
|
|
477
519
|
declare type Join<T> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}/${Join<Tail>}`> : never;
|
|
478
520
|
declare type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
|
|
@@ -493,7 +535,7 @@ declare type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteIn
|
|
|
493
535
|
to?: ToPathOption<TAllRouteInfo, TFrom, TTo>;
|
|
494
536
|
hash?: Updater<string>;
|
|
495
537
|
from?: TFrom;
|
|
496
|
-
} & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo
|
|
538
|
+
} & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
|
|
497
539
|
declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
|
|
498
540
|
search?: SearchReducer<TFromSchema, TToSchema>;
|
|
499
541
|
} : keyof PickRequired<TToSchema> extends never ? {
|
|
@@ -523,6 +565,7 @@ declare type LinkOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRoute
|
|
|
523
565
|
activeOptions?: ActiveOptions;
|
|
524
566
|
preload?: false | 'intent';
|
|
525
567
|
preloadMaxAge?: number;
|
|
568
|
+
preloadGcMaxAge?: number;
|
|
526
569
|
preloadDelay?: number;
|
|
527
570
|
disabled?: boolean;
|
|
528
571
|
};
|
|
@@ -530,12 +573,17 @@ declare type CheckRelativePath<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo
|
|
|
530
573
|
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
|
|
531
574
|
'Valid Route Paths': TAllRouteInfo['routePaths'];
|
|
532
575
|
} : {} : {};
|
|
533
|
-
declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ?
|
|
534
|
-
declare type CheckPathError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = {
|
|
576
|
+
declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath, TPass> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ? TPass : CheckPathError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routePaths']>>;
|
|
577
|
+
declare type CheckPathError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = Expand<{
|
|
535
578
|
Error: `${TInvalids extends string ? TInvalids : never} is not a valid route path.`;
|
|
536
579
|
'Valid Route Paths': TAllRouteInfo['routePaths'];
|
|
537
|
-
}
|
|
538
|
-
declare type
|
|
580
|
+
}>;
|
|
581
|
+
declare type CheckId<TAllRouteInfo extends AnyAllRouteInfo, TPath, TPass> = Exclude<TPath, TAllRouteInfo['routeIds']> extends never ? TPass : CheckIdError<TAllRouteInfo, Exclude<TPath, TAllRouteInfo['routeIds']>>;
|
|
582
|
+
declare type CheckIdError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = Expand<{
|
|
583
|
+
Error: `${TInvalids extends string ? TInvalids : never} is not a valid route ID.`;
|
|
584
|
+
'Valid Route IDs': TAllRouteInfo['routeIds'];
|
|
585
|
+
}>;
|
|
586
|
+
declare type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ToRest extends ['/'] ? Join<[...FromRest, '/']> : ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ToRest extends ['/'] ? Join<[TFrom, '/']> : ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
|
|
539
587
|
declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['routePaths'] ? string : TAllRouteInfo['routePaths']);
|
|
540
588
|
|
|
541
589
|
interface Segment {
|
|
@@ -561,4 +609,4 @@ declare const defaultStringifySearch: (search: Record<string, any>) => string;
|
|
|
561
609
|
declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
|
|
562
610
|
declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
|
|
563
611
|
|
|
564
|
-
export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderFn, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath,
|
|
612
|
+
export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, Loader, LoaderContext, LoaderFn, LoaderState, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesById, RoutesInfoInner, SearchFilter, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cascadeLoaderData, cleanPath, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
|