react-router 7.9.6-pre.0 → 7.9.6-pre.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/development/{chunk-TUTX3ERH.js → chunk-CYHICRRW.js} +25 -4
- package/dist/development/{chunk-7TW6LJC6.mjs → chunk-DKSAHU2I.mjs} +26 -5
- package/dist/{production/chunk-ZHTTD7UY.js → development/chunk-HSVNPM3C.js} +93 -93
- package/dist/{production/chunk-MKF3AQDO.js → development/chunk-OLIKX45O.js} +7 -7
- package/dist/{production/chunk-4MBU4DF6.mjs → development/chunk-RGKEVI2W.mjs} +2 -2
- package/dist/development/dom-export.js +26 -26
- 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 +25 -4
- package/dist/development/index-react-server.mjs +25 -4
- 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-RBZEEJIK.js → chunk-2DNJUQK6.js} +25 -4
- package/dist/{development/chunk-IR7LYQCC.js → production/chunk-EDK3MRM6.js} +93 -93
- package/dist/{development/chunk-DB25NZIA.js → production/chunk-JLDESRHY.js} +7 -7
- package/dist/{development/chunk-P6ZEAD4C.mjs → production/chunk-LC2OWLJG.mjs} +2 -2
- package/dist/production/{chunk-GG2LAVOQ.mjs → chunk-LESYMMDQ.mjs} +26 -5
- package/dist/production/dom-export.js +26 -26
- 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 +25 -4
- package/dist/production/index-react-server.mjs +25 -4
- 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
|
@@ -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.9.6-pre.
|
|
2
|
+
* react-router v7.9.6-pre.1
|
|
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 _chunkCYHICRRWjs = require('./chunk-CYHICRRW.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
|
+
_chunkCYHICRRWjs.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 ? _chunkCYHICRRWjs.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 ? _chunkCYHICRRWjs.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.9.6-pre.
|
|
187
|
+
"7.9.6-pre.1";
|
|
188
188
|
}
|
|
189
189
|
} catch (e) {
|
|
190
190
|
}
|
|
191
191
|
function createBrowserRouter(routes, opts) {
|
|
192
|
-
return
|
|
192
|
+
return _chunkCYHICRRWjs.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: _chunkCYHICRRWjs.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: _chunkCYHICRRWjs.mapRouteProperties,
|
|
200
|
+
hydrationRouteProperties: _chunkCYHICRRWjs.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 _chunkCYHICRRWjs.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: _chunkCYHICRRWjs.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: _chunkCYHICRRWjs.mapRouteProperties,
|
|
216
|
+
hydrationRouteProperties: _chunkCYHICRRWjs.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, _chunkCYHICRRWjs.ErrorResponseImpl)(
|
|
240
240
|
val.status,
|
|
241
241
|
val.statusText,
|
|
242
242
|
val.data,
|
|
@@ -272,7 +272,7 @@ function BrowserRouter({
|
|
|
272
272
|
}) {
|
|
273
273
|
let historyRef = React.useRef();
|
|
274
274
|
if (historyRef.current == null) {
|
|
275
|
-
historyRef.current =
|
|
275
|
+
historyRef.current = _chunkCYHICRRWjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
276
276
|
}
|
|
277
277
|
let history = historyRef.current;
|
|
278
278
|
let [state, setStateImpl] = React.useState({
|
|
@@ -287,7 +287,7 @@ function BrowserRouter({
|
|
|
287
287
|
);
|
|
288
288
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
289
289
|
return /* @__PURE__ */ React.createElement(
|
|
290
|
-
|
|
290
|
+
_chunkCYHICRRWjs.Router,
|
|
291
291
|
{
|
|
292
292
|
basename,
|
|
293
293
|
children,
|
|
@@ -300,7 +300,7 @@ function BrowserRouter({
|
|
|
300
300
|
function HashRouter({ basename, children, window: window2 }) {
|
|
301
301
|
let historyRef = React.useRef();
|
|
302
302
|
if (historyRef.current == null) {
|
|
303
|
-
historyRef.current =
|
|
303
|
+
historyRef.current = _chunkCYHICRRWjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
304
304
|
}
|
|
305
305
|
let history = historyRef.current;
|
|
306
306
|
let [state, setStateImpl] = React.useState({
|
|
@@ -315,7 +315,7 @@ function HashRouter({ basename, children, window: window2 }) {
|
|
|
315
315
|
);
|
|
316
316
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
317
317
|
return /* @__PURE__ */ React.createElement(
|
|
318
|
-
|
|
318
|
+
_chunkCYHICRRWjs.Router,
|
|
319
319
|
{
|
|
320
320
|
basename,
|
|
321
321
|
children,
|
|
@@ -342,7 +342,7 @@ function HistoryRouter({
|
|
|
342
342
|
);
|
|
343
343
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
344
344
|
return /* @__PURE__ */ React.createElement(
|
|
345
|
-
|
|
345
|
+
_chunkCYHICRRWjs.Router,
|
|
346
346
|
{
|
|
347
347
|
basename,
|
|
348
348
|
children,
|
|
@@ -369,7 +369,7 @@ var Link = React.forwardRef(
|
|
|
369
369
|
viewTransition,
|
|
370
370
|
...rest
|
|
371
371
|
}, forwardedRef) {
|
|
372
|
-
let { basename } = React.useContext(
|
|
372
|
+
let { basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
373
373
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
374
374
|
let absoluteHref;
|
|
375
375
|
let isExternal = false;
|
|
@@ -379,22 +379,22 @@ var Link = React.forwardRef(
|
|
|
379
379
|
try {
|
|
380
380
|
let currentUrl = new URL(window.location.href);
|
|
381
381
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
382
|
-
let path =
|
|
382
|
+
let path = _chunkCYHICRRWjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
383
383
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
384
384
|
to = path + targetUrl.search + targetUrl.hash;
|
|
385
385
|
} else {
|
|
386
386
|
isExternal = true;
|
|
387
387
|
}
|
|
388
388
|
} catch (e) {
|
|
389
|
-
|
|
389
|
+
_chunkCYHICRRWjs.warning.call(void 0,
|
|
390
390
|
false,
|
|
391
391
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
let href =
|
|
397
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
396
|
+
let href = _chunkCYHICRRWjs.useHref.call(void 0, to, { relative });
|
|
397
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkCYHICRRWjs.usePrefetchBehavior.call(void 0,
|
|
398
398
|
prefetch,
|
|
399
399
|
rest
|
|
400
400
|
);
|
|
@@ -421,13 +421,13 @@ var Link = React.forwardRef(
|
|
|
421
421
|
...prefetchHandlers,
|
|
422
422
|
href: absoluteHref || href,
|
|
423
423
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
424
|
-
ref:
|
|
424
|
+
ref: _chunkCYHICRRWjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
425
425
|
target,
|
|
426
426
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
427
427
|
}
|
|
428
428
|
)
|
|
429
429
|
);
|
|
430
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
430
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkCYHICRRWjs.PrefetchPageLinks, { page: href })) : link;
|
|
431
431
|
}
|
|
432
432
|
);
|
|
433
433
|
Link.displayName = "Link";
|
|
@@ -443,10 +443,10 @@ var NavLink = React.forwardRef(
|
|
|
443
443
|
children,
|
|
444
444
|
...rest
|
|
445
445
|
}, ref) {
|
|
446
|
-
let path =
|
|
447
|
-
let location =
|
|
448
|
-
let routerState = React.useContext(
|
|
449
|
-
let { navigator, basename } = React.useContext(
|
|
446
|
+
let path = _chunkCYHICRRWjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
447
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
448
|
+
let routerState = React.useContext(_chunkCYHICRRWjs.DataRouterStateContext);
|
|
449
|
+
let { navigator, basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
450
450
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
451
451
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
452
452
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -459,7 +459,7 @@ var NavLink = React.forwardRef(
|
|
|
459
459
|
toPathname = toPathname.toLowerCase();
|
|
460
460
|
}
|
|
461
461
|
if (nextLocationPathname && basename) {
|
|
462
|
-
nextLocationPathname =
|
|
462
|
+
nextLocationPathname = _chunkCYHICRRWjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
463
463
|
}
|
|
464
464
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
465
465
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -554,10 +554,10 @@ function ScrollRestoration({
|
|
|
554
554
|
storageKey,
|
|
555
555
|
...props
|
|
556
556
|
}) {
|
|
557
|
-
let remixContext = React.useContext(
|
|
558
|
-
let { basename } = React.useContext(
|
|
559
|
-
let location =
|
|
560
|
-
let matches =
|
|
557
|
+
let remixContext = React.useContext(_chunkCYHICRRWjs.FrameworkContext);
|
|
558
|
+
let { basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
559
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
560
|
+
let matches = _chunkCYHICRRWjs.useMatches.call(void 0, );
|
|
561
561
|
useScrollRestoration({ getKey, storageKey });
|
|
562
562
|
let ssrKey = React.useMemo(
|
|
563
563
|
() => {
|
|
@@ -611,13 +611,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
611
611
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
612
612
|
}
|
|
613
613
|
function useDataRouterContext(hookName) {
|
|
614
|
-
let ctx = React.useContext(
|
|
615
|
-
|
|
614
|
+
let ctx = React.useContext(_chunkCYHICRRWjs.DataRouterContext);
|
|
615
|
+
_chunkCYHICRRWjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
616
616
|
return ctx;
|
|
617
617
|
}
|
|
618
618
|
function useDataRouterState(hookName) {
|
|
619
|
-
let state = React.useContext(
|
|
620
|
-
|
|
619
|
+
let state = React.useContext(_chunkCYHICRRWjs.DataRouterStateContext);
|
|
620
|
+
_chunkCYHICRRWjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
621
621
|
return state;
|
|
622
622
|
}
|
|
623
623
|
function useLinkClickHandler(to, {
|
|
@@ -628,14 +628,14 @@ function useLinkClickHandler(to, {
|
|
|
628
628
|
relative,
|
|
629
629
|
viewTransition
|
|
630
630
|
} = {}) {
|
|
631
|
-
let navigate =
|
|
632
|
-
let location =
|
|
633
|
-
let path =
|
|
631
|
+
let navigate = _chunkCYHICRRWjs.useNavigate.call(void 0, );
|
|
632
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
633
|
+
let path = _chunkCYHICRRWjs.useResolvedPath.call(void 0, to, { relative });
|
|
634
634
|
return React.useCallback(
|
|
635
635
|
(event) => {
|
|
636
636
|
if (shouldProcessLinkClick(event, target)) {
|
|
637
637
|
event.preventDefault();
|
|
638
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
638
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkCYHICRRWjs.createPath.call(void 0, location) === _chunkCYHICRRWjs.createPath.call(void 0, path);
|
|
639
639
|
navigate(to, {
|
|
640
640
|
replace,
|
|
641
641
|
state,
|
|
@@ -660,13 +660,13 @@ function useLinkClickHandler(to, {
|
|
|
660
660
|
);
|
|
661
661
|
}
|
|
662
662
|
function useSearchParams(defaultInit) {
|
|
663
|
-
|
|
663
|
+
_chunkCYHICRRWjs.warning.call(void 0,
|
|
664
664
|
typeof URLSearchParams !== "undefined",
|
|
665
665
|
`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.`
|
|
666
666
|
);
|
|
667
667
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
668
668
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
669
|
-
let location =
|
|
669
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
670
670
|
let searchParams = React.useMemo(
|
|
671
671
|
() => (
|
|
672
672
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -679,7 +679,7 @@ function useSearchParams(defaultInit) {
|
|
|
679
679
|
),
|
|
680
680
|
[location.search]
|
|
681
681
|
);
|
|
682
|
-
let navigate =
|
|
682
|
+
let navigate = _chunkCYHICRRWjs.useNavigate.call(void 0, );
|
|
683
683
|
let setSearchParams = React.useCallback(
|
|
684
684
|
(nextInit, navigateOptions) => {
|
|
685
685
|
const newSearchParams = createSearchParams(
|
|
@@ -696,8 +696,8 @@ var fetcherId = 0;
|
|
|
696
696
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
697
697
|
function useSubmit() {
|
|
698
698
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
699
|
-
let { basename } = React.useContext(
|
|
700
|
-
let currentRouteId =
|
|
699
|
+
let { basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
700
|
+
let currentRouteId = _chunkCYHICRRWjs.useRouteId.call(void 0, );
|
|
701
701
|
return React.useCallback(
|
|
702
702
|
async (target, options = {}) => {
|
|
703
703
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -733,12 +733,12 @@ function useSubmit() {
|
|
|
733
733
|
);
|
|
734
734
|
}
|
|
735
735
|
function useFormAction(action, { relative } = {}) {
|
|
736
|
-
let { basename } = React.useContext(
|
|
737
|
-
let routeContext = React.useContext(
|
|
738
|
-
|
|
736
|
+
let { basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
737
|
+
let routeContext = React.useContext(_chunkCYHICRRWjs.RouteContext);
|
|
738
|
+
_chunkCYHICRRWjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
739
739
|
let [match] = routeContext.matches.slice(-1);
|
|
740
|
-
let path = { ...
|
|
741
|
-
let location =
|
|
740
|
+
let path = { ..._chunkCYHICRRWjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
741
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
742
742
|
if (action == null) {
|
|
743
743
|
path.search = location.search;
|
|
744
744
|
let params = new URLSearchParams(path.search);
|
|
@@ -755,21 +755,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
755
755
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
756
756
|
}
|
|
757
757
|
if (basename !== "/") {
|
|
758
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
758
|
+
path.pathname = path.pathname === "/" ? basename : _chunkCYHICRRWjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
759
759
|
}
|
|
760
|
-
return
|
|
760
|
+
return _chunkCYHICRRWjs.createPath.call(void 0, path);
|
|
761
761
|
}
|
|
762
762
|
function useFetcher({
|
|
763
763
|
key
|
|
764
764
|
} = {}) {
|
|
765
765
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
766
766
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
767
|
-
let fetcherData = React.useContext(
|
|
768
|
-
let route = React.useContext(
|
|
767
|
+
let fetcherData = React.useContext(_chunkCYHICRRWjs.FetchersContext);
|
|
768
|
+
let route = React.useContext(_chunkCYHICRRWjs.RouteContext);
|
|
769
769
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
770
|
+
_chunkCYHICRRWjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
771
|
+
_chunkCYHICRRWjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
772
|
+
_chunkCYHICRRWjs.invariant.call(void 0,
|
|
773
773
|
routeId != null,
|
|
774
774
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
775
775
|
);
|
|
@@ -784,7 +784,7 @@ function useFetcher({
|
|
|
784
784
|
}, [router, fetcherKey]);
|
|
785
785
|
let load = React.useCallback(
|
|
786
786
|
async (href, opts) => {
|
|
787
|
-
|
|
787
|
+
_chunkCYHICRRWjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
788
788
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
789
789
|
},
|
|
790
790
|
[fetcherKey, routeId, router]
|
|
@@ -810,7 +810,7 @@ function useFetcher({
|
|
|
810
810
|
FetcherForm2.displayName = "fetcher.Form";
|
|
811
811
|
return FetcherForm2;
|
|
812
812
|
}, [fetcherKey]);
|
|
813
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
813
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkCYHICRRWjs.IDLE_FETCHER;
|
|
814
814
|
let data = fetcherData.get(fetcherKey);
|
|
815
815
|
let fetcherWithComponents = React.useMemo(
|
|
816
816
|
() => ({
|
|
@@ -841,7 +841,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
841
841
|
key = getKey(
|
|
842
842
|
{
|
|
843
843
|
...location,
|
|
844
|
-
pathname:
|
|
844
|
+
pathname: _chunkCYHICRRWjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
845
845
|
},
|
|
846
846
|
matches
|
|
847
847
|
);
|
|
@@ -862,10 +862,10 @@ function useScrollRestoration({
|
|
|
862
862
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
863
863
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
864
864
|
);
|
|
865
|
-
let { basename } = React.useContext(
|
|
866
|
-
let location =
|
|
867
|
-
let matches =
|
|
868
|
-
let navigation =
|
|
865
|
+
let { basename } = React.useContext(_chunkCYHICRRWjs.NavigationContext);
|
|
866
|
+
let location = _chunkCYHICRRWjs.useLocation.call(void 0, );
|
|
867
|
+
let matches = _chunkCYHICRRWjs.useMatches.call(void 0, );
|
|
868
|
+
let navigation = _chunkCYHICRRWjs.useNavigation.call(void 0, );
|
|
869
869
|
React.useEffect(() => {
|
|
870
870
|
window.history.scrollRestoration = "manual";
|
|
871
871
|
return () => {
|
|
@@ -884,7 +884,7 @@ function useScrollRestoration({
|
|
|
884
884
|
JSON.stringify(savedScrollPositions)
|
|
885
885
|
);
|
|
886
886
|
} catch (error) {
|
|
887
|
-
|
|
887
|
+
_chunkCYHICRRWjs.warning.call(void 0,
|
|
888
888
|
false,
|
|
889
889
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
890
890
|
);
|
|
@@ -931,7 +931,7 @@ function useScrollRestoration({
|
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
} catch (e2) {
|
|
934
|
-
|
|
934
|
+
_chunkCYHICRRWjs.warning.call(void 0,
|
|
935
935
|
false,
|
|
936
936
|
`"${location.hash.slice(
|
|
937
937
|
1
|
|
@@ -969,7 +969,7 @@ function usePrompt({
|
|
|
969
969
|
when,
|
|
970
970
|
message
|
|
971
971
|
}) {
|
|
972
|
-
let blocker =
|
|
972
|
+
let blocker = _chunkCYHICRRWjs.useBlocker.call(void 0, when);
|
|
973
973
|
React.useEffect(() => {
|
|
974
974
|
if (blocker.state === "blocked") {
|
|
975
975
|
let proceed = window.confirm(message);
|
|
@@ -987,21 +987,21 @@ function usePrompt({
|
|
|
987
987
|
}, [blocker, when]);
|
|
988
988
|
}
|
|
989
989
|
function useViewTransitionState(to, { relative } = {}) {
|
|
990
|
-
let vtContext = React.useContext(
|
|
991
|
-
|
|
990
|
+
let vtContext = React.useContext(_chunkCYHICRRWjs.ViewTransitionContext);
|
|
991
|
+
_chunkCYHICRRWjs.invariant.call(void 0,
|
|
992
992
|
vtContext != null,
|
|
993
993
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
994
994
|
);
|
|
995
995
|
let { basename } = useDataRouterContext(
|
|
996
996
|
"useViewTransitionState" /* useViewTransitionState */
|
|
997
997
|
);
|
|
998
|
-
let path =
|
|
998
|
+
let path = _chunkCYHICRRWjs.useResolvedPath.call(void 0, to, { relative });
|
|
999
999
|
if (!vtContext.isTransitioning) {
|
|
1000
1000
|
return false;
|
|
1001
1001
|
}
|
|
1002
|
-
let currentPath =
|
|
1003
|
-
let nextPath =
|
|
1004
|
-
return
|
|
1002
|
+
let currentPath = _chunkCYHICRRWjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1003
|
+
let nextPath = _chunkCYHICRRWjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1004
|
+
return _chunkCYHICRRWjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkCYHICRRWjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
1007
|
// lib/dom/server.tsx
|
|
@@ -1012,7 +1012,7 @@ function StaticRouter({
|
|
|
1012
1012
|
location: locationProp = "/"
|
|
1013
1013
|
}) {
|
|
1014
1014
|
if (typeof locationProp === "string") {
|
|
1015
|
-
locationProp =
|
|
1015
|
+
locationProp = _chunkCYHICRRWjs.parsePath.call(void 0, locationProp);
|
|
1016
1016
|
}
|
|
1017
1017
|
let action = "POP" /* Pop */;
|
|
1018
1018
|
let location = {
|
|
@@ -1024,7 +1024,7 @@ function StaticRouter({
|
|
|
1024
1024
|
};
|
|
1025
1025
|
let staticNavigator = getStatelessNavigator();
|
|
1026
1026
|
return /* @__PURE__ */ React2.createElement(
|
|
1027
|
-
|
|
1027
|
+
_chunkCYHICRRWjs.Router,
|
|
1028
1028
|
{
|
|
1029
1029
|
basename,
|
|
1030
1030
|
children,
|
|
@@ -1041,7 +1041,7 @@ function StaticRouterProvider({
|
|
|
1041
1041
|
hydrate = true,
|
|
1042
1042
|
nonce
|
|
1043
1043
|
}) {
|
|
1044
|
-
|
|
1044
|
+
_chunkCYHICRRWjs.invariant.call(void 0,
|
|
1045
1045
|
router && context,
|
|
1046
1046
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1047
1047
|
);
|
|
@@ -1064,8 +1064,8 @@ function StaticRouterProvider({
|
|
|
1064
1064
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1065
1065
|
}
|
|
1066
1066
|
let { state } = dataRouterContext.router;
|
|
1067
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1068
|
-
|
|
1067
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkCYHICRRWjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkCYHICRRWjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkCYHICRRWjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkCYHICRRWjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1068
|
+
_chunkCYHICRRWjs.Router,
|
|
1069
1069
|
{
|
|
1070
1070
|
basename: dataRouterContext.basename,
|
|
1071
1071
|
location: state.location,
|
|
@@ -1095,14 +1095,14 @@ function DataRoutes({
|
|
|
1095
1095
|
future,
|
|
1096
1096
|
state
|
|
1097
1097
|
}) {
|
|
1098
|
-
return
|
|
1098
|
+
return _chunkCYHICRRWjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1099
1099
|
}
|
|
1100
1100
|
function serializeErrors(errors) {
|
|
1101
1101
|
if (!errors) return null;
|
|
1102
1102
|
let entries = Object.entries(errors);
|
|
1103
1103
|
let serialized = {};
|
|
1104
1104
|
for (let [key, val] of entries) {
|
|
1105
|
-
if (
|
|
1105
|
+
if (_chunkCYHICRRWjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1106
1106
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1107
1107
|
} else if (val instanceof Error) {
|
|
1108
1108
|
serialized[key] = {
|
|
@@ -1152,16 +1152,16 @@ function getStatelessNavigator() {
|
|
|
1152
1152
|
};
|
|
1153
1153
|
}
|
|
1154
1154
|
function createStaticHandler2(routes, opts) {
|
|
1155
|
-
return
|
|
1155
|
+
return _chunkCYHICRRWjs.createStaticHandler.call(void 0, routes, {
|
|
1156
1156
|
...opts,
|
|
1157
|
-
mapRouteProperties:
|
|
1157
|
+
mapRouteProperties: _chunkCYHICRRWjs.mapRouteProperties
|
|
1158
1158
|
});
|
|
1159
1159
|
}
|
|
1160
1160
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1161
1161
|
let manifest = {};
|
|
1162
|
-
let dataRoutes =
|
|
1162
|
+
let dataRoutes = _chunkCYHICRRWjs.convertRoutesToDataRoutes.call(void 0,
|
|
1163
1163
|
routes,
|
|
1164
|
-
|
|
1164
|
+
_chunkCYHICRRWjs.mapRouteProperties,
|
|
1165
1165
|
void 0,
|
|
1166
1166
|
manifest
|
|
1167
1167
|
);
|
|
@@ -1192,7 +1192,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1192
1192
|
actionData: context.actionData,
|
|
1193
1193
|
errors: context.errors,
|
|
1194
1194
|
initialized: true,
|
|
1195
|
-
navigation:
|
|
1195
|
+
navigation: _chunkCYHICRRWjs.IDLE_NAVIGATION,
|
|
1196
1196
|
restoreScrollPosition: null,
|
|
1197
1197
|
preventScrollReset: false,
|
|
1198
1198
|
revalidation: "idle",
|
|
@@ -1227,7 +1227,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1227
1227
|
createHref,
|
|
1228
1228
|
encodeLocation,
|
|
1229
1229
|
getFetcher() {
|
|
1230
|
-
return
|
|
1230
|
+
return _chunkCYHICRRWjs.IDLE_FETCHER;
|
|
1231
1231
|
},
|
|
1232
1232
|
deleteFetcher() {
|
|
1233
1233
|
throw msg("deleteFetcher");
|
|
@@ -1239,7 +1239,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1239
1239
|
throw msg("dispose");
|
|
1240
1240
|
},
|
|
1241
1241
|
getBlocker() {
|
|
1242
|
-
return
|
|
1242
|
+
return _chunkCYHICRRWjs.IDLE_BLOCKER;
|
|
1243
1243
|
},
|
|
1244
1244
|
deleteBlocker() {
|
|
1245
1245
|
throw msg("deleteBlocker");
|
|
@@ -1257,10 +1257,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1257
1257
|
};
|
|
1258
1258
|
}
|
|
1259
1259
|
function createHref(to) {
|
|
1260
|
-
return typeof to === "string" ? to :
|
|
1260
|
+
return typeof to === "string" ? to : _chunkCYHICRRWjs.createPath.call(void 0, to);
|
|
1261
1261
|
}
|
|
1262
1262
|
function encodeLocation(to) {
|
|
1263
|
-
let href = typeof to === "string" ? to :
|
|
1263
|
+
let href = typeof to === "string" ? to : _chunkCYHICRRWjs.createPath.call(void 0, to);
|
|
1264
1264
|
href = href.replace(/ $/, "%20");
|
|
1265
1265
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1266
1266
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.9.6-pre.
|
|
2
|
+
* react-router v7.9.6-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkCYHICRRWjs = require('./chunk-CYHICRRW.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkCYHICRRWjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkCYHICRRWjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkCYHICRRWjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkCYHICRRWjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkCYHICRRWjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.9.6-pre.
|
|
2
|
+
* react-router v7.9.6-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
withComponentProps,
|
|
50
50
|
withErrorBoundaryProps,
|
|
51
51
|
withHydrateFallbackProps
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-DKSAHU2I.mjs";
|
|
53
53
|
|
|
54
54
|
// lib/dom/ssr/server.tsx
|
|
55
55
|
import * as React from "react";
|