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