@luwiostack/router 0.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/README.md +780 -0
- package/dist/index.cjs +8116 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3131 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3131 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +8069 -0
- package/dist/index.mjs.map +1 -0
- package/dist/vite.cjs +41 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +40 -0
- package/dist/vite.d.cts.map +1 -0
- package/dist/vite.d.mts +40 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +40 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +92 -0
- package/vite-client.d.ts +10 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3131 @@
|
|
|
1
|
+
import * as React$2 from "react";
|
|
2
|
+
import React$1 from "react";
|
|
3
|
+
import { ILocale } from "@luwiostack/locale";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts
|
|
5
|
+
type LRUCache<TKey, TValue> = {
|
|
6
|
+
get: (key: TKey) => TValue | undefined;
|
|
7
|
+
set: (key: TKey, value: TValue) => void;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts
|
|
12
|
+
declare const SEGMENT_TYPE_PATHNAME = 0;
|
|
13
|
+
declare const SEGMENT_TYPE_PARAM = 1;
|
|
14
|
+
declare const SEGMENT_TYPE_WILDCARD = 2;
|
|
15
|
+
declare const SEGMENT_TYPE_OPTIONAL_PARAM = 3;
|
|
16
|
+
declare const SEGMENT_TYPE_INDEX = 4;
|
|
17
|
+
declare const SEGMENT_TYPE_PATHLESS = 5;
|
|
18
|
+
/**
|
|
19
|
+
* All the kinds of segments that can be present in a route path.
|
|
20
|
+
*/
|
|
21
|
+
type SegmentKind = typeof SEGMENT_TYPE_PATHNAME | typeof SEGMENT_TYPE_PARAM | typeof SEGMENT_TYPE_WILDCARD | typeof SEGMENT_TYPE_OPTIONAL_PARAM;
|
|
22
|
+
/**
|
|
23
|
+
* All the kinds of segments that can be present in the segment tree.
|
|
24
|
+
*/
|
|
25
|
+
type ExtendedSegmentKind = SegmentKind | typeof SEGMENT_TYPE_INDEX | typeof SEGMENT_TYPE_PATHLESS;
|
|
26
|
+
type StaticSegmentNode<T extends RouteLike> = SegmentNode<T> & {
|
|
27
|
+
kind: typeof SEGMENT_TYPE_PATHNAME | typeof SEGMENT_TYPE_PATHLESS | typeof SEGMENT_TYPE_INDEX;
|
|
28
|
+
};
|
|
29
|
+
type DynamicSegmentNode<T extends RouteLike> = SegmentNode<T> & {
|
|
30
|
+
kind: typeof SEGMENT_TYPE_PARAM | typeof SEGMENT_TYPE_WILDCARD | typeof SEGMENT_TYPE_OPTIONAL_PARAM;
|
|
31
|
+
prefix?: string;
|
|
32
|
+
suffix?: string;
|
|
33
|
+
caseSensitive: boolean;
|
|
34
|
+
};
|
|
35
|
+
type AnySegmentNode<T extends RouteLike> = StaticSegmentNode<T> | DynamicSegmentNode<T>;
|
|
36
|
+
type SegmentNode<T extends RouteLike> = {
|
|
37
|
+
kind: ExtendedSegmentKind;
|
|
38
|
+
pathless: Array<StaticSegmentNode<T>> | null;
|
|
39
|
+
/** Exact index segment (highest priority) */
|
|
40
|
+
index: StaticSegmentNode<T> | null;
|
|
41
|
+
/** Static segments (2nd priority) */
|
|
42
|
+
static: Map<string, StaticSegmentNode<T>> | null;
|
|
43
|
+
/** Case insensitive static segments (3rd highest priority) */
|
|
44
|
+
staticInsensitive: Map<string, StaticSegmentNode<T>> | null;
|
|
45
|
+
/** Dynamic segments ($param) */
|
|
46
|
+
dynamic: Array<DynamicSegmentNode<T>> | null;
|
|
47
|
+
/** Optional dynamic segments ({-$param}) */
|
|
48
|
+
optional: Array<DynamicSegmentNode<T>> | null;
|
|
49
|
+
/** Wildcard segments ($ - lowest priority) */
|
|
50
|
+
wildcard: Array<DynamicSegmentNode<T>> | null;
|
|
51
|
+
/** Terminal route (if this path can end here) */
|
|
52
|
+
route: T | null;
|
|
53
|
+
/** The full path for this segment node (will only be valid on leaf nodes) */
|
|
54
|
+
fullPath: string;
|
|
55
|
+
parent: AnySegmentNode<T> | null;
|
|
56
|
+
depth: number;
|
|
57
|
+
/** route.options.params.parse function, set on the last node of the route */
|
|
58
|
+
parse: null | ((params: Record<string, string>) => unknown);
|
|
59
|
+
/** route.options.params.priority ?? 0 */
|
|
60
|
+
priority: number;
|
|
61
|
+
};
|
|
62
|
+
type RouteLike = {
|
|
63
|
+
id?: string;
|
|
64
|
+
path?: string;
|
|
65
|
+
children?: Array<RouteLike>;
|
|
66
|
+
parentRoute?: RouteLike;
|
|
67
|
+
isRoot?: boolean;
|
|
68
|
+
options?: {
|
|
69
|
+
caseSensitive?: boolean;
|
|
70
|
+
parseParams?: (params: Record<string, string>) => unknown;
|
|
71
|
+
params?: {
|
|
72
|
+
parse?: (params: Record<string, string>) => unknown;
|
|
73
|
+
priority?: number;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
} & ({
|
|
77
|
+
fullPath: string;
|
|
78
|
+
from?: never;
|
|
79
|
+
} | {
|
|
80
|
+
fullPath?: never;
|
|
81
|
+
from: string;
|
|
82
|
+
});
|
|
83
|
+
type ProcessedTree<TTree extends Extract<RouteLike, {
|
|
84
|
+
fullPath: string;
|
|
85
|
+
}>, TFlat extends Extract<RouteLike, {
|
|
86
|
+
from: string;
|
|
87
|
+
}>, TSingle extends Extract<RouteLike, {
|
|
88
|
+
from: string;
|
|
89
|
+
}>> = {
|
|
90
|
+
/** a representation of the `routeTree` as a segment tree */
|
|
91
|
+
segmentTree: AnySegmentNode<TTree>;
|
|
92
|
+
/** a mini route tree generated from the flat `routeMasks` list */
|
|
93
|
+
masksTree: AnySegmentNode<TFlat> | null;
|
|
94
|
+
/** @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree */
|
|
95
|
+
singleCache: LRUCache<string, AnySegmentNode<TSingle>>;
|
|
96
|
+
/** a cache of route matches from the `segmentTree` */
|
|
97
|
+
matchCache: LRUCache<string, RouteMatch$1<TTree> | null>;
|
|
98
|
+
/** a cache of route matches from the `masksTree` */
|
|
99
|
+
flatCache: LRUCache<string, ReturnType<typeof findMatch<TFlat>>> | null;
|
|
100
|
+
};
|
|
101
|
+
type RouteMatch$1<T extends Extract<RouteLike, {
|
|
102
|
+
fullPath: string;
|
|
103
|
+
}>> = {
|
|
104
|
+
route: T;
|
|
105
|
+
rawParams: Record<string, string>;
|
|
106
|
+
branch: ReadonlyArray<T>;
|
|
107
|
+
};
|
|
108
|
+
interface ProcessRouteTreeResult<TRouteLike extends Extract<RouteLike, {
|
|
109
|
+
fullPath: string;
|
|
110
|
+
}> & {
|
|
111
|
+
id: string;
|
|
112
|
+
}> {
|
|
113
|
+
/** Should be considered a black box, needs to be provided to all matching functions in this module. */
|
|
114
|
+
processedTree: ProcessedTree<TRouteLike, any, any>;
|
|
115
|
+
/** A lookup map of routes by their unique IDs. */
|
|
116
|
+
routesById: Record<string, TRouteLike>;
|
|
117
|
+
/** A lookup map of routes by their trimmed full paths. */
|
|
118
|
+
routesByPath: Record<string, TRouteLike>;
|
|
119
|
+
}
|
|
120
|
+
declare function findMatch<T extends RouteLike>(path: string, segmentTree: AnySegmentNode<T>, fuzzy?: boolean): {
|
|
121
|
+
route: T;
|
|
122
|
+
/**
|
|
123
|
+
* The raw (unparsed) params extracted from the path.
|
|
124
|
+
* This will be the exhaustive list of all params defined in the route's path.
|
|
125
|
+
*/
|
|
126
|
+
rawParams: Record<string, string>;
|
|
127
|
+
} | null;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts
|
|
130
|
+
interface FileRouteTypes {
|
|
131
|
+
fileRoutesByFullPath: any;
|
|
132
|
+
fullPaths: any;
|
|
133
|
+
to: any;
|
|
134
|
+
fileRoutesByTo: any;
|
|
135
|
+
id: any;
|
|
136
|
+
fileRoutesById: any;
|
|
137
|
+
}
|
|
138
|
+
type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
|
|
139
|
+
type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
|
|
140
|
+
interface LazyRoute<in out TRoute extends AnyRoute> {
|
|
141
|
+
options: {
|
|
142
|
+
id: string;
|
|
143
|
+
} & LazyRouteOptions;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region ../../node_modules/.pnpm/@tanstack+history@1.162.1/node_modules/@tanstack/history/dist/esm/index.d.ts
|
|
147
|
+
interface NavigateOptions$1 {
|
|
148
|
+
ignoreBlocker?: boolean;
|
|
149
|
+
}
|
|
150
|
+
type SubscriberHistoryAction = {
|
|
151
|
+
type: Exclude<HistoryAction, 'GO'>;
|
|
152
|
+
} | {
|
|
153
|
+
type: 'GO';
|
|
154
|
+
index: number;
|
|
155
|
+
};
|
|
156
|
+
type SubscriberArgs = {
|
|
157
|
+
location: HistoryLocation$1;
|
|
158
|
+
action: SubscriberHistoryAction;
|
|
159
|
+
};
|
|
160
|
+
interface RouterHistory {
|
|
161
|
+
location: HistoryLocation$1;
|
|
162
|
+
length: number;
|
|
163
|
+
subscribers: Set<(opts: SubscriberArgs) => void>;
|
|
164
|
+
subscribe: (cb: (opts: SubscriberArgs) => void) => () => void;
|
|
165
|
+
push: (path: string, state?: any, navigateOpts?: NavigateOptions$1) => void;
|
|
166
|
+
replace: (path: string, state?: any, navigateOpts?: NavigateOptions$1) => void;
|
|
167
|
+
go: (index: number, navigateOpts?: NavigateOptions$1) => void;
|
|
168
|
+
back: (navigateOpts?: NavigateOptions$1) => void;
|
|
169
|
+
forward: (navigateOpts?: NavigateOptions$1) => void;
|
|
170
|
+
canGoBack: () => boolean;
|
|
171
|
+
createHref: (href: string) => string;
|
|
172
|
+
block: (blocker: NavigationBlocker) => () => void;
|
|
173
|
+
flush: () => void;
|
|
174
|
+
destroy: () => void;
|
|
175
|
+
notify: (action: SubscriberHistoryAction) => void;
|
|
176
|
+
_ignoreSubscribers?: boolean;
|
|
177
|
+
}
|
|
178
|
+
interface HistoryLocation$1 extends ParsedPath {
|
|
179
|
+
state: ParsedHistoryState;
|
|
180
|
+
}
|
|
181
|
+
interface ParsedPath {
|
|
182
|
+
href: string;
|
|
183
|
+
pathname: string;
|
|
184
|
+
search: string;
|
|
185
|
+
hash: string;
|
|
186
|
+
}
|
|
187
|
+
interface HistoryState {}
|
|
188
|
+
type ParsedHistoryState = HistoryState & {
|
|
189
|
+
key?: string;
|
|
190
|
+
__TSR_key?: string;
|
|
191
|
+
__TSR_index: number;
|
|
192
|
+
};
|
|
193
|
+
type ShouldAllowNavigation = any;
|
|
194
|
+
type HistoryAction = 'PUSH' | 'REPLACE' | 'FORWARD' | 'BACK' | 'GO';
|
|
195
|
+
type BlockerFnArgs = {
|
|
196
|
+
currentLocation: HistoryLocation$1;
|
|
197
|
+
nextLocation: HistoryLocation$1;
|
|
198
|
+
action: HistoryAction;
|
|
199
|
+
};
|
|
200
|
+
type BlockerFn = (args: BlockerFnArgs) => Promise<ShouldAllowNavigation> | ShouldAllowNavigation;
|
|
201
|
+
type NavigationBlocker = {
|
|
202
|
+
blockerFn: BlockerFn;
|
|
203
|
+
enableBeforeUnload?: (() => boolean) | boolean;
|
|
204
|
+
};
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/utils.d.ts
|
|
207
|
+
type Awaitable<T> = T | Promise<T>;
|
|
208
|
+
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
209
|
+
type PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> & Required<Pick<TValue, TKey>>;
|
|
210
|
+
type Expand<T> = T extends object ? T extends (infer O) ? O extends Function ? O : { [K in keyof O]: O[K]; } : never : T;
|
|
211
|
+
type MakeDifferenceOptional<TLeft, TRight> = keyof TLeft & keyof TRight extends never ? TRight : Omit<TRight, keyof TLeft & keyof TRight> & { [K in keyof TLeft & keyof TRight]?: TRight[K]; };
|
|
212
|
+
type IsNonEmptyObject<T> = T extends object ? keyof T extends never ? false : true : false;
|
|
213
|
+
type Assign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : keyof TLeft & keyof TRight extends never ? TLeft & TRight : Omit<TLeft, keyof TRight> & TRight : never : never;
|
|
214
|
+
type IntersectAssign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : TRight & TLeft : never : never;
|
|
215
|
+
type Updater<TPrevious, TResult = TPrevious> = TResult | ((prev?: TPrevious) => TResult);
|
|
216
|
+
type NonNullableUpdater<TPrevious, TResult = TPrevious> = TResult | ((prev: TPrevious) => TResult);
|
|
217
|
+
type ExtractObjects<TUnion> = TUnion extends MergeAllPrimitive ? never : TUnion;
|
|
218
|
+
type PartialMergeAllObject<TUnion> = ExtractObjects<TUnion> extends (infer TObj) ? [TObj] extends [never] ? never : { [TKey in TObj extends any ? keyof TObj : never]?: TObj extends any ? TKey extends keyof TObj ? TObj[TKey] : never : never; } : never;
|
|
219
|
+
type MergeAllPrimitive = ReadonlyArray<any> | number | string | bigint | boolean | symbol | undefined | null;
|
|
220
|
+
type ExtractPrimitives<TUnion> = TUnion extends MergeAllPrimitive ? TUnion : TUnion extends object ? never : TUnion;
|
|
221
|
+
type PartialMergeAll<TUnion> = ExtractPrimitives<TUnion> | PartialMergeAllObject<TUnion>;
|
|
222
|
+
type Constrain<T, TConstraint, TDefault = TConstraint> = (T extends TConstraint ? T : never) | TDefault;
|
|
223
|
+
type ConstrainLiteral<T, TConstraint, TDefault = TConstraint> = (T & TConstraint) | TDefault;
|
|
224
|
+
type ValidateJSON<T> = ((...args: Array<any>) => any) extends T ? unknown extends T ? never : 'Function is not serializable' : { [K in keyof T]: ValidateJSON<T[K]>; };
|
|
225
|
+
type LooseReturnType<T> = T extends ((...args: Array<any>) => infer TReturn) ? TReturn : never;
|
|
226
|
+
type LooseAsyncReturnType<T> = T extends ((...args: Array<any>) => infer TReturn) ? TReturn extends Promise<infer TReturn> ? TReturn : TReturn : never;
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/location.d.ts
|
|
229
|
+
interface ParsedLocation<TSearchObj extends AnySchema = {}> {
|
|
230
|
+
/**
|
|
231
|
+
* The full path of the location, including pathname, search, and hash.
|
|
232
|
+
* Does not include the origin. Is the equivalent of calling
|
|
233
|
+
* `url.replace(url.origin, '')`
|
|
234
|
+
*/
|
|
235
|
+
href: string;
|
|
236
|
+
/**
|
|
237
|
+
* @description The pathname of the location, including the leading slash.
|
|
238
|
+
*/
|
|
239
|
+
pathname: string;
|
|
240
|
+
/**
|
|
241
|
+
* The parsed search parameters of the location in object form.
|
|
242
|
+
*/
|
|
243
|
+
search: TSearchObj;
|
|
244
|
+
/**
|
|
245
|
+
* The search string of the location, including the leading question mark.
|
|
246
|
+
*/
|
|
247
|
+
searchStr: string;
|
|
248
|
+
/**
|
|
249
|
+
* The in-memory state of the location as it *may* exist in the browser's history.
|
|
250
|
+
*/
|
|
251
|
+
state: ParsedHistoryState;
|
|
252
|
+
/**
|
|
253
|
+
* The hash of the location, excluding the leading hash character.
|
|
254
|
+
* (e.g., '123' instead of '#123')
|
|
255
|
+
*/
|
|
256
|
+
hash: string;
|
|
257
|
+
/**
|
|
258
|
+
* The masked location of the location.
|
|
259
|
+
*/
|
|
260
|
+
maskedLocation?: ParsedLocation<TSearchObj>;
|
|
261
|
+
/**
|
|
262
|
+
* Whether to unmask the location on reload.
|
|
263
|
+
*/
|
|
264
|
+
unmaskOnReload?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* @private
|
|
267
|
+
* @description The public href of the location.
|
|
268
|
+
* If a rewrite is applied, the `href` property will be the rewritten URL.
|
|
269
|
+
*/
|
|
270
|
+
publicHref: string;
|
|
271
|
+
/**
|
|
272
|
+
* @private
|
|
273
|
+
* @description Whether the publicHref is external (different origin from rewrite).
|
|
274
|
+
*/
|
|
275
|
+
external: boolean;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/link.d.ts
|
|
279
|
+
type IsRequiredParams<TParams> = Record<never, never> extends TParams ? never : true;
|
|
280
|
+
interface ParsePathParamsResult<in out TRequired, in out TOptional, in out TRest> {
|
|
281
|
+
required: TRequired;
|
|
282
|
+
optional: TOptional;
|
|
283
|
+
rest: TRest;
|
|
284
|
+
}
|
|
285
|
+
type ParsePathParamsBoundaryStart<T extends string> = T extends `${infer TLeft}{-${infer TRight}` ? ParsePathParamsResult<ParsePathParams<TLeft>['required'], ParsePathParams<TLeft>['optional'] | ParsePathParams<TRight>['required'] | ParsePathParams<TRight>['optional'], ParsePathParams<TRight>['rest']> : T extends `${infer TLeft}{${infer TRight}` ? ParsePathParamsResult<ParsePathParams<TLeft>['required'] | ParsePathParams<TRight>['required'], ParsePathParams<TLeft>['optional'] | ParsePathParams<TRight>['optional'], ParsePathParams<TRight>['rest']> : never;
|
|
286
|
+
type ParsePathParamsSymbol<T extends string> = T extends `${string}$${infer TRight}` ? TRight extends `${string}/${string}` ? TRight extends `${infer TParam}/${infer TRest}` ? TParam extends '' ? ParsePathParamsResult<ParsePathParams<TRest>['required'], '_splat' | ParsePathParams<TRest>['optional'], ParsePathParams<TRest>['rest']> : ParsePathParamsResult<TParam | ParsePathParams<TRest>['required'], ParsePathParams<TRest>['optional'], ParsePathParams<TRest>['rest']> : never : TRight extends '' ? ParsePathParamsResult<never, '_splat', never> : ParsePathParamsResult<TRight, never, never> : never;
|
|
287
|
+
type ParsePathParamsBoundaryEnd<T extends string> = T extends `${infer TLeft}}${infer TRight}` ? ParsePathParamsResult<ParsePathParams<TLeft>['required'] | ParsePathParams<TRight>['required'], ParsePathParams<TLeft>['optional'] | ParsePathParams<TRight>['optional'], ParsePathParams<TRight>['rest']> : never;
|
|
288
|
+
type ParsePathParamsEscapeStart<T extends string> = T extends `${infer TLeft}[${infer TRight}` ? ParsePathParamsResult<ParsePathParams<TLeft>['required'] | ParsePathParams<TRight>['required'], ParsePathParams<TLeft>['optional'] | ParsePathParams<TRight>['optional'], ParsePathParams<TRight>['rest']> : never;
|
|
289
|
+
type ParsePathParamsEscapeEnd<T extends string> = T extends `${string}]${infer TRight}` ? ParsePathParams<TRight> : never;
|
|
290
|
+
type ParsePathParams<T extends string> = T extends `${string}[${string}` ? ParsePathParamsEscapeStart<T> : T extends `${string}]${string}` ? ParsePathParamsEscapeEnd<T> : T extends `${string}}${string}` ? ParsePathParamsBoundaryEnd<T> : T extends `${string}{${string}` ? ParsePathParamsBoundaryStart<T> : T extends `${string}$${string}` ? ParsePathParamsSymbol<T> : never;
|
|
291
|
+
type AddTrailingSlash<T> = T extends `${string}/` ? T : `${T & string}/`;
|
|
292
|
+
type RemoveTrailingSlashes<T> = T & `${string}/` extends never ? T : T extends `${infer R}/` ? R : T;
|
|
293
|
+
type AddLeadingSlash<T> = T & `/${string}` extends never ? `/${T & string}` : T;
|
|
294
|
+
type RemoveLeadingSlashes<T> = T & `/${string}` extends never ? T : T extends `/${infer R}` ? R : T;
|
|
295
|
+
type JoinPath<TLeft extends string, TRight extends string> = TRight extends '' ? TLeft : TLeft extends '' ? TRight : `${RemoveTrailingSlashes<TLeft>}/${RemoveLeadingSlashes<TRight>}`;
|
|
296
|
+
type RemoveLastSegment<T extends string, TAcc extends string = ''> = T extends `${infer TSegment}/${infer TRest}` ? TRest & `${string}/${string}` extends never ? TRest extends '' ? TAcc : `${TAcc}${TSegment}` : RemoveLastSegment<TRest, `${TAcc}${TSegment}/`> : TAcc;
|
|
297
|
+
type ResolveCurrentPath<TFrom extends string, TTo extends string> = TTo extends '.' ? TFrom : TTo extends './' ? AddTrailingSlash<TFrom> : TTo & `./${string}` extends never ? never : TTo extends `./${infer TRest}` ? AddLeadingSlash<JoinPath<TFrom, TRest>> : never;
|
|
298
|
+
type ResolveParentPath<TFrom extends string, TTo extends string> = TTo extends '../' | '..' ? TFrom extends '' | '/' ? never : AddLeadingSlash<RemoveLastSegment<TFrom>> : TTo & `../${string}` extends never ? AddLeadingSlash<JoinPath<TFrom, TTo>> : TFrom extends '' | '/' ? never : TTo extends `../${infer ToRest}` ? ResolveParentPath<RemoveLastSegment<TFrom>, ToRest> : AddLeadingSlash<JoinPath<TFrom, TTo>>;
|
|
299
|
+
type ResolveRelativePath<TFrom, TTo = '.'> = string extends TFrom ? TTo : string extends TTo ? TFrom : undefined extends TTo ? TFrom : TTo extends string ? TFrom extends string ? TTo extends `/${string}` ? TTo : TTo extends `..${string}` ? ResolveParentPath<TFrom, TTo> : TTo extends `.${string}` ? ResolveCurrentPath<TFrom, TTo> : AddLeadingSlash<JoinPath<TFrom, TTo>> : never : never;
|
|
300
|
+
type FindDescendantToPaths<TRouter extends AnyRouter, TPrefix extends string> = `${TPrefix}/${string}` & RouteToPath<TRouter>;
|
|
301
|
+
type InferDescendantToPaths<TRouter extends AnyRouter, TPrefix extends string, TPaths = FindDescendantToPaths<TRouter, TPrefix>> = TPaths extends `${TPrefix}/` ? never : TPaths extends `${TPrefix}/${infer TRest}` ? TRest : never;
|
|
302
|
+
type RelativeToPath<TRouter extends AnyRouter, TTo extends string, TResolvedPath extends string> = (TResolvedPath & RouteToPath<TRouter> extends never ? never : ToPath<TRouter, TTo>) | `${RemoveTrailingSlashes<TTo>}/${InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TResolvedPath>>}`;
|
|
303
|
+
type RelativeToParentPath<TRouter extends AnyRouter, TFrom extends string, TTo extends string, TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>> = RelativeToPath<TRouter, TTo, TResolvedPath> | (TTo extends `${string}..` | `${string}../` ? TResolvedPath extends '/' | '' ? never : FindDescendantToPaths<TRouter, RemoveTrailingSlashes<TResolvedPath>> extends never ? never : `${RemoveTrailingSlashes<TTo>}/${ParentPath<TRouter>}` : never);
|
|
304
|
+
type RelativeToCurrentPath<TRouter extends AnyRouter, TFrom extends string, TTo extends string, TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>> = RelativeToPath<TRouter, TTo, TResolvedPath> | CurrentPath<TRouter>;
|
|
305
|
+
type AbsoluteToPath<TRouter extends AnyRouter, TFrom extends string> = (string extends TFrom ? CurrentPath<TRouter> : TFrom extends `/` ? never : CurrentPath<TRouter>) | (string extends TFrom ? ParentPath<TRouter> : TFrom extends `/` ? never : ParentPath<TRouter>) | RouteToPath<TRouter> | (TFrom extends '/' ? never : string extends TFrom ? never : InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TFrom>>);
|
|
306
|
+
type RelativeToPathAutoComplete<TRouter extends AnyRouter, TFrom extends string, TTo extends string> = string extends TTo ? string : string extends TFrom ? AbsoluteToPath<TRouter, TFrom> : TTo & `..${string}` extends never ? TTo & `.${string}` extends never ? AbsoluteToPath<TRouter, TFrom> : RelativeToCurrentPath<TRouter, TFrom, TTo> : RelativeToParentPath<TRouter, TFrom, TTo>;
|
|
307
|
+
type NavigateOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & NavigateOptionProps;
|
|
308
|
+
/**
|
|
309
|
+
* The NavigateOptions type is used to describe the options that can be used when describing a navigation action in TanStack Router.
|
|
310
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType)
|
|
311
|
+
*/
|
|
312
|
+
interface NavigateOptionProps {
|
|
313
|
+
/**
|
|
314
|
+
* If set to `true`, the router will scroll the element with an id matching the hash into view with default `ScrollIntoViewOptions`.
|
|
315
|
+
* If set to `false`, the router will not scroll the element with an id matching the hash into view.
|
|
316
|
+
* If set to `ScrollIntoViewOptions`, the router will scroll the element with an id matching the hash into view with the provided options.
|
|
317
|
+
* @default true
|
|
318
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#hashscrollintoview)
|
|
319
|
+
* @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)
|
|
320
|
+
*/
|
|
321
|
+
hashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
322
|
+
/**
|
|
323
|
+
* `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.
|
|
324
|
+
* @default false
|
|
325
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#replace)
|
|
326
|
+
*/
|
|
327
|
+
replace?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history.
|
|
330
|
+
* If `false`, the scroll position will not be reset to 0,0 after the location is committed to history.
|
|
331
|
+
* @default true
|
|
332
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#resetscroll)
|
|
333
|
+
*/
|
|
334
|
+
resetScroll?: boolean;
|
|
335
|
+
/** @deprecated All navigations now use startTransition under the hood */
|
|
336
|
+
startTransition?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* If set to `true`, the router will wrap the resulting navigation in a `document.startViewTransition()` call.
|
|
339
|
+
* If `ViewTransitionOptions`, route navigations will be called using `document.startViewTransition({update, types})`
|
|
340
|
+
* where `types` will be the strings array passed with `ViewTransitionOptions["types"]`.
|
|
341
|
+
* If the browser does not support viewTransition types, the navigation will fall back to normal `document.startTransition()`, same as if `true` was passed.
|
|
342
|
+
*
|
|
343
|
+
* If the browser does not support this api, this option will be ignored.
|
|
344
|
+
* @default false
|
|
345
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#viewtransition)
|
|
346
|
+
* @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition)
|
|
347
|
+
* @see [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types)
|
|
348
|
+
*/
|
|
349
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
350
|
+
/**
|
|
351
|
+
* If `true`, navigation will ignore any blockers that might prevent it.
|
|
352
|
+
* @default false
|
|
353
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#ignoreblocker)
|
|
354
|
+
*/
|
|
355
|
+
ignoreBlocker?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* If `true`, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.
|
|
358
|
+
* @default false
|
|
359
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#reloaddocument)
|
|
360
|
+
*/
|
|
361
|
+
reloadDocument?: boolean;
|
|
362
|
+
/**
|
|
363
|
+
* This can be used instead of `to` to navigate to a fully built href, e.g. pointing to an external target.
|
|
364
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)
|
|
365
|
+
*/
|
|
366
|
+
href?: string;
|
|
367
|
+
}
|
|
368
|
+
type ToOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = ToSubOptions<TRouter, TFrom, TTo> & MaskOptions<TRouter, TMaskFrom, TMaskTo>;
|
|
369
|
+
interface MaskOptions<in out TRouter extends AnyRouter, in out TMaskFrom extends string, in out TMaskTo extends string> {
|
|
370
|
+
_fromLocation?: ParsedLocation;
|
|
371
|
+
mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>;
|
|
372
|
+
}
|
|
373
|
+
type ToMaskOptions<TRouter extends AnyRouter = RegisteredRouter, TMaskFrom extends string = string, TMaskTo extends string = '.'> = ToSubOptions<TRouter, TMaskFrom, TMaskTo> & {
|
|
374
|
+
unmaskOnReload?: boolean;
|
|
375
|
+
};
|
|
376
|
+
type ToSubOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.'> = ToSubOptionsProps<TRouter, TFrom, TTo> & SearchParamOptions<TRouter, TFrom, TTo> & PathParamOptions<TRouter, TFrom, TTo>;
|
|
377
|
+
interface RequiredToOptions<in out TRouter extends AnyRouter, in out TFrom extends string, in out TTo extends string | undefined> {
|
|
378
|
+
/**
|
|
379
|
+
* The internal route path to navigate to. This should be a relative or absolute path within your application.
|
|
380
|
+
* For external URLs, use the `href` property instead.
|
|
381
|
+
* @example "/dashboard" or "../profile"
|
|
382
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)
|
|
383
|
+
*/
|
|
384
|
+
to: ToPathOption<TRouter, TFrom, TTo> & {};
|
|
385
|
+
}
|
|
386
|
+
interface OptionalToOptions<in out TRouter extends AnyRouter, in out TFrom extends string, in out TTo extends string | undefined> {
|
|
387
|
+
/**
|
|
388
|
+
* The internal route path to navigate to. This should be a relative or absolute path within your application.
|
|
389
|
+
* For external URLs, use the `href` property instead.
|
|
390
|
+
* @example "/dashboard" or "../profile"
|
|
391
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)
|
|
392
|
+
*/
|
|
393
|
+
to?: ToPathOption<TRouter, TFrom, TTo> & {};
|
|
394
|
+
}
|
|
395
|
+
type MakeToRequired<TRouter extends AnyRouter, TFrom extends string, TTo extends string | undefined> = string extends TFrom ? string extends TTo ? OptionalToOptions<TRouter, TFrom, TTo> : TTo & CatchAllPaths<TRouter> extends never ? RequiredToOptions<TRouter, TFrom, TTo> : OptionalToOptions<TRouter, TFrom, TTo> : OptionalToOptions<TRouter, TFrom, TTo>;
|
|
396
|
+
type ToSubOptionsProps<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string | undefined = '.'> = MakeToRequired<TRouter, TFrom, TTo> & {
|
|
397
|
+
hash?: true | Updater<string>;
|
|
398
|
+
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
|
399
|
+
from?: FromPathOption<TRouter, TFrom> & {};
|
|
400
|
+
unsafeRelative?: 'path';
|
|
401
|
+
};
|
|
402
|
+
type ParamsReducerFn<in out TRouter extends AnyRouter, in out TParamVariant extends ParamVariant, in out TFrom, in out TTo> = (current: Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>) => Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>;
|
|
403
|
+
type ParamsReducer<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>> | (ParamsReducerFn<TRouter, TParamVariant, TFrom, TTo> & {});
|
|
404
|
+
type ParamVariant = 'PATH' | 'SEARCH';
|
|
405
|
+
type ResolveRoute<TRouter extends AnyRouter, TFrom, TTo, TPath = ResolveRelativePath<TFrom, TTo>> = TPath extends string ? TFrom extends TPath ? RouteByPath<TRouter['routeTree'], TPath> : RouteByToPath<TRouter, TPath> : never;
|
|
406
|
+
type ResolveFromParamType<TParamVariant extends ParamVariant> = TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema';
|
|
407
|
+
type ResolveFromAllParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant> = TParamVariant extends 'PATH' ? AllParams<TRouter['routeTree']> : FullSearchSchema<TRouter['routeTree']>;
|
|
408
|
+
type ResolveFromParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom> = string extends TFrom ? ResolveFromAllParams<TRouter, TParamVariant> : RouteByPath<TRouter['routeTree'], TFrom>['types'][ResolveFromParamType<TParamVariant>];
|
|
409
|
+
type ResolveToParamType<TParamVariant extends ParamVariant> = TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput';
|
|
410
|
+
type ResolveAllToParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant> = TParamVariant extends 'PATH' ? AllParams<TRouter['routeTree']> : FullSearchSchemaInput<TRouter['routeTree']>;
|
|
411
|
+
type ResolveToParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = ResolveRelativePath<TFrom, TTo> extends (infer TPath) ? undefined extends TPath ? never : string extends TPath ? ResolveAllToParams<TRouter, TParamVariant> : TPath extends CatchAllPaths<TRouter> ? ResolveAllToParams<TRouter, TParamVariant> : ResolveRoute<TRouter, TFrom, TTo>['types'][ResolveToParamType<TParamVariant>] : never;
|
|
412
|
+
type ResolveRelativeToParams<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo, TToParams = ResolveToParams<TRouter, TParamVariant, TFrom, TTo>> = TParamVariant extends 'SEARCH' ? TToParams : string extends TFrom ? TToParams : MakeDifferenceOptional<ResolveFromParams<TRouter, TParamVariant, TFrom>, TToParams>;
|
|
413
|
+
interface MakeOptionalSearchParams<in out TRouter extends AnyRouter, in out TFrom, in out TTo> {
|
|
414
|
+
search?: true | (ParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {});
|
|
415
|
+
}
|
|
416
|
+
interface MakeOptionalPathParams<in out TRouter extends AnyRouter, in out TFrom, in out TTo> {
|
|
417
|
+
params?: true | (ParamsReducer<TRouter, 'PATH', TFrom, TTo> & {});
|
|
418
|
+
}
|
|
419
|
+
type MakeRequiredParamsReducer<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = (string extends TFrom ? never : ResolveFromParams<TRouter, TParamVariant, TFrom> extends ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo> ? true : never) | (ParamsReducer<TRouter, TParamVariant, TFrom, TTo> & {});
|
|
420
|
+
interface MakeRequiredPathParams<in out TRouter extends AnyRouter, in out TFrom, in out TTo> {
|
|
421
|
+
params: MakeRequiredParamsReducer<TRouter, 'PATH', TFrom, TTo> & {};
|
|
422
|
+
}
|
|
423
|
+
interface MakeRequiredSearchParams<in out TRouter extends AnyRouter, in out TFrom, in out TTo> {
|
|
424
|
+
search: MakeRequiredParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {};
|
|
425
|
+
}
|
|
426
|
+
type IsRequired<TRouter extends AnyRouter, TParamVariant extends ParamVariant, TFrom, TTo> = ResolveRelativePath<TFrom, TTo> extends (infer TPath) ? undefined extends TPath ? never : TPath extends CatchAllPaths<TRouter> ? never : IsRequiredParams<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>> : never;
|
|
427
|
+
type SearchParamOptions<TRouter extends AnyRouter, TFrom, TTo> = IsRequired<TRouter, 'SEARCH', TFrom, TTo> extends never ? MakeOptionalSearchParams<TRouter, TFrom, TTo> : MakeRequiredSearchParams<TRouter, TFrom, TTo>;
|
|
428
|
+
type PathParamOptions<TRouter extends AnyRouter, TFrom, TTo> = IsRequired<TRouter, 'PATH', TFrom, TTo> extends never ? MakeOptionalPathParams<TRouter, TFrom, TTo> : MakeRequiredPathParams<TRouter, TFrom, TTo>;
|
|
429
|
+
type ToPathOption<TRouter extends AnyRouter = AnyRouter, TFrom extends string = string, TTo extends string | undefined = string> = ConstrainLiteral<TTo, RelativeToPathAutoComplete<TRouter, NoInfer<TFrom> extends string ? NoInfer<TFrom> : '', NoInfer<TTo> & string>>;
|
|
430
|
+
type FromPathOption<TRouter extends AnyRouter, TFrom> = ConstrainLiteral<TFrom, RoutePaths<TRouter['routeTree']>>;
|
|
431
|
+
/**
|
|
432
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/navigation#active-options)
|
|
433
|
+
*/
|
|
434
|
+
interface ActiveOptions {
|
|
435
|
+
/**
|
|
436
|
+
* If true, the link will be active if the current route matches the `to` route path exactly (no children routes)
|
|
437
|
+
* @default false
|
|
438
|
+
*/
|
|
439
|
+
exact?: boolean;
|
|
440
|
+
/**
|
|
441
|
+
* If true, the link will only be active if the current URL hash matches the `hash` prop
|
|
442
|
+
* @default false
|
|
443
|
+
*/
|
|
444
|
+
includeHash?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* If true, the link will only be active if the current URL search params inclusively match the `search` prop
|
|
447
|
+
* @default true
|
|
448
|
+
*/
|
|
449
|
+
includeSearch?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* This modifies the `includeSearch` behavior.
|
|
452
|
+
* If true, properties in `search` that are explicitly `undefined` must NOT be present in the current URL search params for the link to be active.
|
|
453
|
+
* @default false
|
|
454
|
+
*/
|
|
455
|
+
explicitUndefined?: boolean;
|
|
456
|
+
}
|
|
457
|
+
interface LinkOptionsProps {
|
|
458
|
+
/**
|
|
459
|
+
* The standard anchor tag target attribute
|
|
460
|
+
*/
|
|
461
|
+
target?: HTMLAnchorElement['target'];
|
|
462
|
+
/**
|
|
463
|
+
* Configurable options to determine if the link should be considered active or not
|
|
464
|
+
* @default {exact:true,includeHash:true}
|
|
465
|
+
*/
|
|
466
|
+
activeOptions?: ActiveOptions;
|
|
467
|
+
/**
|
|
468
|
+
* The preloading strategy for this link
|
|
469
|
+
* - `false` - No preloading
|
|
470
|
+
* - `'intent'` - Preload the linked route when the user focuses, hovers over, or touches the link
|
|
471
|
+
* - `'viewport'` - Preload the linked route when it enters the viewport
|
|
472
|
+
* - `'render'` - Preload the linked route as soon as it renders
|
|
473
|
+
*/
|
|
474
|
+
preload?: false | 'intent' | 'viewport' | 'render';
|
|
475
|
+
/**
|
|
476
|
+
* Delays focus, hover, and viewport preloading by this many milliseconds.
|
|
477
|
+
* Touch intent preloads immediately. If focus or hover ends, or the link
|
|
478
|
+
* leaves the viewport before this delay, the preload will be cancelled.
|
|
479
|
+
*/
|
|
480
|
+
preloadDelay?: number;
|
|
481
|
+
/**
|
|
482
|
+
* Control whether the link should be disabled or not
|
|
483
|
+
* If set to `true`, the link will be rendered without an `href` attribute
|
|
484
|
+
* @default false
|
|
485
|
+
*/
|
|
486
|
+
disabled?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* When the preload strategy is set to `intent`, this controls the proximity of the link to the cursor before it is preloaded.
|
|
489
|
+
* If the user exits this proximity before this delay, the preload will be cancelled.
|
|
490
|
+
*/
|
|
491
|
+
preloadIntentProximity?: number;
|
|
492
|
+
}
|
|
493
|
+
type LinkOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkOptionsProps;
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts
|
|
496
|
+
type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
|
|
497
|
+
types: {
|
|
498
|
+
children: infer TChildren;
|
|
499
|
+
};
|
|
500
|
+
} ? unknown extends TChildren ? TAcc : TChildren extends ReadonlyArray<any> ? ParseRoute<TChildren[number], TAcc | TChildren[number]> : ParseRoute<TChildren[keyof TChildren], TAcc | TChildren[keyof TChildren]> : TAcc;
|
|
501
|
+
type ParseRouteWithoutBranches<TRouteTree> = ParseRoute<TRouteTree> extends (infer TRoute extends AnyRoute) ? TRoute extends any ? unknown extends TRoute['types']['children'] ? TRoute : TRoute['types']['children'] extends ReadonlyArray<any> ? '/' extends TRoute['types']['children'][number]['path'] ? never : TRoute : '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path'] ? never : TRoute : never : never;
|
|
502
|
+
type CodeRoutesById<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? { [K in TRoutes as K['id']]: K; } : never;
|
|
503
|
+
type RoutesById<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesById<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesById'];
|
|
504
|
+
type RouteById<TRouteTree extends AnyRoute, TId> = Extract<RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>], AnyRoute>;
|
|
505
|
+
type CodeRouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? TRoutes['id'] : never;
|
|
506
|
+
type RouteIds<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRouteIds<TRouteTree> : InferFileRouteTypes<TRouteTree>['id'];
|
|
507
|
+
type ParentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? '../' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '..' : '../' | '..';
|
|
508
|
+
type CurrentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? './' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '.' : './' | '.';
|
|
509
|
+
type ToPath<TRouter extends AnyRouter, TTo extends string> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? AddTrailingSlash<TTo> : TrailingSlashOptionByRouter<TRouter> extends 'never' ? RemoveTrailingSlashes<TTo> : AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>;
|
|
510
|
+
type CatchAllPaths<TRouter extends AnyRouter> = CurrentPath<TRouter> | ParentPath<TRouter>;
|
|
511
|
+
type CodeRoutesByPath<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? { [K in TRoutes as K['fullPath']]: K; } : never;
|
|
512
|
+
type RoutesByPath<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesByPath<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath'];
|
|
513
|
+
type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>], AnyRoute>;
|
|
514
|
+
type CodeRoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? TRoutes['fullPath'] : never;
|
|
515
|
+
type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree ? string : (InferFileRouteTypes<TRouteTree> extends never ? CodeRoutePaths<TRouteTree> : InferFileRouteTypes<TRouteTree>['fullPaths']) | '/';
|
|
516
|
+
type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : `${TRoute['fullPath']}/`;
|
|
517
|
+
type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : RemoveTrailingSlashes<TRoute['fullPath']> : TRoute['fullPath'];
|
|
518
|
+
type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> = RouteToPathNeverTrailingSlash<TRoute> | RouteToPathAlwaysTrailingSlash<TRoute>;
|
|
519
|
+
type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
|
|
520
|
+
always: RouteToPathAlwaysTrailingSlash<TRoute>;
|
|
521
|
+
preserve: RouteToPathPreserveTrailingSlash<TRoute>;
|
|
522
|
+
never: RouteToPathNeverTrailingSlash<TRoute>;
|
|
523
|
+
};
|
|
524
|
+
type TrailingSlashOptionByRouter<TRouter extends AnyRouter> = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable<TRouter['options']['trailingSlash']>;
|
|
525
|
+
type RouteToByRouter<TRouter extends AnyRouter, TRoute extends AnyRoute> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>];
|
|
526
|
+
type CodeRouteToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends (infer TRoute extends AnyRoute) ? TRoute extends any ? RouteToByRouter<TRouter, TRoute> : never : never;
|
|
527
|
+
type FileRouteToPath<TRouter extends AnyRouter, TTo = InferFileRouteTypes<TRouter['routeTree']>['to'], TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>> = 'never' extends TTrailingSlashOption ? TTo : 'always' extends TTrailingSlashOption ? AddTrailingSlash<TTo> : TTo | AddTrailingSlash<TTo>;
|
|
528
|
+
type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter ? string : InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteToPath<TRouter> : FileRouteToPath<TRouter>;
|
|
529
|
+
type CodeRoutesByToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends (infer TRoutes extends AnyRoute) ? { [TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute; } : never;
|
|
530
|
+
type RoutesByToPath<TRouter extends AnyRouter> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRoutesByToPath<TRouter> : InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo'];
|
|
531
|
+
type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>], AnyRoute>;
|
|
532
|
+
type FileRouteByToPath<TRouter extends AnyRouter, TTo> = 'never' extends TrailingSlashOptionByRouter<TRouter> ? CodeRouteByToPath<TRouter, TTo> : 'always' extends TrailingSlashOptionByRouter<TRouter> ? TTo extends '/' ? CodeRouteByToPath<TRouter, TTo> : TTo extends `${infer TPath}/` ? CodeRouteByToPath<TRouter, TPath> : never : CodeRouteByToPath<TRouter, TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>>;
|
|
533
|
+
type RouteByToPath<TRouter extends AnyRouter, TTo> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteByToPath<TRouter, TTo> : FileRouteByToPath<TRouter, TTo>;
|
|
534
|
+
type FullSearchSchema<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? PartialMergeAll<TRoutes['types']['fullSearchSchema']> : never;
|
|
535
|
+
type FullSearchSchemaInput<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']> : never;
|
|
536
|
+
type AllParams<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? PartialMergeAll<TRoutes['types']['allParams']> : never;
|
|
537
|
+
type AllContext<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? PartialMergeAll<TRoutes['types']['allContext']> : never;
|
|
538
|
+
type AllLoaderData<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends (infer TRoutes extends AnyRoute) ? PartialMergeAll<TRoutes['types']['loaderData']> : never;
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts
|
|
541
|
+
type NotFoundError = {
|
|
542
|
+
/**
|
|
543
|
+
@deprecated
|
|
544
|
+
Use `routeId: rootRouteId` instead
|
|
545
|
+
*/
|
|
546
|
+
global?: boolean;
|
|
547
|
+
/**
|
|
548
|
+
@private
|
|
549
|
+
Do not use this. It's used internally to indicate a path matching error
|
|
550
|
+
*/
|
|
551
|
+
_global?: boolean;
|
|
552
|
+
data?: any;
|
|
553
|
+
throw?: boolean;
|
|
554
|
+
routeId?: RouteIds<RegisteredRouter['routeTree']>;
|
|
555
|
+
headers?: HeadersInit;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* Create a not-found error object recognized by TanStack Router.
|
|
559
|
+
*
|
|
560
|
+
* Throw this from loaders/actions to trigger the nearest `notFoundComponent`.
|
|
561
|
+
* Use `routeId` to target a specific route's not-found boundary. If `throw`
|
|
562
|
+
* is true, the error is thrown instead of returned.
|
|
563
|
+
*
|
|
564
|
+
* @param options Optional settings including `routeId`, `headers`, and `throw`.
|
|
565
|
+
* @returns A not-found error object that can be thrown or returned.
|
|
566
|
+
* @link https://tanstack.com/router/latest/docs/router/framework/react/api/router/notFoundFunction
|
|
567
|
+
*/
|
|
568
|
+
declare function notFound(options?: NotFoundError): NotFoundError;
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts
|
|
571
|
+
type AnyRedirect = Redirect<any, any, any, any, any>;
|
|
572
|
+
/**
|
|
573
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
|
|
574
|
+
*/
|
|
575
|
+
type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = Response & {
|
|
576
|
+
options: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
577
|
+
};
|
|
578
|
+
type RedirectOptions<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = {
|
|
579
|
+
href?: string;
|
|
580
|
+
/**
|
|
581
|
+
* @deprecated Use `statusCode` instead
|
|
582
|
+
**/
|
|
583
|
+
code?: number;
|
|
584
|
+
/**
|
|
585
|
+
* The HTTP status code to use when redirecting.
|
|
586
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property)
|
|
587
|
+
*/
|
|
588
|
+
statusCode?: number;
|
|
589
|
+
/**
|
|
590
|
+
* If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it.
|
|
591
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property)
|
|
592
|
+
*/
|
|
593
|
+
throw?: any;
|
|
594
|
+
/**
|
|
595
|
+
* The HTTP headers to use when redirecting.
|
|
596
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property)
|
|
597
|
+
*/
|
|
598
|
+
headers?: HeadersInit;
|
|
599
|
+
} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
600
|
+
/**
|
|
601
|
+
* Options for route-bound redirect, where 'from' is automatically set.
|
|
602
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
|
|
603
|
+
*/
|
|
604
|
+
type RedirectOptionsRoute<TDefaultFrom extends string = string, TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TMaskTo extends string = ''> = Omit<RedirectOptions<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>, 'from'>;
|
|
605
|
+
/**
|
|
606
|
+
* A redirect function bound to a specific route, with 'from' pre-set to the route's fullPath.
|
|
607
|
+
* This enables relative redirects like `Route.redirect({ to: './overview' })`.
|
|
608
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)
|
|
609
|
+
*/
|
|
610
|
+
interface RedirectFnRoute<in out TDefaultFrom extends string = string> {
|
|
611
|
+
<TRouter extends AnyRouter = RegisteredRouter, const TTo extends string | undefined = undefined, const TMaskTo extends string = ''>(opts: RedirectOptionsRoute<TDefaultFrom, TRouter, TTo, TMaskTo>): Redirect<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Create a redirect Response understood by TanStack Router.
|
|
615
|
+
*
|
|
616
|
+
* Use from route `loader`/`beforeLoad` or server functions to trigger a
|
|
617
|
+
* navigation. If `throw: true` is set, the redirect is thrown instead of
|
|
618
|
+
* returned. When an absolute `href` is supplied and `reloadDocument` is not
|
|
619
|
+
* set, a full-document navigation is inferred.
|
|
620
|
+
*
|
|
621
|
+
* @param opts Options for the redirect. Common fields:
|
|
622
|
+
* - `href`: absolute URL for external redirects; infers `reloadDocument`.
|
|
623
|
+
* - `statusCode`: HTTP status code to use (defaults to 307).
|
|
624
|
+
* - `headers`: additional headers to include on the Response.
|
|
625
|
+
* - Standard navigation options like `to`, `params`, `search`, `replace`,
|
|
626
|
+
* and `reloadDocument` for internal redirects.
|
|
627
|
+
* @returns A Response augmented with router navigation options.
|
|
628
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
|
|
629
|
+
*/
|
|
630
|
+
declare function redirect<TRouter extends AnyRouter = RegisteredRouter, const TTo extends string | undefined = '.', const TFrom extends string = string, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(opts: RedirectOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts
|
|
633
|
+
interface DefaultRouteMatchExtensions {
|
|
634
|
+
scripts?: unknown;
|
|
635
|
+
links?: unknown;
|
|
636
|
+
headScripts?: unknown;
|
|
637
|
+
meta?: unknown;
|
|
638
|
+
styles?: unknown;
|
|
639
|
+
}
|
|
640
|
+
interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}
|
|
641
|
+
interface RouteMatch<out TRouteId, out TFullPath, out TAllParams, out TFullSearchSchema, out TLoaderData, out TAllContext, out TLoaderDeps> extends RouteMatchExtensions {
|
|
642
|
+
id: string;
|
|
643
|
+
routeId: TRouteId;
|
|
644
|
+
fullPath: TFullPath;
|
|
645
|
+
index: number;
|
|
646
|
+
pathname: string;
|
|
647
|
+
params: TAllParams;
|
|
648
|
+
_strictParams: TAllParams;
|
|
649
|
+
status: 'pending' | 'success' | 'error' | 'notFound';
|
|
650
|
+
isFetching: false | 'beforeLoad' | 'loader';
|
|
651
|
+
error: unknown;
|
|
652
|
+
paramsError: unknown;
|
|
653
|
+
searchError: unknown;
|
|
654
|
+
updatedAt: number;
|
|
655
|
+
loaderData?: TLoaderData;
|
|
656
|
+
context: TAllContext;
|
|
657
|
+
search: TFullSearchSchema;
|
|
658
|
+
_strictSearch: TFullSearchSchema;
|
|
659
|
+
abortController: AbortController;
|
|
660
|
+
cause: 'preload' | 'enter' | 'stay';
|
|
661
|
+
loaderDeps: TLoaderDeps;
|
|
662
|
+
preload: boolean;
|
|
663
|
+
invalid: boolean;
|
|
664
|
+
headers?: Record<string, string>;
|
|
665
|
+
_notFound?: boolean;
|
|
666
|
+
staticData: StaticDataRouteOption;
|
|
667
|
+
/** This attribute is not reactive */
|
|
668
|
+
ssr?: SSROption;
|
|
669
|
+
}
|
|
670
|
+
interface PreValidationErrorHandlingRouteMatch<TRouteId, TFullPath, TAllParams, TFullSearchSchema> {
|
|
671
|
+
id: string;
|
|
672
|
+
routeId: TRouteId;
|
|
673
|
+
fullPath: TFullPath;
|
|
674
|
+
index: number;
|
|
675
|
+
pathname: string;
|
|
676
|
+
search: {
|
|
677
|
+
status: 'success';
|
|
678
|
+
value: TFullSearchSchema;
|
|
679
|
+
} | {
|
|
680
|
+
status: 'error';
|
|
681
|
+
error: unknown;
|
|
682
|
+
};
|
|
683
|
+
params: {
|
|
684
|
+
status: 'success';
|
|
685
|
+
value: TAllParams;
|
|
686
|
+
} | {
|
|
687
|
+
status: 'error';
|
|
688
|
+
error: unknown;
|
|
689
|
+
};
|
|
690
|
+
staticData: StaticDataRouteOption;
|
|
691
|
+
ssr?: boolean | 'data-only';
|
|
692
|
+
}
|
|
693
|
+
type MakePreValidationErrorHandlingRouteMatchUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? PreValidationErrorHandlingRouteMatch<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema']> : never;
|
|
694
|
+
type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<TRoute['types']['id'], TRoute['types']['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']>;
|
|
695
|
+
type MakeRouteMatch<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TRouteId = RouteIds<TRouteTree>, TStrict extends boolean = true> = RouteMatch<TRouteId, RouteById<TRouteTree, TRouteId>['types']['fullPath'], TStrict extends false ? AllParams<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['allParams'], TStrict extends false ? FullSearchSchema<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'], TStrict extends false ? AllLoaderData<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['loaderData'], TStrict extends false ? AllContext<TRouteTree> : RouteById<TRouteTree, TRouteId>['types']['allContext'], RouteById<TRouteTree, TRouteId>['types']['loaderDeps']>;
|
|
696
|
+
type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>;
|
|
697
|
+
type MakeRouteMatchUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? RouteMatch<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema'], TRoute['types']['loaderData'], TRoute['types']['allContext'], TRoute['types']['loaderDeps']> : never;
|
|
698
|
+
/**
|
|
699
|
+
* The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.
|
|
700
|
+
*
|
|
701
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)
|
|
702
|
+
*/
|
|
703
|
+
interface MatchRouteOptions {
|
|
704
|
+
/**
|
|
705
|
+
* If `true`, will match against pending location instead of the current location.
|
|
706
|
+
*
|
|
707
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)
|
|
708
|
+
*/
|
|
709
|
+
pending?: boolean;
|
|
710
|
+
/**
|
|
711
|
+
* If `true`, will match against the current location with case sensitivity.
|
|
712
|
+
*
|
|
713
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)
|
|
714
|
+
*
|
|
715
|
+
* @deprecated Declare case sensitivity in the route definition instead, or globally for all routes using the `caseSensitive` option on the router.
|
|
716
|
+
*/
|
|
717
|
+
caseSensitive?: boolean;
|
|
718
|
+
/**
|
|
719
|
+
* If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.
|
|
720
|
+
*
|
|
721
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)
|
|
722
|
+
*/
|
|
723
|
+
includeSearch?: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.
|
|
726
|
+
*
|
|
727
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)
|
|
728
|
+
*/
|
|
729
|
+
fuzzy?: boolean;
|
|
730
|
+
}
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/root.d.ts
|
|
733
|
+
/** Stable identifier used for the root route in a route tree. */
|
|
734
|
+
declare const rootRouteId = "__root__";
|
|
735
|
+
type RootRouteId = typeof rootRouteId;
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts
|
|
738
|
+
interface CommitLocationOptions {
|
|
739
|
+
replace?: boolean;
|
|
740
|
+
resetScroll?: boolean;
|
|
741
|
+
hashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
742
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
743
|
+
/**
|
|
744
|
+
* @deprecated All navigations use transitions under the hood now
|
|
745
|
+
**/
|
|
746
|
+
startTransition?: boolean;
|
|
747
|
+
ignoreBlocker?: boolean;
|
|
748
|
+
}
|
|
749
|
+
type NavigateFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
|
|
750
|
+
type BuildLocationFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
751
|
+
leaveParams?: boolean;
|
|
752
|
+
_includeValidateSearch?: boolean;
|
|
753
|
+
_isNavigate?: boolean;
|
|
754
|
+
}) => ParsedLocation;
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts
|
|
757
|
+
/**
|
|
758
|
+
* Hint for RawStream encoding strategy during SSR serialization.
|
|
759
|
+
* - 'binary': Always use base64 encoding (best for binary data like files, images)
|
|
760
|
+
* - 'text': Try UTF-8 first, fallback to base64 (best for text-heavy data like RSC payloads)
|
|
761
|
+
*/
|
|
762
|
+
type RawStreamHint = 'binary' | 'text';
|
|
763
|
+
/**
|
|
764
|
+
* Options for RawStream configuration.
|
|
765
|
+
*/
|
|
766
|
+
interface RawStreamOptions {
|
|
767
|
+
/**
|
|
768
|
+
* Encoding hint for SSR serialization.
|
|
769
|
+
* - 'binary' (default): Always use base64 encoding
|
|
770
|
+
* - 'text': Try UTF-8 first, fallback to base64 for invalid UTF-8 chunks
|
|
771
|
+
*/
|
|
772
|
+
hint?: RawStreamHint;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Marker class for ReadableStream<Uint8Array> that should be serialized
|
|
776
|
+
* with base64 encoding (SSR) or binary framing (server functions).
|
|
777
|
+
*
|
|
778
|
+
* Wrap your binary streams with this to get efficient serialization:
|
|
779
|
+
* ```ts
|
|
780
|
+
* // For binary data (files, images, etc.)
|
|
781
|
+
* return { data: new RawStream(file.stream()) }
|
|
782
|
+
*
|
|
783
|
+
* // For text-heavy data (RSC payloads, etc.)
|
|
784
|
+
* return { data: new RawStream(rscStream, { hint: 'text' }) }
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
declare class RawStream {
|
|
788
|
+
readonly stream: ReadableStream<Uint8Array>;
|
|
789
|
+
readonly hint: RawStreamHint;
|
|
790
|
+
constructor(stream: ReadableStream<Uint8Array>, options?: RawStreamOptions);
|
|
791
|
+
}
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts
|
|
794
|
+
declare const TSR_SERIALIZABLE: unique symbol;
|
|
795
|
+
type TSR_SERIALIZABLE = typeof TSR_SERIALIZABLE;
|
|
796
|
+
type TsrSerializable = {
|
|
797
|
+
[TSR_SERIALIZABLE]: true;
|
|
798
|
+
};
|
|
799
|
+
interface DefaultSerializable {
|
|
800
|
+
number: number;
|
|
801
|
+
string: string;
|
|
802
|
+
boolean: boolean;
|
|
803
|
+
null: null;
|
|
804
|
+
undefined: undefined;
|
|
805
|
+
bigint: bigint;
|
|
806
|
+
Date: Date;
|
|
807
|
+
Uint8Array: Uint8Array;
|
|
808
|
+
RawStream: RawStream;
|
|
809
|
+
TsrSerializable: TsrSerializable;
|
|
810
|
+
void: void;
|
|
811
|
+
}
|
|
812
|
+
interface SerializableExtensions extends DefaultSerializable {}
|
|
813
|
+
type Serializable = SerializableExtensions[keyof SerializableExtensions];
|
|
814
|
+
type UnionizeSerializationAdaptersInput<TAdapters extends ReadonlyArray<AnySerializationAdapter>> = TAdapters[number]['~types']['input'];
|
|
815
|
+
type ValidateSerializable<T, TSerializable> = T extends TSerializable ? T : T extends ((...args: Array<any>) => any) ? SerializationError<'Function may not be serializable'> : T extends RegisteredReadableStream ? SerializationError<'JSX is not be serializable'> : T extends ReadonlyArray<any> ? ValidateSerializableArray<T, TSerializable> : T extends Promise<any> ? ValidateSerializablePromise<T, TSerializable> : T extends ReadableStream<any> ? ValidateReadableStream<T, TSerializable> : T extends Set<any> ? ValidateSerializableSet<T, TSerializable> : T extends Map<any, any> ? ValidateSerializableMap<T, TSerializable> : T extends AsyncGenerator<any, any> ? ValidateSerializableAsyncGenerator<T, TSerializable> : T extends object ? ValidateSerializableMapped<T, TSerializable> : SerializationError<'Type may not be serializable'>;
|
|
816
|
+
type ValidateSerializableAsyncGenerator<T, TSerializable> = T extends AsyncGenerator<infer T, infer TReturn, infer TNext> ? AsyncGenerator<ValidateSerializable<T, TSerializable>, ValidateSerializable<TReturn, TSerializable>, TNext> : never;
|
|
817
|
+
type ValidateSerializablePromise<T, TSerializable> = T extends Promise<infer TAwaited> ? Promise<ValidateSerializable<TAwaited, TSerializable>> : never;
|
|
818
|
+
type ValidateReadableStream<T, TSerializable> = T extends ReadableStream<infer TStreamed> ? ReadableStream<ValidateSerializable<TStreamed, TSerializable>> : never;
|
|
819
|
+
type ValidateSerializableSet<T, TSerializable> = T extends Set<infer TItem> ? Set<ValidateSerializable<TItem, TSerializable>> : never;
|
|
820
|
+
type ValidateSerializableMap<T, TSerializable> = T extends Map<infer TKey, infer TValue> ? Map<ValidateSerializable<TKey, TSerializable>, ValidateSerializable<TValue, TSerializable>> : never;
|
|
821
|
+
type ValidateSerializableArray<T, TSerializable> = T extends readonly [any, ...Array<any>] ? ValidateSerializableMapped<T, TSerializable> : T extends Array<infer U> ? Array<ValidateSerializable<U, TSerializable>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<ValidateSerializable<U, TSerializable>> : never;
|
|
822
|
+
type ValidateSerializableMapped<T, TSerializable> = { [K in keyof T]: ValidateSerializable<T[K], TSerializable>; };
|
|
823
|
+
declare const SERIALIZATION_ERROR: unique symbol;
|
|
824
|
+
interface SerializationError<in out TMessage extends string> {
|
|
825
|
+
[SERIALIZATION_ERROR]: TMessage;
|
|
826
|
+
}
|
|
827
|
+
interface SerializationAdapter<TInput, TOutput, TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>> {
|
|
828
|
+
'~types': SerializationAdapterTypes<TInput, TOutput, TExtendsAdapters>;
|
|
829
|
+
key: string;
|
|
830
|
+
extends?: TExtendsAdapters;
|
|
831
|
+
test: (value: unknown) => value is TInput;
|
|
832
|
+
toSerializable: (value: TInput) => TOutput;
|
|
833
|
+
fromSerializable: (value: TOutput) => TInput;
|
|
834
|
+
}
|
|
835
|
+
interface SerializationAdapterTypes<TInput, TOutput, TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>> {
|
|
836
|
+
input: TInput | UnionizeSerializationAdaptersInput<TExtendsAdapters>;
|
|
837
|
+
output: TOutput;
|
|
838
|
+
extends: TExtendsAdapters;
|
|
839
|
+
}
|
|
840
|
+
type AnySerializationAdapter = SerializationAdapter<any, any, any>;
|
|
841
|
+
type ValidateSerializableInput<TRegister, T> = ValidateSerializable<T, RegisteredSerializableInput<TRegister>>;
|
|
842
|
+
type RegisteredSerializableInput<TRegister> = (unknown extends RegisteredSerializationAdapters<TRegister> ? never : RegisteredSerializationAdapters<TRegister> extends ReadonlyArray<AnySerializationAdapter> ? RegisteredSerializationAdapters<TRegister>[number]['~types']['input'] : never) | Serializable;
|
|
843
|
+
type RegisteredSerializationAdapters<TRegister> = RegisteredConfigType<TRegister, 'serializationAdapters'>;
|
|
844
|
+
type RegisteredSSROption<TRegister> = unknown extends RegisteredConfigType<TRegister, 'defaultSsr'> ? SSROption : RegisteredConfigType<TRegister, 'defaultSsr'>;
|
|
845
|
+
type ValidateSerializableLifecycleResult<TRegister, TParentRoute extends AnyRoute, TSSR, TFn> = false extends RegisteredSsr<TRegister> ? any : ValidateSerializableLifecycleResultSSR<TRegister, TParentRoute, TSSR, TFn> extends (infer TInput) ? TInput : never;
|
|
846
|
+
type ValidateSerializableLifecycleResultSSR<TRegister, TParentRoute extends AnyRoute, TSSR, TFn> = ResolveAllSSR<TParentRoute, TSSR> extends false ? any : RegisteredSSROption<TRegister> extends false ? any : ValidateSerializableInput<TRegister, LooseReturnType<TFn>>;
|
|
847
|
+
type RegisteredReadableStream = unknown extends SerializerExtensions['ReadableStream'] ? never : SerializerExtensions['ReadableStream'];
|
|
848
|
+
interface DefaultSerializerExtensions {
|
|
849
|
+
ReadableStream: unknown;
|
|
850
|
+
}
|
|
851
|
+
interface SerializerExtensions extends DefaultSerializerExtensions {}
|
|
852
|
+
//#endregion
|
|
853
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/route.d.ts
|
|
854
|
+
type AnyPathParams = {};
|
|
855
|
+
type SearchSchemaInput = {
|
|
856
|
+
__TSearchSchemaInput__: 'TSearchSchemaInput';
|
|
857
|
+
};
|
|
858
|
+
type AnyContext = {};
|
|
859
|
+
type RoutePathOptions<TCustomId, TPath> = {
|
|
860
|
+
path: TPath;
|
|
861
|
+
} | {
|
|
862
|
+
id: TCustomId;
|
|
863
|
+
};
|
|
864
|
+
interface StaticDataRouteOption {}
|
|
865
|
+
type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult;
|
|
866
|
+
type SearchMiddlewareMeta = {
|
|
867
|
+
removed?: Map<string, unknown>;
|
|
868
|
+
removedAny?: Set<string>;
|
|
869
|
+
defaulted?: Map<string, unknown>;
|
|
870
|
+
explicit?: unknown;
|
|
871
|
+
};
|
|
872
|
+
type SearchMiddlewareContext<TSearchSchema> = {
|
|
873
|
+
search: TSearchSchema;
|
|
874
|
+
next: (newSearch: TSearchSchema) => TSearchSchema;
|
|
875
|
+
meta?: SearchMiddlewareMeta;
|
|
876
|
+
};
|
|
877
|
+
type SearchMiddleware<TSearchSchema> = (ctx: SearchMiddlewareContext<TSearchSchema>) => TSearchSchema;
|
|
878
|
+
type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
879
|
+
types: {
|
|
880
|
+
fullSearchSchema: infer TFullSearchSchema;
|
|
881
|
+
};
|
|
882
|
+
} ? TFullSearchSchema : {};
|
|
883
|
+
type InferFullSearchSchemaInput<TRoute> = TRoute extends {
|
|
884
|
+
types: {
|
|
885
|
+
fullSearchSchemaInput: infer TFullSearchSchemaInput;
|
|
886
|
+
};
|
|
887
|
+
} ? TFullSearchSchemaInput : {};
|
|
888
|
+
type InferAllParams<TRoute> = TRoute extends {
|
|
889
|
+
types: {
|
|
890
|
+
allParams: infer TAllParams;
|
|
891
|
+
};
|
|
892
|
+
} ? TAllParams : {};
|
|
893
|
+
type InferAllContext<TRoute> = unknown extends TRoute ? TRoute : TRoute extends {
|
|
894
|
+
types: {
|
|
895
|
+
allContext: infer TAllContext;
|
|
896
|
+
};
|
|
897
|
+
} ? TAllContext : {};
|
|
898
|
+
type ResolveRequiredParams<TPath extends string, T> = { [K in ParsePathParams<TPath>['required']]: T; };
|
|
899
|
+
type ResolveOptionalParams<TPath extends string, T> = { [K in ParsePathParams<TPath>['optional']]?: T | undefined; };
|
|
900
|
+
type ResolveParams<TPath extends string, T = string> = ResolveRequiredParams<TPath, T> & ResolveOptionalParams<TPath, T>;
|
|
901
|
+
type ParseParamsFn<in out TPath extends string, in out TParams> = (rawParams: Expand<ResolveParams<TPath>>) => TParams | false;
|
|
902
|
+
type ValidateParsedParams<TPath extends string, TParams> = [TParams] extends [ResolveParams<TPath, any>] ? unknown : never;
|
|
903
|
+
type StringifyParamsFn<in out TPath extends string, in out TParams> = (params: TParams) => ResolveParams<TPath>;
|
|
904
|
+
type ParamsOptions<in out TPath extends string, in out TParams> = {
|
|
905
|
+
params?: {
|
|
906
|
+
parse?: ParseParamsFn<TPath, TParams> & ValidateParsedParams<TPath, TParams>;
|
|
907
|
+
/**
|
|
908
|
+
* When multiple route candidates use `params.parse` during matching,
|
|
909
|
+
* higher priorities are tried first.
|
|
910
|
+
*
|
|
911
|
+
* @default 0
|
|
912
|
+
*/
|
|
913
|
+
priority?: number;
|
|
914
|
+
stringify?: StringifyParamsFn<TPath, TParams>;
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
@deprecated Use params.parse instead
|
|
918
|
+
*/
|
|
919
|
+
parseParams?: ParseParamsFn<TPath, TParams> & ValidateParsedParams<TPath, TParams>;
|
|
920
|
+
/**
|
|
921
|
+
@deprecated Use params.stringify instead
|
|
922
|
+
*/
|
|
923
|
+
stringifyParams?: StringifyParamsFn<TPath, TParams>;
|
|
924
|
+
};
|
|
925
|
+
interface RequiredStaticDataRouteOption {
|
|
926
|
+
staticData: StaticDataRouteOption;
|
|
927
|
+
}
|
|
928
|
+
interface OptionalStaticDataRouteOption {
|
|
929
|
+
staticData?: StaticDataRouteOption;
|
|
930
|
+
}
|
|
931
|
+
type UpdatableStaticRouteOption = {} extends StaticDataRouteOption ? OptionalStaticDataRouteOption : RequiredStaticDataRouteOption;
|
|
932
|
+
type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
|
|
933
|
+
type ContextReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseReturnType<TContextFn> extends never ? AnyContext : LooseReturnType<TContextFn>;
|
|
934
|
+
type ContextAsyncReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseAsyncReturnType<TContextFn> extends never ? AnyContext : LooseAsyncReturnType<TContextFn>;
|
|
935
|
+
type ResolveRouteContext<TRouteContextFn, TBeforeLoadFn> = Assign<ContextReturnType<TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
|
|
936
|
+
type ResolveRouteLoaderFn<TLoaderFn> = TLoaderFn extends {
|
|
937
|
+
handler: infer THandler;
|
|
938
|
+
} ? THandler : TLoaderFn;
|
|
939
|
+
type RouteLoaderObject<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TParams = {}, TLoaderDeps = {}, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TServerMiddlewares = unknown, THandlers = undefined> = {
|
|
940
|
+
handler: RouteLoaderFn<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>;
|
|
941
|
+
staleReloadMode?: LoaderStaleReloadMode;
|
|
942
|
+
};
|
|
943
|
+
type ResolveLoaderData<TLoaderFn> = unknown extends TLoaderFn ? TLoaderFn : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>> extends never ? undefined : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>>;
|
|
944
|
+
type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchValidator> = unknown extends TParentRoute ? ResolveValidatorOutput<TSearchValidator> : IntersectAssign<InferFullSearchSchema<TParentRoute>, ResolveValidatorOutput<TSearchValidator>>;
|
|
945
|
+
type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchValidator> = IntersectAssign<InferFullSearchSchemaInput<TParentRoute>, ResolveSearchValidatorInput<TSearchValidator>>;
|
|
946
|
+
type ResolveAllParamsFromParent<TParentRoute extends AnyRoute, TParams> = Assign<InferAllParams<TParentRoute>, TParams>;
|
|
947
|
+
type RouteContextParameter<TParentRoute extends AnyRoute, TRouterContext> = unknown extends TParentRoute ? TRouterContext : Assign<TRouterContext, InferAllContext<TParentRoute>>;
|
|
948
|
+
type BeforeLoadContextParameter<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn> = Assign<RouteContextParameter<TParentRoute, TRouterContext>, ContextReturnType<TRouteContextFn>>;
|
|
949
|
+
type ResolveAllContext<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn> = Assign<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
|
|
950
|
+
interface FullSearchSchemaOption<in out TParentRoute extends AnyRoute, in out TSearchValidator> {
|
|
951
|
+
search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>;
|
|
952
|
+
}
|
|
953
|
+
interface RemountDepsOptions<in out TRouteId, in out TFullSearchSchema, in out TAllParams, in out TLoaderDeps> {
|
|
954
|
+
routeId: TRouteId;
|
|
955
|
+
search: TFullSearchSchema;
|
|
956
|
+
params: TAllParams;
|
|
957
|
+
loaderDeps: TLoaderDeps;
|
|
958
|
+
}
|
|
959
|
+
type MakeRemountDepsOptionsUnion<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']> = ParseRoute<TRouteTree> extends (infer TRoute extends AnyRoute) ? TRoute extends any ? RemountDepsOptions<TRoute['id'], TRoute['types']['fullSearchSchema'], TRoute['types']['allParams'], TRoute['types']['loaderDeps']> : never : never;
|
|
960
|
+
interface RouteTypes$1<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> {
|
|
961
|
+
parentRoute: TParentRoute;
|
|
962
|
+
path: TPath;
|
|
963
|
+
to: TrimPathRight<TFullPath>;
|
|
964
|
+
fullPath: TFullPath;
|
|
965
|
+
customId: TCustomId;
|
|
966
|
+
id: TId;
|
|
967
|
+
searchSchema: ResolveValidatorOutput<TSearchValidator>;
|
|
968
|
+
searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>;
|
|
969
|
+
searchValidator: TSearchValidator;
|
|
970
|
+
fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>;
|
|
971
|
+
fullSearchSchemaInput: ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>;
|
|
972
|
+
params: TParams;
|
|
973
|
+
allParams: ResolveAllParamsFromParent<TParentRoute, TParams>;
|
|
974
|
+
routerContext: TRouterContext;
|
|
975
|
+
routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>;
|
|
976
|
+
routeContextFn: TRouteContextFn;
|
|
977
|
+
beforeLoadFn: TBeforeLoadFn;
|
|
978
|
+
allContext: ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
|
|
979
|
+
children: TChildren;
|
|
980
|
+
loaderData: ResolveLoaderData<TLoaderFn>;
|
|
981
|
+
loaderDeps: TLoaderDeps;
|
|
982
|
+
fileRouteTypes: TFileRouteTypes;
|
|
983
|
+
ssr: ResolveSSR<TSSR>;
|
|
984
|
+
allSsr: ResolveAllSSR<TParentRoute, TSSR>;
|
|
985
|
+
}
|
|
986
|
+
type ResolveSSR<TSSR> = TSSR extends ((...args: ReadonlyArray<any>) => any) ? LooseReturnType<TSSR> : TSSR;
|
|
987
|
+
type ResolveAllSSR<TParentRoute extends AnyRoute, TSSR> = unknown extends TParentRoute ? ResolveSSR<TSSR> : unknown extends TSSR ? TParentRoute['types']['allSsr'] : ResolveSSR<TSSR>;
|
|
988
|
+
interface RouteExtensions<in out TId, in out TFullPath> {
|
|
989
|
+
id: TId;
|
|
990
|
+
fullPath: TFullPath;
|
|
991
|
+
}
|
|
992
|
+
type RouteLazyFn<TRoute extends AnyRoute> = (lazyFn: () => Promise<LazyRoute<TRoute>>) => TRoute;
|
|
993
|
+
type RouteAddChildrenFn<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> = <const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>) => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
994
|
+
type RouteAddFileChildrenFn<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> = <const TNewChildren>(children: TNewChildren) => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
995
|
+
type RouteAddFileTypesFn<TRegister, TParentRoute extends AnyRoute, TPath extends string, TFullPath extends string, TCustomId extends string, TId extends string, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps extends Record<string, any>, TLoaderFn, TChildren, TSSR, TServerMiddlewares, THandlers> = <TNewFileRouteTypes>() => Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TNewFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
996
|
+
interface Route<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TChildren, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> extends RouteExtensions<TId, TFullPath> {
|
|
997
|
+
path: TPath;
|
|
998
|
+
parentRoute: TParentRoute;
|
|
999
|
+
children?: TChildren;
|
|
1000
|
+
types: RouteTypes$1<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
1001
|
+
options: RouteOptions$1<TRegister, TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers>;
|
|
1002
|
+
isRoot: TParentRoute extends AnyRoute ? true : false;
|
|
1003
|
+
lazyFn?: () => Promise<LazyRoute<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>>;
|
|
1004
|
+
rank: number;
|
|
1005
|
+
to: TrimPathRight<TFullPath>;
|
|
1006
|
+
init: (opts: {
|
|
1007
|
+
originalIndex: number;
|
|
1008
|
+
}) => void;
|
|
1009
|
+
update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
|
|
1010
|
+
lazy: RouteLazyFn<Route<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>>;
|
|
1011
|
+
addChildren: RouteAddChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
1012
|
+
_addFileChildren: RouteAddFileChildrenFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes, TSSR, TServerMiddlewares, THandlers>;
|
|
1013
|
+
_addFileTypes: RouteAddFileTypesFn<TRegister, TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TSSR, TServerMiddlewares, THandlers>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Create a redirect with `from` automatically set to this route's path.
|
|
1016
|
+
* Enables relative redirects like `Route.redirect({ to: './overview' })`.
|
|
1017
|
+
* @param opts Redirect options (same as `redirect()` but without `from`)
|
|
1018
|
+
* @returns A redirect Response that can be thrown from loaders/beforeLoad
|
|
1019
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction
|
|
1020
|
+
*/
|
|
1021
|
+
redirect: RedirectFnRoute<TFullPath>;
|
|
1022
|
+
}
|
|
1023
|
+
type AnyRoute = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
1024
|
+
type RouteOptions$1<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TFullPath extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = AnyPathParams, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = BaseRouteOptions<TRegister, TParentRoute, TId, TCustomId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TSSR, TServerMiddlewares, THandlers> & UpdatableRouteOptions<NoInfer<TParentRoute>, NoInfer<TCustomId>, NoInfer<TFullPath>, NoInfer<TParams>, NoInfer<TSearchValidator>, NoInfer<TLoaderFn>, NoInfer<TLoaderDeps>, NoInfer<TRouterContext>, NoInfer<TRouteContextFn>, NoInfer<TBeforeLoadFn>>;
|
|
1025
|
+
type FileBaseRouteOptions<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = ParamsOptions<TPath, TParams> & FilebaseRouteOptionsInterface<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TRemountDepsFn, TSSR, TServerMiddlewares, THandlers>;
|
|
1026
|
+
interface FilebaseRouteOptionsInterface<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> {
|
|
1027
|
+
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>;
|
|
1028
|
+
shouldReload?: boolean | ((match: LoaderFnContext<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>) => any);
|
|
1029
|
+
context?: Constrain<TRouteContextFn, (ctx: RouteContextOptions<TParentRoute, TParams, TRouterContext, TLoaderDeps, TId>) => any>;
|
|
1030
|
+
ssr?: Constrain<TSSR, undefined | SSROption | ((ctx: SsrContextOptions<TParentRoute, TSearchValidator, TParams>) => Awaitable<undefined | SSROption>)>;
|
|
1031
|
+
beforeLoad?: Constrain<TBeforeLoadFn, (ctx: BeforeLoadContextOptions<TRegister, TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TId, TServerMiddlewares, THandlers>) => ValidateSerializableLifecycleResult<TRegister, TParentRoute, TSSR, TBeforeLoadFn>>;
|
|
1032
|
+
loaderDeps?: (opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>) => TLoaderDeps;
|
|
1033
|
+
remountDeps?: Constrain<TRemountDepsFn, (opt: RemountDepsOptions<TId, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>, TLoaderDeps>) => any>;
|
|
1034
|
+
loader?: Constrain<TLoaderFn, RouteLoaderFn<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers> | RouteLoaderObject<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>>;
|
|
1035
|
+
}
|
|
1036
|
+
type BaseRouteOptions<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, AnyContext, TSSR, TServerMiddlewares, THandlers> & {
|
|
1037
|
+
getParentRoute: () => TParentRoute;
|
|
1038
|
+
};
|
|
1039
|
+
interface ContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouteId> {
|
|
1040
|
+
abortController: AbortController;
|
|
1041
|
+
preload: boolean;
|
|
1042
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
1043
|
+
location: ParsedLocation;
|
|
1044
|
+
/**
|
|
1045
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
1046
|
+
**/
|
|
1047
|
+
navigate: NavigateFn;
|
|
1048
|
+
buildLocation: BuildLocationFn;
|
|
1049
|
+
cause: 'preload' | 'enter' | 'stay';
|
|
1050
|
+
matches: Array<MakeRouteMatchUnion>;
|
|
1051
|
+
routeId: TRouteId;
|
|
1052
|
+
}
|
|
1053
|
+
interface RouteContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouterContext, in out TLoaderDeps, in out TRouteId> extends ContextOptions<TParentRoute, TParams, TRouteId> {
|
|
1054
|
+
deps: TLoaderDeps;
|
|
1055
|
+
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>;
|
|
1056
|
+
}
|
|
1057
|
+
interface SsrContextOptions<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams> {
|
|
1058
|
+
params: {
|
|
1059
|
+
status: 'success';
|
|
1060
|
+
value: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
1061
|
+
} | {
|
|
1062
|
+
status: 'error';
|
|
1063
|
+
error: unknown;
|
|
1064
|
+
};
|
|
1065
|
+
search: {
|
|
1066
|
+
status: 'success';
|
|
1067
|
+
value: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>;
|
|
1068
|
+
} | {
|
|
1069
|
+
status: 'error';
|
|
1070
|
+
error: unknown;
|
|
1071
|
+
};
|
|
1072
|
+
location: ParsedLocation;
|
|
1073
|
+
matches: Array<MakePreValidationErrorHandlingRouteMatchUnion>;
|
|
1074
|
+
}
|
|
1075
|
+
interface BeforeLoadContextOptions<in out TRegister, in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TRouteId, in out TServerMiddlewares, in out THandlers> extends ContextOptions<TParentRoute, TParams, TRouteId>, FullSearchSchemaOption<TParentRoute, TSearchValidator> {
|
|
1076
|
+
context: Expand<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>>;
|
|
1077
|
+
}
|
|
1078
|
+
type AssetFnContextOptions<in out TRouteId, in out TFullPath, in out TParentRoute extends AnyRoute, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps> = {
|
|
1079
|
+
ssr?: {
|
|
1080
|
+
nonce?: string;
|
|
1081
|
+
};
|
|
1082
|
+
matches: Array<RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>>;
|
|
1083
|
+
match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>;
|
|
1084
|
+
params: ResolveAllParamsFromParent<TParentRoute, TParams>;
|
|
1085
|
+
loaderData?: ResolveLoaderData<TLoaderFn>;
|
|
1086
|
+
};
|
|
1087
|
+
interface DefaultUpdatableRouteOptionsExtensions {
|
|
1088
|
+
component?: unknown;
|
|
1089
|
+
errorComponent?: unknown;
|
|
1090
|
+
notFoundComponent?: unknown;
|
|
1091
|
+
pendingComponent?: unknown;
|
|
1092
|
+
}
|
|
1093
|
+
interface UpdatableRouteOptionsExtensions extends DefaultUpdatableRouteOptionsExtensions {}
|
|
1094
|
+
interface UpdatableRouteOptions<in out TParentRoute extends AnyRoute, in out TRouteId, in out TFullPath, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TLoaderDeps, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn> extends UpdatableStaticRouteOption, UpdatableRouteOptionsExtensions {
|
|
1095
|
+
/**
|
|
1096
|
+
* If true, this route will be matched as case-sensitive
|
|
1097
|
+
*
|
|
1098
|
+
* @default false
|
|
1099
|
+
*/
|
|
1100
|
+
caseSensitive?: boolean;
|
|
1101
|
+
/**
|
|
1102
|
+
* If true, this route will be forcefully wrapped in a suspense boundary
|
|
1103
|
+
*/
|
|
1104
|
+
wrapInSuspense?: boolean;
|
|
1105
|
+
pendingMs?: number;
|
|
1106
|
+
pendingMinMs?: number;
|
|
1107
|
+
staleTime?: number;
|
|
1108
|
+
gcTime?: number;
|
|
1109
|
+
preload?: boolean;
|
|
1110
|
+
preloadStaleTime?: number;
|
|
1111
|
+
preloadGcTime?: number;
|
|
1112
|
+
search?: {
|
|
1113
|
+
middlewares?: Array<SearchMiddleware<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1116
|
+
@deprecated Use search.middlewares instead
|
|
1117
|
+
*/
|
|
1118
|
+
preSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
1119
|
+
/**
|
|
1120
|
+
@deprecated Use search.middlewares instead
|
|
1121
|
+
*/
|
|
1122
|
+
postSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
1123
|
+
onCatch?: (error: Error) => void;
|
|
1124
|
+
onError?: (err: any) => void;
|
|
1125
|
+
onEnter?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
1126
|
+
onStay?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
1127
|
+
onLeave?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
1128
|
+
headers?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<Record<string, string> | undefined>;
|
|
1129
|
+
head?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<{
|
|
1130
|
+
links?: AnyRouteMatch['links'];
|
|
1131
|
+
scripts?: AnyRouteMatch['headScripts'];
|
|
1132
|
+
meta?: AnyRouteMatch['meta'];
|
|
1133
|
+
styles?: AnyRouteMatch['styles'];
|
|
1134
|
+
}>;
|
|
1135
|
+
scripts?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<AnyRouteMatch['scripts']>;
|
|
1136
|
+
codeSplitGroupings?: Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>;
|
|
1137
|
+
}
|
|
1138
|
+
type RouteLoaderFn<in out TRegister, in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TServerMiddlewares = unknown, in out THandlers = undefined> = (match: LoaderFnContext<TRegister, TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>) => any;
|
|
1139
|
+
type LoaderStaleReloadMode = 'background' | 'blocking';
|
|
1140
|
+
interface LoaderFnContext<in out TRegister = unknown, in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TServerMiddlewares = unknown, in out THandlers = undefined> {
|
|
1141
|
+
abortController: AbortController;
|
|
1142
|
+
preload: boolean;
|
|
1143
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
1144
|
+
deps: TLoaderDeps;
|
|
1145
|
+
context: Expand<ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
|
|
1146
|
+
location: ParsedLocation;
|
|
1147
|
+
/**
|
|
1148
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
1149
|
+
**/
|
|
1150
|
+
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void;
|
|
1151
|
+
parentMatchPromise: TId extends RootRouteId ? never : Promise<MakeRouteMatchFromRoute<TParentRoute>>;
|
|
1152
|
+
cause: 'preload' | 'enter' | 'stay';
|
|
1153
|
+
route: AnyRoute;
|
|
1154
|
+
}
|
|
1155
|
+
type RouteMask<TRouteTree extends AnyRoute> = {
|
|
1156
|
+
routeTree: TRouteTree;
|
|
1157
|
+
from: RoutePaths<TRouteTree>;
|
|
1158
|
+
to?: any;
|
|
1159
|
+
params?: any;
|
|
1160
|
+
search?: any;
|
|
1161
|
+
hash?: any;
|
|
1162
|
+
state?: any;
|
|
1163
|
+
unmaskOnReload?: boolean;
|
|
1164
|
+
};
|
|
1165
|
+
type ErrorComponentProps<TError = Error> = {
|
|
1166
|
+
error: TError;
|
|
1167
|
+
info?: {
|
|
1168
|
+
componentStack: string;
|
|
1169
|
+
};
|
|
1170
|
+
reset: () => void;
|
|
1171
|
+
};
|
|
1172
|
+
type NotFoundRouteProps = {
|
|
1173
|
+
data?: unknown;
|
|
1174
|
+
isNotFound: boolean;
|
|
1175
|
+
routeId: RouteIds<RegisteredRouter['routeTree']>;
|
|
1176
|
+
};
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/validators.d.ts
|
|
1179
|
+
interface StandardSchemaValidatorProps<TInput, TOutput> {
|
|
1180
|
+
readonly types?: StandardSchemaValidatorTypes<TInput, TOutput> | undefined;
|
|
1181
|
+
readonly validate: AnyStandardSchemaValidate;
|
|
1182
|
+
}
|
|
1183
|
+
interface StandardSchemaValidator<TInput, TOutput> {
|
|
1184
|
+
readonly '~standard': StandardSchemaValidatorProps<TInput, TOutput>;
|
|
1185
|
+
}
|
|
1186
|
+
type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>;
|
|
1187
|
+
interface StandardSchemaValidatorTypes<TInput, TOutput> {
|
|
1188
|
+
readonly input: TInput;
|
|
1189
|
+
readonly output: TOutput;
|
|
1190
|
+
}
|
|
1191
|
+
interface AnyStandardSchemaValidateSuccess {
|
|
1192
|
+
readonly value: any;
|
|
1193
|
+
readonly issues?: undefined;
|
|
1194
|
+
}
|
|
1195
|
+
interface AnyStandardSchemaValidateFailure {
|
|
1196
|
+
readonly issues: ReadonlyArray<AnyStandardSchemaValidateIssue>;
|
|
1197
|
+
}
|
|
1198
|
+
interface AnyStandardSchemaValidateIssue {
|
|
1199
|
+
readonly message: string;
|
|
1200
|
+
}
|
|
1201
|
+
type AnyStandardSchemaValidate = (value: unknown) => (AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure) | Promise<AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure>;
|
|
1202
|
+
interface ValidatorObj<TInput, TOutput> {
|
|
1203
|
+
parse: ValidatorFn<TInput, TOutput>;
|
|
1204
|
+
}
|
|
1205
|
+
type AnyValidatorObj = ValidatorObj<any, any>;
|
|
1206
|
+
interface ValidatorAdapter<TInput, TOutput> {
|
|
1207
|
+
types: {
|
|
1208
|
+
input: TInput;
|
|
1209
|
+
output: TOutput;
|
|
1210
|
+
};
|
|
1211
|
+
parse: (input: unknown) => TOutput;
|
|
1212
|
+
}
|
|
1213
|
+
type AnyValidatorAdapter = ValidatorAdapter<any, any>;
|
|
1214
|
+
type ValidatorFn<TInput, TOutput> = (input: TInput) => TOutput;
|
|
1215
|
+
type Validator<TInput, TOutput> = ValidatorObj<TInput, TOutput> | ValidatorFn<TInput, TOutput> | ValidatorAdapter<TInput, TOutput> | StandardSchemaValidator<TInput, TOutput> | undefined;
|
|
1216
|
+
type AnyValidator = Validator<any, any>;
|
|
1217
|
+
type AnySchema = {};
|
|
1218
|
+
type DefaultValidator = Validator<Record<string, unknown>, AnySchema>;
|
|
1219
|
+
type ResolveSearchValidatorInputFn<TValidator> = TValidator extends ((input: infer TSchemaInput) => any) ? TSchemaInput extends SearchSchemaInput ? Omit<TSchemaInput, keyof SearchSchemaInput> : ResolveValidatorOutputFn<TValidator> : AnySchema;
|
|
1220
|
+
type ResolveSearchValidatorInput<TValidator> = TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['input'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['input'] : TValidator extends AnyValidatorObj ? ResolveSearchValidatorInputFn<TValidator['parse']> : ResolveSearchValidatorInputFn<TValidator>;
|
|
1221
|
+
type ResolveValidatorOutputFn<TValidator> = TValidator extends ((...args: any) => infer TSchema) ? TSchema : AnySchema;
|
|
1222
|
+
type ResolveValidatorOutput<TValidator> = unknown extends TValidator ? TValidator : TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['output'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['output'] : TValidator extends AnyValidatorObj ? ResolveValidatorOutputFn<TValidator['parse']> : ResolveValidatorOutputFn<TValidator>;
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts
|
|
1225
|
+
type SearchSerializer = (searchObj: Record<string, any>) => string;
|
|
1226
|
+
type SearchParser = (searchStr: string) => Record<string, any>;
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/ssr/constants.d.ts
|
|
1229
|
+
declare const GLOBAL_TSR = "$_TSR";
|
|
1230
|
+
declare const GLOBAL_SEROVAL: '$R';
|
|
1231
|
+
//#endregion
|
|
1232
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts
|
|
1233
|
+
type AssetCrossOrigin = 'anonymous' | 'use-credentials';
|
|
1234
|
+
type ScriptFormat = 'module' | 'iife';
|
|
1235
|
+
declare const DEV_STYLES_ATTR = "data-tanstack-router-dev-styles";
|
|
1236
|
+
type AssetCrossOriginConfig = AssetCrossOrigin | Partial<Record<'script' | 'stylesheet', AssetCrossOrigin>>;
|
|
1237
|
+
type ManifestAssetLink = string | {
|
|
1238
|
+
href: string;
|
|
1239
|
+
crossOrigin?: AssetCrossOrigin;
|
|
1240
|
+
};
|
|
1241
|
+
type Manifest = {
|
|
1242
|
+
scriptFormat?: ScriptFormat;
|
|
1243
|
+
inlineStyle?: ManifestInlineCss;
|
|
1244
|
+
routes: Record<string, ManifestRoute>;
|
|
1245
|
+
};
|
|
1246
|
+
type ManifestRoute = {
|
|
1247
|
+
filePath?: string;
|
|
1248
|
+
preloads?: Array<ManifestAssetLink>;
|
|
1249
|
+
scripts?: Array<ManifestScript>;
|
|
1250
|
+
css?: Array<ManifestCssLink>;
|
|
1251
|
+
};
|
|
1252
|
+
type ManifestRouteAssets = Pick<ManifestRoute, 'preloads' | 'scripts' | 'css'>;
|
|
1253
|
+
type RouterManagedTitleTag = {
|
|
1254
|
+
tag: 'title';
|
|
1255
|
+
attrs?: Record<string, any>;
|
|
1256
|
+
children: string;
|
|
1257
|
+
};
|
|
1258
|
+
type RouterManagedMetaTag = {
|
|
1259
|
+
tag: 'meta';
|
|
1260
|
+
attrs?: Record<string, any>;
|
|
1261
|
+
children?: never;
|
|
1262
|
+
};
|
|
1263
|
+
type RouterManagedLinkTag = {
|
|
1264
|
+
tag: 'link';
|
|
1265
|
+
attrs?: Record<string, any>;
|
|
1266
|
+
children?: never;
|
|
1267
|
+
};
|
|
1268
|
+
type RouterManagedScriptTag = {
|
|
1269
|
+
tag: 'script';
|
|
1270
|
+
attrs?: Record<string, any>;
|
|
1271
|
+
children?: string;
|
|
1272
|
+
};
|
|
1273
|
+
type ManifestScript = Omit<RouterManagedScriptTag, 'tag'>;
|
|
1274
|
+
type RouterManagedStyleTag = {
|
|
1275
|
+
tag: 'style';
|
|
1276
|
+
attrs?: Record<string, any>;
|
|
1277
|
+
children?: string;
|
|
1278
|
+
inlineCss?: true;
|
|
1279
|
+
};
|
|
1280
|
+
type RouterManagedTag = RouterManagedTitleTag | RouterManagedMetaTag | RouterManagedLinkTag | RouterManagedScriptTag | RouterManagedStyleTag;
|
|
1281
|
+
type ManifestCssLink = string | {
|
|
1282
|
+
href: string;
|
|
1283
|
+
crossOrigin?: AssetCrossOrigin;
|
|
1284
|
+
[DEV_STYLES_ATTR]?: true;
|
|
1285
|
+
};
|
|
1286
|
+
type ManifestInlineCss = {
|
|
1287
|
+
attrs?: Record<string, any>;
|
|
1288
|
+
children?: string;
|
|
1289
|
+
};
|
|
1290
|
+
//#endregion
|
|
1291
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/ssr/types.d.ts
|
|
1292
|
+
interface DehydratedMatch {
|
|
1293
|
+
i: MakeRouteMatch['id'];
|
|
1294
|
+
b?: MakeRouteMatch['__beforeLoadContext'];
|
|
1295
|
+
l?: MakeRouteMatch['loaderData'];
|
|
1296
|
+
e?: MakeRouteMatch['error'];
|
|
1297
|
+
u: MakeRouteMatch['updatedAt'];
|
|
1298
|
+
s: MakeRouteMatch['status'];
|
|
1299
|
+
ssr?: MakeRouteMatch['ssr'];
|
|
1300
|
+
g?: true;
|
|
1301
|
+
}
|
|
1302
|
+
interface DehydratedRouter {
|
|
1303
|
+
manifest: Manifest | undefined;
|
|
1304
|
+
dehydratedData?: any;
|
|
1305
|
+
matches: Array<DehydratedMatch>;
|
|
1306
|
+
}
|
|
1307
|
+
interface TsrSsrGlobal {
|
|
1308
|
+
router?: DehydratedRouter;
|
|
1309
|
+
h: () => void;
|
|
1310
|
+
e: () => void;
|
|
1311
|
+
c: () => void;
|
|
1312
|
+
p: (script: () => void) => void;
|
|
1313
|
+
buffer: Array<() => void>;
|
|
1314
|
+
t?: Map<string, (value: any) => any>;
|
|
1315
|
+
initialized?: boolean;
|
|
1316
|
+
hydrated?: boolean;
|
|
1317
|
+
streamEnded?: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/load-client.d.ts
|
|
1321
|
+
declare const SUCCESS = 0;
|
|
1322
|
+
declare const ERROR = 1;
|
|
1323
|
+
declare const NOT_FOUND = 2;
|
|
1324
|
+
declare const REDIRECTED = 3;
|
|
1325
|
+
declare const CANCELED = 4;
|
|
1326
|
+
type NonRedirectOutcome = [kind: typeof SUCCESS, data: unknown] | [kind: typeof ERROR, error: unknown] | [kind: typeof NOT_FOUND, error: NotFoundError] | [kind: typeof CANCELED];
|
|
1327
|
+
type RawLoaderOutcome = NonRedirectOutcome | [kind: typeof REDIRECTED, redirect: AnyRedirect];
|
|
1328
|
+
type LoaderFlight = [outcome: Promise<RawLoaderOutcome>, controller: AbortController, leases: number];
|
|
1329
|
+
type LoadTransaction = [controller: AbortController, redirects: number, location: ParsedLocation, matches: Array<AnyRouteMatch>, startedAt: number, done: Promise<void>,
|
|
1330
|
+
/**
|
|
1331
|
+
* Dev-only HMR refresh mode. Presence forces successor rematerialization
|
|
1332
|
+
* until this publication is acknowledged. The optional hydration handoff is
|
|
1333
|
+
* retired when the refresh publishes.
|
|
1334
|
+
*/
|
|
1335
|
+
refresh?: [handoff: NonNullable<AnyRouter['_handoff']> | undefined]];
|
|
1336
|
+
type PendingSession = [generation: LoadTransaction, boundaryId: string,
|
|
1337
|
+
/** Pending reveal time until acknowledged, then minimum-visible-until time. */
|
|
1338
|
+
deadline: number, revealTimer?: ReturnType<typeof setTimeout>, ack?: Promise<boolean> | true, component?: unknown];
|
|
1339
|
+
declare global {
|
|
1340
|
+
interface Window {
|
|
1341
|
+
[GLOBAL_TSR]?: TsrSsrGlobal;
|
|
1342
|
+
[GLOBAL_SEROVAL]?: any;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
//#endregion
|
|
1346
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/load-server.d.ts
|
|
1347
|
+
type ServerLoadResult = {
|
|
1348
|
+
type: 'render';
|
|
1349
|
+
status: 200 | 404 | 500;
|
|
1350
|
+
matches: Array<AnyRouteMatch>;
|
|
1351
|
+
} | {
|
|
1352
|
+
type: 'redirect';
|
|
1353
|
+
redirect: AnyRedirect;
|
|
1354
|
+
};
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/stores.d.ts
|
|
1357
|
+
interface RouterReadableStore<TValue> {
|
|
1358
|
+
get: () => TValue;
|
|
1359
|
+
}
|
|
1360
|
+
interface RouterWritableStore<TValue> extends RouterReadableStore<TValue> {
|
|
1361
|
+
set: ((updater: (prev: TValue) => TValue) => void) & ((value: TValue) => void);
|
|
1362
|
+
}
|
|
1363
|
+
type RouterBatchFn = (fn: () => void) => void;
|
|
1364
|
+
type MutableStoreFactory = <TValue>(initialValue: TValue) => RouterWritableStore<TValue>;
|
|
1365
|
+
type ReadonlyStoreFactory = <TValue>(read: () => TValue) => RouterReadableStore<TValue>;
|
|
1366
|
+
type GetStoreConfig = (opts: {
|
|
1367
|
+
isServer?: boolean;
|
|
1368
|
+
}) => StoreConfig;
|
|
1369
|
+
type StoreConfig = {
|
|
1370
|
+
createMutableStore: MutableStoreFactory;
|
|
1371
|
+
createReadonlyStore: ReadonlyStoreFactory;
|
|
1372
|
+
batch: RouterBatchFn;
|
|
1373
|
+
};
|
|
1374
|
+
type MatchStore = RouterWritableStore<AnyRouteMatch | undefined>;
|
|
1375
|
+
type ReadableStore<TValue> = RouterReadableStore<TValue>;
|
|
1376
|
+
interface RouterStores<in out TRouteTree extends AnyRoute> {
|
|
1377
|
+
status: RouterWritableStore<RouterState<TRouteTree>['status']>;
|
|
1378
|
+
location: RouterWritableStore<ParsedLocation<FullSearchSchema<TRouteTree>>>;
|
|
1379
|
+
resolvedLocation: RouterWritableStore<ParsedLocation<FullSearchSchema<TRouteTree>> | undefined>;
|
|
1380
|
+
ids: RouterWritableStore<Array<string>>;
|
|
1381
|
+
matches: ReadableStore<Array<AnyRouteMatch>>;
|
|
1382
|
+
__store: RouterReadableStore<RouterState<TRouteTree>>;
|
|
1383
|
+
byRoute: Map<string, MatchStore>;
|
|
1384
|
+
/**
|
|
1385
|
+
* Get the stable atom for a route's presented match. The atom remains in the
|
|
1386
|
+
* pool when the route leaves and contains `undefined` until it re-enters.
|
|
1387
|
+
*/
|
|
1388
|
+
getMatchStore: (routeId: string) => RouterReadableStore<AnyRouteMatch | undefined>;
|
|
1389
|
+
setMatches: (nextMatches: Array<AnyRouteMatch>) => void;
|
|
1390
|
+
}
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/router.d.ts
|
|
1393
|
+
interface Register {}
|
|
1394
|
+
type RegisteredSsr<TRegister = Register> = TRegister extends {
|
|
1395
|
+
ssr: infer TSSR;
|
|
1396
|
+
} ? TSSR : false;
|
|
1397
|
+
type RegisteredRouter<TRegister = Register> = TRegister extends {
|
|
1398
|
+
router: infer TRouter;
|
|
1399
|
+
} ? TRouter : AnyRouter;
|
|
1400
|
+
type RegisteredConfigType<TRegister, TKey> = TRegister extends {
|
|
1401
|
+
config: infer TConfig;
|
|
1402
|
+
} ? TConfig extends {
|
|
1403
|
+
'~types': infer TTypes;
|
|
1404
|
+
} ? TKey extends keyof TTypes ? TTypes[TKey] : unknown : unknown : unknown;
|
|
1405
|
+
type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
|
|
1406
|
+
interface DefaultRouterOptionsExtensions {}
|
|
1407
|
+
interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {}
|
|
1408
|
+
type SSROption = boolean | 'data-only';
|
|
1409
|
+
interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated = undefined> extends RouterOptionsExtensions {
|
|
1410
|
+
/**
|
|
1411
|
+
* The history object that will be used to manage the browser history.
|
|
1412
|
+
*
|
|
1413
|
+
* If not provided, a new createBrowserHistory instance will be created and used.
|
|
1414
|
+
*
|
|
1415
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
|
|
1416
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
|
|
1417
|
+
*/
|
|
1418
|
+
history?: TRouterHistory;
|
|
1419
|
+
/**
|
|
1420
|
+
* A function that will be used to stringify search params when generating links.
|
|
1421
|
+
*
|
|
1422
|
+
* @default defaultStringifySearch
|
|
1423
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
|
|
1424
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
|
1425
|
+
*/
|
|
1426
|
+
stringifySearch?: SearchSerializer;
|
|
1427
|
+
/**
|
|
1428
|
+
* A function that will be used to parse search params when parsing the current location.
|
|
1429
|
+
*
|
|
1430
|
+
* @default defaultParseSearch
|
|
1431
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
|
|
1432
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
|
1433
|
+
*/
|
|
1434
|
+
parseSearch?: SearchParser;
|
|
1435
|
+
/**
|
|
1436
|
+
* If `false`, routes will not be preloaded by default in any way.
|
|
1437
|
+
*
|
|
1438
|
+
* If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
|
|
1439
|
+
*
|
|
1440
|
+
* If `'viewport'`, routes will be preloaded by default when they are within the viewport.
|
|
1441
|
+
*
|
|
1442
|
+
* @default false
|
|
1443
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
|
|
1444
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
1445
|
+
*/
|
|
1446
|
+
defaultPreload?: false | 'intent' | 'viewport' | 'render';
|
|
1447
|
+
/**
|
|
1448
|
+
* The delay in milliseconds before intent focus/hover and viewport preloading.
|
|
1449
|
+
* Touch intent preloads immediately.
|
|
1450
|
+
*
|
|
1451
|
+
* @default 50
|
|
1452
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
|
|
1453
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
|
|
1454
|
+
*/
|
|
1455
|
+
defaultPreloadDelay?: number;
|
|
1456
|
+
/**
|
|
1457
|
+
* The default `preloadIntentProximity` a route should use if no preloadIntentProximity is provided.
|
|
1458
|
+
*
|
|
1459
|
+
* @default 0
|
|
1460
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadintentproximity-property)
|
|
1461
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-intent-proximity)
|
|
1462
|
+
*/
|
|
1463
|
+
defaultPreloadIntentProximity?: number;
|
|
1464
|
+
/**
|
|
1465
|
+
* The default `pendingMs` a route should use if no pendingMs is provided.
|
|
1466
|
+
*
|
|
1467
|
+
* @default 1000
|
|
1468
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
|
|
1469
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
|
1470
|
+
*/
|
|
1471
|
+
defaultPendingMs?: number;
|
|
1472
|
+
/**
|
|
1473
|
+
* The default `pendingMinMs` a route should use if no pendingMinMs is provided.
|
|
1474
|
+
*
|
|
1475
|
+
* @default 500
|
|
1476
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
|
|
1477
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
|
1478
|
+
*/
|
|
1479
|
+
defaultPendingMinMs?: number;
|
|
1480
|
+
/**
|
|
1481
|
+
* The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.
|
|
1482
|
+
*
|
|
1483
|
+
* @default 0
|
|
1484
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
|
|
1485
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
|
1486
|
+
*/
|
|
1487
|
+
defaultStaleTime?: number;
|
|
1488
|
+
/**
|
|
1489
|
+
* The default stale reload mode a route loader should use if no `loader.staleReloadMode` is provided.
|
|
1490
|
+
*
|
|
1491
|
+
* `'background'` preserves the current stale-while-revalidate behavior.
|
|
1492
|
+
* `'blocking'` waits for stale loader reloads to complete before resolving navigation.
|
|
1493
|
+
*
|
|
1494
|
+
* @default 'background'
|
|
1495
|
+
*/
|
|
1496
|
+
defaultStaleReloadMode?: LoaderStaleReloadMode;
|
|
1497
|
+
/**
|
|
1498
|
+
* The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
|
|
1499
|
+
*
|
|
1500
|
+
* @default 30_000 `(30 seconds)`
|
|
1501
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
|
|
1502
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
1503
|
+
*/
|
|
1504
|
+
defaultPreloadStaleTime?: number;
|
|
1505
|
+
/**
|
|
1506
|
+
* The default `preloadGcTime` a route should use if none is provided.
|
|
1507
|
+
*
|
|
1508
|
+
* @default 300_000 `(5 minutes)`
|
|
1509
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
|
|
1510
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
1511
|
+
*/
|
|
1512
|
+
defaultPreloadGcTime?: number;
|
|
1513
|
+
/**
|
|
1514
|
+
* If `true`, route navigations will called using `document.startViewTransition()`.
|
|
1515
|
+
*
|
|
1516
|
+
* If the browser does not support this api, this option will be ignored.
|
|
1517
|
+
*
|
|
1518
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
|
|
1519
|
+
*
|
|
1520
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)
|
|
1521
|
+
*/
|
|
1522
|
+
defaultViewTransition?: boolean | ViewTransitionOptions;
|
|
1523
|
+
/**
|
|
1524
|
+
* The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating
|
|
1525
|
+
*
|
|
1526
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.
|
|
1527
|
+
*
|
|
1528
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)
|
|
1529
|
+
*/
|
|
1530
|
+
defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
1531
|
+
/**
|
|
1532
|
+
* @default 'fuzzy'
|
|
1533
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)
|
|
1534
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
|
|
1535
|
+
*/
|
|
1536
|
+
notFoundMode?: 'root' | 'fuzzy';
|
|
1537
|
+
/**
|
|
1538
|
+
* The default `gcTime` a route should use if no gcTime is provided.
|
|
1539
|
+
*
|
|
1540
|
+
* @default 300_000 `(5 minutes)`
|
|
1541
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
|
|
1542
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
|
1543
|
+
*/
|
|
1544
|
+
defaultGcTime?: number;
|
|
1545
|
+
/**
|
|
1546
|
+
* If `true`, all routes will be matched as case-sensitive.
|
|
1547
|
+
*
|
|
1548
|
+
* @default false
|
|
1549
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
|
|
1550
|
+
*/
|
|
1551
|
+
caseSensitive?: boolean;
|
|
1552
|
+
/**
|
|
1553
|
+
*
|
|
1554
|
+
* The route tree that will be used to configure the router instance.
|
|
1555
|
+
*
|
|
1556
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
|
|
1557
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)
|
|
1558
|
+
*/
|
|
1559
|
+
routeTree?: TRouteTree;
|
|
1560
|
+
/**
|
|
1561
|
+
* The basepath for then entire router. This is useful for mounting a router instance at a subpath.
|
|
1562
|
+
* ```
|
|
1563
|
+
* @default '/'
|
|
1564
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
|
|
1565
|
+
*/
|
|
1566
|
+
basepath?: string;
|
|
1567
|
+
/**
|
|
1568
|
+
* The root context that will be provided to all routes in the route tree.
|
|
1569
|
+
*
|
|
1570
|
+
* This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
|
|
1571
|
+
*
|
|
1572
|
+
* Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
|
|
1573
|
+
*
|
|
1574
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
|
|
1575
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
|
|
1576
|
+
*/
|
|
1577
|
+
context?: InferRouterContext<TRouteTree>;
|
|
1578
|
+
additionalContext?: any;
|
|
1579
|
+
/**
|
|
1580
|
+
* A function that will be called when the router is dehydrated.
|
|
1581
|
+
*
|
|
1582
|
+
* The return value of this function will be serialized and stored in the router's dehydrated state.
|
|
1583
|
+
*
|
|
1584
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
|
|
1585
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
|
1586
|
+
*/
|
|
1587
|
+
dehydrate?: () => Awaitable<Constrain<TDehydrated, ValidateSerializableInput<Register, TDehydrated>>>;
|
|
1588
|
+
/**
|
|
1589
|
+
* A function that will be called when the router is hydrated.
|
|
1590
|
+
*
|
|
1591
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
|
|
1592
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
|
1593
|
+
*/
|
|
1594
|
+
hydrate?: (dehydrated: TDehydrated) => Awaitable<void>;
|
|
1595
|
+
/**
|
|
1596
|
+
* An array of route masks that will be used to mask routes in the route tree.
|
|
1597
|
+
*
|
|
1598
|
+
* Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.
|
|
1599
|
+
*
|
|
1600
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
|
|
1601
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
|
|
1602
|
+
*/
|
|
1603
|
+
routeMasks?: Array<RouteMask<TRouteTree>>;
|
|
1604
|
+
/**
|
|
1605
|
+
* If `true`, route masks will, by default, be removed when the page is reloaded.
|
|
1606
|
+
*
|
|
1607
|
+
* This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.
|
|
1608
|
+
*
|
|
1609
|
+
* @default false
|
|
1610
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
|
|
1611
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
|
|
1612
|
+
*/
|
|
1613
|
+
unmaskOnReload?: boolean;
|
|
1614
|
+
/**
|
|
1615
|
+
* Use `notFoundComponent` instead.
|
|
1616
|
+
*
|
|
1617
|
+
* @deprecated
|
|
1618
|
+
* See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
|
|
1619
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
|
|
1620
|
+
*/
|
|
1621
|
+
notFoundRoute?: AnyRoute;
|
|
1622
|
+
/**
|
|
1623
|
+
* Configures how trailing slashes are treated.
|
|
1624
|
+
*
|
|
1625
|
+
* - `'always'` will add a trailing slash if not present
|
|
1626
|
+
* - `'never'` will remove the trailing slash if present
|
|
1627
|
+
* - `'preserve'` will not modify the trailing slash.
|
|
1628
|
+
*
|
|
1629
|
+
* @default 'never'
|
|
1630
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
|
|
1631
|
+
*/
|
|
1632
|
+
trailingSlash?: TTrailingSlashOption;
|
|
1633
|
+
/**
|
|
1634
|
+
* While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.
|
|
1635
|
+
*
|
|
1636
|
+
* @default typeof document !== 'undefined'
|
|
1637
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
|
|
1638
|
+
*/
|
|
1639
|
+
isServer?: boolean;
|
|
1640
|
+
/**
|
|
1641
|
+
* @default false
|
|
1642
|
+
*/
|
|
1643
|
+
isShell?: boolean;
|
|
1644
|
+
/**
|
|
1645
|
+
* @default false
|
|
1646
|
+
*/
|
|
1647
|
+
isPrerendering?: boolean;
|
|
1648
|
+
/**
|
|
1649
|
+
* The default `ssr` a route should use if no `ssr` is provided.
|
|
1650
|
+
*
|
|
1651
|
+
* @default true
|
|
1652
|
+
*/
|
|
1653
|
+
defaultSsr?: SSROption;
|
|
1654
|
+
search?: {
|
|
1655
|
+
/**
|
|
1656
|
+
* Configures how unknown search params (= not returned by any `validateSearch`) are treated.
|
|
1657
|
+
*
|
|
1658
|
+
* @default false
|
|
1659
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
|
|
1660
|
+
*/
|
|
1661
|
+
strict?: boolean;
|
|
1662
|
+
};
|
|
1663
|
+
/**
|
|
1664
|
+
* Configures whether structural sharing is enabled by default for fine-grained selectors.
|
|
1665
|
+
*
|
|
1666
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)
|
|
1667
|
+
*/
|
|
1668
|
+
defaultStructuralSharing?: TDefaultStructuralSharingOption;
|
|
1669
|
+
/**
|
|
1670
|
+
* Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
|
|
1671
|
+
*
|
|
1672
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
|
|
1673
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
|
|
1674
|
+
*/
|
|
1675
|
+
pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
|
|
1676
|
+
defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>;
|
|
1677
|
+
/**
|
|
1678
|
+
* If `true`, scroll restoration will be enabled
|
|
1679
|
+
*
|
|
1680
|
+
* @default false
|
|
1681
|
+
*/
|
|
1682
|
+
scrollRestoration?: boolean | ((opts: {
|
|
1683
|
+
location: ParsedLocation;
|
|
1684
|
+
}) => boolean);
|
|
1685
|
+
/**
|
|
1686
|
+
* A function that will be called to get the key for the scroll restoration cache.
|
|
1687
|
+
*
|
|
1688
|
+
* @default (location) => location.href
|
|
1689
|
+
*/
|
|
1690
|
+
getScrollRestorationKey?: (location: ParsedLocation) => string;
|
|
1691
|
+
/**
|
|
1692
|
+
* The default behavior for scroll restoration.
|
|
1693
|
+
*
|
|
1694
|
+
* @default 'auto'
|
|
1695
|
+
*/
|
|
1696
|
+
scrollRestorationBehavior?: ScrollBehavior;
|
|
1697
|
+
/**
|
|
1698
|
+
* An array of selectors that will be used to scroll to the top of the page in addition to `window`
|
|
1699
|
+
*
|
|
1700
|
+
* @default ['window']
|
|
1701
|
+
*/
|
|
1702
|
+
scrollToTopSelectors?: Array<string | (() => Element | null | undefined)>;
|
|
1703
|
+
/**
|
|
1704
|
+
* When `true`, disables the global catch boundary that normally wraps all route matches.
|
|
1705
|
+
* This allows unhandled errors to bubble up to top-level error handlers in the browser.
|
|
1706
|
+
*
|
|
1707
|
+
* Useful for testing tools (like Storybook Test Runner), error reporting services,
|
|
1708
|
+
* and debugging scenarios where you want errors to reach the browser's global error handlers.
|
|
1709
|
+
*
|
|
1710
|
+
* @default false
|
|
1711
|
+
*/
|
|
1712
|
+
disableGlobalCatchBoundary?: boolean;
|
|
1713
|
+
/**
|
|
1714
|
+
* An array of URL protocols to allow in links, redirects, and navigation.
|
|
1715
|
+
* Absolute URLs with protocols not in this list will be rejected.
|
|
1716
|
+
*
|
|
1717
|
+
* @default DEFAULT_PROTOCOL_ALLOWLIST (http:, https:, mailto:, tel:)
|
|
1718
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#protocolallowlist-property)
|
|
1719
|
+
*/
|
|
1720
|
+
protocolAllowlist?: Array<string>;
|
|
1721
|
+
serializationAdapters?: ReadonlyArray<AnySerializationAdapter>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Configures how the router will rewrite the location between the actual href and the internal href of the router.
|
|
1724
|
+
*
|
|
1725
|
+
* @default undefined
|
|
1726
|
+
* @description You can provide a custom rewrite pair (in/out).
|
|
1727
|
+
* This is useful for shifting data from the origin to the path (for things like subdomain routing), or other advanced use cases.
|
|
1728
|
+
*/
|
|
1729
|
+
rewrite?: LocationRewrite;
|
|
1730
|
+
origin?: string;
|
|
1731
|
+
ssr?: {
|
|
1732
|
+
nonce?: string;
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
type LocationRewrite = {
|
|
1736
|
+
/**
|
|
1737
|
+
* A function that will be called to rewrite the URL before it is interpreted by the router from the history instance.
|
|
1738
|
+
*
|
|
1739
|
+
* @default undefined
|
|
1740
|
+
*/
|
|
1741
|
+
input?: LocationRewriteFunction;
|
|
1742
|
+
/**
|
|
1743
|
+
* A function that will be called to rewrite the URL before it is committed to the actual history instance from the router.
|
|
1744
|
+
*
|
|
1745
|
+
* @default undefined
|
|
1746
|
+
*/
|
|
1747
|
+
output?: LocationRewriteFunction;
|
|
1748
|
+
};
|
|
1749
|
+
/**
|
|
1750
|
+
* A function that will be called to rewrite the URL.
|
|
1751
|
+
*
|
|
1752
|
+
* @param url The URL to rewrite.
|
|
1753
|
+
* @returns The rewritten URL (as a URL instance or full href string) or undefined if no rewrite is needed.
|
|
1754
|
+
*/
|
|
1755
|
+
type LocationRewriteFunction = ({ url }: {
|
|
1756
|
+
url: URL;
|
|
1757
|
+
}) => undefined | string | URL;
|
|
1758
|
+
interface RouterState<in out TRouteTree extends AnyRoute = AnyRoute, in out TRouteMatch = MakeRouteMatchUnion> {
|
|
1759
|
+
status: 'pending' | 'idle';
|
|
1760
|
+
isLoading: boolean;
|
|
1761
|
+
matches: Array<TRouteMatch>;
|
|
1762
|
+
location: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
1763
|
+
resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
1764
|
+
}
|
|
1765
|
+
interface BuildNextOptions {
|
|
1766
|
+
to?: string | number | null;
|
|
1767
|
+
params?: true | Updater<unknown>;
|
|
1768
|
+
search?: true | Updater<unknown>;
|
|
1769
|
+
hash?: true | Updater<string>;
|
|
1770
|
+
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
|
1771
|
+
mask?: {
|
|
1772
|
+
to?: string | number | null;
|
|
1773
|
+
params?: true | Updater<unknown>;
|
|
1774
|
+
search?: true | Updater<unknown>;
|
|
1775
|
+
hash?: true | Updater<string>;
|
|
1776
|
+
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
|
1777
|
+
unmaskOnReload?: boolean;
|
|
1778
|
+
};
|
|
1779
|
+
from?: string;
|
|
1780
|
+
href?: string;
|
|
1781
|
+
_fromLocation?: ParsedLocation;
|
|
1782
|
+
unsafeRelative?: 'path';
|
|
1783
|
+
_isNavigate?: boolean;
|
|
1784
|
+
}
|
|
1785
|
+
type NavigationEventInfo = {
|
|
1786
|
+
fromLocation?: ParsedLocation;
|
|
1787
|
+
toLocation: ParsedLocation;
|
|
1788
|
+
pathChanged: boolean;
|
|
1789
|
+
hrefChanged: boolean;
|
|
1790
|
+
hashChanged: boolean;
|
|
1791
|
+
};
|
|
1792
|
+
interface RouterEvents {
|
|
1793
|
+
onBeforeNavigate: {
|
|
1794
|
+
type: 'onBeforeNavigate';
|
|
1795
|
+
} & NavigationEventInfo;
|
|
1796
|
+
onBeforeLoad: {
|
|
1797
|
+
type: 'onBeforeLoad';
|
|
1798
|
+
} & NavigationEventInfo;
|
|
1799
|
+
onLoad: {
|
|
1800
|
+
type: 'onLoad';
|
|
1801
|
+
} & NavigationEventInfo;
|
|
1802
|
+
onResolved: {
|
|
1803
|
+
type: 'onResolved';
|
|
1804
|
+
} & NavigationEventInfo;
|
|
1805
|
+
onBeforeRouteMount: {
|
|
1806
|
+
type: 'onBeforeRouteMount';
|
|
1807
|
+
} & NavigationEventInfo;
|
|
1808
|
+
onRendered: {
|
|
1809
|
+
type: 'onRendered';
|
|
1810
|
+
} & NavigationEventInfo;
|
|
1811
|
+
}
|
|
1812
|
+
type RouterEvent = RouterEvents[keyof RouterEvents];
|
|
1813
|
+
type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
|
|
1814
|
+
type RouterListener<TRouterEvent extends RouterEvent> = {
|
|
1815
|
+
eventType: TRouterEvent['type'];
|
|
1816
|
+
fn: ListenerFn<TRouterEvent>;
|
|
1817
|
+
};
|
|
1818
|
+
type SubscribeFn = <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
|
|
1819
|
+
interface MatchRoutesOpts {
|
|
1820
|
+
throwOnError?: boolean;
|
|
1821
|
+
}
|
|
1822
|
+
type InferRouterContext<TRouteTree extends AnyRoute> = TRouteTree['types']['routerContext'];
|
|
1823
|
+
type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends InferRouterContext<TRouteTree> ? {
|
|
1824
|
+
context?: InferRouterContext<TRouteTree>;
|
|
1825
|
+
} : {
|
|
1826
|
+
context: InferRouterContext<TRouteTree>;
|
|
1827
|
+
};
|
|
1828
|
+
type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'context' | 'serializationAdapters' | 'defaultSsr'> & RouterContextOptions<TRouteTree>;
|
|
1829
|
+
type PreloadRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<Array<AnyRouteMatch> | undefined>;
|
|
1830
|
+
type MatchRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string | undefined = undefined, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
|
|
1831
|
+
type UpdateFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => void;
|
|
1832
|
+
type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
|
|
1833
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
|
1834
|
+
sync?: boolean;
|
|
1835
|
+
forcePending?: boolean;
|
|
1836
|
+
}) => Promise<void>;
|
|
1837
|
+
type ParseLocationFn<TRouteTree extends AnyRoute> = (locationToParse: HistoryLocation$1, previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>) => ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
1838
|
+
type GetMatchRoutesFn = (pathname: string) => [matchedRoutes: ReadonlyArray<AnyRoute>,
|
|
1839
|
+
/** exhaustive params, still in their string form */
|
|
1840
|
+
rawParams: Record<string, string>, foundRoute: AnyRoute | undefined];
|
|
1841
|
+
type EmitFn = (routerEvent: RouterEvent) => void;
|
|
1842
|
+
type LoadFn = (opts?: {
|
|
1843
|
+
sync?: boolean;
|
|
1844
|
+
action?: {
|
|
1845
|
+
type: HistoryAction;
|
|
1846
|
+
};
|
|
1847
|
+
_signal?: AbortSignal;
|
|
1848
|
+
}) => Promise<void>;
|
|
1849
|
+
type CommitLocationFn = ({ viewTransition, ignoreBlocker, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
|
|
1850
|
+
type StartTransitionFn = (fn: () => void, expected: Array<AnyRouteMatch>) => Promise<boolean>;
|
|
1851
|
+
interface MatchRoutesFn {
|
|
1852
|
+
(pathname: string, locationSearch?: AnySchema, opts?: MatchRoutesOpts): Array<MakeRouteMatchUnion>;
|
|
1853
|
+
/**
|
|
1854
|
+
* @deprecated use the following signature instead
|
|
1855
|
+
*/
|
|
1856
|
+
(next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
1857
|
+
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
1858
|
+
}
|
|
1859
|
+
type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
|
|
1860
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
|
1861
|
+
}) => void;
|
|
1862
|
+
interface ServerSsr {
|
|
1863
|
+
/** Framework-only: injects router-owned HTML into the SSR stream. */
|
|
1864
|
+
injectHtml: (html: string) => void;
|
|
1865
|
+
/** Framework-only: injects a router-owned script tag into the SSR stream. */
|
|
1866
|
+
injectScript: (script: string) => void;
|
|
1867
|
+
isDehydrated: () => boolean;
|
|
1868
|
+
isSerializationFinished: () => boolean;
|
|
1869
|
+
/** Framework-only: atomically reserves the pass-through stream path if safe. */
|
|
1870
|
+
reserveStreamFastPath: () => boolean;
|
|
1871
|
+
/** Framework-only. */
|
|
1872
|
+
onInjectedHtml: (listener: () => void) => () => void;
|
|
1873
|
+
/** Framework-only. */
|
|
1874
|
+
onRenderFinished: (listener: () => void) => void;
|
|
1875
|
+
/** Framework-only. */
|
|
1876
|
+
setRenderFinished: () => void;
|
|
1877
|
+
/** Framework-only. */
|
|
1878
|
+
cleanup: () => void;
|
|
1879
|
+
/**
|
|
1880
|
+
* Register a listener invoked when the SSR request lifecycle ends (success,
|
|
1881
|
+
* error, abort, or stream lifetime expiry). Use to tear down per-request
|
|
1882
|
+
* resources whose references would otherwise pin the router (e.g. query
|
|
1883
|
+
* cache subscriptions, gcTime timers, abort controllers).
|
|
1884
|
+
*
|
|
1885
|
+
* Listeners run synchronously and exactly once. Errors are caught and logged.
|
|
1886
|
+
*/
|
|
1887
|
+
onCleanup: (listener: () => void) => void;
|
|
1888
|
+
/** Framework-only. */
|
|
1889
|
+
onSerializationFinished: (listener: () => void) => () => void;
|
|
1890
|
+
/** Framework-only. */
|
|
1891
|
+
dehydrate: (opts?: {
|
|
1892
|
+
requestAssets?: ManifestRouteAssets;
|
|
1893
|
+
}) => Promise<void>;
|
|
1894
|
+
/** Framework-only. */
|
|
1895
|
+
takeBufferedScripts: () => RouterManagedTag | undefined;
|
|
1896
|
+
/** Framework-only: takes buffered router-owned HTML. */
|
|
1897
|
+
takeBufferedHtml: () => string | undefined;
|
|
1898
|
+
/** Framework-only. */
|
|
1899
|
+
liftScriptBarrier: () => void;
|
|
1900
|
+
}
|
|
1901
|
+
interface RouterSsrLifecycle {
|
|
1902
|
+
onServerSsrAttach?: Array<(serverSsr: ServerSsr) => void>;
|
|
1903
|
+
}
|
|
1904
|
+
type AnyRouter = RouterCore<any, any, any, any, any>;
|
|
1905
|
+
interface ViewTransitionOptions {
|
|
1906
|
+
types: Array<string> | ((locationChangeInfo: {
|
|
1907
|
+
fromLocation?: ParsedLocation;
|
|
1908
|
+
toLocation: ParsedLocation;
|
|
1909
|
+
pathChanged: boolean;
|
|
1910
|
+
hrefChanged: boolean;
|
|
1911
|
+
hashChanged: boolean;
|
|
1912
|
+
}) => Array<string> | false);
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Convert an unknown error into a minimal, serializable object.
|
|
1916
|
+
* Includes name and message (and stack in development).
|
|
1917
|
+
*/
|
|
1918
|
+
declare function defaultSerializeError(err: unknown): {
|
|
1919
|
+
name: string;
|
|
1920
|
+
message: string;
|
|
1921
|
+
} | {
|
|
1922
|
+
data: unknown;
|
|
1923
|
+
};
|
|
1924
|
+
/** Options for configuring trailing-slash behavior. */
|
|
1925
|
+
declare const trailingSlashOptions: {
|
|
1926
|
+
readonly always: "always";
|
|
1927
|
+
readonly never: "never";
|
|
1928
|
+
readonly preserve: "preserve";
|
|
1929
|
+
};
|
|
1930
|
+
type TrailingSlashOption = (typeof trailingSlashOptions)[keyof typeof trailingSlashOptions];
|
|
1931
|
+
declare global {
|
|
1932
|
+
var __TSR_CACHE__: {
|
|
1933
|
+
routeTree: AnyRoute;
|
|
1934
|
+
processRouteTreeResult: ProcessRouteTreeResult<AnyRoute>;
|
|
1935
|
+
resolvePathCache: LRUCache<string, string>;
|
|
1936
|
+
} | undefined;
|
|
1937
|
+
}
|
|
1938
|
+
interface RouterCore<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> {
|
|
1939
|
+
shouldViewTransition?: boolean | ViewTransitionOptions;
|
|
1940
|
+
/** Current client load transaction and owner of navigation writes. */
|
|
1941
|
+
_tx?: LoadTransaction;
|
|
1942
|
+
/** Joinable in-flight loader generations keyed by match ID. */
|
|
1943
|
+
_flights?: Map<string, LoaderFlight>;
|
|
1944
|
+
/** Active speculative lanes retained for cancellation, invalidation, and cache clearing. */
|
|
1945
|
+
_preloads?: Map<AbortController, Array<AnyRouteMatch>>;
|
|
1946
|
+
/** Owns cancellable work before a client transaction publishes. */
|
|
1947
|
+
_preflight?: AbortController;
|
|
1948
|
+
/** Transfers one reconstructed SSR prefix into its initial client load. */
|
|
1949
|
+
_handoff?: HydrationHandoff;
|
|
1950
|
+
/** Pending-boundary reveal and minimum-visible timing state. */
|
|
1951
|
+
_pending?: PendingSession;
|
|
1952
|
+
/** Result of the latest server load, used to render or redirect. */
|
|
1953
|
+
_serverResult?: ServerLoadResult;
|
|
1954
|
+
/** Framework publication waiting for an exact render acknowledgement. */
|
|
1955
|
+
_rendered?: [offered?: Array<AnyRouteMatch>, settle?: (rendered: boolean) => void];
|
|
1956
|
+
/** Development-only HMR reload for a route and its descendants. */
|
|
1957
|
+
_refreshRoute: (() => Promise<void>) | undefined;
|
|
1958
|
+
/** Development-only replacement for a route's lazy chunk owner. */
|
|
1959
|
+
_replaceRouteChunk: ((route: AnyRoute, lazyFn: AnyRoute['lazyFn']) => void) | undefined;
|
|
1960
|
+
}
|
|
1961
|
+
type HydrationHandoff = [claim: () => AbortController | undefined, finish: (matches?: Array<AnyRouteMatch>) => number | undefined];
|
|
1962
|
+
/**
|
|
1963
|
+
* Core, framework-agnostic router engine that powers TanStack Router.
|
|
1964
|
+
*
|
|
1965
|
+
* Provides navigation, matching, loading, preloading, caching and event APIs
|
|
1966
|
+
* used by framework adapters (React/Solid). Prefer framework helpers like
|
|
1967
|
+
* `createRouter` in app code.
|
|
1968
|
+
*
|
|
1969
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
|
|
1970
|
+
*/
|
|
1971
|
+
declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> {
|
|
1972
|
+
tempLocationKey: string | undefined;
|
|
1973
|
+
_scroll: {
|
|
1974
|
+
next: boolean;
|
|
1975
|
+
hash?: boolean;
|
|
1976
|
+
restoring?: boolean;
|
|
1977
|
+
restoration?: boolean;
|
|
1978
|
+
reset?: boolean;
|
|
1979
|
+
};
|
|
1980
|
+
subscribers: Set<RouterListener<RouterEvent>>;
|
|
1981
|
+
/** Accepted off-screen loader generations keyed by match ID. */
|
|
1982
|
+
_cache: Map<string, AnyRouteMatch>;
|
|
1983
|
+
/** Accepted semantic lane, excluding temporary pending presentation. */
|
|
1984
|
+
_committed: Array<AnyRouteMatch>;
|
|
1985
|
+
stores: RouterStores<TRouteTree>;
|
|
1986
|
+
private getStoreConfig;
|
|
1987
|
+
batch: (fn: () => void) => void;
|
|
1988
|
+
options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
|
|
1989
|
+
history: TRouterHistory;
|
|
1990
|
+
rewrite?: LocationRewrite;
|
|
1991
|
+
origin?: string;
|
|
1992
|
+
latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
1993
|
+
_pendingLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
1994
|
+
basepath: string;
|
|
1995
|
+
routeTree: TRouteTree;
|
|
1996
|
+
routesById: RoutesById<TRouteTree>;
|
|
1997
|
+
routesByPath: RoutesByPath<TRouteTree>;
|
|
1998
|
+
processedTree: ProcessedTree<TRouteTree, any, any>;
|
|
1999
|
+
resolvePathCache: LRUCache<string, string>;
|
|
2000
|
+
private routeBranchCache;
|
|
2001
|
+
private lightweightCache;
|
|
2002
|
+
isServer: boolean;
|
|
2003
|
+
pathParamsDecoder?: (encoded: string) => string;
|
|
2004
|
+
protocolAllowlist: Set<string>;
|
|
2005
|
+
/**
|
|
2006
|
+
* @deprecated Use the `createRouter` function instead
|
|
2007
|
+
*/
|
|
2008
|
+
constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, getStoreConfig: GetStoreConfig);
|
|
2009
|
+
startTransition: StartTransitionFn;
|
|
2010
|
+
isShell(): boolean;
|
|
2011
|
+
update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
|
2012
|
+
get state(): RouterState<TRouteTree>;
|
|
2013
|
+
updateLatestLocation: () => void;
|
|
2014
|
+
buildRouteTree: () => ProcessRouteTreeResult<TRouteTree>;
|
|
2015
|
+
setRoutes({ routesById, routesByPath, processedTree }: ProcessRouteTreeResult<TRouteTree>): void;
|
|
2016
|
+
/**
|
|
2017
|
+
* Subscribe to router lifecycle events like `onBeforeNavigate`, `onLoad`,
|
|
2018
|
+
* `onResolved`, etc. Returns an unsubscribe function.
|
|
2019
|
+
*
|
|
2020
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterEventsType
|
|
2021
|
+
*/
|
|
2022
|
+
subscribe: SubscribeFn;
|
|
2023
|
+
emit: EmitFn;
|
|
2024
|
+
/**
|
|
2025
|
+
* Parse a HistoryLocation into a strongly-typed ParsedLocation using the
|
|
2026
|
+
* current router options, rewrite rules and search parser/stringifier.
|
|
2027
|
+
*/
|
|
2028
|
+
parseLocation: ParseLocationFn<TRouteTree>;
|
|
2029
|
+
/** Resolve a path using the router's trailing-slash policy. */
|
|
2030
|
+
resolvePathWithBase: (from: string, path: string) => string;
|
|
2031
|
+
private getRouteBranch;
|
|
2032
|
+
matchRoutes: MatchRoutesFn;
|
|
2033
|
+
private matchRoutesInternal;
|
|
2034
|
+
getMatchedRoutes: GetMatchRoutesFn;
|
|
2035
|
+
/**
|
|
2036
|
+
* Lightweight route matching for buildLocation.
|
|
2037
|
+
* Only computes fullPath, accumulated search, and params - skipping expensive
|
|
2038
|
+
* operations like AbortController, loaderDeps, and full match objects.
|
|
2039
|
+
*/
|
|
2040
|
+
private matchRoutesLightweight;
|
|
2041
|
+
/**
|
|
2042
|
+
* Build the next ParsedLocation from navigation options without committing.
|
|
2043
|
+
* Resolves `to`/`from`, params/search/hash/state, applies search validation
|
|
2044
|
+
* and middlewares, and returns a stable, stringified location object.
|
|
2045
|
+
*
|
|
2046
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#buildlocation-method
|
|
2047
|
+
*/
|
|
2048
|
+
buildLocation: BuildLocationFn;
|
|
2049
|
+
_commitPromise: (Promise<void> & {
|
|
2050
|
+
resolve: () => void;
|
|
2051
|
+
}) | undefined;
|
|
2052
|
+
/**
|
|
2053
|
+
* Commit a previously built location to history (push/replace), optionally
|
|
2054
|
+
* using view transitions and scroll restoration options.
|
|
2055
|
+
*/
|
|
2056
|
+
commitLocation: CommitLocationFn;
|
|
2057
|
+
/** Convenience helper: build a location from options, then commit it. */
|
|
2058
|
+
buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
|
|
2059
|
+
/**
|
|
2060
|
+
* Imperatively navigate using standard `NavigateOptions`. When `reloadDocument`
|
|
2061
|
+
* or an absolute `href` is provided, performs a full document navigation.
|
|
2062
|
+
* Otherwise, builds and commits a client-side location.
|
|
2063
|
+
*
|
|
2064
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType
|
|
2065
|
+
*/
|
|
2066
|
+
navigate: NavigateFn;
|
|
2067
|
+
load: LoadFn;
|
|
2068
|
+
startViewTransition: (fn: () => Promise<void>) => any;
|
|
2069
|
+
/**
|
|
2070
|
+
* Invalidate selected match generations and optionally force current matches
|
|
2071
|
+
* back into a pending state.
|
|
2072
|
+
*
|
|
2073
|
+
* - Marks committed and cached matches whose IDs are selected as invalid.
|
|
2074
|
+
* - Retires selected active preloads so older work cannot publish fresh data.
|
|
2075
|
+
*
|
|
2076
|
+
* The next load decides when to publish pending UI, so invalidation does not
|
|
2077
|
+
* mutate the currently rendered status.
|
|
2078
|
+
*/
|
|
2079
|
+
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
|
|
2080
|
+
resolveRedirect: (redirect: AnyRedirect) => AnyRedirect;
|
|
2081
|
+
clearCache: ClearCacheFn<this>;
|
|
2082
|
+
loadRouteChunk: (route: AnyRoute, componentType?: 'errorComponent' | 'notFoundComponent' | false) => Promise<void> | undefined;
|
|
2083
|
+
preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
2084
|
+
matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
2085
|
+
ssr?: {
|
|
2086
|
+
manifest: Manifest | undefined;
|
|
2087
|
+
};
|
|
2088
|
+
serverSsr?: ServerSsr;
|
|
2089
|
+
serverSsrLifecycle?: RouterSsrLifecycle;
|
|
2090
|
+
}
|
|
2091
|
+
//#endregion
|
|
2092
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/global.d.ts
|
|
2093
|
+
declare global {
|
|
2094
|
+
interface Window {
|
|
2095
|
+
__TSR_ROUTER__?: AnyRouter;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/defer.d.ts
|
|
2100
|
+
/**
|
|
2101
|
+
* Well-known symbol used by {@link defer} to tag a promise with
|
|
2102
|
+
* its deferred state. Consumers can read `promise[TSR_DEFERRED_PROMISE]`
|
|
2103
|
+
* to access `status`, `data`, or `error`.
|
|
2104
|
+
*/
|
|
2105
|
+
declare const TSR_DEFERRED_PROMISE: unique symbol;
|
|
2106
|
+
type DeferredPromiseState<T> = {
|
|
2107
|
+
status: 'pending';
|
|
2108
|
+
data?: T;
|
|
2109
|
+
error?: unknown;
|
|
2110
|
+
} | {
|
|
2111
|
+
status: 'success';
|
|
2112
|
+
data: T;
|
|
2113
|
+
} | {
|
|
2114
|
+
status: 'error';
|
|
2115
|
+
data?: T;
|
|
2116
|
+
error: unknown;
|
|
2117
|
+
};
|
|
2118
|
+
type DeferredPromise<T> = Promise<T> & {
|
|
2119
|
+
[TSR_DEFERRED_PROMISE]: DeferredPromiseState<T>;
|
|
2120
|
+
};
|
|
2121
|
+
/**
|
|
2122
|
+
* Wrap a promise with a deferred state for use with `<Await>` and `useAwaited`.
|
|
2123
|
+
*
|
|
2124
|
+
* The returned promise is augmented with internal state (status/data/error)
|
|
2125
|
+
* so UI can read progress or suspend until it settles.
|
|
2126
|
+
*
|
|
2127
|
+
* @param _promise The promise to wrap.
|
|
2128
|
+
* @param options Optional config. Provide `serializeError` to customize how
|
|
2129
|
+
* errors are serialized for transfer.
|
|
2130
|
+
* @returns The same promise with attached deferred metadata.
|
|
2131
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/deferFunction
|
|
2132
|
+
*/
|
|
2133
|
+
declare function defer<T>(_promise: Promise<T>, options?: {
|
|
2134
|
+
serializeError?: typeof defaultSerializeError;
|
|
2135
|
+
}): DeferredPromise<T>;
|
|
2136
|
+
//#endregion
|
|
2137
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts
|
|
2138
|
+
interface OptionalStructuralSharing<TStructuralSharing, TConstraint> {
|
|
2139
|
+
readonly structuralSharing?: Constrain<TStructuralSharing, TConstraint> | undefined;
|
|
2140
|
+
}
|
|
2141
|
+
//#endregion
|
|
2142
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts
|
|
2143
|
+
interface UseRouteContextBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> {
|
|
2144
|
+
select?: (search: ResolveUseRouteContext<TRouter, TFrom, TStrict>) => TSelected;
|
|
2145
|
+
}
|
|
2146
|
+
type ResolveUseRouteContext<TRouter extends AnyRouter, TFrom, TStrict extends boolean> = TStrict extends false ? AllContext<TRouter['routeTree']> : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allContext']>;
|
|
2147
|
+
type UseRouteContextResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? ResolveUseRouteContext<TRouter, TFrom, TStrict> : TSelected;
|
|
2148
|
+
//#endregion
|
|
2149
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts
|
|
2150
|
+
type UseSearchResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? ResolveUseSearch<TRouter, TFrom, TStrict> : TSelected;
|
|
2151
|
+
type ResolveUseSearch<TRouter extends AnyRouter, TFrom, TStrict extends boolean> = TStrict extends false ? FullSearchSchema<TRouter['routeTree']> : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['fullSearchSchema']>;
|
|
2152
|
+
//#endregion
|
|
2153
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts
|
|
2154
|
+
type ResolveUseParams<TRouter extends AnyRouter, TFrom, TStrict extends boolean> = TStrict extends false ? AllParams<TRouter['routeTree']> : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allParams']>;
|
|
2155
|
+
type UseParamsResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? ResolveUseParams<TRouter, TFrom, TStrict> : TSelected;
|
|
2156
|
+
//#endregion
|
|
2157
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts
|
|
2158
|
+
type UseNavigateResult<TDefaultFrom extends string> = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends string = TDefaultFrom, TMaskFrom extends string = TFrom, TMaskTo extends string = ''>({ from, ...rest }: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
|
|
2159
|
+
//#endregion
|
|
2160
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts
|
|
2161
|
+
type ResolveUseLoaderDeps<TRouter extends AnyRouter, TFrom> = Expand<RouteById<TRouter['routeTree'], TFrom>['types']['loaderDeps']>;
|
|
2162
|
+
type UseLoaderDepsResult<TRouter extends AnyRouter, TFrom, TSelected> = unknown extends TSelected ? ResolveUseLoaderDeps<TRouter, TFrom> : TSelected;
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.26/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts
|
|
2165
|
+
type ResolveUseLoaderData<TRouter extends AnyRouter, TFrom, TStrict extends boolean> = TStrict extends false ? AllLoaderData<TRouter['routeTree']> : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['loaderData']>;
|
|
2166
|
+
type UseLoaderDataResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? ResolveUseLoaderData<TRouter, TFrom, TStrict> : TSelected;
|
|
2167
|
+
//#endregion
|
|
2168
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/awaited.d.ts
|
|
2169
|
+
type AwaitOptions<T> = {
|
|
2170
|
+
promise: Promise<T>;
|
|
2171
|
+
};
|
|
2172
|
+
/** Suspend until a deferred promise resolves or rejects and return its data. */
|
|
2173
|
+
declare function useAwaited<T>({ promise: _promise }: AwaitOptions<T>): T;
|
|
2174
|
+
/**
|
|
2175
|
+
* Component that suspends on a deferred promise and renders its child with
|
|
2176
|
+
* the resolved value. Optionally provides a Suspense fallback.
|
|
2177
|
+
*/
|
|
2178
|
+
declare function Await<T>(props: AwaitOptions<T> & {
|
|
2179
|
+
fallback?: React$2.ReactNode;
|
|
2180
|
+
children: (result: T) => React$2.ReactNode;
|
|
2181
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
2182
|
+
//#endregion
|
|
2183
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/structuralSharing.d.ts
|
|
2184
|
+
type DefaultStructuralSharingEnabled<TRouter extends AnyRouter> = boolean extends TRouter['options']['defaultStructuralSharing'] ? false : NonNullable<TRouter['options']['defaultStructuralSharing']>;
|
|
2185
|
+
interface RequiredStructuralSharing<TStructuralSharing, TConstraint> {
|
|
2186
|
+
readonly structuralSharing: Constrain<TStructuralSharing, TConstraint>;
|
|
2187
|
+
}
|
|
2188
|
+
type StructuralSharingOption<TRouter extends AnyRouter, TSelected, TStructuralSharing> = unknown extends TSelected ? OptionalStructuralSharing<TStructuralSharing, boolean> : unknown extends TRouter['routeTree'] ? OptionalStructuralSharing<TStructuralSharing, boolean> : TSelected extends ValidateJSON<TSelected> ? OptionalStructuralSharing<TStructuralSharing, boolean> : DefaultStructuralSharingEnabled<TRouter> extends true ? RequiredStructuralSharing<TStructuralSharing, false> : OptionalStructuralSharing<TStructuralSharing, false>;
|
|
2189
|
+
type StructuralSharingEnabled<TRouter extends AnyRouter, TStructuralSharing> = boolean extends TStructuralSharing ? DefaultStructuralSharingEnabled<TRouter> : TStructuralSharing;
|
|
2190
|
+
type ValidateSelected<TRouter extends AnyRouter, TSelected, TStructuralSharing> = StructuralSharingEnabled<TRouter, TStructuralSharing> extends true ? ValidateJSON<TSelected> : TSelected;
|
|
2191
|
+
//#endregion
|
|
2192
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useLoaderData.d.ts
|
|
2193
|
+
interface UseLoaderDataBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected, TStructuralSharing> {
|
|
2194
|
+
select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2195
|
+
}
|
|
2196
|
+
type UseLoaderDataRoute<out TId> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLoaderDataBaseOptions<TRouter, TId, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseLoaderDataResult<TRouter, TId, true, TSelected>;
|
|
2197
|
+
//#endregion
|
|
2198
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useMatch.d.ts
|
|
2199
|
+
interface UseMatchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing extends boolean> {
|
|
2200
|
+
select?: (match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2201
|
+
shouldThrow?: TThrow;
|
|
2202
|
+
}
|
|
2203
|
+
type UseMatchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseMatchBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseMatchResult<TRouter, TFrom, true, TSelected>;
|
|
2204
|
+
type UseMatchResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? TStrict extends true ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict> : MakeRouteMatchUnion<TRouter> : TSelected;
|
|
2205
|
+
//#endregion
|
|
2206
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useLoaderDeps.d.ts
|
|
2207
|
+
interface UseLoaderDepsBaseOptions<TRouter extends AnyRouter, TFrom, TSelected, TStructuralSharing> {
|
|
2208
|
+
select?: (deps: ResolveUseLoaderDeps<TRouter, TFrom>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2209
|
+
}
|
|
2210
|
+
type UseLoaderDepsRoute<out TId> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseLoaderDepsResult<TRouter, TId, TSelected>;
|
|
2211
|
+
//#endregion
|
|
2212
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useParams.d.ts
|
|
2213
|
+
interface UseParamsBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing> {
|
|
2214
|
+
select?: (params: ResolveUseParams<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2215
|
+
shouldThrow?: TThrow;
|
|
2216
|
+
}
|
|
2217
|
+
type UseParamsRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseParamsBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseParamsResult<TRouter, TFrom, true, TSelected>;
|
|
2218
|
+
//#endregion
|
|
2219
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useSearch.d.ts
|
|
2220
|
+
interface UseSearchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing> {
|
|
2221
|
+
select?: (state: ResolveUseSearch<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2222
|
+
shouldThrow?: TThrow;
|
|
2223
|
+
}
|
|
2224
|
+
type UseSearchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseSearchBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseSearchResult<TRouter, TFrom, true, TSelected>;
|
|
2225
|
+
//#endregion
|
|
2226
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useRouteContext.d.ts
|
|
2227
|
+
type UseRouteContextRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown>(opts?: UseRouteContextBaseOptions<TRouter, TFrom, true, TSelected>) => UseRouteContextResult<TRouter, TFrom, true, TSelected>;
|
|
2228
|
+
//#endregion
|
|
2229
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/link.d.ts
|
|
2230
|
+
type UseLinkReactProps<TComp> = TComp extends keyof React$2.JSX.IntrinsicElements ? React$2.JSX.IntrinsicElements[TComp] : TComp extends React$2.ComponentType<any> ? React$2.ComponentPropsWithoutRef<TComp> & React$2.RefAttributes<React$2.ComponentRef<TComp>> : never;
|
|
2231
|
+
type ActiveLinkOptions<TComp = 'a', TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & ActiveLinkOptionProps<TComp>;
|
|
2232
|
+
type ActiveLinkProps<TComp> = Partial<LinkComponentReactProps<TComp> & {
|
|
2233
|
+
[key: `data-${string}`]: unknown;
|
|
2234
|
+
}>;
|
|
2235
|
+
interface ActiveLinkOptionProps<TComp = 'a'> {
|
|
2236
|
+
/**
|
|
2237
|
+
* A function that returns additional props for the `active` state of this link.
|
|
2238
|
+
* These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)
|
|
2239
|
+
*/
|
|
2240
|
+
activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>);
|
|
2241
|
+
/**
|
|
2242
|
+
* A function that returns additional props for the `inactive` state of this link.
|
|
2243
|
+
* These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)
|
|
2244
|
+
*/
|
|
2245
|
+
inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>);
|
|
2246
|
+
}
|
|
2247
|
+
type LinkProps<TComp = 'a', TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkPropsChildren;
|
|
2248
|
+
interface LinkPropsChildren {
|
|
2249
|
+
children?: React$2.ReactNode | ((state: {
|
|
2250
|
+
isActive: boolean;
|
|
2251
|
+
}) => React$2.ReactNode);
|
|
2252
|
+
}
|
|
2253
|
+
type LinkComponentReactProps<TComp> = Omit<UseLinkReactProps<TComp>, keyof CreateLinkProps>;
|
|
2254
|
+
type LinkComponentProps<TComp = 'a', TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = '.', TMaskFrom extends string = TFrom, TMaskTo extends string = '.'> = LinkComponentReactProps<TComp> & LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
|
|
2255
|
+
type CreateLinkProps = LinkProps<any, any, string, string, string, string>;
|
|
2256
|
+
interface LinkComponentRoute<in out TDefaultFrom extends string = string> {
|
|
2257
|
+
defaultFrom: TDefaultFrom;
|
|
2258
|
+
<TRouter extends AnyRouter = RegisteredRouter, const TTo extends string | undefined = undefined, const TMaskTo extends string = ''>(props: LinkComponentProps<'a', TRouter, this['defaultFrom'], TTo, this['defaultFrom'], TMaskTo>): React$2.ReactElement;
|
|
2259
|
+
}
|
|
2260
|
+
//#endregion
|
|
2261
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/route.d.ts
|
|
2262
|
+
declare module '@tanstack/router-core' {
|
|
2263
|
+
interface UpdatableRouteOptionsExtensions {
|
|
2264
|
+
component?: RouteComponent;
|
|
2265
|
+
errorComponent?: false | null | undefined | ErrorRouteComponent;
|
|
2266
|
+
notFoundComponent?: NotFoundRouteComponent;
|
|
2267
|
+
pendingComponent?: RouteComponent;
|
|
2268
|
+
}
|
|
2269
|
+
interface RootRouteOptionsExtensions {
|
|
2270
|
+
shellComponent?: ({ children }: {
|
|
2271
|
+
children: React$1.ReactNode;
|
|
2272
|
+
}) => React$1.ReactNode;
|
|
2273
|
+
}
|
|
2274
|
+
interface RouteExtensions<in out TId extends string, in out TFullPath extends string> {
|
|
2275
|
+
useMatch: UseMatchRoute<TId>;
|
|
2276
|
+
useRouteContext: UseRouteContextRoute<TId>;
|
|
2277
|
+
useSearch: UseSearchRoute<TId>;
|
|
2278
|
+
useParams: UseParamsRoute<TId>;
|
|
2279
|
+
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
|
2280
|
+
useLoaderData: UseLoaderDataRoute<TId>;
|
|
2281
|
+
useNavigate: () => UseNavigateResult<TFullPath>;
|
|
2282
|
+
Link: LinkComponentRoute<TFullPath>;
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
interface DefaultRouteTypes<TProps> {
|
|
2286
|
+
component: ((props: TProps) => any) | React$1.LazyExoticComponent<(props: TProps) => any>;
|
|
2287
|
+
}
|
|
2288
|
+
interface RouteTypes<TProps> extends DefaultRouteTypes<TProps> {}
|
|
2289
|
+
type AsyncRouteComponent<TProps> = RouteTypes<TProps>['component'] & {
|
|
2290
|
+
preload?: () => Promise<void> | undefined;
|
|
2291
|
+
};
|
|
2292
|
+
type RouteComponent = AsyncRouteComponent<{}>;
|
|
2293
|
+
type ErrorRouteComponent = AsyncRouteComponent<ErrorComponentProps>;
|
|
2294
|
+
type NotFoundRouteComponent = RouteTypes<NotFoundRouteProps>['component'];
|
|
2295
|
+
//#endregion
|
|
2296
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/fileRoute.d.ts
|
|
2297
|
+
declare module '@tanstack/router-core' {
|
|
2298
|
+
interface LazyRoute<in out TRoute extends AnyRoute> {
|
|
2299
|
+
useMatch: UseMatchRoute<TRoute['id']>;
|
|
2300
|
+
useRouteContext: UseRouteContextRoute<TRoute['id']>;
|
|
2301
|
+
useSearch: UseSearchRoute<TRoute['id']>;
|
|
2302
|
+
useParams: UseParamsRoute<TRoute['id']>;
|
|
2303
|
+
useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>;
|
|
2304
|
+
useLoaderData: UseLoaderDataRoute<TRoute['id']>;
|
|
2305
|
+
useNavigate: () => UseNavigateResult<TRoute['fullPath']>;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
//#endregion
|
|
2309
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/history.d.ts
|
|
2310
|
+
declare module '@tanstack/history' {
|
|
2311
|
+
interface HistoryState {
|
|
2312
|
+
__tempLocation?: HistoryLocation;
|
|
2313
|
+
__tempKey?: string;
|
|
2314
|
+
__hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions;
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
//#endregion
|
|
2318
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/lazyRouteComponent.d.ts
|
|
2319
|
+
/**
|
|
2320
|
+
* Wrap a dynamic import to create a route component that supports
|
|
2321
|
+
* `.preload()` and friendly reload-on-module-missing behavior.
|
|
2322
|
+
*
|
|
2323
|
+
* @param importer Function returning a module promise
|
|
2324
|
+
* @param exportName Named export to use (default: `default`)
|
|
2325
|
+
* @returns A lazy route component compatible with TanStack Router
|
|
2326
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/lazyRouteComponentFunction
|
|
2327
|
+
*/
|
|
2328
|
+
declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends ((props: infer TProps) => any) ? AsyncRouteComponent<TProps> : never;
|
|
2329
|
+
//#endregion
|
|
2330
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/Matches.d.ts
|
|
2331
|
+
declare module '@tanstack/router-core' {
|
|
2332
|
+
interface RouteMatchExtensions {
|
|
2333
|
+
meta?: Array<React$2.JSX.IntrinsicElements['meta'] | undefined>;
|
|
2334
|
+
links?: Array<React$2.JSX.IntrinsicElements['link'] | undefined>;
|
|
2335
|
+
scripts?: Array<React$2.JSX.IntrinsicElements['script'] | undefined>;
|
|
2336
|
+
styles?: Array<React$2.JSX.IntrinsicElements['style'] | undefined>;
|
|
2337
|
+
headScripts?: Array<React$2.JSX.IntrinsicElements['script'] | undefined>;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
//#endregion
|
|
2341
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/Match.d.ts
|
|
2342
|
+
/**
|
|
2343
|
+
* Render the next child match in the route tree. Typically used inside
|
|
2344
|
+
* a route component to render nested routes.
|
|
2345
|
+
*
|
|
2346
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
|
|
2347
|
+
*/
|
|
2348
|
+
declare const Outlet: React$2.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/router.d.ts
|
|
2351
|
+
declare module '@tanstack/router-core' {
|
|
2352
|
+
interface RouterOptionsExtensions {
|
|
2353
|
+
/**
|
|
2354
|
+
* The default `component` a route should use if no component is provided.
|
|
2355
|
+
*
|
|
2356
|
+
* @default Outlet
|
|
2357
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
|
|
2358
|
+
*/
|
|
2359
|
+
defaultComponent?: RouteComponent;
|
|
2360
|
+
/**
|
|
2361
|
+
* The default `errorComponent` a route should use if no error component is provided.
|
|
2362
|
+
*
|
|
2363
|
+
* @default ErrorComponent
|
|
2364
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
|
|
2365
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
|
|
2366
|
+
*/
|
|
2367
|
+
defaultErrorComponent?: ErrorRouteComponent;
|
|
2368
|
+
/**
|
|
2369
|
+
* The default `pendingComponent` a route should use if no pending component is provided.
|
|
2370
|
+
*
|
|
2371
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
|
|
2372
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
|
|
2373
|
+
*/
|
|
2374
|
+
defaultPendingComponent?: RouteComponent;
|
|
2375
|
+
/**
|
|
2376
|
+
* The default `notFoundComponent` a route should use if no notFound component is provided.
|
|
2377
|
+
*
|
|
2378
|
+
* @default NotFound
|
|
2379
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
|
|
2380
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
|
|
2381
|
+
*/
|
|
2382
|
+
defaultNotFoundComponent?: NotFoundRouteComponent;
|
|
2383
|
+
/**
|
|
2384
|
+
* A component that will be used to wrap the entire router.
|
|
2385
|
+
*
|
|
2386
|
+
* This is useful for providing a context to the entire router.
|
|
2387
|
+
*
|
|
2388
|
+
* Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
|
|
2389
|
+
*
|
|
2390
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
|
|
2391
|
+
*/
|
|
2392
|
+
Wrap?: (props: {
|
|
2393
|
+
children: any;
|
|
2394
|
+
}) => React.JSX.Element;
|
|
2395
|
+
/**
|
|
2396
|
+
* A component that will be used to wrap the inner contents of the router.
|
|
2397
|
+
*
|
|
2398
|
+
* This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
|
|
2399
|
+
*
|
|
2400
|
+
* Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
|
|
2401
|
+
*
|
|
2402
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
|
|
2403
|
+
*/
|
|
2404
|
+
InnerWrap?: (props: {
|
|
2405
|
+
children: any;
|
|
2406
|
+
}) => React.JSX.Element;
|
|
2407
|
+
/**
|
|
2408
|
+
* The default `onCatch` handler for errors caught by the Router ErrorBoundary
|
|
2409
|
+
*
|
|
2410
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)
|
|
2411
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)
|
|
2412
|
+
*/
|
|
2413
|
+
defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
//#endregion
|
|
2417
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/RouterProvider.d.ts
|
|
2418
|
+
/**
|
|
2419
|
+
* Renders the current match presentation and provides the router to the React
|
|
2420
|
+
* tree via context.
|
|
2421
|
+
*
|
|
2422
|
+
* Accepts the same options as `createRouter` via props to update the router
|
|
2423
|
+
* instance after creation.
|
|
2424
|
+
*
|
|
2425
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
|
|
2426
|
+
*/
|
|
2427
|
+
declare function RouterProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouter, TDehydrated>): import("react/jsx-runtime").JSX.Element;
|
|
2428
|
+
type RouterProps<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, NonNullable<TRouter['options']['defaultStructuralSharing']>, TRouter['history'], TDehydrated>, 'context'> & {
|
|
2429
|
+
router: TRouter;
|
|
2430
|
+
context?: Partial<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, NonNullable<TRouter['options']['defaultStructuralSharing']>, TRouter['history'], TDehydrated>['context']>;
|
|
2431
|
+
};
|
|
2432
|
+
//#endregion
|
|
2433
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/useLocation.d.ts
|
|
2434
|
+
interface UseLocationBaseOptions<TRouter extends AnyRouter, TSelected, TStructuralSharing extends boolean = boolean> {
|
|
2435
|
+
select?: (state: RouterState<TRouter['routeTree']>['location']) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
|
2436
|
+
}
|
|
2437
|
+
type UseLocationResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? RouterState<TRouter['routeTree']>['location'] : TSelected;
|
|
2438
|
+
/**
|
|
2439
|
+
* Read the current location from the router state with optional selection.
|
|
2440
|
+
* Useful for subscribing to just the pieces of location you care about.
|
|
2441
|
+
*
|
|
2442
|
+
* Options:
|
|
2443
|
+
* - `select`: Project the `location` object to a derived value
|
|
2444
|
+
* - `structuralSharing`: Enable structural sharing for stable references
|
|
2445
|
+
*
|
|
2446
|
+
* @returns The current location (or selected value).
|
|
2447
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook
|
|
2448
|
+
*/
|
|
2449
|
+
declare function useLocation<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>): UseLocationResult<TRouter, TSelected>;
|
|
2450
|
+
//#endregion
|
|
2451
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/HeadContent.d.ts
|
|
2452
|
+
interface HeadContentProps {
|
|
2453
|
+
assetCrossOrigin?: AssetCrossOriginConfig;
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Render route-managed head tags (title, meta, links, styles, head scripts).
|
|
2457
|
+
* Place inside the document head of your app shell.
|
|
2458
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
|
|
2459
|
+
*/
|
|
2460
|
+
declare function HeadContent(props: HeadContentProps): import("react/jsx-runtime").JSX.Element;
|
|
2461
|
+
//#endregion
|
|
2462
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/Scripts.d.ts
|
|
2463
|
+
/**
|
|
2464
|
+
* Render body script tags collected from route matches and SSR manifests.
|
|
2465
|
+
* Should be placed near the end of the document body.
|
|
2466
|
+
*/
|
|
2467
|
+
declare const Scripts: () => import("react/jsx-runtime").JSX.Element;
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.31_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/@tanstack/react-router/dist/esm/ssr/serializer.d.ts
|
|
2470
|
+
declare module '@tanstack/router-core' {
|
|
2471
|
+
interface SerializerExtensions {
|
|
2472
|
+
ReadableStream: React$2.JSX.Element;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
//#endregion
|
|
2476
|
+
//#region src/use-router.d.ts
|
|
2477
|
+
/** A full {@link ILocale}, or a locale code like `'nl-BE'`. */
|
|
2478
|
+
type LocaleInput = ILocale | string;
|
|
2479
|
+
/** Path params — fill `$param` segments and the splat (`$` → `params['*']`). */
|
|
2480
|
+
type PathParams = Record<string, string>;
|
|
2481
|
+
/** Query string params — `null`/`undefined` values are dropped. */
|
|
2482
|
+
type QueryParams = Record<string, string | number | boolean | null | undefined>;
|
|
2483
|
+
/**
|
|
2484
|
+
* **Opt-in** route typing. Augment this interface (module augmentation) to map each route `id` to
|
|
2485
|
+
* its `params` and/or `search` shape; `href`, `path`, `absolute` and `navigate` then check the id,
|
|
2486
|
+
* require the right `params`, type `query`, and reject unknown ids. Leave it empty — the default —
|
|
2487
|
+
* and everything falls back to a loose `string` id + {@link PathParams} / {@link QueryParams}, so no
|
|
2488
|
+
* augmentation is required.
|
|
2489
|
+
*
|
|
2490
|
+
* @example
|
|
2491
|
+
* declare module '@luwiostack/router' {
|
|
2492
|
+
* interface RouteRegister {
|
|
2493
|
+
* about: {} // no params
|
|
2494
|
+
* 'blog.post': { params: { postId: string }; search: { page?: number } }
|
|
2495
|
+
* }
|
|
2496
|
+
* }
|
|
2497
|
+
*/
|
|
2498
|
+
interface RouteRegister {}
|
|
2499
|
+
/** Every registered route id — or `string` while {@link RouteRegister} is left unaugmented. */
|
|
2500
|
+
type RouteId = [keyof RouteRegister] extends [never] ? string : keyof RouteRegister;
|
|
2501
|
+
/** The `params` shape declared for an id in {@link RouteRegister}; loose {@link PathParams} otherwise. */
|
|
2502
|
+
type ParamsFor<Id extends RouteId> = Id extends keyof RouteRegister ? RouteRegister[Id] extends {
|
|
2503
|
+
params: infer P;
|
|
2504
|
+
} ? P : PathParams : PathParams;
|
|
2505
|
+
/** The `search` shape declared for an id in {@link RouteRegister}; loose {@link QueryParams} otherwise. */
|
|
2506
|
+
type SearchFor<Id extends RouteId> = Id extends keyof RouteRegister ? RouteRegister[Id] extends {
|
|
2507
|
+
search: infer S;
|
|
2508
|
+
} ? S : QueryParams : QueryParams;
|
|
2509
|
+
type ParamsArg<Id extends RouteId> = {} extends ParamsFor<Id> ? {
|
|
2510
|
+
params?: ParamsFor<Id>;
|
|
2511
|
+
} : {
|
|
2512
|
+
params: ParamsFor<Id>;
|
|
2513
|
+
};
|
|
2514
|
+
/** Params for {@link IRouter.href}. */
|
|
2515
|
+
type HrefParams<Id extends RouteId = RouteId> = {
|
|
2516
|
+
/** A registered route id (e.g. `'about'`, `'blog.post'`). */
|
|
2517
|
+
id: Id;
|
|
2518
|
+
/** Target locale. Defaults to the active locale. */
|
|
2519
|
+
locale?: LocaleInput;
|
|
2520
|
+
query?: SearchFor<Id>;
|
|
2521
|
+
hash?: string;
|
|
2522
|
+
} & ParamsArg<Id>;
|
|
2523
|
+
/** Params for {@link IRouter.absolute}. */
|
|
2524
|
+
type AbsoluteHrefParams<Id extends RouteId = RouteId> = HrefParams<Id> & {
|
|
2525
|
+
/**
|
|
2526
|
+
* Origin to prepend. Defaults to the router's `origin` config (set it for SSR / pre-render), and
|
|
2527
|
+
* only then to `window.location.origin` in the browser.
|
|
2528
|
+
*/
|
|
2529
|
+
baseUrl?: string;
|
|
2530
|
+
};
|
|
2531
|
+
/** Params for {@link IRouter.path}. */
|
|
2532
|
+
type PathParamsInput<Id extends RouteId = RouteId> = {
|
|
2533
|
+
id: Id;
|
|
2534
|
+
locale?: LocaleInput;
|
|
2535
|
+
} & ParamsArg<Id>;
|
|
2536
|
+
/** Params for {@link IRouter.navigate}. */
|
|
2537
|
+
type NavigateParams<Id extends RouteId = RouteId> = {
|
|
2538
|
+
/** Target route id (e.g. `'about'`, `'blog.post'`) — the same id `href` takes. */
|
|
2539
|
+
id: Id;
|
|
2540
|
+
from?: string;
|
|
2541
|
+
query?: SearchFor<Id>;
|
|
2542
|
+
hash?: string;
|
|
2543
|
+
/** Omit to stay in the active locale; set to navigate to that locale's path. */
|
|
2544
|
+
locale?: LocaleInput;
|
|
2545
|
+
/** Replace the current history entry instead of pushing a new one. */
|
|
2546
|
+
replace?: boolean;
|
|
2547
|
+
state?: Record<string, unknown>;
|
|
2548
|
+
/** `'_blank'` opens the resolved absolute URL in a new tab. */
|
|
2549
|
+
target?: '_self' | '_blank';
|
|
2550
|
+
} & ParamsArg<Id>;
|
|
2551
|
+
/** Params for {@link IRouter.redirect} — the same id-based shape as {@link NavigateParams}. */
|
|
2552
|
+
type RedirectParams<Id extends RouteId = RouteId> = {
|
|
2553
|
+
/** Target route id (e.g. `'about'`, `'blog.post'`) — the same id `href` takes. */
|
|
2554
|
+
id: Id;
|
|
2555
|
+
/** Omit to redirect within the active locale; set to target another locale's path. */
|
|
2556
|
+
locale?: LocaleInput;
|
|
2557
|
+
query?: SearchFor<Id>;
|
|
2558
|
+
hash?: string;
|
|
2559
|
+
/** Replace the current history entry instead of pushing a new one. */
|
|
2560
|
+
replace?: boolean;
|
|
2561
|
+
/** HTTP status code for the redirect (SSR). */
|
|
2562
|
+
statusCode?: number;
|
|
2563
|
+
} & ParamsArg<Id>;
|
|
2564
|
+
/** A locale-aware router, returned by {@link useRouter}. */
|
|
2565
|
+
interface IRouter {
|
|
2566
|
+
/** The active locale. */
|
|
2567
|
+
locale: ILocale;
|
|
2568
|
+
/** The active route's id — `undefined` before the first match resolves. */
|
|
2569
|
+
routeId: string | undefined;
|
|
2570
|
+
/** Every locale this router was configured with. */
|
|
2571
|
+
locales: ILocale[];
|
|
2572
|
+
/**
|
|
2573
|
+
* Whether a route id is mounted in this router — i.e. registered and not dropped by
|
|
2574
|
+
* `config.exclude`. Pass a locale to also require the route be available in that locale (it and
|
|
2575
|
+
* its non-layout ancestors aliased there). Returns `false` for unknown ids rather than throwing.
|
|
2576
|
+
*/
|
|
2577
|
+
has(id: string, locale?: LocaleInput): boolean;
|
|
2578
|
+
/**
|
|
2579
|
+
* The locales a route id is available in — those it (and its non-layout ancestors) are aliased
|
|
2580
|
+
* for. Empty if the route was excluded. Use it to build a language switcher that only offers valid
|
|
2581
|
+
* locales, or hreflang alternates.
|
|
2582
|
+
*/
|
|
2583
|
+
availableLocales(id: RouteId): ILocale[];
|
|
2584
|
+
/** Navigate to a route id (optionally in another locale). */
|
|
2585
|
+
navigate<Id extends RouteId>(params: NavigateParams<Id>): Promise<void>;
|
|
2586
|
+
/**
|
|
2587
|
+
* A redirect to a route id, to **throw** from a `beforeLoad` / `loader` (or component) — same
|
|
2588
|
+
* id-based shape as {@link IRouter.navigate}. `throw router.redirect({ id: 'login' })`.
|
|
2589
|
+
*/
|
|
2590
|
+
redirect<Id extends RouteId>(params: RedirectParams<Id>): ReturnType<typeof redirect>;
|
|
2591
|
+
/** A not-found result to **throw** from a `beforeLoad` / `loader`. `throw router.notFound()`. */
|
|
2592
|
+
notFound(options?: Parameters<typeof notFound>[0]): ReturnType<typeof notFound>;
|
|
2593
|
+
/**
|
|
2594
|
+
* A **forbidden** result to **throw** from a `beforeLoad` / `loader` guard — a locale-aware redirect
|
|
2595
|
+
* to `statusPages[403]` (falling back to `statusPages.default` if 403 has no dedicated page).
|
|
2596
|
+
* `throw router.forbidden()`, or pass `query` to carry a return URL. The target page can read
|
|
2597
|
+
* `useRouteFailure()` for `{ status: 403 }`.
|
|
2598
|
+
*/
|
|
2599
|
+
forbidden(params?: Omit<RedirectParams, 'id'>): ReturnType<typeof redirect>;
|
|
2600
|
+
/** Re-run the active route's loaders. */
|
|
2601
|
+
reload(): Promise<void>;
|
|
2602
|
+
/** Navigate back in history. */
|
|
2603
|
+
goBack(): Promise<void>;
|
|
2604
|
+
/** Whether there is history to go back to. */
|
|
2605
|
+
canGoBack(): boolean;
|
|
2606
|
+
/** The localized pathname for a route id (no query/hash). */
|
|
2607
|
+
path<Id extends RouteId>(params: PathParamsInput<Id>): string;
|
|
2608
|
+
/** A root-relative href: pathname + query + hash. */
|
|
2609
|
+
href<Id extends RouteId>(params: HrefParams<Id>): string;
|
|
2610
|
+
/** An absolute URL: origin + href. */
|
|
2611
|
+
absolute<Id extends RouteId>(params: AbsoluteHrefParams<Id>): string;
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* Resolve a route id + locale to its localized pathname. Pure and exported for testing.
|
|
2615
|
+
*
|
|
2616
|
+
* `config` may be omitted — useful outside React (e.g. a route's `beforeLoad`, where `useRouter`
|
|
2617
|
+
* isn't available). Without it the path is always `/{locale}`-prefixed, the form that resolves in
|
|
2618
|
+
* every locale (including the unprefixed default). Pass `config` to honour `unprefixedDefault` and
|
|
2619
|
+
* strip the prefix for the default locale, exactly as {@link useRouter}'s `path` does.
|
|
2620
|
+
*
|
|
2621
|
+
* @throws If the id is not registered.
|
|
2622
|
+
*/
|
|
2623
|
+
declare function routePath(registry: RouteRegistry, config: RouterConfig | undefined, id: string, locale: ILocale, params?: PathParams): string;
|
|
2624
|
+
/**
|
|
2625
|
+
* The locales a route id is available in: every configured locale for which the route and all of its
|
|
2626
|
+
* non-layout ancestors have an explicit alias. Pure and exported for testing.
|
|
2627
|
+
*
|
|
2628
|
+
* @throws If the id is not registered.
|
|
2629
|
+
*/
|
|
2630
|
+
declare function availableLocales(registry: RouteRegistry, config: RouterConfig, id: string): ILocale[];
|
|
2631
|
+
/**
|
|
2632
|
+
* The route id {@link RouterConfig.statusPages} sends a given HTTP status to: that status's own
|
|
2633
|
+
* entry, else `default` (always present — {@link StatusPages} requires it). Pure and exported for
|
|
2634
|
+
* testing; used for 404, 403, and every `beforeLoad`/`loader` failure.
|
|
2635
|
+
*/
|
|
2636
|
+
declare function statusPageFor(statusPages: StatusPages, status: number): string;
|
|
2637
|
+
/**
|
|
2638
|
+
* A locale-aware router hook for routers built with {@link createRouter}.
|
|
2639
|
+
*
|
|
2640
|
+
* Generates hrefs and navigates by **route id + locale**, resolving translated URL segments from the
|
|
2641
|
+
* registry. Switching locale simply navigates to that locale's real path. `redirect` / `notFound` are
|
|
2642
|
+
* also on the same object (usually thrown from a route's `beforeLoad` via `context.router`).
|
|
2643
|
+
*
|
|
2644
|
+
* @throws If used outside a router created by {@link createRouter}.
|
|
2645
|
+
*
|
|
2646
|
+
* @example
|
|
2647
|
+
* const { router } = useRouter()
|
|
2648
|
+
* router.href({ id: 'about', locale: 'nl-BE' }) // '/nl-BE/over-ons'
|
|
2649
|
+
* await router.navigate({ id: 'about', locale: 'fr-BE' })
|
|
2650
|
+
*/
|
|
2651
|
+
declare function useRouter(): {
|
|
2652
|
+
router: IRouter;
|
|
2653
|
+
};
|
|
2654
|
+
//#endregion
|
|
2655
|
+
//#region src/route-builder.d.ts
|
|
2656
|
+
/**
|
|
2657
|
+
* The route context that {@link createRouter} injects before every route's own `beforeLoad`: it
|
|
2658
|
+
* always carries `{ routeId, locale, router }`, plus whatever ancestors returned from their
|
|
2659
|
+
* `beforeLoad`. The router is translation-agnostic — to translate in `title` / `description` / a
|
|
2660
|
+
* component, an ancestor `beforeLoad` puts a translator on context (e.g. `return { t }`); it then
|
|
2661
|
+
* shows up here as `context.t` (augment this interface to type it).
|
|
2662
|
+
*/
|
|
2663
|
+
interface RouteContext {
|
|
2664
|
+
/** This route's id. */
|
|
2665
|
+
routeId: string;
|
|
2666
|
+
/** The active locale for the sub-tree this route was mounted in. */
|
|
2667
|
+
locale: ILocale;
|
|
2668
|
+
/**
|
|
2669
|
+
* A locale-aware router bound to this route — the same surface as `useRouter().router`, so a guard
|
|
2670
|
+
* can `throw context.router.redirect({ id: 'login' })` or `throw context.router.notFound()`.
|
|
2671
|
+
*/
|
|
2672
|
+
router: IRouter;
|
|
2673
|
+
/** Anything an ancestor's `beforeLoad` merged into context (typed as `unknown`). */
|
|
2674
|
+
[key: string]: unknown;
|
|
2675
|
+
}
|
|
2676
|
+
/**
|
|
2677
|
+
* The context object passed to a route's `beforeLoad` / `loader`. Type its `params` and `search`
|
|
2678
|
+
* via {@link createRoute}'s generics; `context.locale` is always available. Other TanStack ctx
|
|
2679
|
+
* fields (`location`, `cause`, `abortController`, …) remain reachable as `unknown`.
|
|
2680
|
+
*/
|
|
2681
|
+
interface RouteHandlerCtx<TParams = Record<string, string>, TSearch = Record<string, unknown>> {
|
|
2682
|
+
context: RouteContext;
|
|
2683
|
+
params: TParams;
|
|
2684
|
+
search: TSearch;
|
|
2685
|
+
[key: string]: unknown;
|
|
2686
|
+
}
|
|
2687
|
+
/**
|
|
2688
|
+
* The document-head tags a route contributes, rendered by `<HeadContent />` (re-exported from
|
|
2689
|
+
* `@luwiostack/router`). TanStack merges tags across the matched routes: for `title` and for each
|
|
2690
|
+
* `meta` `name`/`property`, the **deepest** route wins; `links`, `styles` and head `scripts` are
|
|
2691
|
+
* concatenated.
|
|
2692
|
+
*/
|
|
2693
|
+
interface RouteHead {
|
|
2694
|
+
/**
|
|
2695
|
+
* `<title>` and `<meta>` tags. `{ title: '…' }` sets the document title; `{ name, content }` and
|
|
2696
|
+
* `{ property, content }` set `<meta>`; `{ 'script:ld+json': {…} }` emits a JSON-LD script.
|
|
2697
|
+
*/
|
|
2698
|
+
meta?: Array<Record<string, unknown>>;
|
|
2699
|
+
/** `<link>` tags — canonical, `alternate`/hreflang, preload, and so on. */
|
|
2700
|
+
links?: Array<Record<string, unknown>>;
|
|
2701
|
+
/** `<script>` tags placed in the head. */
|
|
2702
|
+
scripts?: Array<Record<string, unknown>>;
|
|
2703
|
+
/** `<style>` tags. */
|
|
2704
|
+
styles?: Array<Record<string, unknown>>;
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* The context passed to a route's {@link RouteConfig.head | head}. It mirrors TanStack's head ctx
|
|
2708
|
+
* (`match`, `matches`, `params`, `loaderData`) and — because `@luwiostack/router` wraps `head` — adds
|
|
2709
|
+
* `context` at the top level, so `context.locale` reads exactly like it does in `beforeLoad` and
|
|
2710
|
+
* `loader` (TanStack's raw head ctx exposes it only as `match.context`).
|
|
2711
|
+
*/
|
|
2712
|
+
interface RouteHeadCtx<TParams = Record<string, string>> {
|
|
2713
|
+
/** Route context — always carries `{ routeId, locale }`, plus anything `beforeLoad` merged in. */
|
|
2714
|
+
context: RouteContext;
|
|
2715
|
+
params: TParams;
|
|
2716
|
+
loaderData: unknown;
|
|
2717
|
+
/** The current route match — its `context` is the same {@link RouteContext}. */
|
|
2718
|
+
match: {
|
|
2719
|
+
context: RouteContext;
|
|
2720
|
+
params: TParams;
|
|
2721
|
+
loaderData: unknown;
|
|
2722
|
+
[key: string]: unknown;
|
|
2723
|
+
};
|
|
2724
|
+
matches: ReadonlyArray<unknown>;
|
|
2725
|
+
[key: string]: unknown;
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* The configuration passed to {@link createRoute}. It accepts this package's own three keys
|
|
2729
|
+
* ({@link RouteConfig.id | id}, {@link RouteConfig.parent | parent}, {@link RouteConfig.layout | layout})
|
|
2730
|
+
* plus TanStack Router's route options, which are forwarded verbatim when the tree is built. The
|
|
2731
|
+
* common options are surfaced below with types and docs; the index signature keeps every other
|
|
2732
|
+
* TanStack option available too.
|
|
2733
|
+
*
|
|
2734
|
+
* The generics type the `params` / `search` seen by `beforeLoad`, `loader` and `head` (and
|
|
2735
|
+
* `validateSearch`'s return) — `createRoute<{ postId: string }>({ … })`. They default to loose
|
|
2736
|
+
* records, so untyped usage keeps working; `context.locale` (and `head`'s `locale`) is always typed.
|
|
2737
|
+
*
|
|
2738
|
+
* `path` and `getParentRoute` are intentionally NOT accepted: the URL path is derived per locale
|
|
2739
|
+
* from {@link RouteBuilder.alias} (one or more segments), and the parent is wired from
|
|
2740
|
+
* {@link RouteConfig.parent | parent}.
|
|
2741
|
+
*/
|
|
2742
|
+
interface RouteConfig<TParams = Record<string, string>, TSearch = Record<string, unknown>> {
|
|
2743
|
+
/** Stable, unique id. Wires {@link RouteConfig.parent} and identifies the route for navigation. */
|
|
2744
|
+
id: string;
|
|
2745
|
+
/** Parent route id. Omit for a top-level route (mounted directly under the locale layout). */
|
|
2746
|
+
parent?: string;
|
|
2747
|
+
/**
|
|
2748
|
+
* Marks a **pathless** route: it contributes no URL segment. Use it for an auth guard
|
|
2749
|
+
* (`beforeLoad`) or a shared layout (`component` wrapping an `<Outlet />`). Layout routes
|
|
2750
|
+
* take no aliases.
|
|
2751
|
+
*/
|
|
2752
|
+
layout?: boolean;
|
|
2753
|
+
/**
|
|
2754
|
+
* Runs before this route (and its children) load. Its return value is **merged into the route
|
|
2755
|
+
* context** for this route and every descendant. Receives a typed ctx whose `context.locale` is
|
|
2756
|
+
* the active locale. Use it for auth guards (`throw redirect(...)`) and to derive context.
|
|
2757
|
+
*/
|
|
2758
|
+
beforeLoad?: (ctx: RouteHandlerCtx<TParams, TSearch>) => unknown;
|
|
2759
|
+
/**
|
|
2760
|
+
* Loads this route's data before its component renders. The return is the route's loader data
|
|
2761
|
+
* (read with `useRouteLoaderData()`). Receives a typed ctx; `context.locale` is available.
|
|
2762
|
+
*/
|
|
2763
|
+
loader?: (ctx: RouteHandlerCtx<TParams, TSearch>) => unknown;
|
|
2764
|
+
/**
|
|
2765
|
+
* Selects the slice of `search` the {@link RouteConfig.loader | loader} depends on, so the loader
|
|
2766
|
+
* re-runs only when those values change.
|
|
2767
|
+
*/
|
|
2768
|
+
loaderDeps?: (opts: {
|
|
2769
|
+
search: TSearch;
|
|
2770
|
+
}) => Record<string, unknown>;
|
|
2771
|
+
/** Parse and validate the query string into the typed `search` this route exposes. */
|
|
2772
|
+
validateSearch?: (search: Record<string, unknown>) => TSearch;
|
|
2773
|
+
/**
|
|
2774
|
+
* The page title — **required** for every URL-bearing route (SEO). Receives the head ctx, so
|
|
2775
|
+
* `context.locale` (and anything an ancestor put on context, like a translator) is available:
|
|
2776
|
+
* `title: ({ context }) => context.t('about.title')`. The router renders it as `<title>` and
|
|
2777
|
+
* `og:title`. Layout routes omit it. `createRouter` throws if a URL route has none.
|
|
2778
|
+
*/
|
|
2779
|
+
title?: (ctx: RouteHeadCtx<TParams>) => string;
|
|
2780
|
+
/**
|
|
2781
|
+
* The meta description — **required** for every URL-bearing route (SEO). Same ctx as {@link
|
|
2782
|
+
* RouteConfig.title | title}. The router renders it as `<meta name="description">` and
|
|
2783
|
+
* `og:description`. Layout routes omit it. `createRouter` throws if a URL route has none.
|
|
2784
|
+
*/
|
|
2785
|
+
description?: (ctx: RouteHeadCtx<TParams>) => string;
|
|
2786
|
+
/**
|
|
2787
|
+
* **Optional** extra head tags beyond the SEO essentials the router already emits (title,
|
|
2788
|
+
* description, canonical, hreflang alternates, og:*). Use it for JSON-LD, preloads, extra og/twitter
|
|
2789
|
+
* tags, etc. Same ctx as `title`/`description`; merged with the other matched routes — see
|
|
2790
|
+
* {@link RouteHead}.
|
|
2791
|
+
*/
|
|
2792
|
+
head?: (ctx: RouteHeadCtx<TParams>) => RouteHead;
|
|
2793
|
+
/** The route's component — the page (or layout shell wrapping `<Outlet />`). */
|
|
2794
|
+
component?: any;
|
|
2795
|
+
/** Shown while this route's loader is pending. */
|
|
2796
|
+
pendingComponent?: any;
|
|
2797
|
+
/** Shown when this route (or a child) throws during load or render. */
|
|
2798
|
+
errorComponent?: any;
|
|
2799
|
+
/** Shown when `notFound()` is thrown beneath this route. */
|
|
2800
|
+
notFoundComponent?: any;
|
|
2801
|
+
/** Milliseconds the loader data stays fresh; within it, navigation reuses the cache instead of re-loading. */
|
|
2802
|
+
staleTime?: number;
|
|
2803
|
+
/** Milliseconds cached loader data is kept after the route is no longer active before being garbage-collected. */
|
|
2804
|
+
gcTime?: number;
|
|
2805
|
+
/** Whether the loader re-runs on navigation — a boolean or a predicate over the match. */
|
|
2806
|
+
shouldReload?: boolean | ((ctx: RouteHandlerCtx<TParams, TSearch>) => boolean);
|
|
2807
|
+
/** Match this route's path case-sensitively (default: false). */
|
|
2808
|
+
caseSensitive?: boolean;
|
|
2809
|
+
/** Wrap the component in a `<Suspense>` boundary (default: true for lazy components). */
|
|
2810
|
+
wrapInSuspense?: boolean;
|
|
2811
|
+
/** Any other TanStack Router route option — forwarded to `createRoute` untouched. */
|
|
2812
|
+
[option: string]: unknown;
|
|
2813
|
+
}
|
|
2814
|
+
/** The forwarded TanStack options — {@link RouteConfig} without this package's own keys. */
|
|
2815
|
+
type RouteOptions = Omit<RouteConfig, 'id' | 'parent' | 'layout'>;
|
|
2816
|
+
/**
|
|
2817
|
+
* A deferred route definition. Created by {@link createRoute}, it collects the TanStack options
|
|
2818
|
+
* plus a per-locale alias map. The real TanStack routes are only created later, once
|
|
2819
|
+
* `createRouter` knows which locales to build.
|
|
2820
|
+
*/
|
|
2821
|
+
declare class RouteBuilder {
|
|
2822
|
+
#private;
|
|
2823
|
+
readonly id: string;
|
|
2824
|
+
readonly parent: string | undefined;
|
|
2825
|
+
readonly layout: boolean;
|
|
2826
|
+
readonly options: RouteOptions;
|
|
2827
|
+
constructor(config: RouteConfig<any, any>);
|
|
2828
|
+
/**
|
|
2829
|
+
* Register the localized URL path for one locale. The slug is a full TanStack path pattern, so it
|
|
2830
|
+
* may be a single segment (`'over-ons'`), the empty string (the locale index), or a **multi-segment
|
|
2831
|
+
* path** with static parts and dynamic params (`'blog/$postId'`) — a bare `$` segment is a splat.
|
|
2832
|
+
* Both the static parts and the pattern can differ per locale.
|
|
2833
|
+
*
|
|
2834
|
+
* @example
|
|
2835
|
+
* route.alias(Locale.new({ languageOrLocale: 'nl-BE' }), 'over-ons')
|
|
2836
|
+
* route.alias(Locale.new({ languageOrLocale: 'en-BE' }), 'blog/$postId')
|
|
2837
|
+
*
|
|
2838
|
+
* @throws If the route is a layout route (it has no URL), or if the locale is already aliased.
|
|
2839
|
+
*/
|
|
2840
|
+
alias(locale: ILocale, slug: string): this;
|
|
2841
|
+
/** Whether an explicit alias exists for the given locale. */
|
|
2842
|
+
hasAlias(locale: ILocale): boolean;
|
|
2843
|
+
/** How many locales this route is aliased in. A URL-bearing route must have at least one. */
|
|
2844
|
+
get aliasCount(): number;
|
|
2845
|
+
/**
|
|
2846
|
+
* The URL path for a locale (one or more segments), from the alias registered for that locale.
|
|
2847
|
+
* `createRouter` mounts a route only in the locales it is aliased in, so this is only called when
|
|
2848
|
+
* an alias is present — it throws rather than invent a segment from the id.
|
|
2849
|
+
*/
|
|
2850
|
+
slugFor(locale: ILocale): string;
|
|
2851
|
+
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Define a locale-aware route. Returns a {@link RouteBuilder}; call {@link RouteBuilder.alias} to
|
|
2854
|
+
* give it a localized URL segment per locale, then register it with a {@link RouteRegistry}.
|
|
2855
|
+
*
|
|
2856
|
+
* Optionally type the `params` / `search` the route's `beforeLoad` and `loader` receive:
|
|
2857
|
+
* `createRoute<{ postId: string }>({ … })`.
|
|
2858
|
+
*
|
|
2859
|
+
* @example
|
|
2860
|
+
* const route = createRoute({ id: 'about', component: About })
|
|
2861
|
+
* route.alias(Locale.new({ languageOrLocale: 'en-BE' }), 'about')
|
|
2862
|
+
* route.alias(Locale.new({ languageOrLocale: 'nl-BE' }), 'over-ons')
|
|
2863
|
+
*/
|
|
2864
|
+
declare function createRoute<TParams = Record<string, string>, TSearch = Record<string, unknown>>(config: RouteConfig<TParams, TSearch>): RouteBuilder;
|
|
2865
|
+
//#endregion
|
|
2866
|
+
//#region src/registry.d.ts
|
|
2867
|
+
/**
|
|
2868
|
+
* Collects {@link RouteBuilder}s. Routes usually land here via {@link registerModules} (driven by
|
|
2869
|
+
* the `@luwiostack/router/vite` plugin or a glob), then the registry is handed to `createRouter`, which
|
|
2870
|
+
* expands it into a real TanStack route tree.
|
|
2871
|
+
*
|
|
2872
|
+
* Most apps use the shared {@link routeRegistry} singleton. Construct your own `RouteRegistry` when
|
|
2873
|
+
* you need an isolated set — tests, or several routers in one app. Built on
|
|
2874
|
+
* `@luwiostack/registry`'s `createModuleRegistry` (deduping by route id, throwing on a clash).
|
|
2875
|
+
*/
|
|
2876
|
+
declare class RouteRegistry {
|
|
2877
|
+
#private;
|
|
2878
|
+
/**
|
|
2879
|
+
* Register a route. A low-level primitive — route files normally just `export` their route and
|
|
2880
|
+
* let {@link registerModules} add it.
|
|
2881
|
+
*
|
|
2882
|
+
* @throws If a *different* route with the same id was already registered.
|
|
2883
|
+
*/
|
|
2884
|
+
add(route: RouteBuilder): this;
|
|
2885
|
+
/** All registered routes, in registration order. */
|
|
2886
|
+
all(): readonly RouteBuilder[];
|
|
2887
|
+
/** Look up a registered route by id. */
|
|
2888
|
+
get(id: string): RouteBuilder | undefined;
|
|
2889
|
+
/** Remove every registered route. Mainly useful in tests. */
|
|
2890
|
+
clear(): void;
|
|
2891
|
+
}
|
|
2892
|
+
/** The shared registry used by most apps. */
|
|
2893
|
+
declare const routeRegistry: RouteRegistry;
|
|
2894
|
+
/**
|
|
2895
|
+
* Register every {@link RouteBuilder} exported by the given modules — so route files just
|
|
2896
|
+
* `export` their route and never call `add()` themselves.
|
|
2897
|
+
*
|
|
2898
|
+
* Accepts what a bundler hands you: the record from `import.meta.glob(..., { eager: true })`, or an
|
|
2899
|
+
* array of module namespaces (what the `@luwiostack/router/vite` plugin passes). Any export that is a
|
|
2900
|
+
* `RouteBuilder` — default or named — is registered; everything else is ignored.
|
|
2901
|
+
*
|
|
2902
|
+
* @example
|
|
2903
|
+
* // No plugin? One line in your app:
|
|
2904
|
+
* registerModules(import.meta.glob('./routes/**\/*.route.tsx', { eager: true }))
|
|
2905
|
+
*/
|
|
2906
|
+
declare function registerModules(modules: Record<string, unknown> | readonly unknown[], registry?: RouteRegistry): RouteRegistry;
|
|
2907
|
+
//#endregion
|
|
2908
|
+
//#region src/create-router.d.ts
|
|
2909
|
+
/**
|
|
2910
|
+
* Route ids for the pages `createRouter` redirects to on a failure, keyed by HTTP status. `default`
|
|
2911
|
+
* is **required** — the catch-all covering any status with no entry of its own, or a `beforeLoad`/
|
|
2912
|
+
* `loader` failure with no status at all (a `TypeError`, a genuine bug). Every other key is optional:
|
|
2913
|
+
* add `404`/`403` as best practice (a dedicated not-found / forbidden page), and any other status
|
|
2914
|
+
* (`503`, `429`, …) for a dedicated page per failure kind — anything you don't list falls through to
|
|
2915
|
+
* `default`, so the router always has *somewhere* to send a failure.
|
|
2916
|
+
*
|
|
2917
|
+
* @example
|
|
2918
|
+
* { 404: 'notFound', 403: 'signin', 503: 'maintenance', default: 'serverError' }
|
|
2919
|
+
* @example
|
|
2920
|
+
* { default: 'error' } // the bare minimum: one page for absolutely everything
|
|
2921
|
+
*/
|
|
2922
|
+
type StatusPages = Record<number, string> & {
|
|
2923
|
+
default: string;
|
|
2924
|
+
};
|
|
2925
|
+
/** Configuration for {@link createRouter}. */
|
|
2926
|
+
interface RouterConfig {
|
|
2927
|
+
/** The locales to mount. Each becomes a `/{locale.code}` sub-tree. */
|
|
2928
|
+
locales: ILocale[];
|
|
2929
|
+
/** Where `/` redirects to, and the locale used for the {@link RouterConfig.unprefixedDefault} tree. */
|
|
2930
|
+
defaultLocale: ILocale;
|
|
2931
|
+
/**
|
|
2932
|
+
* Absolute origin (`https://example.com`) used to build the `canonical` and `hreflang` URLs the
|
|
2933
|
+
* router emits into every page's head. Defaults to `window.location.origin`; set it for SSR /
|
|
2934
|
+
* pre-render, where there is no `window`.
|
|
2935
|
+
*/
|
|
2936
|
+
origin?: string;
|
|
2937
|
+
/** Also mount the default locale without a `/{locale}` prefix (so `/about` resolves as well). */
|
|
2938
|
+
unprefixedDefault?: boolean;
|
|
2939
|
+
/** Drop these route ids and all of their descendants. Everything else is mounted. */
|
|
2940
|
+
exclude?: string[];
|
|
2941
|
+
/**
|
|
2942
|
+
* How a URL that matches an **excluded** route's aliased path responds.
|
|
2943
|
+
*
|
|
2944
|
+
* - `'notFound'` (default) — the excluded route is dropped entirely, so its URL falls through to
|
|
2945
|
+
* the not-found catch-all like any other miss (→ **404**, via {@link RouterConfig.statusPages}).
|
|
2946
|
+
* - `'forbidden'` — the excluded route's *path* stays mounted (in every locale it's aliased in) as a
|
|
2947
|
+
* guard that redirects to `statusPages[403]` with a **403** status. Use it when a route is
|
|
2948
|
+
* disabled by config/feature-flag but should read as "exists, but not available" rather than
|
|
2949
|
+
* "never existed".
|
|
2950
|
+
*
|
|
2951
|
+
* This is scoped to `exclude` (a route id within a mounted locale). A **missing locale** is
|
|
2952
|
+
* unaffected: a `/{code}` sub-tree that isn't in {@link RouterConfig.locales} has no node at all, so
|
|
2953
|
+
* `/{code}/…` always **404**s regardless of this setting — there is nothing to forbid.
|
|
2954
|
+
*/
|
|
2955
|
+
excludeStatus?: 'notFound' | 'forbidden';
|
|
2956
|
+
/**
|
|
2957
|
+
* Route ids for the router's generic 404 / 403 / 5xx handling — so no route ever needs its own
|
|
2958
|
+
* try/catch, or its own "where does a rejected request go" logic:
|
|
2959
|
+
*
|
|
2960
|
+
* - **404** (`statusPages[404]`) — where an unmatched URL, or an explicit `throw notFound()` from a
|
|
2961
|
+
* *matched* route (a loader that couldn't find its resource), redirects, in the active locale.
|
|
2962
|
+
* - **403** (`statusPages[403]`) — where `context.router.forbidden()` / `useRouter().router.forbidden()`
|
|
2963
|
+
* redirects (typically sign-in). Pass `query` to carry a return URL.
|
|
2964
|
+
* - **Any other status** (e.g. `503`, `429`) — a dedicated page for a `beforeLoad`/`loader` failure
|
|
2965
|
+
* whose thrown value carries that `status` (an `HttpError` from `@luwiostack/http`, or anything
|
|
2966
|
+
* shaped like one).
|
|
2967
|
+
* - **`default`** — the catch-all: 404/403 fall back to it when not given their own entry, and so
|
|
2968
|
+
* does any other unlisted status or a `beforeLoad`/`loader` failure with no status at all.
|
|
2969
|
+
*
|
|
2970
|
+
* A `beforeLoad`/`loader` failure is logged (`console.error`, so it still reaches an error tracker)
|
|
2971
|
+
* before the redirect. Every status page can read {@link useRouteFailure} for `{ status, error? }` —
|
|
2972
|
+
* `error` (the underlying message) is only present for an actual `beforeLoad`/`loader` failure; a
|
|
2973
|
+
* 404/403 carries `status` only, since there's no exception behind either.
|
|
2974
|
+
*
|
|
2975
|
+
* **Only the data lifecycle is covered.** An error thrown by a route's own `component` DURING
|
|
2976
|
+
* RENDER is a UI bug, not a load failure, and is never touched by `statusPages` — that's left
|
|
2977
|
+
* entirely to the implementor: that route's own `errorComponent`, {@link RouterConfig.rootErrorComponent},
|
|
2978
|
+
* or TanStack's own default.
|
|
2979
|
+
*
|
|
2980
|
+
* @see {@link StatusPages}
|
|
2981
|
+
*/
|
|
2982
|
+
statusPages: StatusPages;
|
|
2983
|
+
/**
|
|
2984
|
+
* Permanent (301) redirects for **legacy URLs** — old bookmarks / indexed links that no longer
|
|
2985
|
+
* match a route (e.g. after renaming locale codes). A map of `pattern → target`:
|
|
2986
|
+
*
|
|
2987
|
+
* - **Wildcard** — a pattern ending in `/*` captures the rest of the path and appends it to the
|
|
2988
|
+
* target's `/*`: `'/nl/*': '/nl-BE/*'` sends `/nl/over-ons` → `/nl-BE/over-ons` (query + hash
|
|
2989
|
+
* preserved). The bare prefix redirects too: `/nl` → `/nl-BE`.
|
|
2990
|
+
* - **Exact** — a pattern with no `*` redirects that one path: `'/pricing': '/plans'`.
|
|
2991
|
+
*
|
|
2992
|
+
* Patterns are matched before the not-found catch-all, so a legacy URL redirects instead of
|
|
2993
|
+
* 404-ing. A pattern must not collide with a real mounted path (old locale codes differ from the
|
|
2994
|
+
* new ones, so they don't).
|
|
2995
|
+
*/
|
|
2996
|
+
redirects?: Record<string, string>;
|
|
2997
|
+
/** Extra options forwarded to TanStack's `createRouter` (`context`, `defaultPreload`, …). */
|
|
2998
|
+
router?: Record<string, unknown>;
|
|
2999
|
+
/**
|
|
3000
|
+
* The **root** route's component. Defaults to one that renders `<HeadContent />` (so the SEO head
|
|
3001
|
+
* the router computes per page — title/og/canonical/hreflang — actually reaches the document),
|
|
3002
|
+
* `<Outlet />`, and `<Scripts />` (the SSR hydration mount point). Override it to own the document
|
|
3003
|
+
* shell yourself — but then you must render `<HeadContent />` and `<Scripts />` (both re-exported
|
|
3004
|
+
* from `@luwiostack/router`), or those emitted tags won't appear.
|
|
3005
|
+
*/
|
|
3006
|
+
rootComponent?: any;
|
|
3007
|
+
/**
|
|
3008
|
+
* The root `errorComponent` — the top-level boundary for an uncaught RENDER error (from a route's
|
|
3009
|
+
* `component`) that no nested route's own `errorComponent` caught. Unrelated to
|
|
3010
|
+
* {@link RouterConfig.statusPages}, which handles `beforeLoad`/`loader` failures instead, before a
|
|
3011
|
+
* component ever renders. Omit it and a render error falls through to TanStack's own default.
|
|
3012
|
+
*/
|
|
3013
|
+
rootErrorComponent?: any;
|
|
3014
|
+
}
|
|
3015
|
+
/**
|
|
3016
|
+
* Expand a {@link RouteRegistry} into a TanStack router: one localized sub-tree per configured
|
|
3017
|
+
* locale, with translated URL segments resolved from each route's aliases.
|
|
3018
|
+
*
|
|
3019
|
+
* Every TanStack option on a route (`loader`, `beforeLoad`, `component`, …) is forwarded
|
|
3020
|
+
* untouched. Before a route's own `beforeLoad` runs, `{ routeId, locale }` is injected into the
|
|
3021
|
+
* route context, so loaders and guards can read the active {@link ILocale}.
|
|
3022
|
+
*
|
|
3023
|
+
* @example
|
|
3024
|
+
* const router = createRouter(routeRegistry, {
|
|
3025
|
+
* locales: ['en-BE', 'nl-BE'].map((l) => Locale.new({ languageOrLocale: l })),
|
|
3026
|
+
* defaultLocale: Locale.new({ languageOrLocale: 'en-BE' }),
|
|
3027
|
+
* statusPages: { 404: 'notFound', 403: 'signin', default: 'serverError' },
|
|
3028
|
+
* })
|
|
3029
|
+
*/
|
|
3030
|
+
declare function createRouter(registry: RouteRegistry, config: RouterConfig): AnyRouter;
|
|
3031
|
+
//#endregion
|
|
3032
|
+
//#region src/lazy.d.ts
|
|
3033
|
+
/**
|
|
3034
|
+
* Code-split a route's component so its module lands in its own chunk instead of the initial bundle.
|
|
3035
|
+
*
|
|
3036
|
+
* The Vite plugin ({@link luwioRouter}) imports every `*.route` file eagerly — the registry needs
|
|
3037
|
+
* every route's id/parent/aliases/`title`/`description` up front to build the localized tree. So keep
|
|
3038
|
+
* route files **thin**: define the route here, but load the page component through `lazy()` from its
|
|
3039
|
+
* own module. The route definition stays eager (it's tiny); the component — and everything it pulls
|
|
3040
|
+
* in — splits out and loads only when the route is matched (TanStack preloads it on intent, e.g.
|
|
3041
|
+
* hover, when `defaultPreload` is on).
|
|
3042
|
+
*
|
|
3043
|
+
* Pass a bare dynamic import for a **default** export, or the export name as the second argument for a
|
|
3044
|
+
* **named** one. Point it at the component's own module — not the `*.route` file — or nothing splits.
|
|
3045
|
+
*
|
|
3046
|
+
* @example
|
|
3047
|
+
* // Home.tsx has `export function Home() { … }`
|
|
3048
|
+
* export default createRoute({
|
|
3049
|
+
* id: 'home',
|
|
3050
|
+
* component: lazy(() => import('./Home'), 'Home'),
|
|
3051
|
+
* title: ({ context }) => context.t(tokens.homeTitle),
|
|
3052
|
+
* description: ({ context }) => context.t(tokens.homeIntro),
|
|
3053
|
+
* }).alias(Locale.new({ languageOrLocale: 'en-US' }), '')
|
|
3054
|
+
*
|
|
3055
|
+
* @example
|
|
3056
|
+
* // About.tsx has `export default function About() { … }`
|
|
3057
|
+
* component: lazy(() => import('./About'))
|
|
3058
|
+
*/
|
|
3059
|
+
declare function lazy<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): ReturnType<typeof lazyRouteComponent<T, TKey>>;
|
|
3060
|
+
//#endregion
|
|
3061
|
+
//#region src/route-hooks.d.ts
|
|
3062
|
+
/**
|
|
3063
|
+
* The active locale, read straight from the router state (the `{ routeId, locale }` injected into
|
|
3064
|
+
* context by `createRouter`). Unlike `@luwiostack/locale`'s `useLocale`, this does not require the
|
|
3065
|
+
* `<Locale>` provider — so it also works in a `notFoundComponent` above it.
|
|
3066
|
+
*
|
|
3067
|
+
* @throws If used outside a router created by {@link createRouter}.
|
|
3068
|
+
*/
|
|
3069
|
+
declare function useRouteLocale(): {
|
|
3070
|
+
locale: ILocale;
|
|
3071
|
+
language: string;
|
|
3072
|
+
region: string;
|
|
3073
|
+
};
|
|
3074
|
+
/**
|
|
3075
|
+
* The current route's path params (wraps TanStack `useParams`). Pass a `select` to subscribe to just
|
|
3076
|
+
* one param — the component then re-renders only when that selected value changes, not on every param
|
|
3077
|
+
* update.
|
|
3078
|
+
*
|
|
3079
|
+
* @example
|
|
3080
|
+
* const params = useRouteParams<{ postId: string }>() // the whole object
|
|
3081
|
+
* const postId = useRouteParams((p) => p.postId) // just one — re-renders only when postId changes
|
|
3082
|
+
*/
|
|
3083
|
+
declare function useRouteParams<T = Record<string, string>, S = T>(select?: (params: T) => S): S;
|
|
3084
|
+
/**
|
|
3085
|
+
* The current route's query/search params (wraps TanStack `useSearch`). Pass a `select` to subscribe
|
|
3086
|
+
* to just one value — the component then re-renders only when that selected value changes.
|
|
3087
|
+
*
|
|
3088
|
+
* @example
|
|
3089
|
+
* const query = useRouteQuery<{ page?: number }>() // the whole object
|
|
3090
|
+
* const page = useRouteQuery((s) => s.page ?? 1) // just one — re-renders only when page changes
|
|
3091
|
+
*/
|
|
3092
|
+
declare function useRouteQuery<T = Record<string, unknown>, S = T>(select?: (search: T) => S): S;
|
|
3093
|
+
/** The current route's loader data (wraps TanStack `useLoaderData`). */
|
|
3094
|
+
declare function useRouteLoaderData<T = unknown>(): T;
|
|
3095
|
+
/**
|
|
3096
|
+
* The current route's context — includes the `{ routeId, locale }` injected by `createRouter`
|
|
3097
|
+
* (wraps TanStack `useRouteContext`).
|
|
3098
|
+
*/
|
|
3099
|
+
declare function useRouteContext<T = unknown>(): T;
|
|
3100
|
+
/**
|
|
3101
|
+
* What a `statusPages` page (see `createRouter`'s config) receives about the failure that redirected
|
|
3102
|
+
* here. `error` is only present for a `beforeLoad`/`loader` failure — a 404/403 has no underlying
|
|
3103
|
+
* exception, just a status — see {@link useRouteFailure}.
|
|
3104
|
+
*/
|
|
3105
|
+
interface RouteFailure {
|
|
3106
|
+
/** The HTTP status the router resolved — 404, 403, or whatever the thrown error carried (else 500). */
|
|
3107
|
+
status: number;
|
|
3108
|
+
/** The underlying error, for a `beforeLoad`/`loader` failure only. */
|
|
3109
|
+
error?: {
|
|
3110
|
+
message: string;
|
|
3111
|
+
};
|
|
3112
|
+
}
|
|
3113
|
+
/**
|
|
3114
|
+
* The failure that redirected here, for a page configured in `createRouter`'s `statusPages` (404,
|
|
3115
|
+
* 403, a dedicated status like 503, or the `default` catch-all). The router attaches this as history
|
|
3116
|
+
* state on every status-page redirect, so the page can render the real status/message instead of a
|
|
3117
|
+
* hardcoded string:
|
|
3118
|
+
*
|
|
3119
|
+
* @example
|
|
3120
|
+
* function Maintenance() {
|
|
3121
|
+
* const failure = useRouteFailure()
|
|
3122
|
+
* return <h1>{failure?.status ?? 503} — The website is in maintenance</h1>
|
|
3123
|
+
* }
|
|
3124
|
+
*
|
|
3125
|
+
* `undefined` when the page was opened directly (a bookmark, a typed URL) rather than via a
|
|
3126
|
+
* router-triggered redirect — there's no failure to report.
|
|
3127
|
+
*/
|
|
3128
|
+
declare function useRouteFailure(): RouteFailure | undefined;
|
|
3129
|
+
//#endregion
|
|
3130
|
+
export { type AbsoluteHrefParams, Await, HeadContent, type HrefParams, type IRouter, type LocaleInput, type NavigateParams, Outlet, type ParamsFor, type PathParams, type PathParamsInput, type QueryParams, type RedirectParams, RouteBuilder, type RouteConfig, type RouteContext, type RouteFailure, type RouteHandlerCtx, type RouteHead, type RouteHeadCtx, type RouteId, type RouteOptions, type RouteRegister, RouteRegistry, type RouterConfig, RouterProvider, Scripts, type SearchFor, type StatusPages, availableLocales, createRoute, createRouter, defer, lazy, registerModules, routePath, routeRegistry, statusPageFor, useAwaited, useLocation, useRouteContext, useRouteFailure, useRouteLoaderData, useRouteLocale, useRouteParams, useRouteQuery, useRouter };
|
|
3131
|
+
//# sourceMappingURL=index.d.mts.map
|