@tanstack/react-router 1.121.15 → 1.121.17

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.
Files changed (241) hide show
  1. package/package.json +2 -2
  2. package/dist/cjs/Asset.cjs +0 -41
  3. package/dist/cjs/Asset.cjs.map +0 -1
  4. package/dist/cjs/Asset.d.cts +0 -2
  5. package/dist/cjs/CatchBoundary.cjs +0 -114
  6. package/dist/cjs/CatchBoundary.cjs.map +0 -1
  7. package/dist/cjs/CatchBoundary.d.cts +0 -12
  8. package/dist/cjs/ClientOnly.cjs +0 -20
  9. package/dist/cjs/ClientOnly.cjs.map +0 -1
  10. package/dist/cjs/ClientOnly.d.cts +0 -29
  11. package/dist/cjs/HeadContent.cjs +0 -155
  12. package/dist/cjs/HeadContent.cjs.map +0 -1
  13. package/dist/cjs/HeadContent.d.cts +0 -7
  14. package/dist/cjs/Match.cjs +0 -257
  15. package/dist/cjs/Match.cjs.map +0 -1
  16. package/dist/cjs/Match.d.cts +0 -8
  17. package/dist/cjs/Matches.cjs +0 -136
  18. package/dist/cjs/Matches.cjs.map +0 -1
  19. package/dist/cjs/Matches.d.cts +0 -26
  20. package/dist/cjs/RouterProvider.cjs +0 -33
  21. package/dist/cjs/RouterProvider.cjs.map +0 -1
  22. package/dist/cjs/RouterProvider.d.cts +0 -10
  23. package/dist/cjs/SafeFragment.cjs +0 -8
  24. package/dist/cjs/SafeFragment.cjs.map +0 -1
  25. package/dist/cjs/SafeFragment.d.cts +0 -1
  26. package/dist/cjs/ScriptOnce.cjs +0 -28
  27. package/dist/cjs/ScriptOnce.cjs.map +0 -1
  28. package/dist/cjs/ScriptOnce.d.cts +0 -5
  29. package/dist/cjs/Scripts.cjs +0 -51
  30. package/dist/cjs/Scripts.cjs.map +0 -1
  31. package/dist/cjs/Scripts.d.cts +0 -1
  32. package/dist/cjs/ScrollRestoration.cjs +0 -39
  33. package/dist/cjs/ScrollRestoration.cjs.map +0 -1
  34. package/dist/cjs/ScrollRestoration.d.cts +0 -14
  35. package/dist/cjs/Transitioner.cjs +0 -115
  36. package/dist/cjs/Transitioner.cjs.map +0 -1
  37. package/dist/cjs/Transitioner.d.cts +0 -1
  38. package/dist/cjs/awaited.cjs +0 -48
  39. package/dist/cjs/awaited.cjs.map +0 -1
  40. package/dist/cjs/awaited.d.cts +0 -10
  41. package/dist/cjs/fileRoute.cjs +0 -107
  42. package/dist/cjs/fileRoute.cjs.map +0 -1
  43. package/dist/cjs/fileRoute.d.cts +0 -54
  44. package/dist/cjs/history.d.cts +0 -8
  45. package/dist/cjs/index.cjs +0 -289
  46. package/dist/cjs/index.cjs.map +0 -1
  47. package/dist/cjs/index.d.cts +0 -55
  48. package/dist/cjs/lazyRouteComponent.cjs +0 -78
  49. package/dist/cjs/lazyRouteComponent.cjs.map +0 -1
  50. package/dist/cjs/lazyRouteComponent.d.cts +0 -2
  51. package/dist/cjs/link.cjs +0 -324
  52. package/dist/cjs/link.cjs.map +0 -1
  53. package/dist/cjs/link.d.cts +0 -48
  54. package/dist/cjs/matchContext.cjs +0 -27
  55. package/dist/cjs/matchContext.cjs.map +0 -1
  56. package/dist/cjs/matchContext.d.cts +0 -3
  57. package/dist/cjs/not-found.cjs +0 -40
  58. package/dist/cjs/not-found.cjs.map +0 -1
  59. package/dist/cjs/not-found.d.cts +0 -9
  60. package/dist/cjs/renderRouteNotFound.cjs +0 -22
  61. package/dist/cjs/renderRouteNotFound.cjs.map +0 -1
  62. package/dist/cjs/renderRouteNotFound.d.cts +0 -2
  63. package/dist/cjs/route.cjs +0 -205
  64. package/dist/cjs/route.cjs.map +0 -1
  65. package/dist/cjs/route.d.cts +0 -95
  66. package/dist/cjs/router.cjs +0 -22
  67. package/dist/cjs/router.cjs.map +0 -1
  68. package/dist/cjs/router.d.cts +0 -72
  69. package/dist/cjs/routerContext.cjs +0 -33
  70. package/dist/cjs/routerContext.cjs.map +0 -1
  71. package/dist/cjs/routerContext.d.cts +0 -8
  72. package/dist/cjs/scroll-restoration.cjs +0 -24
  73. package/dist/cjs/scroll-restoration.cjs.map +0 -1
  74. package/dist/cjs/scroll-restoration.d.cts +0 -1
  75. package/dist/cjs/serializer.d.cts +0 -6
  76. package/dist/cjs/structuralSharing.d.cts +0 -8
  77. package/dist/cjs/typePrimitives.d.cts +0 -16
  78. package/dist/cjs/useBlocker.cjs +0 -165
  79. package/dist/cjs/useBlocker.cjs.map +0 -1
  80. package/dist/cjs/useBlocker.d.cts +0 -66
  81. package/dist/cjs/useCanGoBack.cjs +0 -8
  82. package/dist/cjs/useCanGoBack.cjs.map +0 -1
  83. package/dist/cjs/useCanGoBack.d.cts +0 -1
  84. package/dist/cjs/useLoaderData.cjs +0 -15
  85. package/dist/cjs/useLoaderData.cjs.map +0 -1
  86. package/dist/cjs/useLoaderData.d.cts +0 -8
  87. package/dist/cjs/useLoaderDeps.cjs +0 -14
  88. package/dist/cjs/useLoaderDeps.cjs.map +0 -1
  89. package/dist/cjs/useLoaderDeps.d.cts +0 -8
  90. package/dist/cjs/useLocation.cjs +0 -10
  91. package/dist/cjs/useLocation.cjs.map +0 -1
  92. package/dist/cjs/useLocation.d.cts +0 -7
  93. package/dist/cjs/useMatch.cjs +0 -47
  94. package/dist/cjs/useMatch.cjs.map +0 -1
  95. package/dist/cjs/useMatch.d.cts +0 -10
  96. package/dist/cjs/useNavigate.cjs +0 -55
  97. package/dist/cjs/useNavigate.cjs.map +0 -1
  98. package/dist/cjs/useNavigate.d.cts +0 -5
  99. package/dist/cjs/useParams.cjs +0 -16
  100. package/dist/cjs/useParams.cjs.map +0 -1
  101. package/dist/cjs/useParams.d.cts +0 -9
  102. package/dist/cjs/useRouteContext.cjs +0 -11
  103. package/dist/cjs/useRouteContext.cjs.map +0 -1
  104. package/dist/cjs/useRouteContext.d.cts +0 -3
  105. package/dist/cjs/useRouter.cjs +0 -32
  106. package/dist/cjs/useRouter.cjs.map +0 -1
  107. package/dist/cjs/useRouter.d.cts +0 -4
  108. package/dist/cjs/useRouterState.cjs +0 -29
  109. package/dist/cjs/useRouterState.cjs.map +0 -1
  110. package/dist/cjs/useRouterState.d.cts +0 -8
  111. package/dist/cjs/useSearch.cjs +0 -16
  112. package/dist/cjs/useSearch.cjs.map +0 -1
  113. package/dist/cjs/useSearch.d.cts +0 -9
  114. package/dist/cjs/utils.cjs +0 -72
  115. package/dist/cjs/utils.cjs.map +0 -1
  116. package/dist/cjs/utils.d.cts +0 -49
  117. package/dist/esm/Asset.d.ts +0 -2
  118. package/dist/esm/Asset.js +0 -41
  119. package/dist/esm/Asset.js.map +0 -1
  120. package/dist/esm/CatchBoundary.d.ts +0 -12
  121. package/dist/esm/CatchBoundary.js +0 -97
  122. package/dist/esm/CatchBoundary.js.map +0 -1
  123. package/dist/esm/ClientOnly.d.ts +0 -29
  124. package/dist/esm/ClientOnly.js +0 -20
  125. package/dist/esm/ClientOnly.js.map +0 -1
  126. package/dist/esm/HeadContent.d.ts +0 -7
  127. package/dist/esm/HeadContent.js +0 -139
  128. package/dist/esm/HeadContent.js.map +0 -1
  129. package/dist/esm/Match.d.ts +0 -8
  130. package/dist/esm/Match.js +0 -240
  131. package/dist/esm/Match.js.map +0 -1
  132. package/dist/esm/Matches.d.ts +0 -26
  133. package/dist/esm/Matches.js +0 -119
  134. package/dist/esm/Matches.js.map +0 -1
  135. package/dist/esm/RouterProvider.d.ts +0 -10
  136. package/dist/esm/RouterProvider.js +0 -33
  137. package/dist/esm/RouterProvider.js.map +0 -1
  138. package/dist/esm/SafeFragment.d.ts +0 -1
  139. package/dist/esm/SafeFragment.js +0 -8
  140. package/dist/esm/SafeFragment.js.map +0 -1
  141. package/dist/esm/ScriptOnce.d.ts +0 -5
  142. package/dist/esm/ScriptOnce.js +0 -28
  143. package/dist/esm/ScriptOnce.js.map +0 -1
  144. package/dist/esm/Scripts.d.ts +0 -1
  145. package/dist/esm/Scripts.js +0 -51
  146. package/dist/esm/Scripts.js.map +0 -1
  147. package/dist/esm/ScrollRestoration.d.ts +0 -14
  148. package/dist/esm/ScrollRestoration.js +0 -39
  149. package/dist/esm/ScrollRestoration.js.map +0 -1
  150. package/dist/esm/Transitioner.d.ts +0 -1
  151. package/dist/esm/Transitioner.js +0 -98
  152. package/dist/esm/Transitioner.js.map +0 -1
  153. package/dist/esm/awaited.d.ts +0 -10
  154. package/dist/esm/awaited.js +0 -31
  155. package/dist/esm/awaited.js.map +0 -1
  156. package/dist/esm/fileRoute.d.ts +0 -54
  157. package/dist/esm/fileRoute.js +0 -107
  158. package/dist/esm/fileRoute.js.map +0 -1
  159. package/dist/esm/history.d.ts +0 -8
  160. package/dist/esm/index.d.ts +0 -55
  161. package/dist/esm/index.js +0 -151
  162. package/dist/esm/index.js.map +0 -1
  163. package/dist/esm/lazyRouteComponent.d.ts +0 -2
  164. package/dist/esm/lazyRouteComponent.js +0 -61
  165. package/dist/esm/lazyRouteComponent.js.map +0 -1
  166. package/dist/esm/link.d.ts +0 -48
  167. package/dist/esm/link.js +0 -307
  168. package/dist/esm/link.js.map +0 -1
  169. package/dist/esm/matchContext.d.ts +0 -3
  170. package/dist/esm/matchContext.js +0 -10
  171. package/dist/esm/matchContext.js.map +0 -1
  172. package/dist/esm/not-found.d.ts +0 -9
  173. package/dist/esm/not-found.js +0 -40
  174. package/dist/esm/not-found.js.map +0 -1
  175. package/dist/esm/renderRouteNotFound.d.ts +0 -2
  176. package/dist/esm/renderRouteNotFound.js +0 -22
  177. package/dist/esm/renderRouteNotFound.js.map +0 -1
  178. package/dist/esm/route.d.ts +0 -95
  179. package/dist/esm/route.js +0 -205
  180. package/dist/esm/route.js.map +0 -1
  181. package/dist/esm/router.d.ts +0 -72
  182. package/dist/esm/router.js +0 -22
  183. package/dist/esm/router.js.map +0 -1
  184. package/dist/esm/routerContext.d.ts +0 -8
  185. package/dist/esm/routerContext.js +0 -16
  186. package/dist/esm/routerContext.js.map +0 -1
  187. package/dist/esm/scroll-restoration.d.ts +0 -1
  188. package/dist/esm/scroll-restoration.js +0 -24
  189. package/dist/esm/scroll-restoration.js.map +0 -1
  190. package/dist/esm/serializer.d.ts +0 -6
  191. package/dist/esm/structuralSharing.d.ts +0 -8
  192. package/dist/esm/typePrimitives.d.ts +0 -16
  193. package/dist/esm/useBlocker.d.ts +0 -66
  194. package/dist/esm/useBlocker.js +0 -148
  195. package/dist/esm/useBlocker.js.map +0 -1
  196. package/dist/esm/useCanGoBack.d.ts +0 -1
  197. package/dist/esm/useCanGoBack.js +0 -8
  198. package/dist/esm/useCanGoBack.js.map +0 -1
  199. package/dist/esm/useLoaderData.d.ts +0 -8
  200. package/dist/esm/useLoaderData.js +0 -15
  201. package/dist/esm/useLoaderData.js.map +0 -1
  202. package/dist/esm/useLoaderDeps.d.ts +0 -8
  203. package/dist/esm/useLoaderDeps.js +0 -14
  204. package/dist/esm/useLoaderDeps.js.map +0 -1
  205. package/dist/esm/useLocation.d.ts +0 -7
  206. package/dist/esm/useLocation.js +0 -10
  207. package/dist/esm/useLocation.js.map +0 -1
  208. package/dist/esm/useMatch.d.ts +0 -10
  209. package/dist/esm/useMatch.js +0 -30
  210. package/dist/esm/useMatch.js.map +0 -1
  211. package/dist/esm/useNavigate.d.ts +0 -5
  212. package/dist/esm/useNavigate.js +0 -38
  213. package/dist/esm/useNavigate.js.map +0 -1
  214. package/dist/esm/useParams.d.ts +0 -9
  215. package/dist/esm/useParams.js +0 -16
  216. package/dist/esm/useParams.js.map +0 -1
  217. package/dist/esm/useRouteContext.d.ts +0 -3
  218. package/dist/esm/useRouteContext.js +0 -11
  219. package/dist/esm/useRouteContext.js.map +0 -1
  220. package/dist/esm/useRouter.d.ts +0 -4
  221. package/dist/esm/useRouter.js +0 -15
  222. package/dist/esm/useRouter.js.map +0 -1
  223. package/dist/esm/useRouterState.d.ts +0 -8
  224. package/dist/esm/useRouterState.js +0 -29
  225. package/dist/esm/useRouterState.js.map +0 -1
  226. package/dist/esm/useSearch.d.ts +0 -9
  227. package/dist/esm/useSearch.js +0 -16
  228. package/dist/esm/useSearch.js.map +0 -1
  229. package/dist/esm/utils.d.ts +0 -49
  230. package/dist/esm/utils.js +0 -55
  231. package/dist/esm/utils.js.map +0 -1
  232. package/dist/llms/index.d.ts +0 -3
  233. package/dist/llms/index.js +0 -35
  234. package/dist/llms/rules/api.d.ts +0 -2
  235. package/dist/llms/rules/api.js +0 -4241
  236. package/dist/llms/rules/guide.d.ts +0 -2
  237. package/dist/llms/rules/guide.js +0 -6225
  238. package/dist/llms/rules/routing.d.ts +0 -2
  239. package/dist/llms/rules/routing.js +0 -1946
  240. package/dist/llms/rules/setup-and-architecture.d.ts +0 -2
  241. package/dist/llms/rules/setup-and-architecture.js +0 -932
@@ -1,95 +0,0 @@
1
- import { BaseRootRoute, BaseRoute, BaseRouteApi, AnyContext, AnyRoute, AnyRouter, ConstrainLiteral, ErrorComponentProps, NotFoundError, NotFoundRouteProps, RegisteredRouter, ResolveFullPath, ResolveId, ResolveParams, RootRoute as RootRouteCore, RootRouteId, RootRouteOptions, RouteConstraints, Route as RouteCore, 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
- }
27
- }
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> {
30
- /**
31
- * @deprecated Use the `getRouteApi` function instead.
32
- */
33
- constructor({ id }: {
34
- id: TId;
35
- });
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"]>;
43
- notFound: (opts?: NotFoundError) => NotFoundError;
44
- Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']>;
45
- }
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> implements RouteCore<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
47
- /**
48
- * @deprecated Use the `createRoute` function instead.
49
- */
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>;
59
- }
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>;
61
- export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
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>;
63
- /**
64
- * @deprecated Use the `createRootRouteWithContext` function instead.
65
- */
66
- export declare const rootRouteWithContext: typeof createRootRouteWithContext;
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> implements RootRouteCore<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
68
- /**
69
- * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
70
- */
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<'/'>;
80
- }
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: {
83
- routeTree: TRouteTree;
84
- } & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>): RouteMask<TRouteTree>;
85
- export type ReactNode = any;
86
- export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
87
- export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
88
- preload?: () => Promise<void>;
89
- };
90
- export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>;
91
- export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
92
- export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
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'>);
95
- }
package/dist/esm/route.js DELETED
@@ -1,205 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { BaseRouteApi, notFound, BaseRoute, BaseRootRoute } from "@tanstack/router-core";
3
- import React__default from "react";
4
- import { useLoaderData } from "./useLoaderData.js";
5
- import { useLoaderDeps } from "./useLoaderDeps.js";
6
- import { useParams } from "./useParams.js";
7
- import { useSearch } from "./useSearch.js";
8
- import { useNavigate } from "./useNavigate.js";
9
- import { useMatch } from "./useMatch.js";
10
- import { useRouter } from "./useRouter.js";
11
- import { Link } from "./link.js";
12
- function getRouteApi(id) {
13
- return new RouteApi({ id });
14
- }
15
- class RouteApi extends BaseRouteApi {
16
- /**
17
- * @deprecated Use the `getRouteApi` function instead.
18
- */
19
- constructor({ id }) {
20
- super({ id });
21
- this.useMatch = (opts) => {
22
- return useMatch({
23
- select: opts == null ? void 0 : opts.select,
24
- from: this.id,
25
- structuralSharing: opts == null ? void 0 : opts.structuralSharing
26
- });
27
- };
28
- this.useRouteContext = (opts) => {
29
- return useMatch({
30
- from: this.id,
31
- select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
32
- });
33
- };
34
- this.useSearch = (opts) => {
35
- return useSearch({
36
- select: opts == null ? void 0 : opts.select,
37
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
38
- from: this.id
39
- });
40
- };
41
- this.useParams = (opts) => {
42
- return useParams({
43
- select: opts == null ? void 0 : opts.select,
44
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
45
- from: this.id
46
- });
47
- };
48
- this.useLoaderDeps = (opts) => {
49
- return useLoaderDeps({ ...opts, from: this.id, strict: false });
50
- };
51
- this.useLoaderData = (opts) => {
52
- return useLoaderData({ ...opts, from: this.id, strict: false });
53
- };
54
- this.useNavigate = () => {
55
- const router = useRouter();
56
- return useNavigate({ from: router.routesById[this.id].fullPath });
57
- };
58
- this.notFound = (opts) => {
59
- return notFound({ routeId: this.id, ...opts });
60
- };
61
- this.Link = React__default.forwardRef((props, ref) => {
62
- const router = useRouter();
63
- const fullPath = router.routesById[this.id].fullPath;
64
- return /* @__PURE__ */ jsx(Link, { ref, from: fullPath, ...props });
65
- });
66
- }
67
- }
68
- class Route extends BaseRoute {
69
- /**
70
- * @deprecated Use the `createRoute` function instead.
71
- */
72
- constructor(options) {
73
- super(options);
74
- this.useMatch = (opts) => {
75
- return useMatch({
76
- select: opts == null ? void 0 : opts.select,
77
- from: this.id,
78
- structuralSharing: opts == null ? void 0 : opts.structuralSharing
79
- });
80
- };
81
- this.useRouteContext = (opts) => {
82
- return useMatch({
83
- ...opts,
84
- from: this.id,
85
- select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
86
- });
87
- };
88
- this.useSearch = (opts) => {
89
- return useSearch({
90
- select: opts == null ? void 0 : opts.select,
91
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
92
- from: this.id
93
- });
94
- };
95
- this.useParams = (opts) => {
96
- return useParams({
97
- select: opts == null ? void 0 : opts.select,
98
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
99
- from: this.id
100
- });
101
- };
102
- this.useLoaderDeps = (opts) => {
103
- return useLoaderDeps({ ...opts, from: this.id });
104
- };
105
- this.useLoaderData = (opts) => {
106
- return useLoaderData({ ...opts, from: this.id });
107
- };
108
- this.useNavigate = () => {
109
- return useNavigate({ from: this.fullPath });
110
- };
111
- this.Link = React__default.forwardRef(
112
- (props, ref) => {
113
- return /* @__PURE__ */ jsx(Link, { ref, from: this.fullPath, ...props });
114
- }
115
- );
116
- this.$$typeof = Symbol.for("react.memo");
117
- }
118
- }
119
- function createRoute(options) {
120
- return new Route(options);
121
- }
122
- function createRootRouteWithContext() {
123
- return (options) => {
124
- return createRootRoute(options);
125
- };
126
- }
127
- const rootRouteWithContext = createRootRouteWithContext;
128
- class RootRoute extends BaseRootRoute {
129
- /**
130
- * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
131
- */
132
- constructor(options) {
133
- super(options);
134
- this.useMatch = (opts) => {
135
- return useMatch({
136
- select: opts == null ? void 0 : opts.select,
137
- from: this.id,
138
- structuralSharing: opts == null ? void 0 : opts.structuralSharing
139
- });
140
- };
141
- this.useRouteContext = (opts) => {
142
- return useMatch({
143
- ...opts,
144
- from: this.id,
145
- select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
146
- });
147
- };
148
- this.useSearch = (opts) => {
149
- return useSearch({
150
- select: opts == null ? void 0 : opts.select,
151
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
152
- from: this.id
153
- });
154
- };
155
- this.useParams = (opts) => {
156
- return useParams({
157
- select: opts == null ? void 0 : opts.select,
158
- structuralSharing: opts == null ? void 0 : opts.structuralSharing,
159
- from: this.id
160
- });
161
- };
162
- this.useLoaderDeps = (opts) => {
163
- return useLoaderDeps({ ...opts, from: this.id });
164
- };
165
- this.useLoaderData = (opts) => {
166
- return useLoaderData({ ...opts, from: this.id });
167
- };
168
- this.useNavigate = () => {
169
- return useNavigate({ from: this.fullPath });
170
- };
171
- this.Link = React__default.forwardRef(
172
- (props, ref) => {
173
- return /* @__PURE__ */ jsx(Link, { ref, from: this.fullPath, ...props });
174
- }
175
- );
176
- this.$$typeof = Symbol.for("react.memo");
177
- }
178
- }
179
- function createRootRoute(options) {
180
- return new RootRoute(options);
181
- }
182
- function createRouteMask(opts) {
183
- return opts;
184
- }
185
- class NotFoundRoute extends Route {
186
- constructor(options) {
187
- super({
188
- ...options,
189
- id: "404"
190
- });
191
- }
192
- }
193
- export {
194
- NotFoundRoute,
195
- RootRoute,
196
- Route,
197
- RouteApi,
198
- createRootRoute,
199
- createRootRouteWithContext,
200
- createRoute,
201
- createRouteMask,
202
- getRouteApi,
203
- rootRouteWithContext
204
- };
205
- //# sourceMappingURL=route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route.js","sources":["../../src/route.tsx"],"sourcesContent":["import {\n BaseRootRoute,\n BaseRoute,\n BaseRouteApi,\n notFound,\n} from '@tanstack/router-core'\nimport React from 'react'\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 { Link } from './link'\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 RootRoute as RootRouteCore,\n RootRouteId,\n RootRouteOptions,\n RouteConstraints,\n Route as RouteCore,\n RouteIds,\n RouteMask,\n RouteOptions,\n RouteTypesById,\n RouterCore,\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 { UseRouteContextRoute } from './useRouteContext'\nimport type { LinkComponentRoute } from './link'\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 in out TId extends string,\n in out 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 Link: LinkComponentRoute<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 structuralSharing: opts?.structuralSharing,\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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useSearch({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useParams({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\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 Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> =\n React.forwardRef((props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n const router = useRouter()\n const fullPath = router.routesById[this.id as string].fullPath\n return <Link ref={ref} from={fullPath as never} {...props} />\n }) as unknown as LinkComponentRoute<\n RouteTypesById<TRouter, TId>['fullPath']\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 >\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 implements\n RouteCore<\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 /**\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 ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch: UseMatchRoute<TId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n structuralSharing: opts?.structuralSharing,\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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useSearch({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TId> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useParams({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\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 Link: LinkComponentRoute<TFullPath> = React.forwardRef(\n (props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n return <Link ref={ref} from={this.fullPath as never} {...props} />\n },\n ) as unknown as LinkComponentRoute<TFullPath>\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> {\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 >\n extends BaseRootRoute<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\n implements\n RootRouteCore<\n TSearchValidator,\n TRouterContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n TFileRouteTypes\n >\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 ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch: UseMatchRoute<RootRouteId> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.id,\n structuralSharing: opts?.structuralSharing,\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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useSearch({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\n from: this.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<RootRouteId> = (opts) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n return useParams({\n select: opts?.select,\n structuralSharing: opts?.structuralSharing,\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 Link: LinkComponentRoute<'/'> = React.forwardRef(\n (props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n return <Link ref={ref} from={this.fullPath} {...props} />\n },\n ) as unknown as LinkComponentRoute<'/'>\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\nexport function createRouteMask<\n TRouteTree extends AnyRoute,\n TFrom extends string,\n TTo extends string,\n>(\n opts: {\n routeTree: TRouteTree\n } & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n return opts as any\n}\n\nexport type ReactNode = any\n\nexport type SyncRouteComponent<TProps> =\n | ((props: TProps) => ReactNode)\n | React.LazyExoticComponent<(props: TProps) => ReactNode>\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":["React"],"mappings":"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"}
@@ -1,72 +0,0 @@
1
- import { RouterCore, AnyRoute, CreateRouterFn, RouterConstructorOptions, TrailingSlashOption } from '@tanstack/router-core';
2
- import { RouterHistory } from '@tanstack/history';
3
- import { ErrorRouteComponent, NotFoundRouteComponent, RouteComponent } from './route.js';
4
- declare module '@tanstack/router-core' {
5
- interface RouterOptionsExtensions {
6
- /**
7
- * The default `component` a route should use if no component is provided.
8
- *
9
- * @default Outlet
10
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
11
- */
12
- defaultComponent?: RouteComponent;
13
- /**
14
- * The default `errorComponent` a route should use if no error component is provided.
15
- *
16
- * @default ErrorComponent
17
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
18
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
19
- */
20
- defaultErrorComponent?: ErrorRouteComponent;
21
- /**
22
- * The default `pendingComponent` a route should use if no pending component is provided.
23
- *
24
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
25
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
26
- */
27
- defaultPendingComponent?: RouteComponent;
28
- /**
29
- * The default `notFoundComponent` a route should use if no notFound component is provided.
30
- *
31
- * @default NotFound
32
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
33
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
34
- */
35
- defaultNotFoundComponent?: NotFoundRouteComponent;
36
- /**
37
- * A component that will be used to wrap the entire router.
38
- *
39
- * This is useful for providing a context to the entire router.
40
- *
41
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
42
- *
43
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
44
- */
45
- Wrap?: (props: {
46
- children: any;
47
- }) => React.JSX.Element;
48
- /**
49
- * A component that will be used to wrap the inner contents of the router.
50
- *
51
- * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
52
- *
53
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
54
- *
55
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
56
- */
57
- InnerWrap?: (props: {
58
- children: any;
59
- }) => React.JSX.Element;
60
- /**
61
- * The default `onCatch` handler for errors caught by the Router ErrorBoundary
62
- *
63
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)
64
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)
65
- */
66
- defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void;
67
- }
68
- }
69
- export declare const createRouter: CreateRouterFn;
70
- export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption = 'never', in out TDefaultStructuralSharingOption extends boolean = false, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> extends RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated> {
71
- constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
72
- }
@@ -1,22 +0,0 @@
1
- import { RouterCore } from "@tanstack/router-core";
2
- import { createFileRoute, createLazyFileRoute } from "./fileRoute.js";
3
- const createRouter = (options) => {
4
- return new Router(options);
5
- };
6
- class Router extends RouterCore {
7
- constructor(options) {
8
- super(options);
9
- }
10
- }
11
- if (typeof globalThis !== "undefined") {
12
- globalThis.createFileRoute = createFileRoute;
13
- globalThis.createLazyFileRoute = createLazyFileRoute;
14
- } else if (typeof window !== "undefined") {
15
- window.createFileRoute = createFileRoute;
16
- window.createFileRoute = createLazyFileRoute;
17
- }
18
- export {
19
- Router,
20
- createRouter
21
- };
22
- //# sourceMappingURL=router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router.js","sources":["../../src/router.ts"],"sourcesContent":["import { RouterCore } from '@tanstack/router-core'\nimport { createFileRoute, createLazyFileRoute } from './fileRoute'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n AnyRoute,\n CreateRouterFn,\n RouterConstructorOptions,\n TrailingSlashOption,\n} from '@tanstack/router-core'\n\nimport type {\n ErrorRouteComponent,\n NotFoundRouteComponent,\n RouteComponent,\n} from './route'\n\ndeclare module '@tanstack/router-core' {\n export interface RouterOptionsExtensions {\n /**\n * The default `component` a route should use if no component is provided.\n *\n * @default Outlet\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)\n */\n defaultComponent?: RouteComponent\n /**\n * The default `errorComponent` a route should use if no error component is provided.\n *\n * @default ErrorComponent\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)\n */\n defaultErrorComponent?: ErrorRouteComponent\n /**\n * The default `pendingComponent` a route should use if no pending component is provided.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)\n */\n defaultPendingComponent?: RouteComponent\n /**\n * The default `notFoundComponent` a route should use if no notFound component is provided.\n *\n * @default NotFound\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)\n */\n defaultNotFoundComponent?: NotFoundRouteComponent\n /**\n * A component that will be used to wrap the entire router.\n *\n * This is useful for providing a context to the entire router.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)\n */\n Wrap?: (props: { children: any }) => React.JSX.Element\n /**\n * A component that will be used to wrap the inner contents of the router.\n *\n * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.\n *\n * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)\n */\n InnerWrap?: (props: { children: any }) => React.JSX.Element\n\n /**\n * The default `onCatch` handler for errors caught by the Router ErrorBoundary\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)\n */\n defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n }\n}\n\nexport const createRouter: CreateRouterFn = (options) => {\n return new Router(options)\n}\n\nexport class Router<\n in out TRouteTree extends AnyRoute,\n in out TTrailingSlashOption extends TrailingSlashOption = 'never',\n in out TDefaultStructuralSharingOption extends boolean = false,\n in out TRouterHistory extends RouterHistory = RouterHistory,\n in out TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterCore<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n> {\n constructor(\n options: RouterConstructorOptions<\n TRouteTree,\n TTrailingSlashOption,\n TDefaultStructuralSharingOption,\n TRouterHistory,\n TDehydrated\n >,\n ) {\n super(options)\n }\n}\n\nif (typeof globalThis !== 'undefined') {\n ;(globalThis as any).createFileRoute = createFileRoute\n ;(globalThis as any).createLazyFileRoute = createLazyFileRoute\n} else if (typeof window !== 'undefined') {\n ;(window as any).createFileRoute = createFileRoute\n ;(window as any).createFileRoute = createLazyFileRoute\n}\n"],"names":[],"mappings":";;AA+Ea,MAAA,eAA+B,CAAC,YAAY;AAChD,SAAA,IAAI,OAAO,OAAO;AAC3B;AAEO,MAAM,eAMH,WAMR;AAAA,EACA,YACE,SAOA;AACA,UAAM,OAAO;AAAA,EAAA;AAEjB;AAEA,IAAI,OAAO,eAAe,aAAa;AACnC,aAAmB,kBAAkB;AACrC,aAAmB,sBAAsB;AAC7C,WAAW,OAAO,WAAW,aAAa;AACtC,SAAe,kBAAkB;AACjC,SAAe,kBAAkB;AACrC;"}
@@ -1,8 +0,0 @@
1
- import { AnyRouter } from '@tanstack/router-core';
2
- import * as React from 'react';
3
- declare global {
4
- interface Window {
5
- __TSR_ROUTER_CONTEXT__?: React.Context<AnyRouter>;
6
- }
7
- }
8
- export declare function getRouterContext(): React.Context<AnyRouter>;
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
- const routerContext = React.createContext(null);
3
- function getRouterContext() {
4
- if (typeof document === "undefined") {
5
- return routerContext;
6
- }
7
- if (window.__TSR_ROUTER_CONTEXT__) {
8
- return window.__TSR_ROUTER_CONTEXT__;
9
- }
10
- window.__TSR_ROUTER_CONTEXT__ = routerContext;
11
- return routerContext;
12
- }
13
- export {
14
- getRouterContext
15
- };
16
- //# sourceMappingURL=routerContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routerContext.js","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { AnyRouter } from '@tanstack/router-core'\n\ndeclare global {\n interface Window {\n __TSR_ROUTER_CONTEXT__?: React.Context<AnyRouter>\n }\n}\n\nconst routerContext = React.createContext<AnyRouter>(null!)\n\nexport function getRouterContext() {\n if (typeof document === 'undefined') {\n return routerContext\n }\n\n if (window.__TSR_ROUTER_CONTEXT__) {\n return window.__TSR_ROUTER_CONTEXT__\n }\n\n window.__TSR_ROUTER_CONTEXT__ = routerContext as any\n\n return routerContext\n}\n"],"names":[],"mappings":";AASA,MAAM,gBAAgB,MAAM,cAAyB,IAAK;AAEnD,SAAS,mBAAmB;AAC7B,MAAA,OAAO,aAAa,aAAa;AAC5B,WAAA;AAAA,EAAA;AAGT,MAAI,OAAO,wBAAwB;AACjC,WAAO,OAAO;AAAA,EAAA;AAGhB,SAAO,yBAAyB;AAEzB,SAAA;AACT;"}
@@ -1 +0,0 @@
1
- export declare function ScrollRestoration(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,24 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { defaultGetScrollRestorationKey, restoreScroll, storageKey } from "@tanstack/router-core";
3
- import { useRouter } from "./useRouter.js";
4
- import { ScriptOnce } from "./ScriptOnce.js";
5
- function ScrollRestoration() {
6
- const router = useRouter();
7
- const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
8
- const userKey = getKey(router.latestLocation);
9
- const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : null;
10
- if (!router.isScrollRestoring || !router.isServer) {
11
- return null;
12
- }
13
- return /* @__PURE__ */ jsx(
14
- ScriptOnce,
15
- {
16
- children: `(${restoreScroll.toString()})(${JSON.stringify(storageKey)},${JSON.stringify(resolvedKey)}, undefined, true)`,
17
- log: false
18
- }
19
- );
20
- }
21
- export {
22
- ScrollRestoration
23
- };
24
- //# sourceMappingURL=scroll-restoration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scroll-restoration.js","sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n restoreScroll,\n storageKey,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n const router = useRouter()\n const getKey =\n router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n const userKey = getKey(router.latestLocation)\n const resolvedKey =\n userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n ? userKey\n : null\n\n if (!router.isScrollRestoring || !router.isServer) {\n return null\n }\n\n return (\n <ScriptOnce\n children={`(${restoreScroll.toString()})(${JSON.stringify(storageKey)},${JSON.stringify(resolvedKey)}, undefined, true)`}\n log={false}\n />\n )\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,oBAAoB;AAClC,QAAM,SAAS,UAAU;AACnB,QAAA,SACJ,OAAO,QAAQ,2BAA2B;AACtC,QAAA,UAAU,OAAO,OAAO,cAAc;AAC5C,QAAM,cACJ,YAAY,+BAA+B,OAAO,cAAc,IAC5D,UACA;AAEN,MAAI,CAAC,OAAO,qBAAqB,CAAC,OAAO,UAAU;AAC1C,WAAA;AAAA,EAAA;AAIP,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAU,IAAI,cAAc,SAAU,CAAA,KAAK,KAAK,UAAU,UAAU,CAAC,IAAI,KAAK,UAAU,WAAW,CAAC;AAAA,MACpG,KAAK;AAAA,IAAA;AAAA,EACP;AAEJ;"}
@@ -1,6 +0,0 @@
1
- import type * as React from 'react';
2
- declare module '@tanstack/router-core' {
3
- interface SerializerExtensions {
4
- ReadableStream: React.JSX.Element;
5
- }
6
- }
@@ -1,8 +0,0 @@
1
- import { AnyRouter, Constrain, OptionalStructuralSharing, ValidateJSON } from '@tanstack/router-core';
2
- export type DefaultStructuralSharingEnabled<TRouter extends AnyRouter> = boolean extends TRouter['options']['defaultStructuralSharing'] ? false : NonNullable<TRouter['options']['defaultStructuralSharing']>;
3
- export interface RequiredStructuralSharing<TStructuralSharing, TConstraint> {
4
- readonly structuralSharing: Constrain<TStructuralSharing, TConstraint>;
5
- }
6
- export type StructuralSharingOption<TRouter extends AnyRouter, TSelected, TStructuralSharing> = unknown extends TSelected ? OptionalStructuralSharing<TStructuralSharing, boolean> : unknown extends TRouter['routeTree'] ? OptionalStructuralSharing<TStructuralSharing, boolean> : TSelected extends ValidateJSON<TSelected> ? OptionalStructuralSharing<TStructuralSharing, boolean> : DefaultStructuralSharingEnabled<TRouter> extends true ? RequiredStructuralSharing<TStructuralSharing, false> : OptionalStructuralSharing<TStructuralSharing, false>;
7
- export type StructuralSharingEnabled<TRouter extends AnyRouter, TStructuralSharing> = boolean extends TStructuralSharing ? DefaultStructuralSharingEnabled<TRouter> : TStructuralSharing;
8
- export type ValidateSelected<TRouter extends AnyRouter, TSelected, TStructuralSharing> = StructuralSharingEnabled<TRouter, TStructuralSharing> extends true ? ValidateJSON<TSelected> : TSelected;
@@ -1,16 +0,0 @@
1
- import { AnyRouter, Constrain, InferFrom, InferMaskFrom, InferMaskTo, InferSelected, InferShouldThrow, InferStrict, InferTo, RegisteredRouter } from '@tanstack/router-core';
2
- import { LinkComponentProps } from './link.js';
3
- import { UseParamsOptions } from './useParams.js';
4
- import { UseSearchOptions } from './useSearch.js';
5
- export type ValidateLinkOptions<TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a'> = Constrain<TOptions, LinkComponentProps<TComp, TRouter, InferFrom<TOptions, TDefaultFrom>, InferTo<TOptions>, InferMaskFrom<TOptions>, InferMaskTo<TOptions>>>;
6
- /**
7
- * @internal
8
- */
9
- export type InferStructuralSharing<TOptions> = TOptions extends {
10
- structuralSharing: infer TStructuralSharing;
11
- } ? TStructuralSharing : unknown;
12
- export type ValidateUseSearchOptions<TOptions, TRouter extends AnyRouter = RegisteredRouter> = Constrain<TOptions, UseSearchOptions<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferShouldThrow<TOptions>, InferSelected<TOptions>, InferStructuralSharing<TOptions>>>;
13
- export type ValidateUseParamsOptions<TOptions, TRouter extends AnyRouter = RegisteredRouter> = Constrain<TOptions, UseParamsOptions<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferShouldThrow<TOptions>, InferSelected<TOptions>, InferSelected<TOptions>>>;
14
- export type ValidateLinkOptionsArray<TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>, TDefaultFrom extends string = string, TComp = 'a'> = {
15
- [K in keyof TOptions]: ValidateLinkOptions<TRouter, TOptions[K], TDefaultFrom, TComp>;
16
- };
@@ -1,66 +0,0 @@
1
- import { HistoryAction } from '@tanstack/history';
2
- import { AnyRoute, AnyRouter, ParseRoute, RegisteredRouter } from '@tanstack/router-core';
3
- import * as React from 'react';
4
- interface ShouldBlockFnLocation<out TRouteId, out TFullPath, out TAllParams, out TFullSearchSchema> {
5
- routeId: TRouteId;
6
- fullPath: TFullPath;
7
- pathname: string;
8
- params: TAllParams;
9
- search: TFullSearchSchema;
10
- }
11
- type MakeShouldBlockFnLocationUnion<TRouter extends AnyRouter = RegisteredRouter, TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>> = TRoute extends any ? ShouldBlockFnLocation<TRoute['id'], TRoute['fullPath'], TRoute['types']['allParams'], TRoute['types']['fullSearchSchema']> : never;
12
- type BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> = {
13
- status: 'blocked';
14
- current: MakeShouldBlockFnLocationUnion<TRouter>;
15
- next: MakeShouldBlockFnLocationUnion<TRouter>;
16
- action: HistoryAction;
17
- proceed: () => void;
18
- reset: () => void;
19
- } | {
20
- status: 'idle';
21
- current: undefined;
22
- next: undefined;
23
- action: undefined;
24
- proceed: undefined;
25
- reset: undefined;
26
- };
27
- type ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {
28
- current: MakeShouldBlockFnLocationUnion<TRouter>;
29
- next: MakeShouldBlockFnLocationUnion<TRouter>;
30
- action: HistoryAction;
31
- };
32
- export type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (args: ShouldBlockFnArgs<TRouter>) => boolean | Promise<boolean>;
33
- export type UseBlockerOpts<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean> = {
34
- shouldBlockFn: ShouldBlockFn<TRouter>;
35
- enableBeforeUnload?: boolean | (() => boolean);
36
- disabled?: boolean;
37
- withResolver?: TWithResolver;
38
- };
39
- type LegacyBlockerFn = () => Promise<any> | any;
40
- type LegacyBlockerOpts = {
41
- blockerFn?: LegacyBlockerFn;
42
- condition?: boolean | any;
43
- };
44
- export declare function useBlocker<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = false>(opts: UseBlockerOpts<TRouter, TWithResolver>): TWithResolver extends true ? BlockerResolver<TRouter> : void;
45
- /**
46
- * @deprecated Use the shouldBlockFn property instead
47
- */
48
- export declare function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver;
49
- /**
50
- * @deprecated Use the UseBlockerOpts object syntax instead
51
- */
52
- export declare function useBlocker(blockerFn?: LegacyBlockerFn, condition?: boolean | any): BlockerResolver;
53
- export declare function Block<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean>(opts: PromptProps<TRouter, TWithResolver>): React.ReactNode;
54
- /**
55
- * @deprecated Use the UseBlockerOpts property instead
56
- */
57
- export declare function Block(opts: LegacyPromptProps): React.ReactNode;
58
- type LegacyPromptProps = {
59
- blockerFn?: LegacyBlockerFn;
60
- condition?: boolean | any;
61
- children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode);
62
- };
63
- type PromptProps<TRouter extends AnyRouter = RegisteredRouter, TWithResolver extends boolean = boolean, TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void> = UseBlockerOpts<TRouter, TWithResolver> & {
64
- children?: React.ReactNode | ((params: TParams) => React.ReactNode);
65
- };
66
- export {};