react-router 7.10.0 → 7.10.1-pre.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 +6 -0
- package/dist/development/{chunk-54KWOGSJ.js → chunk-BFZIIKOS.js} +3 -2
- package/dist/{production/chunk-J25F7BL4.js → development/chunk-NUGUL5OD.js} +94 -94
- package/dist/development/{chunk-FGUA77HG.mjs → chunk-SC4UA6B4.mjs} +4 -3
- package/dist/development/{chunk-26EFLBGX.js → chunk-VPK5G3S4.js} +7 -7
- package/dist/development/{chunk-INCZGKXY.mjs → chunk-X3LLUSK4.mjs} +2 -2
- package/dist/development/dom-export.js +27 -27
- 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 +76 -76
- 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-SKXBY33F.js → chunk-322RSYEJ.js} +3 -2
- package/dist/production/{chunk-EKXDIDQN.js → chunk-3WZYQEC5.js} +7 -7
- package/dist/{development/chunk-AWUYHSQU.js → production/chunk-7NETFFGG.js} +94 -94
- package/dist/production/{chunk-RNH4J7KQ.mjs → chunk-FI4GMOFC.mjs} +4 -3
- package/dist/production/{chunk-MFC2CGJA.mjs → chunk-KT4GS4WF.mjs} +2 -2
- package/dist/production/dom-export.js +27 -27
- 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 +76 -76
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.10.1-pre.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Use a stable useOptimistic setter stub in React 18 ([`d04cbbc1b`](https://github.com/remix-run/react-router/commit/d04cbbc1b67eec0e50fd598cbf171261506c8f80))
|
|
8
|
+
|
|
3
9
|
## 7.10.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -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.10.0
|
|
2
|
+
* react-router v7.10.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8649,11 +8649,12 @@ function BoundaryShell({
|
|
|
8649
8649
|
|
|
8650
8650
|
var USE_OPTIMISTIC = "useOptimistic";
|
|
8651
8651
|
var useOptimisticImpl = React9[USE_OPTIMISTIC];
|
|
8652
|
+
var stableUseOptimisticSetter = () => void 0;
|
|
8652
8653
|
function useOptimisticSafe(val) {
|
|
8653
8654
|
if (useOptimisticImpl) {
|
|
8654
8655
|
return useOptimisticImpl(val);
|
|
8655
8656
|
} else {
|
|
8656
|
-
return [val,
|
|
8657
|
+
return [val, stableUseOptimisticSetter];
|
|
8657
8658
|
}
|
|
8658
8659
|
}
|
|
8659
8660
|
function mapRouteProperties(route) {
|
|
@@ -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.10.0
|
|
2
|
+
* react-router v7.10.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkBFZIIKOSjs = require('./chunk-BFZIIKOS.js');
|
|
52
52
|
|
|
53
53
|
// lib/dom/dom.ts
|
|
54
54
|
var defaultMethod = "get";
|
|
@@ -119,7 +119,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
119
119
|
]);
|
|
120
120
|
function getFormEncType(encType) {
|
|
121
121
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
122
|
-
|
|
122
|
+
_chunkBFZIIKOSjs.warning.call(void 0,
|
|
123
123
|
false,
|
|
124
124
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
125
125
|
);
|
|
@@ -135,7 +135,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
135
135
|
let body;
|
|
136
136
|
if (isFormElement(target)) {
|
|
137
137
|
let attr = target.getAttribute("action");
|
|
138
|
-
action = attr ?
|
|
138
|
+
action = attr ? _chunkBFZIIKOSjs.stripBasename.call(void 0, attr, basename) : null;
|
|
139
139
|
method = target.getAttribute("method") || defaultMethod;
|
|
140
140
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
141
141
|
formData = new FormData(target);
|
|
@@ -147,7 +147,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
150
|
-
action = attr ?
|
|
150
|
+
action = attr ? _chunkBFZIIKOSjs.stripBasename.call(void 0, attr, basename) : null;
|
|
151
151
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
152
152
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
153
153
|
formData = new FormData(form, target);
|
|
@@ -184,20 +184,20 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
184
184
|
try {
|
|
185
185
|
if (isBrowser) {
|
|
186
186
|
window.__reactRouterVersion = // @ts-expect-error
|
|
187
|
-
"7.10.0";
|
|
187
|
+
"7.10.1-pre.0";
|
|
188
188
|
}
|
|
189
189
|
} catch (e) {
|
|
190
190
|
}
|
|
191
191
|
function createBrowserRouter(routes, opts) {
|
|
192
|
-
return
|
|
192
|
+
return _chunkBFZIIKOSjs.createRouter.call(void 0, {
|
|
193
193
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
194
194
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
195
195
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
196
|
-
history:
|
|
196
|
+
history: _chunkBFZIIKOSjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
197
197
|
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
198
198
|
routes,
|
|
199
|
-
mapRouteProperties:
|
|
200
|
-
hydrationRouteProperties:
|
|
199
|
+
mapRouteProperties: _chunkBFZIIKOSjs.mapRouteProperties,
|
|
200
|
+
hydrationRouteProperties: _chunkBFZIIKOSjs.hydrationRouteProperties,
|
|
201
201
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
202
202
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
203
203
|
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
@@ -205,15 +205,15 @@ function createBrowserRouter(routes, opts) {
|
|
|
205
205
|
}).initialize();
|
|
206
206
|
}
|
|
207
207
|
function createHashRouter(routes, opts) {
|
|
208
|
-
return
|
|
208
|
+
return _chunkBFZIIKOSjs.createRouter.call(void 0, {
|
|
209
209
|
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
210
210
|
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
211
211
|
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
212
|
-
history:
|
|
212
|
+
history: _chunkBFZIIKOSjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
213
213
|
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
214
214
|
routes,
|
|
215
|
-
mapRouteProperties:
|
|
216
|
-
hydrationRouteProperties:
|
|
215
|
+
mapRouteProperties: _chunkBFZIIKOSjs.mapRouteProperties,
|
|
216
|
+
hydrationRouteProperties: _chunkBFZIIKOSjs.hydrationRouteProperties,
|
|
217
217
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
218
218
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
219
219
|
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
@@ -236,7 +236,7 @@ function deserializeErrors(errors) {
|
|
|
236
236
|
let serialized = {};
|
|
237
237
|
for (let [key, val] of entries) {
|
|
238
238
|
if (val && val.__type === "RouteErrorResponse") {
|
|
239
|
-
serialized[key] = new (0,
|
|
239
|
+
serialized[key] = new (0, _chunkBFZIIKOSjs.ErrorResponseImpl)(
|
|
240
240
|
val.status,
|
|
241
241
|
val.statusText,
|
|
242
242
|
val.data,
|
|
@@ -273,7 +273,7 @@ function BrowserRouter({
|
|
|
273
273
|
}) {
|
|
274
274
|
let historyRef = React.useRef();
|
|
275
275
|
if (historyRef.current == null) {
|
|
276
|
-
historyRef.current =
|
|
276
|
+
historyRef.current = _chunkBFZIIKOSjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
277
277
|
}
|
|
278
278
|
let history = historyRef.current;
|
|
279
279
|
let [state, setStateImpl] = React.useState({
|
|
@@ -292,7 +292,7 @@ function BrowserRouter({
|
|
|
292
292
|
);
|
|
293
293
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
294
294
|
return /* @__PURE__ */ React.createElement(
|
|
295
|
-
|
|
295
|
+
_chunkBFZIIKOSjs.Router,
|
|
296
296
|
{
|
|
297
297
|
basename,
|
|
298
298
|
children,
|
|
@@ -311,7 +311,7 @@ function HashRouter({
|
|
|
311
311
|
}) {
|
|
312
312
|
let historyRef = React.useRef();
|
|
313
313
|
if (historyRef.current == null) {
|
|
314
|
-
historyRef.current =
|
|
314
|
+
historyRef.current = _chunkBFZIIKOSjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
315
315
|
}
|
|
316
316
|
let history = historyRef.current;
|
|
317
317
|
let [state, setStateImpl] = React.useState({
|
|
@@ -330,7 +330,7 @@ function HashRouter({
|
|
|
330
330
|
);
|
|
331
331
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
332
332
|
return /* @__PURE__ */ React.createElement(
|
|
333
|
-
|
|
333
|
+
_chunkBFZIIKOSjs.Router,
|
|
334
334
|
{
|
|
335
335
|
basename,
|
|
336
336
|
children,
|
|
@@ -363,7 +363,7 @@ function HistoryRouter({
|
|
|
363
363
|
);
|
|
364
364
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
365
365
|
return /* @__PURE__ */ React.createElement(
|
|
366
|
-
|
|
366
|
+
_chunkBFZIIKOSjs.Router,
|
|
367
367
|
{
|
|
368
368
|
basename,
|
|
369
369
|
children,
|
|
@@ -391,7 +391,7 @@ var Link = React.forwardRef(
|
|
|
391
391
|
viewTransition,
|
|
392
392
|
...rest
|
|
393
393
|
}, forwardedRef) {
|
|
394
|
-
let { basename, unstable_useTransitions } = React.useContext(
|
|
394
|
+
let { basename, unstable_useTransitions } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
395
395
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
396
396
|
let absoluteHref;
|
|
397
397
|
let isExternal = false;
|
|
@@ -401,22 +401,22 @@ var Link = React.forwardRef(
|
|
|
401
401
|
try {
|
|
402
402
|
let currentUrl = new URL(window.location.href);
|
|
403
403
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
404
|
-
let path =
|
|
404
|
+
let path = _chunkBFZIIKOSjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
405
405
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
406
406
|
to = path + targetUrl.search + targetUrl.hash;
|
|
407
407
|
} else {
|
|
408
408
|
isExternal = true;
|
|
409
409
|
}
|
|
410
410
|
} catch (e) {
|
|
411
|
-
|
|
411
|
+
_chunkBFZIIKOSjs.warning.call(void 0,
|
|
412
412
|
false,
|
|
413
413
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
414
414
|
);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
let href =
|
|
419
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
418
|
+
let href = _chunkBFZIIKOSjs.useHref.call(void 0, to, { relative });
|
|
419
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkBFZIIKOSjs.usePrefetchBehavior.call(void 0,
|
|
420
420
|
prefetch,
|
|
421
421
|
rest
|
|
422
422
|
);
|
|
@@ -444,13 +444,13 @@ var Link = React.forwardRef(
|
|
|
444
444
|
...prefetchHandlers,
|
|
445
445
|
href: absoluteHref || href,
|
|
446
446
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
447
|
-
ref:
|
|
447
|
+
ref: _chunkBFZIIKOSjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
448
448
|
target,
|
|
449
449
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
450
450
|
}
|
|
451
451
|
)
|
|
452
452
|
);
|
|
453
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
453
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkBFZIIKOSjs.PrefetchPageLinks, { page: href })) : link;
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
Link.displayName = "Link";
|
|
@@ -466,10 +466,10 @@ var NavLink = React.forwardRef(
|
|
|
466
466
|
children,
|
|
467
467
|
...rest
|
|
468
468
|
}, ref) {
|
|
469
|
-
let path =
|
|
470
|
-
let location =
|
|
471
|
-
let routerState = React.useContext(
|
|
472
|
-
let { navigator, basename } = React.useContext(
|
|
469
|
+
let path = _chunkBFZIIKOSjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
470
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
471
|
+
let routerState = React.useContext(_chunkBFZIIKOSjs.DataRouterStateContext);
|
|
472
|
+
let { navigator, basename } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
473
473
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
474
474
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
475
475
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -482,7 +482,7 @@ var NavLink = React.forwardRef(
|
|
|
482
482
|
toPathname = toPathname.toLowerCase();
|
|
483
483
|
}
|
|
484
484
|
if (nextLocationPathname && basename) {
|
|
485
|
-
nextLocationPathname =
|
|
485
|
+
nextLocationPathname = _chunkBFZIIKOSjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
486
486
|
}
|
|
487
487
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
488
488
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -537,7 +537,7 @@ var Form = React.forwardRef(
|
|
|
537
537
|
viewTransition,
|
|
538
538
|
...props
|
|
539
539
|
}, forwardedRef) => {
|
|
540
|
-
let { unstable_useTransitions } = React.useContext(
|
|
540
|
+
let { unstable_useTransitions } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
541
541
|
let submit = useSubmit();
|
|
542
542
|
let formAction = useFormAction(action, { relative });
|
|
543
543
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -583,10 +583,10 @@ function ScrollRestoration({
|
|
|
583
583
|
storageKey,
|
|
584
584
|
...props
|
|
585
585
|
}) {
|
|
586
|
-
let remixContext = React.useContext(
|
|
587
|
-
let { basename } = React.useContext(
|
|
588
|
-
let location =
|
|
589
|
-
let matches =
|
|
586
|
+
let remixContext = React.useContext(_chunkBFZIIKOSjs.FrameworkContext);
|
|
587
|
+
let { basename } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
588
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
589
|
+
let matches = _chunkBFZIIKOSjs.useMatches.call(void 0, );
|
|
590
590
|
useScrollRestoration({ getKey, storageKey });
|
|
591
591
|
let ssrKey = React.useMemo(
|
|
592
592
|
() => {
|
|
@@ -640,13 +640,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
640
640
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
641
641
|
}
|
|
642
642
|
function useDataRouterContext(hookName) {
|
|
643
|
-
let ctx = React.useContext(
|
|
644
|
-
|
|
643
|
+
let ctx = React.useContext(_chunkBFZIIKOSjs.DataRouterContext);
|
|
644
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
645
645
|
return ctx;
|
|
646
646
|
}
|
|
647
647
|
function useDataRouterState(hookName) {
|
|
648
|
-
let state = React.useContext(
|
|
649
|
-
|
|
648
|
+
let state = React.useContext(_chunkBFZIIKOSjs.DataRouterStateContext);
|
|
649
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
650
650
|
return state;
|
|
651
651
|
}
|
|
652
652
|
function useLinkClickHandler(to, {
|
|
@@ -658,14 +658,14 @@ function useLinkClickHandler(to, {
|
|
|
658
658
|
viewTransition,
|
|
659
659
|
unstable_useTransitions
|
|
660
660
|
} = {}) {
|
|
661
|
-
let navigate =
|
|
662
|
-
let location =
|
|
663
|
-
let path =
|
|
661
|
+
let navigate = _chunkBFZIIKOSjs.useNavigate.call(void 0, );
|
|
662
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
663
|
+
let path = _chunkBFZIIKOSjs.useResolvedPath.call(void 0, to, { relative });
|
|
664
664
|
return React.useCallback(
|
|
665
665
|
(event) => {
|
|
666
666
|
if (shouldProcessLinkClick(event, target)) {
|
|
667
667
|
event.preventDefault();
|
|
668
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
668
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkBFZIIKOSjs.createPath.call(void 0, location) === _chunkBFZIIKOSjs.createPath.call(void 0, path);
|
|
669
669
|
let doNavigate = () => navigate(to, {
|
|
670
670
|
replace,
|
|
671
671
|
state,
|
|
@@ -696,13 +696,13 @@ function useLinkClickHandler(to, {
|
|
|
696
696
|
);
|
|
697
697
|
}
|
|
698
698
|
function useSearchParams(defaultInit) {
|
|
699
|
-
|
|
699
|
+
_chunkBFZIIKOSjs.warning.call(void 0,
|
|
700
700
|
typeof URLSearchParams !== "undefined",
|
|
701
701
|
`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.`
|
|
702
702
|
);
|
|
703
703
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
704
704
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
705
|
-
let location =
|
|
705
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
706
706
|
let searchParams = React.useMemo(
|
|
707
707
|
() => (
|
|
708
708
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -715,7 +715,7 @@ function useSearchParams(defaultInit) {
|
|
|
715
715
|
),
|
|
716
716
|
[location.search]
|
|
717
717
|
);
|
|
718
|
-
let navigate =
|
|
718
|
+
let navigate = _chunkBFZIIKOSjs.useNavigate.call(void 0, );
|
|
719
719
|
let setSearchParams = React.useCallback(
|
|
720
720
|
(nextInit, navigateOptions) => {
|
|
721
721
|
const newSearchParams = createSearchParams(
|
|
@@ -732,8 +732,8 @@ var fetcherId = 0;
|
|
|
732
732
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
733
733
|
function useSubmit() {
|
|
734
734
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
735
|
-
let { basename } = React.useContext(
|
|
736
|
-
let currentRouteId =
|
|
735
|
+
let { basename } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
736
|
+
let currentRouteId = _chunkBFZIIKOSjs.useRouteId.call(void 0, );
|
|
737
737
|
let routerFetch = router.fetch;
|
|
738
738
|
let routerNavigate = router.navigate;
|
|
739
739
|
return React.useCallback(
|
|
@@ -771,12 +771,12 @@ function useSubmit() {
|
|
|
771
771
|
);
|
|
772
772
|
}
|
|
773
773
|
function useFormAction(action, { relative } = {}) {
|
|
774
|
-
let { basename } = React.useContext(
|
|
775
|
-
let routeContext = React.useContext(
|
|
776
|
-
|
|
774
|
+
let { basename } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
775
|
+
let routeContext = React.useContext(_chunkBFZIIKOSjs.RouteContext);
|
|
776
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
777
777
|
let [match] = routeContext.matches.slice(-1);
|
|
778
|
-
let path = { ...
|
|
779
|
-
let location =
|
|
778
|
+
let path = { ..._chunkBFZIIKOSjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
779
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
780
780
|
if (action == null) {
|
|
781
781
|
path.search = location.search;
|
|
782
782
|
let params = new URLSearchParams(path.search);
|
|
@@ -793,21 +793,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
793
793
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
794
794
|
}
|
|
795
795
|
if (basename !== "/") {
|
|
796
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
796
|
+
path.pathname = path.pathname === "/" ? basename : _chunkBFZIIKOSjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
797
797
|
}
|
|
798
|
-
return
|
|
798
|
+
return _chunkBFZIIKOSjs.createPath.call(void 0, path);
|
|
799
799
|
}
|
|
800
800
|
function useFetcher({
|
|
801
801
|
key
|
|
802
802
|
} = {}) {
|
|
803
803
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
804
804
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
805
|
-
let fetcherData = React.useContext(
|
|
806
|
-
let route = React.useContext(
|
|
805
|
+
let fetcherData = React.useContext(_chunkBFZIIKOSjs.FetchersContext);
|
|
806
|
+
let route = React.useContext(_chunkBFZIIKOSjs.RouteContext);
|
|
807
807
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
808
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
809
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
810
|
+
_chunkBFZIIKOSjs.invariant.call(void 0,
|
|
811
811
|
routeId != null,
|
|
812
812
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
813
813
|
);
|
|
@@ -823,7 +823,7 @@ function useFetcher({
|
|
|
823
823
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
824
824
|
let load = React.useCallback(
|
|
825
825
|
async (href, opts) => {
|
|
826
|
-
|
|
826
|
+
_chunkBFZIIKOSjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
827
827
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
828
828
|
},
|
|
829
829
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -852,7 +852,7 @@ function useFetcher({
|
|
|
852
852
|
FetcherForm2.displayName = "fetcher.Form";
|
|
853
853
|
return FetcherForm2;
|
|
854
854
|
}, [fetcherKey]);
|
|
855
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
855
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkBFZIIKOSjs.IDLE_FETCHER;
|
|
856
856
|
let data = fetcherData.get(fetcherKey);
|
|
857
857
|
let fetcherWithComponents = React.useMemo(
|
|
858
858
|
() => ({
|
|
@@ -883,7 +883,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
883
883
|
key = getKey(
|
|
884
884
|
{
|
|
885
885
|
...location,
|
|
886
|
-
pathname:
|
|
886
|
+
pathname: _chunkBFZIIKOSjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
887
887
|
},
|
|
888
888
|
matches
|
|
889
889
|
);
|
|
@@ -904,10 +904,10 @@ function useScrollRestoration({
|
|
|
904
904
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
905
905
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
906
906
|
);
|
|
907
|
-
let { basename } = React.useContext(
|
|
908
|
-
let location =
|
|
909
|
-
let matches =
|
|
910
|
-
let navigation =
|
|
907
|
+
let { basename } = React.useContext(_chunkBFZIIKOSjs.NavigationContext);
|
|
908
|
+
let location = _chunkBFZIIKOSjs.useLocation.call(void 0, );
|
|
909
|
+
let matches = _chunkBFZIIKOSjs.useMatches.call(void 0, );
|
|
910
|
+
let navigation = _chunkBFZIIKOSjs.useNavigation.call(void 0, );
|
|
911
911
|
React.useEffect(() => {
|
|
912
912
|
window.history.scrollRestoration = "manual";
|
|
913
913
|
return () => {
|
|
@@ -926,7 +926,7 @@ function useScrollRestoration({
|
|
|
926
926
|
JSON.stringify(savedScrollPositions)
|
|
927
927
|
);
|
|
928
928
|
} catch (error) {
|
|
929
|
-
|
|
929
|
+
_chunkBFZIIKOSjs.warning.call(void 0,
|
|
930
930
|
false,
|
|
931
931
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
932
932
|
);
|
|
@@ -973,7 +973,7 @@ function useScrollRestoration({
|
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
975
|
} catch (e2) {
|
|
976
|
-
|
|
976
|
+
_chunkBFZIIKOSjs.warning.call(void 0,
|
|
977
977
|
false,
|
|
978
978
|
`"${location.hash.slice(
|
|
979
979
|
1
|
|
@@ -1011,7 +1011,7 @@ function usePrompt({
|
|
|
1011
1011
|
when,
|
|
1012
1012
|
message
|
|
1013
1013
|
}) {
|
|
1014
|
-
let blocker =
|
|
1014
|
+
let blocker = _chunkBFZIIKOSjs.useBlocker.call(void 0, when);
|
|
1015
1015
|
React.useEffect(() => {
|
|
1016
1016
|
if (blocker.state === "blocked") {
|
|
1017
1017
|
let proceed = window.confirm(message);
|
|
@@ -1029,21 +1029,21 @@ function usePrompt({
|
|
|
1029
1029
|
}, [blocker, when]);
|
|
1030
1030
|
}
|
|
1031
1031
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1032
|
-
let vtContext = React.useContext(
|
|
1033
|
-
|
|
1032
|
+
let vtContext = React.useContext(_chunkBFZIIKOSjs.ViewTransitionContext);
|
|
1033
|
+
_chunkBFZIIKOSjs.invariant.call(void 0,
|
|
1034
1034
|
vtContext != null,
|
|
1035
1035
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1036
1036
|
);
|
|
1037
1037
|
let { basename } = useDataRouterContext(
|
|
1038
1038
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1039
1039
|
);
|
|
1040
|
-
let path =
|
|
1040
|
+
let path = _chunkBFZIIKOSjs.useResolvedPath.call(void 0, to, { relative });
|
|
1041
1041
|
if (!vtContext.isTransitioning) {
|
|
1042
1042
|
return false;
|
|
1043
1043
|
}
|
|
1044
|
-
let currentPath =
|
|
1045
|
-
let nextPath =
|
|
1046
|
-
return
|
|
1044
|
+
let currentPath = _chunkBFZIIKOSjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1045
|
+
let nextPath = _chunkBFZIIKOSjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1046
|
+
return _chunkBFZIIKOSjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkBFZIIKOSjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
1049
|
// lib/dom/server.tsx
|
|
@@ -1054,7 +1054,7 @@ function StaticRouter({
|
|
|
1054
1054
|
location: locationProp = "/"
|
|
1055
1055
|
}) {
|
|
1056
1056
|
if (typeof locationProp === "string") {
|
|
1057
|
-
locationProp =
|
|
1057
|
+
locationProp = _chunkBFZIIKOSjs.parsePath.call(void 0, locationProp);
|
|
1058
1058
|
}
|
|
1059
1059
|
let action = "POP" /* Pop */;
|
|
1060
1060
|
let location = {
|
|
@@ -1066,7 +1066,7 @@ function StaticRouter({
|
|
|
1066
1066
|
};
|
|
1067
1067
|
let staticNavigator = getStatelessNavigator();
|
|
1068
1068
|
return /* @__PURE__ */ React2.createElement(
|
|
1069
|
-
|
|
1069
|
+
_chunkBFZIIKOSjs.Router,
|
|
1070
1070
|
{
|
|
1071
1071
|
basename,
|
|
1072
1072
|
children,
|
|
@@ -1084,7 +1084,7 @@ function StaticRouterProvider({
|
|
|
1084
1084
|
hydrate = true,
|
|
1085
1085
|
nonce
|
|
1086
1086
|
}) {
|
|
1087
|
-
|
|
1087
|
+
_chunkBFZIIKOSjs.invariant.call(void 0,
|
|
1088
1088
|
router && context,
|
|
1089
1089
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1090
1090
|
);
|
|
@@ -1107,8 +1107,8 @@ function StaticRouterProvider({
|
|
|
1107
1107
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1108
1108
|
}
|
|
1109
1109
|
let { state } = dataRouterContext.router;
|
|
1110
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1111
|
-
|
|
1110
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkBFZIIKOSjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkBFZIIKOSjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkBFZIIKOSjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkBFZIIKOSjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1111
|
+
_chunkBFZIIKOSjs.Router,
|
|
1112
1112
|
{
|
|
1113
1113
|
basename: dataRouterContext.basename,
|
|
1114
1114
|
location: state.location,
|
|
@@ -1139,14 +1139,14 @@ function DataRoutes({
|
|
|
1139
1139
|
future,
|
|
1140
1140
|
state
|
|
1141
1141
|
}) {
|
|
1142
|
-
return
|
|
1142
|
+
return _chunkBFZIIKOSjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1143
1143
|
}
|
|
1144
1144
|
function serializeErrors(errors) {
|
|
1145
1145
|
if (!errors) return null;
|
|
1146
1146
|
let entries = Object.entries(errors);
|
|
1147
1147
|
let serialized = {};
|
|
1148
1148
|
for (let [key, val] of entries) {
|
|
1149
|
-
if (
|
|
1149
|
+
if (_chunkBFZIIKOSjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1150
1150
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1151
1151
|
} else if (val instanceof Error) {
|
|
1152
1152
|
serialized[key] = {
|
|
@@ -1196,16 +1196,16 @@ function getStatelessNavigator() {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
}
|
|
1198
1198
|
function createStaticHandler2(routes, opts) {
|
|
1199
|
-
return
|
|
1199
|
+
return _chunkBFZIIKOSjs.createStaticHandler.call(void 0, routes, {
|
|
1200
1200
|
...opts,
|
|
1201
|
-
mapRouteProperties:
|
|
1201
|
+
mapRouteProperties: _chunkBFZIIKOSjs.mapRouteProperties
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
1204
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1205
1205
|
let manifest = {};
|
|
1206
|
-
let dataRoutes =
|
|
1206
|
+
let dataRoutes = _chunkBFZIIKOSjs.convertRoutesToDataRoutes.call(void 0,
|
|
1207
1207
|
routes,
|
|
1208
|
-
|
|
1208
|
+
_chunkBFZIIKOSjs.mapRouteProperties,
|
|
1209
1209
|
void 0,
|
|
1210
1210
|
manifest
|
|
1211
1211
|
);
|
|
@@ -1236,7 +1236,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1236
1236
|
actionData: context.actionData,
|
|
1237
1237
|
errors: context.errors,
|
|
1238
1238
|
initialized: true,
|
|
1239
|
-
navigation:
|
|
1239
|
+
navigation: _chunkBFZIIKOSjs.IDLE_NAVIGATION,
|
|
1240
1240
|
restoreScrollPosition: null,
|
|
1241
1241
|
preventScrollReset: false,
|
|
1242
1242
|
revalidation: "idle",
|
|
@@ -1271,7 +1271,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1271
1271
|
createHref,
|
|
1272
1272
|
encodeLocation,
|
|
1273
1273
|
getFetcher() {
|
|
1274
|
-
return
|
|
1274
|
+
return _chunkBFZIIKOSjs.IDLE_FETCHER;
|
|
1275
1275
|
},
|
|
1276
1276
|
deleteFetcher() {
|
|
1277
1277
|
throw msg("deleteFetcher");
|
|
@@ -1283,7 +1283,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1283
1283
|
throw msg("dispose");
|
|
1284
1284
|
},
|
|
1285
1285
|
getBlocker() {
|
|
1286
|
-
return
|
|
1286
|
+
return _chunkBFZIIKOSjs.IDLE_BLOCKER;
|
|
1287
1287
|
},
|
|
1288
1288
|
deleteBlocker() {
|
|
1289
1289
|
throw msg("deleteBlocker");
|
|
@@ -1301,10 +1301,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1301
1301
|
};
|
|
1302
1302
|
}
|
|
1303
1303
|
function createHref(to) {
|
|
1304
|
-
return typeof to === "string" ? to :
|
|
1304
|
+
return typeof to === "string" ? to : _chunkBFZIIKOSjs.createPath.call(void 0, to);
|
|
1305
1305
|
}
|
|
1306
1306
|
function encodeLocation(to) {
|
|
1307
|
-
let href = typeof to === "string" ? to :
|
|
1307
|
+
let href = typeof to === "string" ? to : _chunkBFZIIKOSjs.createPath.call(void 0, to);
|
|
1308
1308
|
href = href.replace(/ $/, "%20");
|
|
1309
1309
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1310
1310
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.10.0
|
|
2
|
+
* react-router v7.10.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -5987,11 +5987,12 @@ function warnOnce(condition, message) {
|
|
|
5987
5987
|
// lib/components.tsx
|
|
5988
5988
|
var USE_OPTIMISTIC = "useOptimistic";
|
|
5989
5989
|
var useOptimisticImpl = React3[USE_OPTIMISTIC];
|
|
5990
|
+
var stableUseOptimisticSetter = () => void 0;
|
|
5990
5991
|
function useOptimisticSafe(val) {
|
|
5991
5992
|
if (useOptimisticImpl) {
|
|
5992
5993
|
return useOptimisticImpl(val);
|
|
5993
5994
|
} else {
|
|
5994
|
-
return [val,
|
|
5995
|
+
return [val, stableUseOptimisticSetter];
|
|
5995
5996
|
}
|
|
5996
5997
|
}
|
|
5997
5998
|
function mapRouteProperties(route) {
|
|
@@ -9482,7 +9483,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
9482
9483
|
try {
|
|
9483
9484
|
if (isBrowser) {
|
|
9484
9485
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9485
|
-
"7.10.0";
|
|
9486
|
+
"7.10.1-pre.0";
|
|
9486
9487
|
}
|
|
9487
9488
|
} catch (e) {
|
|
9488
9489
|
}
|