react-router 0.0.0-experimental-3cde40396 → 0.0.0-experimental-6f53aff26
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-Q7OYBJ3O.mjs → chunk-2E5FN2U7.mjs} +2 -2
- package/dist/development/{chunk-4DEXIV77.js → chunk-4ERTXQOW.js} +93 -93
- package/dist/development/{chunk-GON545UX.mjs → chunk-NZ3DMRWE.mjs} +2 -2
- package/dist/development/{chunk-KPWUG3WN.js → chunk-U7IKLSRU.js} +1 -1
- package/dist/{production/chunk-FR2NDPWQ.js → development/chunk-VCKRWKKE.js} +7 -7
- package/dist/development/dom-export.js +27 -27
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.js +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/production/{chunk-5SH4UKJL.mjs → chunk-4DVCHN2G.mjs} +2 -2
- package/dist/{development/chunk-FOH5TLLB.js → production/chunk-G4JHZGJK.js} +7 -7
- package/dist/production/{chunk-3OSNUNWR.js → chunk-JR6RUNUQ.js} +93 -93
- package/dist/production/{chunk-UYLN26NU.mjs → chunk-LY2I5ZG2.mjs} +2 -2
- package/dist/production/{chunk-OEZTISH7.js → chunk-ZA5RD5W3.js} +1 -1
- package/dist/production/dom-export.js +27 -27
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.js +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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-6f53aff26
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -9605,7 +9605,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
9605
9605
|
try {
|
|
9606
9606
|
if (isBrowser2) {
|
|
9607
9607
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9608
|
-
"0.0.0-experimental-
|
|
9608
|
+
"0.0.0-experimental-6f53aff26";
|
|
9609
9609
|
}
|
|
9610
9610
|
} catch (e) {
|
|
9611
9611
|
}
|
|
@@ -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-6f53aff26
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var _chunkU7IKLSRUjs = require('./chunk-U7IKLSRU.js');
|
|
53
53
|
|
|
54
54
|
// lib/dom/dom.ts
|
|
55
55
|
var defaultMethod = "get";
|
|
@@ -120,7 +120,7 @@ var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
|
120
120
|
]);
|
|
121
121
|
function getFormEncType(encType) {
|
|
122
122
|
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
123
|
-
|
|
123
|
+
_chunkU7IKLSRUjs.warning.call(void 0,
|
|
124
124
|
false,
|
|
125
125
|
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
126
126
|
);
|
|
@@ -136,7 +136,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
136
136
|
let body;
|
|
137
137
|
if (isFormElement(target)) {
|
|
138
138
|
let attr = target.getAttribute("action");
|
|
139
|
-
action = attr ?
|
|
139
|
+
action = attr ? _chunkU7IKLSRUjs.stripBasename.call(void 0, attr, basename) : null;
|
|
140
140
|
method = target.getAttribute("method") || defaultMethod;
|
|
141
141
|
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
142
142
|
formData = new FormData(target);
|
|
@@ -148,7 +148,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
151
|
-
action = attr ?
|
|
151
|
+
action = attr ? _chunkU7IKLSRUjs.stripBasename.call(void 0, attr, basename) : null;
|
|
152
152
|
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
153
153
|
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
154
154
|
formData = new FormData(form, target);
|
|
@@ -185,20 +185,20 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
185
185
|
try {
|
|
186
186
|
if (isBrowser) {
|
|
187
187
|
window.__reactRouterVersion = // @ts-expect-error
|
|
188
|
-
"0.0.0-experimental-
|
|
188
|
+
"0.0.0-experimental-6f53aff26";
|
|
189
189
|
}
|
|
190
190
|
} catch (e) {
|
|
191
191
|
}
|
|
192
192
|
function createBrowserRouter(routes, opts) {
|
|
193
|
-
return
|
|
193
|
+
return _chunkU7IKLSRUjs.createRouter.call(void 0, {
|
|
194
194
|
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
195
195
|
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
196
196
|
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
197
|
-
history:
|
|
197
|
+
history: _chunkU7IKLSRUjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
198
198
|
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
199
199
|
routes,
|
|
200
|
-
mapRouteProperties:
|
|
201
|
-
hydrationRouteProperties:
|
|
200
|
+
mapRouteProperties: _chunkU7IKLSRUjs.mapRouteProperties,
|
|
201
|
+
hydrationRouteProperties: _chunkU7IKLSRUjs.hydrationRouteProperties,
|
|
202
202
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
203
203
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
204
204
|
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
@@ -206,15 +206,15 @@ function createBrowserRouter(routes, opts) {
|
|
|
206
206
|
}).initialize();
|
|
207
207
|
}
|
|
208
208
|
function createHashRouter(routes, opts) {
|
|
209
|
-
return
|
|
209
|
+
return _chunkU7IKLSRUjs.createRouter.call(void 0, {
|
|
210
210
|
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
211
211
|
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
212
212
|
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
213
|
-
history:
|
|
213
|
+
history: _chunkU7IKLSRUjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
214
214
|
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
215
215
|
routes,
|
|
216
|
-
mapRouteProperties:
|
|
217
|
-
hydrationRouteProperties:
|
|
216
|
+
mapRouteProperties: _chunkU7IKLSRUjs.mapRouteProperties,
|
|
217
|
+
hydrationRouteProperties: _chunkU7IKLSRUjs.hydrationRouteProperties,
|
|
218
218
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
219
219
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
220
220
|
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
@@ -237,7 +237,7 @@ function deserializeErrors(errors) {
|
|
|
237
237
|
let serialized = {};
|
|
238
238
|
for (let [key, val] of entries) {
|
|
239
239
|
if (val && val.__type === "RouteErrorResponse") {
|
|
240
|
-
serialized[key] = new (0,
|
|
240
|
+
serialized[key] = new (0, _chunkU7IKLSRUjs.ErrorResponseImpl)(
|
|
241
241
|
val.status,
|
|
242
242
|
val.statusText,
|
|
243
243
|
val.data,
|
|
@@ -274,7 +274,7 @@ function BrowserRouter({
|
|
|
274
274
|
}) {
|
|
275
275
|
let historyRef = React.useRef();
|
|
276
276
|
if (historyRef.current == null) {
|
|
277
|
-
historyRef.current =
|
|
277
|
+
historyRef.current = _chunkU7IKLSRUjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
278
278
|
}
|
|
279
279
|
let history = historyRef.current;
|
|
280
280
|
let [state, setStateImpl] = React.useState({
|
|
@@ -293,7 +293,7 @@ function BrowserRouter({
|
|
|
293
293
|
);
|
|
294
294
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
295
295
|
return /* @__PURE__ */ React.createElement(
|
|
296
|
-
|
|
296
|
+
_chunkU7IKLSRUjs.Router,
|
|
297
297
|
{
|
|
298
298
|
basename,
|
|
299
299
|
children,
|
|
@@ -312,7 +312,7 @@ function HashRouter({
|
|
|
312
312
|
}) {
|
|
313
313
|
let historyRef = React.useRef();
|
|
314
314
|
if (historyRef.current == null) {
|
|
315
|
-
historyRef.current =
|
|
315
|
+
historyRef.current = _chunkU7IKLSRUjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
316
316
|
}
|
|
317
317
|
let history = historyRef.current;
|
|
318
318
|
let [state, setStateImpl] = React.useState({
|
|
@@ -331,7 +331,7 @@ function HashRouter({
|
|
|
331
331
|
);
|
|
332
332
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
333
333
|
return /* @__PURE__ */ React.createElement(
|
|
334
|
-
|
|
334
|
+
_chunkU7IKLSRUjs.Router,
|
|
335
335
|
{
|
|
336
336
|
basename,
|
|
337
337
|
children,
|
|
@@ -364,7 +364,7 @@ function HistoryRouter({
|
|
|
364
364
|
);
|
|
365
365
|
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
366
366
|
return /* @__PURE__ */ React.createElement(
|
|
367
|
-
|
|
367
|
+
_chunkU7IKLSRUjs.Router,
|
|
368
368
|
{
|
|
369
369
|
basename,
|
|
370
370
|
children,
|
|
@@ -392,12 +392,12 @@ var Link = React.forwardRef(
|
|
|
392
392
|
viewTransition,
|
|
393
393
|
...rest
|
|
394
394
|
}, forwardedRef) {
|
|
395
|
-
let { basename, unstable_useTransitions } = React.useContext(
|
|
395
|
+
let { basename, unstable_useTransitions } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
396
396
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
397
|
-
let parsed =
|
|
397
|
+
let parsed = _chunkU7IKLSRUjs.parseToInfo.call(void 0, to, basename);
|
|
398
398
|
to = parsed.to;
|
|
399
|
-
let href =
|
|
400
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
399
|
+
let href = _chunkU7IKLSRUjs.useHref.call(void 0, to, { relative });
|
|
400
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkU7IKLSRUjs.usePrefetchBehavior.call(void 0,
|
|
401
401
|
prefetch,
|
|
402
402
|
rest
|
|
403
403
|
);
|
|
@@ -425,13 +425,13 @@ var Link = React.forwardRef(
|
|
|
425
425
|
...prefetchHandlers,
|
|
426
426
|
href: parsed.absoluteURL || href,
|
|
427
427
|
onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
|
|
428
|
-
ref:
|
|
428
|
+
ref: _chunkU7IKLSRUjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
429
429
|
target,
|
|
430
430
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
431
431
|
}
|
|
432
432
|
)
|
|
433
433
|
);
|
|
434
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
434
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkU7IKLSRUjs.PrefetchPageLinks, { page: href })) : link;
|
|
435
435
|
}
|
|
436
436
|
);
|
|
437
437
|
Link.displayName = "Link";
|
|
@@ -447,10 +447,10 @@ var NavLink = React.forwardRef(
|
|
|
447
447
|
children,
|
|
448
448
|
...rest
|
|
449
449
|
}, ref) {
|
|
450
|
-
let path =
|
|
451
|
-
let location =
|
|
452
|
-
let routerState = React.useContext(
|
|
453
|
-
let { navigator, basename } = React.useContext(
|
|
450
|
+
let path = _chunkU7IKLSRUjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
451
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
452
|
+
let routerState = React.useContext(_chunkU7IKLSRUjs.DataRouterStateContext);
|
|
453
|
+
let { navigator, basename } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
454
454
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
455
455
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
456
456
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -463,7 +463,7 @@ var NavLink = React.forwardRef(
|
|
|
463
463
|
toPathname = toPathname.toLowerCase();
|
|
464
464
|
}
|
|
465
465
|
if (nextLocationPathname && basename) {
|
|
466
|
-
nextLocationPathname =
|
|
466
|
+
nextLocationPathname = _chunkU7IKLSRUjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
467
467
|
}
|
|
468
468
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
469
469
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -518,7 +518,7 @@ var Form = React.forwardRef(
|
|
|
518
518
|
viewTransition,
|
|
519
519
|
...props
|
|
520
520
|
}, forwardedRef) => {
|
|
521
|
-
let { unstable_useTransitions } = React.useContext(
|
|
521
|
+
let { unstable_useTransitions } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
522
522
|
let submit = useSubmit();
|
|
523
523
|
let formAction = useFormAction(action, { relative });
|
|
524
524
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -564,10 +564,10 @@ function ScrollRestoration({
|
|
|
564
564
|
storageKey,
|
|
565
565
|
...props
|
|
566
566
|
}) {
|
|
567
|
-
let remixContext = React.useContext(
|
|
568
|
-
let { basename } = React.useContext(
|
|
569
|
-
let location =
|
|
570
|
-
let matches =
|
|
567
|
+
let remixContext = React.useContext(_chunkU7IKLSRUjs.FrameworkContext);
|
|
568
|
+
let { basename } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
569
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
570
|
+
let matches = _chunkU7IKLSRUjs.useMatches.call(void 0, );
|
|
571
571
|
useScrollRestoration({ getKey, storageKey });
|
|
572
572
|
let ssrKey = React.useMemo(
|
|
573
573
|
() => {
|
|
@@ -621,13 +621,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
621
621
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
622
622
|
}
|
|
623
623
|
function useDataRouterContext(hookName) {
|
|
624
|
-
let ctx = React.useContext(
|
|
625
|
-
|
|
624
|
+
let ctx = React.useContext(_chunkU7IKLSRUjs.DataRouterContext);
|
|
625
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
626
626
|
return ctx;
|
|
627
627
|
}
|
|
628
628
|
function useDataRouterState(hookName) {
|
|
629
|
-
let state = React.useContext(
|
|
630
|
-
|
|
629
|
+
let state = React.useContext(_chunkU7IKLSRUjs.DataRouterStateContext);
|
|
630
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
631
631
|
return state;
|
|
632
632
|
}
|
|
633
633
|
function useLinkClickHandler(to, {
|
|
@@ -639,14 +639,14 @@ function useLinkClickHandler(to, {
|
|
|
639
639
|
viewTransition,
|
|
640
640
|
unstable_useTransitions
|
|
641
641
|
} = {}) {
|
|
642
|
-
let navigate =
|
|
643
|
-
let location =
|
|
644
|
-
let path =
|
|
642
|
+
let navigate = _chunkU7IKLSRUjs.useNavigate.call(void 0, );
|
|
643
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
644
|
+
let path = _chunkU7IKLSRUjs.useResolvedPath.call(void 0, to, { relative });
|
|
645
645
|
return React.useCallback(
|
|
646
646
|
(event) => {
|
|
647
647
|
if (shouldProcessLinkClick(event, target)) {
|
|
648
648
|
event.preventDefault();
|
|
649
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
649
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkU7IKLSRUjs.createPath.call(void 0, location) === _chunkU7IKLSRUjs.createPath.call(void 0, path);
|
|
650
650
|
let doNavigate = () => navigate(to, {
|
|
651
651
|
replace,
|
|
652
652
|
state,
|
|
@@ -677,13 +677,13 @@ function useLinkClickHandler(to, {
|
|
|
677
677
|
);
|
|
678
678
|
}
|
|
679
679
|
function useSearchParams(defaultInit) {
|
|
680
|
-
|
|
680
|
+
_chunkU7IKLSRUjs.warning.call(void 0,
|
|
681
681
|
typeof URLSearchParams !== "undefined",
|
|
682
682
|
`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.`
|
|
683
683
|
);
|
|
684
684
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
685
685
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
686
|
-
let location =
|
|
686
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
687
687
|
let searchParams = React.useMemo(
|
|
688
688
|
() => (
|
|
689
689
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -696,7 +696,7 @@ function useSearchParams(defaultInit) {
|
|
|
696
696
|
),
|
|
697
697
|
[location.search]
|
|
698
698
|
);
|
|
699
|
-
let navigate =
|
|
699
|
+
let navigate = _chunkU7IKLSRUjs.useNavigate.call(void 0, );
|
|
700
700
|
let setSearchParams = React.useCallback(
|
|
701
701
|
(nextInit, navigateOptions) => {
|
|
702
702
|
const newSearchParams = createSearchParams(
|
|
@@ -713,8 +713,8 @@ var fetcherId = 0;
|
|
|
713
713
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
714
714
|
function useSubmit() {
|
|
715
715
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
716
|
-
let { basename } = React.useContext(
|
|
717
|
-
let currentRouteId =
|
|
716
|
+
let { basename } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
717
|
+
let currentRouteId = _chunkU7IKLSRUjs.useRouteId.call(void 0, );
|
|
718
718
|
let routerFetch = router.fetch;
|
|
719
719
|
let routerNavigate = router.navigate;
|
|
720
720
|
return React.useCallback(
|
|
@@ -752,12 +752,12 @@ function useSubmit() {
|
|
|
752
752
|
);
|
|
753
753
|
}
|
|
754
754
|
function useFormAction(action, { relative } = {}) {
|
|
755
|
-
let { basename } = React.useContext(
|
|
756
|
-
let routeContext = React.useContext(
|
|
757
|
-
|
|
755
|
+
let { basename } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
756
|
+
let routeContext = React.useContext(_chunkU7IKLSRUjs.RouteContext);
|
|
757
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
758
758
|
let [match] = routeContext.matches.slice(-1);
|
|
759
|
-
let path = { ...
|
|
760
|
-
let location =
|
|
759
|
+
let path = { ..._chunkU7IKLSRUjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
760
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
761
761
|
if (action == null) {
|
|
762
762
|
path.search = location.search;
|
|
763
763
|
let params = new URLSearchParams(path.search);
|
|
@@ -774,21 +774,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
774
774
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
775
775
|
}
|
|
776
776
|
if (basename !== "/") {
|
|
777
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
777
|
+
path.pathname = path.pathname === "/" ? basename : _chunkU7IKLSRUjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
778
778
|
}
|
|
779
|
-
return
|
|
779
|
+
return _chunkU7IKLSRUjs.createPath.call(void 0, path);
|
|
780
780
|
}
|
|
781
781
|
function useFetcher({
|
|
782
782
|
key
|
|
783
783
|
} = {}) {
|
|
784
784
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
785
785
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
786
|
-
let fetcherData = React.useContext(
|
|
787
|
-
let route = React.useContext(
|
|
786
|
+
let fetcherData = React.useContext(_chunkU7IKLSRUjs.FetchersContext);
|
|
787
|
+
let route = React.useContext(_chunkU7IKLSRUjs.RouteContext);
|
|
788
788
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
790
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
791
|
+
_chunkU7IKLSRUjs.invariant.call(void 0,
|
|
792
792
|
routeId != null,
|
|
793
793
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
794
794
|
);
|
|
@@ -804,7 +804,7 @@ function useFetcher({
|
|
|
804
804
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
805
805
|
let load = React.useCallback(
|
|
806
806
|
async (href, opts) => {
|
|
807
|
-
|
|
807
|
+
_chunkU7IKLSRUjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
808
808
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
809
809
|
},
|
|
810
810
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -833,7 +833,7 @@ function useFetcher({
|
|
|
833
833
|
FetcherForm2.displayName = "fetcher.Form";
|
|
834
834
|
return FetcherForm2;
|
|
835
835
|
}, [fetcherKey]);
|
|
836
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
836
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkU7IKLSRUjs.IDLE_FETCHER;
|
|
837
837
|
let data = fetcherData.get(fetcherKey);
|
|
838
838
|
let fetcherWithComponents = React.useMemo(
|
|
839
839
|
() => ({
|
|
@@ -864,7 +864,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
864
864
|
key = getKey(
|
|
865
865
|
{
|
|
866
866
|
...location,
|
|
867
|
-
pathname:
|
|
867
|
+
pathname: _chunkU7IKLSRUjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
868
868
|
},
|
|
869
869
|
matches
|
|
870
870
|
);
|
|
@@ -885,10 +885,10 @@ function useScrollRestoration({
|
|
|
885
885
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
886
886
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
887
887
|
);
|
|
888
|
-
let { basename } = React.useContext(
|
|
889
|
-
let location =
|
|
890
|
-
let matches =
|
|
891
|
-
let navigation =
|
|
888
|
+
let { basename } = React.useContext(_chunkU7IKLSRUjs.NavigationContext);
|
|
889
|
+
let location = _chunkU7IKLSRUjs.useLocation.call(void 0, );
|
|
890
|
+
let matches = _chunkU7IKLSRUjs.useMatches.call(void 0, );
|
|
891
|
+
let navigation = _chunkU7IKLSRUjs.useNavigation.call(void 0, );
|
|
892
892
|
React.useEffect(() => {
|
|
893
893
|
window.history.scrollRestoration = "manual";
|
|
894
894
|
return () => {
|
|
@@ -907,7 +907,7 @@ function useScrollRestoration({
|
|
|
907
907
|
JSON.stringify(savedScrollPositions)
|
|
908
908
|
);
|
|
909
909
|
} catch (error) {
|
|
910
|
-
|
|
910
|
+
_chunkU7IKLSRUjs.warning.call(void 0,
|
|
911
911
|
false,
|
|
912
912
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
913
913
|
);
|
|
@@ -954,7 +954,7 @@ function useScrollRestoration({
|
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
} catch (e2) {
|
|
957
|
-
|
|
957
|
+
_chunkU7IKLSRUjs.warning.call(void 0,
|
|
958
958
|
false,
|
|
959
959
|
`"${location.hash.slice(
|
|
960
960
|
1
|
|
@@ -992,7 +992,7 @@ function usePrompt({
|
|
|
992
992
|
when,
|
|
993
993
|
message
|
|
994
994
|
}) {
|
|
995
|
-
let blocker =
|
|
995
|
+
let blocker = _chunkU7IKLSRUjs.useBlocker.call(void 0, when);
|
|
996
996
|
React.useEffect(() => {
|
|
997
997
|
if (blocker.state === "blocked") {
|
|
998
998
|
let proceed = window.confirm(message);
|
|
@@ -1010,21 +1010,21 @@ function usePrompt({
|
|
|
1010
1010
|
}, [blocker, when]);
|
|
1011
1011
|
}
|
|
1012
1012
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1013
|
-
let vtContext = React.useContext(
|
|
1014
|
-
|
|
1013
|
+
let vtContext = React.useContext(_chunkU7IKLSRUjs.ViewTransitionContext);
|
|
1014
|
+
_chunkU7IKLSRUjs.invariant.call(void 0,
|
|
1015
1015
|
vtContext != null,
|
|
1016
1016
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1017
1017
|
);
|
|
1018
1018
|
let { basename } = useDataRouterContext(
|
|
1019
1019
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1020
1020
|
);
|
|
1021
|
-
let path =
|
|
1021
|
+
let path = _chunkU7IKLSRUjs.useResolvedPath.call(void 0, to, { relative });
|
|
1022
1022
|
if (!vtContext.isTransitioning) {
|
|
1023
1023
|
return false;
|
|
1024
1024
|
}
|
|
1025
|
-
let currentPath =
|
|
1026
|
-
let nextPath =
|
|
1027
|
-
return
|
|
1025
|
+
let currentPath = _chunkU7IKLSRUjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1026
|
+
let nextPath = _chunkU7IKLSRUjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1027
|
+
return _chunkU7IKLSRUjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkU7IKLSRUjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
// lib/dom/server.tsx
|
|
@@ -1035,7 +1035,7 @@ function StaticRouter({
|
|
|
1035
1035
|
location: locationProp = "/"
|
|
1036
1036
|
}) {
|
|
1037
1037
|
if (typeof locationProp === "string") {
|
|
1038
|
-
locationProp =
|
|
1038
|
+
locationProp = _chunkU7IKLSRUjs.parsePath.call(void 0, locationProp);
|
|
1039
1039
|
}
|
|
1040
1040
|
let action = "POP" /* Pop */;
|
|
1041
1041
|
let location = {
|
|
@@ -1047,7 +1047,7 @@ function StaticRouter({
|
|
|
1047
1047
|
};
|
|
1048
1048
|
let staticNavigator = getStatelessNavigator();
|
|
1049
1049
|
return /* @__PURE__ */ React2.createElement(
|
|
1050
|
-
|
|
1050
|
+
_chunkU7IKLSRUjs.Router,
|
|
1051
1051
|
{
|
|
1052
1052
|
basename,
|
|
1053
1053
|
children,
|
|
@@ -1065,7 +1065,7 @@ function StaticRouterProvider({
|
|
|
1065
1065
|
hydrate = true,
|
|
1066
1066
|
nonce
|
|
1067
1067
|
}) {
|
|
1068
|
-
|
|
1068
|
+
_chunkU7IKLSRUjs.invariant.call(void 0,
|
|
1069
1069
|
router && context,
|
|
1070
1070
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1071
1071
|
);
|
|
@@ -1088,8 +1088,8 @@ function StaticRouterProvider({
|
|
|
1088
1088
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1089
1089
|
}
|
|
1090
1090
|
let { state } = dataRouterContext.router;
|
|
1091
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1092
|
-
|
|
1091
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkU7IKLSRUjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkU7IKLSRUjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkU7IKLSRUjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkU7IKLSRUjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1092
|
+
_chunkU7IKLSRUjs.Router,
|
|
1093
1093
|
{
|
|
1094
1094
|
basename: dataRouterContext.basename,
|
|
1095
1095
|
location: state.location,
|
|
@@ -1120,14 +1120,14 @@ function DataRoutes({
|
|
|
1120
1120
|
future,
|
|
1121
1121
|
state
|
|
1122
1122
|
}) {
|
|
1123
|
-
return
|
|
1123
|
+
return _chunkU7IKLSRUjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1124
1124
|
}
|
|
1125
1125
|
function serializeErrors(errors) {
|
|
1126
1126
|
if (!errors) return null;
|
|
1127
1127
|
let entries = Object.entries(errors);
|
|
1128
1128
|
let serialized = {};
|
|
1129
1129
|
for (let [key, val] of entries) {
|
|
1130
|
-
if (
|
|
1130
|
+
if (_chunkU7IKLSRUjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1131
1131
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1132
1132
|
} else if (val instanceof Error) {
|
|
1133
1133
|
serialized[key] = {
|
|
@@ -1177,16 +1177,16 @@ function getStatelessNavigator() {
|
|
|
1177
1177
|
};
|
|
1178
1178
|
}
|
|
1179
1179
|
function createStaticHandler2(routes, opts) {
|
|
1180
|
-
return
|
|
1180
|
+
return _chunkU7IKLSRUjs.createStaticHandler.call(void 0, routes, {
|
|
1181
1181
|
...opts,
|
|
1182
|
-
mapRouteProperties:
|
|
1182
|
+
mapRouteProperties: _chunkU7IKLSRUjs.mapRouteProperties
|
|
1183
1183
|
});
|
|
1184
1184
|
}
|
|
1185
1185
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1186
1186
|
let manifest = {};
|
|
1187
|
-
let dataRoutes =
|
|
1187
|
+
let dataRoutes = _chunkU7IKLSRUjs.convertRoutesToDataRoutes.call(void 0,
|
|
1188
1188
|
routes,
|
|
1189
|
-
|
|
1189
|
+
_chunkU7IKLSRUjs.mapRouteProperties,
|
|
1190
1190
|
void 0,
|
|
1191
1191
|
manifest
|
|
1192
1192
|
);
|
|
@@ -1217,7 +1217,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1217
1217
|
actionData: context.actionData,
|
|
1218
1218
|
errors: context.errors,
|
|
1219
1219
|
initialized: true,
|
|
1220
|
-
navigation:
|
|
1220
|
+
navigation: _chunkU7IKLSRUjs.IDLE_NAVIGATION,
|
|
1221
1221
|
restoreScrollPosition: null,
|
|
1222
1222
|
preventScrollReset: false,
|
|
1223
1223
|
revalidation: "idle",
|
|
@@ -1252,7 +1252,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1252
1252
|
createHref,
|
|
1253
1253
|
encodeLocation,
|
|
1254
1254
|
getFetcher() {
|
|
1255
|
-
return
|
|
1255
|
+
return _chunkU7IKLSRUjs.IDLE_FETCHER;
|
|
1256
1256
|
},
|
|
1257
1257
|
deleteFetcher() {
|
|
1258
1258
|
throw msg("deleteFetcher");
|
|
@@ -1264,7 +1264,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1264
1264
|
throw msg("dispose");
|
|
1265
1265
|
},
|
|
1266
1266
|
getBlocker() {
|
|
1267
|
-
return
|
|
1267
|
+
return _chunkU7IKLSRUjs.IDLE_BLOCKER;
|
|
1268
1268
|
},
|
|
1269
1269
|
deleteBlocker() {
|
|
1270
1270
|
throw msg("deleteBlocker");
|
|
@@ -1282,10 +1282,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1282
1282
|
};
|
|
1283
1283
|
}
|
|
1284
1284
|
function createHref(to) {
|
|
1285
|
-
return typeof to === "string" ? to :
|
|
1285
|
+
return typeof to === "string" ? to : _chunkU7IKLSRUjs.createPath.call(void 0, to);
|
|
1286
1286
|
}
|
|
1287
1287
|
function encodeLocation(to) {
|
|
1288
|
-
let href = typeof to === "string" ? to :
|
|
1288
|
+
let href = typeof to === "string" ? to : _chunkU7IKLSRUjs.createPath.call(void 0, to);
|
|
1289
1289
|
href = href.replace(/ $/, "%20");
|
|
1290
1290
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1291
1291
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-6f53aff26
|
|
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-2E5FN2U7.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 _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-6f53aff26
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -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-6f53aff26
|
|
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 _chunkU7IKLSRUjs = require('./chunk-U7IKLSRU.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 = _chunkU7IKLSRUjs.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 (_chunkU7IKLSRUjs.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 (_chunkU7IKLSRUjs.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
|
+
_chunkU7IKLSRUjs.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 = _chunkU7IKLSRUjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|