react-router 7.15.0 → 7.15.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 +50 -10
- package/dist/development/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
- package/dist/development/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
- package/dist/development/{chunk-5KNZJZUH.mjs → chunk-4N6VE7H7.mjs} +230 -113
- package/dist/{production/chunk-7YXKJMLN.js → development/chunk-4YRVXM2U.js} +7 -7
- package/dist/development/{chunk-Z5YQYACE.js → chunk-66UKHEGQ.js} +106 -103
- package/dist/development/{chunk-AM3XM4LS.js → chunk-D6LUOGOQ.js} +251 -137
- package/dist/development/{chunk-RMD3H4O3.mjs → chunk-RJYABSBD.mjs} +22 -21
- package/dist/{production/context-BQs41HrG.d.mts → development/context-ByvtofY2.d.mts} +7 -1
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +48 -50
- package/dist/development/dom-export.mjs +23 -25
- package/dist/{production/index-react-server-client-CSv-KZBk.d.ts → development/index-react-server-client-BS5F89FR.d.ts} +10 -2
- package/dist/{production/index-react-server-client-Ck_yZ1qL.d.mts → development/index-react-server-client-DY04-103.d.mts} +10 -2
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- 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.d.mts +6 -0
- package/dist/development/index-react-server.d.ts +6 -0
- package/dist/development/index-react-server.js +4 -4
- package/dist/development/index-react-server.mjs +4 -4
- package/dist/development/index.d.mts +91 -9
- package/dist/development/index.d.ts +91 -9
- package/dist/development/index.js +103 -100
- package/dist/development/index.mjs +5 -3
- package/dist/{production/instrumentation-DlJ2QV7d.d.ts → development/instrumentation-cRWWLfsU.d.ts} +7 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/production/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
- package/dist/production/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
- package/dist/production/{chunk-23ZOHYE5.mjs → chunk-6S4627ZB.mjs} +22 -21
- package/dist/production/{chunk-LCJTIOKZ.js → chunk-HUBUW7R3.js} +251 -137
- package/dist/production/{chunk-GM3PW4GX.mjs → chunk-JAKZPQZC.mjs} +230 -113
- package/dist/production/{chunk-YBQJ3ABE.js → chunk-PNZCCTKT.js} +106 -103
- package/dist/{development/chunk-2D5H3HU3.js → production/chunk-Y6IFXO7V.js} +7 -7
- package/dist/{development/context-BQs41HrG.d.mts → production/context-ByvtofY2.d.mts} +7 -1
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +48 -50
- package/dist/production/dom-export.mjs +23 -25
- package/dist/{development/index-react-server-client-CSv-KZBk.d.ts → production/index-react-server-client-BS5F89FR.d.ts} +10 -2
- package/dist/{development/index-react-server-client-Ck_yZ1qL.d.mts → production/index-react-server-client-DY04-103.d.mts} +10 -2
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- 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.d.mts +6 -0
- package/dist/production/index-react-server.d.ts +6 -0
- package/dist/production/index-react-server.js +4 -4
- package/dist/production/index-react-server.mjs +4 -4
- package/dist/production/index.d.mts +91 -9
- package/dist/production/index.d.ts +91 -9
- package/dist/production/index.js +103 -100
- package/dist/production/index.mjs +5 -3
- package/dist/{development/instrumentation-DlJ2QV7d.d.ts → production/instrumentation-cRWWLfsU.d.ts} +7 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
|
@@ -1593,6 +1593,8 @@ type NavigationStates = {
|
|
|
1593
1593
|
Idle: {
|
|
1594
1594
|
state: "idle";
|
|
1595
1595
|
location: undefined;
|
|
1596
|
+
matches: undefined;
|
|
1597
|
+
historyAction: undefined;
|
|
1596
1598
|
formMethod: undefined;
|
|
1597
1599
|
formAction: undefined;
|
|
1598
1600
|
formEncType: undefined;
|
|
@@ -1603,6 +1605,8 @@ type NavigationStates = {
|
|
|
1603
1605
|
Loading: {
|
|
1604
1606
|
state: "loading";
|
|
1605
1607
|
location: Location;
|
|
1608
|
+
matches: DataRouteMatch[];
|
|
1609
|
+
historyAction: Action;
|
|
1606
1610
|
formMethod: Submission["formMethod"] | undefined;
|
|
1607
1611
|
formAction: Submission["formAction"] | undefined;
|
|
1608
1612
|
formEncType: Submission["formEncType"] | undefined;
|
|
@@ -1613,6 +1617,8 @@ type NavigationStates = {
|
|
|
1613
1617
|
Submitting: {
|
|
1614
1618
|
state: "submitting";
|
|
1615
1619
|
location: Location;
|
|
1620
|
+
matches: DataRouteMatch[];
|
|
1621
|
+
historyAction: Action;
|
|
1616
1622
|
formMethod: Submission["formMethod"];
|
|
1617
1623
|
formAction: Submission["formAction"];
|
|
1618
1624
|
formEncType: Submission["formEncType"];
|
|
@@ -1593,6 +1593,8 @@ type NavigationStates = {
|
|
|
1593
1593
|
Idle: {
|
|
1594
1594
|
state: "idle";
|
|
1595
1595
|
location: undefined;
|
|
1596
|
+
matches: undefined;
|
|
1597
|
+
historyAction: undefined;
|
|
1596
1598
|
formMethod: undefined;
|
|
1597
1599
|
formAction: undefined;
|
|
1598
1600
|
formEncType: undefined;
|
|
@@ -1603,6 +1605,8 @@ type NavigationStates = {
|
|
|
1603
1605
|
Loading: {
|
|
1604
1606
|
state: "loading";
|
|
1605
1607
|
location: Location;
|
|
1608
|
+
matches: DataRouteMatch[];
|
|
1609
|
+
historyAction: Action;
|
|
1606
1610
|
formMethod: Submission["formMethod"] | undefined;
|
|
1607
1611
|
formAction: Submission["formAction"] | undefined;
|
|
1608
1612
|
formEncType: Submission["formEncType"] | undefined;
|
|
@@ -1613,6 +1617,8 @@ type NavigationStates = {
|
|
|
1613
1617
|
Submitting: {
|
|
1614
1618
|
state: "submitting";
|
|
1615
1619
|
location: Location;
|
|
1620
|
+
matches: DataRouteMatch[];
|
|
1621
|
+
historyAction: Action;
|
|
1616
1622
|
formMethod: Submission["formMethod"];
|
|
1617
1623
|
formAction: Submission["formAction"];
|
|
1618
1624
|
formEncType: Submission["formEncType"];
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.15.
|
|
30
|
+
* react-router v7.15.1
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -2985,7 +2985,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2985
2985
|
let formState;
|
|
2986
2986
|
let skipRevalidation = false;
|
|
2987
2987
|
let potentialCSRFAttackError;
|
|
2988
|
-
if (request.method
|
|
2988
|
+
if (isMutationMethod(request.method)) {
|
|
2989
2989
|
try {
|
|
2990
2990
|
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
|
2991
2991
|
ctx.runningAction = true;
|
|
@@ -3493,7 +3493,7 @@ var unsign = async (cookie, secret) => {
|
|
|
3493
3493
|
let signature = byteStringToUint8Array(atob(hash));
|
|
3494
3494
|
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
|
3495
3495
|
return valid ? value : false;
|
|
3496
|
-
} catch (
|
|
3496
|
+
} catch (e) {
|
|
3497
3497
|
return false;
|
|
3498
3498
|
}
|
|
3499
3499
|
};
|
|
@@ -3594,7 +3594,7 @@ function encodeData(value) {
|
|
|
3594
3594
|
function decodeData(value) {
|
|
3595
3595
|
try {
|
|
3596
3596
|
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
|
3597
|
-
} catch (
|
|
3597
|
+
} catch (e) {
|
|
3598
3598
|
return {};
|
|
3599
3599
|
}
|
|
3600
3600
|
}
|
|
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v7.15.
|
|
9
|
+
* react-router v7.15.1
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -2964,7 +2964,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2964
2964
|
let formState;
|
|
2965
2965
|
let skipRevalidation = false;
|
|
2966
2966
|
let potentialCSRFAttackError;
|
|
2967
|
-
if (request.method
|
|
2967
|
+
if (isMutationMethod(request.method)) {
|
|
2968
2968
|
try {
|
|
2969
2969
|
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
|
2970
2970
|
ctx.runningAction = true;
|
|
@@ -3472,7 +3472,7 @@ var unsign = async (cookie, secret) => {
|
|
|
3472
3472
|
let signature = byteStringToUint8Array(atob(hash));
|
|
3473
3473
|
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
|
3474
3474
|
return valid ? value : false;
|
|
3475
|
-
} catch (
|
|
3475
|
+
} catch (e) {
|
|
3476
3476
|
return false;
|
|
3477
3477
|
}
|
|
3478
3478
|
};
|
|
@@ -3573,7 +3573,7 @@ function encodeData(value) {
|
|
|
3573
3573
|
function decodeData(value) {
|
|
3574
3574
|
try {
|
|
3575
3575
|
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
|
3576
|
-
} catch (
|
|
3576
|
+
} catch (e) {
|
|
3577
3577
|
return {};
|
|
3578
3578
|
}
|
|
3579
3579
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To,
|
|
1
|
+
import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-BVUf681J.mjs';
|
|
2
2
|
export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-BVUf681J.mjs';
|
|
3
|
-
import { c as Router, N as NavigateOptions, B as BlockerFunction,
|
|
4
|
-
export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction,
|
|
3
|
+
import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, g as Navigation, H as HydrationState, h as RouterState } from './context-ByvtofY2.mjs';
|
|
4
|
+
export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, i as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, j as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-ByvtofY2.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { a as RouteModules$1, P as Pages } from './register-Df8okEea.mjs';
|
|
8
8
|
export { b as Register } from './register-Df8okEea.mjs';
|
|
9
|
-
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-
|
|
10
|
-
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-
|
|
9
|
+
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DY04-103.mjs';
|
|
10
|
+
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DY04-103.mjs';
|
|
11
11
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
12
12
|
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
13
|
-
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-
|
|
14
|
-
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-
|
|
13
|
+
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-3AnU12UI.mjs';
|
|
14
|
+
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-3AnU12UI.mjs';
|
|
15
15
|
|
|
16
16
|
declare const SingleFetchRedirectSymbol: unique symbol;
|
|
17
17
|
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
|
@@ -548,7 +548,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
|
|
548
548
|
* @mode data
|
|
549
549
|
* @returns The current {@link Navigation} object
|
|
550
550
|
*/
|
|
551
|
-
declare function useNavigation(): Navigation
|
|
551
|
+
declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">;
|
|
552
552
|
/**
|
|
553
553
|
* Revalidate the data on the page for reasons outside of normal data mutations
|
|
554
554
|
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
|
@@ -878,6 +878,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
|
|
878
878
|
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
|
879
879
|
};
|
|
880
880
|
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
|
881
|
+
/**
|
|
882
|
+
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
|
883
|
+
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
|
884
|
+
*/
|
|
885
|
+
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
|
886
|
+
/**
|
|
887
|
+
* The shape of the `active` variant returned from
|
|
888
|
+
* {@link unstable_useRouterState}.
|
|
889
|
+
*/
|
|
890
|
+
type unstable_RouterStateActiveVariant = {
|
|
891
|
+
location: Location;
|
|
892
|
+
searchParams: URLSearchParams;
|
|
893
|
+
params: Params;
|
|
894
|
+
matches: unstable_RouterStateMatch[];
|
|
895
|
+
type: Action;
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* The shape of the `pending` variant returned from
|
|
899
|
+
* {@link unstable_useRouterState}. Extends
|
|
900
|
+
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
|
901
|
+
* submission fields mirroring {@link useNavigation} — submission fields are
|
|
902
|
+
* populated when the in-flight navigation was triggered by a form submission,
|
|
903
|
+
* otherwise `undefined`.
|
|
904
|
+
*/
|
|
905
|
+
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
|
906
|
+
type unstable_RouterStatePendingVariants = {
|
|
907
|
+
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
|
908
|
+
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* The return shape of {@link unstable_useRouterState}.
|
|
912
|
+
*
|
|
913
|
+
* `active` reflects the currently-committed location. `pending` reflects the
|
|
914
|
+
* in-flight navigation (if any).
|
|
915
|
+
*/
|
|
916
|
+
type unstable_RouterState = {
|
|
917
|
+
active: unstable_RouterStateActiveVariant;
|
|
918
|
+
pending: unstable_RouterStatePendingVariant | null;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* A unified hook for reading router state: current (`active`) and in-flight
|
|
922
|
+
* (`pending`) locations, search params, params, matches, and navigation type.
|
|
923
|
+
*
|
|
924
|
+
* This hook consolidates the information you used to get from {@link useLocation},
|
|
925
|
+
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
|
926
|
+
* and {@link useNavigationType} into a single hook.
|
|
927
|
+
*
|
|
928
|
+
*
|
|
929
|
+
* @example
|
|
930
|
+
* import { unstable_useRouterState as useRouterState } from "react-router";
|
|
931
|
+
*
|
|
932
|
+
* let { active, pending } = unstable_useRouterState();
|
|
933
|
+
*
|
|
934
|
+
* // Active is always populated with the current location
|
|
935
|
+
* active.location; // replaces `useLocation()`
|
|
936
|
+
* active.searchParams; // replaces `useSearchParams()[0]`
|
|
937
|
+
* active.params; // replaces `useParams()`
|
|
938
|
+
* active.matches; // replaces `useMatches()`
|
|
939
|
+
* active.type; // replaces `useNavigationType()`
|
|
940
|
+
*
|
|
941
|
+
* // Pending is only populated during a navigation
|
|
942
|
+
* pending.location; // replaces `useNavigation().location`
|
|
943
|
+
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
|
944
|
+
* pending.params; // Not directly accessible today
|
|
945
|
+
* pending.matches; // Not directly accessible today
|
|
946
|
+
* pending.type; // Not directly accessible today
|
|
947
|
+
* pending.state; // replaces `useNavigation().state`
|
|
948
|
+
* pending.formMethod; // replaces useNavigation().formMethod
|
|
949
|
+
* pending.formAction; // replaces useNavigation().formAction
|
|
950
|
+
* pending.formEncType; // replaces useNavigation().formEncType
|
|
951
|
+
* pending.formData; // replaces useNavigation().formData
|
|
952
|
+
* pending.json; // replaces useNavigation().json
|
|
953
|
+
* pending.text; // replaces useNavigation().text
|
|
954
|
+
*
|
|
955
|
+
* @name unstable_useRouterState
|
|
956
|
+
* @public
|
|
957
|
+
* @category Hooks
|
|
958
|
+
* @mode framework
|
|
959
|
+
* @mode data
|
|
960
|
+
* @returns The current router state with `active` and `pending` variants
|
|
961
|
+
*/
|
|
962
|
+
declare function useRouterState(): unstable_RouterState;
|
|
881
963
|
|
|
882
964
|
/**
|
|
883
965
|
* @category Types
|
|
@@ -1387,4 +1469,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
|
|
1387
1469
|
declare const unstable_getRequest: typeof getRequest;
|
|
1388
1470
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
1389
1471
|
|
|
1390
|
-
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
1472
|
+
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To,
|
|
1
|
+
import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-BqZ2x964.js';
|
|
2
2
|
export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-BqZ2x964.js';
|
|
3
|
-
import { a as Router, B as BlockerFunction, b as Blocker, c as RelativeRoutingType,
|
|
4
|
-
export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction,
|
|
5
|
-
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-
|
|
6
|
-
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-
|
|
3
|
+
import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, d as Navigation, H as HydrationState, e as RouterState } from './instrumentation-cRWWLfsU.js';
|
|
4
|
+
export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, f as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, g as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-cRWWLfsU.js';
|
|
5
|
+
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-BS5F89FR.js';
|
|
6
|
+
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-BS5F89FR.js';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import React__default, { ReactElement } from 'react';
|
|
9
9
|
import { a as RouteModules$1, P as Pages } from './register-Bsscfj79.js';
|
|
10
10
|
export { b as Register } from './register-Bsscfj79.js';
|
|
11
11
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
12
12
|
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
13
|
-
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-
|
|
14
|
-
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-
|
|
13
|
+
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-BOdXz9dK.js';
|
|
14
|
+
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-BOdXz9dK.js';
|
|
15
15
|
|
|
16
16
|
declare const SingleFetchRedirectSymbol: unique symbol;
|
|
17
17
|
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
|
@@ -548,7 +548,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
|
|
548
548
|
* @mode data
|
|
549
549
|
* @returns The current {@link Navigation} object
|
|
550
550
|
*/
|
|
551
|
-
declare function useNavigation(): Navigation
|
|
551
|
+
declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">;
|
|
552
552
|
/**
|
|
553
553
|
* Revalidate the data on the page for reasons outside of normal data mutations
|
|
554
554
|
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
|
@@ -878,6 +878,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
|
|
878
878
|
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
|
879
879
|
};
|
|
880
880
|
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
|
881
|
+
/**
|
|
882
|
+
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
|
883
|
+
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
|
884
|
+
*/
|
|
885
|
+
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
|
886
|
+
/**
|
|
887
|
+
* The shape of the `active` variant returned from
|
|
888
|
+
* {@link unstable_useRouterState}.
|
|
889
|
+
*/
|
|
890
|
+
type unstable_RouterStateActiveVariant = {
|
|
891
|
+
location: Location;
|
|
892
|
+
searchParams: URLSearchParams;
|
|
893
|
+
params: Params;
|
|
894
|
+
matches: unstable_RouterStateMatch[];
|
|
895
|
+
type: Action;
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* The shape of the `pending` variant returned from
|
|
899
|
+
* {@link unstable_useRouterState}. Extends
|
|
900
|
+
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
|
901
|
+
* submission fields mirroring {@link useNavigation} — submission fields are
|
|
902
|
+
* populated when the in-flight navigation was triggered by a form submission,
|
|
903
|
+
* otherwise `undefined`.
|
|
904
|
+
*/
|
|
905
|
+
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
|
906
|
+
type unstable_RouterStatePendingVariants = {
|
|
907
|
+
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
|
908
|
+
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* The return shape of {@link unstable_useRouterState}.
|
|
912
|
+
*
|
|
913
|
+
* `active` reflects the currently-committed location. `pending` reflects the
|
|
914
|
+
* in-flight navigation (if any).
|
|
915
|
+
*/
|
|
916
|
+
type unstable_RouterState = {
|
|
917
|
+
active: unstable_RouterStateActiveVariant;
|
|
918
|
+
pending: unstable_RouterStatePendingVariant | null;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* A unified hook for reading router state: current (`active`) and in-flight
|
|
922
|
+
* (`pending`) locations, search params, params, matches, and navigation type.
|
|
923
|
+
*
|
|
924
|
+
* This hook consolidates the information you used to get from {@link useLocation},
|
|
925
|
+
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
|
926
|
+
* and {@link useNavigationType} into a single hook.
|
|
927
|
+
*
|
|
928
|
+
*
|
|
929
|
+
* @example
|
|
930
|
+
* import { unstable_useRouterState as useRouterState } from "react-router";
|
|
931
|
+
*
|
|
932
|
+
* let { active, pending } = unstable_useRouterState();
|
|
933
|
+
*
|
|
934
|
+
* // Active is always populated with the current location
|
|
935
|
+
* active.location; // replaces `useLocation()`
|
|
936
|
+
* active.searchParams; // replaces `useSearchParams()[0]`
|
|
937
|
+
* active.params; // replaces `useParams()`
|
|
938
|
+
* active.matches; // replaces `useMatches()`
|
|
939
|
+
* active.type; // replaces `useNavigationType()`
|
|
940
|
+
*
|
|
941
|
+
* // Pending is only populated during a navigation
|
|
942
|
+
* pending.location; // replaces `useNavigation().location`
|
|
943
|
+
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
|
944
|
+
* pending.params; // Not directly accessible today
|
|
945
|
+
* pending.matches; // Not directly accessible today
|
|
946
|
+
* pending.type; // Not directly accessible today
|
|
947
|
+
* pending.state; // replaces `useNavigation().state`
|
|
948
|
+
* pending.formMethod; // replaces useNavigation().formMethod
|
|
949
|
+
* pending.formAction; // replaces useNavigation().formAction
|
|
950
|
+
* pending.formEncType; // replaces useNavigation().formEncType
|
|
951
|
+
* pending.formData; // replaces useNavigation().formData
|
|
952
|
+
* pending.json; // replaces useNavigation().json
|
|
953
|
+
* pending.text; // replaces useNavigation().text
|
|
954
|
+
*
|
|
955
|
+
* @name unstable_useRouterState
|
|
956
|
+
* @public
|
|
957
|
+
* @category Hooks
|
|
958
|
+
* @mode framework
|
|
959
|
+
* @mode data
|
|
960
|
+
* @returns The current router state with `active` and `pending` variants
|
|
961
|
+
*/
|
|
962
|
+
declare function useRouterState(): unstable_RouterState;
|
|
881
963
|
|
|
882
964
|
/**
|
|
883
965
|
* @category Types
|
|
@@ -1387,4 +1469,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
|
|
1387
1469
|
declare const unstable_getRequest: typeof getRequest;
|
|
1388
1470
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
1389
1471
|
|
|
1390
|
-
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
|
1472
|
+
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|