react-router 7.9.1 → 7.9.2-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -9
- package/dist/development/{chunk-PW3F6ATG.js → chunk-ED2JHW2I.js} +102 -70
- package/dist/development/{chunk-B7RQU5TL.mjs → chunk-EPSRV6KC.mjs} +64 -26
- package/dist/{production/chunk-RCAZODXZ.mjs → development/chunk-PVJ3J6E6.mjs} +94 -9
- package/dist/{production/chunk-3SXVZXGI.js → development/chunk-VM65TX2A.js} +138 -132
- package/dist/development/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
- package/dist/{production/index-react-server-client-BYr9g50r.d.ts → development/index-react-server-client-DKvU8YRr.d.ts} +39 -23
- package/dist/development/index-react-server-client.d.mts +3 -3
- 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 +10 -0
- package/dist/development/index-react-server.d.ts +10 -0
- package/dist/development/index-react-server.js +3 -3
- package/dist/development/index-react-server.mjs +3 -3
- package/dist/development/index.d.mts +16 -12
- package/dist/development/index.d.ts +14 -10
- package/dist/development/index.js +190 -105
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
- package/dist/{production/routeModules-DnUHijGz.d.ts → development/routeModules-BmVo7q9e.d.ts} +20 -0
- package/dist/production/{chunk-HMYSPRGR.js → chunk-22I2H6CR.js} +102 -70
- package/dist/production/{chunk-P25HWPOZ.mjs → chunk-662O2YDJ.mjs} +64 -26
- package/dist/{development/chunk-SKNKB5VI.mjs → production/chunk-HAV7J4RO.mjs} +94 -9
- package/dist/{development/chunk-LWNHKVDL.js → production/chunk-K4BWIVAI.js} +138 -132
- package/dist/production/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
- package/dist/{development/index-react-server-client-BYr9g50r.d.ts → production/index-react-server-client-DKvU8YRr.d.ts} +39 -23
- package/dist/production/index-react-server-client.d.mts +3 -3
- 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 +10 -0
- package/dist/production/index-react-server.d.ts +10 -0
- package/dist/production/index-react-server.js +3 -3
- package/dist/production/index-react-server.mjs +3 -3
- package/dist/production/index.d.mts +16 -12
- package/dist/production/index.d.ts +14 -10
- package/dist/production/index.js +190 -105
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
- package/dist/{development/routeModules-DnUHijGz.d.ts → production/routeModules-BmVo7q9e.d.ts} +20 -0
- 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
|
+
* react-router v7.9.2-pre.0
|
|
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 _chunkED2JHW2Ijs = require('./chunk-ED2JHW2I.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 (_chunkED2JHW2Ijs.ENABLE_DEV_WARNINGS) {
|
|
76
76
|
if (route.element) {
|
|
77
|
-
|
|
77
|
+
_chunkED2JHW2Ijs.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 (_chunkED2JHW2Ijs.ENABLE_DEV_WARNINGS) {
|
|
90
90
|
if (route.hydrateFallbackElement) {
|
|
91
|
-
|
|
91
|
+
_chunkED2JHW2Ijs.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 (_chunkED2JHW2Ijs.ENABLE_DEV_WARNINGS) {
|
|
104
104
|
if (route.errorElement) {
|
|
105
|
-
|
|
105
|
+
_chunkED2JHW2Ijs.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 _chunkED2JHW2Ijs.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: _chunkED2JHW2Ijs.createMemoryHistory.call(void 0, {
|
|
128
128
|
initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]),
|
|
129
129
|
initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex])
|
|
130
130
|
}),
|
|
@@ -192,12 +192,12 @@ function RouterProvider({
|
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
195
|
-
|
|
195
|
+
_chunkED2JHW2Ijs.warnOnce.call(void 0,
|
|
196
196
|
flushSync === false || reactDomFlushSyncImpl != null,
|
|
197
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.'
|
|
198
198
|
);
|
|
199
199
|
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
200
|
-
|
|
200
|
+
_chunkED2JHW2Ijs.warnOnce.call(void 0,
|
|
201
201
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
202
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."
|
|
203
203
|
);
|
|
@@ -329,7 +329,7 @@ function RouterProvider({
|
|
|
329
329
|
}),
|
|
330
330
|
[router, navigator, basename, unstable_onError]
|
|
331
331
|
);
|
|
332
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
332
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement(
|
|
333
333
|
Router,
|
|
334
334
|
{
|
|
335
335
|
basename,
|
|
@@ -355,7 +355,7 @@ function DataRoutes({
|
|
|
355
355
|
state,
|
|
356
356
|
unstable_onError
|
|
357
357
|
}) {
|
|
358
|
-
return
|
|
358
|
+
return _chunkED2JHW2Ijs.useRoutesImpl.call(void 0, routes, void 0, state, unstable_onError, future);
|
|
359
359
|
}
|
|
360
360
|
function MemoryRouter({
|
|
361
361
|
basename,
|
|
@@ -365,7 +365,7 @@ function MemoryRouter({
|
|
|
365
365
|
}) {
|
|
366
366
|
let historyRef = React.useRef();
|
|
367
367
|
if (historyRef.current == null) {
|
|
368
|
-
historyRef.current =
|
|
368
|
+
historyRef.current = _chunkED2JHW2Ijs.createMemoryHistory.call(void 0, {
|
|
369
369
|
initialEntries,
|
|
370
370
|
initialIndex,
|
|
371
371
|
v5Compat: true
|
|
@@ -400,23 +400,23 @@ function Navigate({
|
|
|
400
400
|
state,
|
|
401
401
|
relative
|
|
402
402
|
}) {
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
404
|
+
_chunkED2JHW2Ijs.useInRouterContext.call(void 0, ),
|
|
405
405
|
// TODO: This error is probably because they somehow have 2 versions of
|
|
406
406
|
// the router loaded. We can help them understand how to avoid that.
|
|
407
407
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
408
408
|
);
|
|
409
|
-
let { static: isStatic } = React.useContext(
|
|
410
|
-
|
|
409
|
+
let { static: isStatic } = React.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
410
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
411
411
|
!isStatic,
|
|
412
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.`
|
|
413
413
|
);
|
|
414
|
-
let { matches } = React.useContext(
|
|
415
|
-
let { pathname: locationPathname } =
|
|
416
|
-
let navigate =
|
|
417
|
-
let path =
|
|
414
|
+
let { matches } = React.useContext(_chunkED2JHW2Ijs.RouteContext);
|
|
415
|
+
let { pathname: locationPathname } = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
416
|
+
let navigate = _chunkED2JHW2Ijs.useNavigate.call(void 0, );
|
|
417
|
+
let path = _chunkED2JHW2Ijs.resolveTo.call(void 0,
|
|
418
418
|
to,
|
|
419
|
-
|
|
419
|
+
_chunkED2JHW2Ijs.getResolveToMatches.call(void 0, matches),
|
|
420
420
|
locationPathname,
|
|
421
421
|
relative === "path"
|
|
422
422
|
);
|
|
@@ -427,10 +427,10 @@ function Navigate({
|
|
|
427
427
|
return null;
|
|
428
428
|
}
|
|
429
429
|
function Outlet(props) {
|
|
430
|
-
return
|
|
430
|
+
return _chunkED2JHW2Ijs.useOutlet.call(void 0, props.context);
|
|
431
431
|
}
|
|
432
432
|
function Route(props) {
|
|
433
|
-
|
|
433
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
434
434
|
false,
|
|
435
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>.`
|
|
436
436
|
);
|
|
@@ -443,8 +443,8 @@ function Router({
|
|
|
443
443
|
navigator,
|
|
444
444
|
static: staticProp = false
|
|
445
445
|
}) {
|
|
446
|
-
|
|
447
|
-
!
|
|
446
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
447
|
+
!_chunkED2JHW2Ijs.useInRouterContext.call(void 0, ),
|
|
448
448
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
449
449
|
);
|
|
450
450
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -458,7 +458,7 @@ function Router({
|
|
|
458
458
|
[basename, navigator, staticProp]
|
|
459
459
|
);
|
|
460
460
|
if (typeof locationProp === "string") {
|
|
461
|
-
locationProp =
|
|
461
|
+
locationProp = _chunkED2JHW2Ijs.parsePath.call(void 0, locationProp);
|
|
462
462
|
}
|
|
463
463
|
let {
|
|
464
464
|
pathname = "/",
|
|
@@ -468,7 +468,7 @@ function Router({
|
|
|
468
468
|
key = "default"
|
|
469
469
|
} = locationProp;
|
|
470
470
|
let locationContext = React.useMemo(() => {
|
|
471
|
-
let trailingPathname =
|
|
471
|
+
let trailingPathname = _chunkED2JHW2Ijs.stripBasename.call(void 0, pathname, basename);
|
|
472
472
|
if (trailingPathname == null) {
|
|
473
473
|
return null;
|
|
474
474
|
}
|
|
@@ -483,27 +483,27 @@ function Router({
|
|
|
483
483
|
navigationType
|
|
484
484
|
};
|
|
485
485
|
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
486
|
-
|
|
486
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
487
487
|
locationContext != null,
|
|
488
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.`
|
|
489
489
|
);
|
|
490
490
|
if (locationContext == null) {
|
|
491
491
|
return null;
|
|
492
492
|
}
|
|
493
|
-
return /* @__PURE__ */ React.createElement(
|
|
493
|
+
return /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.LocationContext.Provider, { children, value: locationContext }));
|
|
494
494
|
}
|
|
495
495
|
function Routes({
|
|
496
496
|
children,
|
|
497
497
|
location
|
|
498
498
|
}) {
|
|
499
|
-
return
|
|
499
|
+
return _chunkED2JHW2Ijs.useRoutes.call(void 0, createRoutesFromChildren(children), location);
|
|
500
500
|
}
|
|
501
501
|
function Await({
|
|
502
502
|
children,
|
|
503
503
|
errorElement,
|
|
504
504
|
resolve
|
|
505
505
|
}) {
|
|
506
|
-
let dataRouterContext = React.useContext(
|
|
506
|
+
let dataRouterContext = React.useContext(_chunkED2JHW2Ijs.DataRouterContext);
|
|
507
507
|
return /* @__PURE__ */ React.createElement(
|
|
508
508
|
AwaitErrorBoundary,
|
|
509
509
|
{
|
|
@@ -567,10 +567,10 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
567
567
|
throw promise._error;
|
|
568
568
|
}
|
|
569
569
|
if (status === 2 /* error */) {
|
|
570
|
-
return /* @__PURE__ */ React.createElement(
|
|
570
|
+
return /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.AwaitContext.Provider, { value: promise, children: errorElement });
|
|
571
571
|
}
|
|
572
572
|
if (status === 1 /* success */) {
|
|
573
|
-
return /* @__PURE__ */ React.createElement(
|
|
573
|
+
return /* @__PURE__ */ React.createElement(_chunkED2JHW2Ijs.AwaitContext.Provider, { value: promise, children });
|
|
574
574
|
}
|
|
575
575
|
throw promise;
|
|
576
576
|
}
|
|
@@ -578,7 +578,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
578
578
|
function ResolveAwait({
|
|
579
579
|
children
|
|
580
580
|
}) {
|
|
581
|
-
let data =
|
|
581
|
+
let data = _chunkED2JHW2Ijs.useAsyncValue.call(void 0, );
|
|
582
582
|
let toRender = typeof children === "function" ? children(data) : children;
|
|
583
583
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender);
|
|
584
584
|
}
|
|
@@ -596,11 +596,11 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
596
596
|
);
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
600
600
|
element.type === Route,
|
|
601
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>`
|
|
602
602
|
);
|
|
603
|
-
|
|
603
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
604
604
|
!element.props.index || !element.props.children,
|
|
605
605
|
"An index route cannot have child routes."
|
|
606
606
|
);
|
|
@@ -611,6 +611,7 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
611
611
|
Component: element.props.Component,
|
|
612
612
|
index: element.props.index,
|
|
613
613
|
path: element.props.path,
|
|
614
|
+
middleware: element.props.middleware,
|
|
614
615
|
loader: element.props.loader,
|
|
615
616
|
action: element.props.action,
|
|
616
617
|
hydrateFallbackElement: element.props.hydrateFallbackElement,
|
|
@@ -634,14 +635,14 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
634
635
|
}
|
|
635
636
|
var createRoutesFromElements = createRoutesFromChildren;
|
|
636
637
|
function renderMatches(matches) {
|
|
637
|
-
return
|
|
638
|
+
return _chunkED2JHW2Ijs._renderMatches.call(void 0, matches);
|
|
638
639
|
}
|
|
639
640
|
function useRouteComponentProps() {
|
|
640
641
|
return {
|
|
641
|
-
params:
|
|
642
|
-
loaderData:
|
|
643
|
-
actionData:
|
|
644
|
-
matches:
|
|
642
|
+
params: _chunkED2JHW2Ijs.useParams.call(void 0, ),
|
|
643
|
+
loaderData: _chunkED2JHW2Ijs.useLoaderData.call(void 0, ),
|
|
644
|
+
actionData: _chunkED2JHW2Ijs.useActionData.call(void 0, ),
|
|
645
|
+
matches: _chunkED2JHW2Ijs.useMatches.call(void 0, )
|
|
645
646
|
};
|
|
646
647
|
}
|
|
647
648
|
function WithComponentProps({
|
|
@@ -658,9 +659,9 @@ function withComponentProps(Component2) {
|
|
|
658
659
|
}
|
|
659
660
|
function useHydrateFallbackProps() {
|
|
660
661
|
return {
|
|
661
|
-
params:
|
|
662
|
-
loaderData:
|
|
663
|
-
actionData:
|
|
662
|
+
params: _chunkED2JHW2Ijs.useParams.call(void 0, ),
|
|
663
|
+
loaderData: _chunkED2JHW2Ijs.useLoaderData.call(void 0, ),
|
|
664
|
+
actionData: _chunkED2JHW2Ijs.useActionData.call(void 0, )
|
|
664
665
|
};
|
|
665
666
|
}
|
|
666
667
|
function WithHydrateFallbackProps({
|
|
@@ -677,10 +678,10 @@ function withHydrateFallbackProps(HydrateFallback) {
|
|
|
677
678
|
}
|
|
678
679
|
function useErrorBoundaryProps() {
|
|
679
680
|
return {
|
|
680
|
-
params:
|
|
681
|
-
loaderData:
|
|
682
|
-
actionData:
|
|
683
|
-
error:
|
|
681
|
+
params: _chunkED2JHW2Ijs.useParams.call(void 0, ),
|
|
682
|
+
loaderData: _chunkED2JHW2Ijs.useLoaderData.call(void 0, ),
|
|
683
|
+
actionData: _chunkED2JHW2Ijs.useActionData.call(void 0, ),
|
|
684
|
+
error: _chunkED2JHW2Ijs.useRouteError.call(void 0, )
|
|
684
685
|
};
|
|
685
686
|
}
|
|
686
687
|
function WithErrorBoundaryProps({
|
|
@@ -765,7 +766,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
765
766
|
]);
|
|
766
767
|
function getFormEncType(encType) {
|
|
767
768
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
768
|
-
|
|
769
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
769
770
|
false,
|
|
770
771
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
771
772
|
);
|
|
@@ -781,7 +782,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
781
782
|
let body;
|
|
782
783
|
if (isFormElement(target)) {
|
|
783
784
|
let attr = target.getAttribute("action");
|
|
784
|
-
action = attr ?
|
|
785
|
+
action = attr ? _chunkED2JHW2Ijs.stripBasename.call(void 0, attr, basename) : null;
|
|
785
786
|
method = target.getAttribute("method") || defaultMethod;
|
|
786
787
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
787
788
|
formData = new FormData(target);
|
|
@@ -793,7 +794,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
793
794
|
);
|
|
794
795
|
}
|
|
795
796
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
796
|
-
action = attr ?
|
|
797
|
+
action = attr ? _chunkED2JHW2Ijs.stripBasename.call(void 0, attr, basename) : null;
|
|
797
798
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
798
799
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
799
800
|
formData = new FormData(form, target);
|
|
@@ -830,16 +831,16 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
830
831
|
try {
|
|
831
832
|
if (isBrowser) {
|
|
832
833
|
window.__reactRouterVersion = // @ts-expect-error
|
|
833
|
-
"7.9.
|
|
834
|
+
"7.9.2-pre.0";
|
|
834
835
|
}
|
|
835
836
|
} catch (e) {
|
|
836
837
|
}
|
|
837
838
|
function createBrowserRouter(routes, opts) {
|
|
838
|
-
return
|
|
839
|
+
return _chunkED2JHW2Ijs.createRouter.call(void 0, {
|
|
839
840
|
basename: _optionalChain([opts, 'optionalAccess', _18 => _18.basename]),
|
|
840
841
|
getContext: _optionalChain([opts, 'optionalAccess', _19 => _19.getContext]),
|
|
841
842
|
future: _optionalChain([opts, 'optionalAccess', _20 => _20.future]),
|
|
842
|
-
history:
|
|
843
|
+
history: _chunkED2JHW2Ijs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _21 => _21.window]) }),
|
|
843
844
|
hydrationData: _optionalChain([opts, 'optionalAccess', _22 => _22.hydrationData]) || parseHydrationData(),
|
|
844
845
|
routes,
|
|
845
846
|
mapRouteProperties,
|
|
@@ -850,11 +851,11 @@ function createBrowserRouter(routes, opts) {
|
|
|
850
851
|
}).initialize();
|
|
851
852
|
}
|
|
852
853
|
function createHashRouter(routes, opts) {
|
|
853
|
-
return
|
|
854
|
+
return _chunkED2JHW2Ijs.createRouter.call(void 0, {
|
|
854
855
|
basename: _optionalChain([opts, 'optionalAccess', _26 => _26.basename]),
|
|
855
856
|
getContext: _optionalChain([opts, 'optionalAccess', _27 => _27.getContext]),
|
|
856
857
|
future: _optionalChain([opts, 'optionalAccess', _28 => _28.future]),
|
|
857
|
-
history:
|
|
858
|
+
history: _chunkED2JHW2Ijs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _29 => _29.window]) }),
|
|
858
859
|
hydrationData: _optionalChain([opts, 'optionalAccess', _30 => _30.hydrationData]) || parseHydrationData(),
|
|
859
860
|
routes,
|
|
860
861
|
mapRouteProperties,
|
|
@@ -880,7 +881,7 @@ function deserializeErrors(errors) {
|
|
|
880
881
|
let serialized = {};
|
|
881
882
|
for (let [key, val] of entries) {
|
|
882
883
|
if (val && val.__type === "RouteErrorResponse") {
|
|
883
|
-
serialized[key] = new (0,
|
|
884
|
+
serialized[key] = new (0, _chunkED2JHW2Ijs.ErrorResponseImpl)(
|
|
884
885
|
val.status,
|
|
885
886
|
val.statusText,
|
|
886
887
|
val.data,
|
|
@@ -916,7 +917,7 @@ function BrowserRouter({
|
|
|
916
917
|
}) {
|
|
917
918
|
let historyRef = React2.useRef();
|
|
918
919
|
if (historyRef.current == null) {
|
|
919
|
-
historyRef.current =
|
|
920
|
+
historyRef.current = _chunkED2JHW2Ijs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
920
921
|
}
|
|
921
922
|
let history = historyRef.current;
|
|
922
923
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -944,7 +945,7 @@ function BrowserRouter({
|
|
|
944
945
|
function HashRouter({ basename, children, window: window2 }) {
|
|
945
946
|
let historyRef = React2.useRef();
|
|
946
947
|
if (historyRef.current == null) {
|
|
947
|
-
historyRef.current =
|
|
948
|
+
historyRef.current = _chunkED2JHW2Ijs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
948
949
|
}
|
|
949
950
|
let history = historyRef.current;
|
|
950
951
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -1013,7 +1014,7 @@ var Link = React2.forwardRef(
|
|
|
1013
1014
|
viewTransition,
|
|
1014
1015
|
...rest
|
|
1015
1016
|
}, forwardedRef) {
|
|
1016
|
-
let { basename } = React2.useContext(
|
|
1017
|
+
let { basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1017
1018
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
1018
1019
|
let absoluteHref;
|
|
1019
1020
|
let isExternal = false;
|
|
@@ -1023,22 +1024,22 @@ var Link = React2.forwardRef(
|
|
|
1023
1024
|
try {
|
|
1024
1025
|
let currentUrl = new URL(window.location.href);
|
|
1025
1026
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
1026
|
-
let path =
|
|
1027
|
+
let path = _chunkED2JHW2Ijs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
1027
1028
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1028
1029
|
to = path + targetUrl.search + targetUrl.hash;
|
|
1029
1030
|
} else {
|
|
1030
1031
|
isExternal = true;
|
|
1031
1032
|
}
|
|
1032
1033
|
} catch (e) {
|
|
1033
|
-
|
|
1034
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
1034
1035
|
false,
|
|
1035
1036
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1036
1037
|
);
|
|
1037
1038
|
}
|
|
1038
1039
|
}
|
|
1039
1040
|
}
|
|
1040
|
-
let href =
|
|
1041
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
1041
|
+
let href = _chunkED2JHW2Ijs.useHref.call(void 0, to, { relative });
|
|
1042
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkED2JHW2Ijs.usePrefetchBehavior.call(void 0,
|
|
1042
1043
|
prefetch,
|
|
1043
1044
|
rest
|
|
1044
1045
|
);
|
|
@@ -1065,13 +1066,13 @@ var Link = React2.forwardRef(
|
|
|
1065
1066
|
...prefetchHandlers,
|
|
1066
1067
|
href: absoluteHref || href,
|
|
1067
1068
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1068
|
-
ref:
|
|
1069
|
+
ref: _chunkED2JHW2Ijs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
1069
1070
|
target,
|
|
1070
1071
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
1071
1072
|
}
|
|
1072
1073
|
)
|
|
1073
1074
|
);
|
|
1074
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(
|
|
1075
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(_chunkED2JHW2Ijs.PrefetchPageLinks, { page: href })) : link;
|
|
1075
1076
|
}
|
|
1076
1077
|
);
|
|
1077
1078
|
Link.displayName = "Link";
|
|
@@ -1087,10 +1088,10 @@ var NavLink = React2.forwardRef(
|
|
|
1087
1088
|
children,
|
|
1088
1089
|
...rest
|
|
1089
1090
|
}, ref) {
|
|
1090
|
-
let path =
|
|
1091
|
-
let location =
|
|
1092
|
-
let routerState = React2.useContext(
|
|
1093
|
-
let { navigator, basename } = React2.useContext(
|
|
1091
|
+
let path = _chunkED2JHW2Ijs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
1092
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1093
|
+
let routerState = React2.useContext(_chunkED2JHW2Ijs.DataRouterStateContext);
|
|
1094
|
+
let { navigator, basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1094
1095
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1095
1096
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1096
1097
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -1103,7 +1104,7 @@ var NavLink = React2.forwardRef(
|
|
|
1103
1104
|
toPathname = toPathname.toLowerCase();
|
|
1104
1105
|
}
|
|
1105
1106
|
if (nextLocationPathname && basename) {
|
|
1106
|
-
nextLocationPathname =
|
|
1107
|
+
nextLocationPathname = _chunkED2JHW2Ijs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
1107
1108
|
}
|
|
1108
1109
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
1109
1110
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -1198,10 +1199,10 @@ function ScrollRestoration({
|
|
|
1198
1199
|
storageKey,
|
|
1199
1200
|
...props
|
|
1200
1201
|
}) {
|
|
1201
|
-
let remixContext = React2.useContext(
|
|
1202
|
-
let { basename } = React2.useContext(
|
|
1203
|
-
let location =
|
|
1204
|
-
let matches =
|
|
1202
|
+
let remixContext = React2.useContext(_chunkED2JHW2Ijs.FrameworkContext);
|
|
1203
|
+
let { basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1204
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1205
|
+
let matches = _chunkED2JHW2Ijs.useMatches.call(void 0, );
|
|
1205
1206
|
useScrollRestoration({ getKey, storageKey });
|
|
1206
1207
|
let ssrKey = React2.useMemo(
|
|
1207
1208
|
() => {
|
|
@@ -1255,13 +1256,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
1255
1256
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1256
1257
|
}
|
|
1257
1258
|
function useDataRouterContext(hookName) {
|
|
1258
|
-
let ctx = React2.useContext(
|
|
1259
|
-
|
|
1259
|
+
let ctx = React2.useContext(_chunkED2JHW2Ijs.DataRouterContext);
|
|
1260
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
1260
1261
|
return ctx;
|
|
1261
1262
|
}
|
|
1262
1263
|
function useDataRouterState(hookName) {
|
|
1263
|
-
let state = React2.useContext(
|
|
1264
|
-
|
|
1264
|
+
let state = React2.useContext(_chunkED2JHW2Ijs.DataRouterStateContext);
|
|
1265
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
1265
1266
|
return state;
|
|
1266
1267
|
}
|
|
1267
1268
|
function useLinkClickHandler(to, {
|
|
@@ -1272,14 +1273,14 @@ function useLinkClickHandler(to, {
|
|
|
1272
1273
|
relative,
|
|
1273
1274
|
viewTransition
|
|
1274
1275
|
} = {}) {
|
|
1275
|
-
let navigate =
|
|
1276
|
-
let location =
|
|
1277
|
-
let path =
|
|
1276
|
+
let navigate = _chunkED2JHW2Ijs.useNavigate.call(void 0, );
|
|
1277
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1278
|
+
let path = _chunkED2JHW2Ijs.useResolvedPath.call(void 0, to, { relative });
|
|
1278
1279
|
return React2.useCallback(
|
|
1279
1280
|
(event) => {
|
|
1280
1281
|
if (shouldProcessLinkClick(event, target)) {
|
|
1281
1282
|
event.preventDefault();
|
|
1282
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
1283
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkED2JHW2Ijs.createPath.call(void 0, location) === _chunkED2JHW2Ijs.createPath.call(void 0, path);
|
|
1283
1284
|
navigate(to, {
|
|
1284
1285
|
replace,
|
|
1285
1286
|
state,
|
|
@@ -1304,13 +1305,13 @@ function useLinkClickHandler(to, {
|
|
|
1304
1305
|
);
|
|
1305
1306
|
}
|
|
1306
1307
|
function useSearchParams(defaultInit) {
|
|
1307
|
-
|
|
1308
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
1308
1309
|
typeof URLSearchParams !== "undefined",
|
|
1309
1310
|
`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.`
|
|
1310
1311
|
);
|
|
1311
1312
|
let defaultSearchParamsRef = React2.useRef(createSearchParams(defaultInit));
|
|
1312
1313
|
let hasSetSearchParamsRef = React2.useRef(false);
|
|
1313
|
-
let location =
|
|
1314
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1314
1315
|
let searchParams = React2.useMemo(
|
|
1315
1316
|
() => (
|
|
1316
1317
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -1323,7 +1324,7 @@ function useSearchParams(defaultInit) {
|
|
|
1323
1324
|
),
|
|
1324
1325
|
[location.search]
|
|
1325
1326
|
);
|
|
1326
|
-
let navigate =
|
|
1327
|
+
let navigate = _chunkED2JHW2Ijs.useNavigate.call(void 0, );
|
|
1327
1328
|
let setSearchParams = React2.useCallback(
|
|
1328
1329
|
(nextInit, navigateOptions) => {
|
|
1329
1330
|
const newSearchParams = createSearchParams(
|
|
@@ -1340,8 +1341,8 @@ var fetcherId = 0;
|
|
|
1340
1341
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
1341
1342
|
function useSubmit() {
|
|
1342
1343
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
1343
|
-
let { basename } = React2.useContext(
|
|
1344
|
-
let currentRouteId =
|
|
1344
|
+
let { basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1345
|
+
let currentRouteId = _chunkED2JHW2Ijs.useRouteId.call(void 0, );
|
|
1345
1346
|
return React2.useCallback(
|
|
1346
1347
|
async (target, options = {}) => {
|
|
1347
1348
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -1377,12 +1378,12 @@ function useSubmit() {
|
|
|
1377
1378
|
);
|
|
1378
1379
|
}
|
|
1379
1380
|
function useFormAction(action, { relative } = {}) {
|
|
1380
|
-
let { basename } = React2.useContext(
|
|
1381
|
-
let routeContext = React2.useContext(
|
|
1382
|
-
|
|
1381
|
+
let { basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1382
|
+
let routeContext = React2.useContext(_chunkED2JHW2Ijs.RouteContext);
|
|
1383
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
1383
1384
|
let [match] = routeContext.matches.slice(-1);
|
|
1384
|
-
let path = { ...
|
|
1385
|
-
let location =
|
|
1385
|
+
let path = { ..._chunkED2JHW2Ijs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
1386
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1386
1387
|
if (action == null) {
|
|
1387
1388
|
path.search = location.search;
|
|
1388
1389
|
let params = new URLSearchParams(path.search);
|
|
@@ -1399,21 +1400,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
1399
1400
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1400
1401
|
}
|
|
1401
1402
|
if (basename !== "/") {
|
|
1402
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
1403
|
+
path.pathname = path.pathname === "/" ? basename : _chunkED2JHW2Ijs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
1403
1404
|
}
|
|
1404
|
-
return
|
|
1405
|
+
return _chunkED2JHW2Ijs.createPath.call(void 0, path);
|
|
1405
1406
|
}
|
|
1406
1407
|
function useFetcher({
|
|
1407
1408
|
key
|
|
1408
1409
|
} = {}) {
|
|
1409
1410
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
1410
1411
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
1411
|
-
let fetcherData = React2.useContext(
|
|
1412
|
-
let route = React2.useContext(
|
|
1412
|
+
let fetcherData = React2.useContext(_chunkED2JHW2Ijs.FetchersContext);
|
|
1413
|
+
let route = React2.useContext(_chunkED2JHW2Ijs.RouteContext);
|
|
1413
1414
|
let routeId = _optionalChain([route, 'access', _37 => _37.matches, 'access', _38 => _38[route.matches.length - 1], 'optionalAccess', _39 => _39.route, 'access', _40 => _40.id]);
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1415
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
1416
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
1417
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
1417
1418
|
routeId != null,
|
|
1418
1419
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
1419
1420
|
);
|
|
@@ -1428,7 +1429,7 @@ function useFetcher({
|
|
|
1428
1429
|
}, [router, fetcherKey]);
|
|
1429
1430
|
let load = React2.useCallback(
|
|
1430
1431
|
async (href, opts) => {
|
|
1431
|
-
|
|
1432
|
+
_chunkED2JHW2Ijs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
1432
1433
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
1433
1434
|
},
|
|
1434
1435
|
[fetcherKey, routeId, router]
|
|
@@ -1444,6 +1445,7 @@ function useFetcher({
|
|
|
1444
1445
|
},
|
|
1445
1446
|
[fetcherKey, submitImpl]
|
|
1446
1447
|
);
|
|
1448
|
+
let unstable_reset = React2.useCallback((opts) => router.resetFetcher(fetcherKey, opts), [router, fetcherKey]);
|
|
1447
1449
|
let FetcherForm = React2.useMemo(() => {
|
|
1448
1450
|
let FetcherForm2 = React2.forwardRef(
|
|
1449
1451
|
(props, ref) => {
|
|
@@ -1453,17 +1455,18 @@ function useFetcher({
|
|
|
1453
1455
|
FetcherForm2.displayName = "fetcher.Form";
|
|
1454
1456
|
return FetcherForm2;
|
|
1455
1457
|
}, [fetcherKey]);
|
|
1456
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
1458
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkED2JHW2Ijs.IDLE_FETCHER;
|
|
1457
1459
|
let data = fetcherData.get(fetcherKey);
|
|
1458
1460
|
let fetcherWithComponents = React2.useMemo(
|
|
1459
1461
|
() => ({
|
|
1460
1462
|
Form: FetcherForm,
|
|
1461
1463
|
submit,
|
|
1462
1464
|
load,
|
|
1465
|
+
unstable_reset,
|
|
1463
1466
|
...fetcher,
|
|
1464
1467
|
data
|
|
1465
1468
|
}),
|
|
1466
|
-
[FetcherForm, submit, load, fetcher, data]
|
|
1469
|
+
[FetcherForm, submit, load, unstable_reset, fetcher, data]
|
|
1467
1470
|
);
|
|
1468
1471
|
return fetcherWithComponents;
|
|
1469
1472
|
}
|
|
@@ -1483,7 +1486,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
1483
1486
|
key = getKey(
|
|
1484
1487
|
{
|
|
1485
1488
|
...location,
|
|
1486
|
-
pathname:
|
|
1489
|
+
pathname: _chunkED2JHW2Ijs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
1487
1490
|
},
|
|
1488
1491
|
matches
|
|
1489
1492
|
);
|
|
@@ -1504,10 +1507,10 @@ function useScrollRestoration({
|
|
|
1504
1507
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
1505
1508
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
1506
1509
|
);
|
|
1507
|
-
let { basename } = React2.useContext(
|
|
1508
|
-
let location =
|
|
1509
|
-
let matches =
|
|
1510
|
-
let navigation =
|
|
1510
|
+
let { basename } = React2.useContext(_chunkED2JHW2Ijs.NavigationContext);
|
|
1511
|
+
let location = _chunkED2JHW2Ijs.useLocation.call(void 0, );
|
|
1512
|
+
let matches = _chunkED2JHW2Ijs.useMatches.call(void 0, );
|
|
1513
|
+
let navigation = _chunkED2JHW2Ijs.useNavigation.call(void 0, );
|
|
1511
1514
|
React2.useEffect(() => {
|
|
1512
1515
|
window.history.scrollRestoration = "manual";
|
|
1513
1516
|
return () => {
|
|
@@ -1526,7 +1529,7 @@ function useScrollRestoration({
|
|
|
1526
1529
|
JSON.stringify(savedScrollPositions)
|
|
1527
1530
|
);
|
|
1528
1531
|
} catch (error) {
|
|
1529
|
-
|
|
1532
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
1530
1533
|
false,
|
|
1531
1534
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
1532
1535
|
);
|
|
@@ -1573,7 +1576,7 @@ function useScrollRestoration({
|
|
|
1573
1576
|
}
|
|
1574
1577
|
}
|
|
1575
1578
|
} catch (e2) {
|
|
1576
|
-
|
|
1579
|
+
_chunkED2JHW2Ijs.warning.call(void 0,
|
|
1577
1580
|
false,
|
|
1578
1581
|
`"${location.hash.slice(
|
|
1579
1582
|
1
|
|
@@ -1611,7 +1614,7 @@ function usePrompt({
|
|
|
1611
1614
|
when,
|
|
1612
1615
|
message
|
|
1613
1616
|
}) {
|
|
1614
|
-
let blocker =
|
|
1617
|
+
let blocker = _chunkED2JHW2Ijs.useBlocker.call(void 0, when);
|
|
1615
1618
|
React2.useEffect(() => {
|
|
1616
1619
|
if (blocker.state === "blocked") {
|
|
1617
1620
|
let proceed = window.confirm(message);
|
|
@@ -1629,21 +1632,21 @@ function usePrompt({
|
|
|
1629
1632
|
}, [blocker, when]);
|
|
1630
1633
|
}
|
|
1631
1634
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1632
|
-
let vtContext = React2.useContext(
|
|
1633
|
-
|
|
1635
|
+
let vtContext = React2.useContext(_chunkED2JHW2Ijs.ViewTransitionContext);
|
|
1636
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
1634
1637
|
vtContext != null,
|
|
1635
1638
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1636
1639
|
);
|
|
1637
1640
|
let { basename } = useDataRouterContext(
|
|
1638
1641
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1639
1642
|
);
|
|
1640
|
-
let path =
|
|
1643
|
+
let path = _chunkED2JHW2Ijs.useResolvedPath.call(void 0, to, { relative });
|
|
1641
1644
|
if (!vtContext.isTransitioning) {
|
|
1642
1645
|
return false;
|
|
1643
1646
|
}
|
|
1644
|
-
let currentPath =
|
|
1645
|
-
let nextPath =
|
|
1646
|
-
return
|
|
1647
|
+
let currentPath = _chunkED2JHW2Ijs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1648
|
+
let nextPath = _chunkED2JHW2Ijs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1649
|
+
return _chunkED2JHW2Ijs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkED2JHW2Ijs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1647
1650
|
}
|
|
1648
1651
|
|
|
1649
1652
|
// lib/dom/server.tsx
|
|
@@ -1654,7 +1657,7 @@ function StaticRouter({
|
|
|
1654
1657
|
location: locationProp = "/"
|
|
1655
1658
|
}) {
|
|
1656
1659
|
if (typeof locationProp === "string") {
|
|
1657
|
-
locationProp =
|
|
1660
|
+
locationProp = _chunkED2JHW2Ijs.parsePath.call(void 0, locationProp);
|
|
1658
1661
|
}
|
|
1659
1662
|
let action = "POP" /* Pop */;
|
|
1660
1663
|
let location = {
|
|
@@ -1683,7 +1686,7 @@ function StaticRouterProvider({
|
|
|
1683
1686
|
hydrate = true,
|
|
1684
1687
|
nonce
|
|
1685
1688
|
}) {
|
|
1686
|
-
|
|
1689
|
+
_chunkED2JHW2Ijs.invariant.call(void 0,
|
|
1687
1690
|
router && context,
|
|
1688
1691
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1689
1692
|
);
|
|
@@ -1706,7 +1709,7 @@ function StaticRouterProvider({
|
|
|
1706
1709
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1707
1710
|
}
|
|
1708
1711
|
let { state } = dataRouterContext.router;
|
|
1709
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
1712
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(_chunkED2JHW2Ijs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(_chunkED2JHW2Ijs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(_chunkED2JHW2Ijs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React3.createElement(_chunkED2JHW2Ijs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React3.createElement(
|
|
1710
1713
|
Router,
|
|
1711
1714
|
{
|
|
1712
1715
|
basename: dataRouterContext.basename,
|
|
@@ -1737,14 +1740,14 @@ function DataRoutes2({
|
|
|
1737
1740
|
future,
|
|
1738
1741
|
state
|
|
1739
1742
|
}) {
|
|
1740
|
-
return
|
|
1743
|
+
return _chunkED2JHW2Ijs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1741
1744
|
}
|
|
1742
1745
|
function serializeErrors(errors) {
|
|
1743
1746
|
if (!errors) return null;
|
|
1744
1747
|
let entries = Object.entries(errors);
|
|
1745
1748
|
let serialized = {};
|
|
1746
1749
|
for (let [key, val] of entries) {
|
|
1747
|
-
if (
|
|
1750
|
+
if (_chunkED2JHW2Ijs.isRouteErrorResponse.call(void 0, val)) {
|
|
1748
1751
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1749
1752
|
} else if (val instanceof Error) {
|
|
1750
1753
|
serialized[key] = {
|
|
@@ -1794,14 +1797,14 @@ function getStatelessNavigator() {
|
|
|
1794
1797
|
};
|
|
1795
1798
|
}
|
|
1796
1799
|
function createStaticHandler2(routes, opts) {
|
|
1797
|
-
return
|
|
1800
|
+
return _chunkED2JHW2Ijs.createStaticHandler.call(void 0, routes, {
|
|
1798
1801
|
...opts,
|
|
1799
1802
|
mapRouteProperties
|
|
1800
1803
|
});
|
|
1801
1804
|
}
|
|
1802
1805
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1803
1806
|
let manifest = {};
|
|
1804
|
-
let dataRoutes =
|
|
1807
|
+
let dataRoutes = _chunkED2JHW2Ijs.convertRoutesToDataRoutes.call(void 0,
|
|
1805
1808
|
routes,
|
|
1806
1809
|
mapRouteProperties,
|
|
1807
1810
|
void 0,
|
|
@@ -1834,7 +1837,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1834
1837
|
actionData: context.actionData,
|
|
1835
1838
|
errors: context.errors,
|
|
1836
1839
|
initialized: true,
|
|
1837
|
-
navigation:
|
|
1840
|
+
navigation: _chunkED2JHW2Ijs.IDLE_NAVIGATION,
|
|
1838
1841
|
restoreScrollPosition: null,
|
|
1839
1842
|
preventScrollReset: false,
|
|
1840
1843
|
revalidation: "idle",
|
|
@@ -1869,16 +1872,19 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1869
1872
|
createHref,
|
|
1870
1873
|
encodeLocation,
|
|
1871
1874
|
getFetcher() {
|
|
1872
|
-
return
|
|
1875
|
+
return _chunkED2JHW2Ijs.IDLE_FETCHER;
|
|
1873
1876
|
},
|
|
1874
1877
|
deleteFetcher() {
|
|
1875
1878
|
throw msg("deleteFetcher");
|
|
1876
1879
|
},
|
|
1880
|
+
resetFetcher() {
|
|
1881
|
+
throw msg("resetFetcher");
|
|
1882
|
+
},
|
|
1877
1883
|
dispose() {
|
|
1878
1884
|
throw msg("dispose");
|
|
1879
1885
|
},
|
|
1880
1886
|
getBlocker() {
|
|
1881
|
-
return
|
|
1887
|
+
return _chunkED2JHW2Ijs.IDLE_BLOCKER;
|
|
1882
1888
|
},
|
|
1883
1889
|
deleteBlocker() {
|
|
1884
1890
|
throw msg("deleteBlocker");
|
|
@@ -1896,10 +1902,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1896
1902
|
};
|
|
1897
1903
|
}
|
|
1898
1904
|
function createHref(to) {
|
|
1899
|
-
return typeof to === "string" ? to :
|
|
1905
|
+
return typeof to === "string" ? to : _chunkED2JHW2Ijs.createPath.call(void 0, to);
|
|
1900
1906
|
}
|
|
1901
1907
|
function encodeLocation(to) {
|
|
1902
|
-
let href = typeof to === "string" ? to :
|
|
1908
|
+
let href = typeof to === "string" ? to : _chunkED2JHW2Ijs.createPath.call(void 0, to);
|
|
1903
1909
|
href = href.replace(/ $/, "%20");
|
|
1904
1910
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1905
1911
|
return {
|