react-router 7.7.1 → 7.8.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +87 -5
  2. package/dist/development/browser-z32v5KVN.d.mts +46 -0
  3. package/dist/development/{chunk-R73PQUJU.js → chunk-4EVDZJGM.js} +130 -130
  4. package/dist/{production/chunk-K3SBCRK4.mjs → development/chunk-I22FVTOY.mjs} +177 -134
  5. package/dist/development/{chunk-K7YFBME3.js → chunk-NGF2R4G7.js} +285 -189
  6. package/dist/development/{chunk-C37GKA54.mjs → chunk-XFFANEXU.mjs} +266 -170
  7. package/dist/development/{components-CjQijYga.d.mts → components-CuPfnyiZ.d.mts} +33 -21
  8. package/dist/{production/route-data-CqEmXQub.d.mts → development/context-DohQKLID.d.mts} +312 -525
  9. package/dist/development/dom-export.d.mts +16 -12
  10. package/dist/development/dom-export.d.ts +13 -8
  11. package/dist/development/dom-export.js +3 -3
  12. package/dist/development/dom-export.mjs +3 -3
  13. package/dist/development/{index-react-server-client-Bi_fx8qz.d.ts → index-react-server-client-BzBbJLAD.d.ts} +357 -219
  14. package/dist/{production/index-react-server-client-KLg-U4nr.d.mts → development/index-react-server-client-CuajY2vy.d.mts} +327 -200
  15. package/dist/development/index-react-server-client.d.mts +4 -3
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +291 -71
  20. package/dist/development/index-react-server.d.ts +291 -71
  21. package/dist/development/index-react-server.js +209 -182
  22. package/dist/development/index-react-server.mjs +209 -182
  23. package/dist/development/index.d.mts +294 -86
  24. package/dist/development/index.d.ts +136 -105
  25. package/dist/development/index.js +258 -215
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/development/lib/types/internal.d.mts +13 -2
  28. package/dist/development/lib/types/internal.d.ts +12 -2
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/development/route-data-CpB5xtMm.d.mts +473 -0
  32. package/dist/{production/routeModules-BR2FO0ix.d.ts → development/routeModules-qBivMBjd.d.ts} +325 -68
  33. package/dist/production/browser-z32v5KVN.d.mts +46 -0
  34. package/dist/production/{chunk-4DGLNKXF.js → chunk-4PESVXQ2.js} +130 -130
  35. package/dist/{development/chunk-KIUJAIYX.mjs → production/chunk-JJOMWYJ4.mjs} +177 -134
  36. package/dist/production/{chunk-IZ57JD2V.mjs → chunk-P2ZJHOXZ.mjs} +266 -170
  37. package/dist/production/{chunk-7OQROU2D.js → chunk-RLJ23MYZ.js} +285 -189
  38. package/dist/production/{components-CjQijYga.d.mts → components-CuPfnyiZ.d.mts} +33 -21
  39. package/dist/{development/route-data-CqEmXQub.d.mts → production/context-DohQKLID.d.mts} +312 -525
  40. package/dist/production/dom-export.d.mts +16 -12
  41. package/dist/production/dom-export.d.ts +13 -8
  42. package/dist/production/dom-export.js +3 -3
  43. package/dist/production/dom-export.mjs +3 -3
  44. package/dist/production/{index-react-server-client-Bi_fx8qz.d.ts → index-react-server-client-BzBbJLAD.d.ts} +357 -219
  45. package/dist/{development/index-react-server-client-KLg-U4nr.d.mts → production/index-react-server-client-CuajY2vy.d.mts} +327 -200
  46. package/dist/production/index-react-server-client.d.mts +4 -3
  47. package/dist/production/index-react-server-client.d.ts +2 -2
  48. package/dist/production/index-react-server-client.js +4 -4
  49. package/dist/production/index-react-server-client.mjs +2 -2
  50. package/dist/production/index-react-server.d.mts +291 -71
  51. package/dist/production/index-react-server.d.ts +291 -71
  52. package/dist/production/index-react-server.js +209 -182
  53. package/dist/production/index-react-server.mjs +209 -182
  54. package/dist/production/index.d.mts +294 -86
  55. package/dist/production/index.d.ts +136 -105
  56. package/dist/production/index.js +258 -215
  57. package/dist/production/index.mjs +3 -3
  58. package/dist/production/lib/types/internal.d.mts +13 -2
  59. package/dist/production/lib/types/internal.d.ts +12 -2
  60. package/dist/production/lib/types/internal.js +1 -1
  61. package/dist/production/lib/types/internal.mjs +1 -1
  62. package/dist/production/route-data-CpB5xtMm.d.mts +473 -0
  63. package/dist/{development/routeModules-BR2FO0ix.d.ts → production/routeModules-qBivMBjd.d.ts} +325 -68
  64. package/package.json +1 -1
  65. package/dist/development/browser-7LYX59NK.d.mts +0 -226
  66. package/dist/production/browser-7LYX59NK.d.mts +0 -226
@@ -1,4 +1,4 @@
1
- import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './route-data-CqEmXQub.mjs';
1
+ import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './context-DohQKLID.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
@@ -14,8 +14,11 @@ interface MemoryRouterOpts {
14
14
  */
15
15
  basename?: string;
16
16
  /**
17
- * Function to provide the initial context values for all client side
18
- * navigations/fetches
17
+ * A function that returns an {@link unstable_RouterContextProvider} instance
18
+ * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
19
+ * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
20
+ * This function is called to generate a fresh `context` instance on each
21
+ * navigation or fetcher call.
19
22
  */
20
23
  unstable_getContext?: RouterInit["unstable_getContext"];
21
24
  /**
@@ -32,7 +35,7 @@ interface MemoryRouterOpts {
32
35
  */
33
36
  initialEntries?: InitialEntry[];
34
37
  /**
35
- * Index of {@link initialEntries} the application should initialize to
38
+ * Index of `initialEntries` the application should initialize to
36
39
  */
37
40
  initialIndex?: number;
38
41
  /**
@@ -89,7 +92,7 @@ interface RouterProviderProps {
89
92
  * Render the UI for the given {@link DataRouter}. This component should
90
93
  * typically be at the top of an app's element tree.
91
94
  *
92
- * @example
95
+ * ```tsx
93
96
  * import { createBrowserRouter } from "react-router";
94
97
  * import { RouterProvider } from "react-router/dom";
95
98
  * import { createRoot } from "react-dom/client";
@@ -98,6 +101,14 @@ interface RouterProviderProps {
98
101
  * createRoot(document.getElementById("root")).render(
99
102
  * <RouterProvider router={router} />
100
103
  * );
104
+ * ```
105
+ *
106
+ * <docs-info>Please note that this component is exported both from
107
+ * `react-router` and `react-router/dom` with the only difference being that the
108
+ * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync)
109
+ * implementation. You _almost always_ want to use the version from
110
+ * `react-router/dom` unless you're running in a non-DOM environment.</docs-info>
111
+ *
101
112
  *
102
113
  * @public
103
114
  * @category Data Routers
@@ -125,7 +136,7 @@ interface MemoryRouterProps {
125
136
  */
126
137
  initialEntries?: InitialEntry[];
127
138
  /**
128
- * Index of {@link initialEntries} the application should initialize to
139
+ * Index of `initialEntries` the application should initialize to
129
140
  */
130
141
  initialIndex?: number;
131
142
  }
@@ -140,7 +151,8 @@ interface MemoryRouterProps {
140
151
  * @param {MemoryRouterProps.children} props.children n/a
141
152
  * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
142
153
  * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
143
- * @returns A declarative in memory router for client side routing.
154
+ * @returns A declarative in-memory {@link Router | `<Router>`} for client-side
155
+ * routing.
144
156
  */
145
157
  declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
146
158
  /**
@@ -161,7 +173,7 @@ interface NavigateProps {
161
173
  */
162
174
  state?: any;
163
175
  /**
164
- * How to interpret relative routing in the {@link to} prop.
176
+ * How to interpret relative routing in the `to` prop.
165
177
  * See {@link RelativeRoutingType}.
166
178
  */
167
179
  relative?: RelativeRoutingType;
@@ -279,32 +291,32 @@ interface PathRouteProps {
279
291
  children?: React.ReactNode;
280
292
  /**
281
293
  * The React element to render when this Route matches.
282
- * Mutually exclusive with {@link Component}.
294
+ * Mutually exclusive with `Component`.
283
295
  */
284
296
  element?: React.ReactNode | null;
285
297
  /**
286
298
  * The React element to render while this router is loading data.
287
- * Mutually exclusive with {@link HydrateFallback}.
299
+ * Mutually exclusive with `HydrateFallback`.
288
300
  */
289
301
  hydrateFallbackElement?: React.ReactNode | null;
290
302
  /**
291
303
  * The React element to render at this route if an error occurs.
292
- * Mutually exclusive with {@link ErrorBoundary}.
304
+ * Mutually exclusive with `ErrorBoundary`.
293
305
  */
294
306
  errorElement?: React.ReactNode | null;
295
307
  /**
296
308
  * The React Component to render when this route matches.
297
- * Mutually exclusive with {@link element}.
309
+ * Mutually exclusive with `element`.
298
310
  */
299
311
  Component?: React.ComponentType | null;
300
312
  /**
301
313
  * The React Component to render while this router is loading data.
302
- * Mutually exclusive with {@link hydrateFallbackElement}.
314
+ * Mutually exclusive with `hydrateFallbackElement`.
303
315
  */
304
316
  HydrateFallback?: React.ComponentType | null;
305
317
  /**
306
318
  * The React Component to render at this route if an error occurs.
307
- * Mutually exclusive with {@link errorElement}.
319
+ * Mutually exclusive with `errorElement`.
308
320
  */
309
321
  ErrorBoundary?: React.ComponentType | null;
310
322
  }
@@ -366,32 +378,32 @@ interface IndexRouteProps {
366
378
  children?: undefined;
367
379
  /**
368
380
  * The React element to render when this Route matches.
369
- * Mutually exclusive with {@link Component}.
381
+ * Mutually exclusive with `Component`.
370
382
  */
371
383
  element?: React.ReactNode | null;
372
384
  /**
373
385
  * The React element to render while this router is loading data.
374
- * Mutually exclusive with {@link HydrateFallback}.
386
+ * Mutually exclusive with `HydrateFallback`.
375
387
  */
376
388
  hydrateFallbackElement?: React.ReactNode | null;
377
389
  /**
378
390
  * The React element to render at this route if an error occurs.
379
- * Mutually exclusive with {@link ErrorBoundary}.
391
+ * Mutually exclusive with `ErrorBoundary`.
380
392
  */
381
393
  errorElement?: React.ReactNode | null;
382
394
  /**
383
395
  * The React Component to render when this route matches.
384
- * Mutually exclusive with {@link element}.
396
+ * Mutually exclusive with `element`.
385
397
  */
386
398
  Component?: React.ComponentType | null;
387
399
  /**
388
400
  * The React Component to render while this router is loading data.
389
- * Mutually exclusive with {@link hydrateFallbackElement}.
401
+ * Mutually exclusive with `hydrateFallbackElement`.
390
402
  */
391
403
  HydrateFallback?: React.ComponentType | null;
392
404
  /**
393
405
  * The React Component to render at this route if an error occurs.
394
- * Mutually exclusive with {@link errorElement}.
406
+ * Mutually exclusive with `errorElement`.
395
407
  */
396
408
  ErrorBoundary?: React.ComponentType | null;
397
409
  }
@@ -471,7 +483,7 @@ interface RouterProps {
471
483
  */
472
484
  location: Partial<Location> | string;
473
485
  /**
474
- * The type of navigation that triggered this location change.
486
+ * The type of navigation that triggered this `location` change.
475
487
  * Defaults to {@link NavigationType.Pop}.
476
488
  */
477
489
  navigationType?: Action;