react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-31a822c5f
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-B4aBBnx8.d.ts +310 -0
- package/dist/development/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/development/{chunk-LUB73E44.js → chunk-CZ7KRWQZ.js} +827 -64
- package/dist/development/{chunk-AGOH44BE.mjs → chunk-FXUONXY4.mjs} +132 -808
- package/dist/development/chunk-SE36CWVW.js +1308 -0
- package/dist/development/chunk-T5RKBXBV.js +188 -0
- package/dist/development/{chunk-IMKEG5CI.mjs → chunk-WTUOISGV.mjs} +2 -2
- package/dist/development/dom-export.d.mts +48 -3
- package/dist/development/dom-export.d.ts +48 -1
- package/dist/development/dom-export.js +703 -18
- package/dist/development/dom-export.mjs +687 -9
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +9 -316
- package/dist/development/index.d.ts +9 -358
- package/dist/development/index.js +82 -914
- package/dist/development/index.mjs +3 -9
- package/dist/development/lib/types/internal.d.mts +2 -3
- 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/{production/register-BrVEYTED.d.mts → development/register-BblEgJPm.d.mts} +1 -1
- package/dist/development/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/development/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/dist/production/browser-B4aBBnx8.d.ts +310 -0
- package/dist/production/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/production/{chunk-2L5AG5Y5.js → chunk-DRKUM6HW.js} +827 -64
- package/dist/production/{chunk-AODJW4D3.mjs → chunk-IGF74WUC.mjs} +132 -808
- package/dist/production/{chunk-UOQCOPF6.mjs → chunk-RUSRTUHT.mjs} +2 -2
- package/dist/production/chunk-UU3LJMU6.js +188 -0
- package/dist/production/chunk-YVVCGSEG.js +1308 -0
- package/dist/production/dom-export.d.mts +48 -3
- package/dist/production/dom-export.d.ts +48 -1
- package/dist/production/dom-export.js +703 -18
- package/dist/production/dom-export.mjs +687 -9
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +9 -316
- package/dist/production/index.d.ts +9 -358
- package/dist/production/index.js +82 -914
- package/dist/production/index.mjs +3 -9
- package/dist/production/lib/types/internal.d.mts +2 -3
- 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-BrVEYTED.d.mts → production/register-BblEgJPm.d.mts} +1 -1
- package/dist/production/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/production/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-2G2U5HGB.js +0 -2089
- package/dist/development/route-data-CDwqkzPE.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-FGRCWJDI.js +0 -2089
- package/dist/production/route-data-CDwqkzPE.d.mts +0 -473
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-31a822c5f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,11 +11,9 @@
|
|
|
11
11
|
"use client";
|
|
12
12
|
import {
|
|
13
13
|
RSCDefaultRootErrorBoundary,
|
|
14
|
-
RSCHydratedRouter,
|
|
15
14
|
RSCStaticRouter,
|
|
16
15
|
ServerMode,
|
|
17
16
|
ServerRouter,
|
|
18
|
-
createCallServer,
|
|
19
17
|
createCookie,
|
|
20
18
|
createCookieSessionStorage,
|
|
21
19
|
createMemorySessionStorage,
|
|
@@ -25,13 +23,12 @@ import {
|
|
|
25
23
|
createSessionStorage,
|
|
26
24
|
deserializeErrors,
|
|
27
25
|
getHydrationData,
|
|
28
|
-
getRSCStream,
|
|
29
26
|
href,
|
|
30
27
|
isCookie,
|
|
31
28
|
isSession,
|
|
32
29
|
routeRSCServerRequest,
|
|
33
30
|
setDevServerHooks
|
|
34
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FXUONXY4.mjs";
|
|
35
32
|
import {
|
|
36
33
|
Action,
|
|
37
34
|
Await,
|
|
@@ -142,7 +139,7 @@ import {
|
|
|
142
139
|
withComponentProps,
|
|
143
140
|
withErrorBoundaryProps,
|
|
144
141
|
withHydrateFallbackProps
|
|
145
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-WTUOISGV.mjs";
|
|
146
143
|
export {
|
|
147
144
|
Await,
|
|
148
145
|
BrowserRouter,
|
|
@@ -237,10 +234,7 @@ export {
|
|
|
237
234
|
replace,
|
|
238
235
|
resolvePath,
|
|
239
236
|
HistoryRouter as unstable_HistoryRouter,
|
|
240
|
-
RSCHydratedRouter as unstable_RSCHydratedRouter,
|
|
241
237
|
RSCStaticRouter as unstable_RSCStaticRouter,
|
|
242
|
-
createCallServer as unstable_createCallServer,
|
|
243
|
-
getRSCStream as unstable_getRSCStream,
|
|
244
238
|
routeRSCServerRequest as unstable_routeRSCServerRequest,
|
|
245
239
|
setDevServerHooks as unstable_setDevServerHooks,
|
|
246
240
|
usePrompt as unstable_usePrompt,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule,
|
|
2
|
-
import {
|
|
3
|
-
import { R as RouteFiles, P as Pages } from '../../register-BrVEYTED.mjs';
|
|
1
|
+
import { R as RouteModule, g as LinkDescriptor, L as Location, F as Func, h as Pretty, i as MetaDescriptor, G as GetLoaderData, j as ServerDataFunctionArgs, k as MiddlewareNextFunction, l as ClientDataFunctionArgs, D as DataStrategyResult, m as ServerDataFrom, N as Normalize, n as GetActionData } from '../../route-data-nQS6GSUI.mjs';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-BblEgJPm.mjs';
|
|
4
3
|
import 'react';
|
|
5
4
|
|
|
6
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule,
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-
|
|
1
|
+
import { R as RouteModule, f as LinkDescriptor, L as Location, F as Func, g as Pretty, h as MetaDescriptor, G as GetLoaderData, i as ServerDataFunctionArgs, j as MiddlewareNextFunction, k as ClientDataFunctionArgs, D as DataStrategyResult, l as ServerDataFrom, N as Normalize, m as GetActionData } from '../../routeModules-9wlxglVk.js';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-D18raRVf.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteModule } from './routeModules-
|
|
1
|
+
import { R as RouteModule } from './routeModules-9wlxglVk.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ComponentType, ReactElement } from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Actions represent the type of change to a location value.
|
|
@@ -2178,7 +2179,7 @@ interface RoutesProps {
|
|
|
2178
2179
|
* <Routes>
|
|
2179
2180
|
* <Route index element={<StepOne />} />
|
|
2180
2181
|
* <Route path="step-2" element={<StepTwo />} />
|
|
2181
|
-
* <Route path="step-3" element={<StepThree />}
|
|
2182
|
+
* <Route path="step-3" element={<StepThree />} />
|
|
2182
2183
|
* </Routes>
|
|
2183
2184
|
*
|
|
2184
2185
|
* @public
|
|
@@ -2565,4 +2566,473 @@ interface RouteContextObject {
|
|
|
2565
2566
|
}
|
|
2566
2567
|
declare const RouteContext: React.Context<RouteContextObject>;
|
|
2567
2568
|
|
|
2568
|
-
|
|
2569
|
+
/**
|
|
2570
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
2571
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
2572
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
2573
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
2574
|
+
*/
|
|
2575
|
+
interface AppLoadContext {
|
|
2576
|
+
[key: string]: unknown;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
2580
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
2581
|
+
interface HtmlLinkProps {
|
|
2582
|
+
/**
|
|
2583
|
+
* Address of the hyperlink
|
|
2584
|
+
*/
|
|
2585
|
+
href?: string;
|
|
2586
|
+
/**
|
|
2587
|
+
* How the element handles crossorigin requests
|
|
2588
|
+
*/
|
|
2589
|
+
crossOrigin?: "anonymous" | "use-credentials";
|
|
2590
|
+
/**
|
|
2591
|
+
* Relationship between the document containing the hyperlink and the destination resource
|
|
2592
|
+
*/
|
|
2593
|
+
rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
|
|
2594
|
+
/**
|
|
2595
|
+
* Applicable media: "screen", "print", "(max-width: 764px)"
|
|
2596
|
+
*/
|
|
2597
|
+
media?: string;
|
|
2598
|
+
/**
|
|
2599
|
+
* Integrity metadata used in Subresource Integrity checks
|
|
2600
|
+
*/
|
|
2601
|
+
integrity?: string;
|
|
2602
|
+
/**
|
|
2603
|
+
* Language of the linked resource
|
|
2604
|
+
*/
|
|
2605
|
+
hrefLang?: string;
|
|
2606
|
+
/**
|
|
2607
|
+
* Hint for the type of the referenced resource
|
|
2608
|
+
*/
|
|
2609
|
+
type?: string;
|
|
2610
|
+
/**
|
|
2611
|
+
* Referrer policy for fetches initiated by the element
|
|
2612
|
+
*/
|
|
2613
|
+
referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
2614
|
+
/**
|
|
2615
|
+
* Sizes of the icons (for rel="icon")
|
|
2616
|
+
*/
|
|
2617
|
+
sizes?: string;
|
|
2618
|
+
/**
|
|
2619
|
+
* Potential destination for a preload request (for rel="preload" and rel="modulepreload")
|
|
2620
|
+
*/
|
|
2621
|
+
as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
|
|
2622
|
+
/**
|
|
2623
|
+
* Color to use when customizing a site's icon (for rel="mask-icon")
|
|
2624
|
+
*/
|
|
2625
|
+
color?: string;
|
|
2626
|
+
/**
|
|
2627
|
+
* Whether the link is disabled
|
|
2628
|
+
*/
|
|
2629
|
+
disabled?: boolean;
|
|
2630
|
+
/**
|
|
2631
|
+
* The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
|
|
2632
|
+
*/
|
|
2633
|
+
title?: string;
|
|
2634
|
+
/**
|
|
2635
|
+
* Images to use in different situations, e.g., high-resolution displays,
|
|
2636
|
+
* small monitors, etc. (for rel="preload")
|
|
2637
|
+
*/
|
|
2638
|
+
imageSrcSet?: string;
|
|
2639
|
+
/**
|
|
2640
|
+
* Image sizes for different page layouts (for rel="preload")
|
|
2641
|
+
*/
|
|
2642
|
+
imageSizes?: string;
|
|
2643
|
+
}
|
|
2644
|
+
interface HtmlLinkPreloadImage extends HtmlLinkProps {
|
|
2645
|
+
/**
|
|
2646
|
+
* Relationship between the document containing the hyperlink and the destination resource
|
|
2647
|
+
*/
|
|
2648
|
+
rel: "preload";
|
|
2649
|
+
/**
|
|
2650
|
+
* Potential destination for a preload request (for rel="preload" and rel="modulepreload")
|
|
2651
|
+
*/
|
|
2652
|
+
as: "image";
|
|
2653
|
+
/**
|
|
2654
|
+
* Address of the hyperlink
|
|
2655
|
+
*/
|
|
2656
|
+
href?: string;
|
|
2657
|
+
/**
|
|
2658
|
+
* Images to use in different situations, e.g., high-resolution displays,
|
|
2659
|
+
* small monitors, etc. (for rel="preload")
|
|
2660
|
+
*/
|
|
2661
|
+
imageSrcSet: string;
|
|
2662
|
+
/**
|
|
2663
|
+
* Image sizes for different page layouts (for rel="preload")
|
|
2664
|
+
*/
|
|
2665
|
+
imageSizes?: string;
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Represents a `<link>` element.
|
|
2669
|
+
*
|
|
2670
|
+
* WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
|
|
2671
|
+
*/
|
|
2672
|
+
type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
|
|
2673
|
+
imageSizes?: never;
|
|
2674
|
+
});
|
|
2675
|
+
interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
|
|
2676
|
+
/**
|
|
2677
|
+
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
2678
|
+
* attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
|
2679
|
+
* element
|
|
2680
|
+
*/
|
|
2681
|
+
nonce?: string | undefined;
|
|
2682
|
+
/**
|
|
2683
|
+
* The absolute path of the page to prefetch, e.g. `/absolute/path`.
|
|
2684
|
+
*/
|
|
2685
|
+
page: string;
|
|
2686
|
+
}
|
|
2687
|
+
type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
|
|
2688
|
+
|
|
2689
|
+
interface RouteModules {
|
|
2690
|
+
[routeId: string]: RouteModule$1 | undefined;
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* The shape of a route module shipped to the client
|
|
2694
|
+
*/
|
|
2695
|
+
interface RouteModule$1 {
|
|
2696
|
+
clientAction?: ClientActionFunction;
|
|
2697
|
+
clientLoader?: ClientLoaderFunction;
|
|
2698
|
+
clientMiddleware?: MiddlewareFunction<Record<string, DataStrategyResult>>[];
|
|
2699
|
+
ErrorBoundary?: ErrorBoundaryComponent;
|
|
2700
|
+
HydrateFallback?: HydrateFallbackComponent;
|
|
2701
|
+
Layout?: LayoutComponent;
|
|
2702
|
+
default: RouteComponent;
|
|
2703
|
+
handle?: RouteHandle;
|
|
2704
|
+
links?: LinksFunction;
|
|
2705
|
+
meta?: MetaFunction;
|
|
2706
|
+
shouldRevalidate?: ShouldRevalidateFunction;
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* The shape of a route module on the server
|
|
2710
|
+
*/
|
|
2711
|
+
interface ServerRouteModule extends RouteModule$1 {
|
|
2712
|
+
action?: ActionFunction;
|
|
2713
|
+
headers?: HeadersFunction | {
|
|
2714
|
+
[name: string]: string;
|
|
2715
|
+
};
|
|
2716
|
+
loader?: LoaderFunction;
|
|
2717
|
+
middleware?: MiddlewareFunction<Response>[];
|
|
2718
|
+
}
|
|
2719
|
+
/**
|
|
2720
|
+
* A function that handles data mutations for a route on the client
|
|
2721
|
+
*/
|
|
2722
|
+
type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
|
|
2723
|
+
/**
|
|
2724
|
+
* Arguments passed to a route `clientAction` function
|
|
2725
|
+
*/
|
|
2726
|
+
type ClientActionFunctionArgs = ActionFunctionArgs & {
|
|
2727
|
+
serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
2728
|
+
};
|
|
2729
|
+
/**
|
|
2730
|
+
* A function that loads data for a route on the client
|
|
2731
|
+
*/
|
|
2732
|
+
type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
|
|
2733
|
+
hydrate?: boolean;
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* Arguments passed to a route `clientLoader` function
|
|
2737
|
+
*/
|
|
2738
|
+
type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
|
|
2739
|
+
serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
|
|
2740
|
+
};
|
|
2741
|
+
/**
|
|
2742
|
+
* ErrorBoundary to display for this route
|
|
2743
|
+
*/
|
|
2744
|
+
type ErrorBoundaryComponent = ComponentType;
|
|
2745
|
+
type HeadersArgs = {
|
|
2746
|
+
loaderHeaders: Headers;
|
|
2747
|
+
parentHeaders: Headers;
|
|
2748
|
+
actionHeaders: Headers;
|
|
2749
|
+
errorHeaders: Headers | undefined;
|
|
2750
|
+
};
|
|
2751
|
+
/**
|
|
2752
|
+
* A function that returns HTTP headers to be used for a route. These headers
|
|
2753
|
+
* will be merged with (and take precedence over) headers from parent routes.
|
|
2754
|
+
*/
|
|
2755
|
+
interface HeadersFunction {
|
|
2756
|
+
(args: HeadersArgs): Headers | HeadersInit;
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* `<Route HydrateFallback>` component to render on initial loads
|
|
2760
|
+
* when client loaders are present
|
|
2761
|
+
*/
|
|
2762
|
+
type HydrateFallbackComponent = ComponentType;
|
|
2763
|
+
/**
|
|
2764
|
+
* Optional, root-only `<Route Layout>` component to wrap the root content in.
|
|
2765
|
+
* Useful for defining the <html>/<head>/<body> document shell shared by the
|
|
2766
|
+
* Component, HydrateFallback, and ErrorBoundary
|
|
2767
|
+
*/
|
|
2768
|
+
type LayoutComponent = ComponentType<{
|
|
2769
|
+
children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
|
|
2770
|
+
}>;
|
|
2771
|
+
/**
|
|
2772
|
+
* A function that defines `<link>` tags to be inserted into the `<head>` of
|
|
2773
|
+
* the document on route transitions.
|
|
2774
|
+
*
|
|
2775
|
+
* @see https://remix.run/route/meta
|
|
2776
|
+
*/
|
|
2777
|
+
interface LinksFunction {
|
|
2778
|
+
(): LinkDescriptor[];
|
|
2779
|
+
}
|
|
2780
|
+
interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
|
|
2781
|
+
id: RouteId;
|
|
2782
|
+
pathname: DataRouteMatch["pathname"];
|
|
2783
|
+
/** @deprecated Use `MetaMatch.loaderData` instead */
|
|
2784
|
+
data: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
|
|
2785
|
+
loaderData: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
|
|
2786
|
+
handle?: RouteHandle;
|
|
2787
|
+
params: DataRouteMatch["params"];
|
|
2788
|
+
meta: MetaDescriptor[];
|
|
2789
|
+
error?: unknown;
|
|
2790
|
+
}
|
|
2791
|
+
type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{
|
|
2792
|
+
[K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>;
|
|
2793
|
+
}[keyof MatchLoaders]>;
|
|
2794
|
+
interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
|
|
2795
|
+
/** @deprecated Use `MetaArgs.loaderData` instead */
|
|
2796
|
+
data: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
|
|
2797
|
+
loaderData: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
|
|
2798
|
+
params: Params;
|
|
2799
|
+
location: Location;
|
|
2800
|
+
matches: MetaMatches<MatchLoaders>;
|
|
2801
|
+
error?: unknown;
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* A function that returns an array of data objects to use for rendering
|
|
2805
|
+
* metadata HTML tags in a route. These tags are not rendered on descendant
|
|
2806
|
+
* routes in the route hierarchy. In other words, they will only be rendered on
|
|
2807
|
+
* the route in which they are exported.
|
|
2808
|
+
*
|
|
2809
|
+
* @param Loader - The type of the current route's loader function
|
|
2810
|
+
* @param MatchLoaders - Mapping from a parent route's filepath to its loader
|
|
2811
|
+
* function type
|
|
2812
|
+
*
|
|
2813
|
+
* Note that parent route filepaths are relative to the `app/` directory.
|
|
2814
|
+
*
|
|
2815
|
+
* For example, if this meta function is for `/sales/customers/$customerId`:
|
|
2816
|
+
*
|
|
2817
|
+
* ```ts
|
|
2818
|
+
* // app/root.tsx
|
|
2819
|
+
* const loader = () => ({ hello: "world" })
|
|
2820
|
+
* export type Loader = typeof loader
|
|
2821
|
+
*
|
|
2822
|
+
* // app/routes/sales.tsx
|
|
2823
|
+
* const loader = () => ({ salesCount: 1074 })
|
|
2824
|
+
* export type Loader = typeof loader
|
|
2825
|
+
*
|
|
2826
|
+
* // app/routes/sales/customers.tsx
|
|
2827
|
+
* const loader = () => ({ customerCount: 74 })
|
|
2828
|
+
* export type Loader = typeof loader
|
|
2829
|
+
*
|
|
2830
|
+
* // app/routes/sales/customers/$customersId.tsx
|
|
2831
|
+
* import type { Loader as RootLoader } from "../../../root"
|
|
2832
|
+
* import type { Loader as SalesLoader } from "../../sales"
|
|
2833
|
+
* import type { Loader as CustomersLoader } from "../../sales/customers"
|
|
2834
|
+
*
|
|
2835
|
+
* const loader = () => ({ name: "Customer name" })
|
|
2836
|
+
*
|
|
2837
|
+
* const meta: MetaFunction<typeof loader, {
|
|
2838
|
+
* "root": RootLoader,
|
|
2839
|
+
* "routes/sales": SalesLoader,
|
|
2840
|
+
* "routes/sales/customers": CustomersLoader,
|
|
2841
|
+
* }> = ({ data, matches }) => {
|
|
2842
|
+
* const { name } = data
|
|
2843
|
+
* // ^? string
|
|
2844
|
+
* const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").data
|
|
2845
|
+
* // ^? number
|
|
2846
|
+
* const { salesCount } = matches.find((match) => match.id === "routes/sales").data
|
|
2847
|
+
* // ^? number
|
|
2848
|
+
* const { hello } = matches.find((match) => match.id === "root").data
|
|
2849
|
+
* // ^? "world"
|
|
2850
|
+
* }
|
|
2851
|
+
* ```
|
|
2852
|
+
*/
|
|
2853
|
+
interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
|
|
2854
|
+
(args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
|
|
2855
|
+
}
|
|
2856
|
+
type MetaDescriptor = {
|
|
2857
|
+
charSet: "utf-8";
|
|
2858
|
+
} | {
|
|
2859
|
+
title: string;
|
|
2860
|
+
} | {
|
|
2861
|
+
name: string;
|
|
2862
|
+
content: string;
|
|
2863
|
+
} | {
|
|
2864
|
+
property: string;
|
|
2865
|
+
content: string;
|
|
2866
|
+
} | {
|
|
2867
|
+
httpEquiv: string;
|
|
2868
|
+
content: string;
|
|
2869
|
+
} | {
|
|
2870
|
+
"script:ld+json": LdJsonObject;
|
|
2871
|
+
} | {
|
|
2872
|
+
tagName: "meta" | "link";
|
|
2873
|
+
[name: string]: string;
|
|
2874
|
+
} | {
|
|
2875
|
+
[name: string]: unknown;
|
|
2876
|
+
};
|
|
2877
|
+
type LdJsonObject = {
|
|
2878
|
+
[Key in string]: LdJsonValue;
|
|
2879
|
+
} & {
|
|
2880
|
+
[Key in string]?: LdJsonValue | undefined;
|
|
2881
|
+
};
|
|
2882
|
+
type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
|
|
2883
|
+
type LdJsonPrimitive = string | number | boolean | null;
|
|
2884
|
+
type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
|
|
2885
|
+
/**
|
|
2886
|
+
* A React component that is rendered for a route.
|
|
2887
|
+
*/
|
|
2888
|
+
type RouteComponent = ComponentType<{}>;
|
|
2889
|
+
/**
|
|
2890
|
+
* An arbitrary object that is associated with a route.
|
|
2891
|
+
*
|
|
2892
|
+
* @see https://remix.run/route/handle
|
|
2893
|
+
*/
|
|
2894
|
+
type RouteHandle = unknown;
|
|
2895
|
+
|
|
2896
|
+
type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
|
|
2897
|
+
[key: PropertyKey]: Serializable;
|
|
2898
|
+
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
2899
|
+
|
|
2900
|
+
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
2901
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
2902
|
+
type Func = (...args: any[]) => unknown;
|
|
2903
|
+
type Pretty<T> = {
|
|
2904
|
+
[K in keyof T]: T[K];
|
|
2905
|
+
} & {};
|
|
2906
|
+
type Normalize<T> = _Normalize<UnionKeys<T>, T>;
|
|
2907
|
+
type _Normalize<Key extends keyof any, T> = T extends infer U ? Pretty<{
|
|
2908
|
+
[K in Key as K extends keyof U ? undefined extends U[K] ? never : K : never]: K extends keyof U ? U[K] : never;
|
|
2909
|
+
} & {
|
|
2910
|
+
[K in Key as K extends keyof U ? undefined extends U[K] ? K : never : never]?: K extends keyof U ? U[K] : never;
|
|
2911
|
+
} & {
|
|
2912
|
+
[K in Key as K extends keyof U ? never : K]?: undefined;
|
|
2913
|
+
}> : never;
|
|
2914
|
+
type UnionKeys<T> = T extends any ? keyof T : never;
|
|
2915
|
+
|
|
2916
|
+
type RouteModule = {
|
|
2917
|
+
meta?: Func;
|
|
2918
|
+
links?: Func;
|
|
2919
|
+
headers?: Func;
|
|
2920
|
+
loader?: Func;
|
|
2921
|
+
clientLoader?: Func;
|
|
2922
|
+
action?: Func;
|
|
2923
|
+
clientAction?: Func;
|
|
2924
|
+
HydrateFallback?: Func;
|
|
2925
|
+
default?: Func;
|
|
2926
|
+
ErrorBoundary?: Func;
|
|
2927
|
+
[key: string]: unknown;
|
|
2928
|
+
};
|
|
2929
|
+
|
|
2930
|
+
/**
|
|
2931
|
+
* A brand that can be applied to a type to indicate that it will serialize
|
|
2932
|
+
* to a specific type when transported to the client from a loader.
|
|
2933
|
+
* Only use this if you have additional serialization/deserialization logic
|
|
2934
|
+
* in your application.
|
|
2935
|
+
*/
|
|
2936
|
+
type unstable_SerializesTo<T> = {
|
|
2937
|
+
unstable__ReactRouter_SerializesTo: [T];
|
|
2938
|
+
};
|
|
2939
|
+
|
|
2940
|
+
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 ReadonlyMap<infer K, infer V> ? ReadonlyMap<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<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> ? {
|
|
2941
|
+
[K in keyof T]: Serialize<T[K]>;
|
|
2942
|
+
} : undefined;
|
|
2943
|
+
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
|
|
2944
|
+
type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
|
|
2945
|
+
type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
|
|
2946
|
+
type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
|
|
2947
|
+
type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
2948
|
+
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
2949
|
+
type ClientDataFunctionArgs<Params> = {
|
|
2950
|
+
/**
|
|
2951
|
+
* 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.
|
|
2952
|
+
*
|
|
2953
|
+
* @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.
|
|
2954
|
+
**/
|
|
2955
|
+
request: Request;
|
|
2956
|
+
/**
|
|
2957
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
2958
|
+
* @example
|
|
2959
|
+
* // app/routes.ts
|
|
2960
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
2961
|
+
*
|
|
2962
|
+
* // app/team.tsx
|
|
2963
|
+
* export function clientLoader({
|
|
2964
|
+
* params,
|
|
2965
|
+
* }: Route.ClientLoaderArgs) {
|
|
2966
|
+
* params.teamId;
|
|
2967
|
+
* // ^ string
|
|
2968
|
+
* }
|
|
2969
|
+
**/
|
|
2970
|
+
params: Params;
|
|
2971
|
+
/**
|
|
2972
|
+
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
2973
|
+
*
|
|
2974
|
+
* When `future.v8_middleware` is enabled, this is an instance of
|
|
2975
|
+
* `RouterContextProvider` and can be used to access context values
|
|
2976
|
+
* from your route middlewares. You may pass in initial context values in your
|
|
2977
|
+
* `<HydratedRouter getContext>` prop
|
|
2978
|
+
*/
|
|
2979
|
+
context: Readonly<RouterContextProvider>;
|
|
2980
|
+
};
|
|
2981
|
+
type ServerDataFunctionArgs<Params> = {
|
|
2982
|
+
/** 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. */
|
|
2983
|
+
request: Request;
|
|
2984
|
+
/**
|
|
2985
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
2986
|
+
* @example
|
|
2987
|
+
* // app/routes.ts
|
|
2988
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
2989
|
+
*
|
|
2990
|
+
* // app/team.tsx
|
|
2991
|
+
* export function loader({
|
|
2992
|
+
* params,
|
|
2993
|
+
* }: Route.LoaderArgs) {
|
|
2994
|
+
* params.teamId;
|
|
2995
|
+
* // ^ string
|
|
2996
|
+
* }
|
|
2997
|
+
**/
|
|
2998
|
+
params: Params;
|
|
2999
|
+
/**
|
|
3000
|
+
* Without `future.v8_middleware` enabled, this is the context passed in
|
|
3001
|
+
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
3002
|
+
* gap between the adapter's request/response API with your React Router app.
|
|
3003
|
+
* It is only applicable if you are using a custom server adapter.
|
|
3004
|
+
*
|
|
3005
|
+
* With `future.v8_middleware` enabled, this is an instance of
|
|
3006
|
+
* `RouterContextProvider` and can be used for type-safe access to
|
|
3007
|
+
* context value set in your route middlewares. If you are using a custom
|
|
3008
|
+
* server adapter, you may provide an initial set of context values from your
|
|
3009
|
+
* `getLoadContext` function.
|
|
3010
|
+
*/
|
|
3011
|
+
context: MiddlewareEnabled extends true ? Readonly<RouterContextProvider> : AppLoadContext;
|
|
3012
|
+
};
|
|
3013
|
+
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
|
|
3014
|
+
ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
|
|
3015
|
+
] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
3016
|
+
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
3017
|
+
type IsHydrate<ClientLoader> = ClientLoader extends {
|
|
3018
|
+
hydrate: true;
|
|
3019
|
+
} ? true : ClientLoader extends {
|
|
3020
|
+
hydrate: false;
|
|
3021
|
+
} ? false : false;
|
|
3022
|
+
type GetLoaderData<T extends RouteModule> = _DataLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
|
3023
|
+
HydrateFallback: Func;
|
|
3024
|
+
} ? true : false>;
|
|
3025
|
+
type _DataLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
|
3026
|
+
HasHydrateFallback,
|
|
3027
|
+
ClientLoaderHydrate
|
|
3028
|
+
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
|
3029
|
+
IsDefined<ClientLoaderData>,
|
|
3030
|
+
IsDefined<ServerLoaderData>
|
|
3031
|
+
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
|
3032
|
+
type GetActionData<T extends RouteModule> = _DataActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
|
3033
|
+
type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
3034
|
+
IsDefined<ServerActionData>,
|
|
3035
|
+
IsDefined<ClientActionData>
|
|
3036
|
+
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
3037
|
+
|
|
3038
|
+
export { type Equal as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyResult as D, type Navigation as E, type Func as F, type GetLoaderData as G, type HeadersFunction as H, Action as I, type RouteObject as J, type InitialEntry as K, type Location as L, type MetaFunction as M, type Normalize as N, type HydrationState as O, type Params as P, type IndexRouteObject as Q, type RouteModule as R, type ShouldRevalidateFunction as S, type To as T, type UIMatch as U, type RouteComponentType as V, type HydrateFallbackType as W, type ErrorBoundaryType as X, type NonIndexRouteObject as Y, type AppLoadContext as Z, type MiddlewareEnabled as _, type ClientLoaderFunction as a, Route as a$, type RouterState as a0, type PatchRoutesOnNavigationFunction as a1, type DataRouteObject as a2, type StaticHandler as a3, type GetScrollPositionFunction as a4, type GetScrollRestorationKeyFunction as a5, type StaticHandlerContext as a6, type Fetcher as a7, type NavigationStates as a8, type RouterSubscriber as a9, isRouteErrorResponse as aA, matchPath as aB, matchRoutes as aC, redirect as aD, redirectDocument as aE, replace as aF, resolvePath as aG, type DataRouteMatch as aH, type Navigator as aI, type PatchRoutesOnNavigationFunctionArgs as aJ, type RouteMatch as aK, AwaitContextProvider as aL, type AwaitProps as aM, type IndexRouteProps as aN, type LayoutRouteProps as aO, type MemoryRouterOpts as aP, type MemoryRouterProps as aQ, type NavigateProps as aR, type OutletProps as aS, type PathRouteProps as aT, type RouteProps as aU, type RouterProps as aV, type RoutesProps as aW, Await as aX, MemoryRouter as aY, Navigate as aZ, Outlet as a_, type RouterNavigateOptions as aa, type RouterFetchOptions as ab, type RevalidationState as ac, type ActionFunctionArgs as ad, type DataStrategyFunctionArgs as ae, type DataStrategyMatch as af, DataWithResponseInit as ag, type ErrorResponse as ah, type FormEncType as ai, type FormMethod as aj, type HTMLFormMethod as ak, type LazyRouteFunction as al, type LoaderFunctionArgs as am, type MiddlewareFunction as an, type PathParam as ao, type RedirectFunction as ap, type RouterContext as aq, type ShouldRevalidateFunctionArgs as ar, createContext as as, createPath as at, parsePath as au, IDLE_NAVIGATION as av, IDLE_FETCHER as aw, IDLE_BLOCKER as ax, data as ay, generatePath as az, type LinksFunction as b, Router as b0, RouterProvider as b1, Routes as b2, createMemoryRouter as b3, createRoutesFromChildren as b4, createRoutesFromElements as b5, renderMatches as b6, type ClientActionFunctionArgs as b7, type ClientLoaderFunctionArgs as b8, type HeadersArgs as b9, type History as bA, type FutureConfig as bB, type CreateStaticHandlerOptions as bC, type MetaArgs as ba, type PageLinkDescriptor as bb, type HtmlLinkDescriptor as bc, type Future as bd, type unstable_SerializesTo as be, createBrowserHistory as bf, invariant as bg, createRouter as bh, ErrorResponseImpl as bi, DataRouterContext as bj, DataRouterStateContext as bk, FetchersContext as bl, LocationContext as bm, NavigationContext as bn, RouteContext as bo, ViewTransitionContext as bp, hydrationRouteProperties as bq, mapRouteProperties as br, WithComponentProps as bs, withComponentProps as bt, WithHydrateFallbackProps as bu, withHydrateFallbackProps as bv, WithErrorBoundaryProps as bw, withErrorBoundaryProps as bx, type RouteManifest as by, type ServerRouteModule as bz, RouterContextProvider as c, type LoaderFunction as d, type RouterInit as e, type RouterProviderProps as f, type LinkDescriptor as g, type Pretty as h, type MetaDescriptor as i, type ServerDataFunctionArgs as j, type MiddlewareNextFunction as k, type ClientDataFunctionArgs as l, type ServerDataFrom as m, type GetActionData as n, type Router$1 as o, type RouteModules as p, type DataStrategyFunction as q, type NavigateOptions as r, type Blocker as s, type SerializeFrom as t, type unstable_ClientOnErrorFunction as u, type RelativeRoutingType as v, type ParamParseKey as w, type Path as x, type PathPattern as y, type PathMatch as z };
|