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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.2.0-pre.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- New type-safe `href` utility that guarantees links point to actual paths in your app ([#13012](https://github.com/remix-run/react-router/pull/13012))
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { href } from "react-router";
|
|
11
|
+
|
|
12
|
+
export default function Component() {
|
|
13
|
+
const link = href("/blog/:slug", { slug: "my-first-post" });
|
|
14
|
+
return (
|
|
15
|
+
<main>
|
|
16
|
+
<Link to={href("/products/:id", { id: "asdf" })} />
|
|
17
|
+
<NavLink to={href("/:lang?/about", { lang: "en" })} />
|
|
18
|
+
</main>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Fix typegen for repeated params ([#13012](https://github.com/remix-run/react-router/pull/13012))
|
|
26
|
+
|
|
27
|
+
In React Router, path parameters are keyed by their name.
|
|
28
|
+
So for a path pattern like `/a/:id/b/:id?/c/:id`, the last `:id` will set the value for `id` in `useParams` and the `params` prop.
|
|
29
|
+
For example, `/a/1/b/2/c/3` will result in the value `{ id: 3 }` at runtime.
|
|
30
|
+
|
|
31
|
+
Previously, generated types for params incorrectly modeled repeated params with an array.
|
|
32
|
+
So `/a/1/b/2/c/3` generated a type like `{ id: [1,2,3] }`.
|
|
33
|
+
|
|
34
|
+
To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
|
|
35
|
+
So `/a/1/b/2/c/3` now generates a type like `{ id: 3 }`.
|
|
36
|
+
|
|
3
37
|
## 7.2.0-pre.0
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -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
|
*
|
|
@@ -154,13 +154,13 @@ function createHashHistory(options = {}) {
|
|
|
154
154
|
}
|
|
155
155
|
function createHashHref(window2, to) {
|
|
156
156
|
let base = window2.document.querySelector("base");
|
|
157
|
-
let
|
|
157
|
+
let href2 = "";
|
|
158
158
|
if (base && base.getAttribute("href")) {
|
|
159
159
|
let url = window2.location.href;
|
|
160
160
|
let hashIndex = url.indexOf("#");
|
|
161
|
-
|
|
161
|
+
href2 = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return href2 + "#" + (typeof to === "string" ? to : createPath(to));
|
|
164
164
|
}
|
|
165
165
|
function validateHashLocation(location, to) {
|
|
166
166
|
warning(
|
|
@@ -302,13 +302,13 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
302
302
|
}
|
|
303
303
|
function createURL(to) {
|
|
304
304
|
let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
|
|
305
|
-
let
|
|
306
|
-
|
|
305
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
306
|
+
href2 = href2.replace(/ $/, "%20");
|
|
307
307
|
invariant(
|
|
308
308
|
base,
|
|
309
|
-
`No window.location.(origin|href) available to create URL for href: ${
|
|
309
|
+
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
310
310
|
);
|
|
311
|
-
return new URL(
|
|
311
|
+
return new URL(href2, base);
|
|
312
312
|
}
|
|
313
313
|
let history = {
|
|
314
314
|
get action() {
|
|
@@ -1710,7 +1710,7 @@ function createRouter(init) {
|
|
|
1710
1710
|
});
|
|
1711
1711
|
return new Map(state.fetchers);
|
|
1712
1712
|
}
|
|
1713
|
-
async function fetch2(key, routeId,
|
|
1713
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1714
1714
|
abortFetcher(key);
|
|
1715
1715
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1716
1716
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1718,7 +1718,7 @@ function createRouter(init) {
|
|
|
1718
1718
|
state.location,
|
|
1719
1719
|
state.matches,
|
|
1720
1720
|
basename,
|
|
1721
|
-
|
|
1721
|
+
href2,
|
|
1722
1722
|
routeId,
|
|
1723
1723
|
opts?.relative
|
|
1724
1724
|
);
|
|
@@ -5356,7 +5356,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5356
5356
|
let module = routeModules[match.route.id];
|
|
5357
5357
|
let route = manifest.routes[match.route.id];
|
|
5358
5358
|
return [
|
|
5359
|
-
route && route.css ? route.css.map((
|
|
5359
|
+
route && route.css ? route.css.map((href2) => ({ rel: "stylesheet", href: href2 })) : [],
|
|
5360
5360
|
module?.links?.() || []
|
|
5361
5361
|
];
|
|
5362
5362
|
}).flat(2);
|
|
@@ -5365,7 +5365,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5365
5365
|
}
|
|
5366
5366
|
function getRouteCssDescriptors(route) {
|
|
5367
5367
|
if (!route.css) return [];
|
|
5368
|
-
return route.css.map((
|
|
5368
|
+
return route.css.map((href2) => ({ rel: "stylesheet", href: href2 }));
|
|
5369
5369
|
}
|
|
5370
5370
|
async function prefetchRouteCss(route) {
|
|
5371
5371
|
if (!route.css) return;
|
|
@@ -6868,7 +6868,7 @@ function PrefetchPageLinksImpl({
|
|
|
6868
6868
|
[newMatchesForAssets, manifest]
|
|
6869
6869
|
);
|
|
6870
6870
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6871
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
6871
|
+
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 }) => (
|
|
6872
6872
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6873
6873
|
// already with their own props
|
|
6874
6874
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -7108,7 +7108,7 @@ function mergeRefs(...refs) {
|
|
|
7108
7108
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7109
7109
|
try {
|
|
7110
7110
|
if (isBrowser) {
|
|
7111
|
-
window.__reactRouterVersion = "7.2.0-pre.
|
|
7111
|
+
window.__reactRouterVersion = "7.2.0-pre.1";
|
|
7112
7112
|
}
|
|
7113
7113
|
} catch (e) {
|
|
7114
7114
|
}
|
|
@@ -7311,7 +7311,7 @@ var Link = React10.forwardRef(
|
|
|
7311
7311
|
}
|
|
7312
7312
|
}
|
|
7313
7313
|
}
|
|
7314
|
-
let
|
|
7314
|
+
let href2 = useHref(to, { relative });
|
|
7315
7315
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7316
7316
|
prefetch,
|
|
7317
7317
|
rest
|
|
@@ -7337,7 +7337,7 @@ var Link = React10.forwardRef(
|
|
|
7337
7337
|
{
|
|
7338
7338
|
...rest,
|
|
7339
7339
|
...prefetchHandlers,
|
|
7340
|
-
href: absoluteHref ||
|
|
7340
|
+
href: absoluteHref || href2,
|
|
7341
7341
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7342
7342
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7343
7343
|
target,
|
|
@@ -7345,7 +7345,7 @@ var Link = React10.forwardRef(
|
|
|
7345
7345
|
}
|
|
7346
7346
|
)
|
|
7347
7347
|
);
|
|
7348
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7348
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
7349
7349
|
}
|
|
7350
7350
|
);
|
|
7351
7351
|
Link.displayName = "Link";
|
|
@@ -7701,9 +7701,9 @@ function useFetcher({
|
|
|
7701
7701
|
return () => router.deleteFetcher(fetcherKey);
|
|
7702
7702
|
}, [router, fetcherKey]);
|
|
7703
7703
|
let load = React10.useCallback(
|
|
7704
|
-
async (
|
|
7704
|
+
async (href2, opts) => {
|
|
7705
7705
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7706
|
-
await router.fetch(fetcherKey, routeId,
|
|
7706
|
+
await router.fetch(fetcherKey, routeId, href2, opts);
|
|
7707
7707
|
},
|
|
7708
7708
|
[fetcherKey, routeId, router]
|
|
7709
7709
|
);
|
|
@@ -8160,9 +8160,9 @@ function createHref(to) {
|
|
|
8160
8160
|
return typeof to === "string" ? to : createPath(to);
|
|
8161
8161
|
}
|
|
8162
8162
|
function encodeLocation(to) {
|
|
8163
|
-
let
|
|
8164
|
-
|
|
8165
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8163
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
8164
|
+
href2 = href2.replace(/ $/, "%20");
|
|
8165
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href2) ? new URL(href2) : new URL(href2, "http://localhost");
|
|
8166
8166
|
return {
|
|
8167
8167
|
pathname: encoded.pathname,
|
|
8168
8168
|
search: encoded.search,
|
|
@@ -9638,6 +9638,24 @@ function createMemorySessionStorage({ cookie } = {}) {
|
|
|
9638
9638
|
});
|
|
9639
9639
|
}
|
|
9640
9640
|
|
|
9641
|
+
// lib/href.ts
|
|
9642
|
+
function href(path, ...args) {
|
|
9643
|
+
let params = args[0];
|
|
9644
|
+
return path.split("/").map((segment) => {
|
|
9645
|
+
const match = segment.match(/^:([\w-]+)(\?)?/);
|
|
9646
|
+
if (!match) return segment;
|
|
9647
|
+
const param = match[1];
|
|
9648
|
+
const value = params ? params[param] : void 0;
|
|
9649
|
+
const isRequired = match[2] === void 0;
|
|
9650
|
+
if (isRequired && value === void 0) {
|
|
9651
|
+
throw Error(
|
|
9652
|
+
`Path '${path}' requires param '${param}' but it was not provided`
|
|
9653
|
+
);
|
|
9654
|
+
}
|
|
9655
|
+
return value;
|
|
9656
|
+
}).filter((segment) => segment !== void 0).join("/");
|
|
9657
|
+
}
|
|
9658
|
+
|
|
9641
9659
|
// lib/dom/ssr/errors.ts
|
|
9642
9660
|
function deserializeErrors2(errors) {
|
|
9643
9661
|
if (!errors) return null;
|
|
@@ -9786,5 +9804,6 @@ export {
|
|
|
9786
9804
|
createSessionStorage,
|
|
9787
9805
|
createCookieSessionStorage,
|
|
9788
9806
|
createMemorySessionStorage,
|
|
9807
|
+
href,
|
|
9789
9808
|
deserializeErrors2 as deserializeErrors
|
|
9790
9809
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-yKFj2vdd.mjs';
|
|
3
|
+
import './route-data-CfLfC_Bh.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-rn7nVSAv.js';
|
|
3
|
+
import './route-data-CfLfC_Bh.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -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
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
matchRoutes,
|
|
26
26
|
shouldHydrateRouteLoader,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-FXE4ZOSB.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction,
|
|
2
|
+
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject, aL as RouteModule, $ as HTMLFormMethod, Z as FormEncType, ax as PageLinkDescriptor, aM as History, w as GetScrollRestorationKeyFunction, N as NavigateOptions, x as Fetcher, m as SerializeFrom, B as BlockerFunction } from './route-data-CfLfC_Bh.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction,
|
|
2
|
+
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject, aL as RouteModule, $ as HTMLFormMethod, Z as FormEncType, ax as PageLinkDescriptor, aM as History, w as GetScrollRestorationKeyFunction, N as NavigateOptions, x as Fetcher, m as SerializeFrom, B as BlockerFunction } from './route-data-CfLfC_Bh.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, v as RouterState } from './route-data-
|
|
2
|
-
export {
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-
|
|
4
|
-
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-CfLfC_Bh.mjs';
|
|
2
|
+
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs, aE as UNSAFE_DataRouterContext, aF as UNSAFE_DataRouterStateContext, X as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aG as UNSAFE_FetchersContext, aH as UNSAFE_LocationContext, aI as UNSAFE_NavigationContext, aJ as UNSAFE_RouteContext, aK as UNSAFE_ViewTransitionContext, aA as UNSAFE_createBrowserHistory, aC as UNSAFE_createRouter, aB as UNSAFE_invariant, a5 as createPath, aa as data, ab as generatePath, ac as isRouteErrorResponse, ad as matchPath, ae as matchRoutes, a6 as parsePath, af as redirect, ag as redirectDocument, ah as replace, ai as resolvePath } from './route-data-CfLfC_Bh.mjs';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-yKFj2vdd.mjs';
|
|
4
|
+
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-yKFj2vdd.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -194,7 +194,7 @@ declare function useOutlet(context?: unknown): React.ReactElement | null;
|
|
|
194
194
|
*/
|
|
195
195
|
declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
|
|
196
196
|
ParamsOrKey
|
|
197
|
-
] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
|
|
197
|
+
] extends [string] ? Params$1<ParamsOrKey> : Partial<ParamsOrKey>>;
|
|
198
198
|
/**
|
|
199
199
|
Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
|
|
200
200
|
|
|
@@ -782,6 +782,37 @@ type DevServerHooks = {
|
|
|
782
782
|
};
|
|
783
783
|
declare function setDevServerHooks(devServerHooks: DevServerHooks): void;
|
|
784
784
|
|
|
785
|
+
/**
|
|
786
|
+
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
787
|
+
* React Router should handle this for you via type generation.
|
|
788
|
+
*
|
|
789
|
+
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
|
790
|
+
*/
|
|
791
|
+
interface Register {
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
type AnyParams = Record<string, Record<string, string | undefined>>;
|
|
795
|
+
type Params = Register extends {
|
|
796
|
+
params: infer RegisteredParams extends AnyParams;
|
|
797
|
+
} ? RegisteredParams : AnyParams;
|
|
798
|
+
type Args = {
|
|
799
|
+
[K in keyof Params]: ToArgs<Params[K]>;
|
|
800
|
+
};
|
|
801
|
+
type ToArgs<T> = Equal<T, {}> extends true ? [] : Partial<T> extends T ? [T] | [] : [
|
|
802
|
+
T
|
|
803
|
+
];
|
|
804
|
+
/**
|
|
805
|
+
Returns a resolved URL path for the specified route.
|
|
806
|
+
|
|
807
|
+
```tsx
|
|
808
|
+
const h = href("/:lang?/about", { lang: "en" })
|
|
809
|
+
// -> `/en/about`
|
|
810
|
+
|
|
811
|
+
<Link to={href("/products/:id", { id: "abc123" })} />
|
|
812
|
+
```
|
|
813
|
+
*/
|
|
814
|
+
declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
|
|
815
|
+
|
|
785
816
|
declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];
|
|
786
817
|
|
|
787
818
|
type RemixErrorBoundaryProps = React.PropsWithChildren<{
|
|
@@ -805,4 +836,4 @@ declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps
|
|
|
805
836
|
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
806
837
|
}
|
|
807
838
|
|
|
808
|
-
export { ActionFunction, ActionFunctionArgs, AppLoadContext$1 as AppLoadContext, Blocker, BlockerFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, isCookie, isSession, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
839
|
+
export { ActionFunction, ActionFunctionArgs, AppLoadContext$1 as AppLoadContext, Blocker, BlockerFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params$1 as Params, Path, PathMatch, PathPattern, type Register, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, v as RouterState } from './route-data-
|
|
2
|
-
export {
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-
|
|
4
|
-
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-CfLfC_Bh.js';
|
|
2
|
+
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs, aE as UNSAFE_DataRouterContext, aF as UNSAFE_DataRouterStateContext, X as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aG as UNSAFE_FetchersContext, aH as UNSAFE_LocationContext, aI as UNSAFE_NavigationContext, aJ as UNSAFE_RouteContext, aK as UNSAFE_ViewTransitionContext, aA as UNSAFE_createBrowserHistory, aC as UNSAFE_createRouter, aB as UNSAFE_invariant, a5 as createPath, aa as data, ab as generatePath, ac as isRouteErrorResponse, ad as matchPath, ae as matchRoutes, a6 as parsePath, af as redirect, ag as redirectDocument, ah as replace, ai as resolvePath } from './route-data-CfLfC_Bh.js';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-rn7nVSAv.js';
|
|
4
|
+
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-rn7nVSAv.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -194,7 +194,7 @@ declare function useOutlet(context?: unknown): React.ReactElement | null;
|
|
|
194
194
|
*/
|
|
195
195
|
declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
|
|
196
196
|
ParamsOrKey
|
|
197
|
-
] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
|
|
197
|
+
] extends [string] ? Params$1<ParamsOrKey> : Partial<ParamsOrKey>>;
|
|
198
198
|
/**
|
|
199
199
|
Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
|
|
200
200
|
|
|
@@ -782,6 +782,37 @@ type DevServerHooks = {
|
|
|
782
782
|
};
|
|
783
783
|
declare function setDevServerHooks(devServerHooks: DevServerHooks): void;
|
|
784
784
|
|
|
785
|
+
/**
|
|
786
|
+
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
787
|
+
* React Router should handle this for you via type generation.
|
|
788
|
+
*
|
|
789
|
+
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
|
790
|
+
*/
|
|
791
|
+
interface Register {
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
type AnyParams = Record<string, Record<string, string | undefined>>;
|
|
795
|
+
type Params = Register extends {
|
|
796
|
+
params: infer RegisteredParams extends AnyParams;
|
|
797
|
+
} ? RegisteredParams : AnyParams;
|
|
798
|
+
type Args = {
|
|
799
|
+
[K in keyof Params]: ToArgs<Params[K]>;
|
|
800
|
+
};
|
|
801
|
+
type ToArgs<T> = Equal<T, {}> extends true ? [] : Partial<T> extends T ? [T] | [] : [
|
|
802
|
+
T
|
|
803
|
+
];
|
|
804
|
+
/**
|
|
805
|
+
Returns a resolved URL path for the specified route.
|
|
806
|
+
|
|
807
|
+
```tsx
|
|
808
|
+
const h = href("/:lang?/about", { lang: "en" })
|
|
809
|
+
// -> `/en/about`
|
|
810
|
+
|
|
811
|
+
<Link to={href("/products/:id", { id: "abc123" })} />
|
|
812
|
+
```
|
|
813
|
+
*/
|
|
814
|
+
declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
|
|
815
|
+
|
|
785
816
|
declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];
|
|
786
817
|
|
|
787
818
|
type RemixErrorBoundaryProps = React.PropsWithChildren<{
|
|
@@ -805,4 +836,4 @@ declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps
|
|
|
805
836
|
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
806
837
|
}
|
|
807
838
|
|
|
808
|
-
export { ActionFunction, ActionFunctionArgs, AppLoadContext$1 as AppLoadContext, Blocker, BlockerFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, isCookie, isSession, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
839
|
+
export { ActionFunction, ActionFunctionArgs, AppLoadContext$1 as AppLoadContext, Blocker, BlockerFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params$1 as Params, Path, PathMatch, PathPattern, type Register, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
@@ -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,
|