react-router 7.2.0-pre.2 → 7.2.0-pre.4
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 +8 -0
- package/dist/development/{chunk-ULARE4JK.mjs → chunk-N43MPAHC.mjs} +2 -2
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/{fog-of-war-yKFj2vdd.d.mts → fog-of-war-BALYJxf_.d.mts} +1 -1
- package/dist/{production/fog-of-war-rn7nVSAv.d.ts → development/fog-of-war-Cm1iXIp7.d.ts} +1 -1
- package/dist/development/index.d.mts +4 -4
- package/dist/development/index.d.ts +4 -4
- package/dist/development/index.js +2 -2
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +81 -2
- package/dist/development/lib/types/route-module.d.ts +81 -2
- 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-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
- package/dist/{production/route-data-CfLfC_Bh.d.mts → development/route-data-BmvbmBej.d.ts} +75 -2
- package/dist/production/{chunk-QRCLBIUO.mjs → chunk-WSLSTL6H.mjs} +2 -2
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/{fog-of-war-yKFj2vdd.d.mts → fog-of-war-BALYJxf_.d.mts} +1 -1
- package/dist/{development/fog-of-war-rn7nVSAv.d.ts → production/fog-of-war-Cm1iXIp7.d.ts} +1 -1
- package/dist/production/index.d.mts +4 -4
- package/dist/production/index.d.ts +4 -4
- package/dist/production/index.js +2 -2
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +81 -2
- package/dist/production/lib/types/route-module.d.ts +81 -2
- 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-CfLfC_Bh.d.ts → route-data-BmvbmBej.d.mts} +75 -2
- package/dist/{development/route-data-CfLfC_Bh.d.mts → production/route-data-BmvbmBej.d.ts} +75 -2
- package/package.json +1 -1
|
@@ -266,8 +266,28 @@ type Submission = {
|
|
|
266
266
|
* this as a private implementation detail in case they diverge in the future.
|
|
267
267
|
*/
|
|
268
268
|
interface DataFunctionArgs<Context> {
|
|
269
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
|
269
270
|
request: Request;
|
|
271
|
+
/**
|
|
272
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
273
|
+
* @example
|
|
274
|
+
* // app/routes.ts
|
|
275
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
276
|
+
*
|
|
277
|
+
* // app/team.tsx
|
|
278
|
+
* export function loader({
|
|
279
|
+
* params,
|
|
280
|
+
* }: Route.LoaderArgs) {
|
|
281
|
+
* params.teamId;
|
|
282
|
+
* // ^ string
|
|
283
|
+
* }
|
|
284
|
+
**/
|
|
270
285
|
params: Params;
|
|
286
|
+
/**
|
|
287
|
+
* This is the context passed in to your server adapter's getLoadContext() function.
|
|
288
|
+
* It's a way to bridge the gap between the adapter's request/response API with your React Router app.
|
|
289
|
+
* It is only applicable if you are using a custom server adapter.
|
|
290
|
+
*/
|
|
271
291
|
context?: Context;
|
|
272
292
|
}
|
|
273
293
|
/**
|
|
@@ -305,18 +325,56 @@ interface ActionFunction<Context = any> {
|
|
|
305
325
|
* Arguments passed to shouldRevalidate function
|
|
306
326
|
*/
|
|
307
327
|
interface ShouldRevalidateFunctionArgs {
|
|
328
|
+
/** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
|
|
308
329
|
currentUrl: URL;
|
|
330
|
+
/** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
|
|
309
331
|
currentParams: AgnosticDataRouteMatch["params"];
|
|
332
|
+
/** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
|
|
310
333
|
nextUrl: URL;
|
|
334
|
+
/** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
|
|
311
335
|
nextParams: AgnosticDataRouteMatch["params"];
|
|
336
|
+
/** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
|
|
312
337
|
formMethod?: Submission["formMethod"];
|
|
338
|
+
/** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
|
|
313
339
|
formAction?: Submission["formAction"];
|
|
340
|
+
/** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
|
|
314
341
|
formEncType?: Submission["formEncType"];
|
|
342
|
+
/** The form submission data when the form's encType is `text/plain` */
|
|
315
343
|
text?: Submission["text"];
|
|
344
|
+
/** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
|
|
316
345
|
formData?: Submission["formData"];
|
|
346
|
+
/** The form submission data when the form's encType is `application/json` */
|
|
317
347
|
json?: Submission["json"];
|
|
348
|
+
/** The status code of the action response */
|
|
318
349
|
actionStatus?: number;
|
|
350
|
+
/**
|
|
351
|
+
* When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* export async function action() {
|
|
355
|
+
* await saveSomeStuff();
|
|
356
|
+
* return { ok: true };
|
|
357
|
+
* }
|
|
358
|
+
*
|
|
359
|
+
* export function shouldRevalidate({
|
|
360
|
+
* actionResult,
|
|
361
|
+
* }) {
|
|
362
|
+
* if (actionResult?.ok) {
|
|
363
|
+
* return false;
|
|
364
|
+
* }
|
|
365
|
+
* return true;
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
319
368
|
actionResult?: any;
|
|
369
|
+
/**
|
|
370
|
+
* By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
|
|
371
|
+
*
|
|
372
|
+
* /projects/123/tasks/abc
|
|
373
|
+
* /projects/123/tasks/def
|
|
374
|
+
* React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
|
|
375
|
+
*
|
|
376
|
+
* It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
|
|
377
|
+
*/
|
|
320
378
|
defaultShouldRevalidate: boolean;
|
|
321
379
|
}
|
|
322
380
|
/**
|
|
@@ -473,8 +531,13 @@ declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = Agnos
|
|
|
473
531
|
interface UIMatch<Data = unknown, Handle = unknown> {
|
|
474
532
|
id: string;
|
|
475
533
|
pathname: string;
|
|
534
|
+
/**
|
|
535
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
|
|
536
|
+
**/
|
|
476
537
|
params: AgnosticRouteMatch["params"];
|
|
538
|
+
/** The return value from the matched route's loader or clientLoader */
|
|
477
539
|
data: Data;
|
|
540
|
+
/** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
|
|
478
541
|
handle: Handle;
|
|
479
542
|
}
|
|
480
543
|
/**
|
|
@@ -1558,6 +1621,16 @@ type Serializable = undefined | null | boolean | string | symbol | number | Arra
|
|
|
1558
1621
|
[key: PropertyKey]: Serializable;
|
|
1559
1622
|
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
1560
1623
|
|
|
1624
|
+
/**
|
|
1625
|
+
* A brand that can be applied to a type to indicate that it will serialize
|
|
1626
|
+
* to a specific type when transported to the client from a loader.
|
|
1627
|
+
* Only use this if you have additional serialization/deserialization logic
|
|
1628
|
+
* in your application.
|
|
1629
|
+
*/
|
|
1630
|
+
type unstable_SerializesTo<T> = {
|
|
1631
|
+
unstable__ReactRouter_SerializesTo?: [T];
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1561
1634
|
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
1562
1635
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1563
1636
|
type Func = (...args: any[]) => unknown;
|
|
@@ -1565,7 +1638,7 @@ type Pretty<T> = {
|
|
|
1565
1638
|
[K in keyof T]: T[K];
|
|
1566
1639
|
} & {};
|
|
1567
1640
|
|
|
1568
|
-
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1641
|
+
type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1569
1642
|
[K in keyof T]: Serialize<T[K]>;
|
|
1570
1643
|
} : undefined;
|
|
1571
1644
|
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
|
|
@@ -1576,4 +1649,4 @@ type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
|
1576
1649
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1577
1650
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1578
1651
|
|
|
1579
|
-
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9,
|
|
1652
|
+
export { type HTMLFormMethod as $, type ActionFunctionArgs as A, type BlockerFunction as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunctionArgs as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, type unstable_SerializesTo as aA, createBrowserHistory as aB, invariant as aC, createRouter as aD, ErrorResponseImpl as aE, DataRouterContext as aF, DataRouterStateContext as aG, FetchersContext as aH, LocationContext as aI, NavigationContext as aJ, RouteContext as aK, ViewTransitionContext as aL, type RouteModule as aM, type History as aN, type ServerDataFrom as aO, type ClientDataFrom as aP, type Func as aQ, type Pretty as aR, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunction as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunction as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type HeadersFunction as au, type MetaArgs as av, type MetaDescriptor as aw, type PageLinkDescriptor as ax, type HtmlLinkDescriptor as ay, type LinkDescriptor as az, type RouteManifest as b, type RelativeRoutingType as c, type Location as d, Action as e, type Path as f, type PathPattern as g, type PathMatch as h, type Params as i, type RouteObject as j, type Navigation as k, type RevalidationState as l, type SerializeFrom as m, type Blocker as n, type StaticHandlerContext as o, type StaticHandler as p, type IndexRouteObject as q, type LoaderFunction as r, type ActionFunction as s, type LinksFunction as t, type NonIndexRouteObject as u, type RouterState as v, type GetScrollRestorationKeyFunction as w, type Fetcher as x, type NavigationStates as y, type RouterInit as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -7107,7 +7107,7 @@ function mergeRefs(...refs) {
|
|
|
7107
7107
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7108
7108
|
try {
|
|
7109
7109
|
if (isBrowser) {
|
|
7110
|
-
window.__reactRouterVersion = "7.2.0-pre.
|
|
7110
|
+
window.__reactRouterVersion = "7.2.0-pre.4";
|
|
7111
7111
|
}
|
|
7112
7112
|
} catch (e) {
|
|
7113
7113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-BALYJxf_.mjs';
|
|
3
|
+
import './route-data-BmvbmBej.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-Cm1iXIp7.js';
|
|
3
|
+
import './route-data-BmvbmBej.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
matchRoutes,
|
|
26
26
|
shouldHydrateRouteLoader,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WSLSTL6H.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject,
|
|
2
|
+
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject, aM as RouteModule, $ as HTMLFormMethod, Z as FormEncType, ax as PageLinkDescriptor, aN as History, w as GetScrollRestorationKeyFunction, N as NavigateOptions, x as Fetcher, m as SerializeFrom, B as BlockerFunction } from './route-data-BmvbmBej.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject,
|
|
2
|
+
import { j as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, c as RelativeRoutingType, u as NonIndexRouteObject, a0 as LazyRouteFunction, q as IndexRouteObject, d as Location, e as Action, al as Navigator, ao as RouteMatch, o as StaticHandlerContext, b as RouteManifest, R as RouteModules, ak as DataRouteObject, aM as RouteModule, $ as HTMLFormMethod, Z as FormEncType, ax as PageLinkDescriptor, aN as History, w as GetScrollRestorationKeyFunction, N as NavigateOptions, x as Fetcher, m as SerializeFrom, B as BlockerFunction } from './route-data-BmvbmBej.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-
|
|
2
|
-
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs,
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-
|
|
4
|
-
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-BmvbmBej.mjs';
|
|
2
|
+
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs, aF as UNSAFE_DataRouterContext, aG as UNSAFE_DataRouterStateContext, X as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aH as UNSAFE_FetchersContext, aI as UNSAFE_LocationContext, aJ as UNSAFE_NavigationContext, aK as UNSAFE_RouteContext, aL as UNSAFE_ViewTransitionContext, aB as UNSAFE_createBrowserHistory, aD as UNSAFE_createRouter, aC as UNSAFE_invariant, a5 as createPath, aa as data, ab as generatePath, ac as isRouteErrorResponse, ad as matchPath, ae as matchRoutes, a6 as parsePath, af as redirect, ag as redirectDocument, ah as replace, ai as resolvePath, aA as unstable_SerializesTo } from './route-data-BmvbmBej.mjs';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-BALYJxf_.mjs';
|
|
4
|
+
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-BALYJxf_.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-
|
|
2
|
-
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs,
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-
|
|
4
|
-
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { R as RouteModules, a as Router, D as DataStrategyFunction, b as RouteManifest, S as ServerRouteModule, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, c as RelativeRoutingType, d as Location, e as Action, P as ParamParseKey, f as Path, g as PathPattern, h as PathMatch, N as NavigateOptions, i as Params$1, j as RouteObject, k as Navigation, l as RevalidationState, U as UIMatch, m as SerializeFrom, B as BlockerFunction, n as Blocker, o as StaticHandlerContext, p as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, M as MetaFunction, t as LinksFunction, u as NonIndexRouteObject, E as Equal, v as RouterState } from './route-data-BmvbmBej.js';
|
|
2
|
+
export { ap as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunction, as as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, x as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, w as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, at as HeadersArgs, au as HeadersFunction, ay as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, az as LinkDescriptor, av as MetaArgs, aw as MetaDescriptor, y as NavigationStates, al as Navigator, ax as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, z as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs, aF as UNSAFE_DataRouterContext, aG as UNSAFE_DataRouterStateContext, X as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aH as UNSAFE_FetchersContext, aI as UNSAFE_LocationContext, aJ as UNSAFE_NavigationContext, aK as UNSAFE_RouteContext, aL as UNSAFE_ViewTransitionContext, aB as UNSAFE_createBrowserHistory, aD as UNSAFE_createRouter, aC as UNSAFE_invariant, a5 as createPath, aa as data, ab as generatePath, ac as isRouteErrorResponse, ad as matchPath, ae as matchRoutes, a6 as parsePath, af as redirect, ag as redirectDocument, ah as replace, ai as resolvePath, aA as unstable_SerializesTo } from './route-data-BmvbmBej.js';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-Cm1iXIp7.js';
|
|
4
|
+
export { f as Await, b as AwaitProps, J as BrowserRouter, B as BrowserRouterProps, v as FetcherFormProps, z as FetcherSubmitFunction, a4 as FetcherSubmitOptions, C as FetcherWithComponents, V as Form, w as FormProps, K as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Q as Link, s as LinkProps, ab as Links, g as MemoryRouter, M as MemoryRouterProps, aa as Meta, U as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a5 as ParamKeyValuePair, P as PathRouteProps, ad as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ac as Scripts, ae as ScriptsProps, W as ScrollRestoration, S as ScrollRestorationProps, x as SetURLSearchParams, y as SubmitFunction, a6 as SubmitOptions, a8 as SubmitTarget, ag as UNSAFE_FrameworkContext, aj as UNSAFE_createClientRoutes, ak as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ah as UNSAFE_getPatchRoutesOnNavigationFunction, af as UNSAFE_mapRouteProperties, al as UNSAFE_shouldHydrateRouteLoader, ai as UNSAFE_useFogOFWarDiscovery, am as UNSAFE_useScrollRestoration, a7 as URLSearchParamsInit, D as createBrowserRouter, G as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, a9 as createSearchParams, r as renderMatches, T as unstable_HistoryRouter, a2 as unstable_usePrompt, a1 as useBeforeUnload, $ as useFetcher, a0 as useFetchers, _ as useFormAction, X as useLinkClickHandler, Y as useSearchParams, Z as useSubmit, a3 as useViewTransitionState } from './fog-of-war-Cm1iXIp7.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -7253,7 +7253,7 @@ function mergeRefs(...refs) {
|
|
|
7253
7253
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7254
7254
|
try {
|
|
7255
7255
|
if (isBrowser) {
|
|
7256
|
-
window.__reactRouterVersion = "7.2.0-pre.
|
|
7256
|
+
window.__reactRouterVersion = "7.2.0-pre.4";
|
|
7257
7257
|
}
|
|
7258
7258
|
} catch (e) {
|
|
7259
7259
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.2.0-pre.
|
|
2
|
+
* react-router v7.2.0-pre.4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
useSearchParams,
|
|
122
122
|
useSubmit,
|
|
123
123
|
useViewTransitionState
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-WSLSTL6H.mjs";
|
|
125
125
|
export {
|
|
126
126
|
Await,
|
|
127
127
|
BrowserRouter,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { az as LinkDescriptor, aw as MetaDescriptor,
|
|
1
|
+
import { az as LinkDescriptor, aw as MetaDescriptor, aO as ServerDataFrom, aP as ClientDataFrom, aQ as Func, E as Equal, aR as Pretty } from '../../route-data-BmvbmBej.mjs';
|
|
2
2
|
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -36,10 +36,15 @@ type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
|
36
36
|
}>;
|
|
37
37
|
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<RouteInfo> | undefined>;
|
|
38
38
|
type CreateMetaArgs<T extends RouteInfo> = {
|
|
39
|
+
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
|
|
39
40
|
location: Location;
|
|
41
|
+
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
|
40
42
|
params: T["params"];
|
|
43
|
+
/** The return value for this route's server loader function */
|
|
41
44
|
data: T["loaderData"];
|
|
45
|
+
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
|
42
46
|
error?: unknown;
|
|
47
|
+
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
|
43
48
|
matches: MetaMatches<[...T["parents"], T]>;
|
|
44
49
|
};
|
|
45
50
|
type MetaDescriptors = MetaDescriptor[];
|
|
@@ -70,18 +75,61 @@ type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
70
75
|
IsDefined<ClientActionData>
|
|
71
76
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
72
77
|
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
78
|
+
/**
|
|
79
|
+
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
|
80
|
+
*
|
|
81
|
+
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
|
82
|
+
**/
|
|
73
83
|
request: Request;
|
|
84
|
+
/**
|
|
85
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
86
|
+
* @example
|
|
87
|
+
* // app/routes.ts
|
|
88
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
89
|
+
*
|
|
90
|
+
* // app/team.tsx
|
|
91
|
+
* export function clientLoader({
|
|
92
|
+
* params,
|
|
93
|
+
* }: Route.ClientLoaderArgs) {
|
|
94
|
+
* params.teamId;
|
|
95
|
+
* // ^ string
|
|
96
|
+
* }
|
|
97
|
+
**/
|
|
74
98
|
params: T["params"];
|
|
75
99
|
};
|
|
76
|
-
type ServerDataFunctionArgs<T extends RouteInfo> =
|
|
100
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = {
|
|
101
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
|
102
|
+
request: Request;
|
|
103
|
+
/**
|
|
104
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
105
|
+
* @example
|
|
106
|
+
* // app/routes.ts
|
|
107
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
108
|
+
*
|
|
109
|
+
* // app/team.tsx
|
|
110
|
+
* export function loader({
|
|
111
|
+
* params,
|
|
112
|
+
* }: Route.LoaderArgs) {
|
|
113
|
+
* params.teamId;
|
|
114
|
+
* // ^ string
|
|
115
|
+
* }
|
|
116
|
+
**/
|
|
117
|
+
params: T["params"];
|
|
118
|
+
/**
|
|
119
|
+
* This is the context passed in to your server adapter's getLoadContext() function.
|
|
120
|
+
* It's a way to bridge the gap between the adapter's request/response API with your React Router app.
|
|
121
|
+
* It is only applicable if you are using a custom server adapter.
|
|
122
|
+
*/
|
|
77
123
|
context: AppLoadContext;
|
|
78
124
|
};
|
|
79
125
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
80
126
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
127
|
+
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
|
81
128
|
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
82
129
|
};
|
|
83
130
|
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
84
131
|
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
132
|
+
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
|
85
133
|
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
|
86
134
|
};
|
|
87
135
|
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
|
@@ -96,12 +144,43 @@ type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
|
96
144
|
}>;
|
|
97
145
|
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : Array<Match<RouteInfo> | undefined>;
|
|
98
146
|
type CreateComponentProps<T extends RouteInfo> = {
|
|
147
|
+
/**
|
|
148
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
149
|
+
* @example
|
|
150
|
+
* // app/routes.ts
|
|
151
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
152
|
+
*
|
|
153
|
+
* // app/team.tsx
|
|
154
|
+
* export default function Component({
|
|
155
|
+
* params,
|
|
156
|
+
* }: Route.ComponentProps) {
|
|
157
|
+
* params.teamId;
|
|
158
|
+
* // ^ string
|
|
159
|
+
* }
|
|
160
|
+
**/
|
|
99
161
|
params: T["params"];
|
|
162
|
+
/** The data returned from the `loader` or `clientLoader` */
|
|
100
163
|
loaderData: T["loaderData"];
|
|
164
|
+
/** The data returned from the `action` or `clientAction` following an action submission. */
|
|
101
165
|
actionData?: T["actionData"];
|
|
166
|
+
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
|
102
167
|
matches: Matches<[...T["parents"], T]>;
|
|
103
168
|
};
|
|
104
169
|
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
170
|
+
/**
|
|
171
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
172
|
+
* @example
|
|
173
|
+
* // app/routes.ts
|
|
174
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
175
|
+
*
|
|
176
|
+
* // app/team.tsx
|
|
177
|
+
* export function ErrorBoundary({
|
|
178
|
+
* params,
|
|
179
|
+
* }: Route.ErrorBoundaryProps) {
|
|
180
|
+
* params.teamId;
|
|
181
|
+
* // ^ string
|
|
182
|
+
* }
|
|
183
|
+
**/
|
|
105
184
|
params: T["params"];
|
|
106
185
|
error: unknown;
|
|
107
186
|
loaderData?: T["loaderData"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { az as LinkDescriptor, aw as MetaDescriptor,
|
|
1
|
+
import { az as LinkDescriptor, aw as MetaDescriptor, aO as ServerDataFrom, aP as ClientDataFrom, aQ as Func, E as Equal, aR as Pretty } from '../../route-data-BmvbmBej.js';
|
|
2
2
|
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -36,10 +36,15 @@ type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
|
36
36
|
}>;
|
|
37
37
|
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<RouteInfo> | undefined>;
|
|
38
38
|
type CreateMetaArgs<T extends RouteInfo> = {
|
|
39
|
+
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
|
|
39
40
|
location: Location;
|
|
41
|
+
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
|
40
42
|
params: T["params"];
|
|
43
|
+
/** The return value for this route's server loader function */
|
|
41
44
|
data: T["loaderData"];
|
|
45
|
+
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
|
42
46
|
error?: unknown;
|
|
47
|
+
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
|
43
48
|
matches: MetaMatches<[...T["parents"], T]>;
|
|
44
49
|
};
|
|
45
50
|
type MetaDescriptors = MetaDescriptor[];
|
|
@@ -70,18 +75,61 @@ type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
70
75
|
IsDefined<ClientActionData>
|
|
71
76
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
72
77
|
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
78
|
+
/**
|
|
79
|
+
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
|
80
|
+
*
|
|
81
|
+
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
|
82
|
+
**/
|
|
73
83
|
request: Request;
|
|
84
|
+
/**
|
|
85
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
86
|
+
* @example
|
|
87
|
+
* // app/routes.ts
|
|
88
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
89
|
+
*
|
|
90
|
+
* // app/team.tsx
|
|
91
|
+
* export function clientLoader({
|
|
92
|
+
* params,
|
|
93
|
+
* }: Route.ClientLoaderArgs) {
|
|
94
|
+
* params.teamId;
|
|
95
|
+
* // ^ string
|
|
96
|
+
* }
|
|
97
|
+
**/
|
|
74
98
|
params: T["params"];
|
|
75
99
|
};
|
|
76
|
-
type ServerDataFunctionArgs<T extends RouteInfo> =
|
|
100
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = {
|
|
101
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
|
102
|
+
request: Request;
|
|
103
|
+
/**
|
|
104
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
105
|
+
* @example
|
|
106
|
+
* // app/routes.ts
|
|
107
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
108
|
+
*
|
|
109
|
+
* // app/team.tsx
|
|
110
|
+
* export function loader({
|
|
111
|
+
* params,
|
|
112
|
+
* }: Route.LoaderArgs) {
|
|
113
|
+
* params.teamId;
|
|
114
|
+
* // ^ string
|
|
115
|
+
* }
|
|
116
|
+
**/
|
|
117
|
+
params: T["params"];
|
|
118
|
+
/**
|
|
119
|
+
* This is the context passed in to your server adapter's getLoadContext() function.
|
|
120
|
+
* It's a way to bridge the gap between the adapter's request/response API with your React Router app.
|
|
121
|
+
* It is only applicable if you are using a custom server adapter.
|
|
122
|
+
*/
|
|
77
123
|
context: AppLoadContext;
|
|
78
124
|
};
|
|
79
125
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
80
126
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
127
|
+
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
|
81
128
|
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
82
129
|
};
|
|
83
130
|
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
84
131
|
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
132
|
+
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
|
85
133
|
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
|
86
134
|
};
|
|
87
135
|
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
|
@@ -96,12 +144,43 @@ type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
|
96
144
|
}>;
|
|
97
145
|
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : Array<Match<RouteInfo> | undefined>;
|
|
98
146
|
type CreateComponentProps<T extends RouteInfo> = {
|
|
147
|
+
/**
|
|
148
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
149
|
+
* @example
|
|
150
|
+
* // app/routes.ts
|
|
151
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
152
|
+
*
|
|
153
|
+
* // app/team.tsx
|
|
154
|
+
* export default function Component({
|
|
155
|
+
* params,
|
|
156
|
+
* }: Route.ComponentProps) {
|
|
157
|
+
* params.teamId;
|
|
158
|
+
* // ^ string
|
|
159
|
+
* }
|
|
160
|
+
**/
|
|
99
161
|
params: T["params"];
|
|
162
|
+
/** The data returned from the `loader` or `clientLoader` */
|
|
100
163
|
loaderData: T["loaderData"];
|
|
164
|
+
/** The data returned from the `action` or `clientAction` following an action submission. */
|
|
101
165
|
actionData?: T["actionData"];
|
|
166
|
+
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
|
102
167
|
matches: Matches<[...T["parents"], T]>;
|
|
103
168
|
};
|
|
104
169
|
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
170
|
+
/**
|
|
171
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
172
|
+
* @example
|
|
173
|
+
* // app/routes.ts
|
|
174
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
175
|
+
*
|
|
176
|
+
* // app/team.tsx
|
|
177
|
+
* export function ErrorBoundary({
|
|
178
|
+
* params,
|
|
179
|
+
* }: Route.ErrorBoundaryProps) {
|
|
180
|
+
* params.teamId;
|
|
181
|
+
* // ^ string
|
|
182
|
+
* }
|
|
183
|
+
**/
|
|
105
184
|
params: T["params"];
|
|
106
185
|
error: unknown;
|
|
107
186
|
loaderData?: T["loaderData"];
|