@tanstack/react-router 1.20.0 → 1.20.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/cjs/Asset.cjs +41 -0
- package/dist/cjs/Asset.cjs.map +1 -0
- package/dist/cjs/Asset.d.cts +2 -0
- package/dist/cjs/CatchBoundary.cjs +16 -12
- package/dist/cjs/CatchBoundary.cjs.map +1 -1
- package/dist/cjs/CatchBoundary.d.cts +8 -32
- package/dist/cjs/ClientOnly.cjs +20 -0
- package/dist/cjs/ClientOnly.cjs.map +1 -0
- package/dist/cjs/ClientOnly.d.cts +29 -0
- package/dist/cjs/HeadContent.cjs +155 -0
- package/dist/cjs/HeadContent.cjs.map +1 -0
- package/dist/cjs/HeadContent.d.cts +7 -0
- package/dist/cjs/Match.cjs +252 -0
- package/dist/cjs/Match.cjs.map +1 -0
- package/dist/cjs/Match.d.cts +8 -0
- package/dist/cjs/Matches.cjs +39 -287
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +23 -83
- package/dist/cjs/RouterProvider.cjs +17 -140
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/RouterProvider.d.cts +8 -27
- package/dist/cjs/SafeFragment.cjs +8 -0
- package/dist/cjs/SafeFragment.cjs.map +1 -0
- package/dist/cjs/SafeFragment.d.cts +1 -0
- package/dist/cjs/ScriptOnce.cjs +28 -0
- package/dist/cjs/ScriptOnce.cjs.map +1 -0
- package/dist/cjs/ScriptOnce.d.cts +5 -0
- package/dist/cjs/Scripts.cjs +51 -0
- package/dist/cjs/Scripts.cjs.map +1 -0
- package/dist/cjs/Scripts.d.cts +1 -0
- package/dist/cjs/ScrollRestoration.cjs +39 -0
- package/dist/cjs/ScrollRestoration.cjs.map +1 -0
- package/dist/cjs/ScrollRestoration.d.cts +14 -0
- package/dist/cjs/Transitioner.cjs +115 -0
- package/dist/cjs/Transitioner.cjs.map +1 -0
- package/dist/cjs/Transitioner.d.cts +1 -0
- package/dist/cjs/awaited.cjs +12 -65
- package/dist/cjs/awaited.cjs.map +1 -1
- package/dist/cjs/awaited.d.cts +4 -4
- package/dist/cjs/fileRoute.cjs +41 -15
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +33 -108
- package/dist/cjs/history.d.cts +1 -0
- package/dist/cjs/index.cjs +216 -73
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +52 -29
- package/dist/cjs/lazyRouteComponent.cjs +40 -29
- package/dist/cjs/lazyRouteComponent.cjs.map +1 -1
- package/dist/cjs/lazyRouteComponent.d.cts +1 -1
- package/dist/cjs/link.cjs +212 -106
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +41 -86
- package/dist/cjs/matchContext.cjs +27 -0
- package/dist/cjs/matchContext.cjs.map +1 -0
- package/dist/cjs/matchContext.d.cts +3 -0
- package/dist/cjs/not-found.cjs +9 -15
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/not-found.d.cts +5 -22
- package/dist/cjs/renderRouteNotFound.cjs +22 -0
- package/dist/cjs/renderRouteNotFound.cjs.map +1 -0
- package/dist/cjs/renderRouteNotFound.d.cts +2 -0
- package/dist/cjs/route.cjs +110 -79
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +64 -361
- package/dist/cjs/router.cjs +12 -1237
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +69 -237
- package/dist/cjs/routerContext.cjs +1 -1
- package/dist/cjs/routerContext.cjs.map +1 -1
- package/dist/cjs/routerContext.d.cts +7 -2
- package/dist/cjs/scroll-restoration.cjs +16 -177
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/cjs/scroll-restoration.d.cts +1 -18
- package/dist/cjs/serializer.d.cts +6 -0
- package/dist/cjs/structuralSharing.d.cts +8 -0
- package/dist/cjs/typePrimitives.d.cts +16 -0
- package/dist/cjs/useBlocker.cjs +138 -9
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/cjs/useBlocker.d.cts +64 -7
- package/dist/cjs/useCanGoBack.cjs +8 -0
- package/dist/cjs/useCanGoBack.cjs.map +1 -0
- package/dist/cjs/useCanGoBack.d.cts +1 -0
- package/dist/cjs/useLoaderData.cjs +15 -0
- package/dist/cjs/useLoaderData.cjs.map +1 -0
- package/dist/cjs/useLoaderData.d.cts +8 -0
- package/dist/cjs/useLoaderDeps.cjs +14 -0
- package/dist/cjs/useLoaderDeps.cjs.map +1 -0
- package/dist/cjs/useLoaderDeps.d.cts +8 -0
- package/dist/cjs/useLocation.cjs +10 -0
- package/dist/cjs/useLocation.cjs.map +1 -0
- package/dist/cjs/useLocation.d.cts +7 -0
- package/dist/cjs/useMatch.cjs +47 -0
- package/dist/cjs/useMatch.cjs.map +1 -0
- package/dist/cjs/useMatch.d.cts +10 -0
- package/dist/cjs/useNavigate.cjs +18 -19
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useNavigate.d.cts +4 -8
- package/dist/cjs/useParams.cjs +8 -8
- package/dist/cjs/useParams.cjs.map +1 -1
- package/dist/cjs/useParams.d.cts +9 -8
- package/dist/cjs/useRouteContext.cjs +3 -3
- package/dist/cjs/useRouteContext.cjs.map +1 -1
- package/dist/cjs/useRouteContext.d.cts +3 -7
- package/dist/cjs/useRouter.cjs.map +1 -1
- package/dist/cjs/useRouter.d.cts +3 -4
- package/dist/cjs/useRouterState.cjs +18 -1
- package/dist/cjs/useRouterState.cjs.map +1 -1
- package/dist/cjs/useRouterState.d.cts +8 -6
- package/dist/cjs/useSearch.cjs +7 -4
- package/dist/cjs/useSearch.cjs.map +1 -1
- package/dist/cjs/useSearch.d.cts +9 -7
- package/dist/cjs/utils.cjs +40 -122
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +46 -50
- package/dist/esm/Asset.d.ts +2 -0
- package/dist/esm/Asset.js +41 -0
- package/dist/esm/Asset.js.map +1 -0
- package/dist/esm/CatchBoundary.d.ts +8 -32
- package/dist/esm/CatchBoundary.js +16 -12
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/ClientOnly.d.ts +29 -0
- package/dist/esm/ClientOnly.js +20 -0
- package/dist/esm/ClientOnly.js.map +1 -0
- package/dist/esm/HeadContent.d.ts +7 -0
- package/dist/esm/HeadContent.js +139 -0
- package/dist/esm/HeadContent.js.map +1 -0
- package/dist/esm/Match.d.ts +8 -0
- package/dist/esm/Match.js +235 -0
- package/dist/esm/Match.js.map +1 -0
- package/dist/esm/Matches.d.ts +23 -83
- package/dist/esm/Matches.js +36 -284
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.d.ts +8 -27
- package/dist/esm/RouterProvider.js +20 -126
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/SafeFragment.d.ts +1 -0
- package/dist/esm/SafeFragment.js +8 -0
- package/dist/esm/SafeFragment.js.map +1 -0
- package/dist/esm/ScriptOnce.d.ts +5 -0
- package/dist/esm/ScriptOnce.js +28 -0
- package/dist/esm/ScriptOnce.js.map +1 -0
- package/dist/esm/Scripts.d.ts +1 -0
- package/dist/esm/Scripts.js +51 -0
- package/dist/esm/Scripts.js.map +1 -0
- package/dist/esm/ScrollRestoration.d.ts +14 -0
- package/dist/esm/ScrollRestoration.js +39 -0
- package/dist/esm/ScrollRestoration.js.map +1 -0
- package/dist/esm/Transitioner.d.ts +1 -0
- package/dist/esm/Transitioner.js +98 -0
- package/dist/esm/Transitioner.js.map +1 -0
- package/dist/esm/awaited.d.ts +4 -4
- package/dist/esm/awaited.js +12 -65
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +33 -108
- package/dist/esm/fileRoute.js +38 -12
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/history.d.ts +1 -0
- package/dist/esm/index.d.ts +52 -29
- package/dist/esm/index.js +41 -29
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lazyRouteComponent.d.ts +1 -1
- package/dist/esm/lazyRouteComponent.js +40 -29
- package/dist/esm/lazyRouteComponent.js.map +1 -1
- package/dist/esm/link.d.ts +41 -86
- package/dist/esm/link.js +212 -106
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/matchContext.d.ts +3 -0
- package/dist/esm/matchContext.js +10 -0
- package/dist/esm/matchContext.js.map +1 -0
- package/dist/esm/not-found.d.ts +5 -22
- package/dist/esm/not-found.js +9 -15
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/renderRouteNotFound.d.ts +2 -0
- package/dist/esm/renderRouteNotFound.js +22 -0
- package/dist/esm/renderRouteNotFound.js.map +1 -0
- package/dist/esm/route.d.ts +64 -361
- package/dist/esm/route.js +103 -72
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +69 -237
- package/dist/esm/router.js +13 -1238
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/routerContext.d.ts +7 -2
- package/dist/esm/routerContext.js +1 -1
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/scroll-restoration.d.ts +1 -18
- package/dist/esm/scroll-restoration.js +17 -161
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/serializer.d.ts +6 -0
- package/dist/esm/structuralSharing.d.ts +8 -0
- package/dist/esm/typePrimitives.d.ts +16 -0
- package/dist/esm/useBlocker.d.ts +64 -7
- package/dist/esm/useBlocker.js +138 -9
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useCanGoBack.d.ts +1 -0
- package/dist/esm/useCanGoBack.js +8 -0
- package/dist/esm/useCanGoBack.js.map +1 -0
- package/dist/esm/useLoaderData.d.ts +8 -0
- package/dist/esm/useLoaderData.js +15 -0
- package/dist/esm/useLoaderData.js.map +1 -0
- package/dist/esm/useLoaderDeps.d.ts +8 -0
- package/dist/esm/useLoaderDeps.js +14 -0
- package/dist/esm/useLoaderDeps.js.map +1 -0
- package/dist/esm/useLocation.d.ts +7 -0
- package/dist/esm/useLocation.js +10 -0
- package/dist/esm/useLocation.js.map +1 -0
- package/dist/esm/useMatch.d.ts +10 -0
- package/dist/esm/useMatch.js +30 -0
- package/dist/esm/useMatch.js.map +1 -0
- package/dist/esm/useNavigate.d.ts +4 -8
- package/dist/esm/useNavigate.js +18 -19
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.d.ts +9 -8
- package/dist/esm/useParams.js +8 -8
- package/dist/esm/useParams.js.map +1 -1
- package/dist/esm/useRouteContext.d.ts +3 -7
- package/dist/esm/useRouteContext.js +2 -2
- package/dist/esm/useRouteContext.js.map +1 -1
- package/dist/esm/useRouter.d.ts +3 -4
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/useRouterState.d.ts +8 -6
- package/dist/esm/useRouterState.js +18 -1
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/esm/useSearch.d.ts +9 -7
- package/dist/esm/useSearch.js +6 -3
- package/dist/esm/useSearch.js.map +1 -1
- package/dist/esm/utils.d.ts +46 -50
- package/dist/esm/utils.js +41 -123
- package/dist/esm/utils.js.map +1 -1
- package/package.json +30 -31
- package/src/Asset.tsx +40 -0
- package/src/CatchBoundary.tsx +35 -19
- package/src/ClientOnly.tsx +68 -0
- package/src/HeadContent.tsx +174 -0
- package/src/Match.tsx +330 -0
- package/src/Matches.tsx +149 -558
- package/src/RouterProvider.tsx +58 -212
- package/src/SafeFragment.tsx +5 -0
- package/src/ScriptOnce.tsx +32 -0
- package/src/Scripts.tsx +65 -0
- package/src/ScrollRestoration.tsx +69 -0
- package/src/Transitioner.tsx +130 -0
- package/src/awaited.tsx +16 -87
- package/src/fileRoute.ts +145 -248
- package/src/history.ts +2 -1
- package/src/index.tsx +368 -30
- package/src/lazyRouteComponent.tsx +68 -54
- package/src/link.tsx +397 -522
- package/src/matchContext.tsx +8 -0
- package/src/not-found.tsx +13 -34
- package/src/renderRouteNotFound.tsx +27 -0
- package/src/route.tsx +572 -0
- package/src/router.ts +99 -2067
- package/src/routerContext.tsx +8 -2
- package/src/scroll-restoration.tsx +23 -224
- package/src/serializer.ts +7 -0
- package/src/structuralSharing.ts +47 -0
- package/src/typePrimitives.ts +84 -0
- package/src/useBlocker.tsx +297 -15
- package/src/useCanGoBack.ts +5 -0
- package/src/useLoaderData.tsx +80 -0
- package/src/useLoaderDeps.tsx +58 -0
- package/src/useLocation.tsx +41 -0
- package/src/useMatch.tsx +119 -0
- package/src/useNavigate.tsx +41 -61
- package/src/useParams.tsx +88 -23
- package/src/useRouteContext.ts +24 -18
- package/src/useRouter.tsx +4 -5
- package/src/useRouterState.tsx +52 -10
- package/src/useSearch.tsx +87 -24
- package/src/utils.ts +97 -312
- package/dist/cjs/createServerFn.cjs +0 -40
- package/dist/cjs/createServerFn.cjs.map +0 -1
- package/dist/cjs/createServerFn.d.cts +0 -44
- package/dist/cjs/defer.cjs +0 -30
- package/dist/cjs/defer.cjs.map +0 -1
- package/dist/cjs/defer.d.cts +0 -25
- package/dist/cjs/location.d.cts +0 -12
- package/dist/cjs/path.cjs +0 -213
- package/dist/cjs/path.cjs.map +0 -1
- package/dist/cjs/path.d.cts +0 -24
- package/dist/cjs/qss.cjs +0 -45
- package/dist/cjs/qss.cjs.map +0 -1
- package/dist/cjs/qss.d.cts +0 -2
- package/dist/cjs/redirects.cjs +0 -16
- package/dist/cjs/redirects.cjs.map +0 -1
- package/dist/cjs/redirects.d.cts +0 -18
- package/dist/cjs/routeInfo.d.cts +0 -33
- package/dist/cjs/searchParams.cjs +0 -63
- package/dist/cjs/searchParams.cjs.map +0 -1
- package/dist/cjs/searchParams.d.cts +0 -7
- package/dist/esm/createServerFn.d.ts +0 -44
- package/dist/esm/createServerFn.js +0 -40
- package/dist/esm/createServerFn.js.map +0 -1
- package/dist/esm/defer.d.ts +0 -25
- package/dist/esm/defer.js +0 -30
- package/dist/esm/defer.js.map +0 -1
- package/dist/esm/location.d.ts +0 -12
- package/dist/esm/path.d.ts +0 -24
- package/dist/esm/path.js +0 -213
- package/dist/esm/path.js.map +0 -1
- package/dist/esm/qss.d.ts +0 -2
- package/dist/esm/qss.js +0 -45
- package/dist/esm/qss.js.map +0 -1
- package/dist/esm/redirects.d.ts +0 -18
- package/dist/esm/redirects.js +0 -16
- package/dist/esm/redirects.js.map +0 -1
- package/dist/esm/routeInfo.d.ts +0 -33
- package/dist/esm/searchParams.d.ts +0 -7
- package/dist/esm/searchParams.js +0 -63
- package/dist/esm/searchParams.js.map +0 -1
- package/src/createServerFn.ts +0 -107
- package/src/defer.ts +0 -70
- package/src/location.ts +0 -13
- package/src/path.ts +0 -280
- package/src/qss.ts +0 -53
- package/src/redirects.ts +0 -56
- package/src/route.ts +0 -1356
- package/src/routeInfo.ts +0 -62
- package/src/searchParams.ts +0 -79
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import warning from "tiny-warning";
|
|
3
|
+
import { DefaultGlobalNotFound } from "./not-found.js";
|
|
4
|
+
function renderRouteNotFound(router, route, data) {
|
|
5
|
+
if (!route.options.notFoundComponent) {
|
|
6
|
+
if (router.options.defaultNotFoundComponent) {
|
|
7
|
+
return /* @__PURE__ */ jsx(router.options.defaultNotFoundComponent, { data });
|
|
8
|
+
}
|
|
9
|
+
if (process.env.NODE_ENV === "development") {
|
|
10
|
+
warning(
|
|
11
|
+
route.options.notFoundComponent,
|
|
12
|
+
`A notFoundError was encountered on the route with ID "${route.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(DefaultGlobalNotFound, {});
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(route.options.notFoundComponent, { data });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
renderRouteNotFound
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=renderRouteNotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderRouteNotFound.js","sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent data={data} />\n }\n\n if (process.env.NODE_ENV === 'development') {\n warning(\n route.options.notFoundComponent,\n `A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)`,\n )\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent data={data} />\n}\n"],"names":[],"mappings":";;;AAKgB,SAAA,oBACd,QACA,OACA,MACA;AACI,MAAA,CAAC,MAAM,QAAQ,mBAAmB;AAChC,QAAA,OAAO,QAAQ,0BAA0B;AAC3C,aAAQ,oBAAA,OAAO,QAAQ,0BAAf,EAAwC,KAAY,CAAA;AAAA,IAAA;AAG1D,QAAA,QAAQ,IAAI,aAAa,eAAe;AAC1C;AAAA,QACE,MAAM,QAAQ;AAAA,QACd,yDAAyD,MAAM,EAAE;AAAA,MACnE;AAAA,IAAA;AAGF,+BAAQ,uBAAsB,EAAA;AAAA,EAAA;AAGhC,SAAQ,oBAAA,MAAM,QAAQ,mBAAd,EAAgC,KAAY,CAAA;AACtD;"}
|
package/dist/esm/route.d.ts
CHANGED
|
@@ -1,392 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} | {
|
|
28
|
-
id: TCustomId;
|
|
29
|
-
};
|
|
30
|
-
export interface StaticDataRouteOption {
|
|
31
|
-
}
|
|
32
|
-
export type RoutePathOptionsIntersection<TCustomId, TPath> = UnionToIntersection<RoutePathOptions<TCustomId, TPath>>;
|
|
33
|
-
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown, TLoaderData extends any = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & UpdatableRouteOptions<NoInfer<TAllParams>, NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>>;
|
|
34
|
-
export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
35
|
-
export type FileBaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown> = {
|
|
36
|
-
validateSearch?: SearchSchemaValidator<TSearchSchemaInput, TSearchSchema>;
|
|
37
|
-
shouldReload?: boolean | ((match: LoaderFnContext<TAllParams, TFullSearchSchema, TAllContext, TRouteContext>) => any);
|
|
38
|
-
beforeLoad?: BeforeLoadFn<TFullSearchSchema, TParentRoute, TAllParams, TRouteContextReturn, TRouterContext>;
|
|
39
|
-
loaderDeps?: (opts: {
|
|
40
|
-
search: TFullSearchSchema;
|
|
41
|
-
}) => TLoaderDeps;
|
|
42
|
-
loader?: RouteLoaderFn<TAllParams, NoInfer<TLoaderDeps>, NoInfer<TAllContext>, NoInfer<TRouteContext>, TLoaderDataReturn>;
|
|
43
|
-
} & ({
|
|
44
|
-
parseParams?: (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
45
|
-
stringifyParams?: (params: NoInfer<ParamsFallback<TPath, TParams>>) => Record<ParsePathParams<TPath>, string>;
|
|
46
|
-
} | {
|
|
47
|
-
stringifyParams?: never;
|
|
48
|
-
parseParams?: never;
|
|
49
|
-
});
|
|
50
|
-
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TParentRoute, TPath, TSearchSchemaInput, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn> & {
|
|
51
|
-
getParentRoute: () => TParentRoute;
|
|
52
|
-
};
|
|
53
|
-
type BeforeLoadFn<TFullSearchSchema extends Record<string, any>, TParentRoute extends AnyRoute, TAllParams, TRouteContextReturn extends RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>> = (opts: {
|
|
54
|
-
search: TFullSearchSchema;
|
|
55
|
-
abortController: AbortController;
|
|
56
|
-
preload: boolean;
|
|
57
|
-
params: TAllParams;
|
|
58
|
-
context: TContext;
|
|
59
|
-
location: ParsedLocation;
|
|
60
|
-
navigate: NavigateFn;
|
|
61
|
-
buildLocation: BuildLocationFn<TParentRoute>;
|
|
62
|
-
cause: 'preload' | 'enter' | 'stay';
|
|
63
|
-
}) => Promise<TRouteContextReturn> | TRouteContextReturn | void;
|
|
64
|
-
export type UpdatableRouteOptions<TAllParams extends Record<string, any>, TFullSearchSchema extends Record<string, any>, TLoaderData extends any> = {
|
|
65
|
-
caseSensitive?: boolean;
|
|
66
|
-
wrapInSuspense?: boolean;
|
|
67
|
-
component?: RouteComponent;
|
|
68
|
-
errorComponent?: false | null | ErrorRouteComponent;
|
|
69
|
-
notFoundComponent?: NotFoundRouteComponent;
|
|
70
|
-
pendingComponent?: RouteComponent;
|
|
71
|
-
pendingMs?: number;
|
|
72
|
-
pendingMinMs?: number;
|
|
73
|
-
staleTime?: number;
|
|
74
|
-
gcTime?: number;
|
|
75
|
-
preloadStaleTime?: number;
|
|
76
|
-
preloadGcTime?: number;
|
|
77
|
-
preSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
78
|
-
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
79
|
-
onError?: (err: any) => void;
|
|
80
|
-
onEnter?: (match: AnyRouteMatch) => void;
|
|
81
|
-
onStay?: (match: AnyRouteMatch) => void;
|
|
82
|
-
onLeave?: (match: AnyRouteMatch) => void;
|
|
83
|
-
meta?: (ctx: {
|
|
84
|
-
params: TAllParams;
|
|
85
|
-
loaderData: TLoaderData;
|
|
86
|
-
}) => JSX.IntrinsicElements['meta'][] | Promise<JSX.IntrinsicElements['meta'][]>;
|
|
87
|
-
links?: () => JSX.IntrinsicElements['link'][];
|
|
88
|
-
scripts?: () => JSX.IntrinsicElements['script'][];
|
|
89
|
-
headers?: (ctx: {
|
|
90
|
-
loaderData: TLoaderData;
|
|
91
|
-
}) => Promise<Record<string, string>> | Record<string, string>;
|
|
92
|
-
} & UpdatableStaticRouteOption;
|
|
93
|
-
export type UpdatableStaticRouteOption = {} extends PickRequired<StaticDataRouteOption> ? {
|
|
94
|
-
staticData?: StaticDataRouteOption;
|
|
95
|
-
} : {
|
|
96
|
-
staticData: StaticDataRouteOption;
|
|
97
|
-
};
|
|
98
|
-
export type MetaDescriptor = {
|
|
99
|
-
charSet: 'utf-8';
|
|
100
|
-
} | {
|
|
101
|
-
title: string;
|
|
102
|
-
} | {
|
|
103
|
-
name: string;
|
|
104
|
-
content: string;
|
|
105
|
-
} | {
|
|
106
|
-
property: string;
|
|
107
|
-
content: string;
|
|
108
|
-
} | {
|
|
109
|
-
httpEquiv: string;
|
|
110
|
-
content: string;
|
|
111
|
-
} | {
|
|
112
|
-
'script:ld+json': LdJsonObject;
|
|
113
|
-
} | {
|
|
114
|
-
tagName: 'meta' | 'link';
|
|
115
|
-
[name: string]: string;
|
|
116
|
-
} | {
|
|
117
|
-
[name: string]: unknown;
|
|
118
|
-
};
|
|
119
|
-
type LdJsonObject = {
|
|
120
|
-
[Key in string]: LdJsonValue;
|
|
121
|
-
} & {
|
|
122
|
-
[Key in string]?: LdJsonValue | undefined;
|
|
123
|
-
};
|
|
124
|
-
type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
|
|
125
|
-
type LdJsonPrimitive = string | number | boolean | null;
|
|
126
|
-
type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
|
|
127
|
-
export type RouteLinkEntry = {};
|
|
128
|
-
export type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<TPath, TParams>;
|
|
129
|
-
export type ParseParamsFn<TPath extends string, TParams> = (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
130
|
-
export type ParseParamsObj<TPath extends string, TParams> = {
|
|
131
|
-
parse?: ParseParamsFn<TPath, TParams>;
|
|
132
|
-
};
|
|
133
|
-
export type SearchSchemaValidator<TInput, TReturn> = SearchSchemaValidatorObj<TInput, TReturn> | SearchSchemaValidatorFn<TInput, TReturn>;
|
|
134
|
-
export type SearchSchemaValidatorObj<TInput, TReturn> = {
|
|
135
|
-
parse?: SearchSchemaValidatorFn<TInput, TReturn>;
|
|
136
|
-
};
|
|
137
|
-
export type SearchSchemaValidatorFn<TInput, TReturn> = (searchObj: TInput) => TReturn;
|
|
138
|
-
export type RouteLoaderFn<TAllParams = {}, TLoaderDeps extends Record<string, any> = {}, TAllContext extends Record<string, any> = AnyContext, TRouteContext extends Record<string, any> = AnyContext, TLoaderData extends any = unknown> = (match: LoaderFnContext<TAllParams, TLoaderDeps, TAllContext, TRouteContext>) => Promise<TLoaderData> | TLoaderData | void;
|
|
139
|
-
export interface LoaderFnContext<TAllParams = {}, TLoaderDeps extends Record<string, any> = {}, TAllContext extends Record<string, any> = AnyContext, TRouteContext extends Record<string, any> = AnyContext> {
|
|
140
|
-
abortController: AbortController;
|
|
141
|
-
preload: boolean;
|
|
142
|
-
params: TAllParams;
|
|
143
|
-
deps: TLoaderDeps;
|
|
144
|
-
context: Expand<Assign<TAllContext, TRouteContext>>;
|
|
145
|
-
location: ParsedLocation;
|
|
146
|
-
navigate: (opts: NavigateOptions<AnyRoute>) => Promise<void>;
|
|
147
|
-
parentMatchPromise?: Promise<void>;
|
|
148
|
-
cause: 'preload' | 'enter' | 'stay';
|
|
149
|
-
route: Route;
|
|
1
|
+
import { BaseRootRoute, BaseRoute, BaseRouteApi, AnyContext, AnyRoute, AnyRouter, ConstrainLiteral, ErrorComponentProps, NotFoundError, NotFoundRouteProps, RegisteredRouter, ResolveFullPath, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteConstraints, RouteIds, RouteMask, RouteOptions, RouteTypesById, RouterCore, ToMaskOptions, UseNavigateResult } from '@tanstack/router-core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { UseLoaderDataRoute } from './useLoaderData.js';
|
|
4
|
+
import { UseMatchRoute } from './useMatch.js';
|
|
5
|
+
import { UseLoaderDepsRoute } from './useLoaderDeps.js';
|
|
6
|
+
import { UseParamsRoute } from './useParams.js';
|
|
7
|
+
import { UseSearchRoute } from './useSearch.js';
|
|
8
|
+
import { UseRouteContextRoute } from './useRouteContext.js';
|
|
9
|
+
import { LinkComponentRoute } from './link.js';
|
|
10
|
+
declare module '@tanstack/router-core' {
|
|
11
|
+
interface UpdatableRouteOptionsExtensions {
|
|
12
|
+
component?: RouteComponent;
|
|
13
|
+
errorComponent?: false | null | ErrorRouteComponent;
|
|
14
|
+
notFoundComponent?: NotFoundRouteComponent;
|
|
15
|
+
pendingComponent?: RouteComponent;
|
|
16
|
+
}
|
|
17
|
+
interface RouteExtensions<in out TId extends string, in out TFullPath extends string> {
|
|
18
|
+
useMatch: UseMatchRoute<TId>;
|
|
19
|
+
useRouteContext: UseRouteContextRoute<TId>;
|
|
20
|
+
useSearch: UseSearchRoute<TId>;
|
|
21
|
+
useParams: UseParamsRoute<TId>;
|
|
22
|
+
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
|
23
|
+
useLoaderData: UseLoaderDataRoute<TId>;
|
|
24
|
+
useNavigate: () => UseNavigateResult<TFullPath>;
|
|
25
|
+
Link: LinkComponentRoute<TFullPath>;
|
|
26
|
+
}
|
|
150
27
|
}
|
|
151
|
-
export
|
|
152
|
-
export
|
|
153
|
-
id: infer TParentId extends string;
|
|
154
|
-
} ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId> : RootRouteId;
|
|
155
|
-
export type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
156
|
-
types: {
|
|
157
|
-
fullSearchSchema: infer TFullSearchSchema;
|
|
158
|
-
};
|
|
159
|
-
} ? TFullSearchSchema : {};
|
|
160
|
-
export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
|
|
161
|
-
types: {
|
|
162
|
-
fullSearchSchemaInput: infer TFullSearchSchemaInput;
|
|
163
|
-
};
|
|
164
|
-
} ? TFullSearchSchemaInput : {};
|
|
165
|
-
export type ResolveFullSearchSchema<TParentRoute, TSearchSchema> = Expand<Assign<Omit<InferFullSearchSchema<TParentRoute>, keyof RootSearchSchema>, TSearchSchema>>;
|
|
166
|
-
export type ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed> = Expand<Assign<Omit<InferFullSearchSchemaInput<TParentRoute>, keyof RootSearchSchema>, TSearchSchemaUsed>>;
|
|
167
|
-
export interface AnyRoute extends Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
168
|
-
}
|
|
169
|
-
export type MergeFromFromParent<T, U> = IsAny<T, U, T & U>;
|
|
170
|
-
export type ResolveAllParams<TParentRoute extends AnyRoute, TParams extends AnyPathParams> = Record<never, string> extends TParentRoute['types']['allParams'] ? TParams : Expand<UnionToIntersection<TParentRoute['types']['allParams'] & TParams> & {}>;
|
|
171
|
-
export type RouteConstraints = {
|
|
172
|
-
TParentRoute: AnyRoute;
|
|
173
|
-
TPath: string;
|
|
174
|
-
TFullPath: string;
|
|
175
|
-
TCustomId: string;
|
|
176
|
-
TId: string;
|
|
177
|
-
TSearchSchema: AnySearchSchema;
|
|
178
|
-
TFullSearchSchema: AnySearchSchema;
|
|
179
|
-
TParams: Record<string, any>;
|
|
180
|
-
TAllParams: Record<string, any>;
|
|
181
|
-
TParentContext: AnyContext;
|
|
182
|
-
TRouteContext: RouteContext;
|
|
183
|
-
TAllContext: AnyContext;
|
|
184
|
-
TRouterContext: AnyContext;
|
|
185
|
-
TChildren: unknown;
|
|
186
|
-
TRouteTree: AnyRoute;
|
|
187
|
-
};
|
|
188
|
-
export declare function getRouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']>(id: TId): RouteApi<TId, TRoute, TFullSearchSchema, TAllParams, TAllContext, TLoaderDeps, TLoaderData>;
|
|
189
|
-
export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']> {
|
|
190
|
-
id: TId;
|
|
28
|
+
export declare function getRouteApi<const TId, TRouter extends AnyRouter = RegisteredRouter>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): RouteApi<TId, TRouter>;
|
|
29
|
+
export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> extends BaseRouteApi<TId, TRouter> {
|
|
191
30
|
/**
|
|
192
31
|
* @deprecated Use the `getRouteApi` function instead.
|
|
193
32
|
*/
|
|
194
33
|
constructor({ id }: {
|
|
195
34
|
id: TId;
|
|
196
35
|
});
|
|
197
|
-
useMatch: <
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
select?: ((s: TFullSearchSchema) => TSelected) | undefined;
|
|
205
|
-
} | undefined) => TSelected;
|
|
206
|
-
useParams: <TSelected = TAllParams>(opts?: {
|
|
207
|
-
select?: ((s: TAllParams) => TSelected) | undefined;
|
|
208
|
-
} | undefined) => TSelected;
|
|
209
|
-
useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {
|
|
210
|
-
select?: ((s: TLoaderDeps) => TSelected) | undefined;
|
|
211
|
-
} | undefined) => TSelected;
|
|
212
|
-
useLoaderData: <TSelected = TLoaderData>(opts?: {
|
|
213
|
-
select?: ((s: TLoaderData) => TSelected) | undefined;
|
|
214
|
-
} | undefined) => TSelected;
|
|
36
|
+
useMatch: UseMatchRoute<TId>;
|
|
37
|
+
useRouteContext: UseRouteContextRoute<TId>;
|
|
38
|
+
useSearch: UseSearchRoute<TId>;
|
|
39
|
+
useParams: UseParamsRoute<TId>;
|
|
40
|
+
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
|
41
|
+
useLoaderData: UseLoaderDataRoute<TId>;
|
|
42
|
+
useNavigate: () => UseNavigateResult<RouteTypesById<TRouter, TId>["fullPath"]>;
|
|
215
43
|
notFound: (opts?: NotFoundError) => NotFoundError;
|
|
44
|
+
Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']>;
|
|
216
45
|
}
|
|
217
|
-
export declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>,
|
|
218
|
-
TRouteContextReturn
|
|
219
|
-
] extends [never] ? RouteContext : TRouteContextReturn, in out TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown, TLoaderData extends any = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
220
|
-
isRoot: TParentRoute extends Route<any> ? true : false;
|
|
221
|
-
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>;
|
|
222
|
-
parentRoute: TParentRoute;
|
|
223
|
-
id: TId;
|
|
224
|
-
path: TPath;
|
|
225
|
-
fullPath: TFullPath;
|
|
226
|
-
to: TrimPathRight<TFullPath>;
|
|
227
|
-
children?: TChildren;
|
|
228
|
-
originalIndex?: number;
|
|
229
|
-
router?: AnyRouter;
|
|
230
|
-
rank: number;
|
|
231
|
-
lazyFn?: () => Promise<LazyRoute<any>>;
|
|
46
|
+
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> {
|
|
232
47
|
/**
|
|
233
48
|
* @deprecated Use the `createRoute` function instead.
|
|
234
49
|
*/
|
|
235
|
-
constructor(options
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
searchSchemaInput: TSearchSchemaInput;
|
|
245
|
-
searchSchemaUsed: TSearchSchemaUsed;
|
|
246
|
-
fullSearchSchema: TFullSearchSchema;
|
|
247
|
-
fullSearchSchemaInput: TFullSearchSchemaInput;
|
|
248
|
-
params: TParams;
|
|
249
|
-
allParams: TAllParams;
|
|
250
|
-
routeContext: TRouteContext;
|
|
251
|
-
allContext: TAllContext;
|
|
252
|
-
children: TChildren;
|
|
253
|
-
routeTree: TRouteTree;
|
|
254
|
-
routerContext: TRouterContext;
|
|
255
|
-
loaderData: TLoaderData;
|
|
256
|
-
loaderDeps: TLoaderDeps;
|
|
257
|
-
};
|
|
258
|
-
init: (opts: {
|
|
259
|
-
originalIndex: number;
|
|
260
|
-
}) => void;
|
|
261
|
-
addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TNewChildren, TRouteTree>;
|
|
262
|
-
updateLoader: <TNewLoaderData extends unknown = unknown>(options: {
|
|
263
|
-
loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TRouteContext, TNewLoaderData>;
|
|
264
|
-
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TNewLoaderData, TChildren, TRouteTree, AnyRoute>;
|
|
265
|
-
update: (options: UpdatableRouteOptions<TAllParams, TFullSearchSchema, TLoaderData>) => this;
|
|
266
|
-
lazy: (lazyFn: () => Promise<LazyRoute<any>>) => this;
|
|
267
|
-
useMatch: <TRouteTree_1 extends AnyRoute = AnyRoute, TRouteMatchState = RouteMatch<TRouteTree_1, TId, false>, TSelected = TRouteMatchState>(opts?: {
|
|
268
|
-
select?: ((match: TRouteMatchState) => TSelected) | undefined;
|
|
269
|
-
} | undefined) => TSelected;
|
|
270
|
-
useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
271
|
-
select?: ((search: TAllContext) => TSelected) | undefined;
|
|
272
|
-
} | undefined) => TSelected;
|
|
273
|
-
useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
274
|
-
select?: ((search: TFullSearchSchema) => TSelected) | undefined;
|
|
275
|
-
} | undefined) => TSelected;
|
|
276
|
-
useParams: <TSelected = TAllParams>(opts?: {
|
|
277
|
-
select?: ((search: TAllParams) => TSelected) | undefined;
|
|
278
|
-
} | undefined) => TSelected;
|
|
279
|
-
useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {
|
|
280
|
-
select?: ((s: TLoaderDeps) => TSelected) | undefined;
|
|
281
|
-
} | undefined) => TSelected;
|
|
282
|
-
useLoaderData: <TSelected = TLoaderData>(opts?: {
|
|
283
|
-
select?: ((search: TLoaderData) => TSelected) | undefined;
|
|
284
|
-
} | undefined) => TSelected;
|
|
50
|
+
constructor(options?: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>);
|
|
51
|
+
useMatch: UseMatchRoute<TId>;
|
|
52
|
+
useRouteContext: UseRouteContextRoute<TId>;
|
|
53
|
+
useSearch: UseSearchRoute<TId>;
|
|
54
|
+
useParams: UseParamsRoute<TId>;
|
|
55
|
+
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
|
56
|
+
useLoaderData: UseLoaderDataRoute<TId>;
|
|
57
|
+
useNavigate: () => UseNavigateResult<TFullPath>;
|
|
58
|
+
Link: LinkComponentRoute<TFullPath>;
|
|
285
59
|
}
|
|
286
|
-
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>,
|
|
287
|
-
TRouteContextReturn
|
|
288
|
-
] extends [never] ? RouteContext : TRouteContextReturn, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown, TLoaderData extends any = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute>(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData, TChildren, TRouteTree>;
|
|
60
|
+
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>;
|
|
289
61
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
|
290
|
-
export declare function createRootRouteWithContext<TRouterContext extends {}>(): <
|
|
62
|
+
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>;
|
|
291
63
|
/**
|
|
292
64
|
* @deprecated Use the `createRootRouteWithContext` function instead.
|
|
293
65
|
*/
|
|
294
66
|
export declare const rootRouteWithContext: typeof createRootRouteWithContext;
|
|
295
|
-
export
|
|
296
|
-
__TRootSearchSchema__: '__TRootSearchSchema__';
|
|
297
|
-
};
|
|
298
|
-
export declare class RootRoute<TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderDataReturn extends any = unknown, TLoaderData extends any = [TLoaderDataReturn] extends [never] ? undefined : TLoaderDataReturn> extends Route<any, // TParentRoute
|
|
299
|
-
'/', // TPath
|
|
300
|
-
'/', // TFullPath
|
|
301
|
-
string, // TCustomId
|
|
302
|
-
RootRouteId, // TId
|
|
303
|
-
TSearchSchemaInput, // TSearchSchemaInput
|
|
304
|
-
TSearchSchema, // TSearchSchema
|
|
305
|
-
TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
|
|
306
|
-
TSearchSchema, // TFullSearchSchema
|
|
307
|
-
{}, // TParams
|
|
308
|
-
{}, // TAllParams
|
|
309
|
-
TRouteContextReturn, // TRouteContextReturn
|
|
310
|
-
TRouteContext, // TRouteContext
|
|
311
|
-
Expand<Assign<TRouterContext, TRouteContext>>, // TAllContext
|
|
312
|
-
TRouterContext, // TRouterContext
|
|
313
|
-
TLoaderDeps, TLoaderDataReturn, TLoaderData, any, // TChildren
|
|
314
|
-
any> {
|
|
67
|
+
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> {
|
|
315
68
|
/**
|
|
316
69
|
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
317
70
|
*/
|
|
318
|
-
constructor(options?:
|
|
319
|
-
RootRouteId
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
TRouteContextReturn, // TRouteContextReturn
|
|
328
|
-
TRouteContext, // TRouteContext
|
|
329
|
-
TRouterContext, Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
330
|
-
TLoaderDeps, TLoaderDataReturn, TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
|
|
71
|
+
constructor(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>);
|
|
72
|
+
useMatch: UseMatchRoute<RootRouteId>;
|
|
73
|
+
useRouteContext: UseRouteContextRoute<RootRouteId>;
|
|
74
|
+
useSearch: UseSearchRoute<RootRouteId>;
|
|
75
|
+
useParams: UseParamsRoute<RootRouteId>;
|
|
76
|
+
useLoaderDeps: UseLoaderDepsRoute<RootRouteId>;
|
|
77
|
+
useLoaderData: UseLoaderDataRoute<RootRouteId>;
|
|
78
|
+
useNavigate: () => UseNavigateResult<"/">;
|
|
79
|
+
Link: LinkComponentRoute<'/'>;
|
|
331
80
|
}
|
|
332
|
-
export declare function createRootRoute<
|
|
333
|
-
|
|
334
|
-
'', // TPath
|
|
335
|
-
TSearchSchemaInput, // TSearchSchemaInput
|
|
336
|
-
TSearchSchema, // TSearchSchema
|
|
337
|
-
TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
|
|
338
|
-
TSearchSchema, // TFullSearchSchema
|
|
339
|
-
{}, // TParams
|
|
340
|
-
{}, // TAllParams
|
|
341
|
-
TRouteContextReturn, // TRouteContextReturn
|
|
342
|
-
TRouteContext, // TRouteContext
|
|
343
|
-
TRouterContext, Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
344
|
-
TLoaderDeps, TLoaderDataReturn, TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>): RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderDataReturn, TLoaderData>;
|
|
345
|
-
export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
|
|
346
|
-
type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
|
|
347
|
-
export type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
|
|
348
|
-
export type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
|
|
349
|
-
export type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
|
|
350
|
-
export type RouteMask<TRouteTree extends AnyRoute> = {
|
|
351
|
-
routeTree: TRouteTree;
|
|
352
|
-
from: RoutePaths<TRouteTree>;
|
|
353
|
-
to?: any;
|
|
354
|
-
params?: any;
|
|
355
|
-
search?: any;
|
|
356
|
-
hash?: any;
|
|
357
|
-
state?: any;
|
|
358
|
-
unmaskOnReload?: boolean;
|
|
359
|
-
};
|
|
360
|
-
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends RoutePaths<TRouteTree>, TTo extends string>(opts: {
|
|
81
|
+
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>;
|
|
82
|
+
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string>(opts: {
|
|
361
83
|
routeTree: TRouteTree;
|
|
362
|
-
} &
|
|
363
|
-
/**
|
|
364
|
-
* @deprecated Use `ErrorComponentProps` instead.
|
|
365
|
-
*/
|
|
366
|
-
export type ErrorRouteProps = {
|
|
367
|
-
error: unknown;
|
|
368
|
-
info: {
|
|
369
|
-
componentStack: string;
|
|
370
|
-
};
|
|
371
|
-
};
|
|
372
|
-
export type ErrorComponentProps = {
|
|
373
|
-
error: unknown;
|
|
374
|
-
info: {
|
|
375
|
-
componentStack: string;
|
|
376
|
-
};
|
|
377
|
-
};
|
|
378
|
-
export type NotFoundRouteProps = {
|
|
379
|
-
data: unknown;
|
|
380
|
-
};
|
|
84
|
+
} & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>): RouteMask<TRouteTree>;
|
|
381
85
|
export type ReactNode = any;
|
|
382
86
|
export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
|
|
383
87
|
export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
384
88
|
preload?: () => Promise<void>;
|
|
385
89
|
};
|
|
386
|
-
export type RouteComponent<TProps = any> =
|
|
90
|
+
export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>;
|
|
387
91
|
export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
|
|
388
92
|
export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
|
|
389
|
-
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute,
|
|
390
|
-
constructor(options: Omit<RouteOptions<TParentRoute, string, string,
|
|
93
|
+
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> {
|
|
94
|
+
constructor(options: Omit<RouteOptions<TParentRoute, string, string, string, string, TSearchValidator, {}, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id' | 'params'>);
|
|
391
95
|
}
|
|
392
|
-
export {};
|