react-router 7.16.0 → 8.0.0-pre.0

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