@tanstack/solid-router 1.111.4 → 1.111.7
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/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +8 -44
- package/dist/cjs/fileRoute.cjs +4 -1
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +5 -5
- package/dist/cjs/index.d.cts +3 -5
- package/dist/cjs/redirects.cjs.map +1 -1
- package/dist/cjs/redirects.d.cts +2 -16
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +8 -109
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +4 -5
- package/dist/cjs/typePrimitives.d.cts +3 -4
- package/dist/cjs/useLoaderData.cjs.map +1 -1
- package/dist/cjs/useLoaderData.d.cts +2 -4
- package/dist/cjs/useLoaderDeps.cjs.map +1 -1
- package/dist/cjs/useLoaderDeps.d.cts +2 -4
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useMatch.d.cts +1 -2
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useNavigate.d.cts +1 -2
- package/dist/cjs/useParams.cjs.map +1 -1
- package/dist/cjs/useParams.d.cts +2 -4
- package/dist/cjs/useRouteContext.cjs.map +1 -1
- package/dist/cjs/useRouteContext.d.cts +1 -8
- package/dist/cjs/useSearch.cjs.map +1 -1
- package/dist/cjs/useSearch.d.cts +2 -4
- package/dist/esm/Matches.d.ts +8 -44
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +5 -5
- package/dist/esm/fileRoute.js +4 -1
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +3 -5
- package/dist/esm/redirects.d.ts +2 -16
- package/dist/esm/redirects.js.map +1 -1
- package/dist/esm/route.d.ts +8 -109
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +4 -5
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/typePrimitives.d.ts +3 -4
- package/dist/esm/useLoaderData.d.ts +2 -4
- package/dist/esm/useLoaderData.js.map +1 -1
- package/dist/esm/useLoaderDeps.d.ts +2 -4
- package/dist/esm/useLoaderDeps.js.map +1 -1
- package/dist/esm/useMatch.d.ts +1 -2
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useNavigate.d.ts +1 -2
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.d.ts +2 -4
- package/dist/esm/useParams.js.map +1 -1
- package/dist/esm/useRouteContext.d.ts +1 -8
- package/dist/esm/useRouteContext.js.map +1 -1
- package/dist/esm/useSearch.d.ts +2 -4
- package/dist/esm/useSearch.js.map +1 -1
- package/dist/source/Matches.d.ts +8 -44
- package/dist/source/Matches.jsx.map +1 -1
- package/dist/source/fileRoute.d.ts +5 -5
- package/dist/source/fileRoute.js +4 -1
- package/dist/source/fileRoute.js.map +1 -1
- package/dist/source/index.d.ts +3 -5
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/redirects.d.ts +2 -16
- package/dist/source/redirects.js.map +1 -1
- package/dist/source/route.d.ts +8 -109
- package/dist/source/route.js.map +1 -1
- package/dist/source/router.d.ts +4 -5
- package/dist/source/router.js.map +1 -1
- package/dist/source/typePrimitives.d.ts +3 -4
- package/dist/source/useLoaderData.d.ts +2 -4
- package/dist/source/useLoaderData.jsx.map +1 -1
- package/dist/source/useLoaderDeps.d.ts +2 -4
- package/dist/source/useLoaderDeps.jsx.map +1 -1
- package/dist/source/useMatch.d.ts +1 -2
- package/dist/source/useMatch.jsx.map +1 -1
- package/dist/source/useNavigate.d.ts +1 -2
- package/dist/source/useNavigate.jsx.map +1 -1
- package/dist/source/useParams.d.ts +2 -4
- package/dist/source/useParams.jsx.map +1 -1
- package/dist/source/useRouteContext.d.ts +1 -8
- package/dist/source/useRouteContext.js.map +1 -1
- package/dist/source/useSearch.d.ts +2 -4
- package/dist/source/useSearch.jsx.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +8 -105
- package/src/fileRoute.ts +16 -14
- package/src/index.tsx +16 -18
- package/src/redirects.ts +4 -36
- package/src/route.ts +11 -532
- package/src/router.ts +9 -10
- package/src/typePrimitives.ts +5 -3
- package/src/useLoaderData.tsx +5 -19
- package/src/useLoaderDeps.tsx +5 -11
- package/src/useMatch.tsx +5 -2
- package/src/useNavigate.tsx +5 -12
- package/src/useParams.tsx +3 -20
- package/src/useRouteContext.ts +5 -36
- package/src/useSearch.tsx +3 -21
package/dist/cjs/route.d.cts
CHANGED
|
@@ -1,114 +1,21 @@
|
|
|
1
|
-
import { AnyContext,
|
|
1
|
+
import { AnyContext, AnySchema, Constrain, ConstrainLiteral, RootRoute as CoreRootRoute, Route as CoreRoute, ErrorComponentProps, NotFoundRouteProps, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteById, RouteContext, RouteIds, RouteLoaderFn, RouteOptions, RoutePaths, RoutePrefix, RouteTypes, ToMaskOptions, TrimPathRight, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
|
|
2
2
|
import { UseLoaderDataRoute } from './useLoaderData.cjs';
|
|
3
3
|
import { UseMatchRoute } from './useMatch.cjs';
|
|
4
4
|
import { UseLoaderDepsRoute } from './useLoaderDeps.cjs';
|
|
5
5
|
import { UseParamsRoute } from './useParams.cjs';
|
|
6
6
|
import { UseSearchRoute } from './useSearch.cjs';
|
|
7
|
-
import { UseNavigateResult } from './useNavigate.cjs';
|
|
8
|
-
import { AnyRouteMatch, MakeRouteMatchFromRoute, MakeRouteMatchUnion, RouteMatch } from './Matches.cjs';
|
|
9
7
|
import { AnyRouter, RegisteredRouter, Router } from './router.cjs';
|
|
10
8
|
import { NotFoundError } from './not-found.cjs';
|
|
11
9
|
import { LazyRoute } from './fileRoute.cjs';
|
|
12
10
|
import { UseRouteContextRoute } from './useRouteContext.cjs';
|
|
13
11
|
import type * as Solid from 'solid-js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
beforeLoad?: Constrain<TBeforeLoadFn, (ctx: BeforeLoadContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn>) => any>;
|
|
22
|
-
loaderDeps?: (opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>) => TLoaderDeps;
|
|
23
|
-
remountDeps?: Constrain<TRemountDepsFn, (opt: RemountDepsOptions<TId, FullSearchSchemaOption<TParentRoute, TSearchValidator>, Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>, TLoaderDeps>) => any>;
|
|
24
|
-
loader?: Constrain<TLoaderFn, (ctx: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any>;
|
|
25
|
-
};
|
|
26
|
-
export type BaseRouteOptions<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> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn> & {
|
|
27
|
-
getParentRoute: () => TParentRoute;
|
|
28
|
-
};
|
|
29
|
-
export interface ContextOptions<in out TParentRoute extends AnyRoute, in out TParams> {
|
|
30
|
-
abortController: AbortController;
|
|
31
|
-
preload: boolean;
|
|
32
|
-
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
33
|
-
location: ParsedLocation;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
36
|
-
**/
|
|
37
|
-
navigate: NavigateFn;
|
|
38
|
-
buildLocation: BuildLocationFn;
|
|
39
|
-
cause: 'preload' | 'enter' | 'stay';
|
|
40
|
-
matches: Array<MakeRouteMatchUnion>;
|
|
41
|
-
}
|
|
42
|
-
export interface RouteContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouterContext, in out TLoaderDeps> extends ContextOptions<TParentRoute, TParams> {
|
|
43
|
-
deps: TLoaderDeps;
|
|
44
|
-
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>;
|
|
45
|
-
}
|
|
46
|
-
export interface BeforeLoadContextOptions<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn> extends ContextOptions<TParentRoute, TParams>, FullSearchSchemaOption<TParentRoute, TSearchValidator> {
|
|
47
|
-
context: Expand<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>>;
|
|
48
|
-
}
|
|
49
|
-
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> = {
|
|
50
|
-
matches: Array<RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>>;
|
|
51
|
-
match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>;
|
|
52
|
-
params: ResolveAllParamsFromParent<TParentRoute, TParams>;
|
|
53
|
-
loaderData: ResolveLoaderData<TLoaderFn>;
|
|
54
|
-
};
|
|
55
|
-
export 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 {
|
|
56
|
-
caseSensitive?: boolean;
|
|
57
|
-
wrapInSuspense?: boolean;
|
|
58
|
-
component?: RouteComponent;
|
|
59
|
-
errorComponent?: false | null | ErrorRouteComponent;
|
|
60
|
-
notFoundComponent?: NotFoundRouteComponent;
|
|
61
|
-
pendingComponent?: RouteComponent;
|
|
62
|
-
pendingMs?: number;
|
|
63
|
-
pendingMinMs?: number;
|
|
64
|
-
staleTime?: number;
|
|
65
|
-
gcTime?: number;
|
|
66
|
-
preload?: boolean;
|
|
67
|
-
preloadStaleTime?: number;
|
|
68
|
-
preloadGcTime?: number;
|
|
69
|
-
search?: {
|
|
70
|
-
middlewares?: Array<SearchMiddleware<ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>>>;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
@deprecated Use search.middlewares instead
|
|
74
|
-
*/
|
|
75
|
-
preSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
76
|
-
/**
|
|
77
|
-
@deprecated Use search.middlewares instead
|
|
78
|
-
*/
|
|
79
|
-
postSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
80
|
-
onCatch?: (error: Error) => void;
|
|
81
|
-
onError?: (err: any) => void;
|
|
82
|
-
onEnter?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
83
|
-
onStay?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
84
|
-
onLeave?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
85
|
-
headers?: (ctx: {
|
|
86
|
-
loaderData: ResolveLoaderData<TLoaderFn>;
|
|
87
|
-
}) => Record<string, string>;
|
|
88
|
-
head?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => {
|
|
89
|
-
links?: AnyRouteMatch['links'];
|
|
90
|
-
scripts?: AnyRouteMatch['headScripts'];
|
|
91
|
-
meta?: AnyRouteMatch['meta'];
|
|
92
|
-
};
|
|
93
|
-
scripts?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => AnyRouteMatch['scripts'];
|
|
94
|
-
ssr?: boolean;
|
|
95
|
-
codeSplitGroupings?: Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>;
|
|
96
|
-
}
|
|
97
|
-
export type RouteLoaderFn<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> = (match: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any;
|
|
98
|
-
export interface LoaderFnContext<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> {
|
|
99
|
-
abortController: AbortController;
|
|
100
|
-
preload: boolean;
|
|
101
|
-
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
102
|
-
deps: TLoaderDeps;
|
|
103
|
-
context: Expand<ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
|
|
104
|
-
location: ParsedLocation;
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
107
|
-
**/
|
|
108
|
-
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void;
|
|
109
|
-
parentMatchPromise: TId extends RootRouteId ? never : Promise<MakeRouteMatchFromRoute<TParentRoute>>;
|
|
110
|
-
cause: 'preload' | 'enter' | 'stay';
|
|
111
|
-
route: Route;
|
|
12
|
+
declare module '@tanstack/router-core' {
|
|
13
|
+
interface UpdatableRouteOptionsExtensions {
|
|
14
|
+
component?: RouteComponent;
|
|
15
|
+
errorComponent?: false | null | ErrorRouteComponent;
|
|
16
|
+
notFoundComponent?: NotFoundRouteComponent;
|
|
17
|
+
pendingComponent?: RouteComponent;
|
|
18
|
+
}
|
|
112
19
|
}
|
|
113
20
|
export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
114
21
|
}
|
|
@@ -199,13 +106,6 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
|
|
|
199
106
|
}
|
|
200
107
|
export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
|
|
201
108
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
|
202
|
-
export type RootRouteOptions<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined> = Omit<RouteOptions<any, // TParentRoute
|
|
203
|
-
RootRouteId, // TId
|
|
204
|
-
RootRouteId, // TCustomId
|
|
205
|
-
'', // TFullPath
|
|
206
|
-
'', // TPath
|
|
207
|
-
TSearchValidator, {}, // TParams
|
|
208
|
-
TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'params'>;
|
|
209
109
|
export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>) => RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
|
|
210
110
|
/**
|
|
211
111
|
* @deprecated Use the `createRootRouteWithContext` function instead.
|
|
@@ -254,4 +154,3 @@ export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
|
|
|
254
154
|
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TRouterContext = AnyContext, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchValidator, {}, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren> {
|
|
255
155
|
constructor(options: Omit<RouteOptions<TParentRoute, string, string, string, string, TSearchValidator, {}, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id' | 'params'>);
|
|
256
156
|
}
|
|
257
|
-
export {};
|