react-router 7.18.0 → 7.18.1
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 +6 -0
- package/dist/{production/chunk-3Z6WS2WZ.js → development/chunk-EVX4J2F5.js} +7 -7
- package/dist/development/{chunk-YL5M26XI.js → chunk-G5KIBF6U.js} +103 -103
- package/dist/development/{chunk-E4MTK73K.mjs → chunk-IJF3QNGC.mjs} +2 -2
- package/dist/development/{chunk-4ZMWKKQ3.mjs → chunk-KS7C4IRE.mjs} +2 -2
- package/dist/development/{chunk-U7ORXROY.js → chunk-SA4DP3SF.js} +1 -1
- package/dist/development/dom-export.js +32 -32
- package/dist/development/dom-export.mjs +3 -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.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.js +90 -90
- 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/production/{chunk-EGOTSXNH.mjs → chunk-3MA7PLKB.mjs} +2 -2
- package/dist/production/{chunk-M7NGGUU6.mjs → chunk-3WDNQUW5.mjs} +2 -2
- package/dist/{development/chunk-WW7PN6QI.js → production/chunk-GOIER6ML.js} +7 -7
- package/dist/production/{chunk-IUPBOWYO.js → chunk-IEF7VMTA.js} +1 -1
- package/dist/production/{chunk-BIP66BKV.js → chunk-WICLSFKL.js} +103 -103
- package/dist/production/dom-export.js +32 -32
- package/dist/production/dom-export.mjs +3 -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.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.js +90 -90
- 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/docs/how-to/status.md +1 -1
- package/docs/upgrading/future.md +222 -12
- package/docs/upgrading/remix.md +2 -2
- 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.18.
|
|
2
|
+
* react-router v7.18.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
var
|
|
56
|
+
var _chunkSA4DP3SFjs = require('./chunk-SA4DP3SF.js');
|
|
57
57
|
|
|
58
58
|
// lib/dom/dom.ts
|
|
59
59
|
var defaultMethod = "get";
|
|
@@ -124,7 +124,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
124
124
|
]);
|
|
125
125
|
function getFormEncType(encType) {
|
|
126
126
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
127
|
-
|
|
127
|
+
_chunkSA4DP3SFjs.warning.call(void 0,
|
|
128
128
|
false,
|
|
129
129
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
130
130
|
);
|
|
@@ -140,7 +140,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
140
140
|
let body;
|
|
141
141
|
if (isFormElement(target)) {
|
|
142
142
|
let attr = target.getAttribute("action");
|
|
143
|
-
action = attr ?
|
|
143
|
+
action = attr ? _chunkSA4DP3SFjs.stripBasename.call(void 0, attr, basename) : null;
|
|
144
144
|
method = target.getAttribute("method") || defaultMethod;
|
|
145
145
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
146
146
|
formData = new FormData(target);
|
|
@@ -152,7 +152,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
154
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
155
|
-
action = attr ?
|
|
155
|
+
action = attr ? _chunkSA4DP3SFjs.stripBasename.call(void 0, attr, basename) : null;
|
|
156
156
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
157
157
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
158
158
|
formData = new FormData(form, target);
|
|
@@ -189,20 +189,20 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
189
189
|
try {
|
|
190
190
|
if (isBrowser) {
|
|
191
191
|
window.__reactRouterVersion = // @ts-expect-error
|
|
192
|
-
"7.18.
|
|
192
|
+
"7.18.1";
|
|
193
193
|
}
|
|
194
194
|
} catch (e) {
|
|
195
195
|
}
|
|
196
196
|
function createBrowserRouter(routes, opts) {
|
|
197
|
-
return
|
|
197
|
+
return _chunkSA4DP3SFjs.createRouter.call(void 0, {
|
|
198
198
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
199
199
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
200
200
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
201
|
-
history:
|
|
201
|
+
history: _chunkSA4DP3SFjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
202
202
|
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
203
203
|
routes,
|
|
204
|
-
mapRouteProperties:
|
|
205
|
-
hydrationRouteProperties:
|
|
204
|
+
mapRouteProperties: _chunkSA4DP3SFjs.mapRouteProperties,
|
|
205
|
+
hydrationRouteProperties: _chunkSA4DP3SFjs.hydrationRouteProperties,
|
|
206
206
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
207
207
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
208
208
|
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
@@ -210,15 +210,15 @@ function createBrowserRouter(routes, opts) {
|
|
|
210
210
|
}).initialize();
|
|
211
211
|
}
|
|
212
212
|
function createHashRouter(routes, opts) {
|
|
213
|
-
return
|
|
213
|
+
return _chunkSA4DP3SFjs.createRouter.call(void 0, {
|
|
214
214
|
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
215
215
|
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
216
216
|
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
217
|
-
history:
|
|
217
|
+
history: _chunkSA4DP3SFjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
218
218
|
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
219
219
|
routes,
|
|
220
|
-
mapRouteProperties:
|
|
221
|
-
hydrationRouteProperties:
|
|
220
|
+
mapRouteProperties: _chunkSA4DP3SFjs.mapRouteProperties,
|
|
221
|
+
hydrationRouteProperties: _chunkSA4DP3SFjs.hydrationRouteProperties,
|
|
222
222
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
223
223
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
224
224
|
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
@@ -241,14 +241,14 @@ function deserializeErrors(errors) {
|
|
|
241
241
|
let serialized = {};
|
|
242
242
|
for (let [key, val] of entries) {
|
|
243
243
|
if (val && val.__type === "RouteErrorResponse") {
|
|
244
|
-
serialized[key] = new (0,
|
|
244
|
+
serialized[key] = new (0, _chunkSA4DP3SFjs.ErrorResponseImpl)(
|
|
245
245
|
val.status,
|
|
246
246
|
val.statusText,
|
|
247
247
|
val.data,
|
|
248
248
|
val.internal === true
|
|
249
249
|
);
|
|
250
250
|
} else if (val && val.__type === "Error") {
|
|
251
|
-
if (typeof val.__subType === "string" &&
|
|
251
|
+
if (typeof val.__subType === "string" && _chunkSA4DP3SFjs.SUPPORTED_ERROR_TYPES.includes(val.__subType)) {
|
|
252
252
|
let ErrorConstructor = window[val.__subType];
|
|
253
253
|
if (typeof ErrorConstructor === "function") {
|
|
254
254
|
try {
|
|
@@ -278,7 +278,7 @@ function BrowserRouter({
|
|
|
278
278
|
}) {
|
|
279
279
|
let historyRef = React.useRef();
|
|
280
280
|
if (historyRef.current == null) {
|
|
281
|
-
historyRef.current =
|
|
281
|
+
historyRef.current = _chunkSA4DP3SFjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
282
282
|
}
|
|
283
283
|
let history = historyRef.current;
|
|
284
284
|
let [state, setStateImpl] = React.useState({
|
|
@@ -297,7 +297,7 @@ function BrowserRouter({
|
|
|
297
297
|
);
|
|
298
298
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
299
299
|
return /* @__PURE__ */ React.createElement(
|
|
300
|
-
|
|
300
|
+
_chunkSA4DP3SFjs.Router,
|
|
301
301
|
{
|
|
302
302
|
basename,
|
|
303
303
|
children,
|
|
@@ -316,7 +316,7 @@ function HashRouter({
|
|
|
316
316
|
}) {
|
|
317
317
|
let historyRef = React.useRef();
|
|
318
318
|
if (historyRef.current == null) {
|
|
319
|
-
historyRef.current =
|
|
319
|
+
historyRef.current = _chunkSA4DP3SFjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
320
320
|
}
|
|
321
321
|
let history = historyRef.current;
|
|
322
322
|
let [state, setStateImpl] = React.useState({
|
|
@@ -335,7 +335,7 @@ function HashRouter({
|
|
|
335
335
|
);
|
|
336
336
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
337
337
|
return /* @__PURE__ */ React.createElement(
|
|
338
|
-
|
|
338
|
+
_chunkSA4DP3SFjs.Router,
|
|
339
339
|
{
|
|
340
340
|
basename,
|
|
341
341
|
children,
|
|
@@ -368,7 +368,7 @@ function HistoryRouter({
|
|
|
368
368
|
);
|
|
369
369
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
370
370
|
return /* @__PURE__ */ React.createElement(
|
|
371
|
-
|
|
371
|
+
_chunkSA4DP3SFjs.Router,
|
|
372
372
|
{
|
|
373
373
|
basename,
|
|
374
374
|
children,
|
|
@@ -397,26 +397,26 @@ var Link = React.forwardRef(
|
|
|
397
397
|
defaultShouldRevalidate,
|
|
398
398
|
...rest
|
|
399
399
|
}, forwardedRef) {
|
|
400
|
-
let { basename, navigator, useTransitions } = React.useContext(
|
|
401
|
-
let isAbsolute = typeof to === "string" &&
|
|
402
|
-
let parsed =
|
|
400
|
+
let { basename, navigator, useTransitions } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
401
|
+
let isAbsolute = typeof to === "string" && _chunkSA4DP3SFjs.ABSOLUTE_URL_REGEX.test(to);
|
|
402
|
+
let parsed = _chunkSA4DP3SFjs.parseToInfo.call(void 0, to, basename);
|
|
403
403
|
to = parsed.to;
|
|
404
|
-
let href =
|
|
405
|
-
let location =
|
|
404
|
+
let href = _chunkSA4DP3SFjs.useHref.call(void 0, to, { relative });
|
|
405
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
406
406
|
let maskedHref = null;
|
|
407
407
|
if (mask) {
|
|
408
|
-
let resolved =
|
|
408
|
+
let resolved = _chunkSA4DP3SFjs.resolveTo.call(void 0,
|
|
409
409
|
mask,
|
|
410
410
|
[],
|
|
411
411
|
location.mask ? location.mask.pathname : "/",
|
|
412
412
|
true
|
|
413
413
|
);
|
|
414
414
|
if (basename !== "/") {
|
|
415
|
-
resolved.pathname = resolved.pathname === "/" ? basename :
|
|
415
|
+
resolved.pathname = resolved.pathname === "/" ? basename : _chunkSA4DP3SFjs.joinPaths.call(void 0, [basename, resolved.pathname]);
|
|
416
416
|
}
|
|
417
417
|
maskedHref = navigator.createHref(resolved);
|
|
418
418
|
}
|
|
419
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
419
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkSA4DP3SFjs.usePrefetchBehavior.call(void 0,
|
|
420
420
|
prefetch,
|
|
421
421
|
rest
|
|
422
422
|
);
|
|
@@ -447,13 +447,13 @@ var Link = React.forwardRef(
|
|
|
447
447
|
...prefetchHandlers,
|
|
448
448
|
href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
|
|
449
449
|
onClick: isSpaLink ? handleClick : onClick,
|
|
450
|
-
ref:
|
|
450
|
+
ref: _chunkSA4DP3SFjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
451
451
|
target,
|
|
452
452
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
453
453
|
}
|
|
454
454
|
)
|
|
455
455
|
);
|
|
456
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
456
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkSA4DP3SFjs.PrefetchPageLinks, { page: href })) : link;
|
|
457
457
|
}
|
|
458
458
|
);
|
|
459
459
|
Link.displayName = "Link";
|
|
@@ -469,10 +469,10 @@ var NavLink = React.forwardRef(
|
|
|
469
469
|
children,
|
|
470
470
|
...rest
|
|
471
471
|
}, ref) {
|
|
472
|
-
let path =
|
|
473
|
-
let location =
|
|
474
|
-
let routerState = React.useContext(
|
|
475
|
-
let { navigator, basename } = React.useContext(
|
|
472
|
+
let path = _chunkSA4DP3SFjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
473
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
474
|
+
let routerState = React.useContext(_chunkSA4DP3SFjs.DataRouterStateContext);
|
|
475
|
+
let { navigator, basename } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
476
476
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
477
477
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
478
478
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -485,7 +485,7 @@ var NavLink = React.forwardRef(
|
|
|
485
485
|
toPathname = toPathname.toLowerCase();
|
|
486
486
|
}
|
|
487
487
|
if (nextLocationPathname && basename) {
|
|
488
|
-
nextLocationPathname =
|
|
488
|
+
nextLocationPathname = _chunkSA4DP3SFjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
489
489
|
}
|
|
490
490
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
491
491
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -541,11 +541,11 @@ var Form = React.forwardRef(
|
|
|
541
541
|
defaultShouldRevalidate,
|
|
542
542
|
...props
|
|
543
543
|
}, forwardedRef) => {
|
|
544
|
-
let { useTransitions } = React.useContext(
|
|
544
|
+
let { useTransitions } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
545
545
|
let submit = useSubmit();
|
|
546
546
|
let formAction = useFormAction(action, { relative });
|
|
547
547
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
548
|
-
let isAbsolute = typeof action === "string" &&
|
|
548
|
+
let isAbsolute = typeof action === "string" && _chunkSA4DP3SFjs.ABSOLUTE_URL_REGEX.test(action);
|
|
549
549
|
let submitHandler = (event) => {
|
|
550
550
|
onSubmit && onSubmit(event);
|
|
551
551
|
if (event.defaultPrevented) return;
|
|
@@ -588,10 +588,10 @@ function ScrollRestoration({
|
|
|
588
588
|
storageKey,
|
|
589
589
|
...props
|
|
590
590
|
}) {
|
|
591
|
-
let remixContext = React.useContext(
|
|
592
|
-
let { basename } = React.useContext(
|
|
593
|
-
let location =
|
|
594
|
-
let matches =
|
|
591
|
+
let remixContext = React.useContext(_chunkSA4DP3SFjs.FrameworkContext);
|
|
592
|
+
let { basename } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
593
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
594
|
+
let matches = _chunkSA4DP3SFjs.useMatches.call(void 0, );
|
|
595
595
|
useScrollRestoration({ getKey, storageKey });
|
|
596
596
|
let ssrKey = React.useMemo(
|
|
597
597
|
() => {
|
|
@@ -636,9 +636,9 @@ function ScrollRestoration({
|
|
|
636
636
|
...props,
|
|
637
637
|
suppressHydrationWarning: true,
|
|
638
638
|
dangerouslySetInnerHTML: {
|
|
639
|
-
__html: `(${restoreScroll})(${
|
|
639
|
+
__html: `(${restoreScroll})(${_chunkSA4DP3SFjs.escapeHtml.call(void 0,
|
|
640
640
|
JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
|
|
641
|
-
)}, ${
|
|
641
|
+
)}, ${_chunkSA4DP3SFjs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
644
|
);
|
|
@@ -648,13 +648,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
648
648
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
649
649
|
}
|
|
650
650
|
function useDataRouterContext(hookName) {
|
|
651
|
-
let ctx = React.useContext(
|
|
652
|
-
|
|
651
|
+
let ctx = React.useContext(_chunkSA4DP3SFjs.DataRouterContext);
|
|
652
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
653
653
|
return ctx;
|
|
654
654
|
}
|
|
655
655
|
function useDataRouterState(hookName) {
|
|
656
|
-
let state = React.useContext(
|
|
657
|
-
|
|
656
|
+
let state = React.useContext(_chunkSA4DP3SFjs.DataRouterStateContext);
|
|
657
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
658
658
|
return state;
|
|
659
659
|
}
|
|
660
660
|
function useLinkClickHandler(to, {
|
|
@@ -668,14 +668,14 @@ function useLinkClickHandler(to, {
|
|
|
668
668
|
defaultShouldRevalidate,
|
|
669
669
|
useTransitions
|
|
670
670
|
} = {}) {
|
|
671
|
-
let navigate =
|
|
672
|
-
let location =
|
|
673
|
-
let path =
|
|
671
|
+
let navigate = _chunkSA4DP3SFjs.useNavigate.call(void 0, );
|
|
672
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
673
|
+
let path = _chunkSA4DP3SFjs.useResolvedPath.call(void 0, to, { relative });
|
|
674
674
|
return React.useCallback(
|
|
675
675
|
(event) => {
|
|
676
676
|
if (shouldProcessLinkClick(event, target)) {
|
|
677
677
|
event.preventDefault();
|
|
678
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
678
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkSA4DP3SFjs.createPath.call(void 0, location) === _chunkSA4DP3SFjs.createPath.call(void 0, path);
|
|
679
679
|
let doNavigate = () => navigate(to, {
|
|
680
680
|
replace,
|
|
681
681
|
mask,
|
|
@@ -710,13 +710,13 @@ function useLinkClickHandler(to, {
|
|
|
710
710
|
);
|
|
711
711
|
}
|
|
712
712
|
function useSearchParams(defaultInit) {
|
|
713
|
-
|
|
713
|
+
_chunkSA4DP3SFjs.warning.call(void 0,
|
|
714
714
|
typeof URLSearchParams !== "undefined",
|
|
715
715
|
`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.`
|
|
716
716
|
);
|
|
717
717
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
718
718
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
719
|
-
let location =
|
|
719
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
720
720
|
let searchParams = React.useMemo(
|
|
721
721
|
() => (
|
|
722
722
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -729,7 +729,7 @@ function useSearchParams(defaultInit) {
|
|
|
729
729
|
),
|
|
730
730
|
[location.search]
|
|
731
731
|
);
|
|
732
|
-
let navigate =
|
|
732
|
+
let navigate = _chunkSA4DP3SFjs.useNavigate.call(void 0, );
|
|
733
733
|
let setSearchParams = React.useCallback(
|
|
734
734
|
(nextInit, navigateOptions) => {
|
|
735
735
|
const newSearchParams = createSearchParams(
|
|
@@ -746,8 +746,8 @@ var fetcherId = 0;
|
|
|
746
746
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
747
747
|
function useSubmit() {
|
|
748
748
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
749
|
-
let { basename } = React.useContext(
|
|
750
|
-
let currentRouteId =
|
|
749
|
+
let { basename } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
750
|
+
let currentRouteId = _chunkSA4DP3SFjs.useRouteId.call(void 0, );
|
|
751
751
|
let routerFetch = router.fetch;
|
|
752
752
|
let routerNavigate = router.navigate;
|
|
753
753
|
return React.useCallback(
|
|
@@ -787,12 +787,12 @@ function useSubmit() {
|
|
|
787
787
|
);
|
|
788
788
|
}
|
|
789
789
|
function useFormAction(action, { relative } = {}) {
|
|
790
|
-
let { basename } = React.useContext(
|
|
791
|
-
let routeContext = React.useContext(
|
|
792
|
-
|
|
790
|
+
let { basename } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
791
|
+
let routeContext = React.useContext(_chunkSA4DP3SFjs.RouteContext);
|
|
792
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
793
793
|
let [match] = routeContext.matches.slice(-1);
|
|
794
|
-
let path = { ...
|
|
795
|
-
let location =
|
|
794
|
+
let path = { ..._chunkSA4DP3SFjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
795
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
796
796
|
if (action == null) {
|
|
797
797
|
path.search = location.search;
|
|
798
798
|
let params = new URLSearchParams(path.search);
|
|
@@ -809,21 +809,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
809
809
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
810
810
|
}
|
|
811
811
|
if (basename !== "/") {
|
|
812
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
812
|
+
path.pathname = path.pathname === "/" ? basename : _chunkSA4DP3SFjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
813
813
|
}
|
|
814
|
-
return
|
|
814
|
+
return _chunkSA4DP3SFjs.createPath.call(void 0, path);
|
|
815
815
|
}
|
|
816
816
|
function useFetcher({
|
|
817
817
|
key
|
|
818
818
|
} = {}) {
|
|
819
819
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
820
820
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
821
|
-
let fetcherData = React.useContext(
|
|
822
|
-
let route = React.useContext(
|
|
821
|
+
let fetcherData = React.useContext(_chunkSA4DP3SFjs.FetchersContext);
|
|
822
|
+
let route = React.useContext(_chunkSA4DP3SFjs.RouteContext);
|
|
823
823
|
let routeId = _optionalChain([route, 'access', _24 => _24.matches, 'access', _25 => _25[route.matches.length - 1], 'optionalAccess', _26 => _26.route, 'access', _27 => _27.id]);
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
824
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
825
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
826
|
+
_chunkSA4DP3SFjs.invariant.call(void 0,
|
|
827
827
|
routeId != null,
|
|
828
828
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
829
829
|
);
|
|
@@ -839,7 +839,7 @@ function useFetcher({
|
|
|
839
839
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
840
840
|
let load = React.useCallback(
|
|
841
841
|
async (href, opts) => {
|
|
842
|
-
|
|
842
|
+
_chunkSA4DP3SFjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
843
843
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
844
844
|
},
|
|
845
845
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -868,7 +868,7 @@ function useFetcher({
|
|
|
868
868
|
FetcherForm2.displayName = "fetcher.Form";
|
|
869
869
|
return FetcherForm2;
|
|
870
870
|
}, [fetcherKey]);
|
|
871
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
871
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkSA4DP3SFjs.IDLE_FETCHER;
|
|
872
872
|
let data = fetcherData.get(fetcherKey);
|
|
873
873
|
let fetcherWithComponents = React.useMemo(
|
|
874
874
|
() => ({
|
|
@@ -902,7 +902,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
902
902
|
key = getKey(
|
|
903
903
|
{
|
|
904
904
|
...location,
|
|
905
|
-
pathname:
|
|
905
|
+
pathname: _chunkSA4DP3SFjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
906
906
|
},
|
|
907
907
|
matches
|
|
908
908
|
);
|
|
@@ -923,10 +923,10 @@ function useScrollRestoration({
|
|
|
923
923
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
924
924
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
925
925
|
);
|
|
926
|
-
let { basename } = React.useContext(
|
|
927
|
-
let location =
|
|
928
|
-
let matches =
|
|
929
|
-
let navigation =
|
|
926
|
+
let { basename } = React.useContext(_chunkSA4DP3SFjs.NavigationContext);
|
|
927
|
+
let location = _chunkSA4DP3SFjs.useLocation.call(void 0, );
|
|
928
|
+
let matches = _chunkSA4DP3SFjs.useMatches.call(void 0, );
|
|
929
|
+
let navigation = _chunkSA4DP3SFjs.useNavigation.call(void 0, );
|
|
930
930
|
React.useEffect(() => {
|
|
931
931
|
window.history.scrollRestoration = "manual";
|
|
932
932
|
return () => {
|
|
@@ -945,7 +945,7 @@ function useScrollRestoration({
|
|
|
945
945
|
JSON.stringify(savedScrollPositions)
|
|
946
946
|
);
|
|
947
947
|
} catch (error) {
|
|
948
|
-
|
|
948
|
+
_chunkSA4DP3SFjs.warning.call(void 0,
|
|
949
949
|
false,
|
|
950
950
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
951
951
|
);
|
|
@@ -992,7 +992,7 @@ function useScrollRestoration({
|
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
} catch (e2) {
|
|
995
|
-
|
|
995
|
+
_chunkSA4DP3SFjs.warning.call(void 0,
|
|
996
996
|
false,
|
|
997
997
|
`"${location.hash.slice(
|
|
998
998
|
1
|
|
@@ -1030,7 +1030,7 @@ function usePrompt({
|
|
|
1030
1030
|
when,
|
|
1031
1031
|
message
|
|
1032
1032
|
}) {
|
|
1033
|
-
let blocker =
|
|
1033
|
+
let blocker = _chunkSA4DP3SFjs.useBlocker.call(void 0, when);
|
|
1034
1034
|
React.useEffect(() => {
|
|
1035
1035
|
if (blocker.state === "blocked") {
|
|
1036
1036
|
let proceed = window.confirm(message);
|
|
@@ -1048,21 +1048,21 @@ function usePrompt({
|
|
|
1048
1048
|
}, [blocker, when]);
|
|
1049
1049
|
}
|
|
1050
1050
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1051
|
-
let vtContext = React.useContext(
|
|
1052
|
-
|
|
1051
|
+
let vtContext = React.useContext(_chunkSA4DP3SFjs.ViewTransitionContext);
|
|
1052
|
+
_chunkSA4DP3SFjs.invariant.call(void 0,
|
|
1053
1053
|
vtContext != null,
|
|
1054
1054
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1055
1055
|
);
|
|
1056
1056
|
let { basename } = useDataRouterContext(
|
|
1057
1057
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1058
1058
|
);
|
|
1059
|
-
let path =
|
|
1059
|
+
let path = _chunkSA4DP3SFjs.useResolvedPath.call(void 0, to, { relative });
|
|
1060
1060
|
if (!vtContext.isTransitioning) {
|
|
1061
1061
|
return false;
|
|
1062
1062
|
}
|
|
1063
|
-
let currentPath =
|
|
1064
|
-
let nextPath =
|
|
1065
|
-
return
|
|
1063
|
+
let currentPath = _chunkSA4DP3SFjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1064
|
+
let nextPath = _chunkSA4DP3SFjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1065
|
+
return _chunkSA4DP3SFjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkSA4DP3SFjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
// lib/dom/server.tsx
|
|
@@ -1073,7 +1073,7 @@ function StaticRouter({
|
|
|
1073
1073
|
location: locationProp = "/"
|
|
1074
1074
|
}) {
|
|
1075
1075
|
if (typeof locationProp === "string") {
|
|
1076
|
-
locationProp =
|
|
1076
|
+
locationProp = _chunkSA4DP3SFjs.parsePath.call(void 0, locationProp);
|
|
1077
1077
|
}
|
|
1078
1078
|
let action = "POP" /* Pop */;
|
|
1079
1079
|
let location = {
|
|
@@ -1086,7 +1086,7 @@ function StaticRouter({
|
|
|
1086
1086
|
};
|
|
1087
1087
|
let staticNavigator = getStatelessNavigator();
|
|
1088
1088
|
return /* @__PURE__ */ React2.createElement(
|
|
1089
|
-
|
|
1089
|
+
_chunkSA4DP3SFjs.Router,
|
|
1090
1090
|
{
|
|
1091
1091
|
basename,
|
|
1092
1092
|
children,
|
|
@@ -1104,7 +1104,7 @@ function StaticRouterProvider({
|
|
|
1104
1104
|
hydrate = true,
|
|
1105
1105
|
nonce
|
|
1106
1106
|
}) {
|
|
1107
|
-
|
|
1107
|
+
_chunkSA4DP3SFjs.invariant.call(void 0,
|
|
1108
1108
|
router && context,
|
|
1109
1109
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1110
1110
|
);
|
|
@@ -1123,12 +1123,12 @@ function StaticRouterProvider({
|
|
|
1123
1123
|
actionData: context.actionData,
|
|
1124
1124
|
errors: serializeErrors(context.errors)
|
|
1125
1125
|
};
|
|
1126
|
-
let json =
|
|
1126
|
+
let json = _chunkSA4DP3SFjs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
|
|
1127
1127
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1128
1128
|
}
|
|
1129
1129
|
let { state } = dataRouterContext.router;
|
|
1130
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1131
|
-
|
|
1130
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkSA4DP3SFjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkSA4DP3SFjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkSA4DP3SFjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkSA4DP3SFjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1131
|
+
_chunkSA4DP3SFjs.Router,
|
|
1132
1132
|
{
|
|
1133
1133
|
basename: dataRouterContext.basename,
|
|
1134
1134
|
location: state.location,
|
|
@@ -1138,7 +1138,7 @@ function StaticRouterProvider({
|
|
|
1138
1138
|
useTransitions: false
|
|
1139
1139
|
},
|
|
1140
1140
|
/* @__PURE__ */ React2.createElement(
|
|
1141
|
-
|
|
1141
|
+
_chunkSA4DP3SFjs.DataRoutes,
|
|
1142
1142
|
{
|
|
1143
1143
|
manifest: router.manifest,
|
|
1144
1144
|
routes: router.routes,
|
|
@@ -1161,7 +1161,7 @@ function serializeErrors(errors) {
|
|
|
1161
1161
|
let entries = Object.entries(errors);
|
|
1162
1162
|
let serialized = {};
|
|
1163
1163
|
for (let [key, val] of entries) {
|
|
1164
|
-
if (
|
|
1164
|
+
if (_chunkSA4DP3SFjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1165
1165
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1166
1166
|
} else if (val instanceof Error) {
|
|
1167
1167
|
serialized[key] = {
|
|
@@ -1211,16 +1211,16 @@ function getStatelessNavigator() {
|
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
1213
|
function createStaticHandler2(routes, opts) {
|
|
1214
|
-
return
|
|
1214
|
+
return _chunkSA4DP3SFjs.createStaticHandler.call(void 0, routes, {
|
|
1215
1215
|
...opts,
|
|
1216
|
-
mapRouteProperties:
|
|
1216
|
+
mapRouteProperties: _chunkSA4DP3SFjs.mapRouteProperties
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
1219
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1220
1220
|
let manifest = {};
|
|
1221
|
-
let dataRoutes =
|
|
1221
|
+
let dataRoutes = _chunkSA4DP3SFjs.convertRoutesToDataRoutes.call(void 0,
|
|
1222
1222
|
routes,
|
|
1223
|
-
|
|
1223
|
+
_chunkSA4DP3SFjs.mapRouteProperties,
|
|
1224
1224
|
void 0,
|
|
1225
1225
|
manifest
|
|
1226
1226
|
);
|
|
@@ -1254,7 +1254,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1254
1254
|
errors: context.errors,
|
|
1255
1255
|
initialized: true,
|
|
1256
1256
|
renderFallback: false,
|
|
1257
|
-
navigation:
|
|
1257
|
+
navigation: _chunkSA4DP3SFjs.IDLE_NAVIGATION,
|
|
1258
1258
|
restoreScrollPosition: null,
|
|
1259
1259
|
preventScrollReset: false,
|
|
1260
1260
|
revalidation: "idle",
|
|
@@ -1295,7 +1295,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1295
1295
|
createHref,
|
|
1296
1296
|
encodeLocation,
|
|
1297
1297
|
getFetcher() {
|
|
1298
|
-
return
|
|
1298
|
+
return _chunkSA4DP3SFjs.IDLE_FETCHER;
|
|
1299
1299
|
},
|
|
1300
1300
|
deleteFetcher() {
|
|
1301
1301
|
throw msg("deleteFetcher");
|
|
@@ -1307,7 +1307,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1307
1307
|
throw msg("dispose");
|
|
1308
1308
|
},
|
|
1309
1309
|
getBlocker() {
|
|
1310
|
-
return
|
|
1310
|
+
return _chunkSA4DP3SFjs.IDLE_BLOCKER;
|
|
1311
1311
|
},
|
|
1312
1312
|
deleteBlocker() {
|
|
1313
1313
|
throw msg("deleteBlocker");
|
|
@@ -1325,12 +1325,12 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1325
1325
|
};
|
|
1326
1326
|
}
|
|
1327
1327
|
function createHref(to) {
|
|
1328
|
-
return typeof to === "string" ? to :
|
|
1328
|
+
return typeof to === "string" ? to : _chunkSA4DP3SFjs.createPath.call(void 0, to);
|
|
1329
1329
|
}
|
|
1330
1330
|
function encodeLocation(to) {
|
|
1331
|
-
let href = typeof to === "string" ? to :
|
|
1331
|
+
let href = typeof to === "string" ? to : _chunkSA4DP3SFjs.createPath.call(void 0, to);
|
|
1332
1332
|
href = href.replace(/ $/, "%20");
|
|
1333
|
-
let encoded =
|
|
1333
|
+
let encoded = _chunkSA4DP3SFjs.ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1334
1334
|
return {
|
|
1335
1335
|
pathname: encoded.pathname,
|
|
1336
1336
|
search: encoded.search,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
withComponentProps,
|
|
56
56
|
withErrorBoundaryProps,
|
|
57
57
|
withHydrateFallbackProps
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-KS7C4IRE.mjs";
|
|
59
59
|
|
|
60
60
|
// lib/dom/ssr/server.tsx
|
|
61
61
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -10307,7 +10307,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
10307
10307
|
try {
|
|
10308
10308
|
if (isBrowser2) {
|
|
10309
10309
|
window.__reactRouterVersion = // @ts-expect-error
|
|
10310
|
-
"7.18.
|
|
10310
|
+
"7.18.1";
|
|
10311
10311
|
}
|
|
10312
10312
|
} catch (e) {
|
|
10313
10313
|
}
|
|
@@ -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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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.18.
|
|
2
|
+
* react-router v7.18.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|