react-router 7.12.0 → 7.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/{production/chunk-QCD7HIN2.mjs → development/chunk-4LKRSAEJ.mjs} +21 -15
- package/dist/development/{chunk-G2I2SRFA.js → chunk-7PAHGFS4.js} +7 -7
- package/dist/development/{chunk-7ZCBDOCZ.js → chunk-HMDR2CVH.js} +96 -96
- package/dist/development/{chunk-EPOLDU6W.mjs → chunk-JZWAC4HX.mjs} +36 -21
- package/dist/development/{chunk-2BEI23B2.js → chunk-WICQJKU6.js} +35 -20
- package/dist/development/dom-export.js +27 -27
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/{index-react-server-client-gGyf-7Xp.d.ts → index-react-server-client-1TI9M9o1.d.ts} +8 -1
- package/dist/development/{index-react-server-client-IoJGLOqV.d.mts → index-react-server-client-MKTlCGL3.d.mts} +8 -1
- package/dist/development/index-react-server-client.d.mts +1 -1
- package/dist/development/index-react-server-client.d.ts +1 -1
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +5 -19
- package/dist/development/index-react-server.mjs +5 -19
- package/dist/development/index.d.mts +2 -2
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +101 -95
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{development/chunk-FNSCYPCZ.mjs → production/chunk-GSFLVUYQ.mjs} +21 -15
- package/dist/production/{chunk-Y62AB6TB.js → chunk-N2HZAAIG.js} +96 -96
- package/dist/production/{chunk-337Z4Y65.js → chunk-NGWWS4QJ.js} +7 -7
- package/dist/production/{chunk-Z47B263N.js → chunk-QSNCZFX5.js} +35 -20
- package/dist/production/{chunk-DZM3VO5F.mjs → chunk-Y3R63HEB.mjs} +36 -21
- package/dist/production/dom-export.js +27 -27
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/{index-react-server-client-gGyf-7Xp.d.ts → index-react-server-client-1TI9M9o1.d.ts} +8 -1
- package/dist/production/{index-react-server-client-IoJGLOqV.d.mts → index-react-server-client-MKTlCGL3.d.mts} +8 -1
- package/dist/production/index-react-server-client.d.mts +1 -1
- package/dist/production/index-react-server-client.d.ts +1 -1
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +5 -19
- package/dist/production/index-react-server.mjs +5 -19
- package/dist/production/index.d.mts +2 -2
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +101 -95
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.13.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _chunkWICQJKU6js = require('./chunk-WICQJKU6.js');
|
|
54
54
|
|
|
55
55
|
// lib/dom/dom.ts
|
|
56
56
|
var defaultMethod = "get";
|
|
@@ -121,7 +121,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
121
121
|
]);
|
|
122
122
|
function getFormEncType(encType) {
|
|
123
123
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
124
|
-
|
|
124
|
+
_chunkWICQJKU6js.warning.call(void 0,
|
|
125
125
|
false,
|
|
126
126
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
127
127
|
);
|
|
@@ -137,7 +137,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
137
137
|
let body;
|
|
138
138
|
if (isFormElement(target)) {
|
|
139
139
|
let attr = target.getAttribute("action");
|
|
140
|
-
action = attr ?
|
|
140
|
+
action = attr ? _chunkWICQJKU6js.stripBasename.call(void 0, attr, basename) : null;
|
|
141
141
|
method = target.getAttribute("method") || defaultMethod;
|
|
142
142
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
143
143
|
formData = new FormData(target);
|
|
@@ -149,7 +149,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
152
|
-
action = attr ?
|
|
152
|
+
action = attr ? _chunkWICQJKU6js.stripBasename.call(void 0, attr, basename) : null;
|
|
153
153
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
154
154
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
155
155
|
formData = new FormData(form, target);
|
|
@@ -186,20 +186,20 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
186
186
|
try {
|
|
187
187
|
if (isBrowser) {
|
|
188
188
|
window.__reactRouterVersion = // @ts-expect-error
|
|
189
|
-
"7.
|
|
189
|
+
"7.13.0";
|
|
190
190
|
}
|
|
191
191
|
} catch (e) {
|
|
192
192
|
}
|
|
193
193
|
function createBrowserRouter(routes, opts) {
|
|
194
|
-
return
|
|
194
|
+
return _chunkWICQJKU6js.createRouter.call(void 0, {
|
|
195
195
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
196
196
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
197
197
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
198
|
-
history:
|
|
198
|
+
history: _chunkWICQJKU6js.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
199
199
|
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
200
200
|
routes,
|
|
201
|
-
mapRouteProperties:
|
|
202
|
-
hydrationRouteProperties:
|
|
201
|
+
mapRouteProperties: _chunkWICQJKU6js.mapRouteProperties,
|
|
202
|
+
hydrationRouteProperties: _chunkWICQJKU6js.hydrationRouteProperties,
|
|
203
203
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
204
204
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
205
205
|
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
@@ -207,15 +207,15 @@ function createBrowserRouter(routes, opts) {
|
|
|
207
207
|
}).initialize();
|
|
208
208
|
}
|
|
209
209
|
function createHashRouter(routes, opts) {
|
|
210
|
-
return
|
|
210
|
+
return _chunkWICQJKU6js.createRouter.call(void 0, {
|
|
211
211
|
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
212
212
|
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
213
213
|
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
214
|
-
history:
|
|
214
|
+
history: _chunkWICQJKU6js.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
215
215
|
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
216
216
|
routes,
|
|
217
|
-
mapRouteProperties:
|
|
218
|
-
hydrationRouteProperties:
|
|
217
|
+
mapRouteProperties: _chunkWICQJKU6js.mapRouteProperties,
|
|
218
|
+
hydrationRouteProperties: _chunkWICQJKU6js.hydrationRouteProperties,
|
|
219
219
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
220
220
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
221
221
|
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
@@ -238,7 +238,7 @@ function deserializeErrors(errors) {
|
|
|
238
238
|
let serialized = {};
|
|
239
239
|
for (let [key, val] of entries) {
|
|
240
240
|
if (val && val.__type === "RouteErrorResponse") {
|
|
241
|
-
serialized[key] = new (0,
|
|
241
|
+
serialized[key] = new (0, _chunkWICQJKU6js.ErrorResponseImpl)(
|
|
242
242
|
val.status,
|
|
243
243
|
val.statusText,
|
|
244
244
|
val.data,
|
|
@@ -275,7 +275,7 @@ function BrowserRouter({
|
|
|
275
275
|
}) {
|
|
276
276
|
let historyRef = React.useRef();
|
|
277
277
|
if (historyRef.current == null) {
|
|
278
|
-
historyRef.current =
|
|
278
|
+
historyRef.current = _chunkWICQJKU6js.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
279
279
|
}
|
|
280
280
|
let history = historyRef.current;
|
|
281
281
|
let [state, setStateImpl] = React.useState({
|
|
@@ -294,7 +294,7 @@ function BrowserRouter({
|
|
|
294
294
|
);
|
|
295
295
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
296
296
|
return /* @__PURE__ */ React.createElement(
|
|
297
|
-
|
|
297
|
+
_chunkWICQJKU6js.Router,
|
|
298
298
|
{
|
|
299
299
|
basename,
|
|
300
300
|
children,
|
|
@@ -313,7 +313,7 @@ function HashRouter({
|
|
|
313
313
|
}) {
|
|
314
314
|
let historyRef = React.useRef();
|
|
315
315
|
if (historyRef.current == null) {
|
|
316
|
-
historyRef.current =
|
|
316
|
+
historyRef.current = _chunkWICQJKU6js.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
317
317
|
}
|
|
318
318
|
let history = historyRef.current;
|
|
319
319
|
let [state, setStateImpl] = React.useState({
|
|
@@ -332,7 +332,7 @@ function HashRouter({
|
|
|
332
332
|
);
|
|
333
333
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
334
334
|
return /* @__PURE__ */ React.createElement(
|
|
335
|
-
|
|
335
|
+
_chunkWICQJKU6js.Router,
|
|
336
336
|
{
|
|
337
337
|
basename,
|
|
338
338
|
children,
|
|
@@ -365,7 +365,7 @@ function HistoryRouter({
|
|
|
365
365
|
);
|
|
366
366
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
367
367
|
return /* @__PURE__ */ React.createElement(
|
|
368
|
-
|
|
368
|
+
_chunkWICQJKU6js.Router,
|
|
369
369
|
{
|
|
370
370
|
basename,
|
|
371
371
|
children,
|
|
@@ -394,12 +394,12 @@ var Link = React.forwardRef(
|
|
|
394
394
|
unstable_defaultShouldRevalidate,
|
|
395
395
|
...rest
|
|
396
396
|
}, forwardedRef) {
|
|
397
|
-
let { basename, unstable_useTransitions } = React.useContext(
|
|
397
|
+
let { basename, unstable_useTransitions } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
398
398
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
399
|
-
let parsed =
|
|
399
|
+
let parsed = _chunkWICQJKU6js.parseToInfo.call(void 0, to, basename);
|
|
400
400
|
to = parsed.to;
|
|
401
|
-
let href =
|
|
402
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
401
|
+
let href = _chunkWICQJKU6js.useHref.call(void 0, to, { relative });
|
|
402
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkWICQJKU6js.usePrefetchBehavior.call(void 0,
|
|
403
403
|
prefetch,
|
|
404
404
|
rest
|
|
405
405
|
);
|
|
@@ -428,13 +428,13 @@ var Link = React.forwardRef(
|
|
|
428
428
|
...prefetchHandlers,
|
|
429
429
|
href: parsed.absoluteURL || href,
|
|
430
430
|
onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
|
|
431
|
-
ref:
|
|
431
|
+
ref: _chunkWICQJKU6js.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
432
432
|
target,
|
|
433
433
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
434
434
|
}
|
|
435
435
|
)
|
|
436
436
|
);
|
|
437
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
437
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkWICQJKU6js.PrefetchPageLinks, { page: href })) : link;
|
|
438
438
|
}
|
|
439
439
|
);
|
|
440
440
|
Link.displayName = "Link";
|
|
@@ -450,10 +450,10 @@ var NavLink = React.forwardRef(
|
|
|
450
450
|
children,
|
|
451
451
|
...rest
|
|
452
452
|
}, ref) {
|
|
453
|
-
let path =
|
|
454
|
-
let location =
|
|
455
|
-
let routerState = React.useContext(
|
|
456
|
-
let { navigator, basename } = React.useContext(
|
|
453
|
+
let path = _chunkWICQJKU6js.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
454
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
455
|
+
let routerState = React.useContext(_chunkWICQJKU6js.DataRouterStateContext);
|
|
456
|
+
let { navigator, basename } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
457
457
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
458
458
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
459
459
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -466,7 +466,7 @@ var NavLink = React.forwardRef(
|
|
|
466
466
|
toPathname = toPathname.toLowerCase();
|
|
467
467
|
}
|
|
468
468
|
if (nextLocationPathname && basename) {
|
|
469
|
-
nextLocationPathname =
|
|
469
|
+
nextLocationPathname = _chunkWICQJKU6js.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
470
470
|
}
|
|
471
471
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
472
472
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -522,7 +522,7 @@ var Form = React.forwardRef(
|
|
|
522
522
|
unstable_defaultShouldRevalidate,
|
|
523
523
|
...props
|
|
524
524
|
}, forwardedRef) => {
|
|
525
|
-
let { unstable_useTransitions } = React.useContext(
|
|
525
|
+
let { unstable_useTransitions } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
526
526
|
let submit = useSubmit();
|
|
527
527
|
let formAction = useFormAction(action, { relative });
|
|
528
528
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -569,10 +569,10 @@ function ScrollRestoration({
|
|
|
569
569
|
storageKey,
|
|
570
570
|
...props
|
|
571
571
|
}) {
|
|
572
|
-
let remixContext = React.useContext(
|
|
573
|
-
let { basename } = React.useContext(
|
|
574
|
-
let location =
|
|
575
|
-
let matches =
|
|
572
|
+
let remixContext = React.useContext(_chunkWICQJKU6js.FrameworkContext);
|
|
573
|
+
let { basename } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
574
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
575
|
+
let matches = _chunkWICQJKU6js.useMatches.call(void 0, );
|
|
576
576
|
useScrollRestoration({ getKey, storageKey });
|
|
577
577
|
let ssrKey = React.useMemo(
|
|
578
578
|
() => {
|
|
@@ -614,9 +614,9 @@ function ScrollRestoration({
|
|
|
614
614
|
...props,
|
|
615
615
|
suppressHydrationWarning: true,
|
|
616
616
|
dangerouslySetInnerHTML: {
|
|
617
|
-
__html: `(${restoreScroll})(${
|
|
617
|
+
__html: `(${restoreScroll})(${_chunkWICQJKU6js.escapeHtml.call(void 0,
|
|
618
618
|
JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
|
|
619
|
-
)}, ${
|
|
619
|
+
)}, ${_chunkWICQJKU6js.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
);
|
|
@@ -626,13 +626,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
626
626
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
627
627
|
}
|
|
628
628
|
function useDataRouterContext(hookName) {
|
|
629
|
-
let ctx = React.useContext(
|
|
630
|
-
|
|
629
|
+
let ctx = React.useContext(_chunkWICQJKU6js.DataRouterContext);
|
|
630
|
+
_chunkWICQJKU6js.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
631
631
|
return ctx;
|
|
632
632
|
}
|
|
633
633
|
function useDataRouterState(hookName) {
|
|
634
|
-
let state = React.useContext(
|
|
635
|
-
|
|
634
|
+
let state = React.useContext(_chunkWICQJKU6js.DataRouterStateContext);
|
|
635
|
+
_chunkWICQJKU6js.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
636
636
|
return state;
|
|
637
637
|
}
|
|
638
638
|
function useLinkClickHandler(to, {
|
|
@@ -645,14 +645,14 @@ function useLinkClickHandler(to, {
|
|
|
645
645
|
unstable_defaultShouldRevalidate,
|
|
646
646
|
unstable_useTransitions
|
|
647
647
|
} = {}) {
|
|
648
|
-
let navigate =
|
|
649
|
-
let location =
|
|
650
|
-
let path =
|
|
648
|
+
let navigate = _chunkWICQJKU6js.useNavigate.call(void 0, );
|
|
649
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
650
|
+
let path = _chunkWICQJKU6js.useResolvedPath.call(void 0, to, { relative });
|
|
651
651
|
return React.useCallback(
|
|
652
652
|
(event) => {
|
|
653
653
|
if (shouldProcessLinkClick(event, target)) {
|
|
654
654
|
event.preventDefault();
|
|
655
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
655
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkWICQJKU6js.createPath.call(void 0, location) === _chunkWICQJKU6js.createPath.call(void 0, path);
|
|
656
656
|
let doNavigate = () => navigate(to, {
|
|
657
657
|
replace,
|
|
658
658
|
state,
|
|
@@ -685,13 +685,13 @@ function useLinkClickHandler(to, {
|
|
|
685
685
|
);
|
|
686
686
|
}
|
|
687
687
|
function useSearchParams(defaultInit) {
|
|
688
|
-
|
|
688
|
+
_chunkWICQJKU6js.warning.call(void 0,
|
|
689
689
|
typeof URLSearchParams !== "undefined",
|
|
690
690
|
`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.`
|
|
691
691
|
);
|
|
692
692
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
693
693
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
694
|
-
let location =
|
|
694
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
695
695
|
let searchParams = React.useMemo(
|
|
696
696
|
() => (
|
|
697
697
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -704,7 +704,7 @@ function useSearchParams(defaultInit) {
|
|
|
704
704
|
),
|
|
705
705
|
[location.search]
|
|
706
706
|
);
|
|
707
|
-
let navigate =
|
|
707
|
+
let navigate = _chunkWICQJKU6js.useNavigate.call(void 0, );
|
|
708
708
|
let setSearchParams = React.useCallback(
|
|
709
709
|
(nextInit, navigateOptions) => {
|
|
710
710
|
const newSearchParams = createSearchParams(
|
|
@@ -721,8 +721,8 @@ var fetcherId = 0;
|
|
|
721
721
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
722
722
|
function useSubmit() {
|
|
723
723
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
724
|
-
let { basename } = React.useContext(
|
|
725
|
-
let currentRouteId =
|
|
724
|
+
let { basename } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
725
|
+
let currentRouteId = _chunkWICQJKU6js.useRouteId.call(void 0, );
|
|
726
726
|
let routerFetch = router.fetch;
|
|
727
727
|
let routerNavigate = router.navigate;
|
|
728
728
|
return React.useCallback(
|
|
@@ -762,12 +762,12 @@ function useSubmit() {
|
|
|
762
762
|
);
|
|
763
763
|
}
|
|
764
764
|
function useFormAction(action, { relative } = {}) {
|
|
765
|
-
let { basename } = React.useContext(
|
|
766
|
-
let routeContext = React.useContext(
|
|
767
|
-
|
|
765
|
+
let { basename } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
766
|
+
let routeContext = React.useContext(_chunkWICQJKU6js.RouteContext);
|
|
767
|
+
_chunkWICQJKU6js.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
768
768
|
let [match] = routeContext.matches.slice(-1);
|
|
769
|
-
let path = { ...
|
|
770
|
-
let location =
|
|
769
|
+
let path = { ..._chunkWICQJKU6js.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
770
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
771
771
|
if (action == null) {
|
|
772
772
|
path.search = location.search;
|
|
773
773
|
let params = new URLSearchParams(path.search);
|
|
@@ -784,21 +784,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
784
784
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
785
785
|
}
|
|
786
786
|
if (basename !== "/") {
|
|
787
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
787
|
+
path.pathname = path.pathname === "/" ? basename : _chunkWICQJKU6js.joinPaths.call(void 0, [basename, path.pathname]);
|
|
788
788
|
}
|
|
789
|
-
return
|
|
789
|
+
return _chunkWICQJKU6js.createPath.call(void 0, path);
|
|
790
790
|
}
|
|
791
791
|
function useFetcher({
|
|
792
792
|
key
|
|
793
793
|
} = {}) {
|
|
794
794
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
795
795
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
796
|
-
let fetcherData = React.useContext(
|
|
797
|
-
let route = React.useContext(
|
|
796
|
+
let fetcherData = React.useContext(_chunkWICQJKU6js.FetchersContext);
|
|
797
|
+
let route = React.useContext(_chunkWICQJKU6js.RouteContext);
|
|
798
798
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
799
|
+
_chunkWICQJKU6js.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
800
|
+
_chunkWICQJKU6js.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
801
|
+
_chunkWICQJKU6js.invariant.call(void 0,
|
|
802
802
|
routeId != null,
|
|
803
803
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
804
804
|
);
|
|
@@ -814,7 +814,7 @@ function useFetcher({
|
|
|
814
814
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
815
815
|
let load = React.useCallback(
|
|
816
816
|
async (href, opts) => {
|
|
817
|
-
|
|
817
|
+
_chunkWICQJKU6js.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
818
818
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
819
819
|
},
|
|
820
820
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -843,7 +843,7 @@ function useFetcher({
|
|
|
843
843
|
FetcherForm2.displayName = "fetcher.Form";
|
|
844
844
|
return FetcherForm2;
|
|
845
845
|
}, [fetcherKey]);
|
|
846
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
846
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkWICQJKU6js.IDLE_FETCHER;
|
|
847
847
|
let data = fetcherData.get(fetcherKey);
|
|
848
848
|
let fetcherWithComponents = React.useMemo(
|
|
849
849
|
() => ({
|
|
@@ -874,7 +874,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
874
874
|
key = getKey(
|
|
875
875
|
{
|
|
876
876
|
...location,
|
|
877
|
-
pathname:
|
|
877
|
+
pathname: _chunkWICQJKU6js.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
878
878
|
},
|
|
879
879
|
matches
|
|
880
880
|
);
|
|
@@ -895,10 +895,10 @@ function useScrollRestoration({
|
|
|
895
895
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
896
896
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
897
897
|
);
|
|
898
|
-
let { basename } = React.useContext(
|
|
899
|
-
let location =
|
|
900
|
-
let matches =
|
|
901
|
-
let navigation =
|
|
898
|
+
let { basename } = React.useContext(_chunkWICQJKU6js.NavigationContext);
|
|
899
|
+
let location = _chunkWICQJKU6js.useLocation.call(void 0, );
|
|
900
|
+
let matches = _chunkWICQJKU6js.useMatches.call(void 0, );
|
|
901
|
+
let navigation = _chunkWICQJKU6js.useNavigation.call(void 0, );
|
|
902
902
|
React.useEffect(() => {
|
|
903
903
|
window.history.scrollRestoration = "manual";
|
|
904
904
|
return () => {
|
|
@@ -917,7 +917,7 @@ function useScrollRestoration({
|
|
|
917
917
|
JSON.stringify(savedScrollPositions)
|
|
918
918
|
);
|
|
919
919
|
} catch (error) {
|
|
920
|
-
|
|
920
|
+
_chunkWICQJKU6js.warning.call(void 0,
|
|
921
921
|
false,
|
|
922
922
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
923
923
|
);
|
|
@@ -964,7 +964,7 @@ function useScrollRestoration({
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
} catch (e2) {
|
|
967
|
-
|
|
967
|
+
_chunkWICQJKU6js.warning.call(void 0,
|
|
968
968
|
false,
|
|
969
969
|
`"${location.hash.slice(
|
|
970
970
|
1
|
|
@@ -1002,7 +1002,7 @@ function usePrompt({
|
|
|
1002
1002
|
when,
|
|
1003
1003
|
message
|
|
1004
1004
|
}) {
|
|
1005
|
-
let blocker =
|
|
1005
|
+
let blocker = _chunkWICQJKU6js.useBlocker.call(void 0, when);
|
|
1006
1006
|
React.useEffect(() => {
|
|
1007
1007
|
if (blocker.state === "blocked") {
|
|
1008
1008
|
let proceed = window.confirm(message);
|
|
@@ -1020,21 +1020,21 @@ function usePrompt({
|
|
|
1020
1020
|
}, [blocker, when]);
|
|
1021
1021
|
}
|
|
1022
1022
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1023
|
-
let vtContext = React.useContext(
|
|
1024
|
-
|
|
1023
|
+
let vtContext = React.useContext(_chunkWICQJKU6js.ViewTransitionContext);
|
|
1024
|
+
_chunkWICQJKU6js.invariant.call(void 0,
|
|
1025
1025
|
vtContext != null,
|
|
1026
1026
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1027
1027
|
);
|
|
1028
1028
|
let { basename } = useDataRouterContext(
|
|
1029
1029
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1030
1030
|
);
|
|
1031
|
-
let path =
|
|
1031
|
+
let path = _chunkWICQJKU6js.useResolvedPath.call(void 0, to, { relative });
|
|
1032
1032
|
if (!vtContext.isTransitioning) {
|
|
1033
1033
|
return false;
|
|
1034
1034
|
}
|
|
1035
|
-
let currentPath =
|
|
1036
|
-
let nextPath =
|
|
1037
|
-
return
|
|
1035
|
+
let currentPath = _chunkWICQJKU6js.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1036
|
+
let nextPath = _chunkWICQJKU6js.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1037
|
+
return _chunkWICQJKU6js.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkWICQJKU6js.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
1040
|
// lib/dom/server.tsx
|
|
@@ -1045,7 +1045,7 @@ function StaticRouter({
|
|
|
1045
1045
|
location: locationProp = "/"
|
|
1046
1046
|
}) {
|
|
1047
1047
|
if (typeof locationProp === "string") {
|
|
1048
|
-
locationProp =
|
|
1048
|
+
locationProp = _chunkWICQJKU6js.parsePath.call(void 0, locationProp);
|
|
1049
1049
|
}
|
|
1050
1050
|
let action = "POP" /* Pop */;
|
|
1051
1051
|
let location = {
|
|
@@ -1057,7 +1057,7 @@ function StaticRouter({
|
|
|
1057
1057
|
};
|
|
1058
1058
|
let staticNavigator = getStatelessNavigator();
|
|
1059
1059
|
return /* @__PURE__ */ React2.createElement(
|
|
1060
|
-
|
|
1060
|
+
_chunkWICQJKU6js.Router,
|
|
1061
1061
|
{
|
|
1062
1062
|
basename,
|
|
1063
1063
|
children,
|
|
@@ -1075,7 +1075,7 @@ function StaticRouterProvider({
|
|
|
1075
1075
|
hydrate = true,
|
|
1076
1076
|
nonce
|
|
1077
1077
|
}) {
|
|
1078
|
-
|
|
1078
|
+
_chunkWICQJKU6js.invariant.call(void 0,
|
|
1079
1079
|
router && context,
|
|
1080
1080
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1081
1081
|
);
|
|
@@ -1094,12 +1094,12 @@ function StaticRouterProvider({
|
|
|
1094
1094
|
actionData: context.actionData,
|
|
1095
1095
|
errors: serializeErrors(context.errors)
|
|
1096
1096
|
};
|
|
1097
|
-
let json =
|
|
1097
|
+
let json = _chunkWICQJKU6js.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
|
|
1098
1098
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1099
1099
|
}
|
|
1100
1100
|
let { state } = dataRouterContext.router;
|
|
1101
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1102
|
-
|
|
1101
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkWICQJKU6js.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkWICQJKU6js.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkWICQJKU6js.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkWICQJKU6js.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1102
|
+
_chunkWICQJKU6js.Router,
|
|
1103
1103
|
{
|
|
1104
1104
|
basename: dataRouterContext.basename,
|
|
1105
1105
|
location: state.location,
|
|
@@ -1130,14 +1130,14 @@ function DataRoutes({
|
|
|
1130
1130
|
future,
|
|
1131
1131
|
state
|
|
1132
1132
|
}) {
|
|
1133
|
-
return
|
|
1133
|
+
return _chunkWICQJKU6js.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1134
1134
|
}
|
|
1135
1135
|
function serializeErrors(errors) {
|
|
1136
1136
|
if (!errors) return null;
|
|
1137
1137
|
let entries = Object.entries(errors);
|
|
1138
1138
|
let serialized = {};
|
|
1139
1139
|
for (let [key, val] of entries) {
|
|
1140
|
-
if (
|
|
1140
|
+
if (_chunkWICQJKU6js.isRouteErrorResponse.call(void 0, val)) {
|
|
1141
1141
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1142
1142
|
} else if (val instanceof Error) {
|
|
1143
1143
|
serialized[key] = {
|
|
@@ -1187,16 +1187,16 @@ function getStatelessNavigator() {
|
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
1189
|
function createStaticHandler2(routes, opts) {
|
|
1190
|
-
return
|
|
1190
|
+
return _chunkWICQJKU6js.createStaticHandler.call(void 0, routes, {
|
|
1191
1191
|
...opts,
|
|
1192
|
-
mapRouteProperties:
|
|
1192
|
+
mapRouteProperties: _chunkWICQJKU6js.mapRouteProperties
|
|
1193
1193
|
});
|
|
1194
1194
|
}
|
|
1195
1195
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1196
1196
|
let manifest = {};
|
|
1197
|
-
let dataRoutes =
|
|
1197
|
+
let dataRoutes = _chunkWICQJKU6js.convertRoutesToDataRoutes.call(void 0,
|
|
1198
1198
|
routes,
|
|
1199
|
-
|
|
1199
|
+
_chunkWICQJKU6js.mapRouteProperties,
|
|
1200
1200
|
void 0,
|
|
1201
1201
|
manifest
|
|
1202
1202
|
);
|
|
@@ -1227,7 +1227,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1227
1227
|
actionData: context.actionData,
|
|
1228
1228
|
errors: context.errors,
|
|
1229
1229
|
initialized: true,
|
|
1230
|
-
navigation:
|
|
1230
|
+
navigation: _chunkWICQJKU6js.IDLE_NAVIGATION,
|
|
1231
1231
|
restoreScrollPosition: null,
|
|
1232
1232
|
preventScrollReset: false,
|
|
1233
1233
|
revalidation: "idle",
|
|
@@ -1262,7 +1262,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1262
1262
|
createHref,
|
|
1263
1263
|
encodeLocation,
|
|
1264
1264
|
getFetcher() {
|
|
1265
|
-
return
|
|
1265
|
+
return _chunkWICQJKU6js.IDLE_FETCHER;
|
|
1266
1266
|
},
|
|
1267
1267
|
deleteFetcher() {
|
|
1268
1268
|
throw msg("deleteFetcher");
|
|
@@ -1274,7 +1274,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1274
1274
|
throw msg("dispose");
|
|
1275
1275
|
},
|
|
1276
1276
|
getBlocker() {
|
|
1277
|
-
return
|
|
1277
|
+
return _chunkWICQJKU6js.IDLE_BLOCKER;
|
|
1278
1278
|
},
|
|
1279
1279
|
deleteBlocker() {
|
|
1280
1280
|
throw msg("deleteBlocker");
|
|
@@ -1292,10 +1292,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1292
1292
|
};
|
|
1293
1293
|
}
|
|
1294
1294
|
function createHref(to) {
|
|
1295
|
-
return typeof to === "string" ? to :
|
|
1295
|
+
return typeof to === "string" ? to : _chunkWICQJKU6js.createPath.call(void 0, to);
|
|
1296
1296
|
}
|
|
1297
1297
|
function encodeLocation(to) {
|
|
1298
|
-
let href = typeof to === "string" ? to :
|
|
1298
|
+
let href = typeof to === "string" ? to : _chunkWICQJKU6js.createPath.call(void 0, to);
|
|
1299
1299
|
href = href.replace(/ $/, "%20");
|
|
1300
1300
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1301
1301
|
return {
|