@tanstack/react-router 1.0.9 → 1.1.0
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/fileRoute.js.map +1 -1
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +351 -351
- package/build/types/fileRoute.d.ts +3 -3
- package/build/types/link.d.ts +5 -4
- package/build/types/route.d.ts +33 -17
- package/build/types/routeInfo.d.ts +1 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/fileRoute.ts +20 -0
- package/src/link.tsx +11 -8
- package/src/route.ts +95 -10
- package/src/routeInfo.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParsePathParams } from './link';
|
|
2
|
-
import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints } from './route';
|
|
2
|
+
import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints, ResolveFullSearchSchemaInput, SearchSchemaInput } from './route';
|
|
3
3
|
import { Assign, Expand, IsAny } from './utils';
|
|
4
4
|
export interface FileRoutesByPath {
|
|
5
5
|
}
|
|
@@ -13,7 +13,7 @@ export type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends strin
|
|
|
13
13
|
export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
|
|
14
14
|
path: TFilePath;
|
|
15
15
|
constructor(path: TFilePath);
|
|
16
|
-
createRoute: <TSearchSchema extends import("./route").AnySearchSchema = {}, TFullSearchSchema extends import("./route").AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends Record<string, any> = MergeFromFromParent<TParentRoute["types"]["allParams"], TParams>, TRouteContext extends RouteContext = RouteContext, TContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & {
|
|
16
|
+
createRoute: <TSearchSchemaInput extends import("./route").AnySearchSchema = {}, TSearchSchema extends import("./route").AnySearchSchema = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? TSearchSchemaInput : TSearchSchema, TFullSearchSchemaInput extends import("./route").AnySearchSchema = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends import("./route").AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends Record<string, any> = MergeFromFromParent<TParentRoute["types"]["allParams"], TParams>, TRouteContext extends RouteContext = RouteContext, TContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & {
|
|
17
17
|
meta?: import("./route").RouteMeta | undefined;
|
|
18
18
|
} & {
|
|
19
19
|
caseSensitive?: boolean | undefined;
|
|
@@ -33,6 +33,6 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
|
|
|
33
33
|
onEnter?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
|
|
34
34
|
onStay?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
|
|
35
35
|
onLeave?: ((match: import("./Matches").AnyRouteMatch) => void) | undefined;
|
|
36
|
-
}) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
|
|
36
|
+
}) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
package/build/types/link.d.ts
CHANGED
|
@@ -44,16 +44,17 @@ export type ToSubOptions<TRouteTree extends AnyRoute = RegisteredRouter['routeTr
|
|
|
44
44
|
from?: TFrom;
|
|
45
45
|
} & CheckPath<TRouteTree, NoInfer<TResolved>, {}> & SearchParamOptions<TRouteTree, TFrom, TTo, TResolved> & PathParamOptions<TRouteTree, TFrom, TTo, TResolved>;
|
|
46
46
|
type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
|
|
47
|
-
|
|
48
|
-
type
|
|
47
|
+
type ParamVariant = 'PATH' | 'SEARCH';
|
|
48
|
+
export type ParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved, TParamVariant extends ParamVariant, TFromRouteType extends 'allParams' | 'fullSearchSchema' = TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema', TToRouteType extends 'allParams' | 'fullSearchSchemaInput' = TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput', TFromParams = Expand<RouteByPath<TRouteTree, TFrom>['types'][TFromRouteType]>, TToParams = TTo extends '' ? TFromParams : never extends TResolved ? Expand<RouteByPath<TRouteTree, TTo>['types'][TToRouteType]> : Expand<RouteByPath<TRouteTree, TResolved>['types'][TToRouteType]>, TReducer = ParamsReducer<TFromParams, TToParams>> = Expand<WithoutEmpty<PickRequired<TToParams>>> extends never ? Partial<MakeParamOption<TParamVariant, true | TReducer>> : TFromParams extends Expand<WithoutEmpty<PickRequired<TToParams>>> ? MakeParamOption<TParamVariant, true | TReducer> : MakeParamOption<TParamVariant, TReducer>;
|
|
49
|
+
type MakeParamOption<TParamVariant extends ParamVariant, T> = TParamVariant extends 'PATH' ? MakePathParamOptions<T> : MakeSearchParamOptions<T>;
|
|
49
50
|
type MakeSearchParamOptions<T> = {
|
|
50
51
|
search: T;
|
|
51
52
|
};
|
|
52
53
|
type MakePathParamOptions<T> = {
|
|
53
54
|
params: T;
|
|
54
55
|
};
|
|
55
|
-
export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved> = ParamOptions<TRouteTree, TFrom, TTo, TResolved, '
|
|
56
|
-
export type PathParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved> = ParamOptions<TRouteTree, TFrom, TTo, TResolved, '
|
|
56
|
+
export type SearchParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved> = ParamOptions<TRouteTree, TFrom, TTo, TResolved, 'SEARCH'>;
|
|
57
|
+
export type PathParamOptions<TRouteTree extends AnyRoute, TFrom, TTo, TResolved> = ParamOptions<TRouteTree, TFrom, TTo, TResolved, 'PATH'>;
|
|
57
58
|
export type ToPathOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RoutePaths<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
58
59
|
export type ToIdOption<TRouteTree extends AnyRoute = AnyRoute, TFrom extends RoutePaths<TRouteTree> | undefined = undefined, TTo extends string = ''> = TTo | RelativeToPathAutoComplete<RouteIds<TRouteTree>, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
59
60
|
export interface ActiveOptions {
|
package/build/types/route.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ import { BuildLocationFn, NavigateFn } from './RouterProvider';
|
|
|
9
9
|
export declare const rootRouteId: "__root__";
|
|
10
10
|
export type RootRouteId = typeof rootRouteId;
|
|
11
11
|
export type AnyPathParams = {};
|
|
12
|
+
export type SearchSchemaInput = {
|
|
13
|
+
__TSearchSchemaInput__: 'TSearchSchemaInput';
|
|
14
|
+
};
|
|
12
15
|
export type AnySearchSchema = {};
|
|
13
16
|
export type AnyContext = {};
|
|
14
17
|
export interface RouteContext {
|
|
@@ -29,11 +32,11 @@ export type MetaOptions = keyof PickRequired<RouteMeta> extends never ? {
|
|
|
29
32
|
} : {
|
|
30
33
|
meta: RouteMeta;
|
|
31
34
|
};
|
|
32
|
-
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>>;
|
|
35
|
+
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>>;
|
|
33
36
|
export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
34
|
-
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = RoutePathOptions<TCustomId, TPath> & {
|
|
37
|
+
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = RoutePathOptions<TCustomId, TPath> & {
|
|
35
38
|
getParentRoute: () => TParentRoute;
|
|
36
|
-
validateSearch?: SearchSchemaValidator<TSearchSchema>;
|
|
39
|
+
validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>;
|
|
37
40
|
shouldReload?: boolean | ((match: LoaderFnContext<TAllParams, TFullSearchSchema, TAllContext, TRouteContext>) => any);
|
|
38
41
|
} & (keyof PickRequired<RouteContext> extends never ? {
|
|
39
42
|
beforeLoad?: BeforeLoadFn<TFullSearchSchema, TParentRoute, TAllParams, TRouteContext>;
|
|
@@ -86,11 +89,11 @@ export type ParseParamsFn<TPath extends string, TParams> = (rawParams: IsAny<TPa
|
|
|
86
89
|
export type ParseParamsObj<TPath extends string, TParams> = {
|
|
87
90
|
parse?: ParseParamsFn<TPath, TParams>;
|
|
88
91
|
};
|
|
89
|
-
export type SearchSchemaValidator<TReturn> = SearchSchemaValidatorObj<TReturn> | SearchSchemaValidatorFn<TReturn>;
|
|
90
|
-
export type SearchSchemaValidatorObj<TReturn> = {
|
|
91
|
-
parse?: SearchSchemaValidatorFn<TReturn>;
|
|
92
|
+
export type SearchSchemaValidator<TInput, TReturn> = SearchSchemaValidatorObj<TInput, TReturn> | SearchSchemaValidatorFn<TInput, TReturn>;
|
|
93
|
+
export type SearchSchemaValidatorObj<TInput, TReturn> = {
|
|
94
|
+
parse?: SearchSchemaValidatorFn<TInput, TReturn>;
|
|
92
95
|
};
|
|
93
|
-
export type SearchSchemaValidatorFn<TReturn> = (searchObj:
|
|
96
|
+
export type SearchSchemaValidatorFn<TInput, TReturn> = (searchObj: TInput) => TReturn;
|
|
94
97
|
export type DefinedPathParamWarning = 'Path params cannot be redefined by child routes!';
|
|
95
98
|
export type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
96
99
|
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
@@ -116,8 +119,14 @@ export type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
|
116
119
|
fullSearchSchema: infer TFullSearchSchema;
|
|
117
120
|
};
|
|
118
121
|
} ? TFullSearchSchema : {};
|
|
122
|
+
export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
|
|
123
|
+
types: {
|
|
124
|
+
fullSearchSchemaInput: infer TFullSearchSchemaInput;
|
|
125
|
+
};
|
|
126
|
+
} ? TFullSearchSchemaInput : {};
|
|
119
127
|
export type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<Assign<InferFullSearchSchema<TParentRoute>, TSearchSchema>>;
|
|
120
|
-
export
|
|
128
|
+
export type ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed> = Expand<Assign<InferFullSearchSchemaInput<TParentRoute>, TSearchSchemaUsed>>;
|
|
129
|
+
export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
121
130
|
}
|
|
122
131
|
export type MergeFromFromParent<T, U> = IsAny<T, U, T & U>;
|
|
123
132
|
export type ResolveAllParams<TParentRoute extends AnyRoute, TParams extends AnyPathParams> = Record<never, string> extends TParentRoute['types']['allParams'] ? TParams : Expand<UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}>;
|
|
@@ -162,9 +171,9 @@ export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']
|
|
|
162
171
|
select?: ((s: TLoaderData) => TSelected) | undefined;
|
|
163
172
|
} | undefined) => TSelected;
|
|
164
173
|
}
|
|
165
|
-
export declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<TParentRoute, TParams>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
174
|
+
export declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema, TFullSearchSchemaInput extends Record<string, any> = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<TParentRoute, TParams>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
166
175
|
isRoot: TParentRoute extends Route<any> ? true : false;
|
|
167
|
-
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>;
|
|
176
|
+
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>;
|
|
168
177
|
test: Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>;
|
|
169
178
|
parentRoute: TParentRoute;
|
|
170
179
|
id: TId;
|
|
@@ -175,7 +184,7 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
175
184
|
originalIndex?: number;
|
|
176
185
|
router?: AnyRouter;
|
|
177
186
|
rank: number;
|
|
178
|
-
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>);
|
|
187
|
+
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>);
|
|
179
188
|
types: {
|
|
180
189
|
parentRoute: TParentRoute;
|
|
181
190
|
path: TPath;
|
|
@@ -184,7 +193,10 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
184
193
|
customId: TCustomId;
|
|
185
194
|
id: TId;
|
|
186
195
|
searchSchema: TSearchSchema;
|
|
196
|
+
searchSchemaInput: TSearchSchemaInput;
|
|
197
|
+
searchSchemaUsed: TSearchSchemaUsed;
|
|
187
198
|
fullSearchSchema: TFullSearchSchema;
|
|
199
|
+
fullSearchSchemaInput: TFullSearchSchemaInput;
|
|
188
200
|
params: TParams;
|
|
189
201
|
allParams: TAllParams;
|
|
190
202
|
routeContext: TRouteContext;
|
|
@@ -198,7 +210,7 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
198
210
|
init: (opts: {
|
|
199
211
|
originalIndex: number;
|
|
200
212
|
}) => void;
|
|
201
|
-
addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TNewChildren, TRouteTree>;
|
|
213
|
+
addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TNewChildren, TRouteTree>;
|
|
202
214
|
update: (options: UpdatableRouteOptions<TFullSearchSchema>) => this;
|
|
203
215
|
useMatch: <TSelected = TAllContext>(opts?: {
|
|
204
216
|
select?: ((search: TAllContext) => TSelected) | undefined;
|
|
@@ -219,14 +231,16 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
219
231
|
select?: ((search: TLoaderData) => TSelected) | undefined;
|
|
220
232
|
} | undefined) => TSelected;
|
|
221
233
|
}
|
|
222
|
-
export type AnyRootRoute = RootRoute<any, any, any, any>;
|
|
223
|
-
export declare function rootRouteWithContext<TRouterContext extends {}>(): <TSearchSchema extends Record<string, any> = {}, TRouteContext extends RouteContext = RouteContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", TSearchSchema, TSearchSchema, {}, {}, TRouteContext, Assign<TRouterContext, TRouteContext>, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute" | "stringifyParams" | "parseParams" | "caseSensitive"> | undefined) => RootRoute<TSearchSchema, TRouteContext, TRouterContext, {}, unknown>;
|
|
224
|
-
export declare class RootRoute<TSearchSchema extends Record<string, any> = {}, TRouteContext extends RouteContext = RouteContext, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> extends Route<any, // TParentRoute
|
|
234
|
+
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any>;
|
|
235
|
+
export declare function rootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TRouteContext extends RouteContext = RouteContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TSearchSchemaUsed, TSearchSchema, {}, {}, TRouteContext, Assign<TRouterContext, TRouteContext>, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute" | "stringifyParams" | "parseParams" | "caseSensitive"> | undefined) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContext, TRouterContext, {}, unknown>;
|
|
236
|
+
export declare class RootRoute<TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TRouteContext extends RouteContext = RouteContext, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> extends Route<any, // TParentRoute
|
|
225
237
|
'/', // TPath
|
|
226
238
|
'/', // TFullPath
|
|
227
239
|
string, // TCustomId
|
|
228
240
|
RootRouteId, // TId
|
|
241
|
+
TSearchSchemaInput, // TSearchSchemaInput
|
|
229
242
|
TSearchSchema, // TSearchSchema
|
|
243
|
+
TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
|
|
230
244
|
TSearchSchema, // TFullSearchSchema
|
|
231
245
|
{}, // TParams
|
|
232
246
|
{}, // TAllParams
|
|
@@ -238,7 +252,9 @@ any> {
|
|
|
238
252
|
constructor(options?: Omit<RouteOptions<AnyRoute, // TParentRoute
|
|
239
253
|
RootRouteId, // TCustomId
|
|
240
254
|
'', // TPath
|
|
255
|
+
TSearchSchemaInput, // TSearchSchemaInput
|
|
241
256
|
TSearchSchema, // TSearchSchema
|
|
257
|
+
TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
|
|
242
258
|
TSearchSchema, // TFullSearchSchema
|
|
243
259
|
{}, // TParams
|
|
244
260
|
{}, // TAllParams
|
|
@@ -277,7 +293,7 @@ export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
|
277
293
|
};
|
|
278
294
|
export type RouteComponent<TProps = any> = SyncRouteComponent<TProps> & AsyncRouteComponent<TProps>;
|
|
279
295
|
export type ErrorRouteComponent = RouteComponent<ErrorRouteProps>;
|
|
280
|
-
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchema, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree> {
|
|
281
|
-
constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchema, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
|
|
296
|
+
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchemaInput extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree> {
|
|
297
|
+
constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContext, TAllContext, TLoaderDeps, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
|
|
282
298
|
}
|
|
283
299
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyRoute, Route } from './route';
|
|
2
2
|
import { Expand, UnionToIntersection, UnionToTuple } from './utils';
|
|
3
3
|
export type ParseRoute<TRouteTree extends AnyRoute> = TRouteTree | ParseRouteChildren<TRouteTree>;
|
|
4
|
-
export type ParseRouteChildren<TRouteTree extends AnyRoute> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? {
|
|
4
|
+
export type ParseRouteChildren<TRouteTree extends AnyRoute> = TRouteTree extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, infer TChildren, any> ? unknown extends TChildren ? never : TChildren extends AnyRoute[] ? {
|
|
5
5
|
[TId in TChildren[number]['id'] as string]: ParseRoute<TChildren[number]>;
|
|
6
6
|
}[string] : never : never;
|
|
7
7
|
export type RoutesById<TRouteTree extends AnyRoute> = {
|