react-router 7.9.2-pre.0 → 7.9.2-pre.2
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 +8 -0
- package/dist/development/{chunk-ED2JHW2I.js → chunk-BMRATXNU.js} +1 -1
- package/dist/development/{chunk-VM65TX2A.js → chunk-CVJRSTVH.js} +270 -156
- package/dist/development/{chunk-EPSRV6KC.mjs → chunk-IM5OGALA.mjs} +116 -2
- package/dist/{production/chunk-HAV7J4RO.mjs → development/chunk-Z2FQBQSH.mjs} +63 -58
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- 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.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.js +157 -152
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{development/chunk-PVJ3J6E6.mjs → production/chunk-54D6QT34.mjs} +63 -58
- package/dist/production/{chunk-22I2H6CR.js → chunk-JZBSSDER.js} +1 -1
- package/dist/production/{chunk-K4BWIVAI.js → chunk-MZDKBHOP.js} +270 -156
- package/dist/production/{chunk-662O2YDJ.mjs → chunk-QE6DSGL5.mjs} +116 -2
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- 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.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.js +157 -152
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
|
@@ -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.9.2-pre.
|
|
2
|
+
* react-router v7.9.2-pre.2
|
|
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 _chunkJZBSSDERjs = require('./chunk-JZBSSDER.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 (_chunkJZBSSDERjs.ENABLE_DEV_WARNINGS) {
|
|
76
76
|
if (route.element) {
|
|
77
|
-
|
|
77
|
+
_chunkJZBSSDERjs.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 (_chunkJZBSSDERjs.ENABLE_DEV_WARNINGS) {
|
|
90
90
|
if (route.hydrateFallbackElement) {
|
|
91
|
-
|
|
91
|
+
_chunkJZBSSDERjs.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 (_chunkJZBSSDERjs.ENABLE_DEV_WARNINGS) {
|
|
104
104
|
if (route.errorElement) {
|
|
105
|
-
|
|
105
|
+
_chunkJZBSSDERjs.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 _chunkJZBSSDERjs.createRouter.call(void 0, {
|
|
124
124
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
125
125
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
126
126
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
127
|
-
history:
|
|
127
|
+
history: _chunkJZBSSDERjs.createMemoryHistory.call(void 0, {
|
|
128
128
|
initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]),
|
|
129
129
|
initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex])
|
|
130
130
|
}),
|
|
@@ -155,6 +155,119 @@ var Deferred = class {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
+
function shallowDiff(a, b) {
|
|
159
|
+
if (a === b) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
let aKeys = Object.keys(a);
|
|
163
|
+
let bKeys = Object.keys(b);
|
|
164
|
+
if (aKeys.length !== bKeys.length) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
for (let key of aKeys) {
|
|
168
|
+
if (a[key] !== b[key]) {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
function UNSTABLE_TransitionEnabledRouterProvider({
|
|
175
|
+
router,
|
|
176
|
+
flushSync: reactDomFlushSyncImpl,
|
|
177
|
+
unstable_onError
|
|
178
|
+
}) {
|
|
179
|
+
let fetcherData = React.useRef(/* @__PURE__ */ new Map());
|
|
180
|
+
let [revalidating, startRevalidation] = React.useTransition();
|
|
181
|
+
let [state, setState] = React.useState(router.state);
|
|
182
|
+
router.__setPendingRerender = (promise) => startRevalidation(
|
|
183
|
+
// @ts-expect-error - need react 19 types for this to be async
|
|
184
|
+
async () => {
|
|
185
|
+
const rerender = await promise;
|
|
186
|
+
startRevalidation(() => {
|
|
187
|
+
rerender();
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
let navigator = React.useMemo(() => {
|
|
192
|
+
return {
|
|
193
|
+
createHref: router.createHref,
|
|
194
|
+
encodeLocation: router.encodeLocation,
|
|
195
|
+
go: (n) => router.navigate(n),
|
|
196
|
+
push: (to, state2, opts) => router.navigate(to, {
|
|
197
|
+
state: state2,
|
|
198
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _10 => _10.preventScrollReset])
|
|
199
|
+
}),
|
|
200
|
+
replace: (to, state2, opts) => router.navigate(to, {
|
|
201
|
+
replace: true,
|
|
202
|
+
state: state2,
|
|
203
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _11 => _11.preventScrollReset])
|
|
204
|
+
})
|
|
205
|
+
};
|
|
206
|
+
}, [router]);
|
|
207
|
+
let basename = router.basename || "/";
|
|
208
|
+
let dataRouterContext = React.useMemo(
|
|
209
|
+
() => ({
|
|
210
|
+
router,
|
|
211
|
+
navigator,
|
|
212
|
+
static: false,
|
|
213
|
+
basename,
|
|
214
|
+
unstable_onError
|
|
215
|
+
}),
|
|
216
|
+
[router, navigator, basename, unstable_onError]
|
|
217
|
+
);
|
|
218
|
+
React.useLayoutEffect(() => {
|
|
219
|
+
return router.subscribe(
|
|
220
|
+
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
221
|
+
newState.fetchers.forEach((fetcher, key) => {
|
|
222
|
+
if (fetcher.data !== void 0) {
|
|
223
|
+
fetcherData.current.set(key, fetcher.data);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
227
|
+
const diff = shallowDiff(state, newState);
|
|
228
|
+
if (!diff) return;
|
|
229
|
+
if (flushSync) {
|
|
230
|
+
if (reactDomFlushSyncImpl) {
|
|
231
|
+
reactDomFlushSyncImpl(() => setState(newState));
|
|
232
|
+
} else {
|
|
233
|
+
setState(newState);
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
React.startTransition(() => {
|
|
237
|
+
setState(newState);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}, [router, reactDomFlushSyncImpl, state]);
|
|
243
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(
|
|
244
|
+
_chunkJZBSSDERjs.DataRouterStateContext.Provider,
|
|
245
|
+
{
|
|
246
|
+
value: {
|
|
247
|
+
...state,
|
|
248
|
+
revalidation: revalidating ? "loading" : state.revalidation
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
/* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(
|
|
252
|
+
Router,
|
|
253
|
+
{
|
|
254
|
+
basename,
|
|
255
|
+
location: state.location,
|
|
256
|
+
navigationType: state.historyAction,
|
|
257
|
+
navigator
|
|
258
|
+
},
|
|
259
|
+
/* @__PURE__ */ React.createElement(
|
|
260
|
+
MemoizedDataRoutes,
|
|
261
|
+
{
|
|
262
|
+
routes: router.routes,
|
|
263
|
+
future: router.future,
|
|
264
|
+
state,
|
|
265
|
+
unstable_onError
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
))
|
|
269
|
+
)), null);
|
|
270
|
+
}
|
|
158
271
|
function RouterProvider({
|
|
159
272
|
router,
|
|
160
273
|
flushSync: reactDomFlushSyncImpl,
|
|
@@ -174,7 +287,7 @@ function RouterProvider({
|
|
|
174
287
|
setStateImpl((prevState) => {
|
|
175
288
|
if (newState.errors && unstable_onError) {
|
|
176
289
|
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
177
|
-
if (_optionalChain([prevState, 'access',
|
|
290
|
+
if (_optionalChain([prevState, 'access', _12 => _12.errors, 'optionalAccess', _13 => _13[routeId]]) !== error) {
|
|
178
291
|
unstable_onError(error);
|
|
179
292
|
}
|
|
180
293
|
});
|
|
@@ -192,12 +305,12 @@ function RouterProvider({
|
|
|
192
305
|
}
|
|
193
306
|
});
|
|
194
307
|
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
195
|
-
|
|
308
|
+
_chunkJZBSSDERjs.warnOnce.call(void 0,
|
|
196
309
|
flushSync === false || reactDomFlushSyncImpl != null,
|
|
197
310
|
'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.'
|
|
198
311
|
);
|
|
199
312
|
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
200
|
-
|
|
313
|
+
_chunkJZBSSDERjs.warnOnce.call(void 0,
|
|
201
314
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
202
315
|
"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."
|
|
203
316
|
);
|
|
@@ -309,12 +422,12 @@ function RouterProvider({
|
|
|
309
422
|
go: (n) => router.navigate(n),
|
|
310
423
|
push: (to, state2, opts) => router.navigate(to, {
|
|
311
424
|
state: state2,
|
|
312
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
425
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _14 => _14.preventScrollReset])
|
|
313
426
|
}),
|
|
314
427
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
315
428
|
replace: true,
|
|
316
429
|
state: state2,
|
|
317
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
430
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _15 => _15.preventScrollReset])
|
|
318
431
|
})
|
|
319
432
|
};
|
|
320
433
|
}, [router]);
|
|
@@ -329,7 +442,7 @@ function RouterProvider({
|
|
|
329
442
|
}),
|
|
330
443
|
[router, navigator, basename, unstable_onError]
|
|
331
444
|
);
|
|
332
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
445
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement(
|
|
333
446
|
Router,
|
|
334
447
|
{
|
|
335
448
|
basename,
|
|
@@ -355,7 +468,7 @@ function DataRoutes({
|
|
|
355
468
|
state,
|
|
356
469
|
unstable_onError
|
|
357
470
|
}) {
|
|
358
|
-
return
|
|
471
|
+
return _chunkJZBSSDERjs.useRoutesImpl.call(void 0, routes, void 0, state, unstable_onError, future);
|
|
359
472
|
}
|
|
360
473
|
function MemoryRouter({
|
|
361
474
|
basename,
|
|
@@ -365,7 +478,7 @@ function MemoryRouter({
|
|
|
365
478
|
}) {
|
|
366
479
|
let historyRef = React.useRef();
|
|
367
480
|
if (historyRef.current == null) {
|
|
368
|
-
historyRef.current =
|
|
481
|
+
historyRef.current = _chunkJZBSSDERjs.createMemoryHistory.call(void 0, {
|
|
369
482
|
initialEntries,
|
|
370
483
|
initialIndex,
|
|
371
484
|
v5Compat: true
|
|
@@ -400,23 +513,23 @@ function Navigate({
|
|
|
400
513
|
state,
|
|
401
514
|
relative
|
|
402
515
|
}) {
|
|
403
|
-
|
|
404
|
-
|
|
516
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
517
|
+
_chunkJZBSSDERjs.useInRouterContext.call(void 0, ),
|
|
405
518
|
// TODO: This error is probably because they somehow have 2 versions of
|
|
406
519
|
// the router loaded. We can help them understand how to avoid that.
|
|
407
520
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
408
521
|
);
|
|
409
|
-
let { static: isStatic } = React.useContext(
|
|
410
|
-
|
|
522
|
+
let { static: isStatic } = React.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
523
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
411
524
|
!isStatic,
|
|
412
525
|
`<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.`
|
|
413
526
|
);
|
|
414
|
-
let { matches } = React.useContext(
|
|
415
|
-
let { pathname: locationPathname } =
|
|
416
|
-
let navigate =
|
|
417
|
-
let path =
|
|
527
|
+
let { matches } = React.useContext(_chunkJZBSSDERjs.RouteContext);
|
|
528
|
+
let { pathname: locationPathname } = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
529
|
+
let navigate = _chunkJZBSSDERjs.useNavigate.call(void 0, );
|
|
530
|
+
let path = _chunkJZBSSDERjs.resolveTo.call(void 0,
|
|
418
531
|
to,
|
|
419
|
-
|
|
532
|
+
_chunkJZBSSDERjs.getResolveToMatches.call(void 0, matches),
|
|
420
533
|
locationPathname,
|
|
421
534
|
relative === "path"
|
|
422
535
|
);
|
|
@@ -427,10 +540,10 @@ function Navigate({
|
|
|
427
540
|
return null;
|
|
428
541
|
}
|
|
429
542
|
function Outlet(props) {
|
|
430
|
-
return
|
|
543
|
+
return _chunkJZBSSDERjs.useOutlet.call(void 0, props.context);
|
|
431
544
|
}
|
|
432
545
|
function Route(props) {
|
|
433
|
-
|
|
546
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
434
547
|
false,
|
|
435
548
|
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
436
549
|
);
|
|
@@ -443,8 +556,8 @@ function Router({
|
|
|
443
556
|
navigator,
|
|
444
557
|
static: staticProp = false
|
|
445
558
|
}) {
|
|
446
|
-
|
|
447
|
-
!
|
|
559
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
560
|
+
!_chunkJZBSSDERjs.useInRouterContext.call(void 0, ),
|
|
448
561
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
449
562
|
);
|
|
450
563
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -458,7 +571,7 @@ function Router({
|
|
|
458
571
|
[basename, navigator, staticProp]
|
|
459
572
|
);
|
|
460
573
|
if (typeof locationProp === "string") {
|
|
461
|
-
locationProp =
|
|
574
|
+
locationProp = _chunkJZBSSDERjs.parsePath.call(void 0, locationProp);
|
|
462
575
|
}
|
|
463
576
|
let {
|
|
464
577
|
pathname = "/",
|
|
@@ -468,7 +581,7 @@ function Router({
|
|
|
468
581
|
key = "default"
|
|
469
582
|
} = locationProp;
|
|
470
583
|
let locationContext = React.useMemo(() => {
|
|
471
|
-
let trailingPathname =
|
|
584
|
+
let trailingPathname = _chunkJZBSSDERjs.stripBasename.call(void 0, pathname, basename);
|
|
472
585
|
if (trailingPathname == null) {
|
|
473
586
|
return null;
|
|
474
587
|
}
|
|
@@ -483,33 +596,33 @@ function Router({
|
|
|
483
596
|
navigationType
|
|
484
597
|
};
|
|
485
598
|
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
486
|
-
|
|
599
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
487
600
|
locationContext != null,
|
|
488
601
|
`<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.`
|
|
489
602
|
);
|
|
490
603
|
if (locationContext == null) {
|
|
491
604
|
return null;
|
|
492
605
|
}
|
|
493
|
-
return /* @__PURE__ */ React.createElement(
|
|
606
|
+
return /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.LocationContext.Provider, { children, value: locationContext }));
|
|
494
607
|
}
|
|
495
608
|
function Routes({
|
|
496
609
|
children,
|
|
497
610
|
location
|
|
498
611
|
}) {
|
|
499
|
-
return
|
|
612
|
+
return _chunkJZBSSDERjs.useRoutes.call(void 0, createRoutesFromChildren(children), location);
|
|
500
613
|
}
|
|
501
614
|
function Await({
|
|
502
615
|
children,
|
|
503
616
|
errorElement,
|
|
504
617
|
resolve
|
|
505
618
|
}) {
|
|
506
|
-
let dataRouterContext = React.useContext(
|
|
619
|
+
let dataRouterContext = React.useContext(_chunkJZBSSDERjs.DataRouterContext);
|
|
507
620
|
return /* @__PURE__ */ React.createElement(
|
|
508
621
|
AwaitErrorBoundary,
|
|
509
622
|
{
|
|
510
623
|
resolve,
|
|
511
624
|
errorElement,
|
|
512
|
-
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess',
|
|
625
|
+
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _16 => _16.unstable_onError])
|
|
513
626
|
},
|
|
514
627
|
/* @__PURE__ */ React.createElement(ResolveAwait, null, children)
|
|
515
628
|
);
|
|
@@ -558,7 +671,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
558
671
|
promise = resolve.then(
|
|
559
672
|
(data) => Object.defineProperty(resolve, "_data", { get: () => data }),
|
|
560
673
|
(error) => {
|
|
561
|
-
_optionalChain([this, 'access',
|
|
674
|
+
_optionalChain([this, 'access', _17 => _17.props, 'access', _18 => _18.unstable_onError, 'optionalCall', _19 => _19(error)]);
|
|
562
675
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
563
676
|
}
|
|
564
677
|
);
|
|
@@ -567,10 +680,10 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
567
680
|
throw promise._error;
|
|
568
681
|
}
|
|
569
682
|
if (status === 2 /* error */) {
|
|
570
|
-
return /* @__PURE__ */ React.createElement(
|
|
683
|
+
return /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.AwaitContext.Provider, { value: promise, children: errorElement });
|
|
571
684
|
}
|
|
572
685
|
if (status === 1 /* success */) {
|
|
573
|
-
return /* @__PURE__ */ React.createElement(
|
|
686
|
+
return /* @__PURE__ */ React.createElement(_chunkJZBSSDERjs.AwaitContext.Provider, { value: promise, children });
|
|
574
687
|
}
|
|
575
688
|
throw promise;
|
|
576
689
|
}
|
|
@@ -578,7 +691,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
578
691
|
function ResolveAwait({
|
|
579
692
|
children
|
|
580
693
|
}) {
|
|
581
|
-
let data =
|
|
694
|
+
let data = _chunkJZBSSDERjs.useAsyncValue.call(void 0, );
|
|
582
695
|
let toRender = typeof children === "function" ? children(data) : children;
|
|
583
696
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender);
|
|
584
697
|
}
|
|
@@ -596,11 +709,11 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
596
709
|
);
|
|
597
710
|
return;
|
|
598
711
|
}
|
|
599
|
-
|
|
712
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
600
713
|
element.type === Route,
|
|
601
714
|
`[${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>`
|
|
602
715
|
);
|
|
603
|
-
|
|
716
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
604
717
|
!element.props.index || !element.props.children,
|
|
605
718
|
"An index route cannot have child routes."
|
|
606
719
|
);
|
|
@@ -635,14 +748,14 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
635
748
|
}
|
|
636
749
|
var createRoutesFromElements = createRoutesFromChildren;
|
|
637
750
|
function renderMatches(matches) {
|
|
638
|
-
return
|
|
751
|
+
return _chunkJZBSSDERjs._renderMatches.call(void 0, matches);
|
|
639
752
|
}
|
|
640
753
|
function useRouteComponentProps() {
|
|
641
754
|
return {
|
|
642
|
-
params:
|
|
643
|
-
loaderData:
|
|
644
|
-
actionData:
|
|
645
|
-
matches:
|
|
755
|
+
params: _chunkJZBSSDERjs.useParams.call(void 0, ),
|
|
756
|
+
loaderData: _chunkJZBSSDERjs.useLoaderData.call(void 0, ),
|
|
757
|
+
actionData: _chunkJZBSSDERjs.useActionData.call(void 0, ),
|
|
758
|
+
matches: _chunkJZBSSDERjs.useMatches.call(void 0, )
|
|
646
759
|
};
|
|
647
760
|
}
|
|
648
761
|
function WithComponentProps({
|
|
@@ -659,9 +772,9 @@ function withComponentProps(Component2) {
|
|
|
659
772
|
}
|
|
660
773
|
function useHydrateFallbackProps() {
|
|
661
774
|
return {
|
|
662
|
-
params:
|
|
663
|
-
loaderData:
|
|
664
|
-
actionData:
|
|
775
|
+
params: _chunkJZBSSDERjs.useParams.call(void 0, ),
|
|
776
|
+
loaderData: _chunkJZBSSDERjs.useLoaderData.call(void 0, ),
|
|
777
|
+
actionData: _chunkJZBSSDERjs.useActionData.call(void 0, )
|
|
665
778
|
};
|
|
666
779
|
}
|
|
667
780
|
function WithHydrateFallbackProps({
|
|
@@ -678,10 +791,10 @@ function withHydrateFallbackProps(HydrateFallback) {
|
|
|
678
791
|
}
|
|
679
792
|
function useErrorBoundaryProps() {
|
|
680
793
|
return {
|
|
681
|
-
params:
|
|
682
|
-
loaderData:
|
|
683
|
-
actionData:
|
|
684
|
-
error:
|
|
794
|
+
params: _chunkJZBSSDERjs.useParams.call(void 0, ),
|
|
795
|
+
loaderData: _chunkJZBSSDERjs.useLoaderData.call(void 0, ),
|
|
796
|
+
actionData: _chunkJZBSSDERjs.useActionData.call(void 0, ),
|
|
797
|
+
error: _chunkJZBSSDERjs.useRouteError.call(void 0, )
|
|
685
798
|
};
|
|
686
799
|
}
|
|
687
800
|
function WithErrorBoundaryProps({
|
|
@@ -766,7 +879,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
766
879
|
]);
|
|
767
880
|
function getFormEncType(encType) {
|
|
768
881
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
769
|
-
|
|
882
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
770
883
|
false,
|
|
771
884
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
772
885
|
);
|
|
@@ -782,7 +895,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
782
895
|
let body;
|
|
783
896
|
if (isFormElement(target)) {
|
|
784
897
|
let attr = target.getAttribute("action");
|
|
785
|
-
action = attr ?
|
|
898
|
+
action = attr ? _chunkJZBSSDERjs.stripBasename.call(void 0, attr, basename) : null;
|
|
786
899
|
method = target.getAttribute("method") || defaultMethod;
|
|
787
900
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
788
901
|
formData = new FormData(target);
|
|
@@ -794,7 +907,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
794
907
|
);
|
|
795
908
|
}
|
|
796
909
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
797
|
-
action = attr ?
|
|
910
|
+
action = attr ? _chunkJZBSSDERjs.stripBasename.call(void 0, attr, basename) : null;
|
|
798
911
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
799
912
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
800
913
|
formData = new FormData(form, target);
|
|
@@ -831,42 +944,42 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
831
944
|
try {
|
|
832
945
|
if (isBrowser) {
|
|
833
946
|
window.__reactRouterVersion = // @ts-expect-error
|
|
834
|
-
"7.9.2-pre.
|
|
947
|
+
"7.9.2-pre.2";
|
|
835
948
|
}
|
|
836
949
|
} catch (e) {
|
|
837
950
|
}
|
|
838
951
|
function createBrowserRouter(routes, opts) {
|
|
839
|
-
return
|
|
840
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
841
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
842
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
843
|
-
history:
|
|
844
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
952
|
+
return _chunkJZBSSDERjs.createRouter.call(void 0, {
|
|
953
|
+
basename: _optionalChain([opts, 'optionalAccess', _20 => _20.basename]),
|
|
954
|
+
getContext: _optionalChain([opts, 'optionalAccess', _21 => _21.getContext]),
|
|
955
|
+
future: _optionalChain([opts, 'optionalAccess', _22 => _22.future]),
|
|
956
|
+
history: _chunkJZBSSDERjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _23 => _23.window]) }),
|
|
957
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _24 => _24.hydrationData]) || parseHydrationData(),
|
|
845
958
|
routes,
|
|
846
959
|
mapRouteProperties,
|
|
847
960
|
hydrationRouteProperties,
|
|
848
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
849
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
850
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
961
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _25 => _25.dataStrategy]),
|
|
962
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _26 => _26.patchRoutesOnNavigation]),
|
|
963
|
+
window: _optionalChain([opts, 'optionalAccess', _27 => _27.window])
|
|
851
964
|
}).initialize();
|
|
852
965
|
}
|
|
853
966
|
function createHashRouter(routes, opts) {
|
|
854
|
-
return
|
|
855
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
856
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
857
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
858
|
-
history:
|
|
859
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
967
|
+
return _chunkJZBSSDERjs.createRouter.call(void 0, {
|
|
968
|
+
basename: _optionalChain([opts, 'optionalAccess', _28 => _28.basename]),
|
|
969
|
+
getContext: _optionalChain([opts, 'optionalAccess', _29 => _29.getContext]),
|
|
970
|
+
future: _optionalChain([opts, 'optionalAccess', _30 => _30.future]),
|
|
971
|
+
history: _chunkJZBSSDERjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _31 => _31.window]) }),
|
|
972
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _32 => _32.hydrationData]) || parseHydrationData(),
|
|
860
973
|
routes,
|
|
861
974
|
mapRouteProperties,
|
|
862
975
|
hydrationRouteProperties,
|
|
863
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
864
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
865
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
976
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _33 => _33.dataStrategy]),
|
|
977
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _34 => _34.patchRoutesOnNavigation]),
|
|
978
|
+
window: _optionalChain([opts, 'optionalAccess', _35 => _35.window])
|
|
866
979
|
}).initialize();
|
|
867
980
|
}
|
|
868
981
|
function parseHydrationData() {
|
|
869
|
-
let state = _optionalChain([window, 'optionalAccess',
|
|
982
|
+
let state = _optionalChain([window, 'optionalAccess', _36 => _36.__staticRouterHydrationData]);
|
|
870
983
|
if (state && state.errors) {
|
|
871
984
|
state = {
|
|
872
985
|
...state,
|
|
@@ -881,7 +994,7 @@ function deserializeErrors(errors) {
|
|
|
881
994
|
let serialized = {};
|
|
882
995
|
for (let [key, val] of entries) {
|
|
883
996
|
if (val && val.__type === "RouteErrorResponse") {
|
|
884
|
-
serialized[key] = new (0,
|
|
997
|
+
serialized[key] = new (0, _chunkJZBSSDERjs.ErrorResponseImpl)(
|
|
885
998
|
val.status,
|
|
886
999
|
val.statusText,
|
|
887
1000
|
val.data,
|
|
@@ -917,7 +1030,7 @@ function BrowserRouter({
|
|
|
917
1030
|
}) {
|
|
918
1031
|
let historyRef = React2.useRef();
|
|
919
1032
|
if (historyRef.current == null) {
|
|
920
|
-
historyRef.current =
|
|
1033
|
+
historyRef.current = _chunkJZBSSDERjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
921
1034
|
}
|
|
922
1035
|
let history = historyRef.current;
|
|
923
1036
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -945,7 +1058,7 @@ function BrowserRouter({
|
|
|
945
1058
|
function HashRouter({ basename, children, window: window2 }) {
|
|
946
1059
|
let historyRef = React2.useRef();
|
|
947
1060
|
if (historyRef.current == null) {
|
|
948
|
-
historyRef.current =
|
|
1061
|
+
historyRef.current = _chunkJZBSSDERjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
949
1062
|
}
|
|
950
1063
|
let history = historyRef.current;
|
|
951
1064
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -1014,7 +1127,7 @@ var Link = React2.forwardRef(
|
|
|
1014
1127
|
viewTransition,
|
|
1015
1128
|
...rest
|
|
1016
1129
|
}, forwardedRef) {
|
|
1017
|
-
let { basename } = React2.useContext(
|
|
1130
|
+
let { basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1018
1131
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
1019
1132
|
let absoluteHref;
|
|
1020
1133
|
let isExternal = false;
|
|
@@ -1024,22 +1137,22 @@ var Link = React2.forwardRef(
|
|
|
1024
1137
|
try {
|
|
1025
1138
|
let currentUrl = new URL(window.location.href);
|
|
1026
1139
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
1027
|
-
let path =
|
|
1140
|
+
let path = _chunkJZBSSDERjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
1028
1141
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1029
1142
|
to = path + targetUrl.search + targetUrl.hash;
|
|
1030
1143
|
} else {
|
|
1031
1144
|
isExternal = true;
|
|
1032
1145
|
}
|
|
1033
1146
|
} catch (e) {
|
|
1034
|
-
|
|
1147
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
1035
1148
|
false,
|
|
1036
1149
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1037
1150
|
);
|
|
1038
1151
|
}
|
|
1039
1152
|
}
|
|
1040
1153
|
}
|
|
1041
|
-
let href =
|
|
1042
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
1154
|
+
let href = _chunkJZBSSDERjs.useHref.call(void 0, to, { relative });
|
|
1155
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkJZBSSDERjs.usePrefetchBehavior.call(void 0,
|
|
1043
1156
|
prefetch,
|
|
1044
1157
|
rest
|
|
1045
1158
|
);
|
|
@@ -1066,13 +1179,13 @@ var Link = React2.forwardRef(
|
|
|
1066
1179
|
...prefetchHandlers,
|
|
1067
1180
|
href: absoluteHref || href,
|
|
1068
1181
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1069
|
-
ref:
|
|
1182
|
+
ref: _chunkJZBSSDERjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
1070
1183
|
target,
|
|
1071
1184
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
1072
1185
|
}
|
|
1073
1186
|
)
|
|
1074
1187
|
);
|
|
1075
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(
|
|
1188
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(_chunkJZBSSDERjs.PrefetchPageLinks, { page: href })) : link;
|
|
1076
1189
|
}
|
|
1077
1190
|
);
|
|
1078
1191
|
Link.displayName = "Link";
|
|
@@ -1088,10 +1201,10 @@ var NavLink = React2.forwardRef(
|
|
|
1088
1201
|
children,
|
|
1089
1202
|
...rest
|
|
1090
1203
|
}, ref) {
|
|
1091
|
-
let path =
|
|
1092
|
-
let location =
|
|
1093
|
-
let routerState = React2.useContext(
|
|
1094
|
-
let { navigator, basename } = React2.useContext(
|
|
1204
|
+
let path = _chunkJZBSSDERjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
1205
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1206
|
+
let routerState = React2.useContext(_chunkJZBSSDERjs.DataRouterStateContext);
|
|
1207
|
+
let { navigator, basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1095
1208
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1096
1209
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1097
1210
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -1104,7 +1217,7 @@ var NavLink = React2.forwardRef(
|
|
|
1104
1217
|
toPathname = toPathname.toLowerCase();
|
|
1105
1218
|
}
|
|
1106
1219
|
if (nextLocationPathname && basename) {
|
|
1107
|
-
nextLocationPathname =
|
|
1220
|
+
nextLocationPathname = _chunkJZBSSDERjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
1108
1221
|
}
|
|
1109
1222
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
1110
1223
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -1168,7 +1281,7 @@ var Form = React2.forwardRef(
|
|
|
1168
1281
|
if (event.defaultPrevented) return;
|
|
1169
1282
|
event.preventDefault();
|
|
1170
1283
|
let submitter = event.nativeEvent.submitter;
|
|
1171
|
-
let submitMethod = _optionalChain([submitter, 'optionalAccess',
|
|
1284
|
+
let submitMethod = _optionalChain([submitter, 'optionalAccess', _37 => _37.getAttribute, 'call', _38 => _38("formmethod")]) || method;
|
|
1172
1285
|
submit(submitter || event.currentTarget, {
|
|
1173
1286
|
fetcherKey,
|
|
1174
1287
|
method: submitMethod,
|
|
@@ -1199,10 +1312,10 @@ function ScrollRestoration({
|
|
|
1199
1312
|
storageKey,
|
|
1200
1313
|
...props
|
|
1201
1314
|
}) {
|
|
1202
|
-
let remixContext = React2.useContext(
|
|
1203
|
-
let { basename } = React2.useContext(
|
|
1204
|
-
let location =
|
|
1205
|
-
let matches =
|
|
1315
|
+
let remixContext = React2.useContext(_chunkJZBSSDERjs.FrameworkContext);
|
|
1316
|
+
let { basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1317
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1318
|
+
let matches = _chunkJZBSSDERjs.useMatches.call(void 0, );
|
|
1206
1319
|
useScrollRestoration({ getKey, storageKey });
|
|
1207
1320
|
let ssrKey = React2.useMemo(
|
|
1208
1321
|
() => {
|
|
@@ -1256,13 +1369,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
1256
1369
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1257
1370
|
}
|
|
1258
1371
|
function useDataRouterContext(hookName) {
|
|
1259
|
-
let ctx = React2.useContext(
|
|
1260
|
-
|
|
1372
|
+
let ctx = React2.useContext(_chunkJZBSSDERjs.DataRouterContext);
|
|
1373
|
+
_chunkJZBSSDERjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
1261
1374
|
return ctx;
|
|
1262
1375
|
}
|
|
1263
1376
|
function useDataRouterState(hookName) {
|
|
1264
|
-
let state = React2.useContext(
|
|
1265
|
-
|
|
1377
|
+
let state = React2.useContext(_chunkJZBSSDERjs.DataRouterStateContext);
|
|
1378
|
+
_chunkJZBSSDERjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
1266
1379
|
return state;
|
|
1267
1380
|
}
|
|
1268
1381
|
function useLinkClickHandler(to, {
|
|
@@ -1273,14 +1386,14 @@ function useLinkClickHandler(to, {
|
|
|
1273
1386
|
relative,
|
|
1274
1387
|
viewTransition
|
|
1275
1388
|
} = {}) {
|
|
1276
|
-
let navigate =
|
|
1277
|
-
let location =
|
|
1278
|
-
let path =
|
|
1389
|
+
let navigate = _chunkJZBSSDERjs.useNavigate.call(void 0, );
|
|
1390
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1391
|
+
let path = _chunkJZBSSDERjs.useResolvedPath.call(void 0, to, { relative });
|
|
1279
1392
|
return React2.useCallback(
|
|
1280
1393
|
(event) => {
|
|
1281
1394
|
if (shouldProcessLinkClick(event, target)) {
|
|
1282
1395
|
event.preventDefault();
|
|
1283
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
1396
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkJZBSSDERjs.createPath.call(void 0, location) === _chunkJZBSSDERjs.createPath.call(void 0, path);
|
|
1284
1397
|
navigate(to, {
|
|
1285
1398
|
replace,
|
|
1286
1399
|
state,
|
|
@@ -1305,13 +1418,13 @@ function useLinkClickHandler(to, {
|
|
|
1305
1418
|
);
|
|
1306
1419
|
}
|
|
1307
1420
|
function useSearchParams(defaultInit) {
|
|
1308
|
-
|
|
1421
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
1309
1422
|
typeof URLSearchParams !== "undefined",
|
|
1310
1423
|
`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.`
|
|
1311
1424
|
);
|
|
1312
1425
|
let defaultSearchParamsRef = React2.useRef(createSearchParams(defaultInit));
|
|
1313
1426
|
let hasSetSearchParamsRef = React2.useRef(false);
|
|
1314
|
-
let location =
|
|
1427
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1315
1428
|
let searchParams = React2.useMemo(
|
|
1316
1429
|
() => (
|
|
1317
1430
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -1324,7 +1437,7 @@ function useSearchParams(defaultInit) {
|
|
|
1324
1437
|
),
|
|
1325
1438
|
[location.search]
|
|
1326
1439
|
);
|
|
1327
|
-
let navigate =
|
|
1440
|
+
let navigate = _chunkJZBSSDERjs.useNavigate.call(void 0, );
|
|
1328
1441
|
let setSearchParams = React2.useCallback(
|
|
1329
1442
|
(nextInit, navigateOptions) => {
|
|
1330
1443
|
const newSearchParams = createSearchParams(
|
|
@@ -1341,8 +1454,8 @@ var fetcherId = 0;
|
|
|
1341
1454
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
1342
1455
|
function useSubmit() {
|
|
1343
1456
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
1344
|
-
let { basename } = React2.useContext(
|
|
1345
|
-
let currentRouteId =
|
|
1457
|
+
let { basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1458
|
+
let currentRouteId = _chunkJZBSSDERjs.useRouteId.call(void 0, );
|
|
1346
1459
|
return React2.useCallback(
|
|
1347
1460
|
async (target, options = {}) => {
|
|
1348
1461
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -1378,12 +1491,12 @@ function useSubmit() {
|
|
|
1378
1491
|
);
|
|
1379
1492
|
}
|
|
1380
1493
|
function useFormAction(action, { relative } = {}) {
|
|
1381
|
-
let { basename } = React2.useContext(
|
|
1382
|
-
let routeContext = React2.useContext(
|
|
1383
|
-
|
|
1494
|
+
let { basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1495
|
+
let routeContext = React2.useContext(_chunkJZBSSDERjs.RouteContext);
|
|
1496
|
+
_chunkJZBSSDERjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
1384
1497
|
let [match] = routeContext.matches.slice(-1);
|
|
1385
|
-
let path = { ...
|
|
1386
|
-
let location =
|
|
1498
|
+
let path = { ..._chunkJZBSSDERjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
1499
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1387
1500
|
if (action == null) {
|
|
1388
1501
|
path.search = location.search;
|
|
1389
1502
|
let params = new URLSearchParams(path.search);
|
|
@@ -1400,21 +1513,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
1400
1513
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1401
1514
|
}
|
|
1402
1515
|
if (basename !== "/") {
|
|
1403
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
1516
|
+
path.pathname = path.pathname === "/" ? basename : _chunkJZBSSDERjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
1404
1517
|
}
|
|
1405
|
-
return
|
|
1518
|
+
return _chunkJZBSSDERjs.createPath.call(void 0, path);
|
|
1406
1519
|
}
|
|
1407
1520
|
function useFetcher({
|
|
1408
1521
|
key
|
|
1409
1522
|
} = {}) {
|
|
1410
1523
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
1411
1524
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
1412
|
-
let fetcherData = React2.useContext(
|
|
1413
|
-
let route = React2.useContext(
|
|
1414
|
-
let routeId = _optionalChain([route, 'access',
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1525
|
+
let fetcherData = React2.useContext(_chunkJZBSSDERjs.FetchersContext);
|
|
1526
|
+
let route = React2.useContext(_chunkJZBSSDERjs.RouteContext);
|
|
1527
|
+
let routeId = _optionalChain([route, 'access', _39 => _39.matches, 'access', _40 => _40[route.matches.length - 1], 'optionalAccess', _41 => _41.route, 'access', _42 => _42.id]);
|
|
1528
|
+
_chunkJZBSSDERjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
1529
|
+
_chunkJZBSSDERjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
1530
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
1418
1531
|
routeId != null,
|
|
1419
1532
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
1420
1533
|
);
|
|
@@ -1429,7 +1542,7 @@ function useFetcher({
|
|
|
1429
1542
|
}, [router, fetcherKey]);
|
|
1430
1543
|
let load = React2.useCallback(
|
|
1431
1544
|
async (href, opts) => {
|
|
1432
|
-
|
|
1545
|
+
_chunkJZBSSDERjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
1433
1546
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
1434
1547
|
},
|
|
1435
1548
|
[fetcherKey, routeId, router]
|
|
@@ -1455,7 +1568,7 @@ function useFetcher({
|
|
|
1455
1568
|
FetcherForm2.displayName = "fetcher.Form";
|
|
1456
1569
|
return FetcherForm2;
|
|
1457
1570
|
}, [fetcherKey]);
|
|
1458
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
1571
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkJZBSSDERjs.IDLE_FETCHER;
|
|
1459
1572
|
let data = fetcherData.get(fetcherKey);
|
|
1460
1573
|
let fetcherWithComponents = React2.useMemo(
|
|
1461
1574
|
() => ({
|
|
@@ -1486,7 +1599,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
1486
1599
|
key = getKey(
|
|
1487
1600
|
{
|
|
1488
1601
|
...location,
|
|
1489
|
-
pathname:
|
|
1602
|
+
pathname: _chunkJZBSSDERjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
1490
1603
|
},
|
|
1491
1604
|
matches
|
|
1492
1605
|
);
|
|
@@ -1507,10 +1620,10 @@ function useScrollRestoration({
|
|
|
1507
1620
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
1508
1621
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
1509
1622
|
);
|
|
1510
|
-
let { basename } = React2.useContext(
|
|
1511
|
-
let location =
|
|
1512
|
-
let matches =
|
|
1513
|
-
let navigation =
|
|
1623
|
+
let { basename } = React2.useContext(_chunkJZBSSDERjs.NavigationContext);
|
|
1624
|
+
let location = _chunkJZBSSDERjs.useLocation.call(void 0, );
|
|
1625
|
+
let matches = _chunkJZBSSDERjs.useMatches.call(void 0, );
|
|
1626
|
+
let navigation = _chunkJZBSSDERjs.useNavigation.call(void 0, );
|
|
1514
1627
|
React2.useEffect(() => {
|
|
1515
1628
|
window.history.scrollRestoration = "manual";
|
|
1516
1629
|
return () => {
|
|
@@ -1529,7 +1642,7 @@ function useScrollRestoration({
|
|
|
1529
1642
|
JSON.stringify(savedScrollPositions)
|
|
1530
1643
|
);
|
|
1531
1644
|
} catch (error) {
|
|
1532
|
-
|
|
1645
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
1533
1646
|
false,
|
|
1534
1647
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
1535
1648
|
);
|
|
@@ -1550,7 +1663,7 @@ function useScrollRestoration({
|
|
|
1550
1663
|
}
|
|
1551
1664
|
}, [storageKey]);
|
|
1552
1665
|
React2.useLayoutEffect(() => {
|
|
1553
|
-
let disableScrollRestoration = _optionalChain([router, 'optionalAccess',
|
|
1666
|
+
let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _43 => _43.enableScrollRestoration, 'call', _44 => _44(
|
|
1554
1667
|
savedScrollPositions,
|
|
1555
1668
|
() => window.scrollY,
|
|
1556
1669
|
getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
|
|
@@ -1576,7 +1689,7 @@ function useScrollRestoration({
|
|
|
1576
1689
|
}
|
|
1577
1690
|
}
|
|
1578
1691
|
} catch (e2) {
|
|
1579
|
-
|
|
1692
|
+
_chunkJZBSSDERjs.warning.call(void 0,
|
|
1580
1693
|
false,
|
|
1581
1694
|
`"${location.hash.slice(
|
|
1582
1695
|
1
|
|
@@ -1614,7 +1727,7 @@ function usePrompt({
|
|
|
1614
1727
|
when,
|
|
1615
1728
|
message
|
|
1616
1729
|
}) {
|
|
1617
|
-
let blocker =
|
|
1730
|
+
let blocker = _chunkJZBSSDERjs.useBlocker.call(void 0, when);
|
|
1618
1731
|
React2.useEffect(() => {
|
|
1619
1732
|
if (blocker.state === "blocked") {
|
|
1620
1733
|
let proceed = window.confirm(message);
|
|
@@ -1632,21 +1745,21 @@ function usePrompt({
|
|
|
1632
1745
|
}, [blocker, when]);
|
|
1633
1746
|
}
|
|
1634
1747
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1635
|
-
let vtContext = React2.useContext(
|
|
1636
|
-
|
|
1748
|
+
let vtContext = React2.useContext(_chunkJZBSSDERjs.ViewTransitionContext);
|
|
1749
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
1637
1750
|
vtContext != null,
|
|
1638
1751
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1639
1752
|
);
|
|
1640
1753
|
let { basename } = useDataRouterContext(
|
|
1641
1754
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1642
1755
|
);
|
|
1643
|
-
let path =
|
|
1756
|
+
let path = _chunkJZBSSDERjs.useResolvedPath.call(void 0, to, { relative });
|
|
1644
1757
|
if (!vtContext.isTransitioning) {
|
|
1645
1758
|
return false;
|
|
1646
1759
|
}
|
|
1647
|
-
let currentPath =
|
|
1648
|
-
let nextPath =
|
|
1649
|
-
return
|
|
1760
|
+
let currentPath = _chunkJZBSSDERjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1761
|
+
let nextPath = _chunkJZBSSDERjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1762
|
+
return _chunkJZBSSDERjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkJZBSSDERjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1650
1763
|
}
|
|
1651
1764
|
|
|
1652
1765
|
// lib/dom/server.tsx
|
|
@@ -1657,7 +1770,7 @@ function StaticRouter({
|
|
|
1657
1770
|
location: locationProp = "/"
|
|
1658
1771
|
}) {
|
|
1659
1772
|
if (typeof locationProp === "string") {
|
|
1660
|
-
locationProp =
|
|
1773
|
+
locationProp = _chunkJZBSSDERjs.parsePath.call(void 0, locationProp);
|
|
1661
1774
|
}
|
|
1662
1775
|
let action = "POP" /* Pop */;
|
|
1663
1776
|
let location = {
|
|
@@ -1686,7 +1799,7 @@ function StaticRouterProvider({
|
|
|
1686
1799
|
hydrate = true,
|
|
1687
1800
|
nonce
|
|
1688
1801
|
}) {
|
|
1689
|
-
|
|
1802
|
+
_chunkJZBSSDERjs.invariant.call(void 0,
|
|
1690
1803
|
router && context,
|
|
1691
1804
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1692
1805
|
);
|
|
@@ -1709,7 +1822,7 @@ function StaticRouterProvider({
|
|
|
1709
1822
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1710
1823
|
}
|
|
1711
1824
|
let { state } = dataRouterContext.router;
|
|
1712
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
1825
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(_chunkJZBSSDERjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(_chunkJZBSSDERjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(_chunkJZBSSDERjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React3.createElement(_chunkJZBSSDERjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React3.createElement(
|
|
1713
1826
|
Router,
|
|
1714
1827
|
{
|
|
1715
1828
|
basename: dataRouterContext.basename,
|
|
@@ -1740,14 +1853,14 @@ function DataRoutes2({
|
|
|
1740
1853
|
future,
|
|
1741
1854
|
state
|
|
1742
1855
|
}) {
|
|
1743
|
-
return
|
|
1856
|
+
return _chunkJZBSSDERjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1744
1857
|
}
|
|
1745
1858
|
function serializeErrors(errors) {
|
|
1746
1859
|
if (!errors) return null;
|
|
1747
1860
|
let entries = Object.entries(errors);
|
|
1748
1861
|
let serialized = {};
|
|
1749
1862
|
for (let [key, val] of entries) {
|
|
1750
|
-
if (
|
|
1863
|
+
if (_chunkJZBSSDERjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1751
1864
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1752
1865
|
} else if (val instanceof Error) {
|
|
1753
1866
|
serialized[key] = {
|
|
@@ -1797,14 +1910,14 @@ function getStatelessNavigator() {
|
|
|
1797
1910
|
};
|
|
1798
1911
|
}
|
|
1799
1912
|
function createStaticHandler2(routes, opts) {
|
|
1800
|
-
return
|
|
1913
|
+
return _chunkJZBSSDERjs.createStaticHandler.call(void 0, routes, {
|
|
1801
1914
|
...opts,
|
|
1802
1915
|
mapRouteProperties
|
|
1803
1916
|
});
|
|
1804
1917
|
}
|
|
1805
1918
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1806
1919
|
let manifest = {};
|
|
1807
|
-
let dataRoutes =
|
|
1920
|
+
let dataRoutes = _chunkJZBSSDERjs.convertRoutesToDataRoutes.call(void 0,
|
|
1808
1921
|
routes,
|
|
1809
1922
|
mapRouteProperties,
|
|
1810
1923
|
void 0,
|
|
@@ -1825,7 +1938,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1825
1938
|
get future() {
|
|
1826
1939
|
return {
|
|
1827
1940
|
v8_middleware: false,
|
|
1828
|
-
..._optionalChain([opts, 'optionalAccess',
|
|
1941
|
+
..._optionalChain([opts, 'optionalAccess', _45 => _45.future])
|
|
1829
1942
|
};
|
|
1830
1943
|
},
|
|
1831
1944
|
get state() {
|
|
@@ -1837,7 +1950,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1837
1950
|
actionData: context.actionData,
|
|
1838
1951
|
errors: context.errors,
|
|
1839
1952
|
initialized: true,
|
|
1840
|
-
navigation:
|
|
1953
|
+
navigation: _chunkJZBSSDERjs.IDLE_NAVIGATION,
|
|
1841
1954
|
restoreScrollPosition: null,
|
|
1842
1955
|
preventScrollReset: false,
|
|
1843
1956
|
revalidation: "idle",
|
|
@@ -1872,7 +1985,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1872
1985
|
createHref,
|
|
1873
1986
|
encodeLocation,
|
|
1874
1987
|
getFetcher() {
|
|
1875
|
-
return
|
|
1988
|
+
return _chunkJZBSSDERjs.IDLE_FETCHER;
|
|
1876
1989
|
},
|
|
1877
1990
|
deleteFetcher() {
|
|
1878
1991
|
throw msg("deleteFetcher");
|
|
@@ -1884,7 +1997,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1884
1997
|
throw msg("dispose");
|
|
1885
1998
|
},
|
|
1886
1999
|
getBlocker() {
|
|
1887
|
-
return
|
|
2000
|
+
return _chunkJZBSSDERjs.IDLE_BLOCKER;
|
|
1888
2001
|
},
|
|
1889
2002
|
deleteBlocker() {
|
|
1890
2003
|
throw msg("deleteBlocker");
|
|
@@ -1902,10 +2015,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1902
2015
|
};
|
|
1903
2016
|
}
|
|
1904
2017
|
function createHref(to) {
|
|
1905
|
-
return typeof to === "string" ? to :
|
|
2018
|
+
return typeof to === "string" ? to : _chunkJZBSSDERjs.createPath.call(void 0, to);
|
|
1906
2019
|
}
|
|
1907
2020
|
function encodeLocation(to) {
|
|
1908
|
-
let href = typeof to === "string" ? to :
|
|
2021
|
+
let href = typeof to === "string" ? to : _chunkJZBSSDERjs.createPath.call(void 0, to);
|
|
1909
2022
|
href = href.replace(/ $/, "%20");
|
|
1910
2023
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1911
2024
|
return {
|
|
@@ -1972,4 +2085,5 @@ function htmlEscape(str) {
|
|
|
1972
2085
|
|
|
1973
2086
|
|
|
1974
2087
|
|
|
1975
|
-
|
|
2088
|
+
|
|
2089
|
+
exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.UNSTABLE_TransitionEnabledRouterProvider = UNSTABLE_TransitionEnabledRouterProvider; exports.RouterProvider = RouterProvider; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps; exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter;
|