@tanstack/router-core 0.0.1-alpha.9 → 0.0.1-beta.2
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 +28 -23
- package/build/cjs/packages/router-core/src/routeMatch.js.map +1 -1
- package/build/cjs/packages/router-core/src/router.js +180 -194
- package/build/cjs/packages/router-core/src/router.js.map +1 -1
- package/build/esm/index.js +243 -217
- 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 +73 -34
- package/build/umd/index.development.js +243 -217
- 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 +45 -17
- package/src/route.ts +64 -2
- package/src/routeConfig.ts +27 -55
- package/src/routeMatch.ts +45 -32
- package/src/router.ts +303 -279
package/build/types/index.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
|
|
|
102
102
|
route: AnyRoute;
|
|
103
103
|
router: Router<any, any>;
|
|
104
104
|
}) => void;
|
|
105
|
+
createElement?: (element: GetFrameworkGeneric<'SyncOrAsyncElement'>) => Promise<GetFrameworkGeneric<'Element'>>;
|
|
105
106
|
}
|
|
106
107
|
interface Action<TPayload = unknown, TResponse = unknown> {
|
|
107
108
|
submit: (submission?: TPayload) => Promise<TResponse>;
|
|
@@ -116,6 +117,29 @@ interface ActionState<TPayload = unknown, TResponse = unknown> {
|
|
|
116
117
|
data?: TResponse;
|
|
117
118
|
error?: unknown;
|
|
118
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
|
+
}
|
|
119
143
|
interface RouterState {
|
|
120
144
|
status: 'idle' | 'loading';
|
|
121
145
|
location: Location;
|
|
@@ -125,6 +149,7 @@ interface RouterState {
|
|
|
125
149
|
currentAction?: ActionState;
|
|
126
150
|
latestAction?: ActionState;
|
|
127
151
|
actions: Record<string, Action>;
|
|
152
|
+
loaders: Record<string, Loader>;
|
|
128
153
|
pending?: PendingState;
|
|
129
154
|
isFetching: boolean;
|
|
130
155
|
isPreloading: boolean;
|
|
@@ -133,7 +158,7 @@ interface PendingState {
|
|
|
133
158
|
location: Location;
|
|
134
159
|
matches: RouteMatch[];
|
|
135
160
|
}
|
|
136
|
-
declare type Listener = () => void;
|
|
161
|
+
declare type Listener = (router: Router<any, any>) => void;
|
|
137
162
|
declare type ListenerFn = () => void;
|
|
138
163
|
interface BuildNextOptions {
|
|
139
164
|
to?: string | number | null;
|
|
@@ -162,6 +187,7 @@ interface MatchRouteOptions {
|
|
|
162
187
|
caseSensitive?: boolean;
|
|
163
188
|
}
|
|
164
189
|
interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> {
|
|
190
|
+
history: BrowserHistory | MemoryHistory | HashHistory;
|
|
165
191
|
options: PickAsRequired<RouterOptions<TRouteConfig>, 'stringifySearch' | 'parseSearch'>;
|
|
166
192
|
basepath: string;
|
|
167
193
|
allRouteInfo: TAllRouteInfo;
|
|
@@ -184,10 +210,6 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
|
|
|
184
210
|
mount: () => () => void;
|
|
185
211
|
onFocus: () => void;
|
|
186
212
|
update: <TRouteConfig extends RouteConfig = RouteConfig>(opts?: RouterOptions<TRouteConfig>) => Router<TRouteConfig>;
|
|
187
|
-
buildRouteTree: (routeConfig: RouteConfig) => Route<TAllRouteInfo, AnyRouteInfo>;
|
|
188
|
-
parseLocation: (location: History['location'], previousLocation?: Location) => Location;
|
|
189
|
-
buildLocation: (dest: BuildNextOptions) => Location;
|
|
190
|
-
commitLocation: (next: Location, replace?: boolean) => Promise<void>;
|
|
191
213
|
buildNext: (opts: BuildNextOptions) => Location;
|
|
192
214
|
cancelMatches: () => void;
|
|
193
215
|
loadLocation: (next?: Location) => Promise<void>;
|
|
@@ -216,19 +238,25 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
|
|
|
216
238
|
invalidateRoute: (opts: MatchLocation) => void;
|
|
217
239
|
reload: () => Promise<void>;
|
|
218
240
|
resolvePath: (from: string, path: string) => string;
|
|
219
|
-
_navigate: (location: BuildNextOptions & {
|
|
220
|
-
replace?: boolean;
|
|
221
|
-
}) => Promise<void>;
|
|
222
241
|
navigate: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(opts: NavigateOptionsAbsolute<TAllRouteInfo, TFrom, TTo>) => Promise<void>;
|
|
223
242
|
matchRoute: <TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'>(matchLocation: ToOptions<TAllRouteInfo, TFrom, TTo>, opts?: MatchRouteOptions) => boolean;
|
|
224
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
|
+
};
|
|
225
253
|
}
|
|
226
254
|
declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
|
|
227
255
|
|
|
228
256
|
interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
|
|
229
257
|
matchId: string;
|
|
230
258
|
pathname: string;
|
|
231
|
-
params:
|
|
259
|
+
params: TRouteInfo['params'];
|
|
232
260
|
parentMatch?: RouteMatch;
|
|
233
261
|
childMatches: RouteMatch[];
|
|
234
262
|
routeSearch: TRouteInfo['searchSchema'];
|
|
@@ -250,7 +278,6 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
250
278
|
pendingElement?: GetFrameworkGeneric<'Element'>;
|
|
251
279
|
loadPromise?: Promise<void>;
|
|
252
280
|
loaderPromise?: Promise<void>;
|
|
253
|
-
importPromise?: Promise<void>;
|
|
254
281
|
elementsPromise?: Promise<void>;
|
|
255
282
|
dataPromise?: Promise<void>;
|
|
256
283
|
pendingTimeout?: Timeout;
|
|
@@ -269,9 +296,20 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
269
296
|
resolve: () => void;
|
|
270
297
|
};
|
|
271
298
|
cancel: () => void;
|
|
272
|
-
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?: {
|
|
273
311
|
maxAge?: number;
|
|
274
|
-
}) => Promise<
|
|
312
|
+
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
275
313
|
invalidate: () => void;
|
|
276
314
|
hasLoaders: () => boolean;
|
|
277
315
|
}
|
|
@@ -296,6 +334,7 @@ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRo
|
|
|
296
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'];
|
|
297
335
|
navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['id'], TTo>, 'from'>) => Promise<void>;
|
|
298
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']>;
|
|
299
338
|
}
|
|
300
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>;
|
|
301
340
|
declare function cascadeLoaderData(matches: RouteMatch<any, any>[]): void;
|
|
@@ -381,11 +420,12 @@ declare type DefinedPathParamWarning = 'Path params cannot be redefined by child
|
|
|
381
420
|
declare type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
382
421
|
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
383
422
|
};
|
|
384
|
-
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 = {}> {
|
|
385
425
|
params: TAllParams;
|
|
386
426
|
search: TFullSearchSchema;
|
|
387
427
|
signal?: AbortSignal;
|
|
388
|
-
}
|
|
428
|
+
}
|
|
389
429
|
declare type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (submission: TActionPayload) => TActionResponse | Promise<TActionResponse>;
|
|
390
430
|
declare type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, RouteInfo<string, TPath>>) => void;
|
|
391
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 = {}> = ({
|
|
@@ -399,18 +439,6 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
|
|
|
399
439
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
400
440
|
pendingMs?: number;
|
|
401
441
|
pendingMinMs?: number;
|
|
402
|
-
} & ({
|
|
403
|
-
parseParams?: never;
|
|
404
|
-
stringifyParams?: never;
|
|
405
|
-
} | {
|
|
406
|
-
parseParams: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams;
|
|
407
|
-
stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
|
|
408
|
-
}) & RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams> & {
|
|
409
|
-
import?: (opts: {
|
|
410
|
-
params: AnyPathParams;
|
|
411
|
-
}) => Promise<RouteLoaders<TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TFullSearchSchema, TAllParams>>;
|
|
412
|
-
} & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
|
|
413
|
-
interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
414
442
|
element?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
415
443
|
errorElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
416
444
|
catchElement?: GetFrameworkGeneric<'SyncOrAsyncElement'>;
|
|
@@ -432,7 +460,13 @@ interface RouteLoaders<TRouteLoaderData extends AnyLoaderData = {}, TLoaderData
|
|
|
432
460
|
search: TFullSearchSchema;
|
|
433
461
|
}) => void;
|
|
434
462
|
meta?: RouteMeta;
|
|
435
|
-
}
|
|
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!');
|
|
436
470
|
declare type SearchFilter<T, U = T> = (prev: T) => U;
|
|
437
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> {
|
|
438
472
|
id: TId;
|
|
@@ -480,7 +514,7 @@ declare type LinkInfo = {
|
|
|
480
514
|
};
|
|
481
515
|
declare type StartsWith<A, B> = A extends `${B extends string ? B : never}${infer _}` ? true : false;
|
|
482
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;
|
|
483
|
-
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;
|
|
484
518
|
declare type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `:${infer V}` ? V : never : never;
|
|
485
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;
|
|
486
520
|
declare type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
|
|
@@ -501,7 +535,7 @@ declare type ToOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteIn
|
|
|
501
535
|
to?: ToPathOption<TAllRouteInfo, TFrom, TTo>;
|
|
502
536
|
hash?: Updater<string>;
|
|
503
537
|
from?: TFrom;
|
|
504
|
-
} & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo
|
|
538
|
+
} & CheckPath<TAllRouteInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TAllRouteInfo, TFrom, TResolvedTo> & PathParamOptions<TAllRouteInfo, TFrom, TResolvedTo>;
|
|
505
539
|
declare type SearchParamOptions<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo, TFromSchema = RouteInfoByPath<TAllRouteInfo, TFrom>['fullSearchSchema'], TToSchema = RouteInfoByPath<TAllRouteInfo, TTo>['fullSearchSchema']> = StartsWith<TFrom, TTo> extends true ? {
|
|
506
540
|
search?: SearchReducer<TFromSchema, TToSchema>;
|
|
507
541
|
} : keyof PickRequired<TToSchema> extends never ? {
|
|
@@ -539,12 +573,17 @@ declare type CheckRelativePath<TAllRouteInfo extends AnyAllRouteInfo, TFrom, TTo
|
|
|
539
573
|
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
|
|
540
574
|
'Valid Route Paths': TAllRouteInfo['routePaths'];
|
|
541
575
|
} : {} : {};
|
|
542
|
-
declare type CheckPath<TAllRouteInfo extends AnyAllRouteInfo, TPath> = Exclude<TPath, TAllRouteInfo['routePaths']> extends never ?
|
|
543
|
-
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<{
|
|
544
578
|
Error: `${TInvalids extends string ? TInvalids : never} is not a valid route path.`;
|
|
545
579
|
'Valid Route Paths': TAllRouteInfo['routePaths'];
|
|
546
|
-
}
|
|
547
|
-
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;
|
|
548
587
|
declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['routePaths'] ? string : TAllRouteInfo['routePaths']);
|
|
549
588
|
|
|
550
589
|
interface Segment {
|
|
@@ -570,4 +609,4 @@ declare const defaultStringifySearch: (search: Record<string, any>) => string;
|
|
|
570
609
|
declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
|
|
571
610
|
declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
|
|
572
611
|
|
|
573
|
-
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 };
|