react-router 0.0.0-experimental-e067e5e52 → 0.0.0-experimental-567b27f71
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 +68 -0
- package/dist/development/{browser-Cloic07w.d.ts → browser-BUb__T3u.d.mts} +2 -1
- package/dist/{production/browser-Cloic07w.d.ts → development/browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/development/{chunk-5UECWI5A.js → chunk-3KQWMVH5.js} +106 -109
- package/dist/{production/chunk-KMR3DDYK.js → development/chunk-FITK2GBN.js} +7 -7
- package/dist/development/{chunk-EZE2A5EE.mjs → chunk-MFSTD5J4.mjs} +305 -191
- package/dist/development/{chunk-SWPURLNP.mjs → chunk-T2TDL4ZI.mjs} +86 -50
- package/dist/development/{chunk-NQI6347W.js → chunk-XLC5DWBP.js} +361 -244
- package/dist/development/context-kw54iBKW.d.mts +1713 -0
- package/dist/development/dom-export.d.mts +3 -2
- package/dist/development/dom-export.d.ts +3 -2
- package/dist/development/dom-export.js +38 -29
- package/dist/development/dom-export.mjs +14 -5
- package/dist/{production/index-react-server-client-CFThihEp.d.mts → development/index-react-server-client-CmqQRyrG.d.mts} +51 -49
- package/dist/development/{index-react-server-client-CtMh0QTM.d.ts → index-react-server-client-CtQKvWuW.d.ts} +1114 -57
- package/dist/development/index-react-server-client.d.mts +3 -2
- package/dist/development/index-react-server-client.d.ts +3 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +297 -246
- package/dist/development/index-react-server.d.ts +297 -246
- package/dist/development/index-react-server.js +97 -21
- package/dist/development/index-react-server.mjs +97 -21
- package/dist/development/index.d.mts +12 -10
- package/dist/development/index.d.ts +12 -10
- package/dist/development/index.js +179 -143
- package/dist/development/index.mjs +3 -3
- package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/development/lib/types/internal.d.mts +4 -4
- package/dist/development/lib/types/internal.d.ts +4 -4
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-B86pZKib.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/development/{register-DA0Mb5jF.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/dist/{development/browser-JuMzyCK4.d.mts → production/browser-BUb__T3u.d.mts} +2 -1
- package/dist/production/{browser-JuMzyCK4.d.mts → browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/production/{chunk-DMRAUID3.js → chunk-7CRO7VK3.js} +361 -244
- package/dist/production/{chunk-T33PNRK2.mjs → chunk-JCFT2HBB.mjs} +305 -191
- package/dist/{development/chunk-DGNRX45Q.js → production/chunk-ONKPUZLV.js} +7 -7
- package/dist/production/{chunk-T4I6FMSB.mjs → chunk-OZOQN5MO.mjs} +86 -50
- package/dist/production/{chunk-AHQTEAQI.js → chunk-Y4BW72NR.js} +106 -109
- package/dist/production/context-kw54iBKW.d.mts +1713 -0
- package/dist/production/dom-export.d.mts +3 -2
- package/dist/production/dom-export.d.ts +3 -2
- package/dist/production/dom-export.js +38 -29
- package/dist/production/dom-export.mjs +14 -5
- package/dist/{development/index-react-server-client-CFThihEp.d.mts → production/index-react-server-client-CmqQRyrG.d.mts} +51 -49
- package/dist/production/{index-react-server-client-CtMh0QTM.d.ts → index-react-server-client-CtQKvWuW.d.ts} +1114 -57
- package/dist/production/index-react-server-client.d.mts +3 -2
- package/dist/production/index-react-server-client.d.ts +3 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +297 -246
- package/dist/production/index-react-server.d.ts +297 -246
- package/dist/production/index-react-server.js +97 -21
- package/dist/production/index-react-server.mjs +97 -21
- package/dist/production/index.d.mts +12 -10
- package/dist/production/index.d.ts +12 -10
- package/dist/production/index.js +179 -143
- package/dist/production/index.mjs +3 -3
- package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/production/lib/types/internal.d.mts +4 -4
- package/dist/production/lib/types/internal.d.ts +4 -4
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-B86pZKib.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/production/{register-DA0Mb5jF.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/package.json +1 -1
- package/dist/development/instrumentation-C7Lh_MjH.d.ts +0 -3340
- package/dist/development/router-CFkT48p_.d.mts +0 -3340
- package/dist/production/instrumentation-C7Lh_MjH.d.ts +0 -3340
- package/dist/production/router-CFkT48p_.d.mts +0 -3340
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-567b27f71
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
var
|
|
54
|
+
var _chunkXLC5DWBPjs = require('./chunk-XLC5DWBP.js');
|
|
55
55
|
|
|
56
56
|
// lib/dom/dom.ts
|
|
57
57
|
var defaultMethod = "get";
|
|
@@ -122,7 +122,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
122
122
|
]);
|
|
123
123
|
function getFormEncType(encType) {
|
|
124
124
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
125
|
-
|
|
125
|
+
_chunkXLC5DWBPjs.warning.call(void 0,
|
|
126
126
|
false,
|
|
127
127
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
128
128
|
);
|
|
@@ -138,7 +138,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
138
138
|
let body;
|
|
139
139
|
if (isFormElement(target)) {
|
|
140
140
|
let attr = target.getAttribute("action");
|
|
141
|
-
action = attr ?
|
|
141
|
+
action = attr ? _chunkXLC5DWBPjs.stripBasename.call(void 0, attr, basename) : null;
|
|
142
142
|
method = target.getAttribute("method") || defaultMethod;
|
|
143
143
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
144
144
|
formData = new FormData(target);
|
|
@@ -150,7 +150,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
153
|
-
action = attr ?
|
|
153
|
+
action = attr ? _chunkXLC5DWBPjs.stripBasename.call(void 0, attr, basename) : null;
|
|
154
154
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
155
155
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
156
156
|
formData = new FormData(form, target);
|
|
@@ -187,20 +187,20 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
187
187
|
try {
|
|
188
188
|
if (isBrowser) {
|
|
189
189
|
window.__reactRouterVersion = // @ts-expect-error
|
|
190
|
-
"0.0.0-experimental-
|
|
190
|
+
"0.0.0-experimental-567b27f71";
|
|
191
191
|
}
|
|
192
192
|
} catch (e) {
|
|
193
193
|
}
|
|
194
194
|
function createBrowserRouter(routes, opts) {
|
|
195
|
-
return
|
|
195
|
+
return _chunkXLC5DWBPjs.createRouter.call(void 0, {
|
|
196
196
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
197
197
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
198
198
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
199
|
-
history:
|
|
199
|
+
history: _chunkXLC5DWBPjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
200
200
|
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
201
201
|
routes,
|
|
202
|
-
mapRouteProperties:
|
|
203
|
-
hydrationRouteProperties:
|
|
202
|
+
mapRouteProperties: _chunkXLC5DWBPjs.mapRouteProperties,
|
|
203
|
+
hydrationRouteProperties: _chunkXLC5DWBPjs.hydrationRouteProperties,
|
|
204
204
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
205
205
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
206
206
|
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
@@ -208,15 +208,15 @@ function createBrowserRouter(routes, opts) {
|
|
|
208
208
|
}).initialize();
|
|
209
209
|
}
|
|
210
210
|
function createHashRouter(routes, opts) {
|
|
211
|
-
return
|
|
211
|
+
return _chunkXLC5DWBPjs.createRouter.call(void 0, {
|
|
212
212
|
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
213
213
|
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
214
214
|
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
215
|
-
history:
|
|
215
|
+
history: _chunkXLC5DWBPjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
216
216
|
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
217
217
|
routes,
|
|
218
|
-
mapRouteProperties:
|
|
219
|
-
hydrationRouteProperties:
|
|
218
|
+
mapRouteProperties: _chunkXLC5DWBPjs.mapRouteProperties,
|
|
219
|
+
hydrationRouteProperties: _chunkXLC5DWBPjs.hydrationRouteProperties,
|
|
220
220
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
221
221
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
222
222
|
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
@@ -239,7 +239,7 @@ function deserializeErrors(errors) {
|
|
|
239
239
|
let serialized = {};
|
|
240
240
|
for (let [key, val] of entries) {
|
|
241
241
|
if (val && val.__type === "RouteErrorResponse") {
|
|
242
|
-
serialized[key] = new (0,
|
|
242
|
+
serialized[key] = new (0, _chunkXLC5DWBPjs.ErrorResponseImpl)(
|
|
243
243
|
val.status,
|
|
244
244
|
val.statusText,
|
|
245
245
|
val.data,
|
|
@@ -276,7 +276,7 @@ function BrowserRouter({
|
|
|
276
276
|
}) {
|
|
277
277
|
let historyRef = React.useRef();
|
|
278
278
|
if (historyRef.current == null) {
|
|
279
|
-
historyRef.current =
|
|
279
|
+
historyRef.current = _chunkXLC5DWBPjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
280
280
|
}
|
|
281
281
|
let history = historyRef.current;
|
|
282
282
|
let [state, setStateImpl] = React.useState({
|
|
@@ -295,7 +295,7 @@ function BrowserRouter({
|
|
|
295
295
|
);
|
|
296
296
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
297
297
|
return /* @__PURE__ */ React.createElement(
|
|
298
|
-
|
|
298
|
+
_chunkXLC5DWBPjs.Router,
|
|
299
299
|
{
|
|
300
300
|
basename,
|
|
301
301
|
children,
|
|
@@ -314,7 +314,7 @@ function HashRouter({
|
|
|
314
314
|
}) {
|
|
315
315
|
let historyRef = React.useRef();
|
|
316
316
|
if (historyRef.current == null) {
|
|
317
|
-
historyRef.current =
|
|
317
|
+
historyRef.current = _chunkXLC5DWBPjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
318
318
|
}
|
|
319
319
|
let history = historyRef.current;
|
|
320
320
|
let [state, setStateImpl] = React.useState({
|
|
@@ -333,7 +333,7 @@ function HashRouter({
|
|
|
333
333
|
);
|
|
334
334
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
335
335
|
return /* @__PURE__ */ React.createElement(
|
|
336
|
-
|
|
336
|
+
_chunkXLC5DWBPjs.Router,
|
|
337
337
|
{
|
|
338
338
|
basename,
|
|
339
339
|
children,
|
|
@@ -366,7 +366,7 @@ function HistoryRouter({
|
|
|
366
366
|
);
|
|
367
367
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
368
368
|
return /* @__PURE__ */ React.createElement(
|
|
369
|
-
|
|
369
|
+
_chunkXLC5DWBPjs.Router,
|
|
370
370
|
{
|
|
371
371
|
basename,
|
|
372
372
|
children,
|
|
@@ -396,26 +396,26 @@ var Link = React.forwardRef(
|
|
|
396
396
|
unstable_defaultShouldRevalidate,
|
|
397
397
|
...rest
|
|
398
398
|
}, forwardedRef) {
|
|
399
|
-
let { basename, navigator, unstable_useTransitions } = React.useContext(
|
|
399
|
+
let { basename, navigator, unstable_useTransitions } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
400
400
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
401
|
-
let parsed =
|
|
401
|
+
let parsed = _chunkXLC5DWBPjs.parseToInfo.call(void 0, to, basename);
|
|
402
402
|
to = parsed.to;
|
|
403
|
-
let href =
|
|
404
|
-
let location =
|
|
403
|
+
let href = _chunkXLC5DWBPjs.useHref.call(void 0, to, { relative });
|
|
404
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
405
405
|
let maskedHref = null;
|
|
406
406
|
if (unstable_mask) {
|
|
407
|
-
let resolved =
|
|
407
|
+
let resolved = _chunkXLC5DWBPjs.resolveTo.call(void 0,
|
|
408
408
|
unstable_mask,
|
|
409
409
|
[],
|
|
410
410
|
location.unstable_mask ? location.unstable_mask.pathname : "/",
|
|
411
411
|
true
|
|
412
412
|
);
|
|
413
413
|
if (basename !== "/") {
|
|
414
|
-
resolved.pathname = resolved.pathname === "/" ? basename :
|
|
414
|
+
resolved.pathname = resolved.pathname === "/" ? basename : _chunkXLC5DWBPjs.joinPaths.call(void 0, [basename, resolved.pathname]);
|
|
415
415
|
}
|
|
416
416
|
maskedHref = navigator.createHref(resolved);
|
|
417
417
|
}
|
|
418
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
418
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkXLC5DWBPjs.usePrefetchBehavior.call(void 0,
|
|
419
419
|
prefetch,
|
|
420
420
|
rest
|
|
421
421
|
);
|
|
@@ -436,6 +436,7 @@ var Link = React.forwardRef(
|
|
|
436
436
|
internalOnClick(event);
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
+
let isSpaLink = !(parsed.isExternal || reloadDocument);
|
|
439
440
|
let link = (
|
|
440
441
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
441
442
|
/* @__PURE__ */ React.createElement(
|
|
@@ -443,15 +444,15 @@ var Link = React.forwardRef(
|
|
|
443
444
|
{
|
|
444
445
|
...rest,
|
|
445
446
|
...prefetchHandlers,
|
|
446
|
-
href: (
|
|
447
|
-
onClick:
|
|
448
|
-
ref:
|
|
447
|
+
href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
|
|
448
|
+
onClick: isSpaLink ? handleClick : onClick,
|
|
449
|
+
ref: _chunkXLC5DWBPjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
449
450
|
target,
|
|
450
451
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
451
452
|
}
|
|
452
453
|
)
|
|
453
454
|
);
|
|
454
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
455
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkXLC5DWBPjs.PrefetchPageLinks, { page: href })) : link;
|
|
455
456
|
}
|
|
456
457
|
);
|
|
457
458
|
Link.displayName = "Link";
|
|
@@ -467,10 +468,10 @@ var NavLink = React.forwardRef(
|
|
|
467
468
|
children,
|
|
468
469
|
...rest
|
|
469
470
|
}, ref) {
|
|
470
|
-
let path =
|
|
471
|
-
let location =
|
|
472
|
-
let routerState = React.useContext(
|
|
473
|
-
let { navigator, basename } = React.useContext(
|
|
471
|
+
let path = _chunkXLC5DWBPjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
472
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
473
|
+
let routerState = React.useContext(_chunkXLC5DWBPjs.DataRouterStateContext);
|
|
474
|
+
let { navigator, basename } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
474
475
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
475
476
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
476
477
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -483,7 +484,7 @@ var NavLink = React.forwardRef(
|
|
|
483
484
|
toPathname = toPathname.toLowerCase();
|
|
484
485
|
}
|
|
485
486
|
if (nextLocationPathname && basename) {
|
|
486
|
-
nextLocationPathname =
|
|
487
|
+
nextLocationPathname = _chunkXLC5DWBPjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
487
488
|
}
|
|
488
489
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
489
490
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -539,7 +540,7 @@ var Form = React.forwardRef(
|
|
|
539
540
|
unstable_defaultShouldRevalidate,
|
|
540
541
|
...props
|
|
541
542
|
}, forwardedRef) => {
|
|
542
|
-
let { unstable_useTransitions } = React.useContext(
|
|
543
|
+
let { unstable_useTransitions } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
543
544
|
let submit = useSubmit();
|
|
544
545
|
let formAction = useFormAction(action, { relative });
|
|
545
546
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -586,10 +587,10 @@ function ScrollRestoration({
|
|
|
586
587
|
storageKey,
|
|
587
588
|
...props
|
|
588
589
|
}) {
|
|
589
|
-
let remixContext = React.useContext(
|
|
590
|
-
let { basename } = React.useContext(
|
|
591
|
-
let location =
|
|
592
|
-
let matches =
|
|
590
|
+
let remixContext = React.useContext(_chunkXLC5DWBPjs.FrameworkContext);
|
|
591
|
+
let { basename } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
592
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
593
|
+
let matches = _chunkXLC5DWBPjs.useMatches.call(void 0, );
|
|
593
594
|
useScrollRestoration({ getKey, storageKey });
|
|
594
595
|
let ssrKey = React.useMemo(
|
|
595
596
|
() => {
|
|
@@ -631,9 +632,9 @@ function ScrollRestoration({
|
|
|
631
632
|
...props,
|
|
632
633
|
suppressHydrationWarning: true,
|
|
633
634
|
dangerouslySetInnerHTML: {
|
|
634
|
-
__html: `(${restoreScroll})(${
|
|
635
|
+
__html: `(${restoreScroll})(${_chunkXLC5DWBPjs.escapeHtml.call(void 0,
|
|
635
636
|
JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
|
|
636
|
-
)}, ${
|
|
637
|
+
)}, ${_chunkXLC5DWBPjs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
|
|
637
638
|
}
|
|
638
639
|
}
|
|
639
640
|
);
|
|
@@ -643,13 +644,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
643
644
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
644
645
|
}
|
|
645
646
|
function useDataRouterContext(hookName) {
|
|
646
|
-
let ctx = React.useContext(
|
|
647
|
-
|
|
647
|
+
let ctx = React.useContext(_chunkXLC5DWBPjs.DataRouterContext);
|
|
648
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
648
649
|
return ctx;
|
|
649
650
|
}
|
|
650
651
|
function useDataRouterState(hookName) {
|
|
651
|
-
let state = React.useContext(
|
|
652
|
-
|
|
652
|
+
let state = React.useContext(_chunkXLC5DWBPjs.DataRouterStateContext);
|
|
653
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
653
654
|
return state;
|
|
654
655
|
}
|
|
655
656
|
function useLinkClickHandler(to, {
|
|
@@ -663,14 +664,14 @@ function useLinkClickHandler(to, {
|
|
|
663
664
|
unstable_defaultShouldRevalidate,
|
|
664
665
|
unstable_useTransitions
|
|
665
666
|
} = {}) {
|
|
666
|
-
let navigate =
|
|
667
|
-
let location =
|
|
668
|
-
let path =
|
|
667
|
+
let navigate = _chunkXLC5DWBPjs.useNavigate.call(void 0, );
|
|
668
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
669
|
+
let path = _chunkXLC5DWBPjs.useResolvedPath.call(void 0, to, { relative });
|
|
669
670
|
return React.useCallback(
|
|
670
671
|
(event) => {
|
|
671
672
|
if (shouldProcessLinkClick(event, target)) {
|
|
672
673
|
event.preventDefault();
|
|
673
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
674
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkXLC5DWBPjs.createPath.call(void 0, location) === _chunkXLC5DWBPjs.createPath.call(void 0, path);
|
|
674
675
|
let doNavigate = () => navigate(to, {
|
|
675
676
|
replace,
|
|
676
677
|
unstable_mask,
|
|
@@ -705,13 +706,13 @@ function useLinkClickHandler(to, {
|
|
|
705
706
|
);
|
|
706
707
|
}
|
|
707
708
|
function useSearchParams(defaultInit) {
|
|
708
|
-
|
|
709
|
+
_chunkXLC5DWBPjs.warning.call(void 0,
|
|
709
710
|
typeof URLSearchParams !== "undefined",
|
|
710
711
|
`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.`
|
|
711
712
|
);
|
|
712
713
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
713
714
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
714
|
-
let location =
|
|
715
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
715
716
|
let searchParams = React.useMemo(
|
|
716
717
|
() => (
|
|
717
718
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -724,7 +725,7 @@ function useSearchParams(defaultInit) {
|
|
|
724
725
|
),
|
|
725
726
|
[location.search]
|
|
726
727
|
);
|
|
727
|
-
let navigate =
|
|
728
|
+
let navigate = _chunkXLC5DWBPjs.useNavigate.call(void 0, );
|
|
728
729
|
let setSearchParams = React.useCallback(
|
|
729
730
|
(nextInit, navigateOptions) => {
|
|
730
731
|
const newSearchParams = createSearchParams(
|
|
@@ -741,8 +742,8 @@ var fetcherId = 0;
|
|
|
741
742
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
742
743
|
function useSubmit() {
|
|
743
744
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
744
|
-
let { basename } = React.useContext(
|
|
745
|
-
let currentRouteId =
|
|
745
|
+
let { basename } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
746
|
+
let currentRouteId = _chunkXLC5DWBPjs.useRouteId.call(void 0, );
|
|
746
747
|
let routerFetch = router.fetch;
|
|
747
748
|
let routerNavigate = router.navigate;
|
|
748
749
|
return React.useCallback(
|
|
@@ -782,12 +783,12 @@ function useSubmit() {
|
|
|
782
783
|
);
|
|
783
784
|
}
|
|
784
785
|
function useFormAction(action, { relative } = {}) {
|
|
785
|
-
let { basename } = React.useContext(
|
|
786
|
-
let routeContext = React.useContext(
|
|
787
|
-
|
|
786
|
+
let { basename } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
787
|
+
let routeContext = React.useContext(_chunkXLC5DWBPjs.RouteContext);
|
|
788
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
788
789
|
let [match] = routeContext.matches.slice(-1);
|
|
789
|
-
let path = { ...
|
|
790
|
-
let location =
|
|
790
|
+
let path = { ..._chunkXLC5DWBPjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
791
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
791
792
|
if (action == null) {
|
|
792
793
|
path.search = location.search;
|
|
793
794
|
let params = new URLSearchParams(path.search);
|
|
@@ -804,21 +805,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
804
805
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
805
806
|
}
|
|
806
807
|
if (basename !== "/") {
|
|
807
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
808
|
+
path.pathname = path.pathname === "/" ? basename : _chunkXLC5DWBPjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
808
809
|
}
|
|
809
|
-
return
|
|
810
|
+
return _chunkXLC5DWBPjs.createPath.call(void 0, path);
|
|
810
811
|
}
|
|
811
812
|
function useFetcher({
|
|
812
813
|
key
|
|
813
814
|
} = {}) {
|
|
814
815
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
815
816
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
816
|
-
let fetcherData = React.useContext(
|
|
817
|
-
let route = React.useContext(
|
|
817
|
+
let fetcherData = React.useContext(_chunkXLC5DWBPjs.FetchersContext);
|
|
818
|
+
let route = React.useContext(_chunkXLC5DWBPjs.RouteContext);
|
|
818
819
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
820
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
821
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
822
|
+
_chunkXLC5DWBPjs.invariant.call(void 0,
|
|
822
823
|
routeId != null,
|
|
823
824
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
824
825
|
);
|
|
@@ -834,7 +835,7 @@ function useFetcher({
|
|
|
834
835
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
835
836
|
let load = React.useCallback(
|
|
836
837
|
async (href, opts) => {
|
|
837
|
-
|
|
838
|
+
_chunkXLC5DWBPjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
838
839
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
839
840
|
},
|
|
840
841
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -863,7 +864,7 @@ function useFetcher({
|
|
|
863
864
|
FetcherForm2.displayName = "fetcher.Form";
|
|
864
865
|
return FetcherForm2;
|
|
865
866
|
}, [fetcherKey]);
|
|
866
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
867
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkXLC5DWBPjs.IDLE_FETCHER;
|
|
867
868
|
let data = fetcherData.get(fetcherKey);
|
|
868
869
|
let fetcherWithComponents = React.useMemo(
|
|
869
870
|
() => ({
|
|
@@ -894,7 +895,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
894
895
|
key = getKey(
|
|
895
896
|
{
|
|
896
897
|
...location,
|
|
897
|
-
pathname:
|
|
898
|
+
pathname: _chunkXLC5DWBPjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
898
899
|
},
|
|
899
900
|
matches
|
|
900
901
|
);
|
|
@@ -915,10 +916,10 @@ function useScrollRestoration({
|
|
|
915
916
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
916
917
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
917
918
|
);
|
|
918
|
-
let { basename } = React.useContext(
|
|
919
|
-
let location =
|
|
920
|
-
let matches =
|
|
921
|
-
let navigation =
|
|
919
|
+
let { basename } = React.useContext(_chunkXLC5DWBPjs.NavigationContext);
|
|
920
|
+
let location = _chunkXLC5DWBPjs.useLocation.call(void 0, );
|
|
921
|
+
let matches = _chunkXLC5DWBPjs.useMatches.call(void 0, );
|
|
922
|
+
let navigation = _chunkXLC5DWBPjs.useNavigation.call(void 0, );
|
|
922
923
|
React.useEffect(() => {
|
|
923
924
|
window.history.scrollRestoration = "manual";
|
|
924
925
|
return () => {
|
|
@@ -937,7 +938,7 @@ function useScrollRestoration({
|
|
|
937
938
|
JSON.stringify(savedScrollPositions)
|
|
938
939
|
);
|
|
939
940
|
} catch (error) {
|
|
940
|
-
|
|
941
|
+
_chunkXLC5DWBPjs.warning.call(void 0,
|
|
941
942
|
false,
|
|
942
943
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
943
944
|
);
|
|
@@ -984,7 +985,7 @@ function useScrollRestoration({
|
|
|
984
985
|
}
|
|
985
986
|
}
|
|
986
987
|
} catch (e2) {
|
|
987
|
-
|
|
988
|
+
_chunkXLC5DWBPjs.warning.call(void 0,
|
|
988
989
|
false,
|
|
989
990
|
`"${location.hash.slice(
|
|
990
991
|
1
|
|
@@ -1022,7 +1023,7 @@ function usePrompt({
|
|
|
1022
1023
|
when,
|
|
1023
1024
|
message
|
|
1024
1025
|
}) {
|
|
1025
|
-
let blocker =
|
|
1026
|
+
let blocker = _chunkXLC5DWBPjs.useBlocker.call(void 0, when);
|
|
1026
1027
|
React.useEffect(() => {
|
|
1027
1028
|
if (blocker.state === "blocked") {
|
|
1028
1029
|
let proceed = window.confirm(message);
|
|
@@ -1040,21 +1041,21 @@ function usePrompt({
|
|
|
1040
1041
|
}, [blocker, when]);
|
|
1041
1042
|
}
|
|
1042
1043
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1043
|
-
let vtContext = React.useContext(
|
|
1044
|
-
|
|
1044
|
+
let vtContext = React.useContext(_chunkXLC5DWBPjs.ViewTransitionContext);
|
|
1045
|
+
_chunkXLC5DWBPjs.invariant.call(void 0,
|
|
1045
1046
|
vtContext != null,
|
|
1046
1047
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1047
1048
|
);
|
|
1048
1049
|
let { basename } = useDataRouterContext(
|
|
1049
1050
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1050
1051
|
);
|
|
1051
|
-
let path =
|
|
1052
|
+
let path = _chunkXLC5DWBPjs.useResolvedPath.call(void 0, to, { relative });
|
|
1052
1053
|
if (!vtContext.isTransitioning) {
|
|
1053
1054
|
return false;
|
|
1054
1055
|
}
|
|
1055
|
-
let currentPath =
|
|
1056
|
-
let nextPath =
|
|
1057
|
-
return
|
|
1056
|
+
let currentPath = _chunkXLC5DWBPjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1057
|
+
let nextPath = _chunkXLC5DWBPjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1058
|
+
return _chunkXLC5DWBPjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkXLC5DWBPjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1058
1059
|
}
|
|
1059
1060
|
|
|
1060
1061
|
// lib/dom/server.tsx
|
|
@@ -1065,7 +1066,7 @@ function StaticRouter({
|
|
|
1065
1066
|
location: locationProp = "/"
|
|
1066
1067
|
}) {
|
|
1067
1068
|
if (typeof locationProp === "string") {
|
|
1068
|
-
locationProp =
|
|
1069
|
+
locationProp = _chunkXLC5DWBPjs.parsePath.call(void 0, locationProp);
|
|
1069
1070
|
}
|
|
1070
1071
|
let action = "POP" /* Pop */;
|
|
1071
1072
|
let location = {
|
|
@@ -1078,7 +1079,7 @@ function StaticRouter({
|
|
|
1078
1079
|
};
|
|
1079
1080
|
let staticNavigator = getStatelessNavigator();
|
|
1080
1081
|
return /* @__PURE__ */ React2.createElement(
|
|
1081
|
-
|
|
1082
|
+
_chunkXLC5DWBPjs.Router,
|
|
1082
1083
|
{
|
|
1083
1084
|
basename,
|
|
1084
1085
|
children,
|
|
@@ -1096,7 +1097,7 @@ function StaticRouterProvider({
|
|
|
1096
1097
|
hydrate = true,
|
|
1097
1098
|
nonce
|
|
1098
1099
|
}) {
|
|
1099
|
-
|
|
1100
|
+
_chunkXLC5DWBPjs.invariant.call(void 0,
|
|
1100
1101
|
router && context,
|
|
1101
1102
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1102
1103
|
);
|
|
@@ -1115,12 +1116,12 @@ function StaticRouterProvider({
|
|
|
1115
1116
|
actionData: context.actionData,
|
|
1116
1117
|
errors: serializeErrors(context.errors)
|
|
1117
1118
|
};
|
|
1118
|
-
let json =
|
|
1119
|
+
let json = _chunkXLC5DWBPjs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
|
|
1119
1120
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1120
1121
|
}
|
|
1121
1122
|
let { state } = dataRouterContext.router;
|
|
1122
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1123
|
-
|
|
1123
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkXLC5DWBPjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkXLC5DWBPjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkXLC5DWBPjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkXLC5DWBPjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1124
|
+
_chunkXLC5DWBPjs.Router,
|
|
1124
1125
|
{
|
|
1125
1126
|
basename: dataRouterContext.basename,
|
|
1126
1127
|
location: state.location,
|
|
@@ -1130,11 +1131,12 @@ function StaticRouterProvider({
|
|
|
1130
1131
|
unstable_useTransitions: false
|
|
1131
1132
|
},
|
|
1132
1133
|
/* @__PURE__ */ React2.createElement(
|
|
1133
|
-
DataRoutes,
|
|
1134
|
+
_chunkXLC5DWBPjs.DataRoutes,
|
|
1134
1135
|
{
|
|
1135
1136
|
routes: router.routes,
|
|
1136
1137
|
future: router.future,
|
|
1137
|
-
state
|
|
1138
|
+
state,
|
|
1139
|
+
isStatic: true
|
|
1138
1140
|
}
|
|
1139
1141
|
)
|
|
1140
1142
|
))))), hydrateScript ? /* @__PURE__ */ React2.createElement(
|
|
@@ -1146,19 +1148,12 @@ function StaticRouterProvider({
|
|
|
1146
1148
|
}
|
|
1147
1149
|
) : null);
|
|
1148
1150
|
}
|
|
1149
|
-
function DataRoutes({
|
|
1150
|
-
routes,
|
|
1151
|
-
future,
|
|
1152
|
-
state
|
|
1153
|
-
}) {
|
|
1154
|
-
return _chunkNQI6347Wjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1155
|
-
}
|
|
1156
1151
|
function serializeErrors(errors) {
|
|
1157
1152
|
if (!errors) return null;
|
|
1158
1153
|
let entries = Object.entries(errors);
|
|
1159
1154
|
let serialized = {};
|
|
1160
1155
|
for (let [key, val] of entries) {
|
|
1161
|
-
if (
|
|
1156
|
+
if (_chunkXLC5DWBPjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1162
1157
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1163
1158
|
} else if (val instanceof Error) {
|
|
1164
1159
|
serialized[key] = {
|
|
@@ -1208,16 +1203,16 @@ function getStatelessNavigator() {
|
|
|
1208
1203
|
};
|
|
1209
1204
|
}
|
|
1210
1205
|
function createStaticHandler2(routes, opts) {
|
|
1211
|
-
return
|
|
1206
|
+
return _chunkXLC5DWBPjs.createStaticHandler.call(void 0, routes, {
|
|
1212
1207
|
...opts,
|
|
1213
|
-
mapRouteProperties:
|
|
1208
|
+
mapRouteProperties: _chunkXLC5DWBPjs.mapRouteProperties
|
|
1214
1209
|
});
|
|
1215
1210
|
}
|
|
1216
1211
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1217
1212
|
let manifest = {};
|
|
1218
|
-
let dataRoutes =
|
|
1213
|
+
let dataRoutes = _chunkXLC5DWBPjs.convertRoutesToDataRoutes.call(void 0,
|
|
1219
1214
|
routes,
|
|
1220
|
-
|
|
1215
|
+
_chunkXLC5DWBPjs.mapRouteProperties,
|
|
1221
1216
|
void 0,
|
|
1222
1217
|
manifest
|
|
1223
1218
|
);
|
|
@@ -1236,6 +1231,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1236
1231
|
get future() {
|
|
1237
1232
|
return {
|
|
1238
1233
|
v8_middleware: false,
|
|
1234
|
+
unstable_passThroughRequests: false,
|
|
1239
1235
|
..._optionalChain([opts, 'optionalAccess', _29 => _29.future])
|
|
1240
1236
|
};
|
|
1241
1237
|
},
|
|
@@ -1248,7 +1244,8 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1248
1244
|
actionData: context.actionData,
|
|
1249
1245
|
errors: context.errors,
|
|
1250
1246
|
initialized: true,
|
|
1251
|
-
|
|
1247
|
+
renderFallback: false,
|
|
1248
|
+
navigation: _chunkXLC5DWBPjs.IDLE_NAVIGATION,
|
|
1252
1249
|
restoreScrollPosition: null,
|
|
1253
1250
|
preventScrollReset: false,
|
|
1254
1251
|
revalidation: "idle",
|
|
@@ -1283,7 +1280,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1283
1280
|
createHref,
|
|
1284
1281
|
encodeLocation,
|
|
1285
1282
|
getFetcher() {
|
|
1286
|
-
return
|
|
1283
|
+
return _chunkXLC5DWBPjs.IDLE_FETCHER;
|
|
1287
1284
|
},
|
|
1288
1285
|
deleteFetcher() {
|
|
1289
1286
|
throw msg("deleteFetcher");
|
|
@@ -1295,7 +1292,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1295
1292
|
throw msg("dispose");
|
|
1296
1293
|
},
|
|
1297
1294
|
getBlocker() {
|
|
1298
|
-
return
|
|
1295
|
+
return _chunkXLC5DWBPjs.IDLE_BLOCKER;
|
|
1299
1296
|
},
|
|
1300
1297
|
deleteBlocker() {
|
|
1301
1298
|
throw msg("deleteBlocker");
|
|
@@ -1313,10 +1310,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1313
1310
|
};
|
|
1314
1311
|
}
|
|
1315
1312
|
function createHref(to) {
|
|
1316
|
-
return typeof to === "string" ? to :
|
|
1313
|
+
return typeof to === "string" ? to : _chunkXLC5DWBPjs.createPath.call(void 0, to);
|
|
1317
1314
|
}
|
|
1318
1315
|
function encodeLocation(to) {
|
|
1319
|
-
let href = typeof to === "string" ? to :
|
|
1316
|
+
let href = typeof to === "string" ? to : _chunkXLC5DWBPjs.createPath.call(void 0, to);
|
|
1320
1317
|
href = href.replace(/ $/, "%20");
|
|
1321
1318
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1322
1319
|
return {
|