@tanstack/router-core 0.0.1-beta.194 → 0.0.1-beta.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/fileRoute.js.map +1 -1
- package/build/cjs/index.js +7 -4
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js +2 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +4 -210
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +194 -189
- package/build/types/index.d.ts +1 -1
- package/build/types/route.d.ts +21 -21
- package/build/types/routeInfo.d.ts +1 -1
- package/build/types/router.d.ts +10 -4
- package/build/umd/index.development.js +2102 -2019
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +21 -11
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -1
- package/src/fileRoute.ts +1 -8
- package/src/index.ts +1 -1
- package/src/route.ts +5 -47
- package/src/routeInfo.ts +1 -3
- package/src/router.ts +14 -10
- package/src/utils.ts +1 -0
- package/build/cjs/history.js +0 -228
- package/build/cjs/history.js.map +0 -1
- package/build/types/history.d.ts +0 -36
- package/src/history.ts +0 -300
package/build/types/route.d.ts
CHANGED
|
@@ -11,34 +11,34 @@ export interface RouteMeta {
|
|
|
11
11
|
}
|
|
12
12
|
export interface RouteContext {
|
|
13
13
|
}
|
|
14
|
-
export interface RegisterRouteComponent<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
14
|
+
export interface RegisterRouteComponent<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
15
15
|
}
|
|
16
|
-
export interface RegisterErrorRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
16
|
+
export interface RegisterErrorRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
17
17
|
}
|
|
18
|
-
export interface RegisterPendingRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
18
|
+
export interface RegisterPendingRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
19
19
|
}
|
|
20
|
-
export interface RegisterRouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
20
|
+
export interface RegisterRouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
21
21
|
}
|
|
22
|
-
export interface RegisterErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
22
|
+
export interface RegisterErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
23
23
|
}
|
|
24
|
-
export interface RegisterPendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
24
|
+
export interface RegisterPendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> {
|
|
25
25
|
}
|
|
26
|
-
export type RegisteredRouteComponent<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
26
|
+
export type RegisteredRouteComponent<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterRouteComponent<TLoader, TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
27
27
|
RouteComponent: infer T;
|
|
28
28
|
} ? T : () => unknown;
|
|
29
|
-
export type RegisteredErrorRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
29
|
+
export type RegisteredErrorRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterErrorRouteComponent<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
30
30
|
ErrorRouteComponent: infer T;
|
|
31
31
|
} ? T : () => unknown;
|
|
32
|
-
export type RegisteredPendingRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
32
|
+
export type RegisteredPendingRouteComponent<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterPendingRouteComponent<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
33
33
|
PendingRouteComponent: infer T;
|
|
34
34
|
} ? T : () => unknown;
|
|
35
|
-
export type RegisteredRouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
35
|
+
export type RegisteredRouteProps<TLoader = unknown, TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterRouteProps<TLoader, TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
36
36
|
RouteProps: infer T;
|
|
37
37
|
} ? T : {};
|
|
38
|
-
export type RegisteredErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
38
|
+
export type RegisteredErrorRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterRouteProps<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
39
39
|
ErrorRouteProps: infer T;
|
|
40
40
|
} ? T : {};
|
|
41
|
-
export type RegisteredPendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams,
|
|
41
|
+
export type RegisteredPendingRouteProps<TFullSearchSchema extends Record<string, any> = AnySearchSchema, TAllParams extends AnyPathParams = AnyPathParams, TAllContext extends Record<string, any> = AnyContext> = RegisterRouteProps<TFullSearchSchema, TAllParams, TAllContext> extends {
|
|
42
42
|
PendingRouteProps: infer T;
|
|
43
43
|
} ? T : {};
|
|
44
44
|
export type PreloadableObj = {
|
|
@@ -55,8 +55,8 @@ export type MetaOptions = keyof PickRequired<RouteMeta> extends never ? {
|
|
|
55
55
|
} : {
|
|
56
56
|
meta: RouteMeta;
|
|
57
57
|
};
|
|
58
|
-
export type AnyRouteProps = RegisteredRouteProps<any, any, any, any
|
|
59
|
-
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoaderContext extends Record<string, any> = AnyContext, TLoader = unknown, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext> & UpdatableRouteOptions<TLoader,
|
|
58
|
+
export type AnyRouteProps = RegisteredRouteProps<any, any, any, any>;
|
|
59
|
+
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoaderContext extends Record<string, any> = AnyContext, TLoader = unknown, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext> & UpdatableRouteOptions<TLoader, TFullSearchSchema, TAllParams, TAllContext>;
|
|
60
60
|
export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
61
61
|
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TLoaderContext extends Record<string, any> = AnyContext, TLoader = unknown, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContext extends RouteContext = RouteContext, TAllContext extends Record<string, any> = AnyContext> = RoutePathOptions<TCustomId, TPath> & {
|
|
62
62
|
getParentRoute: () => TParentRoute;
|
|
@@ -85,12 +85,12 @@ type BeforeLoadFn<TParentRoute extends AnyRoute, TAllParams, TLoaderContext, TRo
|
|
|
85
85
|
params: TAllParams;
|
|
86
86
|
context: Expand<TParentRoute['types']['context'] & TLoaderContext>;
|
|
87
87
|
}) => Promise<TRouteContext> | TRouteContext | void;
|
|
88
|
-
export type UpdatableRouteOptions<TLoader,
|
|
88
|
+
export type UpdatableRouteOptions<TLoader, TFullSearchSchema extends Record<string, any>, TAllParams extends AnyPathParams, TAllContext extends Record<string, any>> = MetaOptions & {
|
|
89
89
|
caseSensitive?: boolean;
|
|
90
90
|
wrapInSuspense?: boolean;
|
|
91
|
-
component?: RegisteredRouteComponent<TLoader, TFullSearchSchema, TAllParams,
|
|
92
|
-
errorComponent?: RegisteredErrorRouteComponent<TFullSearchSchema, TAllParams,
|
|
93
|
-
pendingComponent?: RegisteredPendingRouteComponent<TFullSearchSchema, TAllParams,
|
|
91
|
+
component?: RegisteredRouteComponent<TLoader, TFullSearchSchema, TAllParams, TAllContext>;
|
|
92
|
+
errorComponent?: RegisteredErrorRouteComponent<TFullSearchSchema, TAllParams, TAllContext>;
|
|
93
|
+
pendingComponent?: RegisteredPendingRouteComponent<TFullSearchSchema, TAllParams, TAllContext>;
|
|
94
94
|
preSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
95
95
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
96
96
|
preloadMaxAge?: number;
|
|
@@ -123,7 +123,7 @@ export interface LoaderContext<TAllParams = {}, TLoaderContext = {}, TAllContext
|
|
|
123
123
|
abortController: AbortController;
|
|
124
124
|
preload: boolean;
|
|
125
125
|
params: TAllParams;
|
|
126
|
-
context: DeepMergeAll<[TAllContext, TLoaderContext, TRouteContext]
|
|
126
|
+
context: Expand<DeepMergeAll<[TAllContext, TLoaderContext, TRouteContext]>>;
|
|
127
127
|
}
|
|
128
128
|
export type SearchFilter<T, U = T> = (prev: T) => U;
|
|
129
129
|
export type ResolveId<TParentRoute, TCustomId extends string, TPath extends string> = TParentRoute extends {
|
|
@@ -198,13 +198,13 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
198
198
|
originalIndex?: number;
|
|
199
199
|
router?: AnyRouter;
|
|
200
200
|
rank: number;
|
|
201
|
-
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext> & UpdatableRouteOptions<TLoader,
|
|
201
|
+
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext> & UpdatableRouteOptions<TLoader, TFullSearchSchema, TAllParams, TAllContext>);
|
|
202
202
|
init: (opts: {
|
|
203
203
|
originalIndex: number;
|
|
204
204
|
router: AnyRouter;
|
|
205
205
|
}) => void;
|
|
206
206
|
addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TAllContext, TRouterContext, TNewChildren, TRouteTree>;
|
|
207
|
-
update: (options: UpdatableRouteOptions<TLoader,
|
|
207
|
+
update: (options: UpdatableRouteOptions<TLoader, TFullSearchSchema, TAllParams, TAllContext>) => this;
|
|
208
208
|
static __onInit: (route: any) => void;
|
|
209
209
|
}
|
|
210
210
|
export type AnyRootRoute = RootRoute<any, any, any, any>;
|
|
@@ -18,5 +18,5 @@ export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<ParseRoute
|
|
|
18
18
|
fullPath: TPath;
|
|
19
19
|
}>;
|
|
20
20
|
export type RoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree>['fullPath'] | '/';
|
|
21
|
-
export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['fullSearchSchema']
|
|
21
|
+
export type FullSearchSchema<TRouteTree extends AnyRoute> = Partial<Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['fullSearchSchema']>>>;
|
|
22
22
|
export type AllParams<TRouteTree extends AnyRoute> = Expand<UnionToIntersection<ParseRoute<TRouteTree>['types']['allParams']>>;
|
package/build/types/router.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { Store } from '@tanstack/store';
|
|
2
|
+
import { HistoryLocation, HistoryState, RouterHistory } from '@tanstack/history';
|
|
2
3
|
import { LinkInfo, LinkOptions, NavigateOptions, ToOptions, ResolveRelativePath } from './link';
|
|
3
4
|
import { Route, AnySearchSchema, AnyRoute, AnyContext, AnyPathParams, RegisteredRouteComponent, RegisteredErrorRouteComponent, RegisteredPendingRouteComponent, RouteMask } from './route';
|
|
4
5
|
import { RoutesById, RoutesByPath, ParseRoute, FullSearchSchema, RouteById, RoutePaths, RouteIds } from './routeInfo';
|
|
5
6
|
import { NoInfer, PickAsRequired, Timeout, Updater, NonNullableUpdater } from './utils';
|
|
6
|
-
import { HistoryState, RouterHistory } from './history';
|
|
7
7
|
declare global {
|
|
8
8
|
interface Window {
|
|
9
9
|
__TSR_DEHYDRATED__?: HydrationCtx;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
declare module '@tanstack/history' {
|
|
13
|
+
interface HistoryState {
|
|
14
|
+
__tempLocation?: HistoryLocation;
|
|
15
|
+
__tempKey?: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
12
18
|
export interface Register {
|
|
13
19
|
}
|
|
14
20
|
export interface LocationState {
|
|
@@ -75,9 +81,9 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TDehydrated extends
|
|
|
75
81
|
defaultPreload?: false | 'intent';
|
|
76
82
|
defaultPreloadDelay?: number;
|
|
77
83
|
reloadOnWindowFocus?: boolean;
|
|
78
|
-
defaultComponent?: RegisteredRouteComponent<unknown, AnySearchSchema, AnyPathParams, AnyContext
|
|
79
|
-
defaultErrorComponent?: RegisteredErrorRouteComponent<AnySearchSchema, AnyPathParams, AnyContext
|
|
80
|
-
defaultPendingComponent?: RegisteredPendingRouteComponent<AnySearchSchema, AnyPathParams, AnyContext
|
|
84
|
+
defaultComponent?: RegisteredRouteComponent<unknown, AnySearchSchema, AnyPathParams, AnyContext>;
|
|
85
|
+
defaultErrorComponent?: RegisteredErrorRouteComponent<AnySearchSchema, AnyPathParams, AnyContext>;
|
|
86
|
+
defaultPendingComponent?: RegisteredPendingRouteComponent<AnySearchSchema, AnyPathParams, AnyContext>;
|
|
81
87
|
defaultMaxAge?: number;
|
|
82
88
|
defaultGcMaxAge?: number;
|
|
83
89
|
defaultPreloadMaxAge?: number;
|