react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-e0b6ce9
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/dist/development/{chunk-AGOH44BE.mjs → chunk-4FI4BC6Y.mjs} +67 -51
- package/dist/development/{chunk-IMKEG5CI.mjs → chunk-F6CT5MEB.mjs} +314 -30
- package/dist/development/{chunk-LUB73E44.js → chunk-INO4IHBF.js} +352 -71
- package/dist/development/{chunk-2G2U5HGB.js → chunk-ITZFCV4J.js} +164 -161
- package/dist/development/dom-export.d.mts +59 -4
- package/dist/development/dom-export.d.ts +59 -3
- package/dist/development/dom-export.js +8 -5
- package/dist/development/dom-export.mjs +8 -5
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-CYIi6gi0.d.mts} +198 -134
- package/dist/{production/index-react-server-client-DKvU8YRr.d.ts → development/index-react-server-client-ChBGplLn.d.ts} +198 -134
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -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 +90 -1
- package/dist/development/index-react-server.d.ts +90 -1
- package/dist/development/index-react-server.js +188 -9
- package/dist/development/index-react-server.mjs +188 -9
- package/dist/development/index.d.mts +13 -20
- package/dist/development/index.d.ts +13 -18
- package/dist/development/index.js +161 -147
- package/dist/development/index.mjs +3 -5
- package/dist/development/instrumentation-BGrNA7uj.d.ts +1122 -0
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +3 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-BrVEYTED.d.mts → register-DiOIlEq5.d.mts} +1 -7
- package/dist/{production/register-BrVEYTED.d.mts → development/register-DiOIlEq5.d.ts} +1 -7
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
- package/dist/{production/routeModules-BmVo7q9e.d.ts → development/routeModules-DqotkItD.d.ts} +73 -1046
- package/dist/{production/context-BqL5Eckq.d.mts → development/router-DWv6Clt-.d.mts} +1390 -1253
- package/dist/production/{chunk-AODJW4D3.mjs → chunk-52MYED7O.mjs} +67 -51
- package/dist/production/{chunk-FGRCWJDI.js → chunk-DASXXYNZ.js} +164 -161
- package/dist/production/{chunk-2L5AG5Y5.js → chunk-K7VXYOZD.js} +352 -71
- package/dist/production/{chunk-UOQCOPF6.mjs → chunk-LKSLGWXX.mjs} +314 -30
- package/dist/production/dom-export.d.mts +59 -4
- package/dist/production/dom-export.d.ts +59 -3
- package/dist/production/dom-export.js +8 -5
- package/dist/production/dom-export.mjs +8 -5
- package/dist/production/{index-react-server-client-2EDmGlsZ.d.mts → index-react-server-client-CYIi6gi0.d.mts} +140 -77
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-ChBGplLn.d.ts} +140 -77
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -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 +90 -1
- package/dist/production/index-react-server.d.ts +90 -1
- package/dist/production/index-react-server.js +188 -9
- package/dist/production/index-react-server.mjs +188 -9
- package/dist/production/index.d.mts +13 -20
- package/dist/production/index.d.ts +13 -18
- package/dist/production/index.js +161 -147
- package/dist/production/index.mjs +3 -5
- package/dist/production/instrumentation-BGrNA7uj.d.ts +1122 -0
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +3 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-D8NQoPsO.d.ts → production/register-DiOIlEq5.d.mts} +1 -7
- package/dist/production/{register-D8NQoPsO.d.ts → register-DiOIlEq5.d.ts} +1 -7
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-Cy4Xsfoi.d.mts} +157 -147
- package/dist/{development/routeModules-BmVo7q9e.d.ts → production/routeModules-DqotkItD.d.ts} +73 -1046
- package/dist/{development/context-BqL5Eckq.d.mts → production/router-DWv6Clt-.d.mts} +1390 -1253
- 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 v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-e0b6ce9
|
|
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 _chunkINO4IHBFjs = require('./chunk-INO4IHBF.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 (_chunkINO4IHBFjs.ENABLE_DEV_WARNINGS) {
|
|
76
76
|
if (route.element) {
|
|
77
|
-
|
|
77
|
+
_chunkINO4IHBFjs.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 (_chunkINO4IHBFjs.ENABLE_DEV_WARNINGS) {
|
|
90
90
|
if (route.hydrateFallbackElement) {
|
|
91
|
-
|
|
91
|
+
_chunkINO4IHBFjs.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 (_chunkINO4IHBFjs.ENABLE_DEV_WARNINGS) {
|
|
104
104
|
if (route.errorElement) {
|
|
105
|
-
|
|
105
|
+
_chunkINO4IHBFjs.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 _chunkINO4IHBFjs.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: _chunkINO4IHBFjs.createMemoryHistory.call(void 0, {
|
|
128
128
|
initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]),
|
|
129
129
|
initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex])
|
|
130
130
|
}),
|
|
@@ -133,7 +133,8 @@ function createMemoryRouter(routes, opts) {
|
|
|
133
133
|
hydrationRouteProperties,
|
|
134
134
|
mapRouteProperties,
|
|
135
135
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _8 => _8.dataStrategy]),
|
|
136
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _9 => _9.patchRoutesOnNavigation])
|
|
136
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _9 => _9.patchRoutesOnNavigation]),
|
|
137
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.unstable_instrumentations])
|
|
137
138
|
}).initialize();
|
|
138
139
|
}
|
|
139
140
|
var Deferred = class {
|
|
@@ -195,12 +196,12 @@ function UNSTABLE_TransitionEnabledRouterProvider({
|
|
|
195
196
|
go: (n) => router.navigate(n),
|
|
196
197
|
push: (to, state2, opts) => router.navigate(to, {
|
|
197
198
|
state: state2,
|
|
198
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
199
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _11 => _11.preventScrollReset])
|
|
199
200
|
}),
|
|
200
201
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
201
202
|
replace: true,
|
|
202
203
|
state: state2,
|
|
203
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
204
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _12 => _12.preventScrollReset])
|
|
204
205
|
})
|
|
205
206
|
};
|
|
206
207
|
}, [router]);
|
|
@@ -240,15 +241,15 @@ function UNSTABLE_TransitionEnabledRouterProvider({
|
|
|
240
241
|
}
|
|
241
242
|
);
|
|
242
243
|
}, [router, reactDomFlushSyncImpl, state]);
|
|
243
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
244
|
-
|
|
244
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(
|
|
245
|
+
_chunkINO4IHBFjs.DataRouterStateContext.Provider,
|
|
245
246
|
{
|
|
246
247
|
value: {
|
|
247
248
|
...state,
|
|
248
249
|
revalidation: revalidating ? "loading" : state.revalidation
|
|
249
250
|
}
|
|
250
251
|
},
|
|
251
|
-
/* @__PURE__ */ React.createElement(
|
|
252
|
+
/* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(
|
|
252
253
|
Router,
|
|
253
254
|
{
|
|
254
255
|
basename,
|
|
@@ -287,7 +288,7 @@ function RouterProvider({
|
|
|
287
288
|
setStateImpl((prevState) => {
|
|
288
289
|
if (newState.errors && unstable_onError) {
|
|
289
290
|
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
290
|
-
if (_optionalChain([prevState, 'access',
|
|
291
|
+
if (_optionalChain([prevState, 'access', _13 => _13.errors, 'optionalAccess', _14 => _14[routeId]]) !== error) {
|
|
291
292
|
unstable_onError(error);
|
|
292
293
|
}
|
|
293
294
|
});
|
|
@@ -305,12 +306,12 @@ function RouterProvider({
|
|
|
305
306
|
}
|
|
306
307
|
});
|
|
307
308
|
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
308
|
-
|
|
309
|
+
_chunkINO4IHBFjs.warnOnce.call(void 0,
|
|
309
310
|
flushSync === false || reactDomFlushSyncImpl != null,
|
|
310
311
|
'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.'
|
|
311
312
|
);
|
|
312
313
|
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
313
|
-
|
|
314
|
+
_chunkINO4IHBFjs.warnOnce.call(void 0,
|
|
314
315
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
315
316
|
"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."
|
|
316
317
|
);
|
|
@@ -422,12 +423,12 @@ function RouterProvider({
|
|
|
422
423
|
go: (n) => router.navigate(n),
|
|
423
424
|
push: (to, state2, opts) => router.navigate(to, {
|
|
424
425
|
state: state2,
|
|
425
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
426
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _15 => _15.preventScrollReset])
|
|
426
427
|
}),
|
|
427
428
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
428
429
|
replace: true,
|
|
429
430
|
state: state2,
|
|
430
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
431
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _16 => _16.preventScrollReset])
|
|
431
432
|
})
|
|
432
433
|
};
|
|
433
434
|
}, [router]);
|
|
@@ -442,7 +443,7 @@ function RouterProvider({
|
|
|
442
443
|
}),
|
|
443
444
|
[router, navigator, basename, unstable_onError]
|
|
444
445
|
);
|
|
445
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
446
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement(
|
|
446
447
|
Router,
|
|
447
448
|
{
|
|
448
449
|
basename,
|
|
@@ -468,7 +469,7 @@ function DataRoutes({
|
|
|
468
469
|
state,
|
|
469
470
|
unstable_onError
|
|
470
471
|
}) {
|
|
471
|
-
return
|
|
472
|
+
return _chunkINO4IHBFjs.useRoutesImpl.call(void 0, routes, void 0, state, unstable_onError, future);
|
|
472
473
|
}
|
|
473
474
|
function MemoryRouter({
|
|
474
475
|
basename,
|
|
@@ -478,7 +479,7 @@ function MemoryRouter({
|
|
|
478
479
|
}) {
|
|
479
480
|
let historyRef = React.useRef();
|
|
480
481
|
if (historyRef.current == null) {
|
|
481
|
-
historyRef.current =
|
|
482
|
+
historyRef.current = _chunkINO4IHBFjs.createMemoryHistory.call(void 0, {
|
|
482
483
|
initialEntries,
|
|
483
484
|
initialIndex,
|
|
484
485
|
v5Compat: true
|
|
@@ -513,23 +514,23 @@ function Navigate({
|
|
|
513
514
|
state,
|
|
514
515
|
relative
|
|
515
516
|
}) {
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
518
|
+
_chunkINO4IHBFjs.useInRouterContext.call(void 0, ),
|
|
518
519
|
// TODO: This error is probably because they somehow have 2 versions of
|
|
519
520
|
// the router loaded. We can help them understand how to avoid that.
|
|
520
521
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
521
522
|
);
|
|
522
|
-
let { static: isStatic } = React.useContext(
|
|
523
|
-
|
|
523
|
+
let { static: isStatic } = React.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
524
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
524
525
|
!isStatic,
|
|
525
526
|
`<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.`
|
|
526
527
|
);
|
|
527
|
-
let { matches } = React.useContext(
|
|
528
|
-
let { pathname: locationPathname } =
|
|
529
|
-
let navigate =
|
|
530
|
-
let path =
|
|
528
|
+
let { matches } = React.useContext(_chunkINO4IHBFjs.RouteContext);
|
|
529
|
+
let { pathname: locationPathname } = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
530
|
+
let navigate = _chunkINO4IHBFjs.useNavigate.call(void 0, );
|
|
531
|
+
let path = _chunkINO4IHBFjs.resolveTo.call(void 0,
|
|
531
532
|
to,
|
|
532
|
-
|
|
533
|
+
_chunkINO4IHBFjs.getResolveToMatches.call(void 0, matches),
|
|
533
534
|
locationPathname,
|
|
534
535
|
relative === "path"
|
|
535
536
|
);
|
|
@@ -540,10 +541,10 @@ function Navigate({
|
|
|
540
541
|
return null;
|
|
541
542
|
}
|
|
542
543
|
function Outlet(props) {
|
|
543
|
-
return
|
|
544
|
+
return _chunkINO4IHBFjs.useOutlet.call(void 0, props.context);
|
|
544
545
|
}
|
|
545
546
|
function Route(props) {
|
|
546
|
-
|
|
547
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
547
548
|
false,
|
|
548
549
|
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
549
550
|
);
|
|
@@ -556,8 +557,8 @@ function Router({
|
|
|
556
557
|
navigator,
|
|
557
558
|
static: staticProp = false
|
|
558
559
|
}) {
|
|
559
|
-
|
|
560
|
-
!
|
|
560
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
561
|
+
!_chunkINO4IHBFjs.useInRouterContext.call(void 0, ),
|
|
561
562
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
562
563
|
);
|
|
563
564
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -571,7 +572,7 @@ function Router({
|
|
|
571
572
|
[basename, navigator, staticProp]
|
|
572
573
|
);
|
|
573
574
|
if (typeof locationProp === "string") {
|
|
574
|
-
locationProp =
|
|
575
|
+
locationProp = _chunkINO4IHBFjs.parsePath.call(void 0, locationProp);
|
|
575
576
|
}
|
|
576
577
|
let {
|
|
577
578
|
pathname = "/",
|
|
@@ -581,7 +582,7 @@ function Router({
|
|
|
581
582
|
key = "default"
|
|
582
583
|
} = locationProp;
|
|
583
584
|
let locationContext = React.useMemo(() => {
|
|
584
|
-
let trailingPathname =
|
|
585
|
+
let trailingPathname = _chunkINO4IHBFjs.stripBasename.call(void 0, pathname, basename);
|
|
585
586
|
if (trailingPathname == null) {
|
|
586
587
|
return null;
|
|
587
588
|
}
|
|
@@ -596,33 +597,33 @@ function Router({
|
|
|
596
597
|
navigationType
|
|
597
598
|
};
|
|
598
599
|
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
599
|
-
|
|
600
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
600
601
|
locationContext != null,
|
|
601
602
|
`<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.`
|
|
602
603
|
);
|
|
603
604
|
if (locationContext == null) {
|
|
604
605
|
return null;
|
|
605
606
|
}
|
|
606
|
-
return /* @__PURE__ */ React.createElement(
|
|
607
|
+
return /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.LocationContext.Provider, { children, value: locationContext }));
|
|
607
608
|
}
|
|
608
609
|
function Routes({
|
|
609
610
|
children,
|
|
610
611
|
location
|
|
611
612
|
}) {
|
|
612
|
-
return
|
|
613
|
+
return _chunkINO4IHBFjs.useRoutes.call(void 0, createRoutesFromChildren(children), location);
|
|
613
614
|
}
|
|
614
615
|
function Await({
|
|
615
616
|
children,
|
|
616
617
|
errorElement,
|
|
617
618
|
resolve
|
|
618
619
|
}) {
|
|
619
|
-
let dataRouterContext = React.useContext(
|
|
620
|
+
let dataRouterContext = React.useContext(_chunkINO4IHBFjs.DataRouterContext);
|
|
620
621
|
return /* @__PURE__ */ React.createElement(
|
|
621
622
|
AwaitErrorBoundary,
|
|
622
623
|
{
|
|
623
624
|
resolve,
|
|
624
625
|
errorElement,
|
|
625
|
-
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess',
|
|
626
|
+
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _17 => _17.unstable_onError])
|
|
626
627
|
},
|
|
627
628
|
/* @__PURE__ */ React.createElement(ResolveAwait, null, children)
|
|
628
629
|
);
|
|
@@ -671,7 +672,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
671
672
|
promise = resolve.then(
|
|
672
673
|
(data) => Object.defineProperty(resolve, "_data", { get: () => data }),
|
|
673
674
|
(error) => {
|
|
674
|
-
_optionalChain([this, 'access',
|
|
675
|
+
_optionalChain([this, 'access', _18 => _18.props, 'access', _19 => _19.unstable_onError, 'optionalCall', _20 => _20(error)]);
|
|
675
676
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
676
677
|
}
|
|
677
678
|
);
|
|
@@ -680,10 +681,10 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
680
681
|
throw promise._error;
|
|
681
682
|
}
|
|
682
683
|
if (status === 2 /* error */) {
|
|
683
|
-
return /* @__PURE__ */ React.createElement(
|
|
684
|
+
return /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.AwaitContext.Provider, { value: promise, children: errorElement });
|
|
684
685
|
}
|
|
685
686
|
if (status === 1 /* success */) {
|
|
686
|
-
return /* @__PURE__ */ React.createElement(
|
|
687
|
+
return /* @__PURE__ */ React.createElement(_chunkINO4IHBFjs.AwaitContext.Provider, { value: promise, children });
|
|
687
688
|
}
|
|
688
689
|
throw promise;
|
|
689
690
|
}
|
|
@@ -691,7 +692,7 @@ var AwaitErrorBoundary = class extends React.Component {
|
|
|
691
692
|
function ResolveAwait({
|
|
692
693
|
children
|
|
693
694
|
}) {
|
|
694
|
-
let data =
|
|
695
|
+
let data = _chunkINO4IHBFjs.useAsyncValue.call(void 0, );
|
|
695
696
|
let toRender = typeof children === "function" ? children(data) : children;
|
|
696
697
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender);
|
|
697
698
|
}
|
|
@@ -709,11 +710,11 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
709
710
|
);
|
|
710
711
|
return;
|
|
711
712
|
}
|
|
712
|
-
|
|
713
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
713
714
|
element.type === Route,
|
|
714
715
|
`[${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>`
|
|
715
716
|
);
|
|
716
|
-
|
|
717
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
717
718
|
!element.props.index || !element.props.children,
|
|
718
719
|
"An index route cannot have child routes."
|
|
719
720
|
);
|
|
@@ -748,14 +749,14 @@ function createRoutesFromChildren(children, parentPath = []) {
|
|
|
748
749
|
}
|
|
749
750
|
var createRoutesFromElements = createRoutesFromChildren;
|
|
750
751
|
function renderMatches(matches) {
|
|
751
|
-
return
|
|
752
|
+
return _chunkINO4IHBFjs._renderMatches.call(void 0, matches);
|
|
752
753
|
}
|
|
753
754
|
function useRouteComponentProps() {
|
|
754
755
|
return {
|
|
755
|
-
params:
|
|
756
|
-
loaderData:
|
|
757
|
-
actionData:
|
|
758
|
-
matches:
|
|
756
|
+
params: _chunkINO4IHBFjs.useParams.call(void 0, ),
|
|
757
|
+
loaderData: _chunkINO4IHBFjs.useLoaderData.call(void 0, ),
|
|
758
|
+
actionData: _chunkINO4IHBFjs.useActionData.call(void 0, ),
|
|
759
|
+
matches: _chunkINO4IHBFjs.useMatches.call(void 0, )
|
|
759
760
|
};
|
|
760
761
|
}
|
|
761
762
|
function WithComponentProps({
|
|
@@ -772,9 +773,9 @@ function withComponentProps(Component2) {
|
|
|
772
773
|
}
|
|
773
774
|
function useHydrateFallbackProps() {
|
|
774
775
|
return {
|
|
775
|
-
params:
|
|
776
|
-
loaderData:
|
|
777
|
-
actionData:
|
|
776
|
+
params: _chunkINO4IHBFjs.useParams.call(void 0, ),
|
|
777
|
+
loaderData: _chunkINO4IHBFjs.useLoaderData.call(void 0, ),
|
|
778
|
+
actionData: _chunkINO4IHBFjs.useActionData.call(void 0, )
|
|
778
779
|
};
|
|
779
780
|
}
|
|
780
781
|
function WithHydrateFallbackProps({
|
|
@@ -791,10 +792,10 @@ function withHydrateFallbackProps(HydrateFallback) {
|
|
|
791
792
|
}
|
|
792
793
|
function useErrorBoundaryProps() {
|
|
793
794
|
return {
|
|
794
|
-
params:
|
|
795
|
-
loaderData:
|
|
796
|
-
actionData:
|
|
797
|
-
error:
|
|
795
|
+
params: _chunkINO4IHBFjs.useParams.call(void 0, ),
|
|
796
|
+
loaderData: _chunkINO4IHBFjs.useLoaderData.call(void 0, ),
|
|
797
|
+
actionData: _chunkINO4IHBFjs.useActionData.call(void 0, ),
|
|
798
|
+
error: _chunkINO4IHBFjs.useRouteError.call(void 0, )
|
|
798
799
|
};
|
|
799
800
|
}
|
|
800
801
|
function WithErrorBoundaryProps({
|
|
@@ -879,7 +880,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
879
880
|
]);
|
|
880
881
|
function getFormEncType(encType) {
|
|
881
882
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
882
|
-
|
|
883
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
883
884
|
false,
|
|
884
885
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
885
886
|
);
|
|
@@ -895,7 +896,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
895
896
|
let body;
|
|
896
897
|
if (isFormElement(target)) {
|
|
897
898
|
let attr = target.getAttribute("action");
|
|
898
|
-
action = attr ?
|
|
899
|
+
action = attr ? _chunkINO4IHBFjs.stripBasename.call(void 0, attr, basename) : null;
|
|
899
900
|
method = target.getAttribute("method") || defaultMethod;
|
|
900
901
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
901
902
|
formData = new FormData(target);
|
|
@@ -907,7 +908,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
907
908
|
);
|
|
908
909
|
}
|
|
909
910
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
910
|
-
action = attr ?
|
|
911
|
+
action = attr ? _chunkINO4IHBFjs.stripBasename.call(void 0, attr, basename) : null;
|
|
911
912
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
912
913
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
913
914
|
formData = new FormData(form, target);
|
|
@@ -944,42 +945,44 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
944
945
|
try {
|
|
945
946
|
if (isBrowser) {
|
|
946
947
|
window.__reactRouterVersion = // @ts-expect-error
|
|
947
|
-
"0.0.0-experimental-
|
|
948
|
+
"0.0.0-experimental-e0b6ce9";
|
|
948
949
|
}
|
|
949
950
|
} catch (e) {
|
|
950
951
|
}
|
|
951
952
|
function createBrowserRouter(routes, opts) {
|
|
952
|
-
return
|
|
953
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
954
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
955
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
956
|
-
history:
|
|
957
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
953
|
+
return _chunkINO4IHBFjs.createRouter.call(void 0, {
|
|
954
|
+
basename: _optionalChain([opts, 'optionalAccess', _21 => _21.basename]),
|
|
955
|
+
getContext: _optionalChain([opts, 'optionalAccess', _22 => _22.getContext]),
|
|
956
|
+
future: _optionalChain([opts, 'optionalAccess', _23 => _23.future]),
|
|
957
|
+
history: _chunkINO4IHBFjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _24 => _24.window]) }),
|
|
958
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _25 => _25.hydrationData]) || parseHydrationData(),
|
|
958
959
|
routes,
|
|
959
960
|
mapRouteProperties,
|
|
960
961
|
hydrationRouteProperties,
|
|
961
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
962
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
963
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
962
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _26 => _26.dataStrategy]),
|
|
963
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _27 => _27.patchRoutesOnNavigation]),
|
|
964
|
+
window: _optionalChain([opts, 'optionalAccess', _28 => _28.window]),
|
|
965
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _29 => _29.unstable_instrumentations])
|
|
964
966
|
}).initialize();
|
|
965
967
|
}
|
|
966
968
|
function createHashRouter(routes, opts) {
|
|
967
|
-
return
|
|
968
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
969
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
970
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
971
|
-
history:
|
|
972
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
969
|
+
return _chunkINO4IHBFjs.createRouter.call(void 0, {
|
|
970
|
+
basename: _optionalChain([opts, 'optionalAccess', _30 => _30.basename]),
|
|
971
|
+
getContext: _optionalChain([opts, 'optionalAccess', _31 => _31.getContext]),
|
|
972
|
+
future: _optionalChain([opts, 'optionalAccess', _32 => _32.future]),
|
|
973
|
+
history: _chunkINO4IHBFjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _33 => _33.window]) }),
|
|
974
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _34 => _34.hydrationData]) || parseHydrationData(),
|
|
973
975
|
routes,
|
|
974
976
|
mapRouteProperties,
|
|
975
977
|
hydrationRouteProperties,
|
|
976
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
977
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
978
|
-
window: _optionalChain([opts, 'optionalAccess',
|
|
978
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _35 => _35.dataStrategy]),
|
|
979
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _36 => _36.patchRoutesOnNavigation]),
|
|
980
|
+
window: _optionalChain([opts, 'optionalAccess', _37 => _37.window]),
|
|
981
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _38 => _38.unstable_instrumentations])
|
|
979
982
|
}).initialize();
|
|
980
983
|
}
|
|
981
984
|
function parseHydrationData() {
|
|
982
|
-
let state = _optionalChain([window, 'optionalAccess',
|
|
985
|
+
let state = _optionalChain([window, 'optionalAccess', _39 => _39.__staticRouterHydrationData]);
|
|
983
986
|
if (state && state.errors) {
|
|
984
987
|
state = {
|
|
985
988
|
...state,
|
|
@@ -994,7 +997,7 @@ function deserializeErrors(errors) {
|
|
|
994
997
|
let serialized = {};
|
|
995
998
|
for (let [key, val] of entries) {
|
|
996
999
|
if (val && val.__type === "RouteErrorResponse") {
|
|
997
|
-
serialized[key] = new (0,
|
|
1000
|
+
serialized[key] = new (0, _chunkINO4IHBFjs.ErrorResponseImpl)(
|
|
998
1001
|
val.status,
|
|
999
1002
|
val.statusText,
|
|
1000
1003
|
val.data,
|
|
@@ -1030,7 +1033,7 @@ function BrowserRouter({
|
|
|
1030
1033
|
}) {
|
|
1031
1034
|
let historyRef = React2.useRef();
|
|
1032
1035
|
if (historyRef.current == null) {
|
|
1033
|
-
historyRef.current =
|
|
1036
|
+
historyRef.current = _chunkINO4IHBFjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
1034
1037
|
}
|
|
1035
1038
|
let history = historyRef.current;
|
|
1036
1039
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -1058,7 +1061,7 @@ function BrowserRouter({
|
|
|
1058
1061
|
function HashRouter({ basename, children, window: window2 }) {
|
|
1059
1062
|
let historyRef = React2.useRef();
|
|
1060
1063
|
if (historyRef.current == null) {
|
|
1061
|
-
historyRef.current =
|
|
1064
|
+
historyRef.current = _chunkINO4IHBFjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
1062
1065
|
}
|
|
1063
1066
|
let history = historyRef.current;
|
|
1064
1067
|
let [state, setStateImpl] = React2.useState({
|
|
@@ -1127,7 +1130,7 @@ var Link = React2.forwardRef(
|
|
|
1127
1130
|
viewTransition,
|
|
1128
1131
|
...rest
|
|
1129
1132
|
}, forwardedRef) {
|
|
1130
|
-
let { basename } = React2.useContext(
|
|
1133
|
+
let { basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1131
1134
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
1132
1135
|
let absoluteHref;
|
|
1133
1136
|
let isExternal = false;
|
|
@@ -1137,22 +1140,22 @@ var Link = React2.forwardRef(
|
|
|
1137
1140
|
try {
|
|
1138
1141
|
let currentUrl = new URL(window.location.href);
|
|
1139
1142
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
1140
|
-
let path =
|
|
1143
|
+
let path = _chunkINO4IHBFjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
1141
1144
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1142
1145
|
to = path + targetUrl.search + targetUrl.hash;
|
|
1143
1146
|
} else {
|
|
1144
1147
|
isExternal = true;
|
|
1145
1148
|
}
|
|
1146
1149
|
} catch (e) {
|
|
1147
|
-
|
|
1150
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
1148
1151
|
false,
|
|
1149
1152
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1150
1153
|
);
|
|
1151
1154
|
}
|
|
1152
1155
|
}
|
|
1153
1156
|
}
|
|
1154
|
-
let href =
|
|
1155
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
1157
|
+
let href = _chunkINO4IHBFjs.useHref.call(void 0, to, { relative });
|
|
1158
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkINO4IHBFjs.usePrefetchBehavior.call(void 0,
|
|
1156
1159
|
prefetch,
|
|
1157
1160
|
rest
|
|
1158
1161
|
);
|
|
@@ -1179,13 +1182,13 @@ var Link = React2.forwardRef(
|
|
|
1179
1182
|
...prefetchHandlers,
|
|
1180
1183
|
href: absoluteHref || href,
|
|
1181
1184
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1182
|
-
ref:
|
|
1185
|
+
ref: _chunkINO4IHBFjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
1183
1186
|
target,
|
|
1184
1187
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
1185
1188
|
}
|
|
1186
1189
|
)
|
|
1187
1190
|
);
|
|
1188
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(
|
|
1191
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(_chunkINO4IHBFjs.PrefetchPageLinks, { page: href })) : link;
|
|
1189
1192
|
}
|
|
1190
1193
|
);
|
|
1191
1194
|
Link.displayName = "Link";
|
|
@@ -1201,10 +1204,10 @@ var NavLink = React2.forwardRef(
|
|
|
1201
1204
|
children,
|
|
1202
1205
|
...rest
|
|
1203
1206
|
}, ref) {
|
|
1204
|
-
let path =
|
|
1205
|
-
let location =
|
|
1206
|
-
let routerState = React2.useContext(
|
|
1207
|
-
let { navigator, basename } = React2.useContext(
|
|
1207
|
+
let path = _chunkINO4IHBFjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
1208
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1209
|
+
let routerState = React2.useContext(_chunkINO4IHBFjs.DataRouterStateContext);
|
|
1210
|
+
let { navigator, basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1208
1211
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1209
1212
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1210
1213
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -1217,7 +1220,7 @@ var NavLink = React2.forwardRef(
|
|
|
1217
1220
|
toPathname = toPathname.toLowerCase();
|
|
1218
1221
|
}
|
|
1219
1222
|
if (nextLocationPathname && basename) {
|
|
1220
|
-
nextLocationPathname =
|
|
1223
|
+
nextLocationPathname = _chunkINO4IHBFjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
1221
1224
|
}
|
|
1222
1225
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
1223
1226
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -1281,7 +1284,7 @@ var Form = React2.forwardRef(
|
|
|
1281
1284
|
if (event.defaultPrevented) return;
|
|
1282
1285
|
event.preventDefault();
|
|
1283
1286
|
let submitter = event.nativeEvent.submitter;
|
|
1284
|
-
let submitMethod = _optionalChain([submitter, 'optionalAccess',
|
|
1287
|
+
let submitMethod = _optionalChain([submitter, 'optionalAccess', _40 => _40.getAttribute, 'call', _41 => _41("formmethod")]) || method;
|
|
1285
1288
|
submit(submitter || event.currentTarget, {
|
|
1286
1289
|
fetcherKey,
|
|
1287
1290
|
method: submitMethod,
|
|
@@ -1312,10 +1315,10 @@ function ScrollRestoration({
|
|
|
1312
1315
|
storageKey,
|
|
1313
1316
|
...props
|
|
1314
1317
|
}) {
|
|
1315
|
-
let remixContext = React2.useContext(
|
|
1316
|
-
let { basename } = React2.useContext(
|
|
1317
|
-
let location =
|
|
1318
|
-
let matches =
|
|
1318
|
+
let remixContext = React2.useContext(_chunkINO4IHBFjs.FrameworkContext);
|
|
1319
|
+
let { basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1320
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1321
|
+
let matches = _chunkINO4IHBFjs.useMatches.call(void 0, );
|
|
1319
1322
|
useScrollRestoration({ getKey, storageKey });
|
|
1320
1323
|
let ssrKey = React2.useMemo(
|
|
1321
1324
|
() => {
|
|
@@ -1369,13 +1372,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
1369
1372
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1370
1373
|
}
|
|
1371
1374
|
function useDataRouterContext(hookName) {
|
|
1372
|
-
let ctx = React2.useContext(
|
|
1373
|
-
|
|
1375
|
+
let ctx = React2.useContext(_chunkINO4IHBFjs.DataRouterContext);
|
|
1376
|
+
_chunkINO4IHBFjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
1374
1377
|
return ctx;
|
|
1375
1378
|
}
|
|
1376
1379
|
function useDataRouterState(hookName) {
|
|
1377
|
-
let state = React2.useContext(
|
|
1378
|
-
|
|
1380
|
+
let state = React2.useContext(_chunkINO4IHBFjs.DataRouterStateContext);
|
|
1381
|
+
_chunkINO4IHBFjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
1379
1382
|
return state;
|
|
1380
1383
|
}
|
|
1381
1384
|
function useLinkClickHandler(to, {
|
|
@@ -1386,14 +1389,14 @@ function useLinkClickHandler(to, {
|
|
|
1386
1389
|
relative,
|
|
1387
1390
|
viewTransition
|
|
1388
1391
|
} = {}) {
|
|
1389
|
-
let navigate =
|
|
1390
|
-
let location =
|
|
1391
|
-
let path =
|
|
1392
|
+
let navigate = _chunkINO4IHBFjs.useNavigate.call(void 0, );
|
|
1393
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1394
|
+
let path = _chunkINO4IHBFjs.useResolvedPath.call(void 0, to, { relative });
|
|
1392
1395
|
return React2.useCallback(
|
|
1393
1396
|
(event) => {
|
|
1394
1397
|
if (shouldProcessLinkClick(event, target)) {
|
|
1395
1398
|
event.preventDefault();
|
|
1396
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
1399
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkINO4IHBFjs.createPath.call(void 0, location) === _chunkINO4IHBFjs.createPath.call(void 0, path);
|
|
1397
1400
|
navigate(to, {
|
|
1398
1401
|
replace,
|
|
1399
1402
|
state,
|
|
@@ -1418,13 +1421,13 @@ function useLinkClickHandler(to, {
|
|
|
1418
1421
|
);
|
|
1419
1422
|
}
|
|
1420
1423
|
function useSearchParams(defaultInit) {
|
|
1421
|
-
|
|
1424
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
1422
1425
|
typeof URLSearchParams !== "undefined",
|
|
1423
1426
|
`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.`
|
|
1424
1427
|
);
|
|
1425
1428
|
let defaultSearchParamsRef = React2.useRef(createSearchParams(defaultInit));
|
|
1426
1429
|
let hasSetSearchParamsRef = React2.useRef(false);
|
|
1427
|
-
let location =
|
|
1430
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1428
1431
|
let searchParams = React2.useMemo(
|
|
1429
1432
|
() => (
|
|
1430
1433
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -1437,7 +1440,7 @@ function useSearchParams(defaultInit) {
|
|
|
1437
1440
|
),
|
|
1438
1441
|
[location.search]
|
|
1439
1442
|
);
|
|
1440
|
-
let navigate =
|
|
1443
|
+
let navigate = _chunkINO4IHBFjs.useNavigate.call(void 0, );
|
|
1441
1444
|
let setSearchParams = React2.useCallback(
|
|
1442
1445
|
(nextInit, navigateOptions) => {
|
|
1443
1446
|
const newSearchParams = createSearchParams(
|
|
@@ -1454,8 +1457,8 @@ var fetcherId = 0;
|
|
|
1454
1457
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
1455
1458
|
function useSubmit() {
|
|
1456
1459
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
1457
|
-
let { basename } = React2.useContext(
|
|
1458
|
-
let currentRouteId =
|
|
1460
|
+
let { basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1461
|
+
let currentRouteId = _chunkINO4IHBFjs.useRouteId.call(void 0, );
|
|
1459
1462
|
return React2.useCallback(
|
|
1460
1463
|
async (target, options = {}) => {
|
|
1461
1464
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -1491,12 +1494,12 @@ function useSubmit() {
|
|
|
1491
1494
|
);
|
|
1492
1495
|
}
|
|
1493
1496
|
function useFormAction(action, { relative } = {}) {
|
|
1494
|
-
let { basename } = React2.useContext(
|
|
1495
|
-
let routeContext = React2.useContext(
|
|
1496
|
-
|
|
1497
|
+
let { basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1498
|
+
let routeContext = React2.useContext(_chunkINO4IHBFjs.RouteContext);
|
|
1499
|
+
_chunkINO4IHBFjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
1497
1500
|
let [match] = routeContext.matches.slice(-1);
|
|
1498
|
-
let path = { ...
|
|
1499
|
-
let location =
|
|
1501
|
+
let path = { ..._chunkINO4IHBFjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
1502
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1500
1503
|
if (action == null) {
|
|
1501
1504
|
path.search = location.search;
|
|
1502
1505
|
let params = new URLSearchParams(path.search);
|
|
@@ -1513,21 +1516,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
1513
1516
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1514
1517
|
}
|
|
1515
1518
|
if (basename !== "/") {
|
|
1516
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
1519
|
+
path.pathname = path.pathname === "/" ? basename : _chunkINO4IHBFjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
1517
1520
|
}
|
|
1518
|
-
return
|
|
1521
|
+
return _chunkINO4IHBFjs.createPath.call(void 0, path);
|
|
1519
1522
|
}
|
|
1520
1523
|
function useFetcher({
|
|
1521
1524
|
key
|
|
1522
1525
|
} = {}) {
|
|
1523
1526
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
1524
1527
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
1525
|
-
let fetcherData = React2.useContext(
|
|
1526
|
-
let route = React2.useContext(
|
|
1527
|
-
let routeId = _optionalChain([route, 'access',
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1528
|
+
let fetcherData = React2.useContext(_chunkINO4IHBFjs.FetchersContext);
|
|
1529
|
+
let route = React2.useContext(_chunkINO4IHBFjs.RouteContext);
|
|
1530
|
+
let routeId = _optionalChain([route, 'access', _42 => _42.matches, 'access', _43 => _43[route.matches.length - 1], 'optionalAccess', _44 => _44.route, 'access', _45 => _45.id]);
|
|
1531
|
+
_chunkINO4IHBFjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
1532
|
+
_chunkINO4IHBFjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
1533
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
1531
1534
|
routeId != null,
|
|
1532
1535
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
1533
1536
|
);
|
|
@@ -1542,7 +1545,7 @@ function useFetcher({
|
|
|
1542
1545
|
}, [router, fetcherKey]);
|
|
1543
1546
|
let load = React2.useCallback(
|
|
1544
1547
|
async (href, opts) => {
|
|
1545
|
-
|
|
1548
|
+
_chunkINO4IHBFjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
1546
1549
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
1547
1550
|
},
|
|
1548
1551
|
[fetcherKey, routeId, router]
|
|
@@ -1568,7 +1571,7 @@ function useFetcher({
|
|
|
1568
1571
|
FetcherForm2.displayName = "fetcher.Form";
|
|
1569
1572
|
return FetcherForm2;
|
|
1570
1573
|
}, [fetcherKey]);
|
|
1571
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
1574
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkINO4IHBFjs.IDLE_FETCHER;
|
|
1572
1575
|
let data = fetcherData.get(fetcherKey);
|
|
1573
1576
|
let fetcherWithComponents = React2.useMemo(
|
|
1574
1577
|
() => ({
|
|
@@ -1599,7 +1602,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
1599
1602
|
key = getKey(
|
|
1600
1603
|
{
|
|
1601
1604
|
...location,
|
|
1602
|
-
pathname:
|
|
1605
|
+
pathname: _chunkINO4IHBFjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
1603
1606
|
},
|
|
1604
1607
|
matches
|
|
1605
1608
|
);
|
|
@@ -1620,10 +1623,10 @@ function useScrollRestoration({
|
|
|
1620
1623
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
1621
1624
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
1622
1625
|
);
|
|
1623
|
-
let { basename } = React2.useContext(
|
|
1624
|
-
let location =
|
|
1625
|
-
let matches =
|
|
1626
|
-
let navigation =
|
|
1626
|
+
let { basename } = React2.useContext(_chunkINO4IHBFjs.NavigationContext);
|
|
1627
|
+
let location = _chunkINO4IHBFjs.useLocation.call(void 0, );
|
|
1628
|
+
let matches = _chunkINO4IHBFjs.useMatches.call(void 0, );
|
|
1629
|
+
let navigation = _chunkINO4IHBFjs.useNavigation.call(void 0, );
|
|
1627
1630
|
React2.useEffect(() => {
|
|
1628
1631
|
window.history.scrollRestoration = "manual";
|
|
1629
1632
|
return () => {
|
|
@@ -1642,7 +1645,7 @@ function useScrollRestoration({
|
|
|
1642
1645
|
JSON.stringify(savedScrollPositions)
|
|
1643
1646
|
);
|
|
1644
1647
|
} catch (error) {
|
|
1645
|
-
|
|
1648
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
1646
1649
|
false,
|
|
1647
1650
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
1648
1651
|
);
|
|
@@ -1663,7 +1666,7 @@ function useScrollRestoration({
|
|
|
1663
1666
|
}
|
|
1664
1667
|
}, [storageKey]);
|
|
1665
1668
|
React2.useLayoutEffect(() => {
|
|
1666
|
-
let disableScrollRestoration = _optionalChain([router, 'optionalAccess',
|
|
1669
|
+
let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _46 => _46.enableScrollRestoration, 'call', _47 => _47(
|
|
1667
1670
|
savedScrollPositions,
|
|
1668
1671
|
() => window.scrollY,
|
|
1669
1672
|
getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
|
|
@@ -1689,7 +1692,7 @@ function useScrollRestoration({
|
|
|
1689
1692
|
}
|
|
1690
1693
|
}
|
|
1691
1694
|
} catch (e2) {
|
|
1692
|
-
|
|
1695
|
+
_chunkINO4IHBFjs.warning.call(void 0,
|
|
1693
1696
|
false,
|
|
1694
1697
|
`"${location.hash.slice(
|
|
1695
1698
|
1
|
|
@@ -1727,7 +1730,7 @@ function usePrompt({
|
|
|
1727
1730
|
when,
|
|
1728
1731
|
message
|
|
1729
1732
|
}) {
|
|
1730
|
-
let blocker =
|
|
1733
|
+
let blocker = _chunkINO4IHBFjs.useBlocker.call(void 0, when);
|
|
1731
1734
|
React2.useEffect(() => {
|
|
1732
1735
|
if (blocker.state === "blocked") {
|
|
1733
1736
|
let proceed = window.confirm(message);
|
|
@@ -1745,21 +1748,21 @@ function usePrompt({
|
|
|
1745
1748
|
}, [blocker, when]);
|
|
1746
1749
|
}
|
|
1747
1750
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1748
|
-
let vtContext = React2.useContext(
|
|
1749
|
-
|
|
1751
|
+
let vtContext = React2.useContext(_chunkINO4IHBFjs.ViewTransitionContext);
|
|
1752
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
1750
1753
|
vtContext != null,
|
|
1751
1754
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1752
1755
|
);
|
|
1753
1756
|
let { basename } = useDataRouterContext(
|
|
1754
1757
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1755
1758
|
);
|
|
1756
|
-
let path =
|
|
1759
|
+
let path = _chunkINO4IHBFjs.useResolvedPath.call(void 0, to, { relative });
|
|
1757
1760
|
if (!vtContext.isTransitioning) {
|
|
1758
1761
|
return false;
|
|
1759
1762
|
}
|
|
1760
|
-
let currentPath =
|
|
1761
|
-
let nextPath =
|
|
1762
|
-
return
|
|
1763
|
+
let currentPath = _chunkINO4IHBFjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1764
|
+
let nextPath = _chunkINO4IHBFjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1765
|
+
return _chunkINO4IHBFjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkINO4IHBFjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1763
1766
|
}
|
|
1764
1767
|
|
|
1765
1768
|
// lib/dom/server.tsx
|
|
@@ -1770,7 +1773,7 @@ function StaticRouter({
|
|
|
1770
1773
|
location: locationProp = "/"
|
|
1771
1774
|
}) {
|
|
1772
1775
|
if (typeof locationProp === "string") {
|
|
1773
|
-
locationProp =
|
|
1776
|
+
locationProp = _chunkINO4IHBFjs.parsePath.call(void 0, locationProp);
|
|
1774
1777
|
}
|
|
1775
1778
|
let action = "POP" /* Pop */;
|
|
1776
1779
|
let location = {
|
|
@@ -1799,7 +1802,7 @@ function StaticRouterProvider({
|
|
|
1799
1802
|
hydrate = true,
|
|
1800
1803
|
nonce
|
|
1801
1804
|
}) {
|
|
1802
|
-
|
|
1805
|
+
_chunkINO4IHBFjs.invariant.call(void 0,
|
|
1803
1806
|
router && context,
|
|
1804
1807
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1805
1808
|
);
|
|
@@ -1822,7 +1825,7 @@ function StaticRouterProvider({
|
|
|
1822
1825
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1823
1826
|
}
|
|
1824
1827
|
let { state } = dataRouterContext.router;
|
|
1825
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
1828
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(_chunkINO4IHBFjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(_chunkINO4IHBFjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(_chunkINO4IHBFjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React3.createElement(_chunkINO4IHBFjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React3.createElement(
|
|
1826
1829
|
Router,
|
|
1827
1830
|
{
|
|
1828
1831
|
basename: dataRouterContext.basename,
|
|
@@ -1853,14 +1856,14 @@ function DataRoutes2({
|
|
|
1853
1856
|
future,
|
|
1854
1857
|
state
|
|
1855
1858
|
}) {
|
|
1856
|
-
return
|
|
1859
|
+
return _chunkINO4IHBFjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1857
1860
|
}
|
|
1858
1861
|
function serializeErrors(errors) {
|
|
1859
1862
|
if (!errors) return null;
|
|
1860
1863
|
let entries = Object.entries(errors);
|
|
1861
1864
|
let serialized = {};
|
|
1862
1865
|
for (let [key, val] of entries) {
|
|
1863
|
-
if (
|
|
1866
|
+
if (_chunkINO4IHBFjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1864
1867
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1865
1868
|
} else if (val instanceof Error) {
|
|
1866
1869
|
serialized[key] = {
|
|
@@ -1910,14 +1913,14 @@ function getStatelessNavigator() {
|
|
|
1910
1913
|
};
|
|
1911
1914
|
}
|
|
1912
1915
|
function createStaticHandler2(routes, opts) {
|
|
1913
|
-
return
|
|
1916
|
+
return _chunkINO4IHBFjs.createStaticHandler.call(void 0, routes, {
|
|
1914
1917
|
...opts,
|
|
1915
1918
|
mapRouteProperties
|
|
1916
1919
|
});
|
|
1917
1920
|
}
|
|
1918
1921
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1919
1922
|
let manifest = {};
|
|
1920
|
-
let dataRoutes =
|
|
1923
|
+
let dataRoutes = _chunkINO4IHBFjs.convertRoutesToDataRoutes.call(void 0,
|
|
1921
1924
|
routes,
|
|
1922
1925
|
mapRouteProperties,
|
|
1923
1926
|
void 0,
|
|
@@ -1938,7 +1941,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1938
1941
|
get future() {
|
|
1939
1942
|
return {
|
|
1940
1943
|
v8_middleware: false,
|
|
1941
|
-
..._optionalChain([opts, 'optionalAccess',
|
|
1944
|
+
..._optionalChain([opts, 'optionalAccess', _48 => _48.future])
|
|
1942
1945
|
};
|
|
1943
1946
|
},
|
|
1944
1947
|
get state() {
|
|
@@ -1950,7 +1953,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1950
1953
|
actionData: context.actionData,
|
|
1951
1954
|
errors: context.errors,
|
|
1952
1955
|
initialized: true,
|
|
1953
|
-
navigation:
|
|
1956
|
+
navigation: _chunkINO4IHBFjs.IDLE_NAVIGATION,
|
|
1954
1957
|
restoreScrollPosition: null,
|
|
1955
1958
|
preventScrollReset: false,
|
|
1956
1959
|
revalidation: "idle",
|
|
@@ -1985,7 +1988,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1985
1988
|
createHref,
|
|
1986
1989
|
encodeLocation,
|
|
1987
1990
|
getFetcher() {
|
|
1988
|
-
return
|
|
1991
|
+
return _chunkINO4IHBFjs.IDLE_FETCHER;
|
|
1989
1992
|
},
|
|
1990
1993
|
deleteFetcher() {
|
|
1991
1994
|
throw msg("deleteFetcher");
|
|
@@ -1997,7 +2000,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1997
2000
|
throw msg("dispose");
|
|
1998
2001
|
},
|
|
1999
2002
|
getBlocker() {
|
|
2000
|
-
return
|
|
2003
|
+
return _chunkINO4IHBFjs.IDLE_BLOCKER;
|
|
2001
2004
|
},
|
|
2002
2005
|
deleteBlocker() {
|
|
2003
2006
|
throw msg("deleteBlocker");
|
|
@@ -2015,10 +2018,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
2015
2018
|
};
|
|
2016
2019
|
}
|
|
2017
2020
|
function createHref(to) {
|
|
2018
|
-
return typeof to === "string" ? to :
|
|
2021
|
+
return typeof to === "string" ? to : _chunkINO4IHBFjs.createPath.call(void 0, to);
|
|
2019
2022
|
}
|
|
2020
2023
|
function encodeLocation(to) {
|
|
2021
|
-
let href = typeof to === "string" ? to :
|
|
2024
|
+
let href = typeof to === "string" ? to : _chunkINO4IHBFjs.createPath.call(void 0, to);
|
|
2022
2025
|
href = href.replace(/ $/, "%20");
|
|
2023
2026
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
2024
2027
|
return {
|