react-router 7.18.0 → 8.0.0-pre.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.
Files changed (285) hide show
  1. package/dist/development/dom-export.d.ts +6 -172
  2. package/dist/development/dom-export.js +12 -1009
  3. package/dist/development/index-react-server-client.d.ts +7 -4
  4. package/dist/development/index-react-server-client.js +8 -52
  5. package/dist/development/index-react-server.d.ts +1650 -1641
  6. package/dist/development/index-react-server.js +2882 -3664
  7. package/dist/development/index.d.ts +42 -1476
  8. package/dist/development/index.js +36 -2553
  9. package/dist/development/lib/actions.js +50 -0
  10. package/dist/development/lib/components.d.ts +1030 -0
  11. package/dist/development/lib/components.js +841 -0
  12. package/dist/development/lib/context.d.ts +83 -0
  13. package/dist/development/lib/context.js +41 -0
  14. package/dist/development/lib/dom/dom.d.ts +119 -0
  15. package/dist/development/lib/dom/dom.js +143 -0
  16. package/dist/development/lib/dom/lib.d.ts +2053 -0
  17. package/dist/development/lib/dom/lib.js +1271 -0
  18. package/dist/development/lib/dom/server.d.ts +138 -0
  19. package/dist/development/lib/dom/server.js +301 -0
  20. package/dist/development/lib/dom/ssr/components.d.ts +198 -0
  21. package/dist/development/lib/dom/ssr/components.js +589 -0
  22. package/dist/development/lib/dom/ssr/data.js +29 -0
  23. package/dist/development/lib/dom/ssr/entry.d.ts +60 -0
  24. package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
  25. package/dist/development/lib/dom/ssr/errorBoundaries.js +87 -0
  26. package/dist/development/lib/dom/ssr/fallback.js +33 -0
  27. package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
  28. package/dist/development/lib/dom/ssr/fog-of-war.js +180 -0
  29. package/dist/development/lib/dom/ssr/hydration.d.ts +32 -0
  30. package/dist/development/lib/dom/ssr/hydration.js +29 -0
  31. package/dist/development/lib/dom/ssr/invariant.js +16 -0
  32. package/dist/development/lib/dom/ssr/links.js +170 -0
  33. package/dist/development/lib/dom/ssr/markup.js +24 -0
  34. package/dist/development/lib/dom/ssr/routeModules.d.ts +206 -0
  35. package/dist/development/lib/dom/ssr/routeModules.js +31 -0
  36. package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +62 -0
  37. package/dist/development/lib/dom/ssr/routes-test-stub.js +108 -0
  38. package/dist/development/lib/dom/ssr/routes.d.ts +33 -0
  39. package/dist/development/lib/dom/ssr/routes.js +303 -0
  40. package/dist/development/lib/dom/ssr/server.d.ts +48 -0
  41. package/dist/development/lib/dom/ssr/server.js +69 -0
  42. package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
  43. package/dist/development/lib/dom/ssr/single-fetch.js +345 -0
  44. package/dist/development/lib/dom-export/dom-router-provider.d.ts +9 -0
  45. package/dist/development/lib/dom-export/dom-router-provider.js +22 -0
  46. package/dist/development/lib/dom-export/hydrated-router.d.ts +125 -0
  47. package/dist/development/lib/dom-export/hydrated-router.js +150 -0
  48. package/dist/development/lib/errors.js +29 -0
  49. package/dist/development/lib/hooks.d.ts +947 -0
  50. package/dist/development/lib/hooks.js +1388 -0
  51. package/dist/development/lib/href.d.ts +20 -0
  52. package/dist/development/lib/href.js +50 -0
  53. package/dist/development/lib/router/history.d.ts +258 -0
  54. package/dist/development/lib/router/history.js +372 -0
  55. package/dist/development/lib/router/instrumentation.d.ts +86 -0
  56. package/dist/development/lib/router/instrumentation.js +213 -0
  57. package/dist/development/lib/router/links.d.ts +114 -0
  58. package/dist/development/lib/router/router.d.ts +663 -0
  59. package/dist/development/lib/router/router.js +2988 -0
  60. package/dist/development/lib/router/url.js +18 -0
  61. package/dist/development/lib/router/utils.d.ts +948 -0
  62. package/dist/development/lib/router/utils.js +810 -0
  63. package/dist/development/lib/rsc/browser.d.ts +137 -0
  64. package/dist/development/lib/rsc/browser.js +603 -0
  65. package/dist/development/lib/rsc/errorBoundaries.d.ts +11 -0
  66. package/dist/development/lib/rsc/errorBoundaries.js +90 -0
  67. package/dist/development/lib/rsc/html-stream/browser.d.ts +48 -0
  68. package/dist/development/lib/rsc/html-stream/browser.js +74 -0
  69. package/dist/development/lib/rsc/html-stream/server.js +78 -0
  70. package/dist/development/lib/rsc/route-modules.js +27 -0
  71. package/dist/development/lib/rsc/server.rsc.d.ts +219 -0
  72. package/dist/development/lib/rsc/server.ssr.d.ts +129 -0
  73. package/dist/development/lib/rsc/server.ssr.js +404 -0
  74. package/dist/development/lib/server-runtime/build.d.ts +66 -0
  75. package/dist/development/lib/server-runtime/cookies.d.ts +66 -0
  76. package/dist/development/lib/server-runtime/cookies.js +139 -0
  77. package/dist/development/lib/server-runtime/crypto.js +43 -0
  78. package/dist/development/lib/server-runtime/data.d.ts +13 -0
  79. package/dist/development/lib/server-runtime/data.js +25 -0
  80. package/dist/development/lib/server-runtime/dev.d.ts +9 -0
  81. package/dist/development/lib/server-runtime/dev.js +26 -0
  82. package/dist/development/lib/server-runtime/entry.js +20 -0
  83. package/dist/development/lib/server-runtime/errors.js +75 -0
  84. package/dist/development/lib/server-runtime/headers.js +73 -0
  85. package/dist/development/lib/server-runtime/invariant.js +19 -0
  86. package/dist/development/lib/server-runtime/mode.d.ts +12 -0
  87. package/dist/development/lib/server-runtime/mode.js +25 -0
  88. package/dist/development/lib/server-runtime/routeMatching.js +28 -0
  89. package/dist/development/lib/server-runtime/routes.d.ts +13 -0
  90. package/dist/development/lib/server-runtime/routes.js +74 -0
  91. package/dist/development/lib/server-runtime/server.d.ts +10 -0
  92. package/dist/development/lib/server-runtime/server.js +345 -0
  93. package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
  94. package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
  95. package/dist/development/lib/server-runtime/sessions/cookieStorage.js +45 -0
  96. package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
  97. package/dist/development/lib/server-runtime/sessions/memoryStorage.js +52 -0
  98. package/dist/development/lib/server-runtime/sessions.d.ts +145 -0
  99. package/dist/development/lib/server-runtime/sessions.js +98 -0
  100. package/dist/development/lib/server-runtime/single-fetch.d.ts +7 -0
  101. package/dist/development/lib/server-runtime/single-fetch.js +215 -0
  102. package/dist/development/lib/server-runtime/urls.js +28 -0
  103. package/dist/development/lib/server-runtime/warnings.js +20 -0
  104. package/dist/development/lib/types/future.d.ts +9 -0
  105. package/dist/development/lib/types/internal.d.ts +26 -177
  106. package/dist/development/lib/types/internal.js +3 -2
  107. package/dist/development/{register-roq_0qYo.d.ts → lib/types/register.d.ts} +9 -15
  108. package/dist/development/lib/types/route-data.d.ts +113 -0
  109. package/dist/development/lib/types/route-module-annotations.d.ts +149 -0
  110. package/dist/development/lib/types/route-module.d.ts +19 -0
  111. package/dist/development/lib/types/serializes-to.d.ts +13 -0
  112. package/dist/development/lib/types/utils.d.ts +11 -0
  113. package/dist/development/vendor/turbo-stream-v2/flatten.js +159 -0
  114. package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +179 -0
  115. package/dist/development/vendor/turbo-stream-v2/unflatten.js +199 -0
  116. package/dist/development/vendor/turbo-stream-v2/utils.js +39 -0
  117. package/dist/production/dom-export.d.ts +6 -172
  118. package/dist/production/dom-export.js +12 -1009
  119. package/dist/production/index-react-server-client.d.ts +7 -4
  120. package/dist/production/index-react-server-client.js +8 -52
  121. package/dist/production/index-react-server.d.ts +1650 -1641
  122. package/dist/production/index-react-server.js +2873 -3664
  123. package/dist/production/index.d.ts +42 -1476
  124. package/dist/production/index.js +36 -2553
  125. package/dist/production/lib/actions.js +50 -0
  126. package/dist/production/lib/components.d.ts +1030 -0
  127. package/dist/production/lib/components.js +841 -0
  128. package/dist/production/lib/context.d.ts +83 -0
  129. package/dist/production/lib/context.js +41 -0
  130. package/dist/production/lib/dom/dom.d.ts +119 -0
  131. package/dist/production/lib/dom/dom.js +143 -0
  132. package/dist/production/lib/dom/lib.d.ts +2053 -0
  133. package/dist/production/lib/dom/lib.js +1271 -0
  134. package/dist/production/lib/dom/server.d.ts +138 -0
  135. package/dist/production/lib/dom/server.js +301 -0
  136. package/dist/production/lib/dom/ssr/components.d.ts +198 -0
  137. package/dist/production/lib/dom/ssr/components.js +589 -0
  138. package/dist/production/lib/dom/ssr/data.js +29 -0
  139. package/dist/production/lib/dom/ssr/entry.d.ts +60 -0
  140. package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
  141. package/dist/production/lib/dom/ssr/errorBoundaries.js +87 -0
  142. package/dist/production/lib/dom/ssr/fallback.js +23 -0
  143. package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
  144. package/dist/production/lib/dom/ssr/fog-of-war.js +180 -0
  145. package/dist/production/lib/dom/ssr/hydration.d.ts +32 -0
  146. package/dist/production/lib/dom/ssr/hydration.js +29 -0
  147. package/dist/production/lib/dom/ssr/invariant.js +16 -0
  148. package/dist/production/lib/dom/ssr/links.js +170 -0
  149. package/dist/production/lib/dom/ssr/markup.js +24 -0
  150. package/dist/production/lib/dom/ssr/routeModules.d.ts +206 -0
  151. package/dist/production/lib/dom/ssr/routeModules.js +31 -0
  152. package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +62 -0
  153. package/dist/production/lib/dom/ssr/routes-test-stub.js +108 -0
  154. package/dist/production/lib/dom/ssr/routes.d.ts +33 -0
  155. package/dist/production/lib/dom/ssr/routes.js +303 -0
  156. package/dist/production/lib/dom/ssr/server.d.ts +48 -0
  157. package/dist/production/lib/dom/ssr/server.js +69 -0
  158. package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
  159. package/dist/production/lib/dom/ssr/single-fetch.js +345 -0
  160. package/dist/production/lib/dom-export/dom-router-provider.d.ts +9 -0
  161. package/dist/production/lib/dom-export/dom-router-provider.js +22 -0
  162. package/dist/production/lib/dom-export/hydrated-router.d.ts +125 -0
  163. package/dist/production/lib/dom-export/hydrated-router.js +150 -0
  164. package/dist/production/lib/errors.js +29 -0
  165. package/dist/production/lib/hooks.d.ts +947 -0
  166. package/dist/production/lib/hooks.js +1373 -0
  167. package/dist/production/lib/href.d.ts +20 -0
  168. package/dist/production/lib/href.js +50 -0
  169. package/dist/production/lib/router/history.d.ts +258 -0
  170. package/dist/production/lib/router/history.js +372 -0
  171. package/dist/production/lib/router/instrumentation.d.ts +86 -0
  172. package/dist/production/lib/router/instrumentation.js +213 -0
  173. package/dist/production/lib/router/links.d.ts +114 -0
  174. package/dist/production/lib/router/router.d.ts +663 -0
  175. package/dist/production/lib/router/router.js +2988 -0
  176. package/dist/production/lib/router/url.js +18 -0
  177. package/dist/production/lib/router/utils.d.ts +948 -0
  178. package/dist/production/lib/router/utils.js +801 -0
  179. package/dist/production/lib/rsc/browser.d.ts +137 -0
  180. package/dist/production/lib/rsc/browser.js +603 -0
  181. package/dist/production/lib/rsc/errorBoundaries.d.ts +11 -0
  182. package/dist/production/lib/rsc/errorBoundaries.js +90 -0
  183. package/dist/production/lib/rsc/html-stream/browser.d.ts +48 -0
  184. package/dist/production/lib/rsc/html-stream/browser.js +74 -0
  185. package/dist/production/lib/rsc/html-stream/server.js +78 -0
  186. package/dist/production/lib/rsc/route-modules.js +27 -0
  187. package/dist/production/lib/rsc/server.rsc.d.ts +219 -0
  188. package/dist/production/lib/rsc/server.ssr.d.ts +129 -0
  189. package/dist/production/lib/rsc/server.ssr.js +404 -0
  190. package/dist/production/lib/server-runtime/build.d.ts +66 -0
  191. package/dist/production/lib/server-runtime/cookies.d.ts +66 -0
  192. package/dist/production/lib/server-runtime/cookies.js +139 -0
  193. package/dist/production/lib/server-runtime/crypto.js +43 -0
  194. package/dist/production/lib/server-runtime/data.d.ts +13 -0
  195. package/dist/production/lib/server-runtime/data.js +25 -0
  196. package/dist/production/lib/server-runtime/dev.d.ts +9 -0
  197. package/dist/production/lib/server-runtime/dev.js +26 -0
  198. package/dist/production/lib/server-runtime/entry.js +20 -0
  199. package/dist/production/lib/server-runtime/errors.js +75 -0
  200. package/dist/production/lib/server-runtime/headers.js +73 -0
  201. package/dist/production/lib/server-runtime/invariant.js +19 -0
  202. package/dist/production/lib/server-runtime/mode.d.ts +12 -0
  203. package/dist/production/lib/server-runtime/mode.js +25 -0
  204. package/dist/production/lib/server-runtime/routeMatching.js +28 -0
  205. package/dist/production/lib/server-runtime/routes.d.ts +13 -0
  206. package/dist/production/lib/server-runtime/routes.js +74 -0
  207. package/dist/production/lib/server-runtime/server.d.ts +10 -0
  208. package/dist/production/lib/server-runtime/server.js +345 -0
  209. package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
  210. package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
  211. package/dist/production/lib/server-runtime/sessions/cookieStorage.js +45 -0
  212. package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
  213. package/dist/production/lib/server-runtime/sessions/memoryStorage.js +52 -0
  214. package/dist/production/lib/server-runtime/sessions.d.ts +145 -0
  215. package/dist/production/lib/server-runtime/sessions.js +98 -0
  216. package/dist/production/lib/server-runtime/single-fetch.d.ts +7 -0
  217. package/dist/production/lib/server-runtime/single-fetch.js +215 -0
  218. package/dist/production/lib/server-runtime/urls.js +28 -0
  219. package/dist/production/lib/server-runtime/warnings.js +20 -0
  220. package/dist/production/lib/types/future.d.ts +9 -0
  221. package/dist/production/lib/types/internal.d.ts +26 -177
  222. package/dist/production/lib/types/internal.js +3 -2
  223. package/dist/production/{register-roq_0qYo.d.ts → lib/types/register.d.ts} +9 -15
  224. package/dist/production/lib/types/route-data.d.ts +113 -0
  225. package/dist/production/lib/types/route-module-annotations.d.ts +149 -0
  226. package/dist/production/lib/types/route-module.d.ts +19 -0
  227. package/dist/production/lib/types/serializes-to.d.ts +13 -0
  228. package/dist/production/lib/types/utils.d.ts +11 -0
  229. package/dist/production/vendor/turbo-stream-v2/flatten.js +159 -0
  230. package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +179 -0
  231. package/dist/production/vendor/turbo-stream-v2/unflatten.js +199 -0
  232. package/dist/production/vendor/turbo-stream-v2/utils.js +39 -0
  233. package/docs/explanation/code-splitting.md +16 -0
  234. package/docs/how-to/middleware.md +6 -41
  235. package/docs/how-to/react-server-components.md +1 -1
  236. package/docs/upgrading/future.md +0 -249
  237. package/package.json +43 -87
  238. package/dist/development/browser-B2PdsXXH.d.ts +0 -318
  239. package/dist/development/browser-DBmQ1yAR.d.mts +0 -318
  240. package/dist/development/chunk-4ZMWKKQ3.mjs +0 -11606
  241. package/dist/development/chunk-E4MTK73K.mjs +0 -2517
  242. package/dist/development/chunk-U7ORXROY.js +0 -10307
  243. package/dist/development/chunk-WW7PN6QI.js +0 -188
  244. package/dist/development/chunk-YL5M26XI.js +0 -1366
  245. package/dist/development/context-CeD5LmaF.d.mts +0 -1779
  246. package/dist/development/data-CjO11-hU.d.ts +0 -1740
  247. package/dist/development/data-DEjBmEfD.d.mts +0 -1740
  248. package/dist/development/dom-export.d.mts +0 -172
  249. package/dist/development/dom-export.mjs +0 -1010
  250. package/dist/development/index-react-server-client-3ykjivgQ.d.ts +0 -3677
  251. package/dist/development/index-react-server-client-CACgcj2J.d.mts +0 -2614
  252. package/dist/development/index-react-server-client.d.mts +0 -4
  253. package/dist/development/index-react-server-client.mjs +0 -59
  254. package/dist/development/index-react-server.d.mts +0 -2711
  255. package/dist/development/index-react-server.mjs +0 -3803
  256. package/dist/development/index.d.mts +0 -1479
  257. package/dist/development/index.mjs +0 -275
  258. package/dist/development/instrumentation-Dkmpzd13.d.ts +0 -715
  259. package/dist/development/lib/types/internal.d.mts +0 -184
  260. package/dist/development/lib/types/internal.mjs +0 -10
  261. package/dist/development/register-CmkRspdl.d.mts +0 -30
  262. package/dist/production/browser-B2PdsXXH.d.ts +0 -318
  263. package/dist/production/browser-DBmQ1yAR.d.mts +0 -318
  264. package/dist/production/chunk-3Z6WS2WZ.js +0 -188
  265. package/dist/production/chunk-BIP66BKV.js +0 -1366
  266. package/dist/production/chunk-EGOTSXNH.mjs +0 -2517
  267. package/dist/production/chunk-IUPBOWYO.js +0 -10307
  268. package/dist/production/chunk-M7NGGUU6.mjs +0 -11606
  269. package/dist/production/context-CeD5LmaF.d.mts +0 -1779
  270. package/dist/production/data-CjO11-hU.d.ts +0 -1740
  271. package/dist/production/data-DEjBmEfD.d.mts +0 -1740
  272. package/dist/production/dom-export.d.mts +0 -172
  273. package/dist/production/dom-export.mjs +0 -1010
  274. package/dist/production/index-react-server-client-3ykjivgQ.d.ts +0 -3677
  275. package/dist/production/index-react-server-client-CACgcj2J.d.mts +0 -2614
  276. package/dist/production/index-react-server-client.d.mts +0 -4
  277. package/dist/production/index-react-server-client.mjs +0 -59
  278. package/dist/production/index-react-server.d.mts +0 -2711
  279. package/dist/production/index-react-server.mjs +0 -3803
  280. package/dist/production/index.d.mts +0 -1479
  281. package/dist/production/index.mjs +0 -275
  282. package/dist/production/instrumentation-Dkmpzd13.d.ts +0 -715
  283. package/dist/production/lib/types/internal.d.mts +0 -184
  284. package/dist/production/lib/types/internal.mjs +0 -10
  285. package/dist/production/register-CmkRspdl.d.mts +0 -30
@@ -0,0 +1,1030 @@
1
+
2
+ import { Action, InitialEntry, Location, To } from "./router/history.js";
3
+ import { DataStrategyFunction, IndexRouteObject, LazyRouteFunction, NonIndexRouteObject, Params, PatchRoutesOnNavigationFunction, RouteMatch, RouteObject, UIMatch } from "./router/utils.js";
4
+ import { FutureConfig, HydrationState, RelativeRoutingType, Router as Router$1, RouterInit } from "./router/router.js";
5
+ import { Navigator } from "./context.js";
6
+ import { ClientInstrumentation } from "./router/instrumentation.js";
7
+ import * as React$1 from "react";
8
+
9
+ //#region lib/components.d.ts
10
+ declare const hydrationRouteProperties: (keyof RouteObject)[];
11
+ /**
12
+ * @category Data Routers
13
+ */
14
+ interface MemoryRouterOpts {
15
+ /**
16
+ * Basename path for the application.
17
+ */
18
+ basename?: string;
19
+ /**
20
+ * A function that returns an {@link RouterContextProvider} instance
21
+ * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
22
+ * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
23
+ * This function is called to generate a fresh `context` instance on each
24
+ * navigation or fetcher call.
25
+ */
26
+ getContext?: RouterInit["getContext"];
27
+ /**
28
+ * Future flags to enable for the router.
29
+ */
30
+ future?: Partial<FutureConfig>;
31
+ /**
32
+ * Hydration data to initialize the router with if you have already performed
33
+ * data loading on the server.
34
+ */
35
+ hydrationData?: HydrationState;
36
+ /**
37
+ * Initial entries in the in-memory history stack
38
+ */
39
+ initialEntries?: InitialEntry[];
40
+ /**
41
+ * Index of `initialEntries` the application should initialize to
42
+ */
43
+ initialIndex?: number;
44
+ /**
45
+ * Array of instrumentation objects allowing you to instrument the router and
46
+ * individual routes prior to router initialization (and on any subsequently
47
+ * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
48
+ * mostly useful for observability such as wrapping navigations, fetches,
49
+ * as well as route loaders/actions/middlewares with logging and/or performance
50
+ * tracing. See the [docs](../../how-to/instrumentation) for more information.
51
+ *
52
+ * ```tsx
53
+ * let router = createBrowserRouter(routes, {
54
+ * instrumentations: [logging]
55
+ * });
56
+ *
57
+ *
58
+ * let logging = {
59
+ * router({ instrument }) {
60
+ * instrument({
61
+ * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl),
62
+ * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl)
63
+ * });
64
+ * },
65
+ * route({ instrument, id }) {
66
+ * instrument({
67
+ * middleware: (impl, info) => logExecution(
68
+ * `middleware ${info.request.url} (route ${id})`,
69
+ * impl
70
+ * ),
71
+ * loader: (impl, info) => logExecution(
72
+ * `loader ${info.request.url} (route ${id})`,
73
+ * impl
74
+ * ),
75
+ * action: (impl, info) => logExecution(
76
+ * `action ${info.request.url} (route ${id})`,
77
+ * impl
78
+ * ),
79
+ * })
80
+ * }
81
+ * };
82
+ *
83
+ * async function logExecution(label: string, impl: () => Promise<void>) {
84
+ * let start = performance.now();
85
+ * console.log(`start ${label}`);
86
+ * await impl();
87
+ * let duration = Math.round(performance.now() - start);
88
+ * console.log(`end ${label} (${duration}ms)`);
89
+ * }
90
+ * ```
91
+ */
92
+ instrumentations?: ClientInstrumentation[];
93
+ /**
94
+ * Override the default data strategy of running loaders in parallel -
95
+ * see the [docs](../../how-to/data-strategy) for more information.
96
+ *
97
+ * ```tsx
98
+ * let router = createBrowserRouter(routes, {
99
+ * async dataStrategy({
100
+ * matches,
101
+ * request,
102
+ * runClientMiddleware,
103
+ * }) {
104
+ * const matchesToLoad = matches.filter((m) =>
105
+ * m.shouldCallHandler(),
106
+ * );
107
+ *
108
+ * const results: Record<string, DataStrategyResult> = {};
109
+ * await runClientMiddleware(() =>
110
+ * Promise.all(
111
+ * matchesToLoad.map(async (match) => {
112
+ * results[match.route.id] = await match.resolve();
113
+ * }),
114
+ * ),
115
+ * );
116
+ * return results;
117
+ * },
118
+ * });
119
+ * ```
120
+ */
121
+ dataStrategy?: DataStrategyFunction;
122
+ /**
123
+ * Lazily define portions of the route tree on navigations.
124
+ */
125
+ patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
126
+ }
127
+ /**
128
+ * Create a new {@link DataRouter} that manages the application path using an
129
+ * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
130
+ * stack. Useful for non-browser environments without a DOM API.
131
+ *
132
+ * Data Routers should not be held in React state. You should create your router
133
+ * once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
134
+ * You can use `patchRoutesOnNavigation` to add additional routes programmatically.
135
+ *
136
+ * @public
137
+ * @category Data Routers
138
+ * @mode data
139
+ * @param routes Application routes
140
+ * @param opts Options
141
+ * @param {MemoryRouterOpts.basename} opts.basename n/a
142
+ * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a
143
+ * @param {MemoryRouterOpts.future} opts.future n/a
144
+ * @param {MemoryRouterOpts.getContext} opts.getContext n/a
145
+ * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
146
+ * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
147
+ * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
148
+ * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a
149
+ * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
150
+ * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
151
+ */
152
+ declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1;
153
+ /**
154
+ * Function signature for client side error handling for loader/actions errors
155
+ * and rendering errors via `componentDidCatch`
156
+ */
157
+ interface ClientOnErrorFunction {
158
+ (error: unknown, info: {
159
+ location: Location;
160
+ params: Params;
161
+ pattern: string;
162
+ errorInfo?: React$1.ErrorInfo;
163
+ }): void;
164
+ }
165
+ /**
166
+ * @category Types
167
+ */
168
+ interface RouterProviderProps {
169
+ /**
170
+ * The {@link DataRouter} instance to use for navigation and data fetching. The
171
+ * router prop should be a single router instance created outside of the React
172
+ * tree. Avoid creating new routers during React renders/re-renders.
173
+ */
174
+ router: Router$1;
175
+ /**
176
+ * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync)
177
+ * implementation to use for flushing updates.
178
+ *
179
+ * You usually don't have to worry about this:
180
+ * - The `RouterProvider` exported from `react-router/dom` handles this internally for you
181
+ * - If you are rendering in a non-DOM environment, you can import
182
+ * `RouterProvider` from `react-router` and ignore this prop
183
+ */
184
+ flushSync?: <R>(fn: () => R) => R;
185
+ /**
186
+ * An error handler function that will be called for any middleware, loader, action,
187
+ * or render errors that are encountered in your application. This is useful for
188
+ * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not
189
+ * subject to re-rendering and will only run one time per error.
190
+ *
191
+ * The `errorInfo` parameter is passed along from
192
+ * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch)
193
+ * and is only present for render errors.
194
+ *
195
+ * ```tsx
196
+ * <RouterProvider onError={(error, info) => {
197
+ * let { location, params, pattern, errorInfo } = info;
198
+ * console.error(error, location, errorInfo);
199
+ * reportToErrorService(error, location, errorInfo);
200
+ * }} />
201
+ * ```
202
+ */
203
+ onError?: ClientOnErrorFunction;
204
+ /**
205
+ * Control whether router state updates are internally wrapped in
206
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
207
+ *
208
+ * - When left `undefined`, all state updates are wrapped in
209
+ * `React.startTransition`
210
+ * - This can lead to buggy behaviors if you are wrapping your own
211
+ * navigations/fetchers in `startTransition`.
212
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
213
+ * in `React.startTransition` and router state changes will be wrapped in
214
+ * `React.startTransition` and also sent through
215
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
216
+ * surface mid-navigation router state changes to the UI.
217
+ * - When set to `false`, the router will not leverage `React.startTransition` or
218
+ * `React.useOptimistic` on any navigations or state changes.
219
+ *
220
+ * For more information, please see the [docs](../../explanation/react-transitions).
221
+ */
222
+ useTransitions?: boolean;
223
+ }
224
+ /**
225
+ * Render the UI for the given {@link DataRouter}. This component should
226
+ * typically be at the top of an app's element tree. The router prop should
227
+ * be a single router instance created outside of the React tree. Avoid
228
+ * creating new routers during React renders/re-renders.
229
+ *
230
+ * ```tsx
231
+ * import { createBrowserRouter } from "react-router";
232
+ * import { RouterProvider } from "react-router/dom";
233
+ * import { createRoot } from "react-dom/client";
234
+ *
235
+ * const router = createBrowserRouter(routes);
236
+ * createRoot(document.getElementById("root")).render(
237
+ * <RouterProvider router={router} />
238
+ * );
239
+ * ```
240
+ *
241
+ * <docs-info>Please note that this component is exported both from
242
+ * `react-router` and `react-router/dom` with the only difference being that the
243
+ * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync)
244
+ * implementation. You _almost always_ want to use the version from
245
+ * `react-router/dom` unless you're running in a non-DOM environment.</docs-info>
246
+ *
247
+ *
248
+ * @public
249
+ * @category Data Routers
250
+ * @mode data
251
+ * @param props Props
252
+ * @param {RouterProviderProps.flushSync} props.flushSync n/a
253
+ * @param {RouterProviderProps.onError} props.onError n/a
254
+ * @param {RouterProviderProps.router} props.router n/a
255
+ * @param {RouterProviderProps.useTransitions} props.useTransitions n/a
256
+ * @returns React element for the rendered router
257
+ */
258
+ declare function RouterProvider({
259
+ router,
260
+ flushSync: reactDomFlushSyncImpl,
261
+ onError,
262
+ useTransitions
263
+ }: RouterProviderProps): React$1.ReactElement;
264
+ /**
265
+ * @category Types
266
+ */
267
+ interface MemoryRouterProps {
268
+ /**
269
+ * Application basename
270
+ */
271
+ basename?: string;
272
+ /**
273
+ * Nested {@link Route} elements describing the route tree
274
+ */
275
+ children?: React$1.ReactNode;
276
+ /**
277
+ * Initial entries in the in-memory history stack
278
+ */
279
+ initialEntries?: InitialEntry[];
280
+ /**
281
+ * Index of `initialEntries` the application should initialize to
282
+ */
283
+ initialIndex?: number;
284
+ /**
285
+ * Control whether router state updates are internally wrapped in
286
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
287
+ *
288
+ * - When left `undefined`, all router state updates are wrapped in
289
+ * `React.startTransition`
290
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
291
+ * in `React.startTransition` and all router state updates are wrapped in
292
+ * `React.startTransition`
293
+ * - When set to `false`, the router will not leverage `React.startTransition`
294
+ * on any navigations or state changes.
295
+ *
296
+ * For more information, please see the [docs](../../explanation/react-transitions).
297
+ */
298
+ useTransitions?: boolean;
299
+ }
300
+ /**
301
+ * A declarative {@link Router | `<Router>`} that stores all entries in memory.
302
+ *
303
+ * @public
304
+ * @category Declarative Routers
305
+ * @mode declarative
306
+ * @param props Props
307
+ * @param {MemoryRouterProps.basename} props.basename n/a
308
+ * @param {MemoryRouterProps.children} props.children n/a
309
+ * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
310
+ * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
311
+ * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a
312
+ * @returns A declarative in-memory {@link Router | `<Router>`} for client-side
313
+ * routing.
314
+ */
315
+ declare function MemoryRouter({
316
+ basename,
317
+ children,
318
+ initialEntries,
319
+ initialIndex,
320
+ useTransitions
321
+ }: MemoryRouterProps): React$1.ReactElement;
322
+ /**
323
+ * @category Types
324
+ */
325
+ interface NavigateProps {
326
+ /**
327
+ * The path to navigate to. This can be a string or a {@link Path} object
328
+ */
329
+ to: To;
330
+ /**
331
+ * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
332
+ * stack
333
+ */
334
+ replace?: boolean;
335
+ /**
336
+ * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
337
+ */
338
+ state?: any;
339
+ /**
340
+ * How to interpret relative routing in the `to` prop.
341
+ * See {@link RelativeRoutingType}.
342
+ */
343
+ relative?: RelativeRoutingType;
344
+ }
345
+ /**
346
+ * A component-based version of {@link useNavigate} to use in a
347
+ * [`React.Component` class](https://react.dev/reference/react/Component) where
348
+ * hooks cannot be used.
349
+ *
350
+ * It's recommended to avoid using this component in favor of {@link useNavigate}.
351
+ *
352
+ * @example
353
+ * <Navigate to="/tasks" />
354
+ *
355
+ * @public
356
+ * @category Components
357
+ * @param props Props
358
+ * @param {NavigateProps.relative} props.relative n/a
359
+ * @param {NavigateProps.replace} props.replace n/a
360
+ * @param {NavigateProps.state} props.state n/a
361
+ * @param {NavigateProps.to} props.to n/a
362
+ * @returns {void}
363
+ *
364
+ */
365
+ declare function Navigate({
366
+ to,
367
+ replace,
368
+ state,
369
+ relative
370
+ }: NavigateProps): null;
371
+ /**
372
+ * @category Types
373
+ */
374
+ interface OutletProps {
375
+ /**
376
+ * Provides a context value to the element tree below the outlet. Use when
377
+ * the parent route needs to provide values to child routes.
378
+ *
379
+ * ```tsx
380
+ * <Outlet context={myContextValue} />
381
+ * ```
382
+ *
383
+ * Access the context with {@link useOutletContext}.
384
+ */
385
+ context?: unknown;
386
+ }
387
+ /**
388
+ * Renders the matching child route of a parent route or nothing if no child
389
+ * route matches.
390
+ *
391
+ * @example
392
+ * import { Outlet } from "react-router";
393
+ *
394
+ * export default function SomeParent() {
395
+ * return (
396
+ * <div>
397
+ * <h1>Parent Content</h1>
398
+ * <Outlet />
399
+ * </div>
400
+ * );
401
+ * }
402
+ *
403
+ * @public
404
+ * @category Components
405
+ * @param props Props
406
+ * @param {OutletProps.context} props.context n/a
407
+ * @returns React element for the rendered outlet or `null` if no child route matches.
408
+ */
409
+ declare function Outlet(props: OutletProps): React$1.ReactElement | null;
410
+ /**
411
+ * @category Types
412
+ */
413
+ interface PathRouteProps {
414
+ /**
415
+ * Whether the path should be case-sensitive. Defaults to `false`.
416
+ */
417
+ caseSensitive?: NonIndexRouteObject["caseSensitive"];
418
+ /**
419
+ * The path pattern to match. If unspecified or empty, then this becomes a
420
+ * layout route.
421
+ */
422
+ path?: NonIndexRouteObject["path"];
423
+ /**
424
+ * The unique identifier for this route (for use with {@link DataRouter}s)
425
+ */
426
+ id?: NonIndexRouteObject["id"];
427
+ /**
428
+ * A function that returns a promise that resolves to the route object.
429
+ * Used for code-splitting routes.
430
+ * See [`lazy`](../../start/data/route-object#lazy).
431
+ */
432
+ lazy?: LazyRouteFunction<NonIndexRouteObject>;
433
+ /**
434
+ * The route middleware.
435
+ * See [`middleware`](../../start/data/route-object#middleware).
436
+ */
437
+ middleware?: NonIndexRouteObject["middleware"];
438
+ /**
439
+ * The route loader.
440
+ * See [`loader`](../../start/data/route-object#loader).
441
+ */
442
+ loader?: NonIndexRouteObject["loader"];
443
+ /**
444
+ * The route action.
445
+ * See [`action`](../../start/data/route-object#action).
446
+ */
447
+ action?: NonIndexRouteObject["action"];
448
+ /**
449
+ * The route shouldRevalidate function.
450
+ * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
451
+ */
452
+ shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
453
+ /**
454
+ * The route handle.
455
+ */
456
+ handle?: NonIndexRouteObject["handle"];
457
+ /**
458
+ * Whether this is an index route.
459
+ */
460
+ index?: false;
461
+ /**
462
+ * Child Route components
463
+ */
464
+ children?: React$1.ReactNode;
465
+ /**
466
+ * The React element to render when this Route matches.
467
+ * Mutually exclusive with `Component`.
468
+ */
469
+ element?: React$1.ReactNode | null;
470
+ /**
471
+ * The React element to render while this router is loading data.
472
+ * Mutually exclusive with `HydrateFallback`.
473
+ */
474
+ hydrateFallbackElement?: React$1.ReactNode | null;
475
+ /**
476
+ * The React element to render at this route if an error occurs.
477
+ * Mutually exclusive with `ErrorBoundary`.
478
+ */
479
+ errorElement?: React$1.ReactNode | null;
480
+ /**
481
+ * The React Component to render when this route matches.
482
+ * Mutually exclusive with `element`.
483
+ */
484
+ Component?: React$1.ComponentType | null;
485
+ /**
486
+ * The React Component to render while this router is loading data.
487
+ * Mutually exclusive with `hydrateFallbackElement`.
488
+ */
489
+ HydrateFallback?: React$1.ComponentType | null;
490
+ /**
491
+ * The React Component to render at this route if an error occurs.
492
+ * Mutually exclusive with `errorElement`.
493
+ */
494
+ ErrorBoundary?: React$1.ComponentType | null;
495
+ }
496
+ /**
497
+ * @category Types
498
+ */
499
+ interface LayoutRouteProps extends PathRouteProps {}
500
+ /**
501
+ * @category Types
502
+ */
503
+ interface IndexRouteProps {
504
+ /**
505
+ * Whether the path should be case-sensitive. Defaults to `false`.
506
+ */
507
+ caseSensitive?: IndexRouteObject["caseSensitive"];
508
+ /**
509
+ * The path pattern to match. If unspecified or empty, then this becomes a
510
+ * layout route.
511
+ */
512
+ path?: IndexRouteObject["path"];
513
+ /**
514
+ * The unique identifier for this route (for use with {@link DataRouter}s)
515
+ */
516
+ id?: IndexRouteObject["id"];
517
+ /**
518
+ * A function that returns a promise that resolves to the route object.
519
+ * Used for code-splitting routes.
520
+ * See [`lazy`](../../start/data/route-object#lazy).
521
+ */
522
+ lazy?: LazyRouteFunction<IndexRouteObject>;
523
+ /**
524
+ * The route middleware.
525
+ * See [`middleware`](../../start/data/route-object#middleware).
526
+ */
527
+ middleware?: IndexRouteObject["middleware"];
528
+ /**
529
+ * The route loader.
530
+ * See [`loader`](../../start/data/route-object#loader).
531
+ */
532
+ loader?: IndexRouteObject["loader"];
533
+ /**
534
+ * The route action.
535
+ * See [`action`](../../start/data/route-object#action).
536
+ */
537
+ action?: IndexRouteObject["action"];
538
+ /**
539
+ * The route shouldRevalidate function.
540
+ * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
541
+ */
542
+ shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
543
+ /**
544
+ * The route handle.
545
+ */
546
+ handle?: IndexRouteObject["handle"];
547
+ /**
548
+ * Whether this is an index route.
549
+ */
550
+ index: true;
551
+ /**
552
+ * Child Route components
553
+ */
554
+ children?: undefined;
555
+ /**
556
+ * The React element to render when this Route matches.
557
+ * Mutually exclusive with `Component`.
558
+ */
559
+ element?: React$1.ReactNode | null;
560
+ /**
561
+ * The React element to render while this router is loading data.
562
+ * Mutually exclusive with `HydrateFallback`.
563
+ */
564
+ hydrateFallbackElement?: React$1.ReactNode | null;
565
+ /**
566
+ * The React element to render at this route if an error occurs.
567
+ * Mutually exclusive with `ErrorBoundary`.
568
+ */
569
+ errorElement?: React$1.ReactNode | null;
570
+ /**
571
+ * The React Component to render when this route matches.
572
+ * Mutually exclusive with `element`.
573
+ */
574
+ Component?: React$1.ComponentType | null;
575
+ /**
576
+ * The React Component to render while this router is loading data.
577
+ * Mutually exclusive with `hydrateFallbackElement`.
578
+ */
579
+ HydrateFallback?: React$1.ComponentType | null;
580
+ /**
581
+ * The React Component to render at this route if an error occurs.
582
+ * Mutually exclusive with `errorElement`.
583
+ */
584
+ ErrorBoundary?: React$1.ComponentType | null;
585
+ }
586
+ /**
587
+ * @category Types
588
+ */
589
+ type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
590
+ /**
591
+ * Configures an element to render when a pattern matches the current location.
592
+ * It must be rendered within a {@link Routes} element. Note that these routes
593
+ * do not participate in data loading, actions, code splitting, or any other
594
+ * route module features.
595
+ *
596
+ * @example
597
+ * // Usually used in a declarative router
598
+ * function App() {
599
+ * return (
600
+ * <BrowserRouter>
601
+ * <Routes>
602
+ * <Route index element={<StepOne />} />
603
+ * <Route path="step-2" element={<StepTwo />} />
604
+ * <Route path="step-3" element={<StepThree />} />
605
+ * </Routes>
606
+ * </BrowserRouter>
607
+ * );
608
+ * }
609
+ *
610
+ * // But can be used with a data router as well if you prefer the JSX notation
611
+ * const routes = createRoutesFromElements(
612
+ * <>
613
+ * <Route index loader={step1Loader} Component={StepOne} />
614
+ * <Route path="step-2" loader={step2Loader} Component={StepTwo} />
615
+ * <Route path="step-3" loader={step3Loader} Component={StepThree} />
616
+ * </>
617
+ * );
618
+ *
619
+ * const router = createBrowserRouter(routes);
620
+ *
621
+ * function App() {
622
+ * return <RouterProvider router={router} />;
623
+ * }
624
+ *
625
+ * @public
626
+ * @category Components
627
+ * @param props Props
628
+ * @param {PathRouteProps.action} props.action n/a
629
+ * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a
630
+ * @param {PathRouteProps.Component} props.Component n/a
631
+ * @param {PathRouteProps.children} props.children n/a
632
+ * @param {PathRouteProps.element} props.element n/a
633
+ * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a
634
+ * @param {PathRouteProps.errorElement} props.errorElement n/a
635
+ * @param {PathRouteProps.handle} props.handle n/a
636
+ * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a
637
+ * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a
638
+ * @param {PathRouteProps.id} props.id n/a
639
+ * @param {PathRouteProps.index} props.index n/a
640
+ * @param {PathRouteProps.lazy} props.lazy n/a
641
+ * @param {PathRouteProps.loader} props.loader n/a
642
+ * @param {PathRouteProps.path} props.path n/a
643
+ * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a
644
+ * @returns {void}
645
+ */
646
+ declare function Route(props: RouteProps): React$1.ReactElement | null;
647
+ /**
648
+ * @category Types
649
+ */
650
+ interface RouterProps {
651
+ /**
652
+ * The base path for the application. This is prepended to all locations
653
+ */
654
+ basename?: string;
655
+ /**
656
+ * Nested {@link Route} elements describing the route tree
657
+ */
658
+ children?: React$1.ReactNode;
659
+ /**
660
+ * The location to match against. Defaults to the current location.
661
+ * This can be a string or a {@link Location} object.
662
+ */
663
+ location: Partial<Location> | string;
664
+ /**
665
+ * The type of navigation that triggered this `location` change.
666
+ * Defaults to {@link NavigationType.Pop}.
667
+ */
668
+ navigationType?: Action;
669
+ /**
670
+ * The navigator to use for navigation. This is usually a history object
671
+ * or a custom navigator that implements the {@link Navigator} interface.
672
+ */
673
+ navigator: Navigator;
674
+ /**
675
+ * Whether this router is static or not (used for SSR). If `true`, the router
676
+ * will not be reactive to location changes.
677
+ */
678
+ static?: boolean;
679
+ /**
680
+ * Control whether router state updates are internally wrapped in
681
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
682
+ *
683
+ * - When left `undefined`, all router state updates are wrapped in
684
+ * `React.startTransition`
685
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
686
+ * in `React.startTransition` and all router state updates are wrapped in
687
+ * `React.startTransition`
688
+ * - When set to `false`, the router will not leverage `React.startTransition`
689
+ * on any navigations or state changes.
690
+ *
691
+ * For more information, please see the [docs](../../explanation/react-transitions).
692
+ */
693
+ useTransitions?: boolean;
694
+ }
695
+ /**
696
+ * Provides location context for the rest of the app.
697
+ *
698
+ * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
699
+ * router that is more specific to your environment such as a {@link BrowserRouter}
700
+ * in web browsers or a {@link ServerRouter} for server rendering.
701
+ *
702
+ * @public
703
+ * @category Declarative Routers
704
+ * @mode declarative
705
+ * @param props Props
706
+ * @param {RouterProps.basename} props.basename n/a
707
+ * @param {RouterProps.children} props.children n/a
708
+ * @param {RouterProps.location} props.location n/a
709
+ * @param {RouterProps.navigationType} props.navigationType n/a
710
+ * @param {RouterProps.navigator} props.navigator n/a
711
+ * @param {RouterProps.static} props.static n/a
712
+ * @param {RouterProps.useTransitions} props.useTransitions n/a
713
+ * @returns React element for the rendered router or `null` if the location does
714
+ * not match the {@link props.basename}
715
+ */
716
+ declare function Router({
717
+ basename: basenameProp,
718
+ children,
719
+ location: locationProp,
720
+ navigationType,
721
+ navigator,
722
+ static: staticProp,
723
+ useTransitions
724
+ }: RouterProps): React$1.ReactElement | null;
725
+ /**
726
+ * @category Types
727
+ */
728
+ interface RoutesProps {
729
+ /**
730
+ * Nested {@link Route} elements
731
+ */
732
+ children?: React$1.ReactNode;
733
+ /**
734
+ * The {@link Location} to match against. Defaults to the current location.
735
+ */
736
+ location?: Partial<Location> | string;
737
+ }
738
+ /**
739
+ * Renders a branch of {@link Route | `<Route>`s} that best matches the current
740
+ * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader),
741
+ * [`action`](../../start/framework/route-module#action), code splitting, or
742
+ * any other [route module](../../start/framework/route-module) features.
743
+ *
744
+ * @example
745
+ * import { Route, Routes } from "react-router";
746
+ *
747
+ * <Routes>
748
+ * <Route index element={<StepOne />} />
749
+ * <Route path="step-2" element={<StepTwo />} />
750
+ * <Route path="step-3" element={<StepThree />} />
751
+ * </Routes>
752
+ *
753
+ * @public
754
+ * @category Components
755
+ * @param props Props
756
+ * @param {RoutesProps.children} props.children n/a
757
+ * @param {RoutesProps.location} props.location n/a
758
+ * @returns React element for the rendered routes or `null` if no route matches
759
+ */
760
+ declare function Routes({
761
+ children,
762
+ location
763
+ }: RoutesProps): React$1.ReactElement | null;
764
+ interface AwaitResolveRenderFunction<Resolve = any> {
765
+ (data: Awaited<Resolve>): React$1.ReactNode;
766
+ }
767
+ /**
768
+ * @category Types
769
+ */
770
+ interface AwaitProps<Resolve> {
771
+ /**
772
+ * When using a function, the resolved value is provided as the parameter.
773
+ *
774
+ * ```tsx [2]
775
+ * <Await resolve={reviewsPromise}>
776
+ * {(resolvedReviews) => <Reviews items={resolvedReviews} />}
777
+ * </Await>
778
+ * ```
779
+ *
780
+ * When using React elements, {@link useAsyncValue} will provide the
781
+ * resolved value:
782
+ *
783
+ * ```tsx [2]
784
+ * <Await resolve={reviewsPromise}>
785
+ * <Reviews />
786
+ * </Await>
787
+ *
788
+ * function Reviews() {
789
+ * const resolvedReviews = useAsyncValue();
790
+ * return <div>...</div>;
791
+ * }
792
+ * ```
793
+ */
794
+ children: React$1.ReactNode | AwaitResolveRenderFunction<Resolve>;
795
+ /**
796
+ * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
797
+ * rejects.
798
+ *
799
+ * ```tsx
800
+ * <Await
801
+ * errorElement={<div>Oops</div>}
802
+ * resolve={reviewsPromise}
803
+ * >
804
+ * <Reviews />
805
+ * </Await>
806
+ * ```
807
+ *
808
+ * To provide a more contextual error, you can use the {@link useAsyncError} in a
809
+ * child component
810
+ *
811
+ * ```tsx
812
+ * <Await
813
+ * errorElement={<ReviewsError />}
814
+ * resolve={reviewsPromise}
815
+ * >
816
+ * <Reviews />
817
+ * </Await>
818
+ *
819
+ * function ReviewsError() {
820
+ * const error = useAsyncError();
821
+ * return <div>Error loading reviews: {error.message}</div>;
822
+ * }
823
+ * ```
824
+ *
825
+ * If you do not provide an `errorElement`, the rejected value will bubble up
826
+ * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
827
+ * and be accessible via the {@link useRouteError} hook.
828
+ */
829
+ errorElement?: React$1.ReactNode;
830
+ /**
831
+ * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
832
+ * returned from a [`loader`](../../start/framework/route-module#loader) to be
833
+ * resolved and rendered.
834
+ *
835
+ * ```tsx
836
+ * import { Await, useLoaderData } from "react-router";
837
+ *
838
+ * export async function loader() {
839
+ * let reviews = getReviews(); // not awaited
840
+ * let book = await getBook();
841
+ * return {
842
+ * book,
843
+ * reviews, // this is a promise
844
+ * };
845
+ * }
846
+ *
847
+ * export default function Book() {
848
+ * const {
849
+ * book,
850
+ * reviews, // this is the same promise
851
+ * } = useLoaderData();
852
+ *
853
+ * return (
854
+ * <div>
855
+ * <h1>{book.title}</h1>
856
+ * <p>{book.description}</p>
857
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
858
+ * <Await
859
+ * // and is the promise we pass to Await
860
+ * resolve={reviews}
861
+ * >
862
+ * <Reviews />
863
+ * </Await>
864
+ * </React.Suspense>
865
+ * </div>
866
+ * );
867
+ * }
868
+ * ```
869
+ */
870
+ resolve: Resolve;
871
+ }
872
+ /**
873
+ * Used to render promise values with automatic error handling.
874
+ *
875
+ * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
876
+ *
877
+ * @example
878
+ * import { Await, useLoaderData } from "react-router";
879
+ *
880
+ * export async function loader() {
881
+ * // not awaited
882
+ * const reviews = getReviews();
883
+ * // awaited (blocks the transition)
884
+ * const book = await fetch("/api/book").then((res) => res.json());
885
+ * return { book, reviews };
886
+ * }
887
+ *
888
+ * function Book() {
889
+ * const { book, reviews } = useLoaderData();
890
+ * return (
891
+ * <div>
892
+ * <h1>{book.title}</h1>
893
+ * <p>{book.description}</p>
894
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
895
+ * <Await
896
+ * resolve={reviews}
897
+ * errorElement={
898
+ * <div>Could not load reviews 😬</div>
899
+ * }
900
+ * children={(resolvedReviews) => (
901
+ * <Reviews items={resolvedReviews} />
902
+ * )}
903
+ * />
904
+ * </React.Suspense>
905
+ * </div>
906
+ * );
907
+ * }
908
+ *
909
+ * @public
910
+ * @category Components
911
+ * @mode framework
912
+ * @mode data
913
+ * @param props Props
914
+ * @param {AwaitProps.children} props.children n/a
915
+ * @param {AwaitProps.errorElement} props.errorElement n/a
916
+ * @param {AwaitProps.resolve} props.resolve n/a
917
+ * @returns React element for the rendered awaited value
918
+ */
919
+ declare function Await<Resolve>({
920
+ children,
921
+ errorElement,
922
+ resolve
923
+ }: AwaitProps<Resolve>): React$1.JSX.Element;
924
+ /**
925
+ * Creates a route config from a React "children" object, which is usually
926
+ * either a `<Route>` element or an array of them. Used internally by
927
+ * `<Routes>` to create a route config from its children.
928
+ *
929
+ * @category Utils
930
+ * @mode data
931
+ * @param children The React children to convert into a route config
932
+ * @param parentPath The path of the parent route, used to generate unique IDs.
933
+ * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
934
+ */
935
+ declare function createRoutesFromChildren(children: React$1.ReactNode, parentPath?: number[]): RouteObject[];
936
+ /**
937
+ * Create route objects from JSX elements instead of arrays of objects.
938
+ *
939
+ * @example
940
+ * const routes = createRoutesFromElements(
941
+ * <>
942
+ * <Route index loader={step1Loader} Component={StepOne} />
943
+ * <Route path="step-2" loader={step2Loader} Component={StepTwo} />
944
+ * <Route path="step-3" loader={step3Loader} Component={StepThree} />
945
+ * </>
946
+ * );
947
+ *
948
+ * const router = createBrowserRouter(routes);
949
+ *
950
+ * function App() {
951
+ * return <RouterProvider router={router} />;
952
+ * }
953
+ *
954
+ * @name createRoutesFromElements
955
+ * @public
956
+ * @category Utils
957
+ * @mode data
958
+ * @param children The React children to convert into a route config
959
+ * @param parentPath The path of the parent route, used to generate unique IDs.
960
+ * This is used for internal recursion and is not intended to be used by the
961
+ * application developer.
962
+ * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
963
+ */
964
+ declare const createRoutesFromElements: typeof createRoutesFromChildren;
965
+ /**
966
+ * Renders the result of {@link matchRoutes} into a React element.
967
+ *
968
+ * @public
969
+ * @category Utils
970
+ * @param matches The array of {@link RouteMatch | route matches} to render
971
+ * @returns A React element that renders the matched routes or `null` if no matches
972
+ */
973
+ declare function renderMatches(matches: RouteMatch[] | null): React$1.ReactElement | null;
974
+ declare function useRouteComponentProps(): {
975
+ params: Readonly<Params<string>>;
976
+ loaderData: any;
977
+ actionData: any;
978
+ matches: UIMatch<unknown, unknown>[];
979
+ };
980
+ type RouteComponentProps = ReturnType<typeof useRouteComponentProps>;
981
+ type RouteComponentType = React$1.ComponentType<RouteComponentProps>;
982
+ declare function WithComponentProps({
983
+ children
984
+ }: {
985
+ children: React$1.ReactElement;
986
+ }): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
987
+ declare function withComponentProps(Component: RouteComponentType): () => React$1.ReactElement<{
988
+ params: Readonly<Params<string>>;
989
+ loaderData: any;
990
+ actionData: any;
991
+ matches: UIMatch<unknown, unknown>[];
992
+ }, string | React$1.JSXElementConstructor<any>>;
993
+ declare function useHydrateFallbackProps(): {
994
+ params: Readonly<Params<string>>;
995
+ loaderData: any;
996
+ actionData: any;
997
+ };
998
+ type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>;
999
+ type HydrateFallbackType = React$1.ComponentType<HydrateFallbackProps>;
1000
+ declare function WithHydrateFallbackProps({
1001
+ children
1002
+ }: {
1003
+ children: React$1.ReactElement;
1004
+ }): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
1005
+ declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React$1.ReactElement<{
1006
+ params: Readonly<Params<string>>;
1007
+ loaderData: any;
1008
+ actionData: any;
1009
+ }, string | React$1.JSXElementConstructor<any>>;
1010
+ declare function useErrorBoundaryProps(): {
1011
+ params: Readonly<Params<string>>;
1012
+ loaderData: any;
1013
+ actionData: any;
1014
+ error: unknown;
1015
+ };
1016
+ type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>;
1017
+ type ErrorBoundaryType = React$1.ComponentType<ErrorBoundaryProps>;
1018
+ declare function WithErrorBoundaryProps({
1019
+ children
1020
+ }: {
1021
+ children: React$1.ReactElement;
1022
+ }): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
1023
+ declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React$1.ReactElement<{
1024
+ params: Readonly<Params<string>>;
1025
+ loaderData: any;
1026
+ actionData: any;
1027
+ error: unknown;
1028
+ }, string | React$1.JSXElementConstructor<any>>;
1029
+ //#endregion
1030
+ export { Await, AwaitProps, ClientOnErrorFunction, IndexRouteProps, LayoutRouteProps, MemoryRouter, MemoryRouterOpts, MemoryRouterProps, Navigate, NavigateProps, Outlet, OutletProps, PathRouteProps, Route, RouteProps, Router, RouterProps, RouterProvider, RouterProviderProps, Routes, RoutesProps, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps };