react-router 0.0.0-experimental-31a822c5f → 0.0.0-experimental-de3b900
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/{production/chunk-IGF74WUC.mjs → development/chunk-5VDQAMOM.mjs} +2 -2
- package/dist/development/{chunk-SE36CWVW.js → chunk-JEIV2ESS.js} +93 -93
- package/dist/development/{chunk-CZ7KRWQZ.js → chunk-K3XLKYJI.js} +3 -2
- package/dist/development/{chunk-WTUOISGV.mjs → chunk-OVO62ONG.mjs} +4 -3
- package/dist/{production/chunk-UU3LJMU6.js → development/chunk-UPBUMW2M.js} +7 -7
- 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 +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +1 -0
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +75 -75
- 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-DRKUM6HW.js → chunk-63YB5VLY.js} +3 -2
- package/dist/{development/chunk-T5RKBXBV.js → production/chunk-IE722GR6.js} +7 -7
- package/dist/production/{chunk-RUSRTUHT.mjs → chunk-U25H5FTL.mjs} +4 -3
- package/dist/production/{chunk-YVVCGSEG.js → chunk-VX4OHTGR.js} +93 -93
- package/dist/{development/chunk-FXUONXY4.mjs → production/chunk-XOCFS75J.mjs} +2 -2
- 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 +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +1 -0
- package/dist/production/index.d.ts +1 -0
- package/dist/production/index.js +75 -75
- 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
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-de3b900
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
withComponentProps,
|
|
49
49
|
withErrorBoundaryProps,
|
|
50
50
|
withHydrateFallbackProps
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-OVO62ONG.mjs";
|
|
52
52
|
|
|
53
53
|
// lib/dom/ssr/server.tsx
|
|
54
54
|
import * as React from "react";
|
|
@@ -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-de3b900
|
|
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 _chunkK3XLKYJIjs = require('./chunk-K3XLKYJI.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
|
+
_chunkK3XLKYJIjs.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 ? _chunkK3XLKYJIjs.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 ? _chunkK3XLKYJIjs.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,35 +184,35 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
184
184
|
try {
|
|
185
185
|
if (isBrowser) {
|
|
186
186
|
window.__reactRouterVersion = // @ts-expect-error
|
|
187
|
-
"0.0.0-experimental-
|
|
187
|
+
"0.0.0-experimental-de3b900";
|
|
188
188
|
}
|
|
189
189
|
} catch (e) {
|
|
190
190
|
}
|
|
191
191
|
function createBrowserRouter(routes, opts) {
|
|
192
|
-
return
|
|
192
|
+
return _chunkK3XLKYJIjs.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: _chunkK3XLKYJIjs.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: _chunkK3XLKYJIjs.mapRouteProperties,
|
|
200
|
+
hydrationRouteProperties: _chunkK3XLKYJIjs.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])
|
|
204
204
|
}).initialize();
|
|
205
205
|
}
|
|
206
206
|
function createHashRouter(routes, opts) {
|
|
207
|
-
return
|
|
207
|
+
return _chunkK3XLKYJIjs.createRouter.call(void 0, {
|
|
208
208
|
basename: _optionalChain([opts, 'optionalAccess', _10 => _10.basename]),
|
|
209
209
|
getContext: _optionalChain([opts, 'optionalAccess', _11 => _11.getContext]),
|
|
210
210
|
future: _optionalChain([opts, 'optionalAccess', _12 => _12.future]),
|
|
211
|
-
history:
|
|
211
|
+
history: _chunkK3XLKYJIjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _13 => _13.window]) }),
|
|
212
212
|
hydrationData: _optionalChain([opts, 'optionalAccess', _14 => _14.hydrationData]) || parseHydrationData(),
|
|
213
213
|
routes,
|
|
214
|
-
mapRouteProperties:
|
|
215
|
-
hydrationRouteProperties:
|
|
214
|
+
mapRouteProperties: _chunkK3XLKYJIjs.mapRouteProperties,
|
|
215
|
+
hydrationRouteProperties: _chunkK3XLKYJIjs.hydrationRouteProperties,
|
|
216
216
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _15 => _15.dataStrategy]),
|
|
217
217
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _16 => _16.patchRoutesOnNavigation]),
|
|
218
218
|
window: _optionalChain([opts, 'optionalAccess', _17 => _17.window])
|
|
@@ -234,7 +234,7 @@ function deserializeErrors(errors) {
|
|
|
234
234
|
let serialized = {};
|
|
235
235
|
for (let [key, val] of entries) {
|
|
236
236
|
if (val && val.__type === "RouteErrorResponse") {
|
|
237
|
-
serialized[key] = new (0,
|
|
237
|
+
serialized[key] = new (0, _chunkK3XLKYJIjs.ErrorResponseImpl)(
|
|
238
238
|
val.status,
|
|
239
239
|
val.statusText,
|
|
240
240
|
val.data,
|
|
@@ -270,7 +270,7 @@ function BrowserRouter({
|
|
|
270
270
|
}) {
|
|
271
271
|
let historyRef = React.useRef();
|
|
272
272
|
if (historyRef.current == null) {
|
|
273
|
-
historyRef.current =
|
|
273
|
+
historyRef.current = _chunkK3XLKYJIjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
274
274
|
}
|
|
275
275
|
let history = historyRef.current;
|
|
276
276
|
let [state, setStateImpl] = React.useState({
|
|
@@ -285,7 +285,7 @@ function BrowserRouter({
|
|
|
285
285
|
);
|
|
286
286
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
287
287
|
return /* @__PURE__ */ React.createElement(
|
|
288
|
-
|
|
288
|
+
_chunkK3XLKYJIjs.Router,
|
|
289
289
|
{
|
|
290
290
|
basename,
|
|
291
291
|
children,
|
|
@@ -298,7 +298,7 @@ function BrowserRouter({
|
|
|
298
298
|
function HashRouter({ basename, children, window: window2 }) {
|
|
299
299
|
let historyRef = React.useRef();
|
|
300
300
|
if (historyRef.current == null) {
|
|
301
|
-
historyRef.current =
|
|
301
|
+
historyRef.current = _chunkK3XLKYJIjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
302
302
|
}
|
|
303
303
|
let history = historyRef.current;
|
|
304
304
|
let [state, setStateImpl] = React.useState({
|
|
@@ -313,7 +313,7 @@ function HashRouter({ basename, children, window: window2 }) {
|
|
|
313
313
|
);
|
|
314
314
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
315
315
|
return /* @__PURE__ */ React.createElement(
|
|
316
|
-
|
|
316
|
+
_chunkK3XLKYJIjs.Router,
|
|
317
317
|
{
|
|
318
318
|
basename,
|
|
319
319
|
children,
|
|
@@ -340,7 +340,7 @@ function HistoryRouter({
|
|
|
340
340
|
);
|
|
341
341
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
342
342
|
return /* @__PURE__ */ React.createElement(
|
|
343
|
-
|
|
343
|
+
_chunkK3XLKYJIjs.Router,
|
|
344
344
|
{
|
|
345
345
|
basename,
|
|
346
346
|
children,
|
|
@@ -367,7 +367,7 @@ var Link = React.forwardRef(
|
|
|
367
367
|
viewTransition,
|
|
368
368
|
...rest
|
|
369
369
|
}, forwardedRef) {
|
|
370
|
-
let { basename } = React.useContext(
|
|
370
|
+
let { basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
371
371
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
372
372
|
let absoluteHref;
|
|
373
373
|
let isExternal = false;
|
|
@@ -377,22 +377,22 @@ var Link = React.forwardRef(
|
|
|
377
377
|
try {
|
|
378
378
|
let currentUrl = new URL(window.location.href);
|
|
379
379
|
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
380
|
-
let path =
|
|
380
|
+
let path = _chunkK3XLKYJIjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
381
381
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
382
382
|
to = path + targetUrl.search + targetUrl.hash;
|
|
383
383
|
} else {
|
|
384
384
|
isExternal = true;
|
|
385
385
|
}
|
|
386
386
|
} catch (e) {
|
|
387
|
-
|
|
387
|
+
_chunkK3XLKYJIjs.warning.call(void 0,
|
|
388
388
|
false,
|
|
389
389
|
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
390
390
|
);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
let href =
|
|
395
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
394
|
+
let href = _chunkK3XLKYJIjs.useHref.call(void 0, to, { relative });
|
|
395
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkK3XLKYJIjs.usePrefetchBehavior.call(void 0,
|
|
396
396
|
prefetch,
|
|
397
397
|
rest
|
|
398
398
|
);
|
|
@@ -419,13 +419,13 @@ var Link = React.forwardRef(
|
|
|
419
419
|
...prefetchHandlers,
|
|
420
420
|
href: absoluteHref || href,
|
|
421
421
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
422
|
-
ref:
|
|
422
|
+
ref: _chunkK3XLKYJIjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
423
423
|
target,
|
|
424
424
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
425
425
|
}
|
|
426
426
|
)
|
|
427
427
|
);
|
|
428
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
428
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkK3XLKYJIjs.PrefetchPageLinks, { page: href })) : link;
|
|
429
429
|
}
|
|
430
430
|
);
|
|
431
431
|
Link.displayName = "Link";
|
|
@@ -441,10 +441,10 @@ var NavLink = React.forwardRef(
|
|
|
441
441
|
children,
|
|
442
442
|
...rest
|
|
443
443
|
}, ref) {
|
|
444
|
-
let path =
|
|
445
|
-
let location =
|
|
446
|
-
let routerState = React.useContext(
|
|
447
|
-
let { navigator, basename } = React.useContext(
|
|
444
|
+
let path = _chunkK3XLKYJIjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
445
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
446
|
+
let routerState = React.useContext(_chunkK3XLKYJIjs.DataRouterStateContext);
|
|
447
|
+
let { navigator, basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
448
448
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
449
449
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
450
450
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -457,7 +457,7 @@ var NavLink = React.forwardRef(
|
|
|
457
457
|
toPathname = toPathname.toLowerCase();
|
|
458
458
|
}
|
|
459
459
|
if (nextLocationPathname && basename) {
|
|
460
|
-
nextLocationPathname =
|
|
460
|
+
nextLocationPathname = _chunkK3XLKYJIjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
461
461
|
}
|
|
462
462
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
463
463
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -552,10 +552,10 @@ function ScrollRestoration({
|
|
|
552
552
|
storageKey,
|
|
553
553
|
...props
|
|
554
554
|
}) {
|
|
555
|
-
let remixContext = React.useContext(
|
|
556
|
-
let { basename } = React.useContext(
|
|
557
|
-
let location =
|
|
558
|
-
let matches =
|
|
555
|
+
let remixContext = React.useContext(_chunkK3XLKYJIjs.FrameworkContext);
|
|
556
|
+
let { basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
557
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
558
|
+
let matches = _chunkK3XLKYJIjs.useMatches.call(void 0, );
|
|
559
559
|
useScrollRestoration({ getKey, storageKey });
|
|
560
560
|
let ssrKey = React.useMemo(
|
|
561
561
|
() => {
|
|
@@ -609,13 +609,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
609
609
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
610
610
|
}
|
|
611
611
|
function useDataRouterContext(hookName) {
|
|
612
|
-
let ctx = React.useContext(
|
|
613
|
-
|
|
612
|
+
let ctx = React.useContext(_chunkK3XLKYJIjs.DataRouterContext);
|
|
613
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
614
614
|
return ctx;
|
|
615
615
|
}
|
|
616
616
|
function useDataRouterState(hookName) {
|
|
617
|
-
let state = React.useContext(
|
|
618
|
-
|
|
617
|
+
let state = React.useContext(_chunkK3XLKYJIjs.DataRouterStateContext);
|
|
618
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
619
619
|
return state;
|
|
620
620
|
}
|
|
621
621
|
function useLinkClickHandler(to, {
|
|
@@ -626,14 +626,14 @@ function useLinkClickHandler(to, {
|
|
|
626
626
|
relative,
|
|
627
627
|
viewTransition
|
|
628
628
|
} = {}) {
|
|
629
|
-
let navigate =
|
|
630
|
-
let location =
|
|
631
|
-
let path =
|
|
629
|
+
let navigate = _chunkK3XLKYJIjs.useNavigate.call(void 0, );
|
|
630
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
631
|
+
let path = _chunkK3XLKYJIjs.useResolvedPath.call(void 0, to, { relative });
|
|
632
632
|
return React.useCallback(
|
|
633
633
|
(event) => {
|
|
634
634
|
if (shouldProcessLinkClick(event, target)) {
|
|
635
635
|
event.preventDefault();
|
|
636
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
636
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkK3XLKYJIjs.createPath.call(void 0, location) === _chunkK3XLKYJIjs.createPath.call(void 0, path);
|
|
637
637
|
navigate(to, {
|
|
638
638
|
replace,
|
|
639
639
|
state,
|
|
@@ -658,13 +658,13 @@ function useLinkClickHandler(to, {
|
|
|
658
658
|
);
|
|
659
659
|
}
|
|
660
660
|
function useSearchParams(defaultInit) {
|
|
661
|
-
|
|
661
|
+
_chunkK3XLKYJIjs.warning.call(void 0,
|
|
662
662
|
typeof URLSearchParams !== "undefined",
|
|
663
663
|
`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.`
|
|
664
664
|
);
|
|
665
665
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
666
666
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
667
|
-
let location =
|
|
667
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
668
668
|
let searchParams = React.useMemo(
|
|
669
669
|
() => (
|
|
670
670
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -677,7 +677,7 @@ function useSearchParams(defaultInit) {
|
|
|
677
677
|
),
|
|
678
678
|
[location.search]
|
|
679
679
|
);
|
|
680
|
-
let navigate =
|
|
680
|
+
let navigate = _chunkK3XLKYJIjs.useNavigate.call(void 0, );
|
|
681
681
|
let setSearchParams = React.useCallback(
|
|
682
682
|
(nextInit, navigateOptions) => {
|
|
683
683
|
const newSearchParams = createSearchParams(
|
|
@@ -694,8 +694,8 @@ var fetcherId = 0;
|
|
|
694
694
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
695
695
|
function useSubmit() {
|
|
696
696
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
697
|
-
let { basename } = React.useContext(
|
|
698
|
-
let currentRouteId =
|
|
697
|
+
let { basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
698
|
+
let currentRouteId = _chunkK3XLKYJIjs.useRouteId.call(void 0, );
|
|
699
699
|
return React.useCallback(
|
|
700
700
|
async (target, options = {}) => {
|
|
701
701
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
@@ -731,12 +731,12 @@ function useSubmit() {
|
|
|
731
731
|
);
|
|
732
732
|
}
|
|
733
733
|
function useFormAction(action, { relative } = {}) {
|
|
734
|
-
let { basename } = React.useContext(
|
|
735
|
-
let routeContext = React.useContext(
|
|
736
|
-
|
|
734
|
+
let { basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
735
|
+
let routeContext = React.useContext(_chunkK3XLKYJIjs.RouteContext);
|
|
736
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
737
737
|
let [match] = routeContext.matches.slice(-1);
|
|
738
|
-
let path = { ...
|
|
739
|
-
let location =
|
|
738
|
+
let path = { ..._chunkK3XLKYJIjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
739
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
740
740
|
if (action == null) {
|
|
741
741
|
path.search = location.search;
|
|
742
742
|
let params = new URLSearchParams(path.search);
|
|
@@ -753,21 +753,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
753
753
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
754
754
|
}
|
|
755
755
|
if (basename !== "/") {
|
|
756
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
756
|
+
path.pathname = path.pathname === "/" ? basename : _chunkK3XLKYJIjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
757
757
|
}
|
|
758
|
-
return
|
|
758
|
+
return _chunkK3XLKYJIjs.createPath.call(void 0, path);
|
|
759
759
|
}
|
|
760
760
|
function useFetcher({
|
|
761
761
|
key
|
|
762
762
|
} = {}) {
|
|
763
763
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
764
764
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
765
|
-
let fetcherData = React.useContext(
|
|
766
|
-
let route = React.useContext(
|
|
765
|
+
let fetcherData = React.useContext(_chunkK3XLKYJIjs.FetchersContext);
|
|
766
|
+
let route = React.useContext(_chunkK3XLKYJIjs.RouteContext);
|
|
767
767
|
let routeId = _optionalChain([route, 'access', _21 => _21.matches, 'access', _22 => _22[route.matches.length - 1], 'optionalAccess', _23 => _23.route, 'access', _24 => _24.id]);
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
769
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
770
|
+
_chunkK3XLKYJIjs.invariant.call(void 0,
|
|
771
771
|
routeId != null,
|
|
772
772
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
773
773
|
);
|
|
@@ -782,7 +782,7 @@ function useFetcher({
|
|
|
782
782
|
}, [router, fetcherKey]);
|
|
783
783
|
let load = React.useCallback(
|
|
784
784
|
async (href, opts) => {
|
|
785
|
-
|
|
785
|
+
_chunkK3XLKYJIjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
786
786
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
787
787
|
},
|
|
788
788
|
[fetcherKey, routeId, router]
|
|
@@ -808,7 +808,7 @@ function useFetcher({
|
|
|
808
808
|
FetcherForm2.displayName = "fetcher.Form";
|
|
809
809
|
return FetcherForm2;
|
|
810
810
|
}, [fetcherKey]);
|
|
811
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
811
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkK3XLKYJIjs.IDLE_FETCHER;
|
|
812
812
|
let data = fetcherData.get(fetcherKey);
|
|
813
813
|
let fetcherWithComponents = React.useMemo(
|
|
814
814
|
() => ({
|
|
@@ -839,7 +839,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
839
839
|
key = getKey(
|
|
840
840
|
{
|
|
841
841
|
...location,
|
|
842
|
-
pathname:
|
|
842
|
+
pathname: _chunkK3XLKYJIjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
843
843
|
},
|
|
844
844
|
matches
|
|
845
845
|
);
|
|
@@ -860,10 +860,10 @@ function useScrollRestoration({
|
|
|
860
860
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
861
861
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
862
862
|
);
|
|
863
|
-
let { basename } = React.useContext(
|
|
864
|
-
let location =
|
|
865
|
-
let matches =
|
|
866
|
-
let navigation =
|
|
863
|
+
let { basename } = React.useContext(_chunkK3XLKYJIjs.NavigationContext);
|
|
864
|
+
let location = _chunkK3XLKYJIjs.useLocation.call(void 0, );
|
|
865
|
+
let matches = _chunkK3XLKYJIjs.useMatches.call(void 0, );
|
|
866
|
+
let navigation = _chunkK3XLKYJIjs.useNavigation.call(void 0, );
|
|
867
867
|
React.useEffect(() => {
|
|
868
868
|
window.history.scrollRestoration = "manual";
|
|
869
869
|
return () => {
|
|
@@ -882,7 +882,7 @@ function useScrollRestoration({
|
|
|
882
882
|
JSON.stringify(savedScrollPositions)
|
|
883
883
|
);
|
|
884
884
|
} catch (error) {
|
|
885
|
-
|
|
885
|
+
_chunkK3XLKYJIjs.warning.call(void 0,
|
|
886
886
|
false,
|
|
887
887
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
888
888
|
);
|
|
@@ -929,7 +929,7 @@ function useScrollRestoration({
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
} catch (e2) {
|
|
932
|
-
|
|
932
|
+
_chunkK3XLKYJIjs.warning.call(void 0,
|
|
933
933
|
false,
|
|
934
934
|
`"${location.hash.slice(
|
|
935
935
|
1
|
|
@@ -967,7 +967,7 @@ function usePrompt({
|
|
|
967
967
|
when,
|
|
968
968
|
message
|
|
969
969
|
}) {
|
|
970
|
-
let blocker =
|
|
970
|
+
let blocker = _chunkK3XLKYJIjs.useBlocker.call(void 0, when);
|
|
971
971
|
React.useEffect(() => {
|
|
972
972
|
if (blocker.state === "blocked") {
|
|
973
973
|
let proceed = window.confirm(message);
|
|
@@ -985,21 +985,21 @@ function usePrompt({
|
|
|
985
985
|
}, [blocker, when]);
|
|
986
986
|
}
|
|
987
987
|
function useViewTransitionState(to, { relative } = {}) {
|
|
988
|
-
let vtContext = React.useContext(
|
|
989
|
-
|
|
988
|
+
let vtContext = React.useContext(_chunkK3XLKYJIjs.ViewTransitionContext);
|
|
989
|
+
_chunkK3XLKYJIjs.invariant.call(void 0,
|
|
990
990
|
vtContext != null,
|
|
991
991
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
992
992
|
);
|
|
993
993
|
let { basename } = useDataRouterContext(
|
|
994
994
|
"useViewTransitionState" /* useViewTransitionState */
|
|
995
995
|
);
|
|
996
|
-
let path =
|
|
996
|
+
let path = _chunkK3XLKYJIjs.useResolvedPath.call(void 0, to, { relative });
|
|
997
997
|
if (!vtContext.isTransitioning) {
|
|
998
998
|
return false;
|
|
999
999
|
}
|
|
1000
|
-
let currentPath =
|
|
1001
|
-
let nextPath =
|
|
1002
|
-
return
|
|
1000
|
+
let currentPath = _chunkK3XLKYJIjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1001
|
+
let nextPath = _chunkK3XLKYJIjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1002
|
+
return _chunkK3XLKYJIjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkK3XLKYJIjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
// lib/dom/server.tsx
|
|
@@ -1010,7 +1010,7 @@ function StaticRouter({
|
|
|
1010
1010
|
location: locationProp = "/"
|
|
1011
1011
|
}) {
|
|
1012
1012
|
if (typeof locationProp === "string") {
|
|
1013
|
-
locationProp =
|
|
1013
|
+
locationProp = _chunkK3XLKYJIjs.parsePath.call(void 0, locationProp);
|
|
1014
1014
|
}
|
|
1015
1015
|
let action = "POP" /* Pop */;
|
|
1016
1016
|
let location = {
|
|
@@ -1022,7 +1022,7 @@ function StaticRouter({
|
|
|
1022
1022
|
};
|
|
1023
1023
|
let staticNavigator = getStatelessNavigator();
|
|
1024
1024
|
return /* @__PURE__ */ React2.createElement(
|
|
1025
|
-
|
|
1025
|
+
_chunkK3XLKYJIjs.Router,
|
|
1026
1026
|
{
|
|
1027
1027
|
basename,
|
|
1028
1028
|
children,
|
|
@@ -1039,7 +1039,7 @@ function StaticRouterProvider({
|
|
|
1039
1039
|
hydrate = true,
|
|
1040
1040
|
nonce
|
|
1041
1041
|
}) {
|
|
1042
|
-
|
|
1042
|
+
_chunkK3XLKYJIjs.invariant.call(void 0,
|
|
1043
1043
|
router && context,
|
|
1044
1044
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1045
1045
|
);
|
|
@@ -1062,8 +1062,8 @@ function StaticRouterProvider({
|
|
|
1062
1062
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1063
1063
|
}
|
|
1064
1064
|
let { state } = dataRouterContext.router;
|
|
1065
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1066
|
-
|
|
1065
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkK3XLKYJIjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkK3XLKYJIjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkK3XLKYJIjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkK3XLKYJIjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1066
|
+
_chunkK3XLKYJIjs.Router,
|
|
1067
1067
|
{
|
|
1068
1068
|
basename: dataRouterContext.basename,
|
|
1069
1069
|
location: state.location,
|
|
@@ -1093,14 +1093,14 @@ function DataRoutes({
|
|
|
1093
1093
|
future,
|
|
1094
1094
|
state
|
|
1095
1095
|
}) {
|
|
1096
|
-
return
|
|
1096
|
+
return _chunkK3XLKYJIjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1097
1097
|
}
|
|
1098
1098
|
function serializeErrors(errors) {
|
|
1099
1099
|
if (!errors) return null;
|
|
1100
1100
|
let entries = Object.entries(errors);
|
|
1101
1101
|
let serialized = {};
|
|
1102
1102
|
for (let [key, val] of entries) {
|
|
1103
|
-
if (
|
|
1103
|
+
if (_chunkK3XLKYJIjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1104
1104
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1105
1105
|
} else if (val instanceof Error) {
|
|
1106
1106
|
serialized[key] = {
|
|
@@ -1150,16 +1150,16 @@ function getStatelessNavigator() {
|
|
|
1150
1150
|
};
|
|
1151
1151
|
}
|
|
1152
1152
|
function createStaticHandler2(routes, opts) {
|
|
1153
|
-
return
|
|
1153
|
+
return _chunkK3XLKYJIjs.createStaticHandler.call(void 0, routes, {
|
|
1154
1154
|
...opts,
|
|
1155
|
-
mapRouteProperties:
|
|
1155
|
+
mapRouteProperties: _chunkK3XLKYJIjs.mapRouteProperties
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
1158
1158
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1159
1159
|
let manifest = {};
|
|
1160
|
-
let dataRoutes =
|
|
1160
|
+
let dataRoutes = _chunkK3XLKYJIjs.convertRoutesToDataRoutes.call(void 0,
|
|
1161
1161
|
routes,
|
|
1162
|
-
|
|
1162
|
+
_chunkK3XLKYJIjs.mapRouteProperties,
|
|
1163
1163
|
void 0,
|
|
1164
1164
|
manifest
|
|
1165
1165
|
);
|
|
@@ -1190,7 +1190,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1190
1190
|
actionData: context.actionData,
|
|
1191
1191
|
errors: context.errors,
|
|
1192
1192
|
initialized: true,
|
|
1193
|
-
navigation:
|
|
1193
|
+
navigation: _chunkK3XLKYJIjs.IDLE_NAVIGATION,
|
|
1194
1194
|
restoreScrollPosition: null,
|
|
1195
1195
|
preventScrollReset: false,
|
|
1196
1196
|
revalidation: "idle",
|
|
@@ -1225,7 +1225,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1225
1225
|
createHref,
|
|
1226
1226
|
encodeLocation,
|
|
1227
1227
|
getFetcher() {
|
|
1228
|
-
return
|
|
1228
|
+
return _chunkK3XLKYJIjs.IDLE_FETCHER;
|
|
1229
1229
|
},
|
|
1230
1230
|
deleteFetcher() {
|
|
1231
1231
|
throw msg("deleteFetcher");
|
|
@@ -1237,7 +1237,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1237
1237
|
throw msg("dispose");
|
|
1238
1238
|
},
|
|
1239
1239
|
getBlocker() {
|
|
1240
|
-
return
|
|
1240
|
+
return _chunkK3XLKYJIjs.IDLE_BLOCKER;
|
|
1241
1241
|
},
|
|
1242
1242
|
deleteBlocker() {
|
|
1243
1243
|
throw msg("deleteBlocker");
|
|
@@ -1255,10 +1255,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
1257
|
function createHref(to) {
|
|
1258
|
-
return typeof to === "string" ? to :
|
|
1258
|
+
return typeof to === "string" ? to : _chunkK3XLKYJIjs.createPath.call(void 0, to);
|
|
1259
1259
|
}
|
|
1260
1260
|
function encodeLocation(to) {
|
|
1261
|
-
let href = typeof to === "string" ? to :
|
|
1261
|
+
let href = typeof to === "string" ? to : _chunkK3XLKYJIjs.createPath.call(void 0, to);
|
|
1262
1262
|
href = href.replace(/ $/, "%20");
|
|
1263
1263
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1264
1264
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-de3b900
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -6735,10 +6735,11 @@ function useRoute(...args) {
|
|
|
6735
6735
|
"useRoute" /* UseRoute */
|
|
6736
6736
|
);
|
|
6737
6737
|
const id = _nullishCoalesce(args[0], () => ( currentRouteId));
|
|
6738
|
-
const state = useDataRouterState("
|
|
6738
|
+
const state = useDataRouterState("useRoute" /* UseRoute */);
|
|
6739
6739
|
const route = state.matches.find(({ route: route2 }) => route2.id === id);
|
|
6740
6740
|
if (route === void 0) return void 0;
|
|
6741
6741
|
return {
|
|
6742
|
+
handle: route.route.handle,
|
|
6742
6743
|
loaderData: state.loaderData[id],
|
|
6743
6744
|
actionData: _optionalChain([state, 'access', _79 => _79.actionData, 'optionalAccess', _80 => _80[id]])
|
|
6744
6745
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-de3b900
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -5557,10 +5557,11 @@ function useRoute(...args) {
|
|
|
5557
5557
|
"useRoute" /* UseRoute */
|
|
5558
5558
|
);
|
|
5559
5559
|
const id = args[0] ?? currentRouteId;
|
|
5560
|
-
const state = useDataRouterState("
|
|
5560
|
+
const state = useDataRouterState("useRoute" /* UseRoute */);
|
|
5561
5561
|
const route = state.matches.find(({ route: route2 }) => route2.id === id);
|
|
5562
5562
|
if (route === void 0) return void 0;
|
|
5563
5563
|
return {
|
|
5564
|
+
handle: route.route.handle,
|
|
5564
5565
|
loaderData: state.loaderData[id],
|
|
5565
5566
|
actionData: state.actionData?.[id]
|
|
5566
5567
|
};
|
|
@@ -9126,7 +9127,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
9126
9127
|
try {
|
|
9127
9128
|
if (isBrowser) {
|
|
9128
9129
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9129
|
-
"0.0.0-experimental-
|
|
9130
|
+
"0.0.0-experimental-de3b900";
|
|
9130
9131
|
}
|
|
9131
9132
|
} catch (e) {
|
|
9132
9133
|
}
|