react-router 7.15.1 → 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 +18 -2
  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 -1469
  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-Bsscfj79.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 -1469
  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-Bsscfj79.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-3AnU12UI.d.mts +0 -318
  323. package/dist/development/browser-BOdXz9dK.d.ts +0 -318
  324. package/dist/development/chunk-4N6VE7H7.mjs +0 -11528
  325. package/dist/development/chunk-4YRVXM2U.js +0 -188
  326. package/dist/development/chunk-66UKHEGQ.js +0 -1362
  327. package/dist/development/chunk-D6LUOGOQ.js +0 -10229
  328. package/dist/development/chunk-RJYABSBD.mjs +0 -2585
  329. package/dist/development/context-ByvtofY2.d.mts +0 -1771
  330. package/dist/development/data-BVUf681J.d.mts +0 -1732
  331. package/dist/development/data-BqZ2x964.d.ts +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-BS5F89FR.d.ts +0 -3655
  335. package/dist/development/index-react-server-client-DY04-103.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 -1472
  341. package/dist/development/index.mjs +0 -277
  342. package/dist/development/instrumentation-cRWWLfsU.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-Df8okEea.d.mts +0 -30
  346. package/dist/production/browser-3AnU12UI.d.mts +0 -318
  347. package/dist/production/browser-BOdXz9dK.d.ts +0 -318
  348. package/dist/production/chunk-6S4627ZB.mjs +0 -2585
  349. package/dist/production/chunk-HUBUW7R3.js +0 -10229
  350. package/dist/production/chunk-JAKZPQZC.mjs +0 -11528
  351. package/dist/production/chunk-PNZCCTKT.js +0 -1362
  352. package/dist/production/chunk-Y6IFXO7V.js +0 -188
  353. package/dist/production/context-ByvtofY2.d.mts +0 -1771
  354. package/dist/production/data-BVUf681J.d.mts +0 -1732
  355. package/dist/production/data-BqZ2x964.d.ts +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-BS5F89FR.d.ts +0 -3655
  359. package/dist/production/index-react-server-client-DY04-103.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 -1472
  365. package/dist/production/index.mjs +0 -277
  366. package/dist/production/instrumentation-cRWWLfsU.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-Df8okEea.d.mts +0 -30
@@ -0,0 +1,942 @@
1
+
2
+ import { Location, Path, To } from "./history.js";
3
+ import * as React$1 from "react";
4
+
5
+ //#region lib/router/utils.d.ts
6
+ type MaybePromise<T> = T | Promise<T>;
7
+ /**
8
+ * Map of routeId -> data returned from a loader/action/error
9
+ */
10
+ interface RouteData {
11
+ [routeId: string]: any;
12
+ }
13
+ type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
14
+ type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
15
+ /**
16
+ * Users can specify either lowercase or uppercase form methods on `<Form>`,
17
+ * useSubmit(), `<fetcher.Form>`, etc.
18
+ */
19
+ type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
20
+ /**
21
+ * Active navigation/fetcher form methods are exposed in uppercase on the
22
+ * RouterState. This is to align with the normalization done via fetch().
23
+ */
24
+ type FormMethod = UpperCaseFormMethod;
25
+ type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
26
+ type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined };
27
+ type JsonArray = JsonValue[] | readonly JsonValue[];
28
+ type JsonPrimitive = string | number | boolean | null;
29
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
30
+ /**
31
+ * @private
32
+ * Internal interface to pass around for action submissions, not intended for
33
+ * external consumption
34
+ */
35
+ type Submission = {
36
+ formMethod: FormMethod;
37
+ formAction: string;
38
+ formEncType: FormEncType;
39
+ formData: FormData;
40
+ json: undefined;
41
+ text: undefined;
42
+ } | {
43
+ formMethod: FormMethod;
44
+ formAction: string;
45
+ formEncType: FormEncType;
46
+ formData: undefined;
47
+ json: JsonValue;
48
+ text: undefined;
49
+ } | {
50
+ formMethod: FormMethod;
51
+ formAction: string;
52
+ formEncType: FormEncType;
53
+ formData: undefined;
54
+ json: undefined;
55
+ text: string;
56
+ };
57
+ /**
58
+ * A context instance used as the key for the `get`/`set` methods of a
59
+ * {@link RouterContextProvider}. Accepts an optional default
60
+ * value to be returned if no value has been set.
61
+ */
62
+ interface RouterContext<T = unknown> {
63
+ defaultValue?: T;
64
+ }
65
+ /**
66
+ * Creates a type-safe {@link RouterContext} object that can be used to
67
+ * store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
68
+ * [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
69
+ * Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
70
+ * but specifically designed for React Router's request/response lifecycle.
71
+ *
72
+ * If a `defaultValue` is provided, it will be returned from `context.get()`
73
+ * when no value has been set for the context. Otherwise, reading this context
74
+ * when no value has been set will throw an error.
75
+ *
76
+ * ```tsx filename=app/context.ts
77
+ * import { createContext } from "react-router";
78
+ *
79
+ * // Create a context for user data
80
+ * export const userContext =
81
+ * createContext<User | null>(null);
82
+ * ```
83
+ *
84
+ * ```tsx filename=app/middleware/auth.ts
85
+ * import { getUserFromSession } from "~/auth.server";
86
+ * import { userContext } from "~/context";
87
+ *
88
+ * export const authMiddleware = async ({
89
+ * context,
90
+ * request,
91
+ * }) => {
92
+ * const user = await getUserFromSession(request);
93
+ * context.set(userContext, user);
94
+ * };
95
+ * ```
96
+ *
97
+ * ```tsx filename=app/routes/profile.tsx
98
+ * import { userContext } from "~/context";
99
+ *
100
+ * export async function loader({
101
+ * context,
102
+ * }: Route.LoaderArgs) {
103
+ * const user = context.get(userContext);
104
+ *
105
+ * if (!user) {
106
+ * throw new Response("Unauthorized", { status: 401 });
107
+ * }
108
+ *
109
+ * return { user };
110
+ * }
111
+ * ```
112
+ *
113
+ * @public
114
+ * @category Utils
115
+ * @mode framework
116
+ * @mode data
117
+ * @param defaultValue An optional default value for the context. This value
118
+ * will be returned if no value has been set for this context.
119
+ * @returns A {@link RouterContext} object that can be used with
120
+ * `context.get()` and `context.set()` in [`action`](../../start/framework/route-module#action)s,
121
+ * [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
122
+ */
123
+ declare function createContext<T>(defaultValue?: T): RouterContext<T>;
124
+ /**
125
+ * Provides methods for writing/reading values in application context in a
126
+ * type-safe way. Primarily for usage with [middleware](../../how-to/middleware).
127
+ *
128
+ * @example
129
+ * import {
130
+ * createContext,
131
+ * RouterContextProvider
132
+ * } from "react-router";
133
+ *
134
+ * const userContext = createContext<User | null>(null);
135
+ * const contextProvider = new RouterContextProvider();
136
+ * contextProvider.set(userContext, getUser());
137
+ * // ^ Type-safe
138
+ * const user = contextProvider.get(userContext);
139
+ * // ^ User
140
+ *
141
+ * @public
142
+ * @category Utils
143
+ * @mode framework
144
+ * @mode data
145
+ */
146
+ declare class RouterContextProvider {
147
+ #private;
148
+ /**
149
+ * Create a new `RouterContextProvider` instance
150
+ * @param init An optional initial context map to populate the provider with
151
+ */
152
+ constructor(init?: Map<RouterContext, unknown>);
153
+ /**
154
+ * Access a value from the context. If no value has been set for the context,
155
+ * it will return the context's `defaultValue` if provided, or throw an error
156
+ * if no `defaultValue` was set.
157
+ * @param context The context to get the value for
158
+ * @returns The value for the context, or the context's `defaultValue` if no
159
+ * value was set
160
+ */
161
+ get<T>(context: RouterContext<T>): T;
162
+ /**
163
+ * Set a value for the context. If the context already has a value set, this
164
+ * will overwrite it.
165
+ *
166
+ * @param context The context to set the value for
167
+ * @param value The value to set for the context
168
+ * @returns {void}
169
+ */
170
+ set<C extends RouterContext>(context: C, value: C extends RouterContext<infer T> ? T : never): void;
171
+ }
172
+ type DefaultContext = Readonly<RouterContextProvider>;
173
+ /**
174
+ * @private
175
+ * Arguments passed to route loader/action functions. Same for now but we keep
176
+ * this as a private implementation detail in case they diverge in the future.
177
+ */
178
+ interface DataFunctionArgs<Context> {
179
+ /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
180
+ request: Request;
181
+ /**
182
+ * A URL instance representing the application location being navigated to or
183
+ * fetched.
184
+ *
185
+ * In Framework mode, this is a normalized URL with React-Router-specific
186
+ * implementation details removed (`.data` suffixes, `index`/`_routes` search
187
+ * params). For the raw incoming URL, use `request.url`.
188
+ */
189
+ url: URL;
190
+ /**
191
+ * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
192
+ * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
193
+ */
194
+ pattern: string;
195
+ /**
196
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
197
+ * @example
198
+ * // app/routes.ts
199
+ * route("teams/:teamId", "./team.tsx"),
200
+ *
201
+ * // app/team.tsx
202
+ * export function loader({
203
+ * params,
204
+ * }: Route.LoaderArgs) {
205
+ * params.teamId;
206
+ * // ^ string
207
+ * }
208
+ */
209
+ params: Params;
210
+ /**
211
+ * This is the context passed in to your server adapter's getLoadContext() function.
212
+ * It's a way to bridge the gap between the adapter's request/response API with your React Router app.
213
+ * It is only applicable if you are using a custom server adapter.
214
+ */
215
+ context: Context;
216
+ }
217
+ /**
218
+ * Route middleware `next` function to call downstream handlers and then complete
219
+ * middlewares from the bottom-up
220
+ */
221
+ interface MiddlewareNextFunction<Result = unknown> {
222
+ (): Promise<Result>;
223
+ }
224
+ /**
225
+ * Route middleware function signature. Receives the same "data" arguments as a
226
+ * `loader`/`action` (`request`, `params`, `context`) as the first parameter and
227
+ * a `next` function as the second parameter which will call downstream handlers
228
+ * and then complete middlewares from the bottom-up
229
+ */
230
+ type MiddlewareFunction<Result = unknown> = (args: DataFunctionArgs<Readonly<RouterContextProvider>>, next: MiddlewareNextFunction<Result>) => MaybePromise<Result | void>;
231
+ /**
232
+ * Arguments passed to loader functions
233
+ */
234
+ interface LoaderFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {}
235
+ /**
236
+ * Arguments passed to action functions
237
+ */
238
+ interface ActionFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {}
239
+ /**
240
+ * Loaders and actions can return anything
241
+ */
242
+ type DataFunctionValue = unknown;
243
+ type DataFunctionReturnValue = MaybePromise<DataFunctionValue>;
244
+ /**
245
+ * Route loader function signature
246
+ */
247
+ type LoaderFunction<Context = DefaultContext> = {
248
+ (args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
249
+ } & {
250
+ hydrate?: boolean;
251
+ };
252
+ /**
253
+ * Route action function signature
254
+ */
255
+ interface ActionFunction<Context = DefaultContext> {
256
+ (args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
257
+ }
258
+ /**
259
+ * Arguments passed to shouldRevalidate function
260
+ */
261
+ interface ShouldRevalidateFunctionArgs {
262
+ /** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
263
+ currentUrl: URL;
264
+ /** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
265
+ currentParams: DataRouteMatch["params"];
266
+ /** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
267
+ nextUrl: URL;
268
+ /** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
269
+ nextParams: DataRouteMatch["params"];
270
+ /** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
271
+ formMethod?: Submission["formMethod"];
272
+ /** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
273
+ formAction?: Submission["formAction"];
274
+ /** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
275
+ formEncType?: Submission["formEncType"];
276
+ /** The form submission data when the form's encType is `text/plain` */
277
+ text?: Submission["text"];
278
+ /** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
279
+ formData?: Submission["formData"];
280
+ /** The form submission data when the form's encType is `application/json` */
281
+ json?: Submission["json"];
282
+ /** The status code of the action response */
283
+ actionStatus?: number;
284
+ /**
285
+ * When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
286
+ *
287
+ * @example
288
+ * export async function action() {
289
+ * await saveSomeStuff();
290
+ * return { ok: true };
291
+ * }
292
+ *
293
+ * export function shouldRevalidate({
294
+ * actionResult,
295
+ * }) {
296
+ * if (actionResult?.ok) {
297
+ * return false;
298
+ * }
299
+ * return true;
300
+ * }
301
+ */
302
+ actionResult?: any;
303
+ /**
304
+ * By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
305
+ *
306
+ * /projects/123/tasks/abc
307
+ * /projects/123/tasks/def
308
+ * React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
309
+ *
310
+ * It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
311
+ */
312
+ defaultShouldRevalidate: boolean;
313
+ }
314
+ /**
315
+ * Route shouldRevalidate function signature. This runs after any submission
316
+ * (navigation or fetcher), so we flatten the navigation/fetcher submission
317
+ * onto the arguments. It shouldn't matter whether it came from a navigation
318
+ * or a fetcher, what really matters is the URLs and the formData since loaders
319
+ * have to re-run based on the data models that were potentially mutated.
320
+ */
321
+ interface ShouldRevalidateFunction {
322
+ (args: ShouldRevalidateFunctionArgs): boolean;
323
+ }
324
+ interface DataStrategyMatch extends RouteMatch<string, DataRouteObject> {
325
+ /**
326
+ * @private
327
+ */
328
+ _lazyPromises?: {
329
+ middleware: Promise<void> | undefined;
330
+ handler: Promise<void> | undefined;
331
+ route: Promise<void> | undefined;
332
+ };
333
+ /**
334
+ * @deprecated Deprecated in favor of `shouldCallHandler`
335
+ *
336
+ * A boolean value indicating whether this route handler should be called in
337
+ * this pass.
338
+ *
339
+ * The `matches` array always includes _all_ matched routes even when only
340
+ * _some_ route handlers need to be called so that things like middleware can
341
+ * be implemented.
342
+ *
343
+ * `shouldLoad` is usually only interesting if you are skipping the route
344
+ * handler entirely and implementing custom handler logic - since it lets you
345
+ * determine if that custom logic should run for this route or not.
346
+ *
347
+ * For example:
348
+ * - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
349
+ * you'll get an array of three matches (`[parent, child, b]`), but only `b`
350
+ * will have `shouldLoad=true` because the data for `parent` and `child` is
351
+ * already loaded
352
+ * - If you are on `/parent/child/a` and you submit to `a`'s [`action`](https://reactrouter.com/docs/start/data/route-object#action),
353
+ * then only `a` will have `shouldLoad=true` for the action execution of
354
+ * `dataStrategy`
355
+ * - After the [`action`](https://reactrouter.com/docs/start/data/route-object#action),
356
+ * `dataStrategy` will be called again for the [`loader`](https://reactrouter.com/docs/start/data/route-object#loader)
357
+ * revalidation, and all matches will have `shouldLoad=true` (assuming no
358
+ * custom `shouldRevalidate` implementations)
359
+ */
360
+ shouldLoad: boolean;
361
+ /**
362
+ * Arguments passed to the `shouldRevalidate` function for this `loader` execution.
363
+ * Will be `null` if this is not a revalidating loader {@link DataStrategyMatch}.
364
+ */
365
+ shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
366
+ /**
367
+ * Determine if this route's handler should be called during this `dataStrategy`
368
+ * execution. Calling it with no arguments will leverage the default revalidation
369
+ * behavior. You can pass your own `defaultShouldRevalidate` value if you wish
370
+ * to change the default revalidation behavior with your `dataStrategy`.
371
+ *
372
+ * @param defaultShouldRevalidate `defaultShouldRevalidate` override value (optional)
373
+ */
374
+ shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
375
+ /**
376
+ * An async function that will resolve any `route.lazy` implementations and
377
+ * execute the route's handler (if necessary), returning a {@link DataStrategyResult}
378
+ *
379
+ * - Calling `match.resolve` does not mean you're calling the
380
+ * [`action`](https://reactrouter.com/docs/start/data/route-object#action)/[`loader`](https://reactrouter.com/docs/start/data/route-object#loader)
381
+ * (the "handler") - `resolve` will only call the `handler` internally if
382
+ * needed _and_ if you don't pass your own `handlerOverride` function parameter
383
+ * - It is safe to call `match.resolve` for all matches, even if they have
384
+ * `shouldLoad=false`, and it will no-op if no loading is required
385
+ * - You should generally always call `match.resolve()` for `shouldLoad:true`
386
+ * routes to ensure that any `route.lazy` implementations are processed
387
+ * - See the examples below for how to implement custom handler execution via
388
+ * `match.resolve`
389
+ */
390
+ resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
391
+ }
392
+ interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
393
+ /**
394
+ * Matches for this route extended with Data strategy APIs
395
+ */
396
+ matches: DataStrategyMatch[];
397
+ runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
398
+ /**
399
+ * The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
400
+ * for navigational executions
401
+ */
402
+ fetcherKey: string | null;
403
+ }
404
+ /**
405
+ * Result from a loader or action called via dataStrategy
406
+ */
407
+ interface DataStrategyResult {
408
+ type: "data" | "error";
409
+ result: unknown;
410
+ }
411
+ interface DataStrategyFunction<Context = DefaultContext> {
412
+ (args: DataStrategyFunctionArgs<Context>): Promise<Record<string, DataStrategyResult>>;
413
+ }
414
+ type PatchRoutesOnNavigationFunctionArgs = {
415
+ signal: AbortSignal;
416
+ path: string;
417
+ matches: RouteMatch[];
418
+ fetcherKey: string | undefined;
419
+ patch: (routeId: string | null, children: RouteObject[]) => void;
420
+ };
421
+ type PatchRoutesOnNavigationFunction = (opts: PatchRoutesOnNavigationFunctionArgs) => MaybePromise<void>;
422
+ /**
423
+ * Function provided to set route-specific properties from route objects
424
+ */
425
+ interface MapRoutePropertiesFunction {
426
+ (route: DataRouteObject): Partial<DataRouteObject>;
427
+ }
428
+ /**
429
+ * Keys we cannot change from within a lazy object. We spread all other keys
430
+ * onto the route. Either they're meaningful to the router, or they'll get
431
+ * ignored.
432
+ */
433
+ type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
434
+ /**
435
+ * Keys we cannot change from within a lazy() function. We spread all other keys
436
+ * onto the route. Either they're meaningful to the router, or they'll get
437
+ * ignored.
438
+ */
439
+ type UnsupportedLazyRouteFunctionKey = UnsupportedLazyRouteObjectKey | "middleware";
440
+ /**
441
+ * lazy object to load route properties, which can add non-matching
442
+ * related properties to a route
443
+ */
444
+ type LazyRouteObject<R extends RouteObject> = { [K in keyof R as K extends UnsupportedLazyRouteObjectKey ? never : K]?: () => Promise<R[K] | null | undefined> };
445
+ /**
446
+ * lazy() function to load a route definition, which can add non-matching
447
+ * related properties to a route
448
+ */
449
+ interface LazyRouteFunction<R extends RouteObject> {
450
+ (): Promise<Omit<R, UnsupportedLazyRouteFunctionKey> & Partial<Record<UnsupportedLazyRouteFunctionKey, never>>>;
451
+ }
452
+ type LazyRouteDefinition<R extends RouteObject> = LazyRouteObject<R> | LazyRouteFunction<R>;
453
+ /**
454
+ * Base RouteObject with common props shared by all types of routes
455
+ * @internal
456
+ */
457
+ type BaseRouteObject = {
458
+ /**
459
+ * Whether the path should be case-sensitive. Defaults to `false`.
460
+ */
461
+ caseSensitive?: boolean;
462
+ /**
463
+ * The path pattern to match. If unspecified or empty, then this becomes a
464
+ * layout route.
465
+ */
466
+ path?: string;
467
+ /**
468
+ * The unique identifier for this route (for use with {@link DataRouter}s)
469
+ */
470
+ id?: string;
471
+ /**
472
+ * The route middleware.
473
+ * See [`middleware`](../../start/data/route-object#middleware).
474
+ */
475
+ middleware?: MiddlewareFunction[];
476
+ /**
477
+ * The route loader.
478
+ * See [`loader`](../../start/data/route-object#loader).
479
+ */
480
+ loader?: LoaderFunction | boolean;
481
+ /**
482
+ * The route action.
483
+ * See [`action`](../../start/data/route-object#action).
484
+ */
485
+ action?: ActionFunction | boolean;
486
+ /**
487
+ * The route shouldRevalidate function.
488
+ * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
489
+ */
490
+ shouldRevalidate?: ShouldRevalidateFunction;
491
+ /**
492
+ * The route handle.
493
+ */
494
+ handle?: any;
495
+ /**
496
+ * A function that returns a promise that resolves to the route object.
497
+ * Used for code-splitting routes.
498
+ * See [`lazy`](../../start/data/route-object#lazy).
499
+ */
500
+ lazy?: LazyRouteDefinition<BaseRouteObject>;
501
+ /**
502
+ * The React Component to render when this route matches.
503
+ * Mutually exclusive with `element`.
504
+ */
505
+ Component?: React$1.ComponentType | null;
506
+ /**
507
+ * The React element to render when this Route matches.
508
+ * Mutually exclusive with `Component`.
509
+ */
510
+ element?: React$1.ReactNode | null;
511
+ /**
512
+ * The React Component to render at this route if an error occurs.
513
+ * Mutually exclusive with `errorElement`.
514
+ */
515
+ ErrorBoundary?: React$1.ComponentType | null;
516
+ /**
517
+ * The React element to render at this route if an error occurs.
518
+ * Mutually exclusive with `ErrorBoundary`.
519
+ */
520
+ errorElement?: React$1.ReactNode | null;
521
+ /**
522
+ * The React Component to render while this router is loading data.
523
+ * Mutually exclusive with `hydrateFallbackElement`.
524
+ */
525
+ HydrateFallback?: React$1.ComponentType | null;
526
+ /**
527
+ * The React element to render while this router is loading data.
528
+ * Mutually exclusive with `HydrateFallback`.
529
+ */
530
+ hydrateFallbackElement?: React$1.ReactNode | null;
531
+ };
532
+ /**
533
+ * Index routes must not have children
534
+ */
535
+ type IndexRouteObject = BaseRouteObject & {
536
+ /**
537
+ * Child Route objects - not valid on index routes.
538
+ */
539
+ children?: undefined;
540
+ /**
541
+ * Whether this is an index route.
542
+ */
543
+ index: true;
544
+ };
545
+ /**
546
+ * Non-index routes may have children, but cannot have `index` set to `true`.
547
+ */
548
+ type NonIndexRouteObject = BaseRouteObject & {
549
+ /**
550
+ * Child Route objects.
551
+ */
552
+ children?: RouteObject[];
553
+ /**
554
+ * Whether this is an index route - must be `false` or undefined on non-index routes.
555
+ */
556
+ index?: false;
557
+ };
558
+ /**
559
+ * A route object represents a logical route, with (optionally) its child
560
+ * routes organized in a tree-like structure.
561
+ */
562
+ type RouteObject = IndexRouteObject | NonIndexRouteObject;
563
+ type DataIndexRouteObject = IndexRouteObject & {
564
+ id: string;
565
+ };
566
+ type DataNonIndexRouteObject = NonIndexRouteObject & {
567
+ children?: DataRouteObject[];
568
+ id: string;
569
+ };
570
+ /**
571
+ * A data route object, which is just a RouteObject with a required unique ID
572
+ */
573
+ type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
574
+ type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
575
+ type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
576
+ type Regex_AZ = Uppercase<Regex_az>;
577
+ type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
578
+ type Regex_w = Regex_az | Regex_AZ | Regex_09 | "_";
579
+ /** Emulates Regex `+` operator */
580
+ type RegexMatchPlus<char extends string, T extends string> = _RegexMatchPlus<char, T> extends infer result extends string ? result extends '' ? never : result : never;
581
+ type _RegexMatchPlus<char extends string, T extends string> = T extends `${infer head extends char}${infer rest}` ? `${head}${_RegexMatchPlus<char, rest>}` : '';
582
+ type ParamNameChar = Regex_w | "-";
583
+ type Simplify<T> = { [K in keyof T]: T[K] } & {};
584
+ type GeneratePathParams<path extends string> = Simplify<ParseParams<path> & { [key in string]: string | null | undefined }>;
585
+ type ParseParams<path extends string> = path extends '*' ? {
586
+ '*': string;
587
+ } : path extends `${infer rest}/*` ? {
588
+ '*': string;
589
+ } & ParseParams<rest> : _ParseParams<path>;
590
+ type _ParseParams<path extends string> = path extends `${infer left}/${infer right}` ? _ParseParams<left> & _ParseParams<right> : path extends `:${infer param}?${string}` ? { [key in RegexMatchPlus<ParamNameChar, param>]?: string | null | undefined } : path extends `:${infer param}` ? { [key in RegexMatchPlus<ParamNameChar, param>]: string } : {};
591
+ type PathParam<path extends string> = (keyof ParseParams<path>) & string;
592
+ type ParamParseKey<Segment extends string> = [PathParam<Segment>] extends [never] ? string : PathParam<Segment>;
593
+ /**
594
+ * The parameters that were parsed from the URL path.
595
+ */
596
+ type Params<Key extends string = string> = { readonly [key in Key]: string | undefined };
597
+ /**
598
+ * A RouteMatch contains info about how a route matched a URL.
599
+ */
600
+ interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> {
601
+ /**
602
+ * The names and values of dynamic parameters in the URL.
603
+ */
604
+ params: Params<ParamKey>;
605
+ /**
606
+ * The portion of the URL pathname that was matched.
607
+ */
608
+ pathname: string;
609
+ /**
610
+ * The portion of the URL pathname that was matched before child routes.
611
+ */
612
+ pathnameBase: string;
613
+ /**
614
+ * The route object that was used to match.
615
+ */
616
+ route: RouteObjectType;
617
+ }
618
+ interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {}
619
+ declare function defaultMapRouteProperties(route: DataRouteObject): Partial<DataRouteObject>;
620
+ /**
621
+ * Matches the given routes to a location and returns the match data.
622
+ *
623
+ * @example
624
+ * import { matchRoutes } from "react-router";
625
+ *
626
+ * let routes = [{
627
+ * path: "/",
628
+ * Component: Root,
629
+ * children: [{
630
+ * path: "dashboard",
631
+ * Component: Dashboard,
632
+ * }]
633
+ * }];
634
+ *
635
+ * matchRoutes(routes, "/dashboard"); // [rootMatch, dashboardMatch]
636
+ *
637
+ * @public
638
+ * @category Utils
639
+ * @param routes The array of route objects to match against.
640
+ * @param locationArg The location to match against, either a string path or a
641
+ * partial {@link Location} object
642
+ * @param basename Optional base path to strip from the location before matching.
643
+ * Defaults to `/`.
644
+ * @returns An array of matched routes, or `null` if no matches were found.
645
+ */
646
+ declare function matchRoutes<RouteObjectType extends RouteObject = RouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): RouteMatch<string, RouteObjectType>[] | null;
647
+ interface UIMatch<Data = unknown, Handle = unknown> {
648
+ id: string;
649
+ pathname: string;
650
+ /**
651
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
652
+ */
653
+ params: RouteMatch["params"];
654
+ /**
655
+ * The return value from the matched route's loader or clientLoader. This might
656
+ * be `undefined` if this route's `loader` (or a deeper route's `loader`) threw
657
+ * an error and we're currently displaying an `ErrorBoundary`.
658
+ */
659
+ loaderData: Data | undefined;
660
+ /**
661
+ * The {@link https://reactrouter.com/start/framework/route-module#handle handle object}
662
+ * exported from the matched route module
663
+ */
664
+ handle: Handle;
665
+ }
666
+ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
667
+ relativePath: string;
668
+ caseSensitive: boolean;
669
+ childrenIndex: number;
670
+ route: RouteObjectType;
671
+ }
672
+ /**
673
+ * @private
674
+ * PRIVATE - DO NOT USE
675
+ *
676
+ * A "branch" of routes that match a given route pattern.
677
+ * This is an internal interface not intended for direct external usage.
678
+ */
679
+ interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
680
+ path: string;
681
+ score: number;
682
+ routesMeta: RouteMeta<RouteObjectType>[];
683
+ }
684
+ /**
685
+ * Returns a path with params interpolated.
686
+ *
687
+ * @example
688
+ * import { generatePath } from "react-router";
689
+ *
690
+ * generatePath("/users/:id", { id: "123" }); // "/users/123"
691
+ *
692
+ * @public
693
+ * @category Utils
694
+ * @param originalPath The original path to generate.
695
+ * @param params The parameters to interpolate into the path.
696
+ * @returns The generated path with parameters interpolated.
697
+ */
698
+ declare function generatePath<Path extends string>(originalPath: Path, params?: GeneratePathParams<Path>): string;
699
+ /**
700
+ * Used to match on some portion of a URL pathname.
701
+ */
702
+ interface PathPattern<Path extends string = string> {
703
+ /**
704
+ * A string to match against a URL pathname. May contain `:id`-style segments
705
+ * to indicate placeholders for dynamic parameters. It May also end with `/*`
706
+ * to indicate matching the rest of the URL pathname.
707
+ */
708
+ path: Path;
709
+ /**
710
+ * Should be `true` if the static portions of the `path` should be matched in
711
+ * the same case.
712
+ */
713
+ caseSensitive?: boolean;
714
+ /**
715
+ * Should be `true` if this pattern should match the entire URL pathname.
716
+ */
717
+ end?: boolean;
718
+ }
719
+ /**
720
+ * Contains info about how a {@link PathPattern} matched on a URL pathname.
721
+ */
722
+ interface PathMatch<ParamKey extends string = string> {
723
+ /**
724
+ * The names and values of dynamic parameters in the URL.
725
+ */
726
+ params: Params<ParamKey>;
727
+ /**
728
+ * The portion of the URL pathname that was matched.
729
+ */
730
+ pathname: string;
731
+ /**
732
+ * The portion of the URL pathname that was matched before child routes.
733
+ */
734
+ pathnameBase: string;
735
+ /**
736
+ * The pattern that was used to match.
737
+ */
738
+ pattern: PathPattern;
739
+ }
740
+ /**
741
+ * Performs pattern matching on a URL pathname and returns information about
742
+ * the match.
743
+ *
744
+ * @public
745
+ * @category Utils
746
+ * @param pattern The pattern to match against the URL pathname. This can be a
747
+ * string or a {@link PathPattern} object. If a string is provided, it will be
748
+ * treated as a pattern with `caseSensitive` set to `false` and `end` set to
749
+ * `true`.
750
+ * @param pathname The URL pathname to match against the pattern.
751
+ * @returns A path match object if the pattern matches the pathname,
752
+ * or `null` if it does not match.
753
+ */
754
+ declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
755
+ /**
756
+ * Returns a resolved {@link Path} object relative to the given pathname.
757
+ *
758
+ * @public
759
+ * @category Utils
760
+ * @param to The path to resolve, either a string or a partial {@link Path}
761
+ * object.
762
+ * @param fromPathname The pathname to resolve the path from. Defaults to `/`.
763
+ * @returns A {@link Path} object with the resolved pathname, search, and hash.
764
+ */
765
+ declare function resolvePath(to: To, fromPathname?: string): Path;
766
+ declare class DataWithResponseInit<D> {
767
+ type: string;
768
+ data: D;
769
+ init: ResponseInit | null;
770
+ constructor(data: D, init?: ResponseInit);
771
+ }
772
+ /**
773
+ * Create "responses" that contain `headers`/`status` without forcing
774
+ * serialization into an actual [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
775
+ *
776
+ * @example
777
+ * import { data } from "react-router";
778
+ *
779
+ * export async function action({ request }: Route.ActionArgs) {
780
+ * let formData = await request.formData();
781
+ * let item = await createItem(formData);
782
+ * return data(item, {
783
+ * headers: { "X-Custom-Header": "value" }
784
+ * status: 201,
785
+ * });
786
+ * }
787
+ *
788
+ * @public
789
+ * @category Utils
790
+ * @mode framework
791
+ * @mode data
792
+ * @param data The data to be included in the response.
793
+ * @param init The status code or a `ResponseInit` object to be included in the
794
+ * response.
795
+ * @returns A {@link DataWithResponseInit} instance containing the data and
796
+ * response init.
797
+ */
798
+ declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
799
+ interface TrackedPromise extends Promise<any> {
800
+ _tracked?: boolean;
801
+ _data?: any;
802
+ _error?: any;
803
+ }
804
+ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
805
+ /**
806
+ * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
807
+ * Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
808
+ * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
809
+ *
810
+ * This utility accepts absolute URLs and can navigate to external domains, so
811
+ * the application should validate any user-supplied inputs to redirects.
812
+ *
813
+ * @example
814
+ * import { redirect } from "react-router";
815
+ *
816
+ * export async function loader({ request }: Route.LoaderArgs) {
817
+ * if (!isLoggedIn(request))
818
+ * throw redirect("/login");
819
+ * }
820
+ *
821
+ * // ...
822
+ * }
823
+ *
824
+ * @public
825
+ * @category Utils
826
+ * @mode framework
827
+ * @mode data
828
+ * @param url The URL to redirect to.
829
+ * @param init The status code or a `ResponseInit` object to be included in the
830
+ * response.
831
+ * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
832
+ * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
833
+ * header.
834
+ */
835
+ declare const redirect: RedirectFunction;
836
+ /**
837
+ * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
838
+ * that will force a document reload to the new location. Sets the status code
839
+ * and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
840
+ * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
841
+ *
842
+ * This utility accepts absolute URLs and can navigate to external domains, so
843
+ * the application should validate any user-supplied inputs to redirects.
844
+ *
845
+ * ```tsx filename=routes/logout.tsx
846
+ * import { redirectDocument } from "react-router";
847
+ *
848
+ * import { destroySession } from "../sessions.server";
849
+ *
850
+ * export async function action({ request }: Route.ActionArgs) {
851
+ * let session = await getSession(request.headers.get("Cookie"));
852
+ * return redirectDocument("/", {
853
+ * headers: { "Set-Cookie": await destroySession(session) }
854
+ * });
855
+ * }
856
+ * ```
857
+ *
858
+ * @public
859
+ * @category Utils
860
+ * @mode framework
861
+ * @mode data
862
+ * @param url The URL to redirect to.
863
+ * @param init The status code or a `ResponseInit` object to be included in the
864
+ * response.
865
+ * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
866
+ * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
867
+ * header.
868
+ */
869
+ declare const redirectDocument: RedirectFunction;
870
+ /**
871
+ * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
872
+ * that will perform a [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState)
873
+ * instead of a [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)
874
+ * for client-side navigation redirects. Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
875
+ * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
876
+ *
877
+ * @example
878
+ * import { replace } from "react-router";
879
+ *
880
+ * export async function loader() {
881
+ * return replace("/new-location");
882
+ * }
883
+ *
884
+ * @public
885
+ * @category Utils
886
+ * @mode framework
887
+ * @mode data
888
+ * @param url The URL to redirect to.
889
+ * @param init The status code or a `ResponseInit` object to be included in the
890
+ * response.
891
+ * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
892
+ * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
893
+ * header.
894
+ */
895
+ declare const replace: RedirectFunction;
896
+ type ErrorResponse = {
897
+ status: number;
898
+ statusText: string;
899
+ data: any;
900
+ };
901
+ declare class ErrorResponseImpl implements ErrorResponse {
902
+ status: number;
903
+ statusText: string;
904
+ data: any;
905
+ private error?;
906
+ private internal;
907
+ constructor(status: number, statusText: string | undefined, data: any, internal?: boolean);
908
+ }
909
+ /**
910
+ * Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
911
+ * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
912
+ * thrown from an [`action`](../../start/framework/route-module#action) or
913
+ * [`loader`](../../start/framework/route-module#loader) function.
914
+ *
915
+ * @example
916
+ * import { isRouteErrorResponse } from "react-router";
917
+ *
918
+ * export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
919
+ * if (isRouteErrorResponse(error)) {
920
+ * return (
921
+ * <>
922
+ * <p>Error: `${error.status}: ${error.statusText}`</p>
923
+ * <p>{error.data}</p>
924
+ * </>
925
+ * );
926
+ * }
927
+ *
928
+ * return (
929
+ * <p>Error: {error instanceof Error ? error.message : "Unknown Error"}</p>
930
+ * );
931
+ * }
932
+ *
933
+ * @public
934
+ * @category Utils
935
+ * @mode framework
936
+ * @mode data
937
+ * @param error The error to check.
938
+ * @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
939
+ */
940
+ declare function isRouteErrorResponse(error: any): error is ErrorResponse;
941
+ //#endregion
942
+ export { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MapRoutePropertiesFunction, MaybePromise, MiddlewareFunction, MiddlewareNextFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteBranch, RouteData, RouteManifest, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, Submission, TrackedPromise, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath };