@tanstack/solid-router 1.114.23 → 1.114.24
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/route.cjs +42 -92
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +13 -47
- package/dist/esm/route.d.ts +13 -47
- package/dist/esm/route.js +43 -93
- package/dist/esm/route.js.map +1 -1
- package/dist/source/route.d.ts +14 -47
- package/dist/source/route.js +43 -109
- package/dist/source/route.js.map +1 -1
- package/package.json +2 -2
- package/src/route.ts +108 -357
package/dist/esm/route.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { notFound, rootRouteId, trimPathLeft, joinPaths } from "@tanstack/router-core";
|
|
1
|
+
import { BaseRouteApi, notFound, BaseRoute, BaseRootRoute } from "@tanstack/router-core";
|
|
3
2
|
import { useLoaderData } from "./useLoaderData.js";
|
|
4
3
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
5
4
|
import { useParams } from "./useParams.js";
|
|
@@ -10,11 +9,12 @@ import { useRouter } from "./useRouter.js";
|
|
|
10
9
|
function getRouteApi(id) {
|
|
11
10
|
return new RouteApi({ id });
|
|
12
11
|
}
|
|
13
|
-
class RouteApi {
|
|
12
|
+
class RouteApi extends BaseRouteApi {
|
|
14
13
|
/**
|
|
15
14
|
* @deprecated Use the `getRouteApi` function instead.
|
|
16
15
|
*/
|
|
17
16
|
constructor({ id }) {
|
|
17
|
+
super({ id });
|
|
18
18
|
this.useMatch = (opts) => {
|
|
19
19
|
return useMatch({
|
|
20
20
|
select: opts == null ? void 0 : opts.select,
|
|
@@ -52,77 +52,14 @@ class RouteApi {
|
|
|
52
52
|
this.notFound = (opts) => {
|
|
53
53
|
return notFound({ routeId: this.id, ...opts });
|
|
54
54
|
};
|
|
55
|
-
this.id = id;
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
|
-
class Route {
|
|
57
|
+
class Route extends BaseRoute {
|
|
59
58
|
/**
|
|
60
59
|
* @deprecated Use the `createRoute` function instead.
|
|
61
60
|
*/
|
|
62
61
|
constructor(options) {
|
|
63
|
-
|
|
64
|
-
var _a, _b;
|
|
65
|
-
this.originalIndex = opts.originalIndex;
|
|
66
|
-
const options2 = this.options;
|
|
67
|
-
const isRoot = !(options2 == null ? void 0 : options2.path) && !(options2 == null ? void 0 : options2.id);
|
|
68
|
-
this.parentRoute = (_b = (_a = this.options).getParentRoute) == null ? void 0 : _b.call(_a);
|
|
69
|
-
if (isRoot) {
|
|
70
|
-
this._path = rootRouteId;
|
|
71
|
-
} else {
|
|
72
|
-
invariant(
|
|
73
|
-
this.parentRoute,
|
|
74
|
-
`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
let path = isRoot ? rootRouteId : options2.path;
|
|
78
|
-
if (path && path !== "/") {
|
|
79
|
-
path = trimPathLeft(path);
|
|
80
|
-
}
|
|
81
|
-
const customId = (options2 == null ? void 0 : options2.id) || path;
|
|
82
|
-
let id = isRoot ? rootRouteId : joinPaths([
|
|
83
|
-
this.parentRoute.id === rootRouteId ? "" : this.parentRoute.id,
|
|
84
|
-
customId
|
|
85
|
-
]);
|
|
86
|
-
if (path === rootRouteId) {
|
|
87
|
-
path = "/";
|
|
88
|
-
}
|
|
89
|
-
if (id !== rootRouteId) {
|
|
90
|
-
id = joinPaths(["/", id]);
|
|
91
|
-
}
|
|
92
|
-
const fullPath = id === rootRouteId ? "/" : joinPaths([this.parentRoute.fullPath, path]);
|
|
93
|
-
this._path = path;
|
|
94
|
-
this._id = id;
|
|
95
|
-
this._fullPath = fullPath;
|
|
96
|
-
this._to = fullPath;
|
|
97
|
-
this._ssr = (options2 == null ? void 0 : options2.ssr) ?? opts.defaultSsr ?? true;
|
|
98
|
-
};
|
|
99
|
-
this.addChildren = (children) => {
|
|
100
|
-
return this._addFileChildren(children);
|
|
101
|
-
};
|
|
102
|
-
this._addFileChildren = (children) => {
|
|
103
|
-
if (Array.isArray(children)) {
|
|
104
|
-
this.children = children;
|
|
105
|
-
}
|
|
106
|
-
if (typeof children === "object" && children !== null) {
|
|
107
|
-
this.children = Object.values(children);
|
|
108
|
-
}
|
|
109
|
-
return this;
|
|
110
|
-
};
|
|
111
|
-
this._addFileTypes = () => {
|
|
112
|
-
return this;
|
|
113
|
-
};
|
|
114
|
-
this.updateLoader = (options2) => {
|
|
115
|
-
Object.assign(this.options, options2);
|
|
116
|
-
return this;
|
|
117
|
-
};
|
|
118
|
-
this.update = (options2) => {
|
|
119
|
-
Object.assign(this.options, options2);
|
|
120
|
-
return this;
|
|
121
|
-
};
|
|
122
|
-
this.lazy = (lazyFn) => {
|
|
123
|
-
this.lazyFn = lazyFn;
|
|
124
|
-
return this;
|
|
125
|
-
};
|
|
62
|
+
super(options);
|
|
126
63
|
this.useMatch = (opts) => {
|
|
127
64
|
return useMatch({
|
|
128
65
|
select: opts == null ? void 0 : opts.select,
|
|
@@ -157,27 +94,6 @@ class Route {
|
|
|
157
94
|
this.useNavigate = () => {
|
|
158
95
|
return useNavigate({ from: this.fullPath });
|
|
159
96
|
};
|
|
160
|
-
this.options = options || {};
|
|
161
|
-
this.isRoot = !(options == null ? void 0 : options.getParentRoute);
|
|
162
|
-
invariant(
|
|
163
|
-
!((options == null ? void 0 : options.id) && (options == null ? void 0 : options.path)),
|
|
164
|
-
`Route cannot have both an 'id' and a 'path' option.`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
get to() {
|
|
168
|
-
return this._to;
|
|
169
|
-
}
|
|
170
|
-
get id() {
|
|
171
|
-
return this._id;
|
|
172
|
-
}
|
|
173
|
-
get path() {
|
|
174
|
-
return this._path;
|
|
175
|
-
}
|
|
176
|
-
get fullPath() {
|
|
177
|
-
return this._fullPath;
|
|
178
|
-
}
|
|
179
|
-
get ssr() {
|
|
180
|
-
return this._ssr;
|
|
181
97
|
}
|
|
182
98
|
}
|
|
183
99
|
function createRoute(options) {
|
|
@@ -189,17 +105,48 @@ function createRootRouteWithContext() {
|
|
|
189
105
|
};
|
|
190
106
|
}
|
|
191
107
|
const rootRouteWithContext = createRootRouteWithContext;
|
|
192
|
-
class RootRoute extends
|
|
108
|
+
class RootRoute extends BaseRootRoute {
|
|
193
109
|
/**
|
|
194
110
|
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
195
111
|
*/
|
|
196
112
|
constructor(options) {
|
|
197
113
|
super(options);
|
|
114
|
+
this.useMatch = (opts) => {
|
|
115
|
+
return useMatch({
|
|
116
|
+
select: opts == null ? void 0 : opts.select,
|
|
117
|
+
from: this.id
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
this.useRouteContext = (opts) => {
|
|
121
|
+
return useMatch({
|
|
122
|
+
...opts,
|
|
123
|
+
from: this.id,
|
|
124
|
+
select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
this.useSearch = (opts) => {
|
|
128
|
+
return useSearch({
|
|
129
|
+
select: opts == null ? void 0 : opts.select,
|
|
130
|
+
from: this.id
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.useParams = (opts) => {
|
|
134
|
+
return useParams({
|
|
135
|
+
select: opts == null ? void 0 : opts.select,
|
|
136
|
+
from: this.id
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
this.useLoaderDeps = (opts) => {
|
|
140
|
+
return useLoaderDeps({ ...opts, from: this.id });
|
|
141
|
+
};
|
|
142
|
+
this.useLoaderData = (opts) => {
|
|
143
|
+
return useLoaderData({ ...opts, from: this.id });
|
|
144
|
+
};
|
|
145
|
+
this.useNavigate = () => {
|
|
146
|
+
return useNavigate({ from: this.fullPath });
|
|
147
|
+
};
|
|
198
148
|
}
|
|
199
149
|
}
|
|
200
|
-
function createRootRoute(options) {
|
|
201
|
-
return new RootRoute(options);
|
|
202
|
-
}
|
|
203
150
|
function createRouteMask(opts) {
|
|
204
151
|
return opts;
|
|
205
152
|
}
|
|
@@ -211,6 +158,9 @@ class NotFoundRoute extends Route {
|
|
|
211
158
|
});
|
|
212
159
|
}
|
|
213
160
|
}
|
|
161
|
+
function createRootRoute(options) {
|
|
162
|
+
return new RootRoute(options);
|
|
163
|
+
}
|
|
214
164
|
export {
|
|
215
165
|
NotFoundRoute,
|
|
216
166
|
RootRoute,
|
package/dist/esm/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import invariant from 'tiny-invariant'\nimport {\n joinPaths,\n notFound,\n rootRouteId,\n trimPathLeft,\n} from '@tanstack/router-core'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport { useRouter } from './useRouter'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n LazyRoute as CoreLazyRoute,\n Route as CoreRoute,\n ErrorComponentProps,\n NotFoundError,\n NotFoundRouteProps,\n RegisteredRouter,\n ResolveFullPath,\n ResolveId,\n ResolveParams,\n RootRouteId,\n RootRouteOptions,\n RouteAddChildrenFn,\n RouteAddFileChildrenFn,\n RouteAddFileTypesFn,\n RouteConstraints,\n RouteIds,\n RouteLazyFn,\n RouteLoaderFn,\n RouteMask,\n RouteOptions,\n RoutePathOptionsIntersection,\n RouteTypes,\n RouteTypesById,\n Router,\n ToMaskOptions,\n TrimPathRight,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type * as Solid from 'solid-js'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\ndeclare module '@tanstack/router-core' {\n export interface UpdatableRouteOptionsExtensions {\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n }\n\n export interface RouteExtensions<\n TId extends string,\n TFullPath extends string,\n > {\n useMatch: UseMatchRoute<TId>\n useRouteContext: UseRouteContextRoute<TId>\n useSearch: UseSearchRoute<TId>\n useParams: UseParamsRoute<TId>\n useLoaderDeps: UseLoaderDepsRoute<TId>\n useLoaderData: UseLoaderDataRoute<TId>\n useNavigate: () => UseNavigateResult<TFullPath>\n }\n}\n\nexport function getRouteApi<\n const TId,\n TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {\n id: TId\n\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n this.id = id as any\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n return useMatch({\n from: this.id as any,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<\n RouteTypesById<TRouter, TId>['fullPath']\n > => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.id as string].fullPath })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchValidator = undefined,\n in out TParams = ResolveParams<TPath>,\n in out TRouterContext = AnyContext,\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> implements\n CoreRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n{\n isRoot: TParentRoute extends AnyRoute ? true : false\n options: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\n\n // The following properties are set up in this.init()\n parentRoute!: TParentRoute\n private _id!: TId\n private _path!: TPath\n private _fullPath!: TFullPath\n private _to!: TrimPathRight<TFullPath>\n private _ssr!: boolean\n\n public get to() {\n /* invariant(\n this._to,\n `trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._to\n }\n\n public get id() {\n /* invariant(\n this._id,\n `trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._id\n }\n\n public get path() {\n /* invariant(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n this.isRoot || this._id || this._path,\n `trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._path\n }\n\n public get fullPath() {\n /* invariant(\n this._fullPath,\n `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,\n )*/\n return this._fullPath\n }\n\n public get ssr() {\n return this._ssr\n }\n\n // Optional\n children?: TChildren\n originalIndex?: number\n rank!: number\n lazyFn?: () => Promise<CoreLazyRoute>\n _lazyPromise?: Promise<void>\n _componentsPromise?: Promise<Array<void>>\n\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ) {\n this.options = (options as any) || {}\n\n this.isRoot = !options?.getParentRoute as any\n invariant(\n !((options as any)?.id && (options as any)?.path),\n `Route cannot have both an 'id' and a 'path' option.`,\n )\n }\n\n types!: RouteTypes<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n\n init = (opts: { originalIndex: number; defaultSsr?: boolean }): void => {\n this.originalIndex = opts.originalIndex\n\n const options = this.options as\n | (RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n RoutePathOptionsIntersection<TCustomId, TPath>)\n | undefined\n\n const isRoot = !options?.path && !options?.id\n\n this.parentRoute = this.options.getParentRoute?.()\n\n if (isRoot) {\n this._path = rootRouteId as TPath\n } else {\n invariant(\n this.parentRoute,\n `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n )\n }\n\n let path: undefined | string = isRoot ? rootRouteId : options.path\n\n // If the path is anything other than an index path, trim it up\n if (path && path !== '/') {\n path = trimPathLeft(path)\n }\n\n const customId = options?.id || path\n\n // Strip the parentId prefix from the first level of children\n let id = isRoot\n ? rootRouteId\n : joinPaths([\n this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n customId,\n ])\n\n if (path === rootRouteId) {\n path = '/'\n }\n\n if (id !== rootRouteId) {\n id = joinPaths(['/', id])\n }\n\n const fullPath =\n id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n this._path = path as TPath\n this._id = id as TId\n // this.customId = customId as TCustomId\n this._fullPath = fullPath as TFullPath\n this._to = fullPath as TrimPathRight<TFullPath>\n this._ssr = options?.ssr ?? opts.defaultSsr ?? true\n }\n\n addChildren: RouteAddChildrenFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TFileRouteTypes\n > = (children) => {\n return this._addFileChildren(children) as any\n }\n\n _addFileChildren: RouteAddFileChildrenFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TFileRouteTypes\n > = (children) => {\n if (Array.isArray(children)) {\n this.children = children as TChildren\n }\n\n if (typeof children === 'object' && children !== null) {\n this.children = Object.values(children) as TChildren\n }\n\n return this as any\n }\n\n _addFileTypes: RouteAddFileTypesFn<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > = () => {\n return this as any\n }\n\n updateLoader = <TNewLoaderFn>(options: {\n loader: Constrain<\n TNewLoaderFn,\n RouteLoaderFn<\n TParentRoute,\n TCustomId,\n TParams,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >\n >\n }) => {\n Object.assign(this.options, options)\n return this as unknown as Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TNewLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n }\n\n update = (\n options: UpdatableRouteOptions<\n TParentRoute,\n TCustomId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): this => {\n Object.assign(this.options, options)\n return this\n }\n\n lazy: RouteLazyFn<this> = (lazyFn) => {\n this.lazyFn = lazyFn\n return this\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.fullPath })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n): CoreRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n> {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n >(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) => {\n return createRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchValidator = undefined,\n in out TRouterContext = {},\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> extends Route<\n any, // TParentRoute\n '/', // TPath\n '/', // TFullPath\n string, // TCustomId\n RootRouteId, // TId\n TSearchValidator, // TSearchValidator\n {}, // TParams\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren, // TChildren\n TFileRouteTypes\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) {\n super(options as any)\n }\n}\n\nexport function createRootRoute<\n TSearchValidator = undefined,\n TRouterContext = {},\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n>(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n) {\n return new RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options)\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends string,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never', false>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type SolidNode = Solid.JSX.Element\n\nexport type SyncRouteComponent<TProps> = (props: TProps) => Solid.JSX.Element\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TRouterContext = AnyContext,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchValidator,\n {},\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n string,\n string,\n TSearchValidator,\n {},\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n"],"names":["options"],"mappings":";;;;;;;;;AA+EO,SAAS,YAGd,IAA2D;AAC3D,SAAO,IAAI,SAAuB,EAAE,IAAI;AAC1C;AAEO,MAAM,SAA4D;AAAA;AAAA;AAAA;AAAA,EAMvE,YAAY,EAAE,MAAmB;AAIjC,SAAA,WAA+B,CAAC,SAAS;AACvC,aAAO,SAAS;AAAA,QACd,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,kBAA6C,CAAC,SAAS;AACrD,aAAO,SAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAO,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAC3D;AAAA,IACH;AAEA,SAAA,YAAiC,CAAC,S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AAO,gBAOL,OAAc;AAAA,EAClB;AACF;AAKO,MAAM,uBAAuB;AAE7B,MAAM,kBASH,MAeR;AAAA;AAAA;AAAA;AAAA,EAIA,YACE,SAQA;AACA,UAAM,OAAc;AAAA,EAAA;AAExB;AAEO,SAAS,gBAQd,SAQA;AACO,SAAA,IAAI,UAOT,OAAO;AACX;AAEO,SAAS,gBAKd,MAGuB;AAChB,SAAA;AACT;AAgBO,MAAM,sBASH,MAcR;AAAA,EACA,YACE,SAsBA;AACM,UAAA;AAAA,MACJ,GAAI;AAAA,MACJ,IAAI;AAAA,IAAA,CACL;AAAA,EAAA;AAEL;"}
|
|
1
|
+
{"version":3,"file":"route.js","sources":["../../src/route.ts"],"sourcesContent":["import {\n BaseRootRoute,\n BaseRoute,\n BaseRouteApi,\n notFound,\n} from '@tanstack/router-core'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport { useRouter } from './useRouter'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n ConstrainLiteral,\n ErrorComponentProps,\n NotFoundError,\n NotFoundRouteProps,\n RegisteredRouter,\n ResolveFullPath,\n ResolveId,\n ResolveParams,\n RootRouteId,\n RootRouteOptions,\n RouteConstraints,\n RouteIds,\n RouteMask,\n RouteOptions,\n RouteTypesById,\n Router,\n ToMaskOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type * as Solid from 'solid-js'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\ndeclare module '@tanstack/router-core' {\n export interface UpdatableRouteOptionsExtensions {\n component?: RouteComponent\n errorComponent?: false | null | ErrorRouteComponent\n notFoundComponent?: NotFoundRouteComponent\n pendingComponent?: RouteComponent\n }\n\n export interface RouteExtensions<\n TId extends string,\n TFullPath extends string,\n > {\n useMatch: UseMatchRoute<TId>\n useRouteContext: UseRouteContextRoute<TId>\n useSearch: UseSearchRoute<TId>\n useParams: UseParamsRoute<TId>\n useLoaderDeps: UseLoaderDepsRoute<TId>\n useLoaderData: UseLoaderDataRoute<TId>\n useNavigate: () => UseNavigateResult<TFullPath>\n }\n}\n\nexport function getRouteApi<\n const TId,\n TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<\n TId,\n TRouter extends AnyRouter = RegisteredRouter,\n> extends BaseRouteApi<TId, TRouter> {\n /**\n * @deprecated Use the `getRouteApi` function instead.\n */\n constructor({ id }: { id: TId }) {\n super({ id })\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n return useMatch({\n from: this.id as any,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n }\n\n useNavigate = (): UseNavigateResult<\n RouteTypesById<TRouter, TId>['fullPath']\n > => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.id as string].fullPath })\n }\n\n notFound = (opts?: NotFoundError) => {\n return notFound({ routeId: this.id as string, ...opts })\n }\n}\n\nexport class Route<\n in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n in out TPath extends RouteConstraints['TPath'] = '/',\n in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n in out TCustomId extends RouteConstraints['TCustomId'] = string,\n in out TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n in out TSearchValidator = undefined,\n in out TParams = ResolveParams<TPath>,\n in out TRouterContext = AnyContext,\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> extends BaseRoute<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n> {\n /**\n * @deprecated Use the `createRoute` function instead.\n */\n constructor(\n options?: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ) {\n super(options)\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TFullPath> => {\n return useNavigate({ from: this.fullPath })\n }\n}\n\nexport function createRoute<\n TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n TPath extends RouteConstraints['TPath'] = '/',\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n TPath\n >,\n TCustomId extends RouteConstraints['TCustomId'] = string,\n TId extends RouteConstraints['TId'] = ResolveId<\n TParentRoute,\n TCustomId,\n TPath\n >,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n>(\n options: RouteOptions<\n TParentRoute,\n TId,\n TCustomId,\n TFullPath,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n> {\n return new Route<\n TParentRoute,\n TPath,\n TFullPath,\n TCustomId,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n >(options)\n}\n\nexport type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n return <\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n >(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) => {\n return createRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options as any)\n }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n in out TSearchValidator = undefined,\n in out TRouterContext = {},\n in out TRouteContextFn = AnyContext,\n in out TBeforeLoadFn = AnyContext,\n in out TLoaderDeps extends Record<string, any> = {},\n in out TLoaderFn = undefined,\n in out TChildren = unknown,\n in out TFileRouteTypes = unknown,\n> extends BaseRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n> {\n /**\n * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n */\n constructor(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n ) {\n super(options)\n }\n\n useMatch: UseMatchRoute<RootRouteId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<RootRouteId> = (opts) => {\n return useMatch({\n ...opts,\n from: this.id,\n select: (d) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<RootRouteId> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<RootRouteId> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<RootRouteId> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<RootRouteId> = (opts) => {\n return useLoaderData({ ...opts, from: this.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<'/'> => {\n return useNavigate({ from: this.fullPath })\n }\n}\n\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends string,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<Router<TRouteTree, 'never', false>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type SolidNode = Solid.JSX.Element\n\nexport type SyncRouteComponent<TProps> = (props: TProps) => Solid.JSX.Element\n\nexport type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>\n\nexport type ErrorRouteComponent = RouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>\n\nexport class NotFoundRoute<\n TParentRoute extends AnyRootRoute,\n TRouterContext = AnyContext,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TSearchValidator = undefined,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n> extends Route<\n TParentRoute,\n '/404',\n '/404',\n '404',\n '404',\n TSearchValidator,\n {},\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n> {\n constructor(\n options: Omit<\n RouteOptions<\n TParentRoute,\n string,\n string,\n string,\n string,\n TSearchValidator,\n {},\n TLoaderDeps,\n TLoaderFn,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n | 'caseSensitive'\n | 'parseParams'\n | 'stringifyParams'\n | 'path'\n | 'id'\n | 'params'\n >,\n ) {\n super({\n ...(options as any),\n id: '404',\n })\n }\n}\n\nexport function createRootRoute<\n TSearchValidator = undefined,\n TRouterContext = {},\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n>(\n options?: RootRouteOptions<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >,\n): RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n unknown,\n unknown\n> {\n return new RootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn\n >(options)\n}\n"],"names":[],"mappings":";;;;;;;;AAkEO,SAAS,YAGd,IAA2D;AAC3D,SAAO,IAAI,SAAuB,EAAE,IAAI;AAC1C;AAEO,MAAM,iBAGH,aAA2B;AAAA;AAAA;AAAA;AAAA,EAInC,YAAY,EAAE,MAAmB;AACzB,UAAA,EAAE,IAAI;AAGd,SAAA,WAA+B,CAAC,SAAS;AACvC,aAAO,SAAS;AAAA,QACd,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,kBAA6C,CAAC,SAAS;AACrD,aAAO,SAAS;AAAA,QACd,MAAM,KAAK;AAAA,QACX,QAAQ,CAAC,OAAO,6BAAM,UAAS,KAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAC3D;AAAA,IACH;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,YAAiC,CAAC,SAAS;AACzC,aAAO,UAAU;AAAA,QACf,QAAQ,6BAAM;AAAA,QACd,MAAM,KAAK;AAAA,MAAA,CACL;AAAA,IACV;AAEA,SAAA,gBAAyC,CAAC,SAAS;AAC1C,aAAA,cAAc,EAAE,GAAG,MAAM,MAAM,KAAK,IAAI,QAAQ,OAAc;AAAA,IACvE;AAEA,SAAA,gBAAyC,CAAC,SAAS;AAC1C,aAAA,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,SAsBA;AACM,UAAA;AAAA,MACJ,GAAI;AAAA,MACJ,IAAI;AAAA,IAAA,CACL;AAAA,EAAA;AAEL;AAEO,SAAS,gBAQd,SAiBA;AACO,SAAA,IAAI,UAOT,OAAO;AACX;"}
|
package/dist/source/route.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseRootRoute, BaseRoute, BaseRouteApi } from '@tanstack/router-core';
|
|
2
|
+
import type { AnyContext, AnyRoute, AnyRouter, ConstrainLiteral, ErrorComponentProps, NotFoundError, NotFoundRouteProps, RegisteredRouter, ResolveFullPath, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteConstraints, RouteIds, RouteMask, RouteOptions, RouteTypesById, Router, ToMaskOptions, UseNavigateResult } from '@tanstack/router-core';
|
|
2
3
|
import type { UseLoaderDataRoute } from './useLoaderData';
|
|
3
4
|
import type { UseMatchRoute } from './useMatch';
|
|
4
5
|
import type { UseLoaderDepsRoute } from './useLoaderDeps';
|
|
@@ -24,8 +25,7 @@ declare module '@tanstack/router-core' {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
export declare function getRouteApi<const TId, TRouter extends AnyRouter = RegisteredRouter>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): RouteApi<TId, TRouter>;
|
|
27
|
-
export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
|
|
28
|
-
id: TId;
|
|
28
|
+
export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> extends BaseRouteApi<TId, TRouter> {
|
|
29
29
|
/**
|
|
30
30
|
* @deprecated Use the `getRouteApi` function instead.
|
|
31
31
|
*/
|
|
@@ -41,43 +41,11 @@ export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter>
|
|
|
41
41
|
useNavigate: () => UseNavigateResult<RouteTypesById<TRouter, TId>["fullPath"]>;
|
|
42
42
|
notFound: (opts?: NotFoundError) => NotFoundError;
|
|
43
43
|
}
|
|
44
|
-
export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown>
|
|
45
|
-
isRoot: TParentRoute extends AnyRoute ? true : false;
|
|
46
|
-
options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
|
|
47
|
-
parentRoute: TParentRoute;
|
|
48
|
-
private _id;
|
|
49
|
-
private _path;
|
|
50
|
-
private _fullPath;
|
|
51
|
-
private _to;
|
|
52
|
-
private _ssr;
|
|
53
|
-
get to(): TrimPathRight<TFullPath>;
|
|
54
|
-
get id(): TId;
|
|
55
|
-
get path(): TPath;
|
|
56
|
-
get fullPath(): TFullPath;
|
|
57
|
-
get ssr(): boolean;
|
|
58
|
-
children?: TChildren;
|
|
59
|
-
originalIndex?: number;
|
|
60
|
-
rank: number;
|
|
61
|
-
lazyFn?: () => Promise<CoreLazyRoute>;
|
|
62
|
-
_lazyPromise?: Promise<void>;
|
|
63
|
-
_componentsPromise?: Promise<Array<void>>;
|
|
44
|
+
export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends BaseRoute<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
|
|
64
45
|
/**
|
|
65
46
|
* @deprecated Use the `createRoute` function instead.
|
|
66
47
|
*/
|
|
67
48
|
constructor(options?: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>);
|
|
68
|
-
types: RouteTypes<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>;
|
|
69
|
-
init: (opts: {
|
|
70
|
-
originalIndex: number;
|
|
71
|
-
defaultSsr?: boolean;
|
|
72
|
-
}) => void;
|
|
73
|
-
addChildren: RouteAddChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
|
|
74
|
-
_addFileChildren: RouteAddFileChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
|
|
75
|
-
_addFileTypes: RouteAddFileTypesFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
|
|
76
|
-
updateLoader: <TNewLoaderFn>(options: {
|
|
77
|
-
loader: Constrain<TNewLoaderFn, RouteLoaderFn<TParentRoute, TCustomId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
|
|
78
|
-
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TNewLoaderFn, TChildren, TFileRouteTypes>;
|
|
79
|
-
update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
|
|
80
|
-
lazy: RouteLazyFn<this>;
|
|
81
49
|
useMatch: UseMatchRoute<TId>;
|
|
82
50
|
useRouteContext: UseRouteContextRoute<TId>;
|
|
83
51
|
useSearch: UseSearchRoute<TId>;
|
|
@@ -86,28 +54,26 @@ export declare class Route<in out TParentRoute extends RouteConstraints['TParent
|
|
|
86
54
|
useLoaderData: UseLoaderDataRoute<TId>;
|
|
87
55
|
useNavigate: () => UseNavigateResult<TFullPath>;
|
|
88
56
|
}
|
|
89
|
-
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>):
|
|
57
|
+
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>;
|
|
90
58
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
|
91
59
|
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>;
|
|
92
60
|
/**
|
|
93
61
|
* @deprecated Use the `createRootRouteWithContext` function instead.
|
|
94
62
|
*/
|
|
95
63
|
export declare const rootRouteWithContext: typeof createRootRouteWithContext;
|
|
96
|
-
export declare class RootRoute<in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends
|
|
97
|
-
'/', // TPath
|
|
98
|
-
'/', // TFullPath
|
|
99
|
-
string, // TCustomId
|
|
100
|
-
RootRouteId, // TId
|
|
101
|
-
TSearchValidator, // TSearchValidator
|
|
102
|
-
{}, // TParams
|
|
103
|
-
TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
|
|
104
|
-
TFileRouteTypes> {
|
|
64
|
+
export declare class RootRoute<in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends BaseRootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
|
|
105
65
|
/**
|
|
106
66
|
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
107
67
|
*/
|
|
108
68
|
constructor(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>);
|
|
69
|
+
useMatch: UseMatchRoute<RootRouteId>;
|
|
70
|
+
useRouteContext: UseRouteContextRoute<RootRouteId>;
|
|
71
|
+
useSearch: UseSearchRoute<RootRouteId>;
|
|
72
|
+
useParams: UseParamsRoute<RootRouteId>;
|
|
73
|
+
useLoaderDeps: UseLoaderDepsRoute<RootRouteId>;
|
|
74
|
+
useLoaderData: UseLoaderDataRoute<RootRouteId>;
|
|
75
|
+
useNavigate: () => UseNavigateResult<"/">;
|
|
109
76
|
}
|
|
110
|
-
export declare function createRootRoute<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
|
|
111
77
|
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string>(opts: {
|
|
112
78
|
routeTree: TRouteTree;
|
|
113
79
|
} & ToMaskOptions<Router<TRouteTree, 'never', false>, TFrom, TTo>): RouteMask<TRouteTree>;
|
|
@@ -122,3 +88,4 @@ export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
|
|
|
122
88
|
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> {
|
|
123
89
|
constructor(options: Omit<RouteOptions<TParentRoute, string, string, string, string, TSearchValidator, {}, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id' | 'params'>);
|
|
124
90
|
}
|
|
91
|
+
export declare function createRootRoute<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
|
package/dist/source/route.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { joinPaths, notFound, rootRouteId, trimPathLeft, } from '@tanstack/router-core';
|
|
1
|
+
import { BaseRootRoute, BaseRoute, BaseRouteApi, notFound, } from '@tanstack/router-core';
|
|
3
2
|
import { useLoaderData } from './useLoaderData';
|
|
4
3
|
import { useLoaderDeps } from './useLoaderDeps';
|
|
5
4
|
import { useParams } from './useParams';
|
|
@@ -10,11 +9,12 @@ import { useRouter } from './useRouter';
|
|
|
10
9
|
export function getRouteApi(id) {
|
|
11
10
|
return new RouteApi({ id });
|
|
12
11
|
}
|
|
13
|
-
export class RouteApi {
|
|
12
|
+
export class RouteApi extends BaseRouteApi {
|
|
14
13
|
/**
|
|
15
14
|
* @deprecated Use the `getRouteApi` function instead.
|
|
16
15
|
*/
|
|
17
16
|
constructor({ id }) {
|
|
17
|
+
super({ id });
|
|
18
18
|
this.useMatch = (opts) => {
|
|
19
19
|
return useMatch({
|
|
20
20
|
select: opts?.select,
|
|
@@ -52,111 +52,14 @@ export class RouteApi {
|
|
|
52
52
|
this.notFound = (opts) => {
|
|
53
53
|
return notFound({ routeId: this.id, ...opts });
|
|
54
54
|
};
|
|
55
|
-
this.id = id;
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
|
-
export class Route {
|
|
59
|
-
get to() {
|
|
60
|
-
/* invariant(
|
|
61
|
-
this._to,
|
|
62
|
-
`trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
63
|
-
)*/
|
|
64
|
-
return this._to;
|
|
65
|
-
}
|
|
66
|
-
get id() {
|
|
67
|
-
/* invariant(
|
|
68
|
-
this._id,
|
|
69
|
-
`trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
70
|
-
)*/
|
|
71
|
-
return this._id;
|
|
72
|
-
}
|
|
73
|
-
get path() {
|
|
74
|
-
/* invariant(
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
76
|
-
this.isRoot || this._id || this._path,
|
|
77
|
-
`trying to access property 'path' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
78
|
-
)*/
|
|
79
|
-
return this._path;
|
|
80
|
-
}
|
|
81
|
-
get fullPath() {
|
|
82
|
-
/* invariant(
|
|
83
|
-
this._fullPath,
|
|
84
|
-
`trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`,
|
|
85
|
-
)*/
|
|
86
|
-
return this._fullPath;
|
|
87
|
-
}
|
|
88
|
-
get ssr() {
|
|
89
|
-
return this._ssr;
|
|
90
|
-
}
|
|
57
|
+
export class Route extends BaseRoute {
|
|
91
58
|
/**
|
|
92
59
|
* @deprecated Use the `createRoute` function instead.
|
|
93
60
|
*/
|
|
94
61
|
constructor(options) {
|
|
95
|
-
|
|
96
|
-
this.originalIndex = opts.originalIndex;
|
|
97
|
-
const options = this.options;
|
|
98
|
-
const isRoot = !options?.path && !options?.id;
|
|
99
|
-
this.parentRoute = this.options.getParentRoute?.();
|
|
100
|
-
if (isRoot) {
|
|
101
|
-
this._path = rootRouteId;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
invariant(this.parentRoute, `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);
|
|
105
|
-
}
|
|
106
|
-
let path = isRoot ? rootRouteId : options.path;
|
|
107
|
-
// If the path is anything other than an index path, trim it up
|
|
108
|
-
if (path && path !== '/') {
|
|
109
|
-
path = trimPathLeft(path);
|
|
110
|
-
}
|
|
111
|
-
const customId = options?.id || path;
|
|
112
|
-
// Strip the parentId prefix from the first level of children
|
|
113
|
-
let id = isRoot
|
|
114
|
-
? rootRouteId
|
|
115
|
-
: joinPaths([
|
|
116
|
-
this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,
|
|
117
|
-
customId,
|
|
118
|
-
]);
|
|
119
|
-
if (path === rootRouteId) {
|
|
120
|
-
path = '/';
|
|
121
|
-
}
|
|
122
|
-
if (id !== rootRouteId) {
|
|
123
|
-
id = joinPaths(['/', id]);
|
|
124
|
-
}
|
|
125
|
-
const fullPath = id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path]);
|
|
126
|
-
this._path = path;
|
|
127
|
-
this._id = id;
|
|
128
|
-
// this.customId = customId as TCustomId
|
|
129
|
-
this._fullPath = fullPath;
|
|
130
|
-
this._to = fullPath;
|
|
131
|
-
this._ssr = options?.ssr ?? opts.defaultSsr ?? true;
|
|
132
|
-
};
|
|
133
|
-
this.addChildren = (children) => {
|
|
134
|
-
return this._addFileChildren(children);
|
|
135
|
-
};
|
|
136
|
-
this._addFileChildren = (children) => {
|
|
137
|
-
if (Array.isArray(children)) {
|
|
138
|
-
this.children = children;
|
|
139
|
-
}
|
|
140
|
-
if (typeof children === 'object' && children !== null) {
|
|
141
|
-
this.children = Object.values(children);
|
|
142
|
-
}
|
|
143
|
-
return this;
|
|
144
|
-
};
|
|
145
|
-
this._addFileTypes = () => {
|
|
146
|
-
return this;
|
|
147
|
-
};
|
|
148
|
-
this.updateLoader = (options) => {
|
|
149
|
-
Object.assign(this.options, options);
|
|
150
|
-
return this;
|
|
151
|
-
};
|
|
152
|
-
this.update = (options) => {
|
|
153
|
-
Object.assign(this.options, options);
|
|
154
|
-
return this;
|
|
155
|
-
};
|
|
156
|
-
this.lazy = (lazyFn) => {
|
|
157
|
-
this.lazyFn = lazyFn;
|
|
158
|
-
return this;
|
|
159
|
-
};
|
|
62
|
+
super(options);
|
|
160
63
|
this.useMatch = (opts) => {
|
|
161
64
|
return useMatch({
|
|
162
65
|
select: opts?.select,
|
|
@@ -191,9 +94,6 @@ export class Route {
|
|
|
191
94
|
this.useNavigate = () => {
|
|
192
95
|
return useNavigate({ from: this.fullPath });
|
|
193
96
|
};
|
|
194
|
-
this.options = options || {};
|
|
195
|
-
this.isRoot = !options?.getParentRoute;
|
|
196
|
-
invariant(!(options?.id && options?.path), `Route cannot have both an 'id' and a 'path' option.`);
|
|
197
97
|
}
|
|
198
98
|
}
|
|
199
99
|
export function createRoute(options) {
|
|
@@ -208,17 +108,48 @@ export function createRootRouteWithContext() {
|
|
|
208
108
|
* @deprecated Use the `createRootRouteWithContext` function instead.
|
|
209
109
|
*/
|
|
210
110
|
export const rootRouteWithContext = createRootRouteWithContext;
|
|
211
|
-
export class RootRoute extends
|
|
111
|
+
export class RootRoute extends BaseRootRoute {
|
|
212
112
|
/**
|
|
213
113
|
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
214
114
|
*/
|
|
215
115
|
constructor(options) {
|
|
216
116
|
super(options);
|
|
117
|
+
this.useMatch = (opts) => {
|
|
118
|
+
return useMatch({
|
|
119
|
+
select: opts?.select,
|
|
120
|
+
from: this.id,
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this.useRouteContext = (opts) => {
|
|
124
|
+
return useMatch({
|
|
125
|
+
...opts,
|
|
126
|
+
from: this.id,
|
|
127
|
+
select: (d) => (opts?.select ? opts.select(d.context) : d.context),
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
this.useSearch = (opts) => {
|
|
131
|
+
return useSearch({
|
|
132
|
+
select: opts?.select,
|
|
133
|
+
from: this.id,
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
this.useParams = (opts) => {
|
|
137
|
+
return useParams({
|
|
138
|
+
select: opts?.select,
|
|
139
|
+
from: this.id,
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
this.useLoaderDeps = (opts) => {
|
|
143
|
+
return useLoaderDeps({ ...opts, from: this.id });
|
|
144
|
+
};
|
|
145
|
+
this.useLoaderData = (opts) => {
|
|
146
|
+
return useLoaderData({ ...opts, from: this.id });
|
|
147
|
+
};
|
|
148
|
+
this.useNavigate = () => {
|
|
149
|
+
return useNavigate({ from: this.fullPath });
|
|
150
|
+
};
|
|
217
151
|
}
|
|
218
152
|
}
|
|
219
|
-
export function createRootRoute(options) {
|
|
220
|
-
return new RootRoute(options);
|
|
221
|
-
}
|
|
222
153
|
export function createRouteMask(opts) {
|
|
223
154
|
return opts;
|
|
224
155
|
}
|
|
@@ -230,4 +161,7 @@ export class NotFoundRoute extends Route {
|
|
|
230
161
|
});
|
|
231
162
|
}
|
|
232
163
|
}
|
|
164
|
+
export function createRootRoute(options) {
|
|
165
|
+
return new RootRoute(options);
|
|
166
|
+
}
|
|
233
167
|
//# sourceMappingURL=route.js.map
|
package/dist/source/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,GACT,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAsDvC,MAAM,UAAU,WAAW,CAGzB,EAAyD;IACzD,OAAO,IAAI,QAAQ,CAAe,EAAE,EAAE,EAAE,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,OAAO,QAGX,SAAQ,YAA0B;IAClC;;OAEG;IACH,YAAY,EAAE,EAAE,EAAe;QAC7B,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QAGf,aAAQ,GAAuB,CAAC,IAAI,EAAE,EAAE;YACtC,OAAO,QAAQ,CAAC;gBACd,MAAM,EAAE,IAAI,EAAE,MAAM;gBACpB,IAAI,EAAE,IAAI,CAAC,EAAE;aACP,CAAQ,CAAA;QAClB,CAAC,CAAA;QAED,oBAAe,GAA8B,CAAC,IAAI,EAAE,EAAE;YACpD,OAAO,QAAQ,CAAC;gBACd,IAAI,EAAE,IAAI,CAAC,EAAS;gBACpB,MAAM,EAAE,CAAC,CAAC,EAAE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