@tanstack/router-core 0.0.1-beta.14 → 0.0.1-beta.146
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/LICENSE +21 -0
- package/build/cjs/fileRoute.js +29 -0
- package/build/cjs/fileRoute.js.map +1 -0
- package/build/cjs/history.js +226 -0
- package/build/cjs/history.js.map +1 -0
- package/build/cjs/index.js +78 -0
- package/build/cjs/{packages/router-core/src/index.js.map → index.js.map} +1 -1
- package/build/cjs/{packages/router-core/src/path.js → path.js} +45 -56
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/{packages/router-core/src/qss.js → qss.js} +10 -16
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/route.js +103 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/router.js +1102 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +11 -13
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/{packages/router-core/src/utils.js → utils.js} +54 -64
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +1403 -2096
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +203 -234
- package/build/types/index.d.ts +603 -422
- package/build/umd/index.development.js +1629 -2218
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +13 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +11 -7
- package/src/fileRoute.ts +122 -0
- package/src/history.ts +292 -0
- package/src/index.ts +3 -10
- package/src/link.ts +118 -113
- package/src/path.ts +37 -17
- package/src/qss.ts +1 -2
- package/src/route.ts +891 -218
- package/src/routeInfo.ts +121 -197
- package/src/router.ts +1481 -1018
- package/src/searchParams.ts +1 -1
- package/src/utils.ts +80 -49
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -33
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
- package/build/cjs/node_modules/history/index.js +0 -815
- package/build/cjs/node_modules/history/index.js.map +0 -1
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -30
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +0 -1
- package/build/cjs/packages/router-core/src/index.js +0 -58
- package/build/cjs/packages/router-core/src/path.js.map +0 -1
- package/build/cjs/packages/router-core/src/qss.js.map +0 -1
- package/build/cjs/packages/router-core/src/route.js +0 -147
- package/build/cjs/packages/router-core/src/route.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeConfig.js +0 -69
- package/build/cjs/packages/router-core/src/routeConfig.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeMatch.js +0 -226
- package/build/cjs/packages/router-core/src/routeMatch.js.map +0 -1
- package/build/cjs/packages/router-core/src/router.js +0 -832
- package/build/cjs/packages/router-core/src/router.js.map +0 -1
- package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
- package/build/cjs/packages/router-core/src/utils.js.map +0 -1
- package/src/frameworks.ts +0 -11
- package/src/routeConfig.ts +0 -489
- package/src/routeMatch.ts +0 -312
package/build/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* router-core
|
|
2
|
+
* @tanstack/router-core/src/index.ts
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) TanStack
|
|
5
5
|
*
|
|
@@ -8,114 +8,110 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { BrowserHistory, MemoryHistory, HashHistory, History } from 'history';
|
|
12
|
-
export { createBrowserHistory, createHashHistory, createMemoryHistory } from 'history';
|
|
13
11
|
export { default as invariant } from 'tiny-invariant';
|
|
12
|
+
export { default as warning } from 'tiny-warning';
|
|
13
|
+
import { Store } from '@tanstack/react-store';
|
|
14
14
|
|
|
15
|
-
interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
interface RouterHistory {
|
|
16
|
+
location: RouterLocation;
|
|
17
|
+
listen: (cb: () => void) => () => void;
|
|
18
|
+
push: (path: string, state?: any) => void;
|
|
19
|
+
replace: (path: string, state?: any) => void;
|
|
20
|
+
go: (index: number) => void;
|
|
21
|
+
back: () => void;
|
|
22
|
+
forward: () => void;
|
|
23
|
+
createHref: (href: string) => string;
|
|
24
|
+
block: (blockerFn: BlockerFn) => () => void;
|
|
25
|
+
}
|
|
26
|
+
interface ParsedPath {
|
|
27
|
+
href: string;
|
|
21
28
|
pathname: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
childMatches: RouteMatch[];
|
|
25
|
-
routeSearch: TRouteInfo['searchSchema'];
|
|
26
|
-
search: TRouteInfo['fullSearchSchema'];
|
|
27
|
-
status: 'idle' | 'loading' | 'success' | 'error';
|
|
28
|
-
updatedAt?: number;
|
|
29
|
-
error?: unknown;
|
|
30
|
-
isInvalid: boolean;
|
|
31
|
-
getIsInvalid: () => boolean;
|
|
32
|
-
loaderData: TRouteInfo['loaderData'];
|
|
33
|
-
routeLoaderData: TRouteInfo['routeLoaderData'];
|
|
34
|
-
isFetching: boolean;
|
|
35
|
-
invalidAt: number;
|
|
36
|
-
__: {
|
|
37
|
-
component?: GetFrameworkGeneric<'Component'>;
|
|
38
|
-
errorComponent?: GetFrameworkGeneric<'Component'>;
|
|
39
|
-
pendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
40
|
-
loadPromise?: Promise<void>;
|
|
41
|
-
componentsPromise?: Promise<void>;
|
|
42
|
-
dataPromise?: Promise<void>;
|
|
43
|
-
onExit?: void | ((matchContext: {
|
|
44
|
-
params: TRouteInfo['allParams'];
|
|
45
|
-
search: TRouteInfo['fullSearchSchema'];
|
|
46
|
-
}) => void);
|
|
47
|
-
abortController: AbortController;
|
|
48
|
-
latestId: string;
|
|
49
|
-
validate: () => void;
|
|
50
|
-
notify: () => void;
|
|
51
|
-
resolve: () => void;
|
|
52
|
-
};
|
|
53
|
-
cancel: () => void;
|
|
54
|
-
load: (loaderOpts?: {
|
|
55
|
-
preload: true;
|
|
56
|
-
maxAge: number;
|
|
57
|
-
gcMaxAge: number;
|
|
58
|
-
} | {
|
|
59
|
-
preload?: false;
|
|
60
|
-
maxAge?: never;
|
|
61
|
-
gcMaxAge?: never;
|
|
62
|
-
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
63
|
-
fetch: (opts?: {
|
|
64
|
-
maxAge?: number;
|
|
65
|
-
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
66
|
-
invalidate: () => void;
|
|
67
|
-
hasLoaders: () => boolean;
|
|
29
|
+
search: string;
|
|
30
|
+
hash: string;
|
|
68
31
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
interface RouterLocation extends ParsedPath {
|
|
33
|
+
state: any;
|
|
34
|
+
}
|
|
35
|
+
type BlockerFn = (retry: () => void, cancel: () => void) => void;
|
|
36
|
+
declare function createBrowserHistory(opts?: {
|
|
37
|
+
getHref?: () => string;
|
|
38
|
+
createHref?: (path: string) => string;
|
|
39
|
+
}): RouterHistory;
|
|
40
|
+
declare function createHashHistory(): RouterHistory;
|
|
41
|
+
declare function createMemoryHistory(opts?: {
|
|
42
|
+
initialEntries: string[];
|
|
43
|
+
initialIndex?: number;
|
|
44
|
+
}): RouterHistory;
|
|
74
45
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
47
|
+
type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
|
|
48
|
+
type IsAnyBoolean<T> = 1 extends 0 & T ? true : false;
|
|
49
|
+
type IsKnown<T, Y, N> = unknown extends T ? N : Y;
|
|
50
|
+
type PickAsRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
51
|
+
type PickAsPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
52
|
+
type PickUnsafe<T, K> = K extends keyof T ? Pick<T, K> : never;
|
|
53
|
+
type PickExtra<T, K> = {
|
|
83
54
|
[TKey in keyof K as string extends TKey ? never : TKey extends keyof T ? never : TKey]: K[TKey];
|
|
84
|
-
}
|
|
85
|
-
|
|
55
|
+
};
|
|
56
|
+
type PickRequired<T> = {
|
|
86
57
|
[K in keyof T as undefined extends T[K] ? never : K]: T[K];
|
|
87
58
|
};
|
|
88
|
-
|
|
59
|
+
type Expand<T> = T extends object ? T extends infer O ? {
|
|
89
60
|
[K in keyof O]: O[K];
|
|
90
61
|
} : never : T;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
62
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => any ? I : never;
|
|
63
|
+
type Compute<T> = {
|
|
64
|
+
[K in keyof T]: T[K];
|
|
65
|
+
} | never;
|
|
66
|
+
type AllKeys<T> = T extends any ? keyof T : never;
|
|
67
|
+
type MergeUnion<T, Keys extends keyof T = keyof T> = Compute<{
|
|
68
|
+
[K in Keys]: T[Keys];
|
|
69
|
+
} & {
|
|
70
|
+
[K in AllKeys<T>]?: T extends any ? K extends keyof T ? T[K] : never : never;
|
|
71
|
+
}>;
|
|
72
|
+
type Values<O> = O[ValueKeys<O>];
|
|
73
|
+
type ValueKeys<O> = Extract<keyof O, PropertyKey>;
|
|
74
|
+
type DeepAwaited<T> = T extends Promise<infer A> ? DeepAwaited<A> : T extends Record<infer A, Promise<infer B>> ? {
|
|
94
75
|
[K in A]: DeepAwaited<B>;
|
|
95
76
|
} : T;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
77
|
+
type PathParamMask<TRoutePath extends string> = TRoutePath extends `${infer L}/$${infer C}/${infer R}` ? PathParamMask<`${L}/${string}/${R}`> : TRoutePath extends `${infer L}/$${infer C}` ? PathParamMask<`${L}/${string}`> : TRoutePath;
|
|
78
|
+
type Timeout = ReturnType<typeof setTimeout>;
|
|
79
|
+
type Updater<TPrevious, TResult = TPrevious> = TResult | ((prev?: TPrevious) => TResult);
|
|
80
|
+
type PickExtract<T, U> = {
|
|
100
81
|
[K in keyof T as T[K] extends U ? K : never]: T[K];
|
|
101
82
|
};
|
|
102
|
-
|
|
83
|
+
type PickExclude<T, U> = {
|
|
103
84
|
[K in keyof T as T[K] extends U ? never : K]: T[K];
|
|
104
85
|
};
|
|
86
|
+
declare function last<T>(arr: T[]): T | undefined;
|
|
87
|
+
declare function functionalUpdate<TResult>(updater: Updater<TResult>, previous: TResult): TResult;
|
|
88
|
+
declare function pick<T, K extends keyof T>(parent: T, keys: K[]): Pick<T, K>;
|
|
105
89
|
/**
|
|
106
90
|
* This function returns `a` if `b` is deeply equal.
|
|
107
91
|
* If not, it will replace any deeply equal children of `b` with those of `a`.
|
|
108
|
-
* This can be used for structural sharing between JSON values for example.
|
|
92
|
+
* This can be used for structural sharing between immutable JSON values for example.
|
|
93
|
+
* Do not use this with signals
|
|
109
94
|
*/
|
|
110
|
-
declare function replaceEqualDeep(prev: any,
|
|
111
|
-
declare function
|
|
112
|
-
declare function
|
|
113
|
-
declare function functionalUpdate<TResult>(updater: Updater<TResult>, previous: TResult): TResult;
|
|
114
|
-
declare function pick<T, K extends keyof T>(parent: T, keys: K[]): Pick<T, K>;
|
|
95
|
+
declare function replaceEqualDeep<T>(prev: any, _next: T): T;
|
|
96
|
+
declare function isPlainObject(o: any): boolean;
|
|
97
|
+
declare function partialDeepEqual(a: any, b: any): boolean;
|
|
115
98
|
|
|
99
|
+
declare global {
|
|
100
|
+
interface Window {
|
|
101
|
+
__TSR_DEHYDRATED__?: HydrationCtx;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
interface Register {
|
|
105
|
+
}
|
|
106
|
+
type AnyRouter = Router<any, any, any>;
|
|
107
|
+
type RegisteredRouterPair = Register extends {
|
|
108
|
+
router: infer TRouter extends AnyRouter;
|
|
109
|
+
} ? [TRouter, TRouter['types']['RoutesInfo']] : [Router, AnyRoutesInfo];
|
|
110
|
+
type RegisteredRouter = RegisteredRouterPair[0];
|
|
111
|
+
type RegisteredRoutesInfo = RegisteredRouterPair[1];
|
|
116
112
|
interface LocationState {
|
|
117
113
|
}
|
|
118
|
-
interface
|
|
114
|
+
interface ParsedLocation<TSearchObj extends AnySearchSchema = {}, TState extends LocationState = LocationState> {
|
|
119
115
|
href: string;
|
|
120
116
|
pathname: string;
|
|
121
117
|
search: TSearchObj;
|
|
@@ -130,106 +126,95 @@ interface FromLocation {
|
|
|
130
126
|
key?: string;
|
|
131
127
|
hash?: string;
|
|
132
128
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
type SearchSerializer = (searchObj: Record<string, any>) => string;
|
|
130
|
+
type SearchParser = (searchStr: string) => Record<string, any>;
|
|
131
|
+
type HydrationCtx = {
|
|
132
|
+
router: DehydratedRouter;
|
|
133
|
+
payload: Record<string, any>;
|
|
134
|
+
};
|
|
135
|
+
interface RouteMatch<TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo, TRoute extends AnyRoute = Route> {
|
|
136
|
+
id: string;
|
|
137
|
+
key?: string;
|
|
138
|
+
routeId: string;
|
|
139
|
+
pathname: string;
|
|
140
|
+
params: TRoute['__types']['allParams'];
|
|
141
|
+
status: 'idle' | 'pending' | 'success' | 'error';
|
|
142
|
+
isFetching: boolean;
|
|
143
|
+
invalid: boolean;
|
|
144
|
+
error: unknown;
|
|
145
|
+
paramsError: unknown;
|
|
146
|
+
searchError: unknown;
|
|
147
|
+
updatedAt: number;
|
|
148
|
+
invalidAt: number;
|
|
149
|
+
preloadInvalidAt: number;
|
|
150
|
+
loaderData: TRoute['__types']['loader'];
|
|
151
|
+
loadPromise?: Promise<void>;
|
|
152
|
+
__resolveLoadPromise?: () => void;
|
|
153
|
+
routeContext: TRoute['__types']['routeContext'];
|
|
154
|
+
context: TRoute['__types']['context'];
|
|
155
|
+
routeSearch: TRoute['__types']['searchSchema'];
|
|
156
|
+
search: TRoutesInfo['fullSearchSchema'] & TRoute['__types']['fullSearchSchema'];
|
|
157
|
+
fetchedAt: number;
|
|
158
|
+
abortController: AbortController;
|
|
159
|
+
}
|
|
160
|
+
type AnyRouteMatch = RouteMatch<AnyRoutesInfo, AnyRoute>;
|
|
161
|
+
type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends TRouteTree['__types']['routerContext'] ? {
|
|
162
|
+
context?: TRouteTree['__types']['routerContext'];
|
|
163
|
+
} : {
|
|
164
|
+
context: TRouteTree['__types']['routerContext'];
|
|
165
|
+
};
|
|
166
|
+
interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<string, any>> {
|
|
167
|
+
history?: RouterHistory;
|
|
138
168
|
stringifySearch?: SearchSerializer;
|
|
139
169
|
parseSearch?: SearchParser;
|
|
140
|
-
filterRoutes?: FilterRoutesFn;
|
|
141
170
|
defaultPreload?: false | 'intent';
|
|
142
|
-
defaultPreloadMaxAge?: number;
|
|
143
|
-
defaultPreloadGcMaxAge?: number;
|
|
144
171
|
defaultPreloadDelay?: number;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
defaultComponent?: RegisteredRouteComponent<RouteProps<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>>;
|
|
173
|
+
defaultErrorComponent?: RegisteredRouteErrorComponent<RouteProps<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>>;
|
|
174
|
+
defaultPendingComponent?: RegisteredRouteComponent<RouteProps<unknown, AnySearchSchema, AnyPathParams, AnyContext, AnyContext>>;
|
|
175
|
+
defaultMaxAge?: number;
|
|
176
|
+
defaultGcMaxAge?: number;
|
|
177
|
+
defaultPreloadMaxAge?: number;
|
|
151
178
|
caseSensitive?: boolean;
|
|
152
|
-
|
|
179
|
+
routeTree?: TRouteTree;
|
|
153
180
|
basepath?: string;
|
|
154
|
-
createRouter?: (router: Router<any, any>) => void;
|
|
155
181
|
createRoute?: (opts: {
|
|
156
182
|
route: AnyRoute;
|
|
157
|
-
router:
|
|
183
|
+
router: AnyRouter;
|
|
158
184
|
}) => void;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
interface ActionState<TPayload = unknown, TResponse = unknown> {
|
|
171
|
-
submittedAt: number;
|
|
172
|
-
status: 'idle' | 'pending' | 'success' | 'error';
|
|
173
|
-
submission: TPayload;
|
|
174
|
-
isMulti: boolean;
|
|
175
|
-
data?: TResponse;
|
|
176
|
-
error?: unknown;
|
|
177
|
-
}
|
|
178
|
-
interface Loader<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}, TRouteLoaderData = AnyLoaderData> {
|
|
179
|
-
fetch: keyof PickRequired<TFullSearchSchema> extends never ? keyof TAllParams extends never ? (loaderContext: {
|
|
180
|
-
signal?: AbortSignal;
|
|
181
|
-
}) => Promise<TRouteLoaderData> : (loaderContext: {
|
|
182
|
-
params: TAllParams;
|
|
183
|
-
search?: TFullSearchSchema;
|
|
184
|
-
signal?: AbortSignal;
|
|
185
|
-
}) => Promise<TRouteLoaderData> : keyof TAllParams extends never ? (loaderContext: {
|
|
186
|
-
search: TFullSearchSchema;
|
|
187
|
-
params: TAllParams;
|
|
188
|
-
signal?: AbortSignal;
|
|
189
|
-
}) => Promise<TRouteLoaderData> : (loaderContext: {
|
|
190
|
-
search: TFullSearchSchema;
|
|
191
|
-
signal?: AbortSignal;
|
|
192
|
-
}) => Promise<TRouteLoaderData>;
|
|
193
|
-
current?: LoaderState<TFullSearchSchema, TAllParams>;
|
|
194
|
-
latest?: LoaderState<TFullSearchSchema, TAllParams>;
|
|
195
|
-
pending: LoaderState<TFullSearchSchema, TAllParams>[];
|
|
196
|
-
}
|
|
197
|
-
interface LoaderState<TFullSearchSchema = unknown, TAllParams = unknown> {
|
|
198
|
-
loadedAt: number;
|
|
199
|
-
loaderContext: LoaderContext<TFullSearchSchema, TAllParams>;
|
|
200
|
-
}
|
|
201
|
-
interface RouterState {
|
|
202
|
-
status: 'idle' | 'loading';
|
|
203
|
-
location: Location;
|
|
204
|
-
matches: RouteMatch[];
|
|
205
|
-
lastUpdated: number;
|
|
206
|
-
actions: Record<string, Action>;
|
|
207
|
-
loaders: Record<string, Loader>;
|
|
208
|
-
pending?: PendingState;
|
|
185
|
+
onRouteChange?: () => void;
|
|
186
|
+
context?: TRouteTree['__types']['routerContext'];
|
|
187
|
+
Wrap?: React.ComponentType<{
|
|
188
|
+
children: React.ReactNode;
|
|
189
|
+
dehydratedState?: TDehydrated;
|
|
190
|
+
}>;
|
|
191
|
+
dehydrate?: () => TDehydrated;
|
|
192
|
+
hydrate?: (dehydrated: TDehydrated) => void;
|
|
193
|
+
}
|
|
194
|
+
interface RouterState<TRoutesInfo extends AnyRoutesInfo = AnyRoutesInfo, TState extends LocationState = LocationState> {
|
|
195
|
+
status: 'idle' | 'pending';
|
|
209
196
|
isFetching: boolean;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
197
|
+
matchesById: Record<string, RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>>;
|
|
198
|
+
matchIds: string[];
|
|
199
|
+
pendingMatchIds: string[];
|
|
200
|
+
matches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
|
|
201
|
+
pendingMatches: RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
|
|
202
|
+
location: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
|
|
203
|
+
resolvedLocation: ParsedLocation<TRoutesInfo['fullSearchSchema'], TState>;
|
|
204
|
+
lastUpdated: number;
|
|
215
205
|
}
|
|
216
|
-
|
|
217
|
-
declare type ListenerFn = () => void;
|
|
206
|
+
type ListenerFn = () => void;
|
|
218
207
|
interface BuildNextOptions {
|
|
219
208
|
to?: string | number | null;
|
|
220
|
-
params?: true | Updater<
|
|
209
|
+
params?: true | Updater<unknown>;
|
|
221
210
|
search?: true | Updater<unknown>;
|
|
222
211
|
hash?: true | Updater<string>;
|
|
212
|
+
state?: LocationState;
|
|
223
213
|
key?: string;
|
|
224
214
|
from?: string;
|
|
225
215
|
fromCurrent?: boolean;
|
|
226
|
-
|
|
227
|
-
__postSearchFilters?: SearchFilter<any>[];
|
|
216
|
+
__matches?: AnyRouteMatch[];
|
|
228
217
|
}
|
|
229
|
-
declare type MatchCacheEntry = {
|
|
230
|
-
gc: number;
|
|
231
|
-
match: RouteMatch;
|
|
232
|
-
};
|
|
233
218
|
interface MatchLocation {
|
|
234
219
|
to?: string | number | null;
|
|
235
220
|
fuzzy?: boolean;
|
|
@@ -238,204 +223,205 @@ interface MatchLocation {
|
|
|
238
223
|
fromCurrent?: boolean;
|
|
239
224
|
}
|
|
240
225
|
interface MatchRouteOptions {
|
|
241
|
-
pending
|
|
226
|
+
pending?: boolean;
|
|
242
227
|
caseSensitive?: boolean;
|
|
228
|
+
includeSearch?: boolean;
|
|
229
|
+
fuzzy?: boolean;
|
|
243
230
|
}
|
|
244
231
|
interface DehydratedRouterState extends Pick<RouterState, 'status' | 'location' | 'lastUpdated'> {
|
|
245
|
-
matches: DehydratedRouteMatch[];
|
|
246
232
|
}
|
|
247
|
-
interface
|
|
233
|
+
interface DehydratedRouter {
|
|
234
|
+
state: DehydratedRouterState;
|
|
248
235
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
236
|
+
type RouterConstructorOptions<TRouteTree extends AnyRoute, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & RouterContextOptions<TRouteTree>;
|
|
237
|
+
declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent"];
|
|
238
|
+
declare class Router<TRouteTree extends AnyRoute = AnyRoute, TRoutesInfo extends AnyRoutesInfo = RoutesInfo<TRouteTree>, TDehydrated extends Record<string, any> = Record<string, any>> {
|
|
239
|
+
#private;
|
|
240
|
+
types: {
|
|
241
|
+
RootRoute: TRouteTree;
|
|
242
|
+
RoutesInfo: TRoutesInfo;
|
|
243
|
+
};
|
|
244
|
+
options: PickAsRequired<RouterOptions<TRouteTree, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
|
|
245
|
+
history: RouterHistory;
|
|
252
246
|
basepath: string;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
subscribe: (listener: Listener) => () => void;
|
|
247
|
+
routeTree: RootRoute;
|
|
248
|
+
routesById: RoutesById<TRoutesInfo>;
|
|
249
|
+
routesByPath: RoutesByPath<TRoutesInfo>;
|
|
250
|
+
flatRoutes: TRoutesInfo['routesByFullPath'][keyof TRoutesInfo['routesByFullPath']][];
|
|
251
|
+
navigateTimeout: undefined | Timeout;
|
|
252
|
+
nextAction: undefined | 'push' | 'replace';
|
|
253
|
+
navigationPromise: undefined | Promise<void>;
|
|
254
|
+
__store: Store<RouterState<TRoutesInfo>>;
|
|
255
|
+
state: RouterState<TRoutesInfo>;
|
|
256
|
+
dehydratedData?: TDehydrated;
|
|
257
|
+
constructor(options: RouterConstructorOptions<TRouteTree, TDehydrated>);
|
|
265
258
|
reset: () => void;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
update: <TRouteConfig extends RouteConfig = RouteConfig>(opts?: RouterOptions<TRouteConfig>) => Router<TRouteConfig>;
|
|
270
|
-
buildNext: (opts: BuildNextOptions) => Location;
|
|
259
|
+
mount: () => void;
|
|
260
|
+
update: (opts?: RouterOptions<any, any>) => this;
|
|
261
|
+
buildNext: (opts: BuildNextOptions) => ParsedLocation;
|
|
271
262
|
cancelMatches: () => void;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
263
|
+
cancelMatch: (id: string) => void;
|
|
264
|
+
safeLoad: (opts?: {
|
|
265
|
+
next?: ParsedLocation;
|
|
266
|
+
}) => Promise<void>;
|
|
267
|
+
latestLoadPromise: Promise<void>;
|
|
268
|
+
load: (opts?: {
|
|
269
|
+
next?: ParsedLocation;
|
|
270
|
+
throwOnError?: boolean;
|
|
271
|
+
}) => Promise<void>;
|
|
272
|
+
getRoute: <TId extends keyof TRoutesInfo["routesById"]>(id: TId) => TRoutesInfo["routesById"][TId];
|
|
273
|
+
preloadRoute: (navigateOpts?: BuildNextOptions & {
|
|
274
|
+
maxAge?: number;
|
|
275
|
+
}) => Promise<RouteMatch<TRoutesInfo, TRoutesInfo["routeIntersection"]>[]>;
|
|
276
|
+
cleanMatches: () => void;
|
|
277
|
+
matchRoutes: (pathname: string, locationSearch: AnySearchSchema, opts?: {
|
|
278
|
+
throwOnError?: boolean;
|
|
279
|
+
debug?: boolean;
|
|
280
|
+
}) => RouteMatch<TRoutesInfo, TRoutesInfo['routeIntersection']>[];
|
|
281
|
+
loadMatches: (resolvedMatches: AnyRouteMatch[], opts?: {
|
|
282
|
+
preload?: boolean;
|
|
278
283
|
maxAge?: number;
|
|
279
|
-
gcMaxAge?: number;
|
|
280
|
-
}) => Promise<RouteMatch[]>;
|
|
281
|
-
matchRoutes: (pathname: string, opts?: {
|
|
282
|
-
strictParseParams?: boolean;
|
|
283
|
-
}) => RouteMatch[];
|
|
284
|
-
loadMatches: (resolvedMatches: RouteMatch[], loaderOpts?: {
|
|
285
|
-
preload: true;
|
|
286
|
-
maxAge: number;
|
|
287
|
-
gcMaxAge: number;
|
|
288
|
-
} | {
|
|
289
|
-
preload?: false;
|
|
290
|
-
maxAge?: never;
|
|
291
|
-
gcMaxAge?: never;
|
|
292
284
|
}) => Promise<void>;
|
|
293
|
-
invalidateRoute: (opts: MatchLocation) => void;
|
|
294
285
|
reload: () => Promise<void>;
|
|
295
286
|
resolvePath: (from: string, path: string) => string;
|
|
296
|
-
navigate: <TFrom extends
|
|
297
|
-
matchRoute: <TFrom extends
|
|
298
|
-
buildLink: <TFrom extends
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
287
|
+
navigate: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRoutesInfo, TFrom, TTo>) => Promise<void>;
|
|
288
|
+
matchRoute: <TFrom extends string = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRoutesInfo, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | TRoutesInfo["routesById"][TResolved]["__types"]["allParams"];
|
|
289
|
+
buildLink: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, }: LinkOptions<TRoutesInfo, TFrom, TTo>) => LinkInfo;
|
|
290
|
+
dehydrate: () => DehydratedRouter;
|
|
291
|
+
hydrate: (__do_not_use_server_ctx?: HydrationCtx) => Promise<void>;
|
|
292
|
+
injectedHtml: (string | (() => Promise<string> | string))[];
|
|
293
|
+
injectHtml: (html: string | (() => Promise<string> | string)) => Promise<void>;
|
|
294
|
+
dehydrateData: <T>(key: any, getData: T | (() => T | Promise<T>)) => () => T | undefined;
|
|
295
|
+
hydrateData: <T = unknown>(key: any) => T | undefined;
|
|
296
|
+
getRouteMatch: (id: string) => undefined | RouteMatch<TRoutesInfo, AnyRoute>;
|
|
297
|
+
setRouteMatch: (id: string, updater: (prev: RouteMatch<TRoutesInfo, AnyRoute>) => RouteMatch<TRoutesInfo, AnyRoute>) => void;
|
|
298
|
+
setRouteMatchData: (id: string, updater: (prev: any) => any, opts?: {
|
|
299
|
+
updatedAt?: number;
|
|
300
|
+
maxAge?: number;
|
|
301
|
+
}) => void;
|
|
302
|
+
invalidate: (opts?: {
|
|
303
|
+
matchId?: string;
|
|
304
|
+
reload?: boolean;
|
|
305
|
+
}) => Promise<void>;
|
|
306
|
+
getIsInvalid: (opts?: {
|
|
307
|
+
matchId: string;
|
|
308
|
+
preload?: boolean;
|
|
309
|
+
}) => boolean;
|
|
310
|
+
}
|
|
311
|
+
type AnyRedirect = Redirect<any, any, any>;
|
|
312
|
+
type Redirect<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = NavigateOptions<TRoutesInfo, TFrom, TTo> & {
|
|
313
|
+
code?: number;
|
|
314
|
+
};
|
|
315
|
+
declare function redirect<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''>(opts: Redirect<TRoutesInfo, TFrom, TTo>): Redirect<TRoutesInfo, TFrom, TTo>;
|
|
316
|
+
declare function isRedirect(obj: any): obj is AnyRedirect;
|
|
317
|
+
declare class SearchParamError extends Error {
|
|
310
318
|
}
|
|
311
|
-
declare
|
|
312
|
-
|
|
313
|
-
interface AnyRoute extends Route<any, any> {
|
|
314
|
-
}
|
|
315
|
-
interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> {
|
|
316
|
-
routeId: TRouteInfo['id'];
|
|
317
|
-
routeRouteId: TRouteInfo['routeId'];
|
|
318
|
-
routePath: TRouteInfo['path'];
|
|
319
|
-
fullPath: TRouteInfo['fullPath'];
|
|
320
|
-
parentRoute?: AnyRoute;
|
|
321
|
-
childRoutes?: AnyRoute[];
|
|
322
|
-
options: RouteOptions;
|
|
323
|
-
router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo>;
|
|
324
|
-
buildLink: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo>, 'from'>) => LinkInfo;
|
|
325
|
-
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'];
|
|
326
|
-
navigate: <TTo extends string = '.'>(options: Omit<LinkOptions<TAllRouteInfo, TRouteInfo['id'], TTo>, 'from'>) => Promise<void>;
|
|
327
|
-
action: unknown extends TRouteInfo['actionResponse'] ? Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']> | undefined : Action<TRouteInfo['actionPayload'], TRouteInfo['actionResponse']>;
|
|
328
|
-
loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
|
|
329
|
-
}
|
|
330
|
-
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>;
|
|
331
|
-
|
|
332
|
-
interface AnyAllRouteInfo {
|
|
333
|
-
routeConfig: AnyRouteConfig;
|
|
334
|
-
routeInfo: AnyRouteInfo;
|
|
335
|
-
routeInfoById: Record<string, AnyRouteInfo>;
|
|
336
|
-
routeInfoByFullPath: Record<string, AnyRouteInfo>;
|
|
337
|
-
routeIds: any;
|
|
338
|
-
routePaths: any;
|
|
319
|
+
declare class PathParamError extends Error {
|
|
339
320
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
321
|
+
declare function lazyFn<T extends Record<string, (...args: any[]) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<ReturnType<T[TKey]>>;
|
|
322
|
+
|
|
323
|
+
declare const rootRouteId: "__root__";
|
|
324
|
+
type RootRouteId = typeof rootRouteId;
|
|
325
|
+
type AnyPathParams = {};
|
|
326
|
+
type AnySearchSchema = {};
|
|
327
|
+
type AnyContext = {};
|
|
328
|
+
interface RouteMeta {
|
|
347
329
|
}
|
|
348
|
-
interface
|
|
330
|
+
interface RouteContext {
|
|
349
331
|
}
|
|
350
|
-
|
|
351
|
-
declare type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteConfigWithChildren<infer TChildren> ? unknown extends TChildren ? never : TChildren extends AnyRouteConfig[] ? Values<{
|
|
352
|
-
[TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
|
|
353
|
-
}> : never : never;
|
|
354
|
-
declare type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
|
|
355
|
-
id: TId;
|
|
356
|
-
} extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
|
|
357
|
-
declare type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TRouteLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
|
|
358
|
-
interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
|
|
359
|
-
[TInfo in TRouteInfo as TInfo['id']]: TInfo;
|
|
360
|
-
}, TRouteInfoByFullPath = {
|
|
361
|
-
[TInfo in TRouteInfo as TInfo['fullPath'] extends RootRouteId ? never : string extends TInfo['fullPath'] ? never : TInfo['fullPath']]: TInfo;
|
|
362
|
-
}> {
|
|
363
|
-
routeConfig: TRouteConfig;
|
|
364
|
-
routeInfo: TRouteInfo;
|
|
365
|
-
routeInfoById: TRouteInfoById;
|
|
366
|
-
routeInfoByFullPath: TRouteInfoByFullPath;
|
|
367
|
-
routeIds: keyof TRouteInfoById;
|
|
368
|
-
routePaths: keyof TRouteInfoByFullPath;
|
|
332
|
+
interface RegisterRouteComponent<TProps> {
|
|
369
333
|
}
|
|
370
|
-
interface
|
|
334
|
+
interface RegisterRouteErrorComponent<TProps> {
|
|
371
335
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
336
|
+
type RegisteredRouteComponent<TProps> = RegisterRouteComponent<TProps> extends {
|
|
337
|
+
RouteComponent: infer T;
|
|
338
|
+
} ? T : (props: TProps) => unknown;
|
|
339
|
+
type RegisteredRouteErrorComponent<TProps> = RegisterRouteErrorComponent<TProps> extends {
|
|
340
|
+
RouteErrorComponent: infer T;
|
|
341
|
+
} ? T : (props: TProps) => unknown;
|
|
342
|
+
type PreloadableObj = {
|
|
343
|
+
preload?: () => Promise<void>;
|
|
344
|
+
};
|
|
345
|
+
type RoutePathOptions<TCustomId, TPath> = {
|
|
375
346
|
path: TPath;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
loaderData: TLoaderData;
|
|
379
|
-
actionPayload: TActionPayload;
|
|
380
|
-
actionResponse: TActionResponse;
|
|
381
|
-
searchSchema: TSearchSchema;
|
|
382
|
-
fullSearchSchema: TFullSearchSchema;
|
|
383
|
-
parentParams: TParentParams;
|
|
384
|
-
params: TParams;
|
|
385
|
-
allParams: TAllParams;
|
|
386
|
-
options: RouteOptions<TRouteId, TPath, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
387
|
-
}
|
|
388
|
-
declare type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
|
|
389
|
-
[K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
|
|
347
|
+
} | {
|
|
348
|
+
id: TCustomId;
|
|
390
349
|
};
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
declare type AnyLoaderData = {};
|
|
397
|
-
declare type AnyPathParams = {};
|
|
398
|
-
declare type AnySearchSchema = {};
|
|
399
|
-
interface RouteMeta {
|
|
400
|
-
}
|
|
401
|
-
declare type SearchSchemaValidator<TReturn, TParentSchema> = SearchSchemaValidatorObj<TReturn, TParentSchema> | SearchSchemaValidatorFn<TReturn, TParentSchema>;
|
|
402
|
-
declare type SearchSchemaValidatorObj<TReturn, TParentSchema> = {
|
|
403
|
-
parse?: SearchSchemaValidatorFn<TReturn, TParentSchema>;
|
|
350
|
+
type RoutePathOptionsIntersection<TCustomId, TPath> = UnionToIntersection<RoutePathOptions<TCustomId, TPath>>;
|
|
351
|
+
type MetaOptions = keyof PickRequired<RouteMeta> extends never ? {
|
|
352
|
+
meta?: RouteMeta;
|
|
353
|
+
} : {
|
|
354
|
+
meta: RouteMeta;
|
|
404
355
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
356
|
+
type AnyRouteProps = RouteProps<any, any, any, any, any>;
|
|
357
|
+
type ComponentPropsFromRoute<TRoute> = TRoute extends Route<infer TParentRoute, infer TPath, infer TFullPath, infer TCustomId, infer TId, infer TLoader, infer TSearchSchema, infer TFullSearchSchema, infer TParams, infer TAllParams, infer TParentContext, infer TAllParentContext, infer TRouteContext, infer TContext, infer TRouterContext, infer TChildren, infer TRoutesInfo> ? RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext> : never;
|
|
358
|
+
type ComponentFromRoute<TRoute> = RegisteredRouteComponent<ComponentPropsFromRoute<TRoute>>;
|
|
359
|
+
type RouteLoaderFromRoute<TRoute extends AnyRoute> = LoaderFn<TRoute['__types']['loader'], TRoute['__types']['searchSchema'], TRoute['__types']['fullSearchSchema'], TRoute['__types']['allParams'], TRoute['__types']['routeContext'], TRoute['__types']['context']>;
|
|
360
|
+
type RouteProps<TLoader = unknown, TFullSearchSchema extends AnySearchSchema = AnySearchSchema, TAllParams = AnyPathParams, TRouteContext = AnyContext, TContext = AnyContext> = {
|
|
361
|
+
useMatch: () => RouteMatch<AnyRoutesInfo, AnyRoute>;
|
|
362
|
+
useLoader: () => UseLoaderResult<TLoader>;
|
|
363
|
+
useSearch: <TStrict extends boolean = true, TSearch = TFullSearchSchema, TSelected = TSearch>(opts?: {
|
|
364
|
+
strict?: TStrict;
|
|
365
|
+
select?: (search: TSearch) => TSelected;
|
|
366
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
367
|
+
useParams: <TDefaultSelected = TAllParams, TSelected = TDefaultSelected>(opts?: {
|
|
368
|
+
select?: (params: TDefaultSelected) => TSelected;
|
|
369
|
+
}) => TSelected;
|
|
370
|
+
useContext: <TDefaultSelected = TContext, TSelected = TDefaultSelected>(opts?: {
|
|
371
|
+
select?: (context: TDefaultSelected) => TSelected;
|
|
372
|
+
}) => TSelected;
|
|
373
|
+
useRouteContext: <TDefaultSelected = TRouteContext, TSelected = TDefaultSelected>(opts?: {
|
|
374
|
+
select?: (context: TDefaultSelected) => TSelected;
|
|
375
|
+
}) => TSelected;
|
|
412
376
|
};
|
|
413
|
-
|
|
414
|
-
|
|
377
|
+
type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = AnyPathParams, TParams extends AnyPathParams = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = TParams, TParentContext extends AnyContext = AnyContext, TAllParentContext extends IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext> = IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext>, TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TAllParentContext, TRouteContext> = MergeParamsFromParent<TAllParentContext, TRouteContext>> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TLoader, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
|
|
378
|
+
type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
379
|
+
type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoader = unknown, TParentSearchSchema extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = AnyPathParams, TParams = unknown, TAllParams = ParamsFallback<TPath, TParams>, TParentContext extends AnyContext = AnyContext, TAllParentContext extends IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext> = IsAny<TParentRoute['__types']['allParams'], TParentContext, TParentRoute['__types']['allParams'] & TParentContext>, TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TAllParentContext, TRouteContext> = MergeParamsFromParent<TAllParentContext, TRouteContext>> = RoutePathOptions<TCustomId, TPath> & {
|
|
380
|
+
getParentRoute: () => TParentRoute;
|
|
381
|
+
validateSearch?: SearchSchemaValidator<TSearchSchema, TParentSearchSchema>;
|
|
382
|
+
loader?: LoaderFn<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>;
|
|
383
|
+
} & ({
|
|
384
|
+
parseParams?: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
385
|
+
stringifyParams?: (params: NoInfer<ParamsFallback<TPath, TParams>>) => Record<ParsePathParams<TPath>, string>;
|
|
386
|
+
} | {
|
|
387
|
+
stringifyParams?: never;
|
|
388
|
+
parseParams?: never;
|
|
389
|
+
}) & (keyof PickRequired<RouteContext> extends never ? {
|
|
390
|
+
getContext?: GetContextFn<TParentRoute, TAllParams, TFullSearchSchema, TParentContext, TAllParentContext, TRouteContext>;
|
|
391
|
+
} : {
|
|
392
|
+
getContext: GetContextFn<TParentRoute, TAllParams, TFullSearchSchema, TParentContext, TAllParentContext, TRouteContext>;
|
|
393
|
+
});
|
|
394
|
+
type GetContextFn<TParentRoute, TAllParams, TFullSearchSchema, TParentContext, TAllParentContext, TRouteContext> = (opts: {
|
|
415
395
|
params: TAllParams;
|
|
416
396
|
search: TFullSearchSchema;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
397
|
+
} & (TParentRoute extends undefined ? {
|
|
398
|
+
context?: TAllParentContext;
|
|
399
|
+
parentContext?: TParentContext;
|
|
400
|
+
} : {
|
|
401
|
+
context: TAllParentContext;
|
|
402
|
+
parentContext: TParentContext;
|
|
403
|
+
})) => TRouteContext;
|
|
404
|
+
type UpdatableRouteOptions<TLoader, TSearchSchema extends AnySearchSchema, TFullSearchSchema extends AnySearchSchema, TAllParams extends AnyPathParams, TRouteContext extends AnyContext, TContext extends AnyContext> = MetaOptions & {
|
|
405
|
+
key?: null | false | GetKeyFn<TFullSearchSchema, TAllParams>;
|
|
426
406
|
caseSensitive?: boolean;
|
|
427
|
-
|
|
407
|
+
wrapInSuspense?: boolean;
|
|
408
|
+
component?: RegisteredRouteComponent<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>;
|
|
409
|
+
errorComponent?: RegisteredRouteErrorComponent<{
|
|
410
|
+
error: unknown;
|
|
411
|
+
} & Partial<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>>;
|
|
412
|
+
pendingComponent?: RegisteredRouteComponent<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>;
|
|
428
413
|
preSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
429
414
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
415
|
+
preloadMaxAge?: number;
|
|
416
|
+
maxAge?: number;
|
|
417
|
+
gcMaxAge?: number;
|
|
418
|
+
beforeLoad?: (opts: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>) => Promise<void> | void;
|
|
419
|
+
onBeforeLoadError?: (err: any) => void;
|
|
420
|
+
onValidateSearchError?: (err: any) => void;
|
|
421
|
+
onParseParamsError?: (err: any) => void;
|
|
422
|
+
onLoadError?: (err: any) => void;
|
|
423
|
+
onError?: (err: any) => void;
|
|
424
|
+
onLoaded?: (matchContext: {
|
|
439
425
|
params: TAllParams;
|
|
440
426
|
search: TFullSearchSchema;
|
|
441
427
|
}) => void | undefined | ((match: {
|
|
@@ -446,65 +432,223 @@ declare type RouteOptions<TRouteId extends string = string, TPath extends string
|
|
|
446
432
|
params: TAllParams;
|
|
447
433
|
search: TFullSearchSchema;
|
|
448
434
|
}) => void;
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
435
|
+
};
|
|
436
|
+
type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<TPath, TParams>;
|
|
437
|
+
type ParseParamsFn<TPath extends string, TParams> = (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
438
|
+
type ParseParamsObj<TPath extends string, TParams> = {
|
|
439
|
+
parse?: ParseParamsFn<TPath, TParams>;
|
|
440
|
+
};
|
|
441
|
+
type SearchSchemaValidator<TReturn, TParentSchema> = SearchSchemaValidatorObj<TReturn, TParentSchema> | SearchSchemaValidatorFn<TReturn, TParentSchema>;
|
|
442
|
+
type SearchSchemaValidatorObj<TReturn, TParentSchema> = {
|
|
443
|
+
parse?: SearchSchemaValidatorFn<TReturn, TParentSchema>;
|
|
444
|
+
};
|
|
445
|
+
type SearchSchemaValidatorFn<TReturn, TParentSchema> = (searchObj: Record<string, unknown>) => {} extends TParentSchema ? TReturn : keyof TReturn extends keyof TParentSchema ? {
|
|
446
|
+
error: 'Top level search params cannot be redefined by child routes!';
|
|
447
|
+
keys: keyof TReturn & keyof TParentSchema;
|
|
448
|
+
} : TReturn;
|
|
449
|
+
type DefinedPathParamWarning = 'Path params cannot be redefined by child routes!';
|
|
450
|
+
type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
451
|
+
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
452
|
+
};
|
|
453
|
+
type LoaderFn<TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}, TContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> = (match: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, TContext, TAllContext> & {
|
|
454
|
+
parentMatchPromise?: Promise<void>;
|
|
455
|
+
}) => Promise<TLoader> | TLoader;
|
|
456
|
+
type GetKeyFn<TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}> = (loaderContext: {
|
|
457
|
+
params: TAllParams;
|
|
458
|
+
search: TFullSearchSchema;
|
|
459
|
+
}) => any;
|
|
460
|
+
interface LoaderContext<TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams = {}, TContext extends AnyContext = AnyContext, TAllContext extends AnyContext = AnyContext> {
|
|
461
|
+
params: TAllParams;
|
|
462
|
+
routeSearch: TSearchSchema;
|
|
463
|
+
search: TFullSearchSchema;
|
|
464
|
+
abortController: AbortController;
|
|
465
|
+
preload: boolean;
|
|
466
|
+
routeContext: TContext;
|
|
467
|
+
context: TAllContext;
|
|
468
|
+
}
|
|
469
|
+
type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, Route>) => void;
|
|
470
|
+
type SearchFilter<T, U = T> = (prev: T) => U;
|
|
471
|
+
type ResolveId<TParentRoute, TCustomId extends string, TPath extends string> = TParentRoute extends {
|
|
472
|
+
id: infer TParentId extends string;
|
|
473
|
+
} ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId> : RootRouteId;
|
|
474
|
+
type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
475
|
+
isRoot: true;
|
|
476
|
+
__types: {
|
|
477
|
+
searchSchema: infer TSearchSchema;
|
|
478
|
+
};
|
|
479
|
+
} ? TSearchSchema : TRoute extends {
|
|
480
|
+
__types: {
|
|
481
|
+
fullSearchSchema: infer TFullSearchSchema;
|
|
482
|
+
};
|
|
483
|
+
} ? TFullSearchSchema : {};
|
|
484
|
+
type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = InferFullSearchSchema<TParentRoute> & TSearchSchema;
|
|
485
|
+
interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
486
|
+
}
|
|
487
|
+
type AnyRouteWithRouterContext<TRouterContext extends AnyContext> = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, TRouterContext, any, any>;
|
|
488
|
+
type MergeParamsFromParent<T, U> = IsAny<T, U, T & U>;
|
|
489
|
+
type UseLoaderResult<T> = T extends Record<PropertyKey, infer U> ? {
|
|
490
|
+
[K in keyof T]: UseLoaderResultPromise<T[K]>;
|
|
491
|
+
} : UseLoaderResultPromise<T>;
|
|
492
|
+
type UseLoaderResultPromise<T> = T extends Promise<infer U> ? StreamedPromise<U> : T;
|
|
493
|
+
type StreamedPromise<T> = {
|
|
494
|
+
promise: Promise<T>;
|
|
495
|
+
status: 'resolved' | 'pending';
|
|
496
|
+
data: T;
|
|
497
|
+
resolve: (value: T) => void;
|
|
498
|
+
};
|
|
499
|
+
declare class Route<TParentRoute extends AnyRoute = AnyRoute, TPath extends string = '/', TFullPath extends ResolveFullPath<TParentRoute, TPath> = ResolveFullPath<TParentRoute, TPath>, TCustomId extends string = string, TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams extends MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams> = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends TParentRoute['__types']['routeContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends TParentRoute['__types']['context'] = TParentRoute['__types']['context'], TRouteContext extends RouteContext = RouteContext, TContext extends MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext> = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo> {
|
|
500
|
+
__types: {
|
|
501
|
+
parentRoute: TParentRoute;
|
|
502
|
+
path: TPath;
|
|
503
|
+
to: TrimPathRight<TFullPath>;
|
|
504
|
+
fullPath: TFullPath;
|
|
505
|
+
customId: TCustomId;
|
|
506
|
+
id: TId;
|
|
507
|
+
loader: TLoader;
|
|
508
|
+
searchSchema: TSearchSchema;
|
|
509
|
+
fullSearchSchema: TFullSearchSchema;
|
|
510
|
+
params: TParams;
|
|
511
|
+
allParams: TAllParams;
|
|
512
|
+
parentContext: TParentContext;
|
|
513
|
+
allParentContext: TAllParentContext;
|
|
514
|
+
routeContext: TRouteContext;
|
|
515
|
+
context: TContext;
|
|
516
|
+
children: TChildren;
|
|
517
|
+
routesInfo: TRoutesInfo;
|
|
518
|
+
routerContext: TRouterContext;
|
|
519
|
+
};
|
|
520
|
+
isRoot: TParentRoute extends Route<any> ? true : false;
|
|
521
|
+
options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute['__types']['allParams'], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>;
|
|
522
|
+
parentRoute: TParentRoute;
|
|
459
523
|
id: TId;
|
|
460
|
-
|
|
461
|
-
path: NoInfer<TPath>;
|
|
524
|
+
path: TPath;
|
|
462
525
|
fullPath: TFullPath;
|
|
463
|
-
|
|
464
|
-
children?:
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}) =>
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
declare
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
526
|
+
to: TrimPathRight<TFullPath>;
|
|
527
|
+
children?: TChildren;
|
|
528
|
+
originalIndex?: number;
|
|
529
|
+
router?: Router<TRoutesInfo['routeTree'], TRoutesInfo>;
|
|
530
|
+
rank: number;
|
|
531
|
+
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute['__types']['allParams'], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext> & UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>);
|
|
532
|
+
init: (opts: {
|
|
533
|
+
originalIndex: number;
|
|
534
|
+
router: AnyRouter;
|
|
535
|
+
}) => void;
|
|
536
|
+
addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TNewChildren, TRoutesInfo>;
|
|
537
|
+
update: (options: UpdatableRouteOptions<TLoader, TSearchSchema, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => this;
|
|
538
|
+
static __onInit: (route: typeof this$1) => void;
|
|
539
|
+
}
|
|
540
|
+
type AnyRootRoute = RootRoute<any, any, any, any>;
|
|
541
|
+
declare class RouterContext<TRouterContext extends {}> {
|
|
542
|
+
constructor();
|
|
543
|
+
createRootRoute: <TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", {}, TSearchSchema, {}, {}, AnyPathParams, Record<never, string>, Record<never, string>, AnyContext, AnyContext, RouteContext, RouteContext>, "caseSensitive" | "path" | "getParentRoute" | "stringifyParams" | "parseParams" | "id"> | undefined) => RootRoute<TLoader, TSearchSchema, TContext, TRouterContext>;
|
|
544
|
+
}
|
|
545
|
+
declare class RootRoute<TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TContext extends RouteContext = RouteContext, TRouterContext extends {} = {}> extends Route<any, '/', '/', string, RootRouteId, TLoader, TSearchSchema, TSearchSchema, {}, {}, TRouterContext, TRouterContext, MergeParamsFromParent<TRouterContext, TContext>, MergeParamsFromParent<TRouterContext, TContext>, TRouterContext, any, any> {
|
|
546
|
+
constructor(options?: Omit<RouteOptions<AnyRoute, RootRouteId, '', TLoader, TSearchSchema, {}, {}>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
|
|
547
|
+
}
|
|
548
|
+
type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed extends RoutePrefix<TParentRoute['fullPath'], TPath> = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
|
|
549
|
+
type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
|
|
550
|
+
type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
|
|
551
|
+
type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
|
|
552
|
+
type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
|
|
553
|
+
|
|
554
|
+
interface AnyRoutesInfo {
|
|
555
|
+
routeTree: AnyRoute;
|
|
556
|
+
routeUnion: AnyRoute;
|
|
557
|
+
routesById: Record<string, AnyRoute>;
|
|
558
|
+
routesByFullPath: Record<string, AnyRoute>;
|
|
559
|
+
routeIds: any;
|
|
560
|
+
routePaths: any;
|
|
561
|
+
routeIntersection: AnyRoute;
|
|
562
|
+
fullSearchSchema: Record<string, any>;
|
|
563
|
+
allParams: Record<string, any>;
|
|
564
|
+
}
|
|
565
|
+
interface DefaultRoutesInfo {
|
|
566
|
+
routeTree: AnyRoute;
|
|
567
|
+
routeUnion: AnyRoute;
|
|
568
|
+
routesById: Record<string, Route>;
|
|
569
|
+
routesByFullPath: Record<string, Route>;
|
|
570
|
+
routeIds: string;
|
|
571
|
+
routePaths: string;
|
|
572
|
+
routeIntersection: AnyRoute;
|
|
573
|
+
fullSearchSchema: AnySearchSchema;
|
|
574
|
+
allParams: AnyPathParams;
|
|
575
|
+
}
|
|
576
|
+
interface RoutesInfo<TRouteTree extends AnyRoute = Route> extends RoutesInfoInner<TRouteTree, ParseRoute<TRouteTree>> {
|
|
577
|
+
}
|
|
578
|
+
interface RoutesInfoInner<TRouteTree extends AnyRoute, TRouteUnion extends AnyRoute = Route, TRoutesById = {
|
|
579
|
+
'/': TRouteUnion;
|
|
580
|
+
} & {
|
|
581
|
+
[TRoute in TRouteUnion as TRoute['id']]: TRoute;
|
|
582
|
+
}, TRoutesByFullPath = {
|
|
583
|
+
'/': TRouteUnion;
|
|
584
|
+
} & {
|
|
585
|
+
[TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : `${TRoute['fullPath']}/` extends keyof TRoutesById ? never : TRoute['fullPath'] extends `${infer Trimmed}/` ? Trimmed : TRoute['fullPath']]: TRoute;
|
|
586
|
+
}> {
|
|
587
|
+
routeTree: TRouteTree;
|
|
588
|
+
routeUnion: TRouteUnion;
|
|
589
|
+
routesById: TRoutesById;
|
|
590
|
+
routesByFullPath: TRoutesByFullPath;
|
|
591
|
+
routeIds: keyof TRoutesById;
|
|
592
|
+
routePaths: keyof TRoutesByFullPath;
|
|
593
|
+
routeIntersection: Route<TRouteUnion['__types']['parentRoute'], // TParentRoute,
|
|
594
|
+
TRouteUnion['__types']['path'], // TPath,
|
|
595
|
+
TRouteUnion['__types']['fullPath'], // TFullPath,
|
|
596
|
+
TRouteUnion['__types']['customId'], // TCustomId,
|
|
597
|
+
TRouteUnion['__types']['id'], // TId,
|
|
598
|
+
TRouteUnion['__types']['loader'], // TId,
|
|
599
|
+
// TId,
|
|
600
|
+
MergeUnion<TRouteUnion['__types']['searchSchema']> & {}, // TSearchSchema,
|
|
601
|
+
// TSearchSchema,
|
|
602
|
+
MergeUnion<TRouteUnion['__types']['fullSearchSchema']> & {}, // TFullSearchSchema,
|
|
603
|
+
MergeUnion<TRouteUnion['__types']['params']>, // TParams,
|
|
604
|
+
MergeUnion<TRouteUnion['__types']['allParams']>, // TAllParams,
|
|
605
|
+
MergeUnion<TRouteUnion['__types']['parentContext']>, // TParentContext,
|
|
606
|
+
MergeUnion<TRouteUnion['__types']['allParentContext']>, // TAllParentContext,
|
|
607
|
+
// TAllParentContext,
|
|
608
|
+
MergeUnion<TRouteUnion['__types']['routeContext']> & {}, // TRouteContext,
|
|
609
|
+
// TRouteContext,
|
|
610
|
+
MergeUnion<TRouteUnion['__types']['context']> & {}, // TContext,
|
|
611
|
+
// TContext,
|
|
612
|
+
MergeUnion<TRouteUnion['__types']['routerContext']> & {}, // TRouterContext,
|
|
613
|
+
TRouteUnion['__types']['children'], // TChildren,
|
|
614
|
+
TRouteUnion['__types']['routesInfo']>;
|
|
615
|
+
fullSearchSchema: Partial<MergeUnion<TRouteUnion['__types']['fullSearchSchema']>>;
|
|
616
|
+
allParams: Partial<MergeUnion<TRouteUnion['__types']['allParams']>>;
|
|
617
|
+
}
|
|
618
|
+
type ParseRoute<TRouteTree> = TRouteTree extends AnyRoute ? TRouteTree | ParseRouteChildren<TRouteTree> : never;
|
|
619
|
+
type ParseRouteChildren<TRouteTree> = TRouteTree extends Route<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[] ? Values<{
|
|
620
|
+
[TId in TChildren[number]['id']]: ParseRouteChild<TChildren[number], TId>;
|
|
621
|
+
}> : never : never;
|
|
622
|
+
type ParseRouteChild<TRoute, TId> = TRoute extends AnyRoute ? ParseRoute<TRoute> : never;
|
|
623
|
+
type RoutesById<TRoutesInfo extends AnyRoutesInfo> = {
|
|
624
|
+
[K in keyof TRoutesInfo['routesById']]: TRoutesInfo['routesById'][K];
|
|
625
|
+
};
|
|
626
|
+
type RouteById<TRoutesInfo extends AnyRoutesInfo, TId> = TId extends keyof TRoutesInfo['routesById'] ? IsAny<TRoutesInfo['routesById'][TId]['id'], Route, TRoutesInfo['routesById'][TId]> : never;
|
|
627
|
+
type RoutesByPath<TRoutesInfo extends AnyRoutesInfo> = {
|
|
628
|
+
[K in keyof TRoutesInfo['routesByFullPath']]: TRoutesInfo['routesByFullPath'][K];
|
|
629
|
+
};
|
|
630
|
+
type RouteByPath<TRoutesInfo extends AnyRoutesInfo, TPath> = TPath extends keyof TRoutesInfo['routesByFullPath'] ? IsAny<TRoutesInfo['routesByFullPath'][TPath]['id'], Route, TRoutesInfo['routesByFullPath'][TPath]> : never;
|
|
488
631
|
|
|
489
|
-
|
|
632
|
+
type LinkInfo = {
|
|
490
633
|
type: 'external';
|
|
491
634
|
href: string;
|
|
492
635
|
} | {
|
|
493
636
|
type: 'internal';
|
|
494
|
-
next:
|
|
637
|
+
next: ParsedLocation;
|
|
495
638
|
handleFocus: (e: any) => void;
|
|
496
639
|
handleClick: (e: any) => void;
|
|
497
640
|
handleEnter: (e: any) => void;
|
|
498
641
|
handleLeave: (e: any) => void;
|
|
642
|
+
handleTouchStart: (e: any) => void;
|
|
499
643
|
isActive: boolean;
|
|
500
644
|
disabled?: boolean;
|
|
501
645
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
646
|
+
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;
|
|
647
|
+
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;
|
|
648
|
+
type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `$${infer V}` ? V : never : never;
|
|
649
|
+
type Join<T, Delimiter extends string = '/'> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}${Delimiter}${Join<Tail>}`> : never;
|
|
650
|
+
type Last<T extends any[]> = T extends [...infer _, infer L] ? L : never;
|
|
651
|
+
type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
|
|
508
652
|
...Split<ResolveRelativePath<TFrom, TTo>, false>,
|
|
509
653
|
...infer TToRest
|
|
510
654
|
] ? `${CleanPath<Join<[
|
|
@@ -514,64 +658,60 @@ declare type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends s
|
|
|
514
658
|
...Split<TFrom, false>,
|
|
515
659
|
...Split<RestTTo, false>,
|
|
516
660
|
...infer RestPath
|
|
517
|
-
] ? `${TTo}${Join<RestPath>}` : never :
|
|
518
|
-
|
|
661
|
+
] ? `${TTo}${Join<RestPath>}` : never : (TFrom extends `/` ? never : SplitPaths extends [...Split<TFrom, false>, ...infer RestPath] ? Join<RestPath> extends {
|
|
662
|
+
length: 0;
|
|
663
|
+
} ? never : './' : never) | (TFrom extends `/` ? never : '../') | AllPaths;
|
|
664
|
+
type NavigateOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = ToOptions<TRoutesInfo, TFrom, TTo> & {
|
|
519
665
|
replace?: boolean;
|
|
520
666
|
};
|
|
521
|
-
|
|
522
|
-
to?: ToPathOption<
|
|
667
|
+
type ToOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = '', TResolvedTo = ResolveRelativePath<TFrom, NoInfer<TTo>>> = {
|
|
668
|
+
to?: ToPathOption<TRoutesInfo, TFrom, TTo>;
|
|
523
669
|
hash?: Updater<string>;
|
|
670
|
+
state?: LocationState;
|
|
524
671
|
from?: TFrom;
|
|
525
|
-
} & CheckPath<
|
|
526
|
-
|
|
527
|
-
search?: SearchReducer<
|
|
528
|
-
} : keyof PickRequired<TToSchema> extends never ? {
|
|
529
|
-
search?: SearchReducer<TFromSchema, TToSchema>;
|
|
672
|
+
} & CheckPath<TRoutesInfo, NoInfer<TResolvedTo>, {}> & SearchParamOptions<TRoutesInfo, TFrom, TResolvedTo> & PathParamOptions<TRoutesInfo, TFrom, TResolvedTo>;
|
|
673
|
+
type SearchParamOptions<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo, TFromSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & RouteByPath<TRoutesInfo, TFrom> extends never ? {} : RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']>, TToSchema = Partial<RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']> & Omit<RouteByPath<TRoutesInfo, TTo>['__types']['fullSearchSchema'], keyof PickRequired<RouteByPath<TRoutesInfo, TFrom>['__types']['fullSearchSchema']>>, TFromFullSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & TFromSchema>, TToFullSchema = UnionToIntersection<TRoutesInfo['fullSearchSchema'] & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
|
|
674
|
+
search?: true | SearchReducer<TFromFullSchema, TToFullSchema>;
|
|
530
675
|
} : {
|
|
531
|
-
search: SearchReducer<
|
|
676
|
+
search: SearchReducer<TFromFullSchema, TToFullSchema>;
|
|
532
677
|
};
|
|
533
|
-
|
|
678
|
+
type SearchReducer<TFrom, TTo> = {
|
|
534
679
|
[TKey in keyof TTo]: TTo[TKey];
|
|
535
680
|
} | ((current: TFrom) => TTo);
|
|
536
|
-
|
|
537
|
-
params?: ParamsReducer<
|
|
538
|
-
} : AnyPathParams extends TToParams ? {
|
|
539
|
-
params?: ParamsReducer<TFromParams, Record<string, never>>;
|
|
681
|
+
type PathParamOptions<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo, TFromSchema = UnionToIntersection<RouteByPath<TRoutesInfo, TFrom> extends never ? {} : RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']>, TToSchema = Partial<RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']> & Omit<RouteByPath<TRoutesInfo, TTo>['__types']['allParams'], keyof PickRequired<RouteByPath<TRoutesInfo, TFrom>['__types']['allParams']>>, TFromFullParams = UnionToIntersection<TRoutesInfo['allParams'] & TFromSchema>, TToFullParams = UnionToIntersection<TRoutesInfo['allParams'] & TToSchema>> = keyof PickRequired<TToSchema> extends never ? {
|
|
682
|
+
params?: ParamsReducer<TFromFullParams, TToFullParams>;
|
|
540
683
|
} : {
|
|
541
|
-
params: ParamsReducer<
|
|
684
|
+
params: ParamsReducer<TFromFullParams, TToFullParams>;
|
|
542
685
|
};
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
686
|
+
type ParamsReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo);
|
|
687
|
+
type ToPathOption<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<TRoutesInfo['routePaths'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
688
|
+
type ToIdOption<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = TTo | RelativeToPathAutoComplete<TRoutesInfo['routeIds'], NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>;
|
|
546
689
|
interface ActiveOptions {
|
|
547
690
|
exact?: boolean;
|
|
548
691
|
includeHash?: boolean;
|
|
692
|
+
includeSearch?: boolean;
|
|
549
693
|
}
|
|
550
|
-
|
|
694
|
+
type LinkOptions<TRoutesInfo extends AnyRoutesInfo = RegisteredRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = ''> = NavigateOptions<TRoutesInfo, TFrom, TTo> & {
|
|
551
695
|
target?: HTMLAnchorElement['target'];
|
|
552
696
|
activeOptions?: ActiveOptions;
|
|
553
697
|
preload?: false | 'intent';
|
|
554
|
-
preloadMaxAge?: number;
|
|
555
|
-
preloadGcMaxAge?: number;
|
|
556
698
|
preloadDelay?: number;
|
|
557
699
|
disabled?: boolean;
|
|
558
700
|
};
|
|
559
|
-
|
|
701
|
+
type CheckRelativePath<TRoutesInfo extends AnyRoutesInfo, TFrom, TTo> = TTo extends string ? TFrom extends string ? ResolveRelativePath<TFrom, TTo> extends TRoutesInfo['routePaths'] ? {} : {
|
|
560
702
|
Error: `${TFrom} + ${TTo} resolves to ${ResolveRelativePath<TFrom, TTo>}, which is not a valid route path.`;
|
|
561
|
-
'Valid Route Paths':
|
|
703
|
+
'Valid Route Paths': TRoutesInfo['routePaths'];
|
|
562
704
|
} : {} : {};
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
declare type CheckIdError<TAllRouteInfo extends AnyAllRouteInfo, TInvalids> = Expand<{
|
|
705
|
+
type CheckPath<TRoutesInfo extends AnyRoutesInfo, TPath, TPass> = Exclude<TPath, TRoutesInfo['routePaths']> extends never ? TPass : CheckPathError<TRoutesInfo, Exclude<TPath, TRoutesInfo['routePaths']>>;
|
|
706
|
+
type CheckPathError<TRoutesInfo extends AnyRoutesInfo, TInvalids> = {
|
|
707
|
+
to: TRoutesInfo['routePaths'];
|
|
708
|
+
};
|
|
709
|
+
type CheckId<TRoutesInfo extends AnyRoutesInfo, TPath, TPass> = Exclude<TPath, TRoutesInfo['routeIds']> extends never ? TPass : CheckIdError<TRoutesInfo, Exclude<TPath, TRoutesInfo['routeIds']>>;
|
|
710
|
+
type CheckIdError<TRoutesInfo extends AnyRoutesInfo, TInvalids> = {
|
|
570
711
|
Error: `${TInvalids extends string ? TInvalids : never} is not a valid route ID.`;
|
|
571
|
-
'Valid Route IDs':
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
declare type ValidFromPath<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = undefined | (string extends TAllRouteInfo['routePaths'] ? string : TAllRouteInfo['routePaths']);
|
|
712
|
+
'Valid Route IDs': TRoutesInfo['routeIds'];
|
|
713
|
+
};
|
|
714
|
+
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;
|
|
575
715
|
|
|
576
716
|
interface Segment {
|
|
577
717
|
type: 'pathname' | 'param' | 'wildcard';
|
|
@@ -584,16 +724,57 @@ declare function trimPathRight(path: string): string;
|
|
|
584
724
|
declare function trimPath(path: string): string;
|
|
585
725
|
declare function resolvePath(basepath: string, base: string, to: string): string;
|
|
586
726
|
declare function parsePathname(pathname?: string): Segment[];
|
|
587
|
-
declare function interpolatePath(path: string | undefined, params: any,
|
|
588
|
-
declare function matchPathname(currentPathname: string, matchLocation: Pick<MatchLocation, 'to' | 'fuzzy' | 'caseSensitive'>): AnyPathParams | undefined;
|
|
589
|
-
declare function matchByPath(from: string, matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>): Record<string, string> | undefined;
|
|
727
|
+
declare function interpolatePath(path: string | undefined, params: any, leaveWildcards?: boolean): string;
|
|
728
|
+
declare function matchPathname(basepath: string, currentPathname: string, matchLocation: Pick<MatchLocation, 'to' | 'fuzzy' | 'caseSensitive'>): AnyPathParams | undefined;
|
|
729
|
+
declare function matchByPath(basepath: string, from: string, matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>): Record<string, string> | undefined;
|
|
590
730
|
|
|
591
731
|
declare function encode(obj: any, pfx?: string): string;
|
|
592
732
|
declare function decode(str: any): {};
|
|
593
733
|
|
|
734
|
+
interface FileRoutesByPath {
|
|
735
|
+
}
|
|
736
|
+
declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TPath extends string = Last<Split<TFilePath>>, TCustomId extends string = TPath extends `_${infer T}` ? T : string> {
|
|
737
|
+
path: TFilePath;
|
|
738
|
+
constructor(path: TFilePath);
|
|
739
|
+
createRoute: <TFullPath extends ResolveFullPath<TParentRoute, TPath, string extends TPath ? "__root__" : TPath extends string ? TParentRoute["fullPath"] extends infer T ? T extends TParentRoute["fullPath"] ? T extends "__root__" ? TPath extends "/" ? "/" : `/${TrimPath<TPath>}` : `${T}/${TPath}` extends "/" ? "/" : `/${TrimPathLeft<`${TrimPathRight<T>}/${TrimPath<TPath>}`>}` : never : never : never> = ResolveFullPath<TParentRoute, TPath, string extends TPath ? "__root__" : TPath extends string ? TParentRoute["fullPath"] extends infer T ? T extends TParentRoute["fullPath"] ? T extends "__root__" ? TPath extends "/" ? "/" : `/${TrimPath<TPath>}` : `${T}/${TPath}` extends "/" ? "/" : `/${TrimPathLeft<`${TrimPathRight<T>}/${TrimPath<TPath>}`>}` : never : never : never>, TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams extends IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams> = IsAny<TParentRoute["__types"]["allParams"], TParams, TParentRoute["__types"]["allParams"] & TParams>, TParentContext extends TParentRoute["__types"]["routeContext"] = TParentRoute["__types"]["routeContext"], TAllParentContext extends TParentRoute["__types"]["context"] = TParentRoute["__types"]["context"], TRouteContext extends RouteContext = RouteContext, TContext extends IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext> = IsAny<TParentRoute["__types"]["context"], TRouteContext, TParentRoute["__types"]["context"] & TRouteContext>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo>(options: Omit<RouteOptions<TParentRoute, TCustomId, TPath, TLoader, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute["__types"]["allParams"], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, "path" | "getParentRoute" | "id"> & {
|
|
740
|
+
meta?: RouteMeta | undefined;
|
|
741
|
+
} & {
|
|
742
|
+
key?: false | GetKeyFn<TFullSearchSchema, TAllParams> | null | undefined;
|
|
743
|
+
caseSensitive?: boolean | undefined;
|
|
744
|
+
wrapInSuspense?: boolean | undefined;
|
|
745
|
+
component?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
|
|
746
|
+
errorComponent?: ((props: {
|
|
747
|
+
error: unknown;
|
|
748
|
+
} & Partial<RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>>) => unknown) | undefined;
|
|
749
|
+
pendingComponent?: ((props: RouteProps<TLoader, TFullSearchSchema, TAllParams, TRouteContext, TContext>) => unknown) | undefined;
|
|
750
|
+
preSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
751
|
+
postSearchFilters?: SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
752
|
+
preloadMaxAge?: number | undefined;
|
|
753
|
+
maxAge?: number | undefined;
|
|
754
|
+
gcMaxAge?: number | undefined;
|
|
755
|
+
beforeLoad?: ((opts: LoaderContext<TSearchSchema, TFullSearchSchema, TAllParams, NoInfer<TRouteContext>, TContext>) => void | Promise<void>) | undefined;
|
|
756
|
+
onBeforeLoadError?: ((err: any) => void) | undefined;
|
|
757
|
+
onValidateSearchError?: ((err: any) => void) | undefined;
|
|
758
|
+
onParseParamsError?: ((err: any) => void) | undefined;
|
|
759
|
+
onLoadError?: ((err: any) => void) | undefined;
|
|
760
|
+
onError?: ((err: any) => void) | undefined;
|
|
761
|
+
onLoaded?: ((matchContext: {
|
|
762
|
+
params: TAllParams;
|
|
763
|
+
search: TFullSearchSchema;
|
|
764
|
+
}) => void | ((match: {
|
|
765
|
+
params: TAllParams;
|
|
766
|
+
search: TFullSearchSchema;
|
|
767
|
+
}) => void) | undefined) | undefined;
|
|
768
|
+
onTransition?: ((match: {
|
|
769
|
+
params: TAllParams;
|
|
770
|
+
search: TFullSearchSchema;
|
|
771
|
+
}) => void) | undefined;
|
|
772
|
+
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TChildren, TRoutesInfo>;
|
|
773
|
+
}
|
|
774
|
+
|
|
594
775
|
declare const defaultParseSearch: (searchStr: string) => AnySearchSchema;
|
|
595
776
|
declare const defaultStringifySearch: (search: Record<string, any>) => string;
|
|
596
777
|
declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
|
|
597
778
|
declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
|
|
598
779
|
|
|
599
|
-
export {
|
|
780
|
+
export { ActiveOptions, AnyContext, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouteProps, AnyRouteWithRouterContext, AnyRouter, AnyRoutesInfo, AnySearchSchema, BaseRouteOptions, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, ComponentFromRoute, ComponentPropsFromRoute, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FileRoute, FileRoutesByPath, FromLocation, GetKeyFn, HydrationCtx, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, Join, Last, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderFn, LocationState, MatchLocation, MatchRouteOptions, MergeParamsFromParent, MergeUnion, MetaOptions, NavigateOptions, NoInfer, ParamsFallback, ParentParams, ParseParamsFn, ParseParamsObj, ParseParamsOption, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamError, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, PreloadableObj, Redirect, Register, RegisterRouteComponent, RegisterRouteErrorComponent, RegisteredRouteComponent, RegisteredRouteErrorComponent, RegisteredRouter, RegisteredRouterPair, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullPath, ResolveFullSearchSchema, ResolveId, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteContext, RouteLoaderFromRoute, RouteMatch, RouteMeta, RouteOptions, RoutePathOptions, RoutePathOptionsIntersection, RouteProps, Router, RouterConstructorOptions, RouterContext, RouterContextOptions, RouterHistory, RouterLocation, RouterOptions, RouterState, RoutesById, RoutesByPath, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamError, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, StreamedPromise, Timeout, ToIdOption, ToOptions, ToPathOption, TrimPath, TrimPathLeft, TrimPathRight, UnionToIntersection, UnloaderFn, UpdatableRouteOptions, Updater, UseLoaderResult, UseLoaderResultPromise, ValueKeys, Values, cleanPath, componentTypes, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, lazyFn, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
|