@tanstack/router-core 0.0.1-beta.7 → 0.0.1-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/packages/router-core/src/index.js +0 -1
- package/build/cjs/packages/router-core/src/index.js.map +1 -1
- package/build/cjs/packages/router-core/src/route.js +0 -11
- package/build/cjs/packages/router-core/src/route.js.map +1 -1
- package/build/cjs/packages/router-core/src/router.js +12 -2
- package/build/cjs/packages/router-core/src/router.js.map +1 -1
- package/build/esm/index.js +11 -10
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +132 -138
- package/build/types/index.d.ts +67 -68
- package/build/umd/index.development.js +10 -10
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/route.ts +0 -13
- package/src/router.ts +14 -1
package/build/types/index.d.ts
CHANGED
|
@@ -57,6 +57,72 @@ declare function warning(cond: any, message: string): cond is true;
|
|
|
57
57
|
declare function functionalUpdate<TResult>(updater: Updater<TResult>, previous: TResult): TResult;
|
|
58
58
|
declare function pick<T, K extends keyof T>(parent: T, keys: K[]): Pick<T, K>;
|
|
59
59
|
|
|
60
|
+
interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
|
|
61
|
+
matchId: string;
|
|
62
|
+
pathname: string;
|
|
63
|
+
params: TRouteInfo['params'];
|
|
64
|
+
parentMatch?: RouteMatch;
|
|
65
|
+
childMatches: RouteMatch[];
|
|
66
|
+
routeSearch: TRouteInfo['searchSchema'];
|
|
67
|
+
search: TRouteInfo['fullSearchSchema'];
|
|
68
|
+
status: 'idle' | 'loading' | 'success' | 'error';
|
|
69
|
+
updatedAt?: number;
|
|
70
|
+
error?: unknown;
|
|
71
|
+
isInvalid: boolean;
|
|
72
|
+
getIsInvalid: () => boolean;
|
|
73
|
+
loaderData: TRouteInfo['loaderData'];
|
|
74
|
+
routeLoaderData: TRouteInfo['routeLoaderData'];
|
|
75
|
+
isFetching: boolean;
|
|
76
|
+
isPending: boolean;
|
|
77
|
+
invalidAt: number;
|
|
78
|
+
__: {
|
|
79
|
+
element?: GetFrameworkGeneric<'Element'>;
|
|
80
|
+
errorElement?: GetFrameworkGeneric<'Element'>;
|
|
81
|
+
catchElement?: GetFrameworkGeneric<'Element'>;
|
|
82
|
+
pendingElement?: GetFrameworkGeneric<'Element'>;
|
|
83
|
+
loadPromise?: Promise<void>;
|
|
84
|
+
loaderPromise?: Promise<void>;
|
|
85
|
+
elementsPromise?: Promise<void>;
|
|
86
|
+
dataPromise?: Promise<void>;
|
|
87
|
+
pendingTimeout?: Timeout;
|
|
88
|
+
pendingMinTimeout?: Timeout;
|
|
89
|
+
pendingMinPromise?: Promise<void>;
|
|
90
|
+
onExit?: void | ((matchContext: {
|
|
91
|
+
params: TRouteInfo['allParams'];
|
|
92
|
+
search: TRouteInfo['fullSearchSchema'];
|
|
93
|
+
}) => void);
|
|
94
|
+
abortController: AbortController;
|
|
95
|
+
latestId: string;
|
|
96
|
+
validate: () => void;
|
|
97
|
+
startPending: () => void;
|
|
98
|
+
cancelPending: () => void;
|
|
99
|
+
notify: () => void;
|
|
100
|
+
resolve: () => void;
|
|
101
|
+
};
|
|
102
|
+
cancel: () => void;
|
|
103
|
+
load: (loaderOpts?: {
|
|
104
|
+
withPending?: boolean;
|
|
105
|
+
} & ({
|
|
106
|
+
preload: true;
|
|
107
|
+
maxAge: number;
|
|
108
|
+
gcMaxAge: number;
|
|
109
|
+
} | {
|
|
110
|
+
preload?: false;
|
|
111
|
+
maxAge?: never;
|
|
112
|
+
gcMaxAge?: never;
|
|
113
|
+
})) => Promise<TRouteInfo['routeLoaderData']>;
|
|
114
|
+
fetch: (opts?: {
|
|
115
|
+
maxAge?: number;
|
|
116
|
+
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
117
|
+
invalidate: () => void;
|
|
118
|
+
hasLoaders: () => boolean;
|
|
119
|
+
}
|
|
120
|
+
declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
|
|
121
|
+
matchId: string;
|
|
122
|
+
params: TRouteInfo['allParams'];
|
|
123
|
+
pathname: string;
|
|
124
|
+
}): RouteMatch<TAllRouteInfo, TRouteInfo>;
|
|
125
|
+
|
|
60
126
|
interface LocationState {
|
|
61
127
|
}
|
|
62
128
|
interface Location<TSearchObj extends AnySearchSchema = {}, TState extends LocationState = LocationState> {
|
|
@@ -260,72 +326,6 @@ interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInf
|
|
|
260
326
|
}
|
|
261
327
|
declare function createRouter<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>>(userOptions?: RouterOptions<TRouteConfig>): Router<TRouteConfig, TAllRouteInfo>;
|
|
262
328
|
|
|
263
|
-
interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> extends Route<TAllRouteInfo, TRouteInfo> {
|
|
264
|
-
matchId: string;
|
|
265
|
-
pathname: string;
|
|
266
|
-
params: TRouteInfo['params'];
|
|
267
|
-
parentMatch?: RouteMatch;
|
|
268
|
-
childMatches: RouteMatch[];
|
|
269
|
-
routeSearch: TRouteInfo['searchSchema'];
|
|
270
|
-
search: TRouteInfo['fullSearchSchema'];
|
|
271
|
-
status: 'idle' | 'loading' | 'success' | 'error';
|
|
272
|
-
updatedAt?: number;
|
|
273
|
-
error?: unknown;
|
|
274
|
-
isInvalid: boolean;
|
|
275
|
-
getIsInvalid: () => boolean;
|
|
276
|
-
loaderData: TRouteInfo['loaderData'];
|
|
277
|
-
routeLoaderData: TRouteInfo['routeLoaderData'];
|
|
278
|
-
isFetching: boolean;
|
|
279
|
-
isPending: boolean;
|
|
280
|
-
invalidAt: number;
|
|
281
|
-
__: {
|
|
282
|
-
element?: GetFrameworkGeneric<'Element'>;
|
|
283
|
-
errorElement?: GetFrameworkGeneric<'Element'>;
|
|
284
|
-
catchElement?: GetFrameworkGeneric<'Element'>;
|
|
285
|
-
pendingElement?: GetFrameworkGeneric<'Element'>;
|
|
286
|
-
loadPromise?: Promise<void>;
|
|
287
|
-
loaderPromise?: Promise<void>;
|
|
288
|
-
elementsPromise?: Promise<void>;
|
|
289
|
-
dataPromise?: Promise<void>;
|
|
290
|
-
pendingTimeout?: Timeout;
|
|
291
|
-
pendingMinTimeout?: Timeout;
|
|
292
|
-
pendingMinPromise?: Promise<void>;
|
|
293
|
-
onExit?: void | ((matchContext: {
|
|
294
|
-
params: TRouteInfo['allParams'];
|
|
295
|
-
search: TRouteInfo['fullSearchSchema'];
|
|
296
|
-
}) => void);
|
|
297
|
-
abortController: AbortController;
|
|
298
|
-
latestId: string;
|
|
299
|
-
validate: () => void;
|
|
300
|
-
startPending: () => void;
|
|
301
|
-
cancelPending: () => void;
|
|
302
|
-
notify: () => void;
|
|
303
|
-
resolve: () => void;
|
|
304
|
-
};
|
|
305
|
-
cancel: () => void;
|
|
306
|
-
load: (loaderOpts?: {
|
|
307
|
-
withPending?: boolean;
|
|
308
|
-
} & ({
|
|
309
|
-
preload: true;
|
|
310
|
-
maxAge: number;
|
|
311
|
-
gcMaxAge: number;
|
|
312
|
-
} | {
|
|
313
|
-
preload?: false;
|
|
314
|
-
maxAge?: never;
|
|
315
|
-
gcMaxAge?: never;
|
|
316
|
-
})) => Promise<TRouteInfo['routeLoaderData']>;
|
|
317
|
-
fetch: (opts?: {
|
|
318
|
-
maxAge?: number;
|
|
319
|
-
}) => Promise<TRouteInfo['routeLoaderData']>;
|
|
320
|
-
invalidate: () => void;
|
|
321
|
-
hasLoaders: () => boolean;
|
|
322
|
-
}
|
|
323
|
-
declare function createRouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(router: Router<any, any>, route: Route<TAllRouteInfo, TRouteInfo>, opts: {
|
|
324
|
-
matchId: string;
|
|
325
|
-
params: TRouteInfo['allParams'];
|
|
326
|
-
pathname: string;
|
|
327
|
-
}): RouteMatch<TAllRouteInfo, TRouteInfo>;
|
|
328
|
-
|
|
329
329
|
interface AnyRoute extends Route<any, any> {
|
|
330
330
|
}
|
|
331
331
|
interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> {
|
|
@@ -344,7 +344,6 @@ interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRo
|
|
|
344
344
|
loader: unknown extends TRouteInfo['routeLoaderData'] ? Action<LoaderContext<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams']>, TRouteInfo['routeLoaderData']> | undefined : Loader<TRouteInfo['fullSearchSchema'], TRouteInfo['allParams'], TRouteInfo['routeLoaderData']>;
|
|
345
345
|
}
|
|
346
346
|
declare function createRoute<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo>(routeConfig: RouteConfig, options: TRouteInfo['options'], parent: undefined | Route<TAllRouteInfo, any>, router: Router<TAllRouteInfo['routeConfig'], TAllRouteInfo>): Route<TAllRouteInfo, TRouteInfo>;
|
|
347
|
-
declare function cascadeLoaderData(matches: RouteMatch<any, any>[]): void;
|
|
348
347
|
|
|
349
348
|
interface AnyAllRouteInfo {
|
|
350
349
|
routeConfig: AnyRouteConfig;
|
|
@@ -616,4 +615,4 @@ declare const defaultStringifySearch: (search: Record<string, any>) => string;
|
|
|
616
615
|
declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
|
|
617
616
|
declare function stringifySearchWith(stringify: (search: any) => string): (search: Record<string, any>) => string;
|
|
618
617
|
|
|
619
|
-
export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, Loader, LoaderContext, LoaderFn, LoaderState, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesById, RoutesInfoInner, SearchFilter, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values,
|
|
618
|
+
export { Action, ActionFn, ActionState, AllRouteInfo, AnyAllRouteInfo, AnyLoaderData, AnyPathParams, AnyRoute, AnyRouteConfig, AnyRouteConfigWithChildren, AnyRouteInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultAllRouteInfo, DefinedPathParamWarning, Expand, FilterRoutesFn, FrameworkGenerics, FromLocation, GetFrameworkGeneric, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, Loader, LoaderContext, LoaderFn, LoaderState, Location, LocationState, MatchCacheEntry, MatchLocation, MatchRouteOptions, NavigateOptionsAbsolute, NoInfer, ParentParams, ParsePathParams, ParseRouteConfig, PathParamMask, PendingState, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, RelativeToPathAutoComplete, ResolveRelativePath, RootRouteId, Route, RouteConfig, RouteConfigRoute, RouteInfo, RouteInfoById, RouteInfoByPath, RouteMatch, RouteMeta, RouteOptions, Router, RouterOptions, RouterState, RoutesById, RoutesInfoInner, SearchFilter, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cleanPath, createRoute, createRouteConfig, createRouteMatch, createRouter, decode, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
|
|
@@ -1334,15 +1334,6 @@
|
|
|
1334
1334
|
});
|
|
1335
1335
|
return route;
|
|
1336
1336
|
}
|
|
1337
|
-
function cascadeLoaderData(matches) {
|
|
1338
|
-
matches.forEach((match, index) => {
|
|
1339
|
-
const parent = matches[index - 1];
|
|
1340
|
-
|
|
1341
|
-
if (parent) {
|
|
1342
|
-
match.loaderData = replaceEqualDeep(match.loaderData, _extends({}, parent.loaderData, match.routeLoaderData));
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
1337
|
|
|
1347
1338
|
const rootRouteId = '__root__';
|
|
1348
1339
|
const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId, parentPath) {
|
|
@@ -2476,7 +2467,16 @@
|
|
|
2476
2467
|
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
2477
2468
|
}
|
|
2478
2469
|
|
|
2479
|
-
|
|
2470
|
+
function cascadeLoaderData(matches) {
|
|
2471
|
+
matches.forEach((match, index) => {
|
|
2472
|
+
const parent = matches[index - 1];
|
|
2473
|
+
|
|
2474
|
+
if (parent) {
|
|
2475
|
+
match.loaderData = replaceEqualDeep(match.loaderData, _extends({}, parent.loaderData, match.routeLoaderData));
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
2480
|
exports.cleanPath = cleanPath;
|
|
2481
2481
|
exports.createBrowserHistory = createBrowserHistory;
|
|
2482
2482
|
exports.createHashHistory = createHashHistory;
|