react-router 0.0.0-experimental-beaa4f52a → 0.0.0-experimental-df0f1dfda
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/dist/development/{chunk-3SBCR7VW.mjs → chunk-O5WSUTKP.mjs} +467 -758
- package/dist/development/data-CQbyyGzl.d.mts +11 -0
- package/dist/development/data-CQbyyGzl.d.ts +11 -0
- package/dist/development/dom-export.d.mts +3 -13
- package/dist/development/dom-export.d.ts +3 -13
- package/dist/development/dom-export.js +193 -262
- package/dist/development/dom-export.mjs +6 -9
- package/dist/development/{fog-of-war-CrM4EOZM.d.ts → fog-of-war-D3ny56dR.d.mts} +11 -87
- package/dist/{production/fog-of-war-CrM4EOZM.d.ts → development/fog-of-war-L5G-Cw9x.d.ts} +11 -87
- package/dist/development/index.d.mts +11 -7
- package/dist/development/index.d.ts +11 -7
- package/dist/development/index.js +467 -758
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +5 -13
- package/dist/development/lib/types/route-module.d.ts +5 -13
- 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-C9zMg-qq.d.ts → route-data-Cq_b5feC.d.mts} +17 -54
- package/dist/{production/route-data-C9zMg-qq.d.mts → development/route-data-Cq_b5feC.d.ts} +17 -54
- package/dist/production/{chunk-DRRQRV77.mjs → chunk-F7U65DMX.mjs} +467 -758
- package/dist/production/data-CQbyyGzl.d.mts +11 -0
- package/dist/production/data-CQbyyGzl.d.ts +11 -0
- package/dist/production/dom-export.d.mts +3 -13
- package/dist/production/dom-export.d.ts +3 -13
- package/dist/production/dom-export.js +193 -262
- package/dist/production/dom-export.mjs +6 -9
- package/dist/production/{fog-of-war-CYAe8qUt.d.mts → fog-of-war-D3ny56dR.d.mts} +11 -87
- package/dist/{development/fog-of-war-CYAe8qUt.d.mts → production/fog-of-war-L5G-Cw9x.d.ts} +11 -87
- package/dist/production/index.d.mts +11 -7
- package/dist/production/index.d.ts +11 -7
- package/dist/production/index.js +467 -758
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +5 -13
- package/dist/production/lib/types/route-module.d.ts +5 -13
- 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-C9zMg-qq.d.ts → route-data-Cq_b5feC.d.mts} +17 -54
- package/dist/{development/route-data-C9zMg-qq.d.mts → production/route-data-Cq_b5feC.d.ts} +17 -54
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-df0f1dfda
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
useSearchParams,
|
|
121
121
|
useSubmit,
|
|
122
122
|
useViewTransitionState
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-O5WSUTKP.mjs";
|
|
124
124
|
export {
|
|
125
125
|
Await,
|
|
126
126
|
BrowserRouter,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ay as LinkDescriptor, av as MetaDescriptor, aM as ServerDataFrom, aN as ClientDataFrom, aO as Func, aP as Equal, aQ as Pretty } from '../../route-data-Cq_b5feC.mjs';
|
|
2
|
+
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
|
|
2
3
|
import 'react';
|
|
3
4
|
|
|
4
5
|
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
@@ -68,22 +69,13 @@ type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
68
69
|
IsDefined<ServerActionData>,
|
|
69
70
|
IsDefined<ClientActionData>
|
|
70
71
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
71
|
-
type
|
|
72
|
+
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
72
73
|
request: Request;
|
|
73
74
|
params: T["params"];
|
|
74
75
|
};
|
|
75
|
-
type
|
|
76
|
-
context: RouterContext;
|
|
77
|
-
};
|
|
78
|
-
type ServerDataFunctionArgs<T extends RouteInfo> = SharedDataFunctionArgs<T> & {
|
|
76
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
79
77
|
context: AppLoadContext;
|
|
80
78
|
};
|
|
81
|
-
type CreateServerMiddlewareArgs<T extends RouteInfo> = ServerDataFunctionArgs<T> & {
|
|
82
|
-
next: MiddlewareFunctionArgs<AppLoadContext, Response>["next"];
|
|
83
|
-
};
|
|
84
|
-
type CreateClientMiddlewareArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
85
|
-
next: MiddlewareFunctionArgs<RouterContext, undefined>["next"];
|
|
86
|
-
};
|
|
87
79
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
88
80
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
89
81
|
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
@@ -114,4 +106,4 @@ type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
|
114
106
|
actionData?: T["actionData"];
|
|
115
107
|
};
|
|
116
108
|
|
|
117
|
-
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs,
|
|
109
|
+
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, HeadersArgs, LinkDescriptors, MetaDescriptors };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ay as LinkDescriptor, av as MetaDescriptor, aM as ServerDataFrom, aN as ClientDataFrom, aO as Func, aP as Equal, aQ as Pretty } from '../../route-data-Cq_b5feC.js';
|
|
2
|
+
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
|
|
2
3
|
import 'react';
|
|
3
4
|
|
|
4
5
|
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
@@ -68,22 +69,13 @@ type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
68
69
|
IsDefined<ServerActionData>,
|
|
69
70
|
IsDefined<ClientActionData>
|
|
70
71
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
71
|
-
type
|
|
72
|
+
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
72
73
|
request: Request;
|
|
73
74
|
params: T["params"];
|
|
74
75
|
};
|
|
75
|
-
type
|
|
76
|
-
context: RouterContext;
|
|
77
|
-
};
|
|
78
|
-
type ServerDataFunctionArgs<T extends RouteInfo> = SharedDataFunctionArgs<T> & {
|
|
76
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
79
77
|
context: AppLoadContext;
|
|
80
78
|
};
|
|
81
|
-
type CreateServerMiddlewareArgs<T extends RouteInfo> = ServerDataFunctionArgs<T> & {
|
|
82
|
-
next: MiddlewareFunctionArgs<AppLoadContext, Response>["next"];
|
|
83
|
-
};
|
|
84
|
-
type CreateClientMiddlewareArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
85
|
-
next: MiddlewareFunctionArgs<RouterContext, undefined>["next"];
|
|
86
|
-
};
|
|
87
79
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
88
80
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
89
81
|
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
@@ -114,4 +106,4 @@ type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
|
114
106
|
actionData?: T["actionData"];
|
|
115
107
|
};
|
|
116
108
|
|
|
117
|
-
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs,
|
|
109
|
+
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, HeadersArgs, LinkDescriptors, MetaDescriptors };
|
|
@@ -260,15 +260,6 @@ type Submission = {
|
|
|
260
260
|
json: undefined;
|
|
261
261
|
text: string;
|
|
262
262
|
};
|
|
263
|
-
/**
|
|
264
|
-
* An object of unknown type for client-side loaders and actions provided by the
|
|
265
|
-
* `createBrowserRouter` `context` option. This is defined as an empty interface
|
|
266
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
267
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
268
|
-
*/
|
|
269
|
-
interface RouterContext {
|
|
270
|
-
[key: string]: unknown;
|
|
271
|
-
}
|
|
272
263
|
/**
|
|
273
264
|
* @private
|
|
274
265
|
* Arguments passed to route loader/action functions. Same for now but we keep
|
|
@@ -277,37 +268,29 @@ interface RouterContext {
|
|
|
277
268
|
interface DataFunctionArgs<Context> {
|
|
278
269
|
request: Request;
|
|
279
270
|
params: Params;
|
|
280
|
-
context
|
|
271
|
+
context?: Context;
|
|
281
272
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Route middleware function arguments
|
|
284
|
-
*/
|
|
285
|
-
type MiddlewareFunctionArgs<Context = RouterContext, Result = unknown> = DataFunctionArgs<Context> & {
|
|
286
|
-
next: () => Promise<Result>;
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* Route middleware function signature
|
|
290
|
-
*/
|
|
291
|
-
type MiddlewareFunction<Context = RouterContext, Result = unknown> = (args: MiddlewareFunctionArgs<Context, Result>) => Result | Promise<Result>;
|
|
292
273
|
/**
|
|
293
274
|
* Arguments passed to loader functions
|
|
294
275
|
*/
|
|
295
|
-
interface LoaderFunctionArgs<Context =
|
|
276
|
+
interface LoaderFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
296
277
|
}
|
|
297
278
|
/**
|
|
298
279
|
* Arguments passed to action functions
|
|
299
280
|
*/
|
|
300
|
-
interface ActionFunctionArgs<Context =
|
|
281
|
+
interface ActionFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
301
282
|
}
|
|
302
283
|
/**
|
|
303
|
-
* Loaders and actions can return anything
|
|
284
|
+
* Loaders and actions can return anything except `undefined` (`null` is a
|
|
285
|
+
* valid return value if there is no data to return). Responses are preferred
|
|
286
|
+
* and will ease any future migration to Remix
|
|
304
287
|
*/
|
|
305
|
-
type DataFunctionValue = unknown;
|
|
288
|
+
type DataFunctionValue = Response | NonNullable<unknown> | null;
|
|
306
289
|
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
|
|
307
290
|
/**
|
|
308
291
|
* Route loader function signature
|
|
309
292
|
*/
|
|
310
|
-
type LoaderFunction<Context =
|
|
293
|
+
type LoaderFunction<Context = any> = {
|
|
311
294
|
(args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
|
|
312
295
|
} & {
|
|
313
296
|
hydrate?: boolean;
|
|
@@ -315,7 +298,7 @@ type LoaderFunction<Context = RouterContext> = {
|
|
|
315
298
|
/**
|
|
316
299
|
* Route action function signature
|
|
317
300
|
*/
|
|
318
|
-
interface ActionFunction<Context =
|
|
301
|
+
interface ActionFunction<Context = any> {
|
|
319
302
|
(args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
|
|
320
303
|
}
|
|
321
304
|
/**
|
|
@@ -350,7 +333,7 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
350
333
|
shouldLoad: boolean;
|
|
351
334
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
352
335
|
}
|
|
353
|
-
interface DataStrategyFunctionArgs<Context =
|
|
336
|
+
interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
354
337
|
matches: DataStrategyMatch[];
|
|
355
338
|
fetcherKey: string | null;
|
|
356
339
|
}
|
|
@@ -361,8 +344,8 @@ interface DataStrategyResult {
|
|
|
361
344
|
type: "data" | "error";
|
|
362
345
|
result: unknown;
|
|
363
346
|
}
|
|
364
|
-
interface DataStrategyFunction
|
|
365
|
-
(args: DataStrategyFunctionArgs
|
|
347
|
+
interface DataStrategyFunction {
|
|
348
|
+
(args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
|
|
366
349
|
}
|
|
367
350
|
type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
|
|
368
351
|
path: string;
|
|
@@ -402,7 +385,6 @@ type AgnosticBaseRouteObject = {
|
|
|
402
385
|
caseSensitive?: boolean;
|
|
403
386
|
path?: string;
|
|
404
387
|
id?: string;
|
|
405
|
-
middleware?: MiddlewareFunction[];
|
|
406
388
|
loader?: LoaderFunction | boolean;
|
|
407
389
|
action?: ActionFunction | boolean;
|
|
408
390
|
hasErrorBoundary?: boolean;
|
|
@@ -886,7 +868,6 @@ interface RouterInit {
|
|
|
886
868
|
routes: AgnosticRouteObject[];
|
|
887
869
|
history: History;
|
|
888
870
|
basename?: string;
|
|
889
|
-
context?: RouterContext;
|
|
890
871
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
891
872
|
future?: Partial<FutureConfig>;
|
|
892
873
|
hydrationData?: HydrationState;
|
|
@@ -916,17 +897,13 @@ interface StaticHandler {
|
|
|
916
897
|
dataRoutes: AgnosticDataRouteObject[];
|
|
917
898
|
query(request: Request, opts?: {
|
|
918
899
|
requestContext?: unknown;
|
|
919
|
-
filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean;
|
|
920
900
|
skipLoaderErrorBubbling?: boolean;
|
|
921
|
-
|
|
922
|
-
dataStrategy?: DataStrategyFunction<unknown>;
|
|
923
|
-
respond?: (staticContext: StaticHandlerContext) => Promise<Response>;
|
|
901
|
+
dataStrategy?: DataStrategyFunction;
|
|
924
902
|
}): Promise<StaticHandlerContext | Response>;
|
|
925
903
|
queryRoute(request: Request, opts?: {
|
|
926
904
|
routeId?: string;
|
|
927
905
|
requestContext?: unknown;
|
|
928
|
-
dataStrategy?: DataStrategyFunction
|
|
929
|
-
respond?: (res: Response) => Promise<Response>;
|
|
906
|
+
dataStrategy?: DataStrategyFunction;
|
|
930
907
|
}): Promise<any>;
|
|
931
908
|
}
|
|
932
909
|
type ViewTransitionOpts = {
|
|
@@ -1160,7 +1137,6 @@ interface IndexRouteObject {
|
|
|
1160
1137
|
caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
|
|
1161
1138
|
path?: AgnosticIndexRouteObject["path"];
|
|
1162
1139
|
id?: AgnosticIndexRouteObject["id"];
|
|
1163
|
-
middleware?: AgnosticIndexRouteObject["middleware"];
|
|
1164
1140
|
loader?: AgnosticIndexRouteObject["loader"];
|
|
1165
1141
|
action?: AgnosticIndexRouteObject["action"];
|
|
1166
1142
|
hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
|
|
@@ -1180,7 +1156,6 @@ interface NonIndexRouteObject {
|
|
|
1180
1156
|
caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
|
|
1181
1157
|
path?: AgnosticNonIndexRouteObject["path"];
|
|
1182
1158
|
id?: AgnosticNonIndexRouteObject["id"];
|
|
1183
|
-
middleware?: AgnosticNonIndexRouteObject["middleware"];
|
|
1184
1159
|
loader?: AgnosticNonIndexRouteObject["loader"];
|
|
1185
1160
|
action?: AgnosticNonIndexRouteObject["action"];
|
|
1186
1161
|
hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
|
|
@@ -1377,16 +1352,6 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
|
|
|
1377
1352
|
}
|
|
1378
1353
|
type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
|
|
1379
1354
|
|
|
1380
|
-
/**
|
|
1381
|
-
* An object of unknown type for route loaders and actions provided by the
|
|
1382
|
-
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1383
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
1384
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1385
|
-
*/
|
|
1386
|
-
interface AppLoadContext {
|
|
1387
|
-
[key: string]: unknown;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
1355
|
interface RouteModules {
|
|
1391
1356
|
[routeId: string]: RouteModule | undefined;
|
|
1392
1357
|
}
|
|
@@ -1396,7 +1361,6 @@ interface RouteModules {
|
|
|
1396
1361
|
interface RouteModule {
|
|
1397
1362
|
clientAction?: ClientActionFunction;
|
|
1398
1363
|
clientLoader?: ClientLoaderFunction;
|
|
1399
|
-
clientMiddleware?: MiddlewareFunction<RouterContext, undefined>[];
|
|
1400
1364
|
ErrorBoundary?: ErrorBoundaryComponent;
|
|
1401
1365
|
HydrateFallback?: HydrateFallbackComponent;
|
|
1402
1366
|
Layout?: LayoutComponent;
|
|
@@ -1415,7 +1379,6 @@ interface ServerRouteModule extends RouteModule {
|
|
|
1415
1379
|
[name: string]: string;
|
|
1416
1380
|
};
|
|
1417
1381
|
loader?: LoaderFunction;
|
|
1418
|
-
middleware?: MiddlewareFunction<AppLoadContext, Response>[];
|
|
1419
1382
|
}
|
|
1420
1383
|
/**
|
|
1421
1384
|
* A function that handles data mutations for a route on the client
|
|
@@ -1424,7 +1387,7 @@ type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<Actio
|
|
|
1424
1387
|
/**
|
|
1425
1388
|
* Arguments passed to a route `clientAction` function
|
|
1426
1389
|
*/
|
|
1427
|
-
type ClientActionFunctionArgs = ActionFunctionArgs & {
|
|
1390
|
+
type ClientActionFunctionArgs = ActionFunctionArgs<undefined> & {
|
|
1428
1391
|
serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
1429
1392
|
};
|
|
1430
1393
|
/**
|
|
@@ -1436,7 +1399,7 @@ type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<Load
|
|
|
1436
1399
|
/**
|
|
1437
1400
|
* Arguments passed to a route `clientLoader` function
|
|
1438
1401
|
*/
|
|
1439
|
-
type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
|
|
1402
|
+
type ClientLoaderFunctionArgs = LoaderFunctionArgs<undefined> & {
|
|
1440
1403
|
serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
1441
1404
|
};
|
|
1442
1405
|
/**
|
|
@@ -1612,4 +1575,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1612
1575
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1613
1576
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1614
1577
|
|
|
1615
|
-
export { type
|
|
1578
|
+
export { type LazyRouteFunction as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type RouterSubscriber as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterNavigateOptions as J, type RouterFetchOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type DataStrategyFunctionArgs as O, type ParamParseKey as P, type DataStrategyMatch as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyResult as V, DataWithResponseInit as W, type ErrorResponse as X, type FormEncType as Y, type FormMethod as Z, type HTMLFormMethod as _, type Router as a, type PathParam as a0, type RedirectFunction as a1, type ShouldRevalidateFunction as a2, type ShouldRevalidateFunctionArgs as a3, createPath as a4, parsePath as a5, IDLE_NAVIGATION as a6, IDLE_FETCHER as a7, IDLE_BLOCKER as a8, data as a9, invariant as aA, createRouter as aB, ErrorResponseImpl as aC, DataRouterContext as aD, DataRouterStateContext as aE, FetchersContext as aF, LocationContext as aG, NavigationContext as aH, RouteContext as aI, ViewTransitionContext as aJ, type RouteModule as aK, type History as aL, type ServerDataFrom as aM, type ClientDataFrom as aN, type Func as aO, type Equal as aP, type Pretty as aQ, generatePath as aa, isRouteErrorResponse as ab, matchPath as ac, matchRoutes as ad, redirect as ae, redirectDocument as af, replace as ag, resolvePath as ah, type DataRouteMatch as ai, type DataRouteObject as aj, type Navigator as ak, type PatchRoutesOnNavigationFunction as al, type PatchRoutesOnNavigationFunctionArgs as am, type RouteMatch as an, type ClientActionFunction as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunction as aq, type ClientLoaderFunctionArgs as ar, type HeadersArgs as as, type HeadersFunction as at, type MetaArgs as au, type MetaDescriptor as av, type PageLinkDescriptor as aw, type HtmlLinkDescriptor as ax, type LinkDescriptor as ay, createBrowserHistory as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|
|
@@ -260,15 +260,6 @@ type Submission = {
|
|
|
260
260
|
json: undefined;
|
|
261
261
|
text: string;
|
|
262
262
|
};
|
|
263
|
-
/**
|
|
264
|
-
* An object of unknown type for client-side loaders and actions provided by the
|
|
265
|
-
* `createBrowserRouter` `context` option. This is defined as an empty interface
|
|
266
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
267
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
268
|
-
*/
|
|
269
|
-
interface RouterContext {
|
|
270
|
-
[key: string]: unknown;
|
|
271
|
-
}
|
|
272
263
|
/**
|
|
273
264
|
* @private
|
|
274
265
|
* Arguments passed to route loader/action functions. Same for now but we keep
|
|
@@ -277,37 +268,29 @@ interface RouterContext {
|
|
|
277
268
|
interface DataFunctionArgs<Context> {
|
|
278
269
|
request: Request;
|
|
279
270
|
params: Params;
|
|
280
|
-
context
|
|
271
|
+
context?: Context;
|
|
281
272
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Route middleware function arguments
|
|
284
|
-
*/
|
|
285
|
-
type MiddlewareFunctionArgs<Context = RouterContext, Result = unknown> = DataFunctionArgs<Context> & {
|
|
286
|
-
next: () => Promise<Result>;
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* Route middleware function signature
|
|
290
|
-
*/
|
|
291
|
-
type MiddlewareFunction<Context = RouterContext, Result = unknown> = (args: MiddlewareFunctionArgs<Context, Result>) => Result | Promise<Result>;
|
|
292
273
|
/**
|
|
293
274
|
* Arguments passed to loader functions
|
|
294
275
|
*/
|
|
295
|
-
interface LoaderFunctionArgs<Context =
|
|
276
|
+
interface LoaderFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
296
277
|
}
|
|
297
278
|
/**
|
|
298
279
|
* Arguments passed to action functions
|
|
299
280
|
*/
|
|
300
|
-
interface ActionFunctionArgs<Context =
|
|
281
|
+
interface ActionFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
301
282
|
}
|
|
302
283
|
/**
|
|
303
|
-
* Loaders and actions can return anything
|
|
284
|
+
* Loaders and actions can return anything except `undefined` (`null` is a
|
|
285
|
+
* valid return value if there is no data to return). Responses are preferred
|
|
286
|
+
* and will ease any future migration to Remix
|
|
304
287
|
*/
|
|
305
|
-
type DataFunctionValue = unknown;
|
|
288
|
+
type DataFunctionValue = Response | NonNullable<unknown> | null;
|
|
306
289
|
type DataFunctionReturnValue = Promise<DataFunctionValue> | DataFunctionValue;
|
|
307
290
|
/**
|
|
308
291
|
* Route loader function signature
|
|
309
292
|
*/
|
|
310
|
-
type LoaderFunction<Context =
|
|
293
|
+
type LoaderFunction<Context = any> = {
|
|
311
294
|
(args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
|
|
312
295
|
} & {
|
|
313
296
|
hydrate?: boolean;
|
|
@@ -315,7 +298,7 @@ type LoaderFunction<Context = RouterContext> = {
|
|
|
315
298
|
/**
|
|
316
299
|
* Route action function signature
|
|
317
300
|
*/
|
|
318
|
-
interface ActionFunction<Context =
|
|
301
|
+
interface ActionFunction<Context = any> {
|
|
319
302
|
(args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
|
|
320
303
|
}
|
|
321
304
|
/**
|
|
@@ -350,7 +333,7 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
350
333
|
shouldLoad: boolean;
|
|
351
334
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
352
335
|
}
|
|
353
|
-
interface DataStrategyFunctionArgs<Context =
|
|
336
|
+
interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
|
|
354
337
|
matches: DataStrategyMatch[];
|
|
355
338
|
fetcherKey: string | null;
|
|
356
339
|
}
|
|
@@ -361,8 +344,8 @@ interface DataStrategyResult {
|
|
|
361
344
|
type: "data" | "error";
|
|
362
345
|
result: unknown;
|
|
363
346
|
}
|
|
364
|
-
interface DataStrategyFunction
|
|
365
|
-
(args: DataStrategyFunctionArgs
|
|
347
|
+
interface DataStrategyFunction {
|
|
348
|
+
(args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
|
|
366
349
|
}
|
|
367
350
|
type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
|
|
368
351
|
path: string;
|
|
@@ -402,7 +385,6 @@ type AgnosticBaseRouteObject = {
|
|
|
402
385
|
caseSensitive?: boolean;
|
|
403
386
|
path?: string;
|
|
404
387
|
id?: string;
|
|
405
|
-
middleware?: MiddlewareFunction[];
|
|
406
388
|
loader?: LoaderFunction | boolean;
|
|
407
389
|
action?: ActionFunction | boolean;
|
|
408
390
|
hasErrorBoundary?: boolean;
|
|
@@ -886,7 +868,6 @@ interface RouterInit {
|
|
|
886
868
|
routes: AgnosticRouteObject[];
|
|
887
869
|
history: History;
|
|
888
870
|
basename?: string;
|
|
889
|
-
context?: RouterContext;
|
|
890
871
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
891
872
|
future?: Partial<FutureConfig>;
|
|
892
873
|
hydrationData?: HydrationState;
|
|
@@ -916,17 +897,13 @@ interface StaticHandler {
|
|
|
916
897
|
dataRoutes: AgnosticDataRouteObject[];
|
|
917
898
|
query(request: Request, opts?: {
|
|
918
899
|
requestContext?: unknown;
|
|
919
|
-
filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean;
|
|
920
900
|
skipLoaderErrorBubbling?: boolean;
|
|
921
|
-
|
|
922
|
-
dataStrategy?: DataStrategyFunction<unknown>;
|
|
923
|
-
respond?: (staticContext: StaticHandlerContext) => Promise<Response>;
|
|
901
|
+
dataStrategy?: DataStrategyFunction;
|
|
924
902
|
}): Promise<StaticHandlerContext | Response>;
|
|
925
903
|
queryRoute(request: Request, opts?: {
|
|
926
904
|
routeId?: string;
|
|
927
905
|
requestContext?: unknown;
|
|
928
|
-
dataStrategy?: DataStrategyFunction
|
|
929
|
-
respond?: (res: Response) => Promise<Response>;
|
|
906
|
+
dataStrategy?: DataStrategyFunction;
|
|
930
907
|
}): Promise<any>;
|
|
931
908
|
}
|
|
932
909
|
type ViewTransitionOpts = {
|
|
@@ -1160,7 +1137,6 @@ interface IndexRouteObject {
|
|
|
1160
1137
|
caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
|
|
1161
1138
|
path?: AgnosticIndexRouteObject["path"];
|
|
1162
1139
|
id?: AgnosticIndexRouteObject["id"];
|
|
1163
|
-
middleware?: AgnosticIndexRouteObject["middleware"];
|
|
1164
1140
|
loader?: AgnosticIndexRouteObject["loader"];
|
|
1165
1141
|
action?: AgnosticIndexRouteObject["action"];
|
|
1166
1142
|
hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
|
|
@@ -1180,7 +1156,6 @@ interface NonIndexRouteObject {
|
|
|
1180
1156
|
caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
|
|
1181
1157
|
path?: AgnosticNonIndexRouteObject["path"];
|
|
1182
1158
|
id?: AgnosticNonIndexRouteObject["id"];
|
|
1183
|
-
middleware?: AgnosticNonIndexRouteObject["middleware"];
|
|
1184
1159
|
loader?: AgnosticNonIndexRouteObject["loader"];
|
|
1185
1160
|
action?: AgnosticNonIndexRouteObject["action"];
|
|
1186
1161
|
hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
|
|
@@ -1377,16 +1352,6 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
|
|
|
1377
1352
|
}
|
|
1378
1353
|
type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
|
|
1379
1354
|
|
|
1380
|
-
/**
|
|
1381
|
-
* An object of unknown type for route loaders and actions provided by the
|
|
1382
|
-
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1383
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
1384
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1385
|
-
*/
|
|
1386
|
-
interface AppLoadContext {
|
|
1387
|
-
[key: string]: unknown;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
1355
|
interface RouteModules {
|
|
1391
1356
|
[routeId: string]: RouteModule | undefined;
|
|
1392
1357
|
}
|
|
@@ -1396,7 +1361,6 @@ interface RouteModules {
|
|
|
1396
1361
|
interface RouteModule {
|
|
1397
1362
|
clientAction?: ClientActionFunction;
|
|
1398
1363
|
clientLoader?: ClientLoaderFunction;
|
|
1399
|
-
clientMiddleware?: MiddlewareFunction<RouterContext, undefined>[];
|
|
1400
1364
|
ErrorBoundary?: ErrorBoundaryComponent;
|
|
1401
1365
|
HydrateFallback?: HydrateFallbackComponent;
|
|
1402
1366
|
Layout?: LayoutComponent;
|
|
@@ -1415,7 +1379,6 @@ interface ServerRouteModule extends RouteModule {
|
|
|
1415
1379
|
[name: string]: string;
|
|
1416
1380
|
};
|
|
1417
1381
|
loader?: LoaderFunction;
|
|
1418
|
-
middleware?: MiddlewareFunction<AppLoadContext, Response>[];
|
|
1419
1382
|
}
|
|
1420
1383
|
/**
|
|
1421
1384
|
* A function that handles data mutations for a route on the client
|
|
@@ -1424,7 +1387,7 @@ type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<Actio
|
|
|
1424
1387
|
/**
|
|
1425
1388
|
* Arguments passed to a route `clientAction` function
|
|
1426
1389
|
*/
|
|
1427
|
-
type ClientActionFunctionArgs = ActionFunctionArgs & {
|
|
1390
|
+
type ClientActionFunctionArgs = ActionFunctionArgs<undefined> & {
|
|
1428
1391
|
serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
1429
1392
|
};
|
|
1430
1393
|
/**
|
|
@@ -1436,7 +1399,7 @@ type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<Load
|
|
|
1436
1399
|
/**
|
|
1437
1400
|
* Arguments passed to a route `clientLoader` function
|
|
1438
1401
|
*/
|
|
1439
|
-
type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
|
|
1402
|
+
type ClientLoaderFunctionArgs = LoaderFunctionArgs<undefined> & {
|
|
1440
1403
|
serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
1441
1404
|
};
|
|
1442
1405
|
/**
|
|
@@ -1612,4 +1575,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1612
1575
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1613
1576
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1614
1577
|
|
|
1615
|
-
export { type
|
|
1578
|
+
export { type LazyRouteFunction as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type RouterSubscriber as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterNavigateOptions as J, type RouterFetchOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type DataStrategyFunctionArgs as O, type ParamParseKey as P, type DataStrategyMatch as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyResult as V, DataWithResponseInit as W, type ErrorResponse as X, type FormEncType as Y, type FormMethod as Z, type HTMLFormMethod as _, type Router as a, type PathParam as a0, type RedirectFunction as a1, type ShouldRevalidateFunction as a2, type ShouldRevalidateFunctionArgs as a3, createPath as a4, parsePath as a5, IDLE_NAVIGATION as a6, IDLE_FETCHER as a7, IDLE_BLOCKER as a8, data as a9, invariant as aA, createRouter as aB, ErrorResponseImpl as aC, DataRouterContext as aD, DataRouterStateContext as aE, FetchersContext as aF, LocationContext as aG, NavigationContext as aH, RouteContext as aI, ViewTransitionContext as aJ, type RouteModule as aK, type History as aL, type ServerDataFrom as aM, type ClientDataFrom as aN, type Func as aO, type Equal as aP, type Pretty as aQ, generatePath as aa, isRouteErrorResponse as ab, matchPath as ac, matchRoutes as ad, redirect as ae, redirectDocument as af, replace as ag, resolvePath as ah, type DataRouteMatch as ai, type DataRouteObject as aj, type Navigator as ak, type PatchRoutesOnNavigationFunction as al, type PatchRoutesOnNavigationFunctionArgs as am, type RouteMatch as an, type ClientActionFunction as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunction as aq, type ClientLoaderFunctionArgs as ar, type HeadersArgs as as, type HeadersFunction as at, type MetaArgs as au, type MetaDescriptor as av, type PageLinkDescriptor as aw, type HtmlLinkDescriptor as ax, type LinkDescriptor as ay, createBrowserHistory as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|