react-router 0.0.0-experimental-e067e5e52 → 0.0.0-experimental-56b72276e
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/dist/development/{chunk-5UECWI5A.js → chunk-63U7QHOO.js} +99 -99
- package/dist/development/{chunk-SWPURLNP.mjs → chunk-66UV33R5.mjs} +2 -2
- package/dist/{production/chunk-KMR3DDYK.js → development/chunk-AEFPRTVA.js} +7 -7
- package/dist/development/{chunk-EZE2A5EE.mjs → chunk-C35YGSX6.mjs} +6 -6
- package/dist/development/{chunk-NQI6347W.js → chunk-PUKCNFVJ.js} +5 -5
- package/dist/development/dom-export.js +27 -27
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/index-react-server-client.d.mts +1 -1
- package/dist/development/index-react-server-client.d.ts +1 -1
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +2 -2
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +82 -82
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{development/chunk-DGNRX45Q.js → production/chunk-CYERTBD4.js} +7 -7
- package/dist/production/{chunk-AHQTEAQI.js → chunk-DEXURW6G.js} +99 -99
- package/dist/production/{chunk-DMRAUID3.js → chunk-KDSQNTYZ.js} +5 -5
- package/dist/production/{chunk-T4I6FMSB.mjs → chunk-N2N4A2FL.mjs} +2 -2
- package/dist/production/{chunk-T33PNRK2.mjs → chunk-WUU6KOE6.mjs} +6 -6
- package/dist/production/dom-export.js +27 -27
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/index-react-server-client.d.mts +1 -1
- package/dist/production/index-react-server-client.d.ts +1 -1
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +2 -2
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +82 -82
- 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/dist/{production/index-react-server-client-CFThihEp.d.mts → development/index-react-server-client--SGjRgyj.d.mts} +48 -48
- package/dist/development/{index-react-server-client-CtMh0QTM.d.ts → index-react-server-client-Y7cd_xTA.d.ts} +48 -48
- package/dist/{development/index-react-server-client-CFThihEp.d.mts → production/index-react-server-client--SGjRgyj.d.mts} +48 -48
- package/dist/production/{index-react-server-client-CtMh0QTM.d.ts → index-react-server-client-Y7cd_xTA.d.ts} +48 -48
|
@@ -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-56b72276e
|
|
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 _chunkPUKCNFVJjs = require('./chunk-PUKCNFVJ.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
|
+
_chunkPUKCNFVJjs.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 ? _chunkPUKCNFVJjs.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 ? _chunkPUKCNFVJjs.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-56b72276e";
|
|
191
191
|
}
|
|
192
192
|
} catch (e) {
|
|
193
193
|
}
|
|
194
194
|
function createBrowserRouter(routes, opts) {
|
|
195
|
-
return
|
|
195
|
+
return _chunkPUKCNFVJjs.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: _chunkPUKCNFVJjs.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: _chunkPUKCNFVJjs.mapRouteProperties,
|
|
203
|
+
hydrationRouteProperties: _chunkPUKCNFVJjs.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 _chunkPUKCNFVJjs.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: _chunkPUKCNFVJjs.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: _chunkPUKCNFVJjs.mapRouteProperties,
|
|
219
|
+
hydrationRouteProperties: _chunkPUKCNFVJjs.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, _chunkPUKCNFVJjs.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 = _chunkPUKCNFVJjs.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
|
+
_chunkPUKCNFVJjs.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 = _chunkPUKCNFVJjs.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
|
+
_chunkPUKCNFVJjs.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
|
+
_chunkPUKCNFVJjs.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(_chunkPUKCNFVJjs.NavigationContext);
|
|
400
400
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
401
|
-
let parsed =
|
|
401
|
+
let parsed = _chunkPUKCNFVJjs.parseToInfo.call(void 0, to, basename);
|
|
402
402
|
to = parsed.to;
|
|
403
|
-
let href =
|
|
404
|
-
let location =
|
|
403
|
+
let href = _chunkPUKCNFVJjs.useHref.call(void 0, to, { relative });
|
|
404
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
405
405
|
let maskedHref = null;
|
|
406
406
|
if (unstable_mask) {
|
|
407
|
-
let resolved =
|
|
407
|
+
let resolved = _chunkPUKCNFVJjs.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 : _chunkPUKCNFVJjs.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] = _chunkPUKCNFVJjs.usePrefetchBehavior.call(void 0,
|
|
419
419
|
prefetch,
|
|
420
420
|
rest
|
|
421
421
|
);
|
|
@@ -445,13 +445,13 @@ var Link = React.forwardRef(
|
|
|
445
445
|
...prefetchHandlers,
|
|
446
446
|
href: (!(parsed.isExternal || reloadDocument) ? maskedHref : void 0) || parsed.absoluteURL || href,
|
|
447
447
|
onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
|
|
448
|
-
ref:
|
|
448
|
+
ref: _chunkPUKCNFVJjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
449
449
|
target,
|
|
450
450
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
451
451
|
}
|
|
452
452
|
)
|
|
453
453
|
);
|
|
454
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
454
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkPUKCNFVJjs.PrefetchPageLinks, { page: href })) : link;
|
|
455
455
|
}
|
|
456
456
|
);
|
|
457
457
|
Link.displayName = "Link";
|
|
@@ -467,10 +467,10 @@ var NavLink = React.forwardRef(
|
|
|
467
467
|
children,
|
|
468
468
|
...rest
|
|
469
469
|
}, ref) {
|
|
470
|
-
let path =
|
|
471
|
-
let location =
|
|
472
|
-
let routerState = React.useContext(
|
|
473
|
-
let { navigator, basename } = React.useContext(
|
|
470
|
+
let path = _chunkPUKCNFVJjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
471
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
472
|
+
let routerState = React.useContext(_chunkPUKCNFVJjs.DataRouterStateContext);
|
|
473
|
+
let { navigator, basename } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
474
474
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
475
475
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
476
476
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -483,7 +483,7 @@ var NavLink = React.forwardRef(
|
|
|
483
483
|
toPathname = toPathname.toLowerCase();
|
|
484
484
|
}
|
|
485
485
|
if (nextLocationPathname && basename) {
|
|
486
|
-
nextLocationPathname =
|
|
486
|
+
nextLocationPathname = _chunkPUKCNFVJjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
487
487
|
}
|
|
488
488
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
489
489
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -539,7 +539,7 @@ var Form = React.forwardRef(
|
|
|
539
539
|
unstable_defaultShouldRevalidate,
|
|
540
540
|
...props
|
|
541
541
|
}, forwardedRef) => {
|
|
542
|
-
let { unstable_useTransitions } = React.useContext(
|
|
542
|
+
let { unstable_useTransitions } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
543
543
|
let submit = useSubmit();
|
|
544
544
|
let formAction = useFormAction(action, { relative });
|
|
545
545
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -586,10 +586,10 @@ function ScrollRestoration({
|
|
|
586
586
|
storageKey,
|
|
587
587
|
...props
|
|
588
588
|
}) {
|
|
589
|
-
let remixContext = React.useContext(
|
|
590
|
-
let { basename } = React.useContext(
|
|
591
|
-
let location =
|
|
592
|
-
let matches =
|
|
589
|
+
let remixContext = React.useContext(_chunkPUKCNFVJjs.FrameworkContext);
|
|
590
|
+
let { basename } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
591
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
592
|
+
let matches = _chunkPUKCNFVJjs.useMatches.call(void 0, );
|
|
593
593
|
useScrollRestoration({ getKey, storageKey });
|
|
594
594
|
let ssrKey = React.useMemo(
|
|
595
595
|
() => {
|
|
@@ -631,9 +631,9 @@ function ScrollRestoration({
|
|
|
631
631
|
...props,
|
|
632
632
|
suppressHydrationWarning: true,
|
|
633
633
|
dangerouslySetInnerHTML: {
|
|
634
|
-
__html: `(${restoreScroll})(${
|
|
634
|
+
__html: `(${restoreScroll})(${_chunkPUKCNFVJjs.escapeHtml.call(void 0,
|
|
635
635
|
JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
|
|
636
|
-
)}, ${
|
|
636
|
+
)}, ${_chunkPUKCNFVJjs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
);
|
|
@@ -643,13 +643,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
643
643
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
644
644
|
}
|
|
645
645
|
function useDataRouterContext(hookName) {
|
|
646
|
-
let ctx = React.useContext(
|
|
647
|
-
|
|
646
|
+
let ctx = React.useContext(_chunkPUKCNFVJjs.DataRouterContext);
|
|
647
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
648
648
|
return ctx;
|
|
649
649
|
}
|
|
650
650
|
function useDataRouterState(hookName) {
|
|
651
|
-
let state = React.useContext(
|
|
652
|
-
|
|
651
|
+
let state = React.useContext(_chunkPUKCNFVJjs.DataRouterStateContext);
|
|
652
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
653
653
|
return state;
|
|
654
654
|
}
|
|
655
655
|
function useLinkClickHandler(to, {
|
|
@@ -663,14 +663,14 @@ function useLinkClickHandler(to, {
|
|
|
663
663
|
unstable_defaultShouldRevalidate,
|
|
664
664
|
unstable_useTransitions
|
|
665
665
|
} = {}) {
|
|
666
|
-
let navigate =
|
|
667
|
-
let location =
|
|
668
|
-
let path =
|
|
666
|
+
let navigate = _chunkPUKCNFVJjs.useNavigate.call(void 0, );
|
|
667
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
668
|
+
let path = _chunkPUKCNFVJjs.useResolvedPath.call(void 0, to, { relative });
|
|
669
669
|
return React.useCallback(
|
|
670
670
|
(event) => {
|
|
671
671
|
if (shouldProcessLinkClick(event, target)) {
|
|
672
672
|
event.preventDefault();
|
|
673
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
673
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkPUKCNFVJjs.createPath.call(void 0, location) === _chunkPUKCNFVJjs.createPath.call(void 0, path);
|
|
674
674
|
let doNavigate = () => navigate(to, {
|
|
675
675
|
replace,
|
|
676
676
|
unstable_mask,
|
|
@@ -705,13 +705,13 @@ function useLinkClickHandler(to, {
|
|
|
705
705
|
);
|
|
706
706
|
}
|
|
707
707
|
function useSearchParams(defaultInit) {
|
|
708
|
-
|
|
708
|
+
_chunkPUKCNFVJjs.warning.call(void 0,
|
|
709
709
|
typeof URLSearchParams !== "undefined",
|
|
710
710
|
`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
711
|
);
|
|
712
712
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
713
713
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
714
|
-
let location =
|
|
714
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
715
715
|
let searchParams = React.useMemo(
|
|
716
716
|
() => (
|
|
717
717
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -724,7 +724,7 @@ function useSearchParams(defaultInit) {
|
|
|
724
724
|
),
|
|
725
725
|
[location.search]
|
|
726
726
|
);
|
|
727
|
-
let navigate =
|
|
727
|
+
let navigate = _chunkPUKCNFVJjs.useNavigate.call(void 0, );
|
|
728
728
|
let setSearchParams = React.useCallback(
|
|
729
729
|
(nextInit, navigateOptions) => {
|
|
730
730
|
const newSearchParams = createSearchParams(
|
|
@@ -741,8 +741,8 @@ var fetcherId = 0;
|
|
|
741
741
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
742
742
|
function useSubmit() {
|
|
743
743
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
744
|
-
let { basename } = React.useContext(
|
|
745
|
-
let currentRouteId =
|
|
744
|
+
let { basename } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
745
|
+
let currentRouteId = _chunkPUKCNFVJjs.useRouteId.call(void 0, );
|
|
746
746
|
let routerFetch = router.fetch;
|
|
747
747
|
let routerNavigate = router.navigate;
|
|
748
748
|
return React.useCallback(
|
|
@@ -782,12 +782,12 @@ function useSubmit() {
|
|
|
782
782
|
);
|
|
783
783
|
}
|
|
784
784
|
function useFormAction(action, { relative } = {}) {
|
|
785
|
-
let { basename } = React.useContext(
|
|
786
|
-
let routeContext = React.useContext(
|
|
787
|
-
|
|
785
|
+
let { basename } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
786
|
+
let routeContext = React.useContext(_chunkPUKCNFVJjs.RouteContext);
|
|
787
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
788
788
|
let [match] = routeContext.matches.slice(-1);
|
|
789
|
-
let path = { ...
|
|
790
|
-
let location =
|
|
789
|
+
let path = { ..._chunkPUKCNFVJjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
790
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
791
791
|
if (action == null) {
|
|
792
792
|
path.search = location.search;
|
|
793
793
|
let params = new URLSearchParams(path.search);
|
|
@@ -804,21 +804,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
804
804
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
805
805
|
}
|
|
806
806
|
if (basename !== "/") {
|
|
807
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
807
|
+
path.pathname = path.pathname === "/" ? basename : _chunkPUKCNFVJjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
808
808
|
}
|
|
809
|
-
return
|
|
809
|
+
return _chunkPUKCNFVJjs.createPath.call(void 0, path);
|
|
810
810
|
}
|
|
811
811
|
function useFetcher({
|
|
812
812
|
key
|
|
813
813
|
} = {}) {
|
|
814
814
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
815
815
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
816
|
-
let fetcherData = React.useContext(
|
|
817
|
-
let route = React.useContext(
|
|
816
|
+
let fetcherData = React.useContext(_chunkPUKCNFVJjs.FetchersContext);
|
|
817
|
+
let route = React.useContext(_chunkPUKCNFVJjs.RouteContext);
|
|
818
818
|
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
|
-
|
|
819
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
820
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
821
|
+
_chunkPUKCNFVJjs.invariant.call(void 0,
|
|
822
822
|
routeId != null,
|
|
823
823
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
824
824
|
);
|
|
@@ -834,7 +834,7 @@ function useFetcher({
|
|
|
834
834
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
835
835
|
let load = React.useCallback(
|
|
836
836
|
async (href, opts) => {
|
|
837
|
-
|
|
837
|
+
_chunkPUKCNFVJjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
838
838
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
839
839
|
},
|
|
840
840
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -863,7 +863,7 @@ function useFetcher({
|
|
|
863
863
|
FetcherForm2.displayName = "fetcher.Form";
|
|
864
864
|
return FetcherForm2;
|
|
865
865
|
}, [fetcherKey]);
|
|
866
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
866
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkPUKCNFVJjs.IDLE_FETCHER;
|
|
867
867
|
let data = fetcherData.get(fetcherKey);
|
|
868
868
|
let fetcherWithComponents = React.useMemo(
|
|
869
869
|
() => ({
|
|
@@ -894,7 +894,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
894
894
|
key = getKey(
|
|
895
895
|
{
|
|
896
896
|
...location,
|
|
897
|
-
pathname:
|
|
897
|
+
pathname: _chunkPUKCNFVJjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
898
898
|
},
|
|
899
899
|
matches
|
|
900
900
|
);
|
|
@@ -915,10 +915,10 @@ function useScrollRestoration({
|
|
|
915
915
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
916
916
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
917
917
|
);
|
|
918
|
-
let { basename } = React.useContext(
|
|
919
|
-
let location =
|
|
920
|
-
let matches =
|
|
921
|
-
let navigation =
|
|
918
|
+
let { basename } = React.useContext(_chunkPUKCNFVJjs.NavigationContext);
|
|
919
|
+
let location = _chunkPUKCNFVJjs.useLocation.call(void 0, );
|
|
920
|
+
let matches = _chunkPUKCNFVJjs.useMatches.call(void 0, );
|
|
921
|
+
let navigation = _chunkPUKCNFVJjs.useNavigation.call(void 0, );
|
|
922
922
|
React.useEffect(() => {
|
|
923
923
|
window.history.scrollRestoration = "manual";
|
|
924
924
|
return () => {
|
|
@@ -937,7 +937,7 @@ function useScrollRestoration({
|
|
|
937
937
|
JSON.stringify(savedScrollPositions)
|
|
938
938
|
);
|
|
939
939
|
} catch (error) {
|
|
940
|
-
|
|
940
|
+
_chunkPUKCNFVJjs.warning.call(void 0,
|
|
941
941
|
false,
|
|
942
942
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
943
943
|
);
|
|
@@ -984,7 +984,7 @@ function useScrollRestoration({
|
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
986
|
} catch (e2) {
|
|
987
|
-
|
|
987
|
+
_chunkPUKCNFVJjs.warning.call(void 0,
|
|
988
988
|
false,
|
|
989
989
|
`"${location.hash.slice(
|
|
990
990
|
1
|
|
@@ -1022,7 +1022,7 @@ function usePrompt({
|
|
|
1022
1022
|
when,
|
|
1023
1023
|
message
|
|
1024
1024
|
}) {
|
|
1025
|
-
let blocker =
|
|
1025
|
+
let blocker = _chunkPUKCNFVJjs.useBlocker.call(void 0, when);
|
|
1026
1026
|
React.useEffect(() => {
|
|
1027
1027
|
if (blocker.state === "blocked") {
|
|
1028
1028
|
let proceed = window.confirm(message);
|
|
@@ -1040,21 +1040,21 @@ function usePrompt({
|
|
|
1040
1040
|
}, [blocker, when]);
|
|
1041
1041
|
}
|
|
1042
1042
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1043
|
-
let vtContext = React.useContext(
|
|
1044
|
-
|
|
1043
|
+
let vtContext = React.useContext(_chunkPUKCNFVJjs.ViewTransitionContext);
|
|
1044
|
+
_chunkPUKCNFVJjs.invariant.call(void 0,
|
|
1045
1045
|
vtContext != null,
|
|
1046
1046
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1047
1047
|
);
|
|
1048
1048
|
let { basename } = useDataRouterContext(
|
|
1049
1049
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1050
1050
|
);
|
|
1051
|
-
let path =
|
|
1051
|
+
let path = _chunkPUKCNFVJjs.useResolvedPath.call(void 0, to, { relative });
|
|
1052
1052
|
if (!vtContext.isTransitioning) {
|
|
1053
1053
|
return false;
|
|
1054
1054
|
}
|
|
1055
|
-
let currentPath =
|
|
1056
|
-
let nextPath =
|
|
1057
|
-
return
|
|
1055
|
+
let currentPath = _chunkPUKCNFVJjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1056
|
+
let nextPath = _chunkPUKCNFVJjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1057
|
+
return _chunkPUKCNFVJjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkPUKCNFVJjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
1060
|
// lib/dom/server.tsx
|
|
@@ -1065,7 +1065,7 @@ function StaticRouter({
|
|
|
1065
1065
|
location: locationProp = "/"
|
|
1066
1066
|
}) {
|
|
1067
1067
|
if (typeof locationProp === "string") {
|
|
1068
|
-
locationProp =
|
|
1068
|
+
locationProp = _chunkPUKCNFVJjs.parsePath.call(void 0, locationProp);
|
|
1069
1069
|
}
|
|
1070
1070
|
let action = "POP" /* Pop */;
|
|
1071
1071
|
let location = {
|
|
@@ -1078,7 +1078,7 @@ function StaticRouter({
|
|
|
1078
1078
|
};
|
|
1079
1079
|
let staticNavigator = getStatelessNavigator();
|
|
1080
1080
|
return /* @__PURE__ */ React2.createElement(
|
|
1081
|
-
|
|
1081
|
+
_chunkPUKCNFVJjs.Router,
|
|
1082
1082
|
{
|
|
1083
1083
|
basename,
|
|
1084
1084
|
children,
|
|
@@ -1096,7 +1096,7 @@ function StaticRouterProvider({
|
|
|
1096
1096
|
hydrate = true,
|
|
1097
1097
|
nonce
|
|
1098
1098
|
}) {
|
|
1099
|
-
|
|
1099
|
+
_chunkPUKCNFVJjs.invariant.call(void 0,
|
|
1100
1100
|
router && context,
|
|
1101
1101
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1102
1102
|
);
|
|
@@ -1115,12 +1115,12 @@ function StaticRouterProvider({
|
|
|
1115
1115
|
actionData: context.actionData,
|
|
1116
1116
|
errors: serializeErrors(context.errors)
|
|
1117
1117
|
};
|
|
1118
|
-
let json =
|
|
1118
|
+
let json = _chunkPUKCNFVJjs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
|
|
1119
1119
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1120
1120
|
}
|
|
1121
1121
|
let { state } = dataRouterContext.router;
|
|
1122
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1123
|
-
|
|
1122
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkPUKCNFVJjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkPUKCNFVJjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkPUKCNFVJjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkPUKCNFVJjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1123
|
+
_chunkPUKCNFVJjs.Router,
|
|
1124
1124
|
{
|
|
1125
1125
|
basename: dataRouterContext.basename,
|
|
1126
1126
|
location: state.location,
|
|
@@ -1151,14 +1151,14 @@ function DataRoutes({
|
|
|
1151
1151
|
future,
|
|
1152
1152
|
state
|
|
1153
1153
|
}) {
|
|
1154
|
-
return
|
|
1154
|
+
return _chunkPUKCNFVJjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1155
1155
|
}
|
|
1156
1156
|
function serializeErrors(errors) {
|
|
1157
1157
|
if (!errors) return null;
|
|
1158
1158
|
let entries = Object.entries(errors);
|
|
1159
1159
|
let serialized = {};
|
|
1160
1160
|
for (let [key, val] of entries) {
|
|
1161
|
-
if (
|
|
1161
|
+
if (_chunkPUKCNFVJjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1162
1162
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1163
1163
|
} else if (val instanceof Error) {
|
|
1164
1164
|
serialized[key] = {
|
|
@@ -1208,16 +1208,16 @@ function getStatelessNavigator() {
|
|
|
1208
1208
|
};
|
|
1209
1209
|
}
|
|
1210
1210
|
function createStaticHandler2(routes, opts) {
|
|
1211
|
-
return
|
|
1211
|
+
return _chunkPUKCNFVJjs.createStaticHandler.call(void 0, routes, {
|
|
1212
1212
|
...opts,
|
|
1213
|
-
mapRouteProperties:
|
|
1213
|
+
mapRouteProperties: _chunkPUKCNFVJjs.mapRouteProperties
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
1216
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1217
1217
|
let manifest = {};
|
|
1218
|
-
let dataRoutes =
|
|
1218
|
+
let dataRoutes = _chunkPUKCNFVJjs.convertRoutesToDataRoutes.call(void 0,
|
|
1219
1219
|
routes,
|
|
1220
|
-
|
|
1220
|
+
_chunkPUKCNFVJjs.mapRouteProperties,
|
|
1221
1221
|
void 0,
|
|
1222
1222
|
manifest
|
|
1223
1223
|
);
|
|
@@ -1248,7 +1248,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1248
1248
|
actionData: context.actionData,
|
|
1249
1249
|
errors: context.errors,
|
|
1250
1250
|
initialized: true,
|
|
1251
|
-
navigation:
|
|
1251
|
+
navigation: _chunkPUKCNFVJjs.IDLE_NAVIGATION,
|
|
1252
1252
|
restoreScrollPosition: null,
|
|
1253
1253
|
preventScrollReset: false,
|
|
1254
1254
|
revalidation: "idle",
|
|
@@ -1283,7 +1283,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1283
1283
|
createHref,
|
|
1284
1284
|
encodeLocation,
|
|
1285
1285
|
getFetcher() {
|
|
1286
|
-
return
|
|
1286
|
+
return _chunkPUKCNFVJjs.IDLE_FETCHER;
|
|
1287
1287
|
},
|
|
1288
1288
|
deleteFetcher() {
|
|
1289
1289
|
throw msg("deleteFetcher");
|
|
@@ -1295,7 +1295,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1295
1295
|
throw msg("dispose");
|
|
1296
1296
|
},
|
|
1297
1297
|
getBlocker() {
|
|
1298
|
-
return
|
|
1298
|
+
return _chunkPUKCNFVJjs.IDLE_BLOCKER;
|
|
1299
1299
|
},
|
|
1300
1300
|
deleteBlocker() {
|
|
1301
1301
|
throw msg("deleteBlocker");
|
|
@@ -1313,10 +1313,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
function createHref(to) {
|
|
1316
|
-
return typeof to === "string" ? to :
|
|
1316
|
+
return typeof to === "string" ? to : _chunkPUKCNFVJjs.createPath.call(void 0, to);
|
|
1317
1317
|
}
|
|
1318
1318
|
function encodeLocation(to) {
|
|
1319
|
-
let href = typeof to === "string" ? to :
|
|
1319
|
+
let href = typeof to === "string" ? to : _chunkPUKCNFVJjs.createPath.call(void 0, to);
|
|
1320
1320
|
href = href.replace(/ $/, "%20");
|
|
1321
1321
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1322
1322
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-56b72276e
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
withComponentProps,
|
|
52
52
|
withErrorBoundaryProps,
|
|
53
53
|
withHydrateFallbackProps
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-C35YGSX6.mjs";
|
|
55
55
|
|
|
56
56
|
// lib/dom/ssr/server.tsx
|
|
57
57
|
import * as React from "react";
|
|
@@ -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 v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-56b72276e
|
|
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 _chunkPUKCNFVJjs = require('./chunk-PUKCNFVJ.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 = _chunkPUKCNFVJjs.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 (_chunkPUKCNFVJjs.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 (_chunkPUKCNFVJjs.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
|
+
_chunkPUKCNFVJjs.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 = _chunkPUKCNFVJjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|