react-router 7.7.0-pre.1 → 7.7.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 +9 -7
- package/dist/development/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
- package/dist/development/{chunk-6ZHKKNZG.js → chunk-4ADB4KIO.js} +170 -140
- package/dist/development/{chunk-YNUF36W5.mjs → chunk-EF7DTUVF.mjs} +52 -22
- package/dist/{production/chunk-KZZC37RO.mjs → development/chunk-T3VM44WY.mjs} +31 -26
- package/dist/development/{chunk-Z7T4GLA7.js → chunk-V6PEDDZI.js} +1 -1
- package/dist/development/components-DzqPLVI1.d.mts +464 -0
- package/dist/development/dom-export.d.mts +3 -3
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-DOK8MfYF.d.mts → development/index-react-server-client-CUidsuu_.d.mts} +2 -2
- package/dist/development/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
- 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 +10 -4
- package/dist/development/index-react-server-client.mjs +9 -3
- package/dist/development/index-react-server.js +20 -6
- package/dist/development/index-react-server.mjs +21 -6
- package/dist/development/index.d.mts +396 -9
- package/dist/development/index.d.ts +372 -12
- package/dist/development/index.js +131 -120
- package/dist/development/index.mjs +9 -3
- package/dist/development/lib/types/internal.d.mts +1 -1
- 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/{production/route-data-DAw7Esur.d.mts → development/route-data-DjzmHYNR.d.mts} +1 -1
- package/dist/{production/route-data-7aXBQ4I3.d.ts → development/routeModules-g5PTiDfO.d.ts} +156 -156
- package/dist/production/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
- package/dist/production/{chunk-W77PDD2Y.js → chunk-2TYFPE3B.js} +170 -140
- package/dist/production/{chunk-SH44XSL4.js → chunk-5KHO4FML.js} +1 -1
- package/dist/{development/chunk-YP7CIEHK.mjs → production/chunk-GNZILI6H.mjs} +31 -26
- package/dist/production/{chunk-4FKAWASN.mjs → chunk-WPPIQDYG.mjs} +52 -22
- package/dist/production/components-DzqPLVI1.d.mts +464 -0
- package/dist/production/dom-export.d.mts +3 -3
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-DOK8MfYF.d.mts → production/index-react-server-client-CUidsuu_.d.mts} +2 -2
- package/dist/production/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
- 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 +10 -4
- package/dist/production/index-react-server-client.mjs +9 -3
- package/dist/production/index-react-server.js +20 -6
- package/dist/production/index-react-server.mjs +21 -6
- package/dist/production/index.d.mts +396 -9
- package/dist/production/index.d.ts +372 -12
- package/dist/production/index.js +131 -120
- package/dist/production/index.mjs +9 -3
- package/dist/production/lib/types/internal.d.mts +1 -1
- 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/{development/route-data-DAw7Esur.d.mts → production/route-data-DjzmHYNR.d.mts} +1 -1
- package/dist/{development/route-data-7aXBQ4I3.d.ts → production/routeModules-g5PTiDfO.d.ts} +156 -156
- package/package.json +1 -1
- package/dist/development/components-IaVqGBuO.d.mts +0 -816
- package/dist/production/components-IaVqGBuO.d.mts +0 -816
|
@@ -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.7.0
|
|
2
|
+
* react-router v7.7.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 _chunkV6PEDDZIjs = require('./chunk-V6PEDDZI.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 (_chunkV6PEDDZIjs.ENABLE_DEV_WARNINGS) {
|
|
76
76
|
if (route.element) {
|
|
77
|
-
|
|
77
|
+
_chunkV6PEDDZIjs.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 (_chunkV6PEDDZIjs.ENABLE_DEV_WARNINGS) {
|
|
90
90
|
if (route.hydrateFallbackElement) {
|
|
91
|
-
|
|
91
|
+
_chunkV6PEDDZIjs.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 (_chunkV6PEDDZIjs.ENABLE_DEV_WARNINGS) {
|
|
104
104
|
if (route.errorElement) {
|
|
105
|
-
|
|
105
|
+
_chunkV6PEDDZIjs.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 _chunkV6PEDDZIjs.createRouter.call(void 0, {
|
|
124
124
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
125
125
|
unstable_getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.unstable_getContext]),
|
|
126
126
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
127
|
-
history:
|
|
127
|
+
history: _chunkV6PEDDZIjs.createMemoryHistory.call(void 0, {
|
|
128
128
|
initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]),
|
|
129
129
|
initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex])
|
|
130
130
|
}),
|
|
@@ -176,12 +176,12 @@ function RouterProvider({
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
179
|
-
|
|
179
|
+
_chunkV6PEDDZIjs.warnOnce.call(void 0,
|
|
180
180
|
flushSync === false || reactDomFlushSyncImpl != null,
|
|
181
181
|
'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.'
|
|
182
182
|
);
|
|
183
183
|
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
184
|
-
|
|
184
|
+
_chunkV6PEDDZIjs.warnOnce.call(void 0,
|
|
185
185
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
186
186
|
"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."
|
|
187
187
|
);
|
|
@@ -306,7 +306,7 @@ function RouterProvider({
|
|
|
306
306
|
}),
|
|
307
307
|
[router, navigator, basename]
|
|
308
308
|
);
|
|
309
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
309
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement(
|
|
310
310
|
Router,
|
|
311
311
|
{
|
|
312
312
|
basename,
|
|
@@ -330,7 +330,7 @@ function DataRoutes({
|
|
|
330
330
|
future,
|
|
331
331
|
state
|
|
332
332
|
}) {
|
|
333
|
-
return
|
|
333
|
+
return _chunkV6PEDDZIjs.useRoutesImpl.call(void 0, routes, void 0, state, future);
|
|
334
334
|
}
|
|
335
335
|
function MemoryRouter({
|
|
336
336
|
basename,
|
|
@@ -340,7 +340,7 @@ function MemoryRouter({
|
|
|
340
340
|
}) {
|
|
341
341
|
let historyRef = React.useRef();
|
|
342
342
|
if (historyRef.current == null) {
|
|
343
|
-
historyRef.current =
|
|
343
|
+
historyRef.current = _chunkV6PEDDZIjs.createMemoryHistory.call(void 0, {
|
|
344
344
|
initialEntries,
|
|
345
345
|
initialIndex,
|
|
346
346
|
v5Compat: true
|
|
@@ -375,23 +375,23 @@ function Navigate({
|
|
|
375
375
|
state,
|
|
376
376
|
relative
|
|
377
377
|
}) {
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
379
|
+
_chunkV6PEDDZIjs.useInRouterContext.call(void 0, ),
|
|
380
380
|
// TODO: This error is probably because they somehow have 2 versions of
|
|
381
381
|
// the router loaded. We can help them understand how to avoid that.
|
|
382
382
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
383
383
|
);
|
|
384
|
-
let { static: isStatic } = React.useContext(
|
|
385
|
-
|
|
384
|
+
let { static: isStatic } = React.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
385
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
386
386
|
!isStatic,
|
|
387
387
|
`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
|
|
388
388
|
);
|
|
389
|
-
let { matches } = React.useContext(
|
|
390
|
-
let { pathname: locationPathname } =
|
|
391
|
-
let navigate =
|
|
392
|
-
let path =
|
|
389
|
+
let { matches } = React.useContext(_chunkV6PEDDZIjs.RouteContext);
|
|
390
|
+
let { pathname: locationPathname } = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
391
|
+
let navigate = _chunkV6PEDDZIjs.useNavigate.call(void 0, );
|
|
392
|
+
let path = _chunkV6PEDDZIjs.resolveTo.call(void 0,
|
|
393
393
|
to,
|
|
394
|
-
|
|
394
|
+
_chunkV6PEDDZIjs.getResolveToMatches.call(void 0, matches),
|
|
395
395
|
locationPathname,
|
|
396
396
|
relative === "path"
|
|
397
397
|
);
|
|
@@ -402,10 +402,10 @@ function Navigate({
|
|
|
402
402
|
return null;
|
|
403
403
|
}
|
|
404
404
|
function Outlet(props) {
|
|
405
|
-
return
|
|
405
|
+
return _chunkV6PEDDZIjs.useOutlet.call(void 0, props.context);
|
|
406
406
|
}
|
|
407
407
|
function Route(_props) {
|
|
408
|
-
|
|
408
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
409
409
|
false,
|
|
410
410
|
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
411
411
|
);
|
|
@@ -418,8 +418,8 @@ function Router({
|
|
|
418
418
|
navigator,
|
|
419
419
|
static: staticProp = false
|
|
420
420
|
}) {
|
|
421
|
-
|
|
422
|
-
!
|
|
421
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
422
|
+
!_chunkV6PEDDZIjs.useInRouterContext.call(void 0, ),
|
|
423
423
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
424
424
|
);
|
|
425
425
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -433,7 +433,7 @@ function Router({
|
|
|
433
433
|
[basename, navigator, staticProp]
|
|
434
434
|
);
|
|
435
435
|
if (typeof locationProp === "string") {
|
|
436
|
-
locationProp =
|
|
436
|
+
locationProp = _chunkV6PEDDZIjs.parsePath.call(void 0, locationProp);
|
|
437
437
|
}
|
|
438
438
|
let {
|
|
439
439
|
pathname = "/",
|
|
@@ -443,7 +443,7 @@ function Router({
|
|
|
443
443
|
key = "default"
|
|
444
444
|
} = locationProp;
|
|
445
445
|
let locationContext = React.useMemo(() => {
|
|
446
|
-
let trailingPathname =
|
|
446
|
+
let trailingPathname = _chunkV6PEDDZIjs.stripBasename.call(void 0, pathname, basename);
|
|
447
447
|
if (trailingPathname == null) {
|
|
448
448
|
return null;
|
|
449
449
|
}
|
|
@@ -458,20 +458,20 @@ function Router({
|
|
|
458
458
|
navigationType
|
|
459
459
|
};
|
|
460
460
|
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
461
|
-
|
|
461
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
462
462
|
locationContext != null,
|
|
463
463
|
`<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
|
|
464
464
|
);
|
|
465
465
|
if (locationContext == null) {
|
|
466
466
|
return null;
|
|
467
467
|
}
|
|
468
|
-
return /* @__PURE__ */ React.createElement(
|
|
468
|
+
return /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.LocationContext.Provider, { children, value: locationContext }));
|
|
469
469
|
}
|
|
470
470
|
function Routes({
|
|
471
471
|
children,
|
|
472
472
|
location
|
|
473
473
|
}) {
|
|
474
|
-
return
|
|
474
|
+
return _chunkV6PEDDZIjs.useRoutes.call(void 0, createRoutesFromChildren(children), location);
|
|
475
475
|
}
|
|
476
476
|
function Await({
|
|
477
477
|
children,
|
|
@@ -526,10 +526,10 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
526
526
|
throw promise._error;
|
|
527
527
|
}
|
|
528
528
|
if (status === 2 /* error */) {
|
|
529
|
-
return /* @__PURE__ */ React.createElement(
|
|
529
|
+
return /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.AwaitContext.Provider, { value: promise, children: errorElement });
|
|
530
530
|
}
|
|
531
531
|
if (status === 1 /* success */) {
|
|
532
|
-
return /* @__PURE__ */ React.createElement(
|
|
532
|
+
return /* @__PURE__ */ React.createElement(_chunkV6PEDDZIjs.AwaitContext.Provider, { value: promise, children });
|
|
533
533
|
}
|
|
534
534
|
throw promise;
|
|
535
535
|
}
|
|
@@ -537,7 +537,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
537
537
|
function ResolveAwait({
|
|
538
538
|
children
|
|
539
539
|
}) {
|
|
540
|
-
let data =
|
|
540
|
+
let data = _chunkV6PEDDZIjs.useAsyncValue.call(void 0, );
|
|
541
541
|
let toRender = typeof children === "function" ? children(data) : children;
|
|
542
542
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender);
|
|
543
543
|
}
|
|
@@ -555,11 +555,11 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
555
555
|
);
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
|
-
|
|
558
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
559
559
|
element.type === Route,
|
|
560
560
|
`[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
|
|
561
561
|
);
|
|
562
|
-
|
|
562
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
563
563
|
!element.props.index || !element.props.children,
|
|
564
564
|
"An index route cannot have child routes."
|
|
565
565
|
);
|
|
@@ -593,37 +593,64 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
593
593
|
}
|
|
594
594
|
var createRoutesFromElements = createRoutesFromChildren;
|
|
595
595
|
function renderMatches(matches) {
|
|
596
|
-
return
|
|
596
|
+
return _chunkV6PEDDZIjs._renderMatches.call(void 0, matches);
|
|
597
|
+
}
|
|
598
|
+
function useRouteComponentProps() {
|
|
599
|
+
return {
|
|
600
|
+
params: _chunkV6PEDDZIjs.useParams.call(void 0, ),
|
|
601
|
+
loaderData: _chunkV6PEDDZIjs.useLoaderData.call(void 0, ),
|
|
602
|
+
actionData: _chunkV6PEDDZIjs.useActionData.call(void 0, ),
|
|
603
|
+
matches: _chunkV6PEDDZIjs.useMatches.call(void 0, )
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function WithComponentProps({
|
|
607
|
+
children
|
|
608
|
+
}) {
|
|
609
|
+
const props = useRouteComponentProps();
|
|
610
|
+
return React.cloneElement(children, props);
|
|
597
611
|
}
|
|
598
612
|
function withComponentProps(Component2) {
|
|
599
|
-
return function
|
|
600
|
-
const props =
|
|
601
|
-
params: _chunkZ7T4GLA7js.useParams.call(void 0, ),
|
|
602
|
-
loaderData: _chunkZ7T4GLA7js.useLoaderData.call(void 0, ),
|
|
603
|
-
actionData: _chunkZ7T4GLA7js.useActionData.call(void 0, ),
|
|
604
|
-
matches: _chunkZ7T4GLA7js.useMatches.call(void 0, )
|
|
605
|
-
};
|
|
613
|
+
return function WithComponentProps2() {
|
|
614
|
+
const props = useRouteComponentProps();
|
|
606
615
|
return React.createElement(Component2, props);
|
|
607
616
|
};
|
|
608
617
|
}
|
|
618
|
+
function useHydrateFallbackProps() {
|
|
619
|
+
return {
|
|
620
|
+
params: _chunkV6PEDDZIjs.useParams.call(void 0, ),
|
|
621
|
+
loaderData: _chunkV6PEDDZIjs.useLoaderData.call(void 0, ),
|
|
622
|
+
actionData: _chunkV6PEDDZIjs.useActionData.call(void 0, )
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function WithHydrateFallbackProps({
|
|
626
|
+
children
|
|
627
|
+
}) {
|
|
628
|
+
const props = useHydrateFallbackProps();
|
|
629
|
+
return React.cloneElement(children, props);
|
|
630
|
+
}
|
|
609
631
|
function withHydrateFallbackProps(HydrateFallback) {
|
|
610
|
-
return function
|
|
611
|
-
const props =
|
|
612
|
-
params: _chunkZ7T4GLA7js.useParams.call(void 0, ),
|
|
613
|
-
loaderData: _chunkZ7T4GLA7js.useLoaderData.call(void 0, ),
|
|
614
|
-
actionData: _chunkZ7T4GLA7js.useActionData.call(void 0, )
|
|
615
|
-
};
|
|
632
|
+
return function WithHydrateFallbackProps2() {
|
|
633
|
+
const props = useHydrateFallbackProps();
|
|
616
634
|
return React.createElement(HydrateFallback, props);
|
|
617
635
|
};
|
|
618
636
|
}
|
|
637
|
+
function useErrorBoundaryProps() {
|
|
638
|
+
return {
|
|
639
|
+
params: _chunkV6PEDDZIjs.useParams.call(void 0, ),
|
|
640
|
+
loaderData: _chunkV6PEDDZIjs.useLoaderData.call(void 0, ),
|
|
641
|
+
actionData: _chunkV6PEDDZIjs.useActionData.call(void 0, ),
|
|
642
|
+
error: _chunkV6PEDDZIjs.useRouteError.call(void 0, )
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function WithErrorBoundaryProps({
|
|
646
|
+
children
|
|
647
|
+
}) {
|
|
648
|
+
const props = useErrorBoundaryProps();
|
|
649
|
+
return React.cloneElement(children, props);
|
|
650
|
+
}
|
|
619
651
|
function withErrorBoundaryProps(ErrorBoundary) {
|
|
620
|
-
return function
|
|
621
|
-
const props =
|
|
622
|
-
params: _chunkZ7T4GLA7js.useParams.call(void 0, ),
|
|
623
|
-
loaderData: _chunkZ7T4GLA7js.useLoaderData.call(void 0, ),
|
|
624
|
-
actionData: _chunkZ7T4GLA7js.useActionData.call(void 0, ),
|
|
625
|
-
error: _chunkZ7T4GLA7js.useRouteError.call(void 0, )
|
|
626
|
-
};
|
|
652
|
+
return function WithErrorBoundaryProps2() {
|
|
653
|
+
const props = useErrorBoundaryProps();
|
|
627
654
|
return React.createElement(ErrorBoundary, props);
|
|
628
655
|
};
|
|
629
656
|
}
|
|
@@ -697,7 +724,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
697
724
|
]);
|
|
698
725
|
function getFormEncType(encType) {
|
|
699
726
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
700
|
-
|
|
727
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
701
728
|
false,
|
|
702
729
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
703
730
|
);
|
|
@@ -713,7 +740,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
713
740
|
let body;
|
|
714
741
|
if (isFormElement(target)) {
|
|
715
742
|
let attr = target.getAttribute("action");
|
|
716
|
-
action = attr ?
|
|
743
|
+
action = attr ? _chunkV6PEDDZIjs.stripBasename.call(void 0, attr, basename) : null;
|
|
717
744
|
method = target.getAttribute("method") || defaultMethod;
|
|
718
745
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
719
746
|
formData = new FormData(target);
|
|
@@ -725,7 +752,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
725
752
|
);
|
|
726
753
|
}
|
|
727
754
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
728
|
-
action = attr ?
|
|
755
|
+
action = attr ? _chunkV6PEDDZIjs.stripBasename.call(void 0, attr, basename) : null;
|
|
729
756
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
730
757
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
731
758
|
formData = new FormData(form, target);
|
|
@@ -762,16 +789,16 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
762
789
|
try {
|
|
763
790
|
if (isBrowser) {
|
|
764
791
|
window.__reactRouterVersion = // @ts-expect-error
|
|
765
|
-
"7.7.0
|
|
792
|
+
"7.7.0";
|
|
766
793
|
}
|
|
767
794
|
} catch (e) {
|
|
768
795
|
}
|
|
769
796
|
function createBrowserRouter(routes, opts) {
|
|
770
|
-
return
|
|
797
|
+
return _chunkV6PEDDZIjs.createRouter.call(void 0, {
|
|
771
798
|
basename: _optionalChain([opts, 'optionalAccess', _12 => _12.basename]),
|
|
772
799
|
unstable_getContext: _optionalChain([opts, 'optionalAccess', _13 => _13.unstable_getContext]),
|
|
773
800
|
future: _optionalChain([opts, 'optionalAccess', _14 => _14.future]),
|
|
774
|
-
history:
|
|
801
|
+
history: _chunkV6PEDDZIjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _15 => _15.window]) }),
|
|
775
802
|
hydrationData: _optionalChain([opts, 'optionalAccess', _16 => _16.hydrationData]) || parseHydrationData(),
|
|
776
803
|
routes,
|
|
777
804
|
mapRouteProperties,
|
|
@@ -782,11 +809,11 @@ function createBrowserRouter(routes, opts) {
|
|
|
782
809
|
}).initialize();
|
|
783
810
|
}
|
|
784
811
|
function createHashRouter(routes, opts) {
|
|
785
|
-
return
|
|
812
|
+
return _chunkV6PEDDZIjs.createRouter.call(void 0, {
|
|
786
813
|
basename: _optionalChain([opts, 'optionalAccess', _20 => _20.basename]),
|
|
787
814
|
unstable_getContext: _optionalChain([opts, 'optionalAccess', _21 => _21.unstable_getContext]),
|
|
788
815
|
future: _optionalChain([opts, 'optionalAccess', _22 => _22.future]),
|
|
789
|
-
history:
|
|
816
|
+
history: _chunkV6PEDDZIjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _23 => _23.window]) }),
|
|
790
817
|
hydrationData: _optionalChain([opts, 'optionalAccess', _24 => _24.hydrationData]) || parseHydrationData(),
|
|
791
818
|
routes,
|
|
792
819
|
mapRouteProperties,
|
|
@@ -812,7 +839,7 @@ function deserializeErrors(errors) {
|
|
|
812
839
|
let serialized = {};
|
|
813
840
|
for (let [key, val] of entries) {
|
|
814
841
|
if (val && val.__type === "RouteErrorResponse") {
|
|
815
|
-
serialized[key] = new (0,
|
|
842
|
+
serialized[key] = new (0, _chunkV6PEDDZIjs.ErrorResponseImpl)(
|
|
816
843
|
val.status,
|
|
817
844
|
val.statusText,
|
|
818
845
|
val.data,
|
|
@@ -848,7 +875,7 @@ function BrowserRouter({
|
|
|
848
875
|
}) {
|
|
849
876
|
let historyRef = React2.useRef();
|
|
850
877
|
if (historyRef.current == null) {
|
|
851
|
-
historyRef.current =
|
|
878
|
+
historyRef.current = _chunkV6PEDDZIjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
852
879
|
}
|
|
853
880
|
let history = historyRef.current;
|
|
854
881
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -876,7 +903,7 @@ function BrowserRouter({
|
|
|
876
903
|
function HashRouter({ basename, children, window: window2 }) {
|
|
877
904
|
let historyRef = React2.useRef();
|
|
878
905
|
if (historyRef.current == null) {
|
|
879
|
-
historyRef.current =
|
|
906
|
+
historyRef.current = _chunkV6PEDDZIjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
880
907
|
}
|
|
881
908
|
let history = historyRef.current;
|
|
882
909
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -945,7 +972,7 @@ var Link = React2.forwardRef(
|
|
|
945
972
|
viewTransition,
|
|
946
973
|
...rest
|
|
947
974
|
}, forwardedRef) {
|
|
948
|
-
let { basename } = React2.useContext(
|
|
975
|
+
let { basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
949
976
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
950
977
|
let absoluteHref;
|
|
951
978
|
let isExternal = false;
|
|
@@ -955,22 +982,22 @@ var Link = React2.forwardRef(
|
|
|
955
982
|
try {
|
|
956
983
|
let currentUrl = new URL(window.location.href);
|
|
957
984
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
958
|
-
let path =
|
|
985
|
+
let path = _chunkV6PEDDZIjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
959
986
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
960
987
|
to = path + targetUrl.search + targetUrl.hash;
|
|
961
988
|
} else {
|
|
962
989
|
isExternal = true;
|
|
963
990
|
}
|
|
964
991
|
} catch (e) {
|
|
965
|
-
|
|
992
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
966
993
|
false,
|
|
967
994
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
968
995
|
);
|
|
969
996
|
}
|
|
970
997
|
}
|
|
971
998
|
}
|
|
972
|
-
let href =
|
|
973
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
999
|
+
let href = _chunkV6PEDDZIjs.useHref.call(void 0, to, { relative });
|
|
1000
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkV6PEDDZIjs.usePrefetchBehavior.call(void 0,
|
|
974
1001
|
prefetch,
|
|
975
1002
|
rest
|
|
976
1003
|
);
|
|
@@ -997,13 +1024,13 @@ var Link = React2.forwardRef(
|
|
|
997
1024
|
...prefetchHandlers,
|
|
998
1025
|
href: absoluteHref || href,
|
|
999
1026
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1000
|
-
ref:
|
|
1027
|
+
ref: _chunkV6PEDDZIjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
1001
1028
|
target,
|
|
1002
1029
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
1003
1030
|
}
|
|
1004
1031
|
)
|
|
1005
1032
|
);
|
|
1006
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(
|
|
1033
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(_chunkV6PEDDZIjs.PrefetchPageLinks, { page: href })) : link;
|
|
1007
1034
|
}
|
|
1008
1035
|
);
|
|
1009
1036
|
Link.displayName = "Link";
|
|
@@ -1019,10 +1046,10 @@ var NavLink = React2.forwardRef(
|
|
|
1019
1046
|
children,
|
|
1020
1047
|
...rest
|
|
1021
1048
|
}, ref) {
|
|
1022
|
-
let path =
|
|
1023
|
-
let location =
|
|
1024
|
-
let routerState = React2.useContext(
|
|
1025
|
-
let { navigator, basename } = React2.useContext(
|
|
1049
|
+
let path = _chunkV6PEDDZIjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
1050
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1051
|
+
let routerState = React2.useContext(_chunkV6PEDDZIjs.DataRouterStateContext);
|
|
1052
|
+
let { navigator, basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
1026
1053
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1027
1054
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1028
1055
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -1035,7 +1062,7 @@ var NavLink = React2.forwardRef(
|
|
|
1035
1062
|
toPathname = toPathname.toLowerCase();
|
|
1036
1063
|
}
|
|
1037
1064
|
if (nextLocationPathname && basename) {
|
|
1038
|
-
nextLocationPathname =
|
|
1065
|
+
nextLocationPathname = _chunkV6PEDDZIjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
1039
1066
|
}
|
|
1040
1067
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
1041
1068
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -1130,10 +1157,10 @@ function ScrollRestoration({
|
|
|
1130
1157
|
storageKey,
|
|
1131
1158
|
...props
|
|
1132
1159
|
}) {
|
|
1133
|
-
let remixContext = React2.useContext(
|
|
1134
|
-
let { basename } = React2.useContext(
|
|
1135
|
-
let location =
|
|
1136
|
-
let matches =
|
|
1160
|
+
let remixContext = React2.useContext(_chunkV6PEDDZIjs.FrameworkContext);
|
|
1161
|
+
let { basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
1162
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1163
|
+
let matches = _chunkV6PEDDZIjs.useMatches.call(void 0, );
|
|
1137
1164
|
useScrollRestoration({ getKey, storageKey });
|
|
1138
1165
|
let ssrKey = React2.useMemo(
|
|
1139
1166
|
() => {
|
|
@@ -1187,13 +1214,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
1187
1214
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1188
1215
|
}
|
|
1189
1216
|
function useDataRouterContext(hookName) {
|
|
1190
|
-
let ctx = React2.useContext(
|
|
1191
|
-
|
|
1217
|
+
let ctx = React2.useContext(_chunkV6PEDDZIjs.DataRouterContext);
|
|
1218
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
1192
1219
|
return ctx;
|
|
1193
1220
|
}
|
|
1194
1221
|
function useDataRouterState(hookName) {
|
|
1195
|
-
let state = React2.useContext(
|
|
1196
|
-
|
|
1222
|
+
let state = React2.useContext(_chunkV6PEDDZIjs.DataRouterStateContext);
|
|
1223
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
1197
1224
|
return state;
|
|
1198
1225
|
}
|
|
1199
1226
|
function useLinkClickHandler(to, {
|
|
@@ -1204,14 +1231,14 @@ function useLinkClickHandler(to, {
|
|
|
1204
1231
|
relative,
|
|
1205
1232
|
viewTransition
|
|
1206
1233
|
} = {}) {
|
|
1207
|
-
let navigate =
|
|
1208
|
-
let location =
|
|
1209
|
-
let path =
|
|
1234
|
+
let navigate = _chunkV6PEDDZIjs.useNavigate.call(void 0, );
|
|
1235
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1236
|
+
let path = _chunkV6PEDDZIjs.useResolvedPath.call(void 0, to, { relative });
|
|
1210
1237
|
return React2.useCallback(
|
|
1211
1238
|
(event) => {
|
|
1212
1239
|
if (shouldProcessLinkClick(event, target)) {
|
|
1213
1240
|
event.preventDefault();
|
|
1214
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
1241
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkV6PEDDZIjs.createPath.call(void 0, location) === _chunkV6PEDDZIjs.createPath.call(void 0, path);
|
|
1215
1242
|
navigate(to, {
|
|
1216
1243
|
replace,
|
|
1217
1244
|
state,
|
|
@@ -1236,13 +1263,13 @@ function useLinkClickHandler(to, {
|
|
|
1236
1263
|
);
|
|
1237
1264
|
}
|
|
1238
1265
|
function useSearchParams(defaultInit) {
|
|
1239
|
-
|
|
1266
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
1240
1267
|
typeof URLSearchParams !== "undefined",
|
|
1241
1268
|
`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.`
|
|
1242
1269
|
);
|
|
1243
1270
|
let defaultSearchParamsRef = React2.useRef(createSearchParams(defaultInit));
|
|
1244
1271
|
let hasSetSearchParamsRef = React2.useRef(false);
|
|
1245
|
-
let location =
|
|
1272
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1246
1273
|
let searchParams = React2.useMemo(
|
|
1247
1274
|
() => (
|
|
1248
1275
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -1255,7 +1282,7 @@ function useSearchParams(defaultInit) {
|
|
|
1255
1282
|
),
|
|
1256
1283
|
[location.search]
|
|
1257
1284
|
);
|
|
1258
|
-
let navigate =
|
|
1285
|
+
let navigate = _chunkV6PEDDZIjs.useNavigate.call(void 0, );
|
|
1259
1286
|
let setSearchParams = React2.useCallback(
|
|
1260
1287
|
(nextInit, navigateOptions) => {
|
|
1261
1288
|
const newSearchParams = createSearchParams(
|
|
@@ -1272,8 +1299,8 @@ var fetcherId = 0;
|
|
|
1272
1299
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
1273
1300
|
function useSubmit() {
|
|
1274
1301
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
1275
|
-
let { basename } = React2.useContext(
|
|
1276
|
-
let currentRouteId =
|
|
1302
|
+
let { basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
1303
|
+
let currentRouteId = _chunkV6PEDDZIjs.useRouteId.call(void 0, );
|
|
1277
1304
|
return React2.useCallback(
|
|
1278
1305
|
async (target, options = {}) => {
|
|
1279
1306
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -1309,12 +1336,12 @@ function useSubmit() {
|
|
|
1309
1336
|
);
|
|
1310
1337
|
}
|
|
1311
1338
|
function useFormAction(action, { relative } = {}) {
|
|
1312
|
-
let { basename } = React2.useContext(
|
|
1313
|
-
let routeContext = React2.useContext(
|
|
1314
|
-
|
|
1339
|
+
let { basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
1340
|
+
let routeContext = React2.useContext(_chunkV6PEDDZIjs.RouteContext);
|
|
1341
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
1315
1342
|
let [match] = routeContext.matches.slice(-1);
|
|
1316
|
-
let path = { ...
|
|
1317
|
-
let location =
|
|
1343
|
+
let path = { ..._chunkV6PEDDZIjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
1344
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1318
1345
|
if (action == null) {
|
|
1319
1346
|
path.search = location.search;
|
|
1320
1347
|
let params = new URLSearchParams(path.search);
|
|
@@ -1331,21 +1358,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
1331
1358
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1332
1359
|
}
|
|
1333
1360
|
if (basename !== "/") {
|
|
1334
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
1361
|
+
path.pathname = path.pathname === "/" ? basename : _chunkV6PEDDZIjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
1335
1362
|
}
|
|
1336
|
-
return
|
|
1363
|
+
return _chunkV6PEDDZIjs.createPath.call(void 0, path);
|
|
1337
1364
|
}
|
|
1338
1365
|
function useFetcher({
|
|
1339
1366
|
key
|
|
1340
1367
|
} = {}) {
|
|
1341
1368
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
1342
1369
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
1343
|
-
let fetcherData = React2.useContext(
|
|
1344
|
-
let route = React2.useContext(
|
|
1370
|
+
let fetcherData = React2.useContext(_chunkV6PEDDZIjs.FetchersContext);
|
|
1371
|
+
let route = React2.useContext(_chunkV6PEDDZIjs.RouteContext);
|
|
1345
1372
|
let routeId = _optionalChain([route, 'access', _31 => _31.matches, 'access', _32 => _32[route.matches.length - 1], 'optionalAccess', _33 => _33.route, 'access', _34 => _34.id]);
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1373
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
1374
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
1375
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
1349
1376
|
routeId != null,
|
|
1350
1377
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
1351
1378
|
);
|
|
@@ -1360,7 +1387,7 @@ function useFetcher({
|
|
|
1360
1387
|
}, [router, fetcherKey]);
|
|
1361
1388
|
let load = React2.useCallback(
|
|
1362
1389
|
async (href, opts) => {
|
|
1363
|
-
|
|
1390
|
+
_chunkV6PEDDZIjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
1364
1391
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
1365
1392
|
},
|
|
1366
1393
|
[fetcherKey, routeId, router]
|
|
@@ -1385,7 +1412,7 @@ function useFetcher({
|
|
|
1385
1412
|
FetcherForm2.displayName = "fetcher.Form";
|
|
1386
1413
|
return FetcherForm2;
|
|
1387
1414
|
}, [fetcherKey]);
|
|
1388
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
1415
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkV6PEDDZIjs.IDLE_FETCHER;
|
|
1389
1416
|
let data = fetcherData.get(fetcherKey);
|
|
1390
1417
|
let fetcherWithComponents = React2.useMemo(
|
|
1391
1418
|
() => ({
|
|
@@ -1415,7 +1442,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
1415
1442
|
key = getKey(
|
|
1416
1443
|
{
|
|
1417
1444
|
...location,
|
|
1418
|
-
pathname:
|
|
1445
|
+
pathname: _chunkV6PEDDZIjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
1419
1446
|
},
|
|
1420
1447
|
matches
|
|
1421
1448
|
);
|
|
@@ -1436,10 +1463,10 @@ function useScrollRestoration({
|
|
|
1436
1463
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
1437
1464
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
1438
1465
|
);
|
|
1439
|
-
let { basename } = React2.useContext(
|
|
1440
|
-
let location =
|
|
1441
|
-
let matches =
|
|
1442
|
-
let navigation =
|
|
1466
|
+
let { basename } = React2.useContext(_chunkV6PEDDZIjs.NavigationContext);
|
|
1467
|
+
let location = _chunkV6PEDDZIjs.useLocation.call(void 0, );
|
|
1468
|
+
let matches = _chunkV6PEDDZIjs.useMatches.call(void 0, );
|
|
1469
|
+
let navigation = _chunkV6PEDDZIjs.useNavigation.call(void 0, );
|
|
1443
1470
|
React2.useEffect(() => {
|
|
1444
1471
|
window.history.scrollRestoration = "manual";
|
|
1445
1472
|
return () => {
|
|
@@ -1458,7 +1485,7 @@ function useScrollRestoration({
|
|
|
1458
1485
|
JSON.stringify(savedScrollPositions)
|
|
1459
1486
|
);
|
|
1460
1487
|
} catch (error) {
|
|
1461
|
-
|
|
1488
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
1462
1489
|
false,
|
|
1463
1490
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
1464
1491
|
);
|
|
@@ -1505,7 +1532,7 @@ function useScrollRestoration({
|
|
|
1505
1532
|
}
|
|
1506
1533
|
}
|
|
1507
1534
|
} catch (e2) {
|
|
1508
|
-
|
|
1535
|
+
_chunkV6PEDDZIjs.warning.call(void 0,
|
|
1509
1536
|
false,
|
|
1510
1537
|
`"${location.hash.slice(
|
|
1511
1538
|
1
|
|
@@ -1543,7 +1570,7 @@ function usePrompt({
|
|
|
1543
1570
|
when,
|
|
1544
1571
|
message
|
|
1545
1572
|
}) {
|
|
1546
|
-
let blocker =
|
|
1573
|
+
let blocker = _chunkV6PEDDZIjs.useBlocker.call(void 0, when);
|
|
1547
1574
|
React2.useEffect(() => {
|
|
1548
1575
|
if (blocker.state === "blocked") {
|
|
1549
1576
|
let proceed = window.confirm(message);
|
|
@@ -1561,21 +1588,21 @@ function usePrompt({
|
|
|
1561
1588
|
}, [blocker, when]);
|
|
1562
1589
|
}
|
|
1563
1590
|
function useViewTransitionState(to, opts = {}) {
|
|
1564
|
-
let vtContext = React2.useContext(
|
|
1565
|
-
|
|
1591
|
+
let vtContext = React2.useContext(_chunkV6PEDDZIjs.ViewTransitionContext);
|
|
1592
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
1566
1593
|
vtContext != null,
|
|
1567
1594
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1568
1595
|
);
|
|
1569
1596
|
let { basename } = useDataRouterContext(
|
|
1570
1597
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1571
1598
|
);
|
|
1572
|
-
let path =
|
|
1599
|
+
let path = _chunkV6PEDDZIjs.useResolvedPath.call(void 0, to, { relative: opts.relative });
|
|
1573
1600
|
if (!vtContext.isTransitioning) {
|
|
1574
1601
|
return false;
|
|
1575
1602
|
}
|
|
1576
|
-
let currentPath =
|
|
1577
|
-
let nextPath =
|
|
1578
|
-
return
|
|
1603
|
+
let currentPath = _chunkV6PEDDZIjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1604
|
+
let nextPath = _chunkV6PEDDZIjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1605
|
+
return _chunkV6PEDDZIjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkV6PEDDZIjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1579
1606
|
}
|
|
1580
1607
|
|
|
1581
1608
|
// lib/dom/server.tsx
|
|
@@ -1586,7 +1613,7 @@ function StaticRouter({
|
|
|
1586
1613
|
location: locationProp = "/"
|
|
1587
1614
|
}) {
|
|
1588
1615
|
if (typeof locationProp === "string") {
|
|
1589
|
-
locationProp =
|
|
1616
|
+
locationProp = _chunkV6PEDDZIjs.parsePath.call(void 0, locationProp);
|
|
1590
1617
|
}
|
|
1591
1618
|
let action = "POP" /* Pop */;
|
|
1592
1619
|
let location = {
|
|
@@ -1615,7 +1642,7 @@ function StaticRouterProvider({
|
|
|
1615
1642
|
hydrate = true,
|
|
1616
1643
|
nonce
|
|
1617
1644
|
}) {
|
|
1618
|
-
|
|
1645
|
+
_chunkV6PEDDZIjs.invariant.call(void 0,
|
|
1619
1646
|
router && context,
|
|
1620
1647
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1621
1648
|
);
|
|
@@ -1638,7 +1665,7 @@ function StaticRouterProvider({
|
|
|
1638
1665
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1639
1666
|
}
|
|
1640
1667
|
let { state } = dataRouterContext.router;
|
|
1641
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
1668
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(_chunkV6PEDDZIjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(_chunkV6PEDDZIjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(_chunkV6PEDDZIjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React3.createElement(_chunkV6PEDDZIjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React3.createElement(
|
|
1642
1669
|
Router,
|
|
1643
1670
|
{
|
|
1644
1671
|
basename: dataRouterContext.basename,
|
|
@@ -1669,14 +1696,14 @@ function DataRoutes2({
|
|
|
1669
1696
|
future,
|
|
1670
1697
|
state
|
|
1671
1698
|
}) {
|
|
1672
|
-
return
|
|
1699
|
+
return _chunkV6PEDDZIjs.useRoutesImpl.call(void 0, routes, void 0, state, future);
|
|
1673
1700
|
}
|
|
1674
1701
|
function serializeErrors(errors) {
|
|
1675
1702
|
if (!errors) return null;
|
|
1676
1703
|
let entries = Object.entries(errors);
|
|
1677
1704
|
let serialized = {};
|
|
1678
1705
|
for (let [key, val] of entries) {
|
|
1679
|
-
if (
|
|
1706
|
+
if (_chunkV6PEDDZIjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1680
1707
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1681
1708
|
} else if (val instanceof Error) {
|
|
1682
1709
|
serialized[key] = {
|
|
@@ -1726,14 +1753,14 @@ function getStatelessNavigator() {
|
|
|
1726
1753
|
};
|
|
1727
1754
|
}
|
|
1728
1755
|
function createStaticHandler2(routes, opts) {
|
|
1729
|
-
return
|
|
1756
|
+
return _chunkV6PEDDZIjs.createStaticHandler.call(void 0, routes, {
|
|
1730
1757
|
...opts,
|
|
1731
1758
|
mapRouteProperties
|
|
1732
1759
|
});
|
|
1733
1760
|
}
|
|
1734
1761
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1735
1762
|
let manifest = {};
|
|
1736
|
-
let dataRoutes =
|
|
1763
|
+
let dataRoutes = _chunkV6PEDDZIjs.convertRoutesToDataRoutes.call(void 0,
|
|
1737
1764
|
routes,
|
|
1738
1765
|
mapRouteProperties,
|
|
1739
1766
|
void 0,
|
|
@@ -1766,7 +1793,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1766
1793
|
actionData: context.actionData,
|
|
1767
1794
|
errors: context.errors,
|
|
1768
1795
|
initialized: true,
|
|
1769
|
-
navigation:
|
|
1796
|
+
navigation: _chunkV6PEDDZIjs.IDLE_NAVIGATION,
|
|
1770
1797
|
restoreScrollPosition: null,
|
|
1771
1798
|
preventScrollReset: false,
|
|
1772
1799
|
revalidation: "idle",
|
|
@@ -1801,7 +1828,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1801
1828
|
createHref,
|
|
1802
1829
|
encodeLocation,
|
|
1803
1830
|
getFetcher() {
|
|
1804
|
-
return
|
|
1831
|
+
return _chunkV6PEDDZIjs.IDLE_FETCHER;
|
|
1805
1832
|
},
|
|
1806
1833
|
deleteFetcher() {
|
|
1807
1834
|
throw msg("deleteFetcher");
|
|
@@ -1810,7 +1837,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1810
1837
|
throw msg("dispose");
|
|
1811
1838
|
},
|
|
1812
1839
|
getBlocker() {
|
|
1813
|
-
return
|
|
1840
|
+
return _chunkV6PEDDZIjs.IDLE_BLOCKER;
|
|
1814
1841
|
},
|
|
1815
1842
|
deleteBlocker() {
|
|
1816
1843
|
throw msg("deleteBlocker");
|
|
@@ -1828,10 +1855,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1828
1855
|
};
|
|
1829
1856
|
}
|
|
1830
1857
|
function createHref(to) {
|
|
1831
|
-
return typeof to === "string" ? to :
|
|
1858
|
+
return typeof to === "string" ? to : _chunkV6PEDDZIjs.createPath.call(void 0, to);
|
|
1832
1859
|
}
|
|
1833
1860
|
function encodeLocation(to) {
|
|
1834
|
-
let href = typeof to === "string" ? to :
|
|
1861
|
+
let href = typeof to === "string" ? to : _chunkV6PEDDZIjs.createPath.call(void 0, to);
|
|
1835
1862
|
href = href.replace(/ $/, "%20");
|
|
1836
1863
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1837
1864
|
return {
|
|
@@ -1895,4 +1922,7 @@ function htmlEscape(str) {
|
|
|
1895
1922
|
|
|
1896
1923
|
|
|
1897
1924
|
|
|
1898
|
-
|
|
1925
|
+
|
|
1926
|
+
|
|
1927
|
+
|
|
1928
|
+
exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; 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;
|