react-router 7.11.0-pre.0 → 7.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -3
- package/dist/{production/chunk-M5W3Q3T5.js → development/chunk-2JY4UAJA.js} +93 -93
- package/dist/{production/chunk-YGB3JEIP.js → development/chunk-GNDLROV6.js} +7 -7
- package/dist/development/{chunk-KRMLYMWA.mjs → chunk-JMJ3UQ3L.mjs} +2 -2
- package/dist/development/{chunk-UO7KGW2U.js → chunk-SZQUWNVJ.js} +1 -1
- package/dist/{production/chunk-J4JITZ76.mjs → development/chunk-YNUBSHFH.mjs} +2 -2
- 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-AO22ZXHI.js → chunk-2HFJAX7U.js} +1 -1
- package/dist/{development/chunk-OVG6YSZ5.js → production/chunk-BEXOWXJO.js} +7 -7
- package/dist/{development/chunk-QMKP6CC3.mjs → production/chunk-E6GYEQUT.mjs} +2 -2
- package/dist/production/{chunk-IDHO4Q57.mjs → chunk-TINMVEA2.mjs} +2 -2
- package/dist/{development/chunk-JKMHOZYW.js → production/chunk-ZMYPVUNZ.js} +93 -93
- 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
|
"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 v7.11.0
|
|
2
|
+
* react-router v7.11.0
|
|
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 v7.11.0
|
|
2
|
+
* react-router v7.11.0
|
|
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 _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.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 = _chunk2HFJAX7Ujs.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 (_chunk2HFJAX7Ujs.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 (_chunk2HFJAX7Ujs.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
|
+
_chunk2HFJAX7Ujs.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 = _chunk2HFJAX7Ujs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.11.0
|
|
2
|
+
* react-router v7.11.0
|
|
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-TINMVEA2.mjs";
|
|
55
55
|
|
|
56
56
|
// lib/dom/ssr/server.tsx
|
|
57
57
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.11.0
|
|
2
|
+
* react-router v7.11.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -9649,7 +9649,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
9649
9649
|
try {
|
|
9650
9650
|
if (isBrowser2) {
|
|
9651
9651
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9652
|
-
"7.11.0
|
|
9652
|
+
"7.11.0";
|
|
9653
9653
|
}
|
|
9654
9654
|
} catch (e) {
|
|
9655
9655
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.11.0
|
|
2
|
+
* react-router v7.11.0
|
|
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 _chunk2HFJAX7Ujs = require('./chunk-2HFJAX7U.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
|
+
_chunk2HFJAX7Ujs.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 ? _chunk2HFJAX7Ujs.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 ? _chunk2HFJAX7Ujs.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
|
-
"7.11.0
|
|
188
|
+
"7.11.0";
|
|
189
189
|
}
|
|
190
190
|
} catch (e) {
|
|
191
191
|
}
|
|
192
192
|
function createBrowserRouter(routes, opts) {
|
|
193
|
-
return
|
|
193
|
+
return _chunk2HFJAX7Ujs.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: _chunk2HFJAX7Ujs.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: _chunk2HFJAX7Ujs.mapRouteProperties,
|
|
201
|
+
hydrationRouteProperties: _chunk2HFJAX7Ujs.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 _chunk2HFJAX7Ujs.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: _chunk2HFJAX7Ujs.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: _chunk2HFJAX7Ujs.mapRouteProperties,
|
|
217
|
+
hydrationRouteProperties: _chunk2HFJAX7Ujs.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, _chunk2HFJAX7Ujs.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 = _chunk2HFJAX7Ujs.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
|
+
_chunk2HFJAX7Ujs.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 = _chunk2HFJAX7Ujs.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
|
+
_chunk2HFJAX7Ujs.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
|
+
_chunk2HFJAX7Ujs.Router,
|
|
368
368
|
{
|
|
369
369
|
basename,
|
|
370
370
|
children,
|
|
@@ -393,12 +393,12 @@ var Link = React.forwardRef(
|
|
|
393
393
|
unstable_defaultShouldRevalidate,
|
|
394
394
|
...rest
|
|
395
395
|
}, forwardedRef) {
|
|
396
|
-
let { basename, unstable_useTransitions } = React.useContext(
|
|
396
|
+
let { basename, unstable_useTransitions } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
397
397
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
398
|
-
let parsed =
|
|
398
|
+
let parsed = _chunk2HFJAX7Ujs.parseToInfo.call(void 0, to, basename);
|
|
399
399
|
to = parsed.to;
|
|
400
|
-
let href =
|
|
401
|
-
let [shouldPrefetch, prefetchRef, prefetchHandlers] =
|
|
400
|
+
let href = _chunk2HFJAX7Ujs.useHref.call(void 0, to, { relative });
|
|
401
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunk2HFJAX7Ujs.usePrefetchBehavior.call(void 0,
|
|
402
402
|
prefetch,
|
|
403
403
|
rest
|
|
404
404
|
);
|
|
@@ -427,13 +427,13 @@ var Link = React.forwardRef(
|
|
|
427
427
|
...prefetchHandlers,
|
|
428
428
|
href: parsed.absoluteURL || href,
|
|
429
429
|
onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
|
|
430
|
-
ref:
|
|
430
|
+
ref: _chunk2HFJAX7Ujs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
431
431
|
target,
|
|
432
432
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
433
433
|
}
|
|
434
434
|
)
|
|
435
435
|
);
|
|
436
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(
|
|
436
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunk2HFJAX7Ujs.PrefetchPageLinks, { page: href })) : link;
|
|
437
437
|
}
|
|
438
438
|
);
|
|
439
439
|
Link.displayName = "Link";
|
|
@@ -449,10 +449,10 @@ var NavLink = React.forwardRef(
|
|
|
449
449
|
children,
|
|
450
450
|
...rest
|
|
451
451
|
}, ref) {
|
|
452
|
-
let path =
|
|
453
|
-
let location =
|
|
454
|
-
let routerState = React.useContext(
|
|
455
|
-
let { navigator, basename } = React.useContext(
|
|
452
|
+
let path = _chunk2HFJAX7Ujs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
453
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
454
|
+
let routerState = React.useContext(_chunk2HFJAX7Ujs.DataRouterStateContext);
|
|
455
|
+
let { navigator, basename } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
456
456
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
457
457
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
458
458
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -465,7 +465,7 @@ var NavLink = React.forwardRef(
|
|
|
465
465
|
toPathname = toPathname.toLowerCase();
|
|
466
466
|
}
|
|
467
467
|
if (nextLocationPathname && basename) {
|
|
468
|
-
nextLocationPathname =
|
|
468
|
+
nextLocationPathname = _chunk2HFJAX7Ujs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
469
469
|
}
|
|
470
470
|
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
471
471
|
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
@@ -521,7 +521,7 @@ var Form = React.forwardRef(
|
|
|
521
521
|
unstable_defaultShouldRevalidate,
|
|
522
522
|
...props
|
|
523
523
|
}, forwardedRef) => {
|
|
524
|
-
let { unstable_useTransitions } = React.useContext(
|
|
524
|
+
let { unstable_useTransitions } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
525
525
|
let submit = useSubmit();
|
|
526
526
|
let formAction = useFormAction(action, { relative });
|
|
527
527
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
@@ -568,10 +568,10 @@ function ScrollRestoration({
|
|
|
568
568
|
storageKey,
|
|
569
569
|
...props
|
|
570
570
|
}) {
|
|
571
|
-
let remixContext = React.useContext(
|
|
572
|
-
let { basename } = React.useContext(
|
|
573
|
-
let location =
|
|
574
|
-
let matches =
|
|
571
|
+
let remixContext = React.useContext(_chunk2HFJAX7Ujs.FrameworkContext);
|
|
572
|
+
let { basename } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
573
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
574
|
+
let matches = _chunk2HFJAX7Ujs.useMatches.call(void 0, );
|
|
575
575
|
useScrollRestoration({ getKey, storageKey });
|
|
576
576
|
let ssrKey = React.useMemo(
|
|
577
577
|
() => {
|
|
@@ -625,13 +625,13 @@ function getDataRouterConsoleError(hookName) {
|
|
|
625
625
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
626
626
|
}
|
|
627
627
|
function useDataRouterContext(hookName) {
|
|
628
|
-
let ctx = React.useContext(
|
|
629
|
-
|
|
628
|
+
let ctx = React.useContext(_chunk2HFJAX7Ujs.DataRouterContext);
|
|
629
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
630
630
|
return ctx;
|
|
631
631
|
}
|
|
632
632
|
function useDataRouterState(hookName) {
|
|
633
|
-
let state = React.useContext(
|
|
634
|
-
|
|
633
|
+
let state = React.useContext(_chunk2HFJAX7Ujs.DataRouterStateContext);
|
|
634
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
635
635
|
return state;
|
|
636
636
|
}
|
|
637
637
|
function useLinkClickHandler(to, {
|
|
@@ -644,14 +644,14 @@ function useLinkClickHandler(to, {
|
|
|
644
644
|
unstable_defaultShouldRevalidate,
|
|
645
645
|
unstable_useTransitions
|
|
646
646
|
} = {}) {
|
|
647
|
-
let navigate =
|
|
648
|
-
let location =
|
|
649
|
-
let path =
|
|
647
|
+
let navigate = _chunk2HFJAX7Ujs.useNavigate.call(void 0, );
|
|
648
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
649
|
+
let path = _chunk2HFJAX7Ujs.useResolvedPath.call(void 0, to, { relative });
|
|
650
650
|
return React.useCallback(
|
|
651
651
|
(event) => {
|
|
652
652
|
if (shouldProcessLinkClick(event, target)) {
|
|
653
653
|
event.preventDefault();
|
|
654
|
-
let replace = replaceProp !== void 0 ? replaceProp :
|
|
654
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunk2HFJAX7Ujs.createPath.call(void 0, location) === _chunk2HFJAX7Ujs.createPath.call(void 0, path);
|
|
655
655
|
let doNavigate = () => navigate(to, {
|
|
656
656
|
replace,
|
|
657
657
|
state,
|
|
@@ -684,13 +684,13 @@ function useLinkClickHandler(to, {
|
|
|
684
684
|
);
|
|
685
685
|
}
|
|
686
686
|
function useSearchParams(defaultInit) {
|
|
687
|
-
|
|
687
|
+
_chunk2HFJAX7Ujs.warning.call(void 0,
|
|
688
688
|
typeof URLSearchParams !== "undefined",
|
|
689
689
|
`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.`
|
|
690
690
|
);
|
|
691
691
|
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
692
692
|
let hasSetSearchParamsRef = React.useRef(false);
|
|
693
|
-
let location =
|
|
693
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
694
694
|
let searchParams = React.useMemo(
|
|
695
695
|
() => (
|
|
696
696
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
@@ -703,7 +703,7 @@ function useSearchParams(defaultInit) {
|
|
|
703
703
|
),
|
|
704
704
|
[location.search]
|
|
705
705
|
);
|
|
706
|
-
let navigate =
|
|
706
|
+
let navigate = _chunk2HFJAX7Ujs.useNavigate.call(void 0, );
|
|
707
707
|
let setSearchParams = React.useCallback(
|
|
708
708
|
(nextInit, navigateOptions) => {
|
|
709
709
|
const newSearchParams = createSearchParams(
|
|
@@ -720,8 +720,8 @@ var fetcherId = 0;
|
|
|
720
720
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
721
721
|
function useSubmit() {
|
|
722
722
|
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
723
|
-
let { basename } = React.useContext(
|
|
724
|
-
let currentRouteId =
|
|
723
|
+
let { basename } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
724
|
+
let currentRouteId = _chunk2HFJAX7Ujs.useRouteId.call(void 0, );
|
|
725
725
|
let routerFetch = router.fetch;
|
|
726
726
|
let routerNavigate = router.navigate;
|
|
727
727
|
return React.useCallback(
|
|
@@ -761,12 +761,12 @@ function useSubmit() {
|
|
|
761
761
|
);
|
|
762
762
|
}
|
|
763
763
|
function useFormAction(action, { relative } = {}) {
|
|
764
|
-
let { basename } = React.useContext(
|
|
765
|
-
let routeContext = React.useContext(
|
|
766
|
-
|
|
764
|
+
let { basename } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
765
|
+
let routeContext = React.useContext(_chunk2HFJAX7Ujs.RouteContext);
|
|
766
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
767
767
|
let [match] = routeContext.matches.slice(-1);
|
|
768
|
-
let path = { ...
|
|
769
|
-
let location =
|
|
768
|
+
let path = { ..._chunk2HFJAX7Ujs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
769
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
770
770
|
if (action == null) {
|
|
771
771
|
path.search = location.search;
|
|
772
772
|
let params = new URLSearchParams(path.search);
|
|
@@ -783,21 +783,21 @@ function useFormAction(action, { relative } = {}) {
|
|
|
783
783
|
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
784
784
|
}
|
|
785
785
|
if (basename !== "/") {
|
|
786
|
-
path.pathname = path.pathname === "/" ? basename :
|
|
786
|
+
path.pathname = path.pathname === "/" ? basename : _chunk2HFJAX7Ujs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
787
787
|
}
|
|
788
|
-
return
|
|
788
|
+
return _chunk2HFJAX7Ujs.createPath.call(void 0, path);
|
|
789
789
|
}
|
|
790
790
|
function useFetcher({
|
|
791
791
|
key
|
|
792
792
|
} = {}) {
|
|
793
793
|
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
794
794
|
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
795
|
-
let fetcherData = React.useContext(
|
|
796
|
-
let route = React.useContext(
|
|
795
|
+
let fetcherData = React.useContext(_chunk2HFJAX7Ujs.FetchersContext);
|
|
796
|
+
let route = React.useContext(_chunk2HFJAX7Ujs.RouteContext);
|
|
797
797
|
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
798
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
799
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
800
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0,
|
|
801
801
|
routeId != null,
|
|
802
802
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
803
803
|
);
|
|
@@ -813,7 +813,7 @@ function useFetcher({
|
|
|
813
813
|
}, [deleteFetcher, getFetcher, fetcherKey]);
|
|
814
814
|
let load = React.useCallback(
|
|
815
815
|
async (href, opts) => {
|
|
816
|
-
|
|
816
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
817
817
|
await routerFetch(fetcherKey, routeId, href, opts);
|
|
818
818
|
},
|
|
819
819
|
[fetcherKey, routeId, routerFetch]
|
|
@@ -842,7 +842,7 @@ function useFetcher({
|
|
|
842
842
|
FetcherForm2.displayName = "fetcher.Form";
|
|
843
843
|
return FetcherForm2;
|
|
844
844
|
}, [fetcherKey]);
|
|
845
|
-
let fetcher = state.fetchers.get(fetcherKey) ||
|
|
845
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunk2HFJAX7Ujs.IDLE_FETCHER;
|
|
846
846
|
let data = fetcherData.get(fetcherKey);
|
|
847
847
|
let fetcherWithComponents = React.useMemo(
|
|
848
848
|
() => ({
|
|
@@ -873,7 +873,7 @@ function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
|
873
873
|
key = getKey(
|
|
874
874
|
{
|
|
875
875
|
...location,
|
|
876
|
-
pathname:
|
|
876
|
+
pathname: _chunk2HFJAX7Ujs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
877
877
|
},
|
|
878
878
|
matches
|
|
879
879
|
);
|
|
@@ -894,10 +894,10 @@ function useScrollRestoration({
|
|
|
894
894
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
895
895
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
896
896
|
);
|
|
897
|
-
let { basename } = React.useContext(
|
|
898
|
-
let location =
|
|
899
|
-
let matches =
|
|
900
|
-
let navigation =
|
|
897
|
+
let { basename } = React.useContext(_chunk2HFJAX7Ujs.NavigationContext);
|
|
898
|
+
let location = _chunk2HFJAX7Ujs.useLocation.call(void 0, );
|
|
899
|
+
let matches = _chunk2HFJAX7Ujs.useMatches.call(void 0, );
|
|
900
|
+
let navigation = _chunk2HFJAX7Ujs.useNavigation.call(void 0, );
|
|
901
901
|
React.useEffect(() => {
|
|
902
902
|
window.history.scrollRestoration = "manual";
|
|
903
903
|
return () => {
|
|
@@ -916,7 +916,7 @@ function useScrollRestoration({
|
|
|
916
916
|
JSON.stringify(savedScrollPositions)
|
|
917
917
|
);
|
|
918
918
|
} catch (error) {
|
|
919
|
-
|
|
919
|
+
_chunk2HFJAX7Ujs.warning.call(void 0,
|
|
920
920
|
false,
|
|
921
921
|
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
922
922
|
);
|
|
@@ -963,7 +963,7 @@ function useScrollRestoration({
|
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
965
|
} catch (e2) {
|
|
966
|
-
|
|
966
|
+
_chunk2HFJAX7Ujs.warning.call(void 0,
|
|
967
967
|
false,
|
|
968
968
|
`"${location.hash.slice(
|
|
969
969
|
1
|
|
@@ -1001,7 +1001,7 @@ function usePrompt({
|
|
|
1001
1001
|
when,
|
|
1002
1002
|
message
|
|
1003
1003
|
}) {
|
|
1004
|
-
let blocker =
|
|
1004
|
+
let blocker = _chunk2HFJAX7Ujs.useBlocker.call(void 0, when);
|
|
1005
1005
|
React.useEffect(() => {
|
|
1006
1006
|
if (blocker.state === "blocked") {
|
|
1007
1007
|
let proceed = window.confirm(message);
|
|
@@ -1019,21 +1019,21 @@ function usePrompt({
|
|
|
1019
1019
|
}, [blocker, when]);
|
|
1020
1020
|
}
|
|
1021
1021
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1022
|
-
let vtContext = React.useContext(
|
|
1023
|
-
|
|
1022
|
+
let vtContext = React.useContext(_chunk2HFJAX7Ujs.ViewTransitionContext);
|
|
1023
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0,
|
|
1024
1024
|
vtContext != null,
|
|
1025
1025
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1026
1026
|
);
|
|
1027
1027
|
let { basename } = useDataRouterContext(
|
|
1028
1028
|
"useViewTransitionState" /* useViewTransitionState */
|
|
1029
1029
|
);
|
|
1030
|
-
let path =
|
|
1030
|
+
let path = _chunk2HFJAX7Ujs.useResolvedPath.call(void 0, to, { relative });
|
|
1031
1031
|
if (!vtContext.isTransitioning) {
|
|
1032
1032
|
return false;
|
|
1033
1033
|
}
|
|
1034
|
-
let currentPath =
|
|
1035
|
-
let nextPath =
|
|
1036
|
-
return
|
|
1034
|
+
let currentPath = _chunk2HFJAX7Ujs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1035
|
+
let nextPath = _chunk2HFJAX7Ujs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1036
|
+
return _chunk2HFJAX7Ujs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunk2HFJAX7Ujs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
// lib/dom/server.tsx
|
|
@@ -1044,7 +1044,7 @@ function StaticRouter({
|
|
|
1044
1044
|
location: locationProp = "/"
|
|
1045
1045
|
}) {
|
|
1046
1046
|
if (typeof locationProp === "string") {
|
|
1047
|
-
locationProp =
|
|
1047
|
+
locationProp = _chunk2HFJAX7Ujs.parsePath.call(void 0, locationProp);
|
|
1048
1048
|
}
|
|
1049
1049
|
let action = "POP" /* Pop */;
|
|
1050
1050
|
let location = {
|
|
@@ -1056,7 +1056,7 @@ function StaticRouter({
|
|
|
1056
1056
|
};
|
|
1057
1057
|
let staticNavigator = getStatelessNavigator();
|
|
1058
1058
|
return /* @__PURE__ */ React2.createElement(
|
|
1059
|
-
|
|
1059
|
+
_chunk2HFJAX7Ujs.Router,
|
|
1060
1060
|
{
|
|
1061
1061
|
basename,
|
|
1062
1062
|
children,
|
|
@@ -1074,7 +1074,7 @@ function StaticRouterProvider({
|
|
|
1074
1074
|
hydrate = true,
|
|
1075
1075
|
nonce
|
|
1076
1076
|
}) {
|
|
1077
|
-
|
|
1077
|
+
_chunk2HFJAX7Ujs.invariant.call(void 0,
|
|
1078
1078
|
router && context,
|
|
1079
1079
|
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1080
1080
|
);
|
|
@@ -1097,8 +1097,8 @@ function StaticRouterProvider({
|
|
|
1097
1097
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1098
1098
|
}
|
|
1099
1099
|
let { state } = dataRouterContext.router;
|
|
1100
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
1101
|
-
|
|
1100
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunk2HFJAX7Ujs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1101
|
+
_chunk2HFJAX7Ujs.Router,
|
|
1102
1102
|
{
|
|
1103
1103
|
basename: dataRouterContext.basename,
|
|
1104
1104
|
location: state.location,
|
|
@@ -1129,14 +1129,14 @@ function DataRoutes({
|
|
|
1129
1129
|
future,
|
|
1130
1130
|
state
|
|
1131
1131
|
}) {
|
|
1132
|
-
return
|
|
1132
|
+
return _chunk2HFJAX7Ujs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1133
1133
|
}
|
|
1134
1134
|
function serializeErrors(errors) {
|
|
1135
1135
|
if (!errors) return null;
|
|
1136
1136
|
let entries = Object.entries(errors);
|
|
1137
1137
|
let serialized = {};
|
|
1138
1138
|
for (let [key, val] of entries) {
|
|
1139
|
-
if (
|
|
1139
|
+
if (_chunk2HFJAX7Ujs.isRouteErrorResponse.call(void 0, val)) {
|
|
1140
1140
|
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1141
1141
|
} else if (val instanceof Error) {
|
|
1142
1142
|
serialized[key] = {
|
|
@@ -1186,16 +1186,16 @@ function getStatelessNavigator() {
|
|
|
1186
1186
|
};
|
|
1187
1187
|
}
|
|
1188
1188
|
function createStaticHandler2(routes, opts) {
|
|
1189
|
-
return
|
|
1189
|
+
return _chunk2HFJAX7Ujs.createStaticHandler.call(void 0, routes, {
|
|
1190
1190
|
...opts,
|
|
1191
|
-
mapRouteProperties:
|
|
1191
|
+
mapRouteProperties: _chunk2HFJAX7Ujs.mapRouteProperties
|
|
1192
1192
|
});
|
|
1193
1193
|
}
|
|
1194
1194
|
function createStaticRouter(routes, context, opts = {}) {
|
|
1195
1195
|
let manifest = {};
|
|
1196
|
-
let dataRoutes =
|
|
1196
|
+
let dataRoutes = _chunk2HFJAX7Ujs.convertRoutesToDataRoutes.call(void 0,
|
|
1197
1197
|
routes,
|
|
1198
|
-
|
|
1198
|
+
_chunk2HFJAX7Ujs.mapRouteProperties,
|
|
1199
1199
|
void 0,
|
|
1200
1200
|
manifest
|
|
1201
1201
|
);
|
|
@@ -1226,7 +1226,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1226
1226
|
actionData: context.actionData,
|
|
1227
1227
|
errors: context.errors,
|
|
1228
1228
|
initialized: true,
|
|
1229
|
-
navigation:
|
|
1229
|
+
navigation: _chunk2HFJAX7Ujs.IDLE_NAVIGATION,
|
|
1230
1230
|
restoreScrollPosition: null,
|
|
1231
1231
|
preventScrollReset: false,
|
|
1232
1232
|
revalidation: "idle",
|
|
@@ -1261,7 +1261,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1261
1261
|
createHref,
|
|
1262
1262
|
encodeLocation,
|
|
1263
1263
|
getFetcher() {
|
|
1264
|
-
return
|
|
1264
|
+
return _chunk2HFJAX7Ujs.IDLE_FETCHER;
|
|
1265
1265
|
},
|
|
1266
1266
|
deleteFetcher() {
|
|
1267
1267
|
throw msg("deleteFetcher");
|
|
@@ -1273,7 +1273,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1273
1273
|
throw msg("dispose");
|
|
1274
1274
|
},
|
|
1275
1275
|
getBlocker() {
|
|
1276
|
-
return
|
|
1276
|
+
return _chunk2HFJAX7Ujs.IDLE_BLOCKER;
|
|
1277
1277
|
},
|
|
1278
1278
|
deleteBlocker() {
|
|
1279
1279
|
throw msg("deleteBlocker");
|
|
@@ -1291,10 +1291,10 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
}
|
|
1293
1293
|
function createHref(to) {
|
|
1294
|
-
return typeof to === "string" ? to :
|
|
1294
|
+
return typeof to === "string" ? to : _chunk2HFJAX7Ujs.createPath.call(void 0, to);
|
|
1295
1295
|
}
|
|
1296
1296
|
function encodeLocation(to) {
|
|
1297
|
-
let href = typeof to === "string" ? to :
|
|
1297
|
+
let href = typeof to === "string" ? to : _chunk2HFJAX7Ujs.createPath.call(void 0, to);
|
|
1298
1298
|
href = href.replace(/ $/, "%20");
|
|
1299
1299
|
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1300
1300
|
return {
|