react-router 7.14.1 → 7.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/dist/development/{browser-D-3-U2Jj.d.mts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{production/browser-D-3-U2Jj.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/{production/chunk-3SUPTI2U.js → development/chunk-2D5H3HU3.js} +7 -7
- package/dist/development/{chunk-OE4NN4TA.mjs → chunk-5KNZJZUH.mjs} +362 -213
- package/dist/development/{chunk-YMKMFAYZ.js → chunk-AM3XM4LS.js} +314 -172
- package/dist/development/{chunk-BFXCU3MI.mjs → chunk-RMD3H4O3.mjs} +81 -62
- package/dist/development/{chunk-3F6IB66O.js → chunk-Z5YQYACE.js} +146 -139
- package/dist/{production/context-BzhbVly6.d.mts → development/context-BQs41HrG.d.mts} +94 -42
- package/dist/development/{routeModules-CM_clkdE.d.ts → data-BVUf681J.d.mts} +89 -56
- package/dist/{production/routeModules-CM_clkdE.d.ts → development/data-BqZ2x964.d.ts} +79 -46
- package/dist/development/dom-export.d.mts +9 -9
- package/dist/development/dom-export.d.ts +9 -9
- package/dist/development/dom-export.js +37 -40
- package/dist/development/dom-export.mjs +12 -15
- package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -36
- package/dist/development/index-react-server.d.ts +107 -36
- package/dist/development/index-react-server.js +60 -33
- package/dist/development/index-react-server.mjs +60 -33
- package/dist/development/index.d.mts +11 -11
- package/dist/development/index.d.ts +11 -11
- package/dist/development/index.js +174 -155
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-D1WlEpq9.d.ts → register-Bsscfj79.d.ts} +1 -1
- package/dist/{production/register-D1WlEpq9.d.ts → development/register-Df8okEea.d.mts} +1 -1
- package/dist/production/{browser-CtktEGQs.d.ts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{development/browser-CtktEGQs.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-23ZOHYE5.mjs} +81 -62
- package/dist/{development/chunk-7VLQJKNG.js → production/chunk-7YXKJMLN.js} +7 -7
- package/dist/production/{chunk-SPR7R4GU.mjs → chunk-GM3PW4GX.mjs} +362 -213
- package/dist/production/{chunk-UVEQGZIH.js → chunk-LCJTIOKZ.js} +314 -172
- package/dist/production/{chunk-LIOP3ILM.js → chunk-YBQJ3ABE.js} +146 -139
- package/dist/{development/context-BzhbVly6.d.mts → production/context-BQs41HrG.d.mts} +94 -42
- package/dist/{development/routeModules-Djumx26z.d.mts → production/data-BVUf681J.d.mts} +79 -46
- package/dist/production/{routeModules-Djumx26z.d.mts → data-BqZ2x964.d.ts} +89 -56
- package/dist/production/dom-export.d.mts +9 -9
- package/dist/production/dom-export.d.ts +9 -9
- package/dist/production/dom-export.js +37 -40
- package/dist/production/dom-export.mjs +12 -15
- package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -36
- package/dist/production/index-react-server.d.ts +107 -36
- package/dist/production/index-react-server.js +60 -33
- package/dist/production/index-react-server.mjs +60 -33
- package/dist/production/index.d.mts +11 -11
- package/dist/production/index.d.ts +11 -11
- package/dist/production/index.js +174 -155
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-aE9ob3TK.d.mts → production/register-Bsscfj79.d.ts} +1 -1
- package/dist/production/{register-aE9ob3TK.d.mts → register-Df8okEea.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
deserializeErrors,
|
|
15
15
|
getHydrationData,
|
|
16
16
|
populateRSCRouteModules
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-23ZOHYE5.mjs";
|
|
18
18
|
import {
|
|
19
19
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
20
20
|
ErrorResponseImpl,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
RSCRouterContext,
|
|
23
23
|
RemixErrorBoundary,
|
|
24
24
|
RouterProvider,
|
|
25
|
+
URL_LIMIT,
|
|
25
26
|
createBrowserHistory,
|
|
26
27
|
createClientRoutes,
|
|
27
28
|
createClientRoutesWithHMRRevalidationOptOut,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
singleFetchUrl,
|
|
44
45
|
stripIndexParam,
|
|
45
46
|
useFogOFWarDiscovery
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-GM3PW4GX.mjs";
|
|
47
48
|
|
|
48
49
|
// lib/dom-export/dom-router-provider.tsx
|
|
49
50
|
import * as React from "react";
|
|
@@ -82,7 +83,7 @@ function initSsrInfo() {
|
|
|
82
83
|
}
|
|
83
84
|
function createHydratedRouter({
|
|
84
85
|
getContext,
|
|
85
|
-
|
|
86
|
+
instrumentations
|
|
86
87
|
}) {
|
|
87
88
|
initSsrInfo();
|
|
88
89
|
if (!ssrInfo) {
|
|
@@ -155,10 +156,10 @@ function createHydratedRouter({
|
|
|
155
156
|
getContext,
|
|
156
157
|
hydrationData,
|
|
157
158
|
hydrationRouteProperties,
|
|
158
|
-
|
|
159
|
+
instrumentations,
|
|
159
160
|
mapRouteProperties,
|
|
160
161
|
future: {
|
|
161
|
-
|
|
162
|
+
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
|
162
163
|
},
|
|
163
164
|
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
|
164
165
|
() => router2,
|
|
@@ -192,7 +193,7 @@ function HydratedRouter(props) {
|
|
|
192
193
|
if (!router) {
|
|
193
194
|
router = createHydratedRouter({
|
|
194
195
|
getContext: props.getContext,
|
|
195
|
-
|
|
196
|
+
instrumentations: props.instrumentations
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
199
|
let [criticalCss, setCriticalCss] = React2.useState(
|
|
@@ -253,7 +254,7 @@ function HydratedRouter(props) {
|
|
|
253
254
|
RouterProvider2,
|
|
254
255
|
{
|
|
255
256
|
router,
|
|
256
|
-
|
|
257
|
+
useTransitions: props.useTransitions,
|
|
257
258
|
onError: props.onError
|
|
258
259
|
}
|
|
259
260
|
))
|
|
@@ -538,8 +539,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
538
539
|
hasClientLoader: M.route.hasClientLoader,
|
|
539
540
|
hasComponent: M.route.hasComponent,
|
|
540
541
|
hasAction: M.route.hasAction,
|
|
541
|
-
hasClientAction: M.route.hasClientAction
|
|
542
|
-
hasShouldRevalidate: M.route.hasShouldRevalidate
|
|
542
|
+
hasClientAction: M.route.hasClientAction
|
|
543
543
|
};
|
|
544
544
|
},
|
|
545
545
|
// pass map into fetchAndDecode so it can add payloads
|
|
@@ -742,10 +742,9 @@ function RSCHydratedRouter({
|
|
|
742
742
|
// These flags have no runtime impact so can always be false. If we add
|
|
743
743
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
744
744
|
v8_middleware: false,
|
|
745
|
-
unstable_subResourceIntegrity: false,
|
|
746
745
|
unstable_trailingSlashAwareDataRequests: true,
|
|
747
746
|
// always on for RSC
|
|
748
|
-
|
|
747
|
+
v8_passThroughRequests: true
|
|
749
748
|
// always on for RSC
|
|
750
749
|
},
|
|
751
750
|
isSpaMode: false,
|
|
@@ -843,8 +842,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
843
842
|
hasLoader: true,
|
|
844
843
|
hasClientLoader: match.clientLoader != null,
|
|
845
844
|
hasAction: match.hasAction,
|
|
846
|
-
hasClientAction: match.clientAction != null
|
|
847
|
-
hasShouldRevalidate: match.shouldRevalidate != null
|
|
845
|
+
hasClientAction: match.clientAction != null
|
|
848
846
|
};
|
|
849
847
|
if (typeof dataRoute.loader === "function") {
|
|
850
848
|
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
|
@@ -871,7 +869,6 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
871
869
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
872
870
|
var discoveredPathsMaxSize = 1e3;
|
|
873
871
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
874
|
-
var URL_LIMIT = 7680;
|
|
875
872
|
function getManifestUrl(paths) {
|
|
876
873
|
if (paths.length === 0) {
|
|
877
874
|
return null;
|
|
@@ -1,6 +1,70 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as ServerInstrumentation, H as HydrationState, f as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, d as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, e as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-DlJ2QV7d.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-BqZ2x964.js';
|
|
4
|
+
|
|
5
|
+
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
6
|
+
interface ServerRoute extends Route$1 {
|
|
7
|
+
children: ServerRoute[];
|
|
8
|
+
module: ServerRouteModule;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type OptionalCriticalCss = CriticalCss | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The output of the compiler for the server build.
|
|
14
|
+
*/
|
|
15
|
+
interface ServerBuild {
|
|
16
|
+
entry: {
|
|
17
|
+
module: ServerEntryModule;
|
|
18
|
+
};
|
|
19
|
+
routes: ServerRouteManifest;
|
|
20
|
+
assets: AssetsManifest;
|
|
21
|
+
basename?: string;
|
|
22
|
+
publicPath: string;
|
|
23
|
+
assetsBuildDirectory: string;
|
|
24
|
+
future: FutureConfig;
|
|
25
|
+
ssr: boolean;
|
|
26
|
+
unstable_getCriticalCss?: (args: {
|
|
27
|
+
pathname: string;
|
|
28
|
+
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated This is now done via a custom header during prerendering
|
|
31
|
+
*/
|
|
32
|
+
isSpaMode: boolean;
|
|
33
|
+
prerender: string[];
|
|
34
|
+
routeDiscovery: {
|
|
35
|
+
mode: "lazy" | "initial";
|
|
36
|
+
manifestPath: string;
|
|
37
|
+
};
|
|
38
|
+
allowedActionOrigins?: string[] | false;
|
|
39
|
+
}
|
|
40
|
+
interface HandleDocumentRequestFunction {
|
|
41
|
+
(request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
|
|
42
|
+
}
|
|
43
|
+
interface HandleDataRequestFunction {
|
|
44
|
+
(response: Response, args: {
|
|
45
|
+
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
46
|
+
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
47
|
+
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
48
|
+
}): Promise<Response> | Response;
|
|
49
|
+
}
|
|
50
|
+
interface HandleErrorFunction {
|
|
51
|
+
(error: unknown, args: {
|
|
52
|
+
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
53
|
+
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
54
|
+
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
55
|
+
}): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A module that serves as the entry point for a Remix app during server
|
|
59
|
+
* rendering.
|
|
60
|
+
*/
|
|
61
|
+
interface ServerEntryModule {
|
|
62
|
+
default: HandleDocumentRequestFunction;
|
|
63
|
+
handleDataRequest?: HandleDataRequestFunction;
|
|
64
|
+
handleError?: HandleErrorFunction;
|
|
65
|
+
instrumentations?: ServerInstrumentation[];
|
|
66
|
+
streamTimeout?: number;
|
|
67
|
+
}
|
|
4
68
|
|
|
5
69
|
interface Route$1 {
|
|
6
70
|
index?: boolean;
|
|
@@ -55,12 +119,12 @@ interface FrameworkContextObject {
|
|
|
55
119
|
};
|
|
56
120
|
}
|
|
57
121
|
interface EntryContext extends FrameworkContextObject {
|
|
122
|
+
branches: RouteBranch<DataRouteObject>[];
|
|
58
123
|
staticHandlerContext: StaticHandlerContext;
|
|
59
124
|
serverHandoffStream?: ReadableStream<Uint8Array>;
|
|
60
125
|
}
|
|
61
126
|
interface FutureConfig {
|
|
62
|
-
|
|
63
|
-
unstable_subResourceIntegrity: boolean;
|
|
127
|
+
v8_passThroughRequests: boolean;
|
|
64
128
|
unstable_trailingSlashAwareDataRequests: boolean;
|
|
65
129
|
v8_middleware: boolean;
|
|
66
130
|
}
|
|
@@ -83,71 +147,7 @@ interface AssetsManifest {
|
|
|
83
147
|
sri?: Record<string, string> | true;
|
|
84
148
|
}
|
|
85
149
|
|
|
86
|
-
|
|
87
|
-
interface ServerRoute extends Route$1 {
|
|
88
|
-
children: ServerRoute[];
|
|
89
|
-
module: ServerRouteModule;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
type OptionalCriticalCss = CriticalCss | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* The output of the compiler for the server build.
|
|
95
|
-
*/
|
|
96
|
-
interface ServerBuild {
|
|
97
|
-
entry: {
|
|
98
|
-
module: ServerEntryModule;
|
|
99
|
-
};
|
|
100
|
-
routes: ServerRouteManifest;
|
|
101
|
-
assets: AssetsManifest;
|
|
102
|
-
basename?: string;
|
|
103
|
-
publicPath: string;
|
|
104
|
-
assetsBuildDirectory: string;
|
|
105
|
-
future: FutureConfig;
|
|
106
|
-
ssr: boolean;
|
|
107
|
-
unstable_getCriticalCss?: (args: {
|
|
108
|
-
pathname: string;
|
|
109
|
-
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated This is now done via a custom header during prerendering
|
|
112
|
-
*/
|
|
113
|
-
isSpaMode: boolean;
|
|
114
|
-
prerender: string[];
|
|
115
|
-
routeDiscovery: {
|
|
116
|
-
mode: "lazy" | "initial";
|
|
117
|
-
manifestPath: string;
|
|
118
|
-
};
|
|
119
|
-
allowedActionOrigins?: string[] | false;
|
|
120
|
-
}
|
|
121
|
-
interface HandleDocumentRequestFunction {
|
|
122
|
-
(request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
|
|
123
|
-
}
|
|
124
|
-
interface HandleDataRequestFunction {
|
|
125
|
-
(response: Response, args: {
|
|
126
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
127
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
128
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
129
|
-
}): Promise<Response> | Response;
|
|
130
|
-
}
|
|
131
|
-
interface HandleErrorFunction {
|
|
132
|
-
(error: unknown, args: {
|
|
133
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
134
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
135
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
136
|
-
}): void;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* A module that serves as the entry point for a Remix app during server
|
|
140
|
-
* rendering.
|
|
141
|
-
*/
|
|
142
|
-
interface ServerEntryModule {
|
|
143
|
-
default: HandleDocumentRequestFunction;
|
|
144
|
-
handleDataRequest?: HandleDataRequestFunction;
|
|
145
|
-
handleError?: HandleErrorFunction;
|
|
146
|
-
unstable_instrumentations?: unstable_ServerInstrumentation[];
|
|
147
|
-
streamTimeout?: number;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "unstable_useTransitions"> {
|
|
150
|
+
interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> {
|
|
151
151
|
router: Router$1;
|
|
152
152
|
staticContext?: StaticHandlerContext;
|
|
153
153
|
onError?: ClientOnErrorFunction;
|
|
@@ -171,7 +171,7 @@ interface NavigateOptions {
|
|
|
171
171
|
/** Replace the current entry in the history stack instead of pushing a new one */
|
|
172
172
|
replace?: boolean;
|
|
173
173
|
/** Masked URL */
|
|
174
|
-
|
|
174
|
+
mask?: To;
|
|
175
175
|
/** Adds persistent client side routing state to the next location */
|
|
176
176
|
state?: any;
|
|
177
177
|
/** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */
|
|
@@ -183,7 +183,7 @@ interface NavigateOptions {
|
|
|
183
183
|
/** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link useViewTransitionState `useViewTransitionState()`} hook. */
|
|
184
184
|
viewTransition?: boolean;
|
|
185
185
|
/** Specifies the default revalidation behavior after this submission */
|
|
186
|
-
|
|
186
|
+
defaultShouldRevalidate?: boolean;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* A Navigator is a "location changer"; it's how you get to different locations.
|
|
@@ -205,7 +205,7 @@ interface NavigationContextObject {
|
|
|
205
205
|
basename: string;
|
|
206
206
|
navigator: Navigator;
|
|
207
207
|
static: boolean;
|
|
208
|
-
|
|
208
|
+
useTransitions: boolean | undefined;
|
|
209
209
|
future: {};
|
|
210
210
|
}
|
|
211
211
|
declare const NavigationContext: React.Context<NavigationContextObject>;
|
|
@@ -268,7 +268,7 @@ interface MemoryRouterOpts {
|
|
|
268
268
|
*
|
|
269
269
|
* ```tsx
|
|
270
270
|
* let router = createBrowserRouter(routes, {
|
|
271
|
-
*
|
|
271
|
+
* instrumentations: [logging]
|
|
272
272
|
* });
|
|
273
273
|
*
|
|
274
274
|
*
|
|
@@ -306,7 +306,7 @@ interface MemoryRouterOpts {
|
|
|
306
306
|
* }
|
|
307
307
|
* ```
|
|
308
308
|
*/
|
|
309
|
-
|
|
309
|
+
instrumentations?: ClientInstrumentation[];
|
|
310
310
|
/**
|
|
311
311
|
* Override the default data strategy of running loaders in parallel -
|
|
312
312
|
* see the [docs](../../how-to/data-strategy) for more information.
|
|
@@ -358,7 +358,7 @@ interface MemoryRouterOpts {
|
|
|
358
358
|
* @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
|
|
359
359
|
* @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
|
|
360
360
|
* @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
|
|
361
|
-
* @param {MemoryRouterOpts.
|
|
361
|
+
* @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a
|
|
362
362
|
* @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
|
|
363
363
|
* @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
|
|
364
364
|
*/
|
|
@@ -371,7 +371,7 @@ interface ClientOnErrorFunction {
|
|
|
371
371
|
(error: unknown, info: {
|
|
372
372
|
location: Location;
|
|
373
373
|
params: Params;
|
|
374
|
-
|
|
374
|
+
pattern: string;
|
|
375
375
|
errorInfo?: React.ErrorInfo;
|
|
376
376
|
}): void;
|
|
377
377
|
}
|
|
@@ -405,7 +405,7 @@ interface RouterProviderProps {
|
|
|
405
405
|
*
|
|
406
406
|
* ```tsx
|
|
407
407
|
* <RouterProvider onError=(error, info) => {
|
|
408
|
-
* let { location, params,
|
|
408
|
+
* let { location, params, pattern, errorInfo } = info;
|
|
409
409
|
* console.error(error, location, errorInfo);
|
|
410
410
|
* reportToErrorService(error, location, errorInfo);
|
|
411
411
|
* }} />
|
|
@@ -428,9 +428,9 @@ interface RouterProviderProps {
|
|
|
428
428
|
* - When set to `false`, the router will not leverage `React.startTransition` or
|
|
429
429
|
* `React.useOptimistic` on any navigations or state changes.
|
|
430
430
|
*
|
|
431
|
-
* For more information, please see the [docs](
|
|
431
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
432
432
|
*/
|
|
433
|
-
|
|
433
|
+
useTransitions?: boolean;
|
|
434
434
|
}
|
|
435
435
|
/**
|
|
436
436
|
* Render the UI for the given {@link DataRouter}. This component should
|
|
@@ -461,10 +461,10 @@ interface RouterProviderProps {
|
|
|
461
461
|
* @param {RouterProviderProps.flushSync} props.flushSync n/a
|
|
462
462
|
* @param {RouterProviderProps.onError} props.onError n/a
|
|
463
463
|
* @param {RouterProviderProps.router} props.router n/a
|
|
464
|
-
* @param {RouterProviderProps.
|
|
464
|
+
* @param {RouterProviderProps.useTransitions} props.useTransitions n/a
|
|
465
465
|
* @returns React element for the rendered router
|
|
466
466
|
*/
|
|
467
|
-
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError,
|
|
467
|
+
declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement;
|
|
468
468
|
/**
|
|
469
469
|
* @category Types
|
|
470
470
|
*/
|
|
@@ -497,9 +497,9 @@ interface MemoryRouterProps {
|
|
|
497
497
|
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
498
498
|
* on any navigations or state changes.
|
|
499
499
|
*
|
|
500
|
-
* For more information, please see the [docs](
|
|
500
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
501
501
|
*/
|
|
502
|
-
|
|
502
|
+
useTransitions?: boolean;
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* A declarative {@link Router | `<Router>`} that stores all entries in memory.
|
|
@@ -512,11 +512,11 @@ interface MemoryRouterProps {
|
|
|
512
512
|
* @param {MemoryRouterProps.children} props.children n/a
|
|
513
513
|
* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
|
|
514
514
|
* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
|
|
515
|
-
* @param {MemoryRouterProps.
|
|
515
|
+
* @param {MemoryRouterProps.useTransitions} props.useTransitions n/a
|
|
516
516
|
* @returns A declarative in-memory {@link Router | `<Router>`} for client-side
|
|
517
517
|
* routing.
|
|
518
518
|
*/
|
|
519
|
-
declare function MemoryRouter({ basename, children, initialEntries, initialIndex,
|
|
519
|
+
declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement;
|
|
520
520
|
/**
|
|
521
521
|
* @category Types
|
|
522
522
|
*/
|
|
@@ -884,9 +884,9 @@ interface RouterProps {
|
|
|
884
884
|
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
885
885
|
* on any navigations or state changes.
|
|
886
886
|
*
|
|
887
|
-
* For more information, please see the [docs](
|
|
887
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
888
888
|
*/
|
|
889
|
-
|
|
889
|
+
useTransitions?: boolean;
|
|
890
890
|
}
|
|
891
891
|
/**
|
|
892
892
|
* Provides location context for the rest of the app.
|
|
@@ -905,11 +905,11 @@ interface RouterProps {
|
|
|
905
905
|
* @param {RouterProps.navigationType} props.navigationType n/a
|
|
906
906
|
* @param {RouterProps.navigator} props.navigator n/a
|
|
907
907
|
* @param {RouterProps.static} props.static n/a
|
|
908
|
-
* @param {RouterProps.
|
|
908
|
+
* @param {RouterProps.useTransitions} props.useTransitions n/a
|
|
909
909
|
* @returns React element for the rendered router or `null` if the location does
|
|
910
910
|
* not match the {@link props.basename}
|
|
911
911
|
*/
|
|
912
|
-
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp,
|
|
912
|
+
declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null;
|
|
913
913
|
/**
|
|
914
914
|
* @category Types
|
|
915
915
|
*/
|
|
@@ -1285,7 +1285,7 @@ interface SharedSubmitOptions {
|
|
|
1285
1285
|
* By default (when not specified), loaders will revalidate according to the routers
|
|
1286
1286
|
* standard revalidation behavior.
|
|
1287
1287
|
*/
|
|
1288
|
-
|
|
1288
|
+
defaultShouldRevalidate?: boolean;
|
|
1289
1289
|
}
|
|
1290
1290
|
/**
|
|
1291
1291
|
* Submit options available to fetchers
|
|
@@ -1619,7 +1619,7 @@ interface DOMRouterOpts {
|
|
|
1619
1619
|
*
|
|
1620
1620
|
* ```tsx
|
|
1621
1621
|
* let router = createBrowserRouter(routes, {
|
|
1622
|
-
*
|
|
1622
|
+
* instrumentations: [logging]
|
|
1623
1623
|
* });
|
|
1624
1624
|
*
|
|
1625
1625
|
*
|
|
@@ -1657,7 +1657,7 @@ interface DOMRouterOpts {
|
|
|
1657
1657
|
* }
|
|
1658
1658
|
* ```
|
|
1659
1659
|
*/
|
|
1660
|
-
|
|
1660
|
+
instrumentations?: ClientInstrumentation[];
|
|
1661
1661
|
/**
|
|
1662
1662
|
* Override the default data strategy of running loaders in parallel -
|
|
1663
1663
|
* see the [docs](../../how-to/data-strategy) for more information.
|
|
@@ -2006,7 +2006,7 @@ interface DOMRouterOpts {
|
|
|
2006
2006
|
* @param {DOMRouterOpts.future} opts.future n/a
|
|
2007
2007
|
* @param {DOMRouterOpts.getContext} opts.getContext n/a
|
|
2008
2008
|
* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
|
|
2009
|
-
* @param {DOMRouterOpts.
|
|
2009
|
+
* @param {DOMRouterOpts.instrumentations} opts.instrumentations n/a
|
|
2010
2010
|
* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
|
|
2011
2011
|
* @param {DOMRouterOpts.window} opts.window n/a
|
|
2012
2012
|
* @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
|
|
@@ -2025,7 +2025,7 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
|
|
|
2025
2025
|
* @param {DOMRouterOpts.future} opts.future n/a
|
|
2026
2026
|
* @param {DOMRouterOpts.getContext} opts.getContext n/a
|
|
2027
2027
|
* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
|
|
2028
|
-
* @param {DOMRouterOpts.
|
|
2028
|
+
* @param {DOMRouterOpts.instrumentations} opts.instrumentations n/a
|
|
2029
2029
|
* @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a
|
|
2030
2030
|
* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
|
|
2031
2031
|
* @param {DOMRouterOpts.window} opts.window n/a
|
|
@@ -2056,9 +2056,9 @@ interface BrowserRouterProps {
|
|
|
2056
2056
|
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
2057
2057
|
* on any navigations or state changes.
|
|
2058
2058
|
*
|
|
2059
|
-
* For more information, please see the [docs](
|
|
2059
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
2060
2060
|
*/
|
|
2061
|
-
|
|
2061
|
+
useTransitions?: boolean;
|
|
2062
2062
|
/**
|
|
2063
2063
|
* [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) object
|
|
2064
2064
|
* override. Defaults to the global `window` instance
|
|
@@ -2075,12 +2075,12 @@ interface BrowserRouterProps {
|
|
|
2075
2075
|
* @param props Props
|
|
2076
2076
|
* @param {BrowserRouterProps.basename} props.basename n/a
|
|
2077
2077
|
* @param {BrowserRouterProps.children} props.children n/a
|
|
2078
|
-
* @param {BrowserRouterProps.
|
|
2078
|
+
* @param {BrowserRouterProps.useTransitions} props.useTransitions n/a
|
|
2079
2079
|
* @param {BrowserRouterProps.window} props.window n/a
|
|
2080
2080
|
* @returns A declarative {@link Router | `<Router>`} using the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
|
|
2081
2081
|
* API for client-side routing.
|
|
2082
2082
|
*/
|
|
2083
|
-
declare function BrowserRouter({ basename, children,
|
|
2083
|
+
declare function BrowserRouter({ basename, children, useTransitions, window, }: BrowserRouterProps): React.JSX.Element;
|
|
2084
2084
|
/**
|
|
2085
2085
|
* @category Types
|
|
2086
2086
|
*/
|
|
@@ -2105,9 +2105,9 @@ interface HashRouterProps {
|
|
|
2105
2105
|
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
2106
2106
|
* on any navigations or state changes.
|
|
2107
2107
|
*
|
|
2108
|
-
* For more information, please see the [docs](
|
|
2108
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
2109
2109
|
*/
|
|
2110
|
-
|
|
2110
|
+
useTransitions?: boolean;
|
|
2111
2111
|
/**
|
|
2112
2112
|
* [`Window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) object
|
|
2113
2113
|
* override. Defaults to the global `window` instance
|
|
@@ -2125,12 +2125,12 @@ interface HashRouterProps {
|
|
|
2125
2125
|
* @param props Props
|
|
2126
2126
|
* @param {HashRouterProps.basename} props.basename n/a
|
|
2127
2127
|
* @param {HashRouterProps.children} props.children n/a
|
|
2128
|
-
* @param {HashRouterProps.
|
|
2128
|
+
* @param {HashRouterProps.useTransitions} props.useTransitions n/a
|
|
2129
2129
|
* @param {HashRouterProps.window} props.window n/a
|
|
2130
2130
|
* @returns A declarative {@link Router | `<Router>`} using the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash)
|
|
2131
2131
|
* for client-side routing.
|
|
2132
2132
|
*/
|
|
2133
|
-
declare function HashRouter({ basename, children,
|
|
2133
|
+
declare function HashRouter({ basename, children, useTransitions, window, }: HashRouterProps): React.JSX.Element;
|
|
2134
2134
|
/**
|
|
2135
2135
|
* @category Types
|
|
2136
2136
|
*/
|
|
@@ -2159,9 +2159,9 @@ interface HistoryRouterProps {
|
|
|
2159
2159
|
* - When set to `false`, the router will not leverage `React.startTransition`
|
|
2160
2160
|
* on any navigations or state changes.
|
|
2161
2161
|
*
|
|
2162
|
-
* For more information, please see the [docs](
|
|
2162
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
2163
2163
|
*/
|
|
2164
|
-
|
|
2164
|
+
useTransitions?: boolean;
|
|
2165
2165
|
}
|
|
2166
2166
|
/**
|
|
2167
2167
|
* A declarative {@link Router | `<Router>`} that accepts a pre-instantiated
|
|
@@ -2178,11 +2178,11 @@ interface HistoryRouterProps {
|
|
|
2178
2178
|
* @param {HistoryRouterProps.basename} props.basename n/a
|
|
2179
2179
|
* @param {HistoryRouterProps.children} props.children n/a
|
|
2180
2180
|
* @param {HistoryRouterProps.history} props.history n/a
|
|
2181
|
-
* @param {HistoryRouterProps.
|
|
2181
|
+
* @param {HistoryRouterProps.useTransitions} props.useTransitions n/a
|
|
2182
2182
|
* @returns A declarative {@link Router | `<Router>`} using the provided history
|
|
2183
2183
|
* implementation for client-side routing.
|
|
2184
2184
|
*/
|
|
2185
|
-
declare function HistoryRouter({ basename, children, history,
|
|
2185
|
+
declare function HistoryRouter({ basename, children, history, useTransitions, }: HistoryRouterProps): React.JSX.Element;
|
|
2186
2186
|
declare namespace HistoryRouter {
|
|
2187
2187
|
var displayName: string;
|
|
2188
2188
|
}
|
|
@@ -2349,7 +2349,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
|
2349
2349
|
* Specify the default revalidation behavior for the navigation.
|
|
2350
2350
|
*
|
|
2351
2351
|
* ```tsx
|
|
2352
|
-
* <Link to="/some/path"
|
|
2352
|
+
* <Link to="/some/path" defaultShouldRevalidate={false} />
|
|
2353
2353
|
* ```
|
|
2354
2354
|
*
|
|
2355
2355
|
* If no `shouldRevalidate` functions are present on the active routes, then this
|
|
@@ -2360,7 +2360,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
|
2360
2360
|
* By default (when not specified), loaders will revalidate according to the routers
|
|
2361
2361
|
* standard revalidation behavior.
|
|
2362
2362
|
*/
|
|
2363
|
-
|
|
2363
|
+
defaultShouldRevalidate?: boolean;
|
|
2364
2364
|
/**
|
|
2365
2365
|
* Masked path for this navigation, when you want to navigate the router to
|
|
2366
2366
|
* one location but display a separate location in the URL bar.
|
|
@@ -2391,7 +2391,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
|
2391
2391
|
* <Link
|
|
2392
2392
|
* key={image.id}
|
|
2393
2393
|
* to={`/gallery?image=${image.id}`}
|
|
2394
|
-
*
|
|
2394
|
+
* mask={`/images/${image.id}`}
|
|
2395
2395
|
* >
|
|
2396
2396
|
* <img src={image.url} alt={image.alt} />
|
|
2397
2397
|
* </Link>
|
|
@@ -2408,7 +2408,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
|
2408
2408
|
* }
|
|
2409
2409
|
* ```
|
|
2410
2410
|
*/
|
|
2411
|
-
|
|
2411
|
+
mask?: To;
|
|
2412
2412
|
}
|
|
2413
2413
|
/**
|
|
2414
2414
|
* A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
|
|
@@ -2438,8 +2438,8 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
|
2438
2438
|
* @param {LinkProps.state} props.state n/a
|
|
2439
2439
|
* @param {LinkProps.to} props.to n/a
|
|
2440
2440
|
* @param {LinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a
|
|
2441
|
-
* @param {LinkProps.
|
|
2442
|
-
* @param {LinkProps.
|
|
2441
|
+
* @param {LinkProps.defaultShouldRevalidate} props.defaultShouldRevalidate n/a
|
|
2442
|
+
* @param {LinkProps.mask} props.mask [modes: framework, data] n/a
|
|
2443
2443
|
*/
|
|
2444
2444
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
2445
2445
|
/**
|
|
@@ -2680,7 +2680,7 @@ interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
|
|
2680
2680
|
* By default (when not specified), loaders will revalidate according to the routers
|
|
2681
2681
|
* standard revalidation behavior.
|
|
2682
2682
|
*/
|
|
2683
|
-
|
|
2683
|
+
defaultShouldRevalidate?: boolean;
|
|
2684
2684
|
}
|
|
2685
2685
|
/**
|
|
2686
2686
|
* Form props available to fetchers
|
|
@@ -2788,7 +2788,7 @@ interface FormProps extends SharedFormProps {
|
|
|
2788
2788
|
* @param {FormProps.replace} replace n/a
|
|
2789
2789
|
* @param {FormProps.state} state n/a
|
|
2790
2790
|
* @param {FormProps.viewTransition} viewTransition n/a
|
|
2791
|
-
* @param {FormProps.
|
|
2791
|
+
* @param {FormProps.defaultShouldRevalidate} defaultShouldRevalidate n/a
|
|
2792
2792
|
* @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component
|
|
2793
2793
|
*/
|
|
2794
2794
|
declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
|
|
@@ -2879,25 +2879,25 @@ declare namespace ScrollRestoration {
|
|
|
2879
2879
|
* @param options.viewTransition Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
2880
2880
|
* for this navigation. To apply specific styles during the transition, see
|
|
2881
2881
|
* {@link useViewTransitionState}. Defaults to `false`.
|
|
2882
|
-
* @param options.
|
|
2882
|
+
* @param options.defaultShouldRevalidate Specify the default revalidation
|
|
2883
2883
|
* behavior for the navigation. Defaults to `true`.
|
|
2884
|
-
* @param options.
|
|
2884
|
+
* @param options.mask Masked location to display in the browser instead
|
|
2885
2885
|
* of the router location. Defaults to `undefined`.
|
|
2886
|
-
* @param options.
|
|
2886
|
+
* @param options.useTransitions Wraps the navigation in
|
|
2887
2887
|
* [`React.startTransition`](https://react.dev/reference/react/startTransition)
|
|
2888
2888
|
* for concurrent rendering. Defaults to `false`.
|
|
2889
2889
|
* @returns A click handler function that can be used in a custom {@link Link} component.
|
|
2890
2890
|
*/
|
|
2891
|
-
declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp,
|
|
2891
|
+
declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, mask, state, preventScrollReset, relative, viewTransition, defaultShouldRevalidate, useTransitions, }?: {
|
|
2892
2892
|
target?: React.HTMLAttributeAnchorTarget;
|
|
2893
2893
|
replace?: boolean;
|
|
2894
|
-
|
|
2894
|
+
mask?: To;
|
|
2895
2895
|
state?: any;
|
|
2896
2896
|
preventScrollReset?: boolean;
|
|
2897
2897
|
relative?: RelativeRoutingType;
|
|
2898
2898
|
viewTransition?: boolean;
|
|
2899
|
-
|
|
2900
|
-
|
|
2899
|
+
defaultShouldRevalidate?: boolean;
|
|
2900
|
+
useTransitions?: boolean;
|
|
2901
2901
|
}): (event: React.MouseEvent<E, MouseEvent>) => void;
|
|
2902
2902
|
/**
|
|
2903
2903
|
* Returns a tuple of the current URL's [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
|
|
@@ -3636,9 +3636,11 @@ declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticH
|
|
|
3636
3636
|
* `query`
|
|
3637
3637
|
* @param opts Options
|
|
3638
3638
|
* @param opts.future Future flags for the static {@link DataRouter}
|
|
3639
|
+
* @param opts.branches Optional pre-computed route branches
|
|
3639
3640
|
* @returns A static {@link DataRouter} that can be used to render the provided routes
|
|
3640
3641
|
*/
|
|
3641
3642
|
declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
|
|
3643
|
+
branches?: RouteBranch<DataRouteObject>[];
|
|
3642
3644
|
future?: Partial<FutureConfig$1>;
|
|
3643
3645
|
}): Router$1;
|
|
3644
3646
|
|