react-router 7.8.1 → 7.8.2-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.
- package/CHANGELOG.md +23 -0
- package/dist/development/{chunk-IFMMFE4R.mjs → chunk-7QFLQWWN.mjs} +34 -75
- package/dist/{production/chunk-YMYXECPK.js → development/chunk-IVOVRAK2.js} +210 -169
- package/dist/development/{chunk-UH6JLGW7.mjs → chunk-ZVD2KUIM.mjs} +187 -204
- package/dist/development/{chunk-TGXCWGPT.js → chunk-ZVMYUFGA.js} +125 -183
- package/dist/development/{context-DohQKLID.d.mts → context-jKip1TFB.d.mts} +846 -8
- package/dist/development/dom-export.d.mts +20 -2
- package/dist/development/dom-export.d.ts +20 -1
- package/dist/development/dom-export.js +10 -4
- package/dist/development/dom-export.mjs +10 -4
- package/dist/{production/index-react-server-client-BQ6FxdA_.d.ts → development/index-react-server-client-BKpa2trA.d.ts} +6 -816
- package/dist/{production/index-react-server-client-11fLy3qB.d.mts → development/index-react-server-client-DRhjXpk2.d.mts} +2 -3
- package/dist/development/index-react-server-client.d.mts +3 -4
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +4 -3
- package/dist/development/index-react-server.d.ts +4 -3
- package/dist/development/index-react-server.js +62 -53
- package/dist/development/index-react-server.mjs +62 -53
- package/dist/development/index.d.mts +7 -9
- package/dist/development/index.d.ts +5 -5
- package/dist/development/index.js +122 -163
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-CNjObrhZ.d.mts → route-data-DAVP2QQ0.d.mts} +3 -3
- package/dist/development/{routeModules-C3oqzPpI.d.ts → routeModules-rOzWJJ9x.d.ts} +848 -10
- package/dist/production/{chunk-KHPQXKYM.js → chunk-5WPGWA23.js} +125 -183
- package/dist/{development/chunk-IIA3TUI2.js → production/chunk-IK7IYG3O.js} +210 -169
- package/dist/production/{chunk-5Y7ELDIJ.mjs → chunk-LR4OTIMG.mjs} +34 -75
- package/dist/production/{chunk-PFDCNQUK.mjs → chunk-VHBXOG2Z.mjs} +187 -204
- package/dist/production/{context-DohQKLID.d.mts → context-jKip1TFB.d.mts} +846 -8
- package/dist/production/dom-export.d.mts +20 -2
- package/dist/production/dom-export.d.ts +20 -1
- package/dist/production/dom-export.js +10 -4
- package/dist/production/dom-export.mjs +10 -4
- package/dist/{development/index-react-server-client-BQ6FxdA_.d.ts → production/index-react-server-client-BKpa2trA.d.ts} +6 -816
- package/dist/{development/index-react-server-client-11fLy3qB.d.mts → production/index-react-server-client-DRhjXpk2.d.mts} +2 -3
- package/dist/production/index-react-server-client.d.mts +3 -4
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +4 -3
- package/dist/production/index-react-server.d.ts +4 -3
- package/dist/production/index-react-server.js +62 -53
- package/dist/production/index-react-server.mjs +62 -53
- package/dist/production/index.d.mts +7 -9
- package/dist/production/index.d.ts +5 -5
- package/dist/production/index.js +122 -163
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-CNjObrhZ.d.mts → route-data-DAVP2QQ0.d.mts} +3 -3
- package/dist/production/{routeModules-C3oqzPpI.d.ts → routeModules-rOzWJJ9x.d.ts} +848 -10
- package/package.json +1 -1
- package/dist/development/components-CuPfnyiZ.d.mts +0 -814
- package/dist/production/components-CuPfnyiZ.d.mts +0 -814
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.8.1
|
|
2
|
+
* react-router v7.8.2-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkZVMYUFGAjs = require('./chunk-ZVMYUFGA.js');
|
|
65
65
|
|
|
66
66
|
// lib/components.tsx
|
|
67
67
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -72,9 +72,9 @@ function mapRouteProperties(route) {
|
|
|
72
72
|
hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null
|
|
73
73
|
};
|
|
74
74
|
if (route.Component) {
|
|
75
|
-
if (
|
|
75
|
+
if (_chunkZVMYUFGAjs.ENABLE_DEV_WARNINGS) {
|
|
76
76
|
if (route.element) {
|
|
77
|
-
|
|
77
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
78
78
|
false,
|
|
79
79
|
"You should not include both `Component` and `element` on your route - `Component` will be used."
|
|
80
80
|
);
|
|
@@ -86,9 +86,9 @@ function mapRouteProperties(route) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
if (route.HydrateFallback) {
|
|
89
|
-
if (
|
|
89
|
+
if (_chunkZVMYUFGAjs.ENABLE_DEV_WARNINGS) {
|
|
90
90
|
if (route.hydrateFallbackElement) {
|
|
91
|
-
|
|
91
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
92
92
|
false,
|
|
93
93
|
"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."
|
|
94
94
|
);
|
|
@@ -100,9 +100,9 @@ function mapRouteProperties(route) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
if (route.ErrorBoundary) {
|
|
103
|
-
if (
|
|
103
|
+
if (_chunkZVMYUFGAjs.ENABLE_DEV_WARNINGS) {
|
|
104
104
|
if (route.errorElement) {
|
|
105
|
-
|
|
105
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
106
106
|
false,
|
|
107
107
|
"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."
|
|
108
108
|
);
|
|
@@ -120,11 +120,11 @@ var hydrationRouteProperties = [
|
|
|
120
120
|
"hydrateFallbackElement"
|
|
121
121
|
];
|
|
122
122
|
function createMemoryRouter(routes, opts) {
|
|
123
|
-
return
|
|
123
|
+
return _chunkZVMYUFGAjs.createRouter.call(void 0, {
|
|
124
124
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
125
125
|
unstable_getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.unstable_getContext]),
|
|
126
126
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
127
|
-
history:
|
|
127
|
+
history: _chunkZVMYUFGAjs.createMemoryHistory.call(void 0, {
|
|
128
128
|
initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]),
|
|
129
129
|
initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex])
|
|
130
130
|
}),
|
|
@@ -157,7 +157,8 @@ var Deferred = class {
|
|
|
157
157
|
};
|
|
158
158
|
function RouterProvider({
|
|
159
159
|
router,
|
|
160
|
-
flushSync: reactDomFlushSyncImpl
|
|
160
|
+
flushSync: reactDomFlushSyncImpl,
|
|
161
|
+
unstable_onError
|
|
161
162
|
}) {
|
|
162
163
|
let [state, setStateImpl] = React.useState(router.state);
|
|
163
164
|
let [pendingState, setPendingState] = React.useState();
|
|
@@ -168,6 +169,21 @@ function RouterProvider({
|
|
|
168
169
|
let [transition, setTransition] = React.useState();
|
|
169
170
|
let [interruption, setInterruption] = React.useState();
|
|
170
171
|
let fetcherData = React.useRef(/* @__PURE__ */ new Map());
|
|
172
|
+
let logErrorsAndSetState = React.useCallback(
|
|
173
|
+
(newState) => {
|
|
174
|
+
setStateImpl((prevState) => {
|
|
175
|
+
if (newState.errors && unstable_onError) {
|
|
176
|
+
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
177
|
+
if (_optionalChain([prevState, 'access', _10 => _10.errors, 'optionalAccess', _11 => _11[routeId]]) !== error) {
|
|
178
|
+
unstable_onError(error);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return newState;
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
[unstable_onError]
|
|
186
|
+
);
|
|
171
187
|
let setState = React.useCallback(
|
|
172
188
|
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
173
189
|
newState.fetchers.forEach((fetcher, key) => {
|
|
@@ -176,20 +192,20 @@ function RouterProvider({
|
|
|
176
192
|
}
|
|
177
193
|
});
|
|
178
194
|
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
179
|
-
|
|
195
|
+
_chunkZVMYUFGAjs.warnOnce.call(void 0,
|
|
180
196
|
flushSync === false || reactDomFlushSyncImpl != null,
|
|
181
197
|
'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.'
|
|
182
198
|
);
|
|
183
199
|
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
184
|
-
|
|
200
|
+
_chunkZVMYUFGAjs.warnOnce.call(void 0,
|
|
185
201
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
186
202
|
"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."
|
|
187
203
|
);
|
|
188
204
|
if (!viewTransitionOpts || !isViewTransitionAvailable) {
|
|
189
205
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
190
|
-
reactDomFlushSyncImpl(() =>
|
|
206
|
+
reactDomFlushSyncImpl(() => logErrorsAndSetState(newState));
|
|
191
207
|
} else {
|
|
192
|
-
React.startTransition(() =>
|
|
208
|
+
React.startTransition(() => logErrorsAndSetState(newState));
|
|
193
209
|
}
|
|
194
210
|
return;
|
|
195
211
|
}
|
|
@@ -207,7 +223,7 @@ function RouterProvider({
|
|
|
207
223
|
});
|
|
208
224
|
});
|
|
209
225
|
let t = router.window.document.startViewTransition(() => {
|
|
210
|
-
reactDomFlushSyncImpl(() =>
|
|
226
|
+
reactDomFlushSyncImpl(() => logErrorsAndSetState(newState));
|
|
211
227
|
});
|
|
212
228
|
t.finished.finally(() => {
|
|
213
229
|
reactDomFlushSyncImpl(() => {
|
|
@@ -238,7 +254,13 @@ function RouterProvider({
|
|
|
238
254
|
});
|
|
239
255
|
}
|
|
240
256
|
},
|
|
241
|
-
[
|
|
257
|
+
[
|
|
258
|
+
router.window,
|
|
259
|
+
reactDomFlushSyncImpl,
|
|
260
|
+
transition,
|
|
261
|
+
renderDfd,
|
|
262
|
+
logErrorsAndSetState
|
|
263
|
+
]
|
|
242
264
|
);
|
|
243
265
|
React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
244
266
|
React.useEffect(() => {
|
|
@@ -251,7 +273,7 @@ function RouterProvider({
|
|
|
251
273
|
let newState = pendingState;
|
|
252
274
|
let renderPromise = renderDfd.promise;
|
|
253
275
|
let transition2 = router.window.document.startViewTransition(async () => {
|
|
254
|
-
React.startTransition(() =>
|
|
276
|
+
React.startTransition(() => logErrorsAndSetState(newState));
|
|
255
277
|
await renderPromise;
|
|
256
278
|
});
|
|
257
279
|
transition2.finished.finally(() => {
|
|
@@ -262,7 +284,7 @@ function RouterProvider({
|
|
|
262
284
|
});
|
|
263
285
|
setTransition(transition2);
|
|
264
286
|
}
|
|
265
|
-
}, [pendingState, renderDfd, router.window]);
|
|
287
|
+
}, [pendingState, renderDfd, router.window, logErrorsAndSetState]);
|
|
266
288
|
React.useEffect(() => {
|
|
267
289
|
if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
|
|
268
290
|
renderDfd.resolve();
|
|
@@ -287,12 +309,12 @@ function RouterProvider({
|
|
|
287
309
|
go: (n) => router.navigate(n),
|
|
288
310
|
push: (to, state2, opts) => router.navigate(to, {
|
|
289
311
|
state: state2,
|
|
290
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
312
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _12 => _12.preventScrollReset])
|
|
291
313
|
}),
|
|
292
314
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
293
315
|
replace: true,
|
|
294
316
|
state: state2,
|
|
295
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
317
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _13 => _13.preventScrollReset])
|
|
296
318
|
})
|
|
297
319
|
};
|
|
298
320
|
}, [router]);
|
|
@@ -302,11 +324,12 @@ function RouterProvider({
|
|
|
302
324
|
router,
|
|
303
325
|
navigator,
|
|
304
326
|
static: false,
|
|
305
|
-
basename
|
|
327
|
+
basename,
|
|
328
|
+
unstable_onError
|
|
306
329
|
}),
|
|
307
|
-
[router, navigator, basename]
|
|
330
|
+
[router, navigator, basename, unstable_onError]
|
|
308
331
|
);
|
|
309
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
332
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement(
|
|
310
333
|
Router,
|
|
311
334
|
{
|
|
312
335
|
basename,
|
|
@@ -319,7 +342,8 @@ function RouterProvider({
|
|
|
319
342
|
{
|
|
320
343
|
routes: router.routes,
|
|
321
344
|
future: router.future,
|
|
322
|
-
state
|
|
345
|
+
state,
|
|
346
|
+
unstable_onError
|
|
323
347
|
}
|
|
324
348
|
)
|
|
325
349
|
))))), null);
|
|
@@ -328,9 +352,10 @@ var MemoizedDataRoutes = React.memo(DataRoutes);
|
|
|
328
352
|
function DataRoutes({
|
|
329
353
|
routes,
|
|
330
354
|
future,
|
|
331
|
-
state
|
|
355
|
+
state,
|
|
356
|
+
unstable_onError
|
|
332
357
|
}) {
|
|
333
|
-
return
|
|
358
|
+
return _chunkZVMYUFGAjs.useRoutesImpl.call(void 0, routes, void 0, state, unstable_onError, future);
|
|
334
359
|
}
|
|
335
360
|
function MemoryRouter({
|
|
336
361
|
basename,
|
|
@@ -340,7 +365,7 @@ function MemoryRouter({
|
|
|
340
365
|
}) {
|
|
341
366
|
let historyRef = React.useRef();
|
|
342
367
|
if (historyRef.current == null) {
|
|
343
|
-
historyRef.current =
|
|
368
|
+
historyRef.current = _chunkZVMYUFGAjs.createMemoryHistory.call(void 0, {
|
|
344
369
|
initialEntries,
|
|
345
370
|
initialIndex,
|
|
346
371
|
v5Compat: true
|
|
@@ -375,23 +400,23 @@ function Navigate({
|
|
|
375
400
|
state,
|
|
376
401
|
relative
|
|
377
402
|
}) {
|
|
378
|
-
|
|
379
|
-
|
|
403
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
404
|
+
_chunkZVMYUFGAjs.useInRouterContext.call(void 0, ),
|
|
380
405
|
// TODO: This error is probably because they somehow have 2 versions of
|
|
381
406
|
// the router loaded. We can help them understand how to avoid that.
|
|
382
407
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
383
408
|
);
|
|
384
|
-
let { static: isStatic } = React.useContext(
|
|
385
|
-
|
|
409
|
+
let { static: isStatic } = React.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
410
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
386
411
|
!isStatic,
|
|
387
412
|
`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
|
|
388
413
|
);
|
|
389
|
-
let { matches } = React.useContext(
|
|
390
|
-
let { pathname: locationPathname } =
|
|
391
|
-
let navigate =
|
|
392
|
-
let path =
|
|
414
|
+
let { matches } = React.useContext(_chunkZVMYUFGAjs.RouteContext);
|
|
415
|
+
let { pathname: locationPathname } = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
416
|
+
let navigate = _chunkZVMYUFGAjs.useNavigate.call(void 0, );
|
|
417
|
+
let path = _chunkZVMYUFGAjs.resolveTo.call(void 0,
|
|
393
418
|
to,
|
|
394
|
-
|
|
419
|
+
_chunkZVMYUFGAjs.getResolveToMatches.call(void 0, matches),
|
|
395
420
|
locationPathname,
|
|
396
421
|
relative === "path"
|
|
397
422
|
);
|
|
@@ -402,10 +427,10 @@ function Navigate({
|
|
|
402
427
|
return null;
|
|
403
428
|
}
|
|
404
429
|
function Outlet(props) {
|
|
405
|
-
return
|
|
430
|
+
return _chunkZVMYUFGAjs.useOutlet.call(void 0, props.context);
|
|
406
431
|
}
|
|
407
432
|
function Route(props) {
|
|
408
|
-
|
|
433
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
409
434
|
false,
|
|
410
435
|
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
411
436
|
);
|
|
@@ -418,8 +443,8 @@ function Router({
|
|
|
418
443
|
navigator,
|
|
419
444
|
static: staticProp = false
|
|
420
445
|
}) {
|
|
421
|
-
|
|
422
|
-
!
|
|
446
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
447
|
+
!_chunkZVMYUFGAjs.useInRouterContext.call(void 0, ),
|
|
423
448
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
424
449
|
);
|
|
425
450
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -433,7 +458,7 @@ function Router({
|
|
|
433
458
|
[basename, navigator, staticProp]
|
|
434
459
|
);
|
|
435
460
|
if (typeof locationProp === "string") {
|
|
436
|
-
locationProp =
|
|
461
|
+
locationProp = _chunkZVMYUFGAjs.parsePath.call(void 0, locationProp);
|
|
437
462
|
}
|
|
438
463
|
let {
|
|
439
464
|
pathname = "/",
|
|
@@ -443,7 +468,7 @@ function Router({
|
|
|
443
468
|
key = "default"
|
|
444
469
|
} = locationProp;
|
|
445
470
|
let locationContext = React.useMemo(() => {
|
|
446
|
-
let trailingPathname =
|
|
471
|
+
let trailingPathname = _chunkZVMYUFGAjs.stripBasename.call(void 0, pathname, basename);
|
|
447
472
|
if (trailingPathname == null) {
|
|
448
473
|
return null;
|
|
449
474
|
}
|
|
@@ -458,27 +483,36 @@ function Router({
|
|
|
458
483
|
navigationType
|
|
459
484
|
};
|
|
460
485
|
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
461
|
-
|
|
486
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
462
487
|
locationContext != null,
|
|
463
488
|
`<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
|
|
464
489
|
);
|
|
465
490
|
if (locationContext == null) {
|
|
466
491
|
return null;
|
|
467
492
|
}
|
|
468
|
-
return /* @__PURE__ */ React.createElement(
|
|
493
|
+
return /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.LocationContext.Provider, { children, value: locationContext }));
|
|
469
494
|
}
|
|
470
495
|
function Routes({
|
|
471
496
|
children,
|
|
472
497
|
location
|
|
473
498
|
}) {
|
|
474
|
-
return
|
|
499
|
+
return _chunkZVMYUFGAjs.useRoutes.call(void 0, createRoutesFromChildren(children), location);
|
|
475
500
|
}
|
|
476
501
|
function Await({
|
|
477
502
|
children,
|
|
478
503
|
errorElement,
|
|
479
504
|
resolve
|
|
480
505
|
}) {
|
|
481
|
-
|
|
506
|
+
let dataRouterContext = React.useContext(_chunkZVMYUFGAjs.DataRouterContext);
|
|
507
|
+
return /* @__PURE__ */ React.createElement(
|
|
508
|
+
AwaitErrorBoundary,
|
|
509
|
+
{
|
|
510
|
+
resolve,
|
|
511
|
+
errorElement,
|
|
512
|
+
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _14 => _14.unstable_onError])
|
|
513
|
+
},
|
|
514
|
+
/* @__PURE__ */ React.createElement(ResolveAwait, null, children)
|
|
515
|
+
);
|
|
482
516
|
}
|
|
483
517
|
var AwaitErrorBoundary = class extends React.Component {
|
|
484
518
|
constructor(props) {
|
|
@@ -489,11 +523,15 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
489
523
|
return { error };
|
|
490
524
|
}
|
|
491
525
|
componentDidCatch(error, errorInfo) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
526
|
+
if (this.props.unstable_onError) {
|
|
527
|
+
this.props.unstable_onError(error, errorInfo);
|
|
528
|
+
} else {
|
|
529
|
+
console.error(
|
|
530
|
+
"<Await> caught the following error during render",
|
|
531
|
+
error,
|
|
532
|
+
errorInfo
|
|
533
|
+
);
|
|
534
|
+
}
|
|
497
535
|
}
|
|
498
536
|
render() {
|
|
499
537
|
let { children, errorElement, resolve } = this.props;
|
|
@@ -519,17 +557,20 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
519
557
|
Object.defineProperty(resolve, "_tracked", { get: () => true });
|
|
520
558
|
promise = resolve.then(
|
|
521
559
|
(data) => Object.defineProperty(resolve, "_data", { get: () => data }),
|
|
522
|
-
(error) =>
|
|
560
|
+
(error) => {
|
|
561
|
+
_optionalChain([this, 'access', _15 => _15.props, 'access', _16 => _16.unstable_onError, 'optionalCall', _17 => _17(error)]);
|
|
562
|
+
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
563
|
+
}
|
|
523
564
|
);
|
|
524
565
|
}
|
|
525
566
|
if (status === 2 /* error */ && !errorElement) {
|
|
526
567
|
throw promise._error;
|
|
527
568
|
}
|
|
528
569
|
if (status === 2 /* error */) {
|
|
529
|
-
return /* @__PURE__ */ React.createElement(
|
|
570
|
+
return /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.AwaitContext.Provider, { value: promise, children: errorElement });
|
|
530
571
|
}
|
|
531
572
|
if (status === 1 /* success */) {
|
|
532
|
-
return /* @__PURE__ */ React.createElement(
|
|
573
|
+
return /* @__PURE__ */ React.createElement(_chunkZVMYUFGAjs.AwaitContext.Provider, { value: promise, children });
|
|
533
574
|
}
|
|
534
575
|
throw promise;
|
|
535
576
|
}
|
|
@@ -537,7 +578,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
537
578
|
function ResolveAwait({
|
|
538
579
|
children
|
|
539
580
|
}) {
|
|
540
|
-
let data =
|
|
581
|
+
let data = _chunkZVMYUFGAjs.useAsyncValue.call(void 0, );
|
|
541
582
|
let toRender = typeof children === "function" ? children(data) : children;
|
|
542
583
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender);
|
|
543
584
|
}
|
|
@@ -555,11 +596,11 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
555
596
|
);
|
|
556
597
|
return;
|
|
557
598
|
}
|
|
558
|
-
|
|
599
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
559
600
|
element.type === Route,
|
|
560
601
|
`[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
|
|
561
602
|
);
|
|
562
|
-
|
|
603
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
563
604
|
!element.props.index || !element.props.children,
|
|
564
605
|
"An index route cannot have child routes."
|
|
565
606
|
);
|
|
@@ -593,14 +634,14 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
593
634
|
}
|
|
594
635
|
var createRoutesFromElements = createRoutesFromChildren;
|
|
595
636
|
function renderMatches(matches) {
|
|
596
|
-
return
|
|
637
|
+
return _chunkZVMYUFGAjs._renderMatches.call(void 0, matches);
|
|
597
638
|
}
|
|
598
639
|
function useRouteComponentProps() {
|
|
599
640
|
return {
|
|
600
|
-
params:
|
|
601
|
-
loaderData:
|
|
602
|
-
actionData:
|
|
603
|
-
matches:
|
|
641
|
+
params: _chunkZVMYUFGAjs.useParams.call(void 0, ),
|
|
642
|
+
loaderData: _chunkZVMYUFGAjs.useLoaderData.call(void 0, ),
|
|
643
|
+
actionData: _chunkZVMYUFGAjs.useActionData.call(void 0, ),
|
|
644
|
+
matches: _chunkZVMYUFGAjs.useMatches.call(void 0, )
|
|
604
645
|
};
|
|
605
646
|
}
|
|
606
647
|
function WithComponentProps({
|
|
@@ -617,9 +658,9 @@ function withComponentProps(Component2) {
|
|
|
617
658
|
}
|
|
618
659
|
function useHydrateFallbackProps() {
|
|
619
660
|
return {
|
|
620
|
-
params:
|
|
621
|
-
loaderData:
|
|
622
|
-
actionData:
|
|
661
|
+
params: _chunkZVMYUFGAjs.useParams.call(void 0, ),
|
|
662
|
+
loaderData: _chunkZVMYUFGAjs.useLoaderData.call(void 0, ),
|
|
663
|
+
actionData: _chunkZVMYUFGAjs.useActionData.call(void 0, )
|
|
623
664
|
};
|
|
624
665
|
}
|
|
625
666
|
function WithHydrateFallbackProps({
|
|
@@ -636,10 +677,10 @@ function withHydrateFallbackProps(HydrateFallback) {
|
|
|
636
677
|
}
|
|
637
678
|
function useErrorBoundaryProps() {
|
|
638
679
|
return {
|
|
639
|
-
params:
|
|
640
|
-
loaderData:
|
|
641
|
-
actionData:
|
|
642
|
-
error:
|
|
680
|
+
params: _chunkZVMYUFGAjs.useParams.call(void 0, ),
|
|
681
|
+
loaderData: _chunkZVMYUFGAjs.useLoaderData.call(void 0, ),
|
|
682
|
+
actionData: _chunkZVMYUFGAjs.useActionData.call(void 0, ),
|
|
683
|
+
error: _chunkZVMYUFGAjs.useRouteError.call(void 0, )
|
|
643
684
|
};
|
|
644
685
|
}
|
|
645
686
|
function WithErrorBoundaryProps({
|
|
@@ -724,7 +765,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
724
765
|
]);
|
|
725
766
|
function getFormEncType(encType) {
|
|
726
767
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
727
|
-
|
|
768
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
728
769
|
false,
|
|
729
770
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
730
771
|
);
|
|
@@ -740,7 +781,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
740
781
|
let body;
|
|
741
782
|
if (isFormElement(target)) {
|
|
742
783
|
let attr = target.getAttribute("action");
|
|
743
|
-
action = attr ?
|
|
784
|
+
action = attr ? _chunkZVMYUFGAjs.stripBasename.call(void 0, attr, basename) : null;
|
|
744
785
|
method = target.getAttribute("method") || defaultMethod;
|
|
745
786
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
746
787
|
formData = new FormData(target);
|
|
@@ -752,7 +793,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
752
793
|
);
|
|
753
794
|
}
|
|
754
795
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
755
|
-
action = attr ?
|
|
796
|
+
action = attr ? _chunkZVMYUFGAjs.stripBasename.call(void 0, attr, basename) : null;
|
|
756
797
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
757
798
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
758
799
|
formData = new FormData(form, target);
|
|
@@ -789,42 +830,42 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
789
830
|
try {
|
|
790
831
|
if (isBrowser) {
|
|
791
832
|
window.__reactRouterVersion = // @ts-expect-error
|
|
792
|
-
"7.8.1";
|
|
833
|
+
"7.8.2-pre.1";
|
|
793
834
|
}
|
|
794
835
|
} catch (e) {
|
|
795
836
|
}
|
|
796
837
|
function createBrowserRouter(routes, opts) {
|
|
797
|
-
return
|
|
798
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
799
|
-
unstable_getContext: _optionalChain([opts, 'optionalAccess',
|
|
800
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
801
|
-
history:
|
|
802
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
838
|
+
return _chunkZVMYUFGAjs.createRouter.call(void 0, {
|
|
839
|
+
basename: _optionalChain([opts, 'optionalAccess', _18 => _18.basename]),
|
|
840
|
+
unstable_getContext: _optionalChain([opts, 'optionalAccess', _19 => _19.unstable_getContext]),
|
|
841
|
+
future: _optionalChain([opts, 'optionalAccess', _20 => _20.future]),
|
|
842
|
+
history: _chunkZVMYUFGAjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _21 => _21.window]) }),
|
|
843
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _22 => _22.hydrationData]) || parseHydrationData(),
|
|
803
844
|
routes,
|
|
804
845
|
mapRouteProperties,
|
|
805
846
|
hydrationRouteProperties,
|
|
806
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
807
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
808
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
847
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _23 => _23.dataStrategy]),
|
|
848
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _24 => _24.patchRoutesOnNavigation]),
|
|
849
|
+
window: _optionalChain([opts, 'optionalAccess', _25 => _25.window])
|
|
809
850
|
}).initialize();
|
|
810
851
|
}
|
|
811
852
|
function createHashRouter(routes, opts) {
|
|
812
|
-
return
|
|
813
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
814
|
-
unstable_getContext: _optionalChain([opts, 'optionalAccess',
|
|
815
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
816
|
-
history:
|
|
817
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
853
|
+
return _chunkZVMYUFGAjs.createRouter.call(void 0, {
|
|
854
|
+
basename: _optionalChain([opts, 'optionalAccess', _26 => _26.basename]),
|
|
855
|
+
unstable_getContext: _optionalChain([opts, 'optionalAccess', _27 => _27.unstable_getContext]),
|
|
856
|
+
future: _optionalChain([opts, 'optionalAccess', _28 => _28.future]),
|
|
857
|
+
history: _chunkZVMYUFGAjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _29 => _29.window]) }),
|
|
858
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _30 => _30.hydrationData]) || parseHydrationData(),
|
|
818
859
|
routes,
|
|
819
860
|
mapRouteProperties,
|
|
820
861
|
hydrationRouteProperties,
|
|
821
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
822
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
823
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
862
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _31 => _31.dataStrategy]),
|
|
863
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _32 => _32.patchRoutesOnNavigation]),
|
|
864
|
+
window: _optionalChain([opts, 'optionalAccess', _33 => _33.window])
|
|
824
865
|
}).initialize();
|
|
825
866
|
}
|
|
826
867
|
function parseHydrationData() {
|
|
827
|
-
let state = _optionalChain([window, 'optionalAccess',
|
|
868
|
+
let state = _optionalChain([window, 'optionalAccess', _34 => _34.__staticRouterHydrationData]);
|
|
828
869
|
if (state && state.errors) {
|
|
829
870
|
state = {
|
|
830
871
|
...state,
|
|
@@ -839,7 +880,7 @@ function deserializeErrors(errors) {
|
|
|
839
880
|
let serialized = {};
|
|
840
881
|
for (let [key, val] of entries) {
|
|
841
882
|
if (val && val.__type === "RouteErrorResponse") {
|
|
842
|
-
serialized[key] = new (0,
|
|
883
|
+
serialized[key] = new (0, _chunkZVMYUFGAjs.ErrorResponseImpl)(
|
|
843
884
|
val.status,
|
|
844
885
|
val.statusText,
|
|
845
886
|
val.data,
|
|
@@ -875,7 +916,7 @@ function BrowserRouter({
|
|
|
875
916
|
}) {
|
|
876
917
|
let historyRef = React2.useRef();
|
|
877
918
|
if (historyRef.current == null) {
|
|
878
|
-
historyRef.current =
|
|
919
|
+
historyRef.current = _chunkZVMYUFGAjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
879
920
|
}
|
|
880
921
|
let history = historyRef.current;
|
|
881
922
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -903,7 +944,7 @@ function BrowserRouter({
|
|
|
903
944
|
function HashRouter({ basename, children, window: window2 }) {
|
|
904
945
|
let historyRef = React2.useRef();
|
|
905
946
|
if (historyRef.current == null) {
|
|
906
|
-
historyRef.current =
|
|
947
|
+
historyRef.current = _chunkZVMYUFGAjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
907
948
|
}
|
|
908
949
|
let history = historyRef.current;
|
|
909
950
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -972,7 +1013,7 @@ var Link = React2.forwardRef(
|
|
|
972
1013
|
viewTransition,
|
|
973
1014
|
...rest
|
|
974
1015
|
}, forwardedRef) {
|
|
975
|
-
let { basename } = React2.useContext(
|
|
1016
|
+
let { basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
976
1017
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
977
1018
|
let absoluteHref;
|
|
978
1019
|
let isExternal = false;
|
|
@@ -982,22 +1023,22 @@ var Link = React2.forwardRef(
|
|
|
982
1023
|
try {
|
|
983
1024
|
let currentUrl = new URL(window.location.href);
|
|
984
1025
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
985
|
-
let path =
|
|
1026
|
+
let path = _chunkZVMYUFGAjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
986
1027
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
987
1028
|
to = path + targetUrl.search + targetUrl.hash;
|
|
988
1029
|
} else {
|
|
989
1030
|
isExternal = true;
|
|
990
1031
|
}
|
|
991
1032
|
} catch (e) {
|
|
992
|
-
|
|
1033
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
993
1034
|
false,
|
|
994
1035
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
995
1036
|
);
|
|
996
1037
|
}
|
|
997
1038
|
}
|
|
998
1039
|
}
|
|
999
|
-
let href =
|
|
1000
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
1040
|
+
let href = _chunkZVMYUFGAjs.useHref.call(void 0, to, { relative });
|
|
1041
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkZVMYUFGAjs.usePrefetchBehavior.call(void 0,
|
|
1001
1042
|
prefetch,
|
|
1002
1043
|
rest
|
|
1003
1044
|
);
|
|
@@ -1024,13 +1065,13 @@ var Link = React2.forwardRef(
|
|
|
1024
1065
|
...prefetchHandlers,
|
|
1025
1066
|
href: absoluteHref || href,
|
|
1026
1067
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1027
|
-
ref:
|
|
1068
|
+
ref: _chunkZVMYUFGAjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
1028
1069
|
target,
|
|
1029
1070
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
1030
1071
|
}
|
|
1031
1072
|
)
|
|
1032
1073
|
);
|
|
1033
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(
|
|
1074
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(_chunkZVMYUFGAjs.PrefetchPageLinks, { page: href })) : link;
|
|
1034
1075
|
}
|
|
1035
1076
|
);
|
|
1036
1077
|
Link.displayName = "Link";
|
|
@@ -1046,10 +1087,10 @@ var NavLink = React2.forwardRef(
|
|
|
1046
1087
|
children,
|
|
1047
1088
|
...rest
|
|
1048
1089
|
}, ref) {
|
|
1049
|
-
let path =
|
|
1050
|
-
let location =
|
|
1051
|
-
let routerState = React2.useContext(
|
|
1052
|
-
let { navigator, basename } = React2.useContext(
|
|
1090
|
+
let path = _chunkZVMYUFGAjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
1091
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1092
|
+
let routerState = React2.useContext(_chunkZVMYUFGAjs.DataRouterStateContext);
|
|
1093
|
+
let { navigator, basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
1053
1094
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1054
1095
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1055
1096
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -1062,7 +1103,7 @@ var NavLink = React2.forwardRef(
|
|
|
1062
1103
|
toPathname = toPathname.toLowerCase();
|
|
1063
1104
|
}
|
|
1064
1105
|
if (nextLocationPathname && basename) {
|
|
1065
|
-
nextLocationPathname =
|
|
1106
|
+
nextLocationPathname = _chunkZVMYUFGAjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
1066
1107
|
}
|
|
1067
1108
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
1068
1109
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -1126,7 +1167,7 @@ var Form = React2.forwardRef(
|
|
|
1126
1167
|
if (event.defaultPrevented) return;
|
|
1127
1168
|
event.preventDefault();
|
|
1128
1169
|
let submitter = event.nativeEvent.submitter;
|
|
1129
|
-
let submitMethod = _optionalChain([submitter, 'optionalAccess',
|
|
1170
|
+
let submitMethod = _optionalChain([submitter, 'optionalAccess', _35 => _35.getAttribute, 'call', _36 => _36("formmethod")]) || method;
|
|
1130
1171
|
submit(submitter || event.currentTarget, {
|
|
1131
1172
|
fetcherKey,
|
|
1132
1173
|
method: submitMethod,
|
|
@@ -1157,10 +1198,10 @@ function ScrollRestoration({
|
|
|
1157
1198
|
storageKey,
|
|
1158
1199
|
...props
|
|
1159
1200
|
}) {
|
|
1160
|
-
let remixContext = React2.useContext(
|
|
1161
|
-
let { basename } = React2.useContext(
|
|
1162
|
-
let location =
|
|
1163
|
-
let matches =
|
|
1201
|
+
let remixContext = React2.useContext(_chunkZVMYUFGAjs.FrameworkContext);
|
|
1202
|
+
let { basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
1203
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1204
|
+
let matches = _chunkZVMYUFGAjs.useMatches.call(void 0, );
|
|
1164
1205
|
useScrollRestoration({ getKey, storageKey });
|
|
1165
1206
|
let ssrKey = React2.useMemo(
|
|
1166
1207
|
() => {
|
|
@@ -1214,13 +1255,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
1214
1255
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1215
1256
|
}
|
|
1216
1257
|
function useDataRouterContext(hookName) {
|
|
1217
|
-
let ctx = React2.useContext(
|
|
1218
|
-
|
|
1258
|
+
let ctx = React2.useContext(_chunkZVMYUFGAjs.DataRouterContext);
|
|
1259
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
1219
1260
|
return ctx;
|
|
1220
1261
|
}
|
|
1221
1262
|
function useDataRouterState(hookName) {
|
|
1222
|
-
let state = React2.useContext(
|
|
1223
|
-
|
|
1263
|
+
let state = React2.useContext(_chunkZVMYUFGAjs.DataRouterStateContext);
|
|
1264
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
1224
1265
|
return state;
|
|
1225
1266
|
}
|
|
1226
1267
|
function useLinkClickHandler(to, {
|
|
@@ -1231,14 +1272,14 @@ function useLinkClickHandler(to, {
|
|
|
1231
1272
|
relative,
|
|
1232
1273
|
viewTransition
|
|
1233
1274
|
} = {}) {
|
|
1234
|
-
let navigate =
|
|
1235
|
-
let location =
|
|
1236
|
-
let path =
|
|
1275
|
+
let navigate = _chunkZVMYUFGAjs.useNavigate.call(void 0, );
|
|
1276
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1277
|
+
let path = _chunkZVMYUFGAjs.useResolvedPath.call(void 0, to, { relative });
|
|
1237
1278
|
return React2.useCallback(
|
|
1238
1279
|
(event) => {
|
|
1239
1280
|
if (shouldProcessLinkClick(event, target)) {
|
|
1240
1281
|
event.preventDefault();
|
|
1241
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
1282
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkZVMYUFGAjs.createPath.call(void 0, location) === _chunkZVMYUFGAjs.createPath.call(void 0, path);
|
|
1242
1283
|
navigate(to, {
|
|
1243
1284
|
replace,
|
|
1244
1285
|
state,
|
|
@@ -1263,13 +1304,13 @@ function useLinkClickHandler(to, {
|
|
|
1263
1304
|
);
|
|
1264
1305
|
}
|
|
1265
1306
|
function useSearchParams(defaultInit) {
|
|
1266
|
-
|
|
1307
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
1267
1308
|
typeof URLSearchParams !== "undefined",
|
|
1268
1309
|
`You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
|
|
1269
1310
|
);
|
|
1270
1311
|
let defaultSearchParamsRef = React2.useRef(createSearchParams(defaultInit));
|
|
1271
1312
|
let hasSetSearchParamsRef = React2.useRef(false);
|
|
1272
|
-
let location =
|
|
1313
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1273
1314
|
let searchParams = React2.useMemo(
|
|
1274
1315
|
() => (
|
|
1275
1316
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -1282,7 +1323,7 @@ function useSearchParams(defaultInit) {
|
|
|
1282
1323
|
),
|
|
1283
1324
|
[location.search]
|
|
1284
1325
|
);
|
|
1285
|
-
let navigate =
|
|
1326
|
+
let navigate = _chunkZVMYUFGAjs.useNavigate.call(void 0, );
|
|
1286
1327
|
let setSearchParams = React2.useCallback(
|
|
1287
1328
|
(nextInit, navigateOptions) => {
|
|
1288
1329
|
const newSearchParams = createSearchParams(
|
|
@@ -1299,8 +1340,8 @@ var fetcherId = 0;
|
|
|
1299
1340
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
1300
1341
|
function useSubmit() {
|
|
1301
1342
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
1302
|
-
let { basename } = React2.useContext(
|
|
1303
|
-
let currentRouteId =
|
|
1343
|
+
let { basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
1344
|
+
let currentRouteId = _chunkZVMYUFGAjs.useRouteId.call(void 0, );
|
|
1304
1345
|
return React2.useCallback(
|
|
1305
1346
|
async (target, options = {}) => {
|
|
1306
1347
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -1336,12 +1377,12 @@ function useSubmit() {
|
|
|
1336
1377
|
);
|
|
1337
1378
|
}
|
|
1338
1379
|
function useFormAction(action, { relative } = {}) {
|
|
1339
|
-
let { basename } = React2.useContext(
|
|
1340
|
-
let routeContext = React2.useContext(
|
|
1341
|
-
|
|
1380
|
+
let { basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
1381
|
+
let routeContext = React2.useContext(_chunkZVMYUFGAjs.RouteContext);
|
|
1382
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
1342
1383
|
let [match] = routeContext.matches.slice(-1);
|
|
1343
|
-
let path = { ...
|
|
1344
|
-
let location =
|
|
1384
|
+
let path = { ..._chunkZVMYUFGAjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
1385
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1345
1386
|
if (action == null) {
|
|
1346
1387
|
path.search = location.search;
|
|
1347
1388
|
let params = new URLSearchParams(path.search);
|
|
@@ -1358,21 +1399,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
1358
1399
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1359
1400
|
}
|
|
1360
1401
|
if (basename !== "/") {
|
|
1361
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
1402
|
+
path.pathname = path.pathname === "/" ? basename : _chunkZVMYUFGAjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
1362
1403
|
}
|
|
1363
|
-
return
|
|
1404
|
+
return _chunkZVMYUFGAjs.createPath.call(void 0, path);
|
|
1364
1405
|
}
|
|
1365
1406
|
function useFetcher({
|
|
1366
1407
|
key
|
|
1367
1408
|
} = {}) {
|
|
1368
1409
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
1369
1410
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
1370
|
-
let fetcherData = React2.useContext(
|
|
1371
|
-
let route = React2.useContext(
|
|
1372
|
-
let routeId = _optionalChain([route, 'access',
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1411
|
+
let fetcherData = React2.useContext(_chunkZVMYUFGAjs.FetchersContext);
|
|
1412
|
+
let route = React2.useContext(_chunkZVMYUFGAjs.RouteContext);
|
|
1413
|
+
let routeId = _optionalChain([route, 'access', _37 => _37.matches, 'access', _38 => _38[route.matches.length - 1], 'optionalAccess', _39 => _39.route, 'access', _40 => _40.id]);
|
|
1414
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
1415
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
1416
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
1376
1417
|
routeId != null,
|
|
1377
1418
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
1378
1419
|
);
|
|
@@ -1387,7 +1428,7 @@ function useFetcher({
|
|
|
1387
1428
|
}, [router, fetcherKey]);
|
|
1388
1429
|
let load = React2.useCallback(
|
|
1389
1430
|
async (href, opts) => {
|
|
1390
|
-
|
|
1431
|
+
_chunkZVMYUFGAjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
1391
1432
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
1392
1433
|
},
|
|
1393
1434
|
[fetcherKey, routeId, router]
|
|
@@ -1412,7 +1453,7 @@ function useFetcher({
|
|
|
1412
1453
|
FetcherForm2.displayName = "fetcher.Form";
|
|
1413
1454
|
return FetcherForm2;
|
|
1414
1455
|
}, [fetcherKey]);
|
|
1415
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
1456
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkZVMYUFGAjs.IDLE_FETCHER;
|
|
1416
1457
|
let data = fetcherData.get(fetcherKey);
|
|
1417
1458
|
let fetcherWithComponents = React2.useMemo(
|
|
1418
1459
|
() => ({
|
|
@@ -1442,7 +1483,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
1442
1483
|
key = getKey(
|
|
1443
1484
|
{
|
|
1444
1485
|
...location,
|
|
1445
|
-
pathname:
|
|
1486
|
+
pathname: _chunkZVMYUFGAjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
1446
1487
|
},
|
|
1447
1488
|
matches
|
|
1448
1489
|
);
|
|
@@ -1463,10 +1504,10 @@ function useScrollRestoration({
|
|
|
1463
1504
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
1464
1505
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
1465
1506
|
);
|
|
1466
|
-
let { basename } = React2.useContext(
|
|
1467
|
-
let location =
|
|
1468
|
-
let matches =
|
|
1469
|
-
let navigation =
|
|
1507
|
+
let { basename } = React2.useContext(_chunkZVMYUFGAjs.NavigationContext);
|
|
1508
|
+
let location = _chunkZVMYUFGAjs.useLocation.call(void 0, );
|
|
1509
|
+
let matches = _chunkZVMYUFGAjs.useMatches.call(void 0, );
|
|
1510
|
+
let navigation = _chunkZVMYUFGAjs.useNavigation.call(void 0, );
|
|
1470
1511
|
React2.useEffect(() => {
|
|
1471
1512
|
window.history.scrollRestoration = "manual";
|
|
1472
1513
|
return () => {
|
|
@@ -1485,7 +1526,7 @@ function useScrollRestoration({
|
|
|
1485
1526
|
JSON.stringify(savedScrollPositions)
|
|
1486
1527
|
);
|
|
1487
1528
|
} catch (error) {
|
|
1488
|
-
|
|
1529
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
1489
1530
|
false,
|
|
1490
1531
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
1491
1532
|
);
|
|
@@ -1506,7 +1547,7 @@ function useScrollRestoration({
|
|
|
1506
1547
|
}
|
|
1507
1548
|
}, [storageKey]);
|
|
1508
1549
|
React2.useLayoutEffect(() => {
|
|
1509
|
-
let disableScrollRestoration = _optionalChain([router, 'optionalAccess',
|
|
1550
|
+
let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _41 => _41.enableScrollRestoration, 'call', _42 => _42(
|
|
1510
1551
|
savedScrollPositions,
|
|
1511
1552
|
() => window.scrollY,
|
|
1512
1553
|
getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
|
|
@@ -1532,7 +1573,7 @@ function useScrollRestoration({
|
|
|
1532
1573
|
}
|
|
1533
1574
|
}
|
|
1534
1575
|
} catch (e2) {
|
|
1535
|
-
|
|
1576
|
+
_chunkZVMYUFGAjs.warning.call(void 0,
|
|
1536
1577
|
false,
|
|
1537
1578
|
`"${location.hash.slice(
|
|
1538
1579
|
1
|
|
@@ -1570,7 +1611,7 @@ function usePrompt({
|
|
|
1570
1611
|
when,
|
|
1571
1612
|
message
|
|
1572
1613
|
}) {
|
|
1573
|
-
let blocker =
|
|
1614
|
+
let blocker = _chunkZVMYUFGAjs.useBlocker.call(void 0, when);
|
|
1574
1615
|
React2.useEffect(() => {
|
|
1575
1616
|
if (blocker.state === "blocked") {
|
|
1576
1617
|
let proceed = window.confirm(message);
|
|
@@ -1588,21 +1629,21 @@ function usePrompt({
|
|
|
1588
1629
|
}, [blocker, when]);
|
|
1589
1630
|
}
|
|
1590
1631
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1591
|
-
let vtContext = React2.useContext(
|
|
1592
|
-
|
|
1632
|
+
let vtContext = React2.useContext(_chunkZVMYUFGAjs.ViewTransitionContext);
|
|
1633
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
1593
1634
|
vtContext != null,
|
|
1594
1635
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1595
1636
|
);
|
|
1596
1637
|
let { basename } = useDataRouterContext(
|
|
1597
1638
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1598
1639
|
);
|
|
1599
|
-
let path =
|
|
1640
|
+
let path = _chunkZVMYUFGAjs.useResolvedPath.call(void 0, to, { relative });
|
|
1600
1641
|
if (!vtContext.isTransitioning) {
|
|
1601
1642
|
return false;
|
|
1602
1643
|
}
|
|
1603
|
-
let currentPath =
|
|
1604
|
-
let nextPath =
|
|
1605
|
-
return
|
|
1644
|
+
let currentPath = _chunkZVMYUFGAjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1645
|
+
let nextPath = _chunkZVMYUFGAjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1646
|
+
return _chunkZVMYUFGAjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkZVMYUFGAjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1606
1647
|
}
|
|
1607
1648
|
|
|
1608
1649
|
// lib/dom/server.tsx
|
|
@@ -1613,7 +1654,7 @@ function StaticRouter({
|
|
|
1613
1654
|
location: locationProp = "/"
|
|
1614
1655
|
}) {
|
|
1615
1656
|
if (typeof locationProp === "string") {
|
|
1616
|
-
locationProp =
|
|
1657
|
+
locationProp = _chunkZVMYUFGAjs.parsePath.call(void 0, locationProp);
|
|
1617
1658
|
}
|
|
1618
1659
|
let action = "POP" /* Pop */;
|
|
1619
1660
|
let location = {
|
|
@@ -1642,7 +1683,7 @@ function StaticRouterProvider({
|
|
|
1642
1683
|
hydrate = true,
|
|
1643
1684
|
nonce
|
|
1644
1685
|
}) {
|
|
1645
|
-
|
|
1686
|
+
_chunkZVMYUFGAjs.invariant.call(void 0,
|
|
1646
1687
|
router && context,
|
|
1647
1688
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1648
1689
|
);
|
|
@@ -1665,7 +1706,7 @@ function StaticRouterProvider({
|
|
|
1665
1706
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1666
1707
|
}
|
|
1667
1708
|
let { state } = dataRouterContext.router;
|
|
1668
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
1709
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(_chunkZVMYUFGAjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(_chunkZVMYUFGAjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(_chunkZVMYUFGAjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React3.createElement(_chunkZVMYUFGAjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React3.createElement(
|
|
1669
1710
|
Router,
|
|
1670
1711
|
{
|
|
1671
1712
|
basename: dataRouterContext.basename,
|
|
@@ -1696,14 +1737,14 @@ function DataRoutes2({
|
|
|
1696
1737
|
future,
|
|
1697
1738
|
state
|
|
1698
1739
|
}) {
|
|
1699
|
-
return
|
|
1740
|
+
return _chunkZVMYUFGAjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1700
1741
|
}
|
|
1701
1742
|
function serializeErrors(errors) {
|
|
1702
1743
|
if (!errors) return null;
|
|
1703
1744
|
let entries = Object.entries(errors);
|
|
1704
1745
|
let serialized = {};
|
|
1705
1746
|
for (let [key, val] of entries) {
|
|
1706
|
-
if (
|
|
1747
|
+
if (_chunkZVMYUFGAjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1707
1748
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1708
1749
|
} else if (val instanceof Error) {
|
|
1709
1750
|
serialized[key] = {
|
|
@@ -1753,14 +1794,14 @@ function getStatelessNavigator() {
|
|
|
1753
1794
|
};
|
|
1754
1795
|
}
|
|
1755
1796
|
function createStaticHandler2(routes, opts) {
|
|
1756
|
-
return
|
|
1797
|
+
return _chunkZVMYUFGAjs.createStaticHandler.call(void 0, routes, {
|
|
1757
1798
|
...opts,
|
|
1758
1799
|
mapRouteProperties
|
|
1759
1800
|
});
|
|
1760
1801
|
}
|
|
1761
1802
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1762
1803
|
let manifest = {};
|
|
1763
|
-
let dataRoutes =
|
|
1804
|
+
let dataRoutes = _chunkZVMYUFGAjs.convertRoutesToDataRoutes.call(void 0,
|
|
1764
1805
|
routes,
|
|
1765
1806
|
mapRouteProperties,
|
|
1766
1807
|
void 0,
|
|
@@ -1781,7 +1822,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1781
1822
|
get future() {
|
|
1782
1823
|
return {
|
|
1783
1824
|
unstable_middleware: false,
|
|
1784
|
-
..._optionalChain([opts, 'optionalAccess',
|
|
1825
|
+
..._optionalChain([opts, 'optionalAccess', _43 => _43.future])
|
|
1785
1826
|
};
|
|
1786
1827
|
},
|
|
1787
1828
|
get state() {
|
|
@@ -1793,7 +1834,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1793
1834
|
actionData: context.actionData,
|
|
1794
1835
|
errors: context.errors,
|
|
1795
1836
|
initialized: true,
|
|
1796
|
-
navigation:
|
|
1837
|
+
navigation: _chunkZVMYUFGAjs.IDLE_NAVIGATION,
|
|
1797
1838
|
restoreScrollPosition: null,
|
|
1798
1839
|
preventScrollReset: false,
|
|
1799
1840
|
revalidation: "idle",
|
|
@@ -1828,7 +1869,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1828
1869
|
createHref,
|
|
1829
1870
|
encodeLocation,
|
|
1830
1871
|
getFetcher() {
|
|
1831
|
-
return
|
|
1872
|
+
return _chunkZVMYUFGAjs.IDLE_FETCHER;
|
|
1832
1873
|
},
|
|
1833
1874
|
deleteFetcher() {
|
|
1834
1875
|
throw msg("deleteFetcher");
|
|
@@ -1837,7 +1878,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1837
1878
|
throw msg("dispose");
|
|
1838
1879
|
},
|
|
1839
1880
|
getBlocker() {
|
|
1840
|
-
return
|
|
1881
|
+
return _chunkZVMYUFGAjs.IDLE_BLOCKER;
|
|
1841
1882
|
},
|
|
1842
1883
|
deleteBlocker() {
|
|
1843
1884
|
throw msg("deleteBlocker");
|
|
@@ -1855,10 +1896,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1855
1896
|
};
|
|
1856
1897
|
}
|
|
1857
1898
|
function createHref(to) {
|
|
1858
|
-
return typeof to === "string" ? to :
|
|
1899
|
+
return typeof to === "string" ? to : _chunkZVMYUFGAjs.createPath.call(void 0, to);
|
|
1859
1900
|
}
|
|
1860
1901
|
function encodeLocation(to) {
|
|
1861
|
-
let href = typeof to === "string" ? to :
|
|
1902
|
+
let href = typeof to === "string" ? to : _chunkZVMYUFGAjs.createPath.call(void 0, to);
|
|
1862
1903
|
href = href.replace(/ $/, "%20");
|
|
1863
1904
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1864
1905
|
return {
|