react-router 7.2.0-pre.0 → 7.2.0-pre.1
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 +34 -0
- package/dist/development/{chunk-HLU4BUUT.mjs → chunk-FXE4ZOSB.mjs} +41 -22
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/{production/fog-of-war-Ax4Jg2xL.d.ts → development/fog-of-war-rn7nVSAv.d.ts} +1 -1
- package/dist/development/{fog-of-war-Cyo_TZuh.d.mts → fog-of-war-yKFj2vdd.d.mts} +1 -1
- package/dist/development/index.d.mts +37 -6
- package/dist/development/index.d.ts +37 -6
- package/dist/development/index.js +42 -22
- package/dist/development/index.mjs +4 -2
- package/dist/development/lib/types/route-module.d.mts +1 -1
- package/dist/development/lib/types/route-module.d.ts +1 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-DQbTMaUY.d.ts → route-data-CfLfC_Bh.d.mts} +1 -1
- package/dist/{production/route-data-DQbTMaUY.d.mts → development/route-data-CfLfC_Bh.d.ts} +1 -1
- package/dist/production/{chunk-IA3JXIZE.mjs → chunk-3BG6WSY4.mjs} +41 -22
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/{development/fog-of-war-Ax4Jg2xL.d.ts → production/fog-of-war-rn7nVSAv.d.ts} +1 -1
- package/dist/production/{fog-of-war-Cyo_TZuh.d.mts → fog-of-war-yKFj2vdd.d.mts} +1 -1
- package/dist/production/index.d.mts +37 -6
- package/dist/production/index.d.ts +37 -6
- package/dist/production/index.js +42 -22
- package/dist/production/index.mjs +4 -2
- package/dist/production/lib/types/route-module.d.mts +1 -1
- package/dist/production/lib/types/route-module.d.ts +1 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-DQbTMaUY.d.ts → route-data-CfLfC_Bh.d.mts} +1 -1
- package/dist/{development/route-data-DQbTMaUY.d.mts → production/route-data-CfLfC_Bh.d.ts} +1 -1
- package/package.json +1 -1
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -108,6 +108,7 @@ __export(react_router_exports, {
|
|
|
108
108
|
createStaticRouter: () => createStaticRouter,
|
|
109
109
|
data: () => data,
|
|
110
110
|
generatePath: () => generatePath,
|
|
111
|
+
href: () => href,
|
|
111
112
|
isCookie: () => isCookie,
|
|
112
113
|
isRouteErrorResponse: () => isRouteErrorResponse,
|
|
113
114
|
isSession: () => isSession,
|
|
@@ -299,13 +300,13 @@ function createHashHistory(options = {}) {
|
|
|
299
300
|
}
|
|
300
301
|
function createHashHref(window2, to) {
|
|
301
302
|
let base = window2.document.querySelector("base");
|
|
302
|
-
let
|
|
303
|
+
let href2 = "";
|
|
303
304
|
if (base && base.getAttribute("href")) {
|
|
304
305
|
let url = window2.location.href;
|
|
305
306
|
let hashIndex = url.indexOf("#");
|
|
306
|
-
|
|
307
|
+
href2 = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
307
308
|
}
|
|
308
|
-
return
|
|
309
|
+
return href2 + "#" + (typeof to === "string" ? to : createPath(to));
|
|
309
310
|
}
|
|
310
311
|
function validateHashLocation(location, to) {
|
|
311
312
|
warning(
|
|
@@ -447,13 +448,13 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
447
448
|
}
|
|
448
449
|
function createURL(to) {
|
|
449
450
|
let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
|
|
450
|
-
let
|
|
451
|
-
|
|
451
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
452
|
+
href2 = href2.replace(/ $/, "%20");
|
|
452
453
|
invariant(
|
|
453
454
|
base,
|
|
454
|
-
`No window.location.(origin|href) available to create URL for href: ${
|
|
455
|
+
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
455
456
|
);
|
|
456
|
-
return new URL(
|
|
457
|
+
return new URL(href2, base);
|
|
457
458
|
}
|
|
458
459
|
let history = {
|
|
459
460
|
get action() {
|
|
@@ -1855,7 +1856,7 @@ function createRouter(init) {
|
|
|
1855
1856
|
});
|
|
1856
1857
|
return new Map(state.fetchers);
|
|
1857
1858
|
}
|
|
1858
|
-
async function fetch2(key, routeId,
|
|
1859
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1859
1860
|
abortFetcher(key);
|
|
1860
1861
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1861
1862
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1863,7 +1864,7 @@ function createRouter(init) {
|
|
|
1863
1864
|
state.location,
|
|
1864
1865
|
state.matches,
|
|
1865
1866
|
basename,
|
|
1866
|
-
|
|
1867
|
+
href2,
|
|
1867
1868
|
routeId,
|
|
1868
1869
|
opts?.relative
|
|
1869
1870
|
);
|
|
@@ -5501,7 +5502,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5501
5502
|
let module2 = routeModules[match.route.id];
|
|
5502
5503
|
let route = manifest.routes[match.route.id];
|
|
5503
5504
|
return [
|
|
5504
|
-
route && route.css ? route.css.map((
|
|
5505
|
+
route && route.css ? route.css.map((href2) => ({ rel: "stylesheet", href: href2 })) : [],
|
|
5505
5506
|
module2?.links?.() || []
|
|
5506
5507
|
];
|
|
5507
5508
|
}).flat(2);
|
|
@@ -5510,7 +5511,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5510
5511
|
}
|
|
5511
5512
|
function getRouteCssDescriptors(route) {
|
|
5512
5513
|
if (!route.css) return [];
|
|
5513
|
-
return route.css.map((
|
|
5514
|
+
return route.css.map((href2) => ({ rel: "stylesheet", href: href2 }));
|
|
5514
5515
|
}
|
|
5515
5516
|
async function prefetchRouteCss(route) {
|
|
5516
5517
|
if (!route.css) return;
|
|
@@ -7013,7 +7014,7 @@ function PrefetchPageLinksImpl({
|
|
|
7013
7014
|
[newMatchesForAssets, manifest]
|
|
7014
7015
|
);
|
|
7015
7016
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
7016
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
7017
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React9.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React9.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
7017
7018
|
// these don't spread `linkProps` because they are full link descriptors
|
|
7018
7019
|
// already with their own props
|
|
7019
7020
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -7253,7 +7254,7 @@ function mergeRefs(...refs) {
|
|
|
7253
7254
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7254
7255
|
try {
|
|
7255
7256
|
if (isBrowser) {
|
|
7256
|
-
window.__reactRouterVersion = "7.2.0-pre.
|
|
7257
|
+
window.__reactRouterVersion = "7.2.0-pre.1";
|
|
7257
7258
|
}
|
|
7258
7259
|
} catch (e) {
|
|
7259
7260
|
}
|
|
@@ -7456,7 +7457,7 @@ var Link = React10.forwardRef(
|
|
|
7456
7457
|
}
|
|
7457
7458
|
}
|
|
7458
7459
|
}
|
|
7459
|
-
let
|
|
7460
|
+
let href2 = useHref(to, { relative });
|
|
7460
7461
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7461
7462
|
prefetch,
|
|
7462
7463
|
rest
|
|
@@ -7482,7 +7483,7 @@ var Link = React10.forwardRef(
|
|
|
7482
7483
|
{
|
|
7483
7484
|
...rest,
|
|
7484
7485
|
...prefetchHandlers,
|
|
7485
|
-
href: absoluteHref ||
|
|
7486
|
+
href: absoluteHref || href2,
|
|
7486
7487
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7487
7488
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7488
7489
|
target,
|
|
@@ -7490,7 +7491,7 @@ var Link = React10.forwardRef(
|
|
|
7490
7491
|
}
|
|
7491
7492
|
)
|
|
7492
7493
|
);
|
|
7493
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7494
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
7494
7495
|
}
|
|
7495
7496
|
);
|
|
7496
7497
|
Link.displayName = "Link";
|
|
@@ -7846,9 +7847,9 @@ function useFetcher({
|
|
|
7846
7847
|
return () => router.deleteFetcher(fetcherKey);
|
|
7847
7848
|
}, [router, fetcherKey]);
|
|
7848
7849
|
let load = React10.useCallback(
|
|
7849
|
-
async (
|
|
7850
|
+
async (href2, opts) => {
|
|
7850
7851
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7851
|
-
await router.fetch(fetcherKey, routeId,
|
|
7852
|
+
await router.fetch(fetcherKey, routeId, href2, opts);
|
|
7852
7853
|
},
|
|
7853
7854
|
[fetcherKey, routeId, router]
|
|
7854
7855
|
);
|
|
@@ -8305,9 +8306,9 @@ function createHref(to) {
|
|
|
8305
8306
|
return typeof to === "string" ? to : createPath(to);
|
|
8306
8307
|
}
|
|
8307
8308
|
function encodeLocation(to) {
|
|
8308
|
-
let
|
|
8309
|
-
|
|
8310
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8309
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
8310
|
+
href2 = href2.replace(/ $/, "%20");
|
|
8311
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href2) ? new URL(href2) : new URL(href2, "http://localhost");
|
|
8311
8312
|
return {
|
|
8312
8313
|
pathname: encoded.pathname,
|
|
8313
8314
|
search: encoded.search,
|
|
@@ -9783,6 +9784,24 @@ function createMemorySessionStorage({ cookie } = {}) {
|
|
|
9783
9784
|
});
|
|
9784
9785
|
}
|
|
9785
9786
|
|
|
9787
|
+
// lib/href.ts
|
|
9788
|
+
function href(path, ...args) {
|
|
9789
|
+
let params = args[0];
|
|
9790
|
+
return path.split("/").map((segment) => {
|
|
9791
|
+
const match = segment.match(/^:([\w-]+)(\?)?/);
|
|
9792
|
+
if (!match) return segment;
|
|
9793
|
+
const param = match[1];
|
|
9794
|
+
const value = params ? params[param] : void 0;
|
|
9795
|
+
const isRequired = match[2] === void 0;
|
|
9796
|
+
if (isRequired && value === void 0) {
|
|
9797
|
+
throw Error(
|
|
9798
|
+
`Path '${path}' requires param '${param}' but it was not provided`
|
|
9799
|
+
);
|
|
9800
|
+
}
|
|
9801
|
+
return value;
|
|
9802
|
+
}).filter((segment) => segment !== void 0).join("/");
|
|
9803
|
+
}
|
|
9804
|
+
|
|
9786
9805
|
// lib/dom/ssr/errors.ts
|
|
9787
9806
|
function deserializeErrors2(errors) {
|
|
9788
9807
|
if (!errors) return null;
|
|
@@ -9889,6 +9908,7 @@ function deserializeErrors2(errors) {
|
|
|
9889
9908
|
createStaticRouter,
|
|
9890
9909
|
data,
|
|
9891
9910
|
generatePath,
|
|
9911
|
+
href,
|
|
9892
9912
|
isCookie,
|
|
9893
9913
|
isRouteErrorResponse,
|
|
9894
9914
|
isSession,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
generatePath,
|
|
74
74
|
getPatchRoutesOnNavigationFunction,
|
|
75
75
|
getSingleFetchDataStrategy,
|
|
76
|
+
href,
|
|
76
77
|
invariant,
|
|
77
78
|
isCookie,
|
|
78
79
|
isRouteErrorResponse,
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
useSearchParams,
|
|
121
122
|
useSubmit,
|
|
122
123
|
useViewTransitionState
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-3BG6WSY4.mjs";
|
|
124
125
|
export {
|
|
125
126
|
Await,
|
|
126
127
|
BrowserRouter,
|
|
@@ -190,6 +191,7 @@ export {
|
|
|
190
191
|
createStaticRouter,
|
|
191
192
|
data,
|
|
192
193
|
generatePath,
|
|
194
|
+
href,
|
|
193
195
|
isCookie,
|
|
194
196
|
isRouteErrorResponse,
|
|
195
197
|
isSession,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { az as LinkDescriptor, aw as MetaDescriptor, aN as ServerDataFrom, aO as ClientDataFrom, aP as Func, E as Equal, aQ as Pretty } from '../../route-data-CfLfC_Bh.mjs';
|
|
2
2
|
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { az as LinkDescriptor, aw as MetaDescriptor, aN as ServerDataFrom, aO as ClientDataFrom, aP as Func, E as Equal, aQ as Pretty } from '../../route-data-CfLfC_Bh.js';
|
|
2
2
|
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -1576,4 +1576,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1576
1576
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1577
1577
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1578
1578
|
|
|
1579
|
-
export { type
|
|
1579
|
+
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, createBrowserHistory as aA, invariant as aB, createRouter as aC, ErrorResponseImpl as aD, DataRouterContext as aE, DataRouterStateContext as aF, FetchersContext as aG, LocationContext as aH, NavigationContext as aI, RouteContext as aJ, ViewTransitionContext as aK, type RouteModule as aL, type History as aM, type ServerDataFrom as aN, type ClientDataFrom as aO, type Func as aP, type Pretty as aQ, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunction as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunction as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type HeadersFunction as au, type MetaArgs as av, type MetaDescriptor as aw, type PageLinkDescriptor as ax, type HtmlLinkDescriptor as ay, type LinkDescriptor as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|
|
@@ -1576,4 +1576,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1576
1576
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1577
1577
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1578
1578
|
|
|
1579
|
-
export { type
|
|
1579
|
+
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, createBrowserHistory as aA, invariant as aB, createRouter as aC, ErrorResponseImpl as aD, DataRouterContext as aE, DataRouterStateContext as aF, FetchersContext as aG, LocationContext as aH, NavigationContext as aI, RouteContext as aJ, ViewTransitionContext as aK, type RouteModule as aL, type History as aM, type ServerDataFrom as aN, type ClientDataFrom as aO, type Func as aP, type Pretty as aQ, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunction as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunction as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type HeadersFunction as au, type MetaArgs as av, type MetaDescriptor as aw, type PageLinkDescriptor as ax, type HtmlLinkDescriptor as ay, type LinkDescriptor as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|