react-router 7.0.0-pre.2 → 7.0.0-pre.3

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/chunk-3AAHPOYG.mjs +9617 -0
  3. package/dist/dom-export.d.mts +13 -0
  4. package/dist/dom-export.d.ts +13 -3
  5. package/dist/dom-export.js +5502 -0
  6. package/dist/dom-export.mjs +112 -126
  7. package/dist/{lib/dom/lib.d.ts → fog-of-war-BijhfqFM.d.ts} +699 -45
  8. package/dist/fog-of-war-Bz_EDtxF.d.mts +1595 -0
  9. package/dist/index.d.mts +839 -0
  10. package/dist/index.d.ts +839 -73
  11. package/dist/index.js +9763 -0
  12. package/dist/index.mjs +225 -12689
  13. package/dist/lib/types.d.mts +2 -0
  14. package/dist/lib/types.d.ts +2 -83
  15. package/dist/lib/types.js +28 -0
  16. package/dist/lib/types.mjs +1 -1
  17. package/dist/types-BlYP8xpH.d.mts +1620 -0
  18. package/dist/types-BlYP8xpH.d.ts +1620 -0
  19. package/package.json +52 -12
  20. package/dist/dom-export.mjs.map +0 -1
  21. package/dist/index.mjs.map +0 -1
  22. package/dist/lib/components.d.ts +0 -372
  23. package/dist/lib/context.d.ts +0 -115
  24. package/dist/lib/dom/dom.d.ts +0 -123
  25. package/dist/lib/dom/global.d.ts +0 -40
  26. package/dist/lib/dom/server.d.ts +0 -41
  27. package/dist/lib/dom/ssr/components.d.ts +0 -122
  28. package/dist/lib/dom/ssr/data.d.ts +0 -2
  29. package/dist/lib/dom/ssr/entry.d.ts +0 -48
  30. package/dist/lib/dom/ssr/errorBoundaries.d.ts +0 -36
  31. package/dist/lib/dom/ssr/errors.d.ts +0 -2
  32. package/dist/lib/dom/ssr/fallback.d.ts +0 -2
  33. package/dist/lib/dom/ssr/fog-of-war.d.ts +0 -28
  34. package/dist/lib/dom/ssr/invariant.d.ts +0 -2
  35. package/dist/lib/dom/ssr/links.d.ts +0 -25
  36. package/dist/lib/dom/ssr/markup.d.ts +0 -5
  37. package/dist/lib/dom/ssr/routeModules.d.ts +0 -183
  38. package/dist/lib/dom/ssr/routes-test-stub.d.ts +0 -59
  39. package/dist/lib/dom/ssr/routes.d.ts +0 -29
  40. package/dist/lib/dom/ssr/server.d.ts +0 -16
  41. package/dist/lib/dom/ssr/single-fetch.d.ts +0 -37
  42. package/dist/lib/dom-export/dom-router-provider.d.ts +0 -5
  43. package/dist/lib/dom-export/hydrated-router.d.ts +0 -5
  44. package/dist/lib/dom-export.d.ts +0 -3
  45. package/dist/lib/hooks.d.ts +0 -411
  46. package/dist/lib/router/history.d.ts +0 -253
  47. package/dist/lib/router/links.d.ts +0 -104
  48. package/dist/lib/router/router.d.ts +0 -544
  49. package/dist/lib/router/utils.d.ts +0 -497
  50. package/dist/lib/server-runtime/build.d.ts +0 -38
  51. package/dist/lib/server-runtime/cookies.d.ts +0 -62
  52. package/dist/lib/server-runtime/crypto.d.ts +0 -2
  53. package/dist/lib/server-runtime/data.d.ts +0 -11
  54. package/dist/lib/server-runtime/dev.d.ts +0 -8
  55. package/dist/lib/server-runtime/entry.d.ts +0 -3
  56. package/dist/lib/server-runtime/errors.d.ts +0 -51
  57. package/dist/lib/server-runtime/headers.d.ts +0 -3
  58. package/dist/lib/server-runtime/invariant.d.ts +0 -2
  59. package/dist/lib/server-runtime/markup.d.ts +0 -1
  60. package/dist/lib/server-runtime/mode.d.ts +0 -9
  61. package/dist/lib/server-runtime/routeMatching.d.ts +0 -8
  62. package/dist/lib/server-runtime/routeModules.d.ts +0 -40
  63. package/dist/lib/server-runtime/routes.d.ts +0 -11
  64. package/dist/lib/server-runtime/server.d.ts +0 -5
  65. package/dist/lib/server-runtime/serverHandoff.d.ts +0 -11
  66. package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +0 -19
  67. package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +0 -17
  68. package/dist/lib/server-runtime/sessions.d.ts +0 -140
  69. package/dist/lib/server-runtime/single-fetch.d.ts +0 -30
  70. package/dist/lib/server-runtime/typecheck.d.ts +0 -4
  71. package/dist/lib/server-runtime/warnings.d.ts +0 -1
  72. package/dist/main-dom-export.js +0 -19
  73. package/dist/main.js +0 -19
  74. package/dist/react-router-dom.development.js +0 -199
  75. package/dist/react-router-dom.development.js.map +0 -1
  76. package/dist/react-router-dom.production.min.js +0 -12
  77. package/dist/react-router-dom.production.min.js.map +0 -1
  78. package/dist/react-router.development.js +0 -12528
  79. package/dist/react-router.development.js.map +0 -1
  80. package/dist/react-router.production.min.js +0 -12
  81. package/dist/react-router.production.min.js.map +0 -1
  82. package/dist/umd/react-router-dom.development.js +0 -241
  83. package/dist/umd/react-router-dom.development.js.map +0 -1
  84. package/dist/umd/react-router-dom.production.min.js +0 -12
  85. package/dist/umd/react-router-dom.production.min.js.map +0 -1
  86. package/dist/umd/react-router.development.js +0 -12834
  87. package/dist/umd/react-router.development.js.map +0 -1
  88. package/dist/umd/react-router.production.min.js +0 -12
  89. package/dist/umd/react-router.production.min.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,73 +1,839 @@
1
- export type { InitialEntry, Location, Path, To } from "./lib/router/history";
2
- export type { HydrationState, StaticHandler, GetScrollPositionFunction, GetScrollRestorationKeyFunction, StaticHandlerContext, Fetcher, Navigation, NavigationStates, RelativeRoutingType, Blocker, BlockerFunction, Router as DataRouter, RouterState, RouterInit, RouterSubscriber, RouterNavigateOptions, RouterFetchOptions, RevalidationState, } from "./lib/router/router";
3
- export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, } from "./lib/router/utils";
4
- export { Action as NavigationType, createPath, parsePath, } from "./lib/router/history";
5
- export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router";
6
- export { data, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils";
7
- export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context";
8
- export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components";
9
- export type { NavigateFunction } from "./lib/hooks";
10
- export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, } from "./lib/components";
11
- export { useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "./lib/hooks";
12
- export type { BrowserRouterProps, HashRouterProps, HistoryRouterProps, LinkProps, NavLinkProps, NavLinkRenderProps, FetcherFormProps, FormProps, ScrollRestorationProps, SetURLSearchParams, SubmitFunction, FetcherSubmitFunction, FetcherWithComponents, } from "./lib/dom/lib";
13
- export { createBrowserRouter, createHashRouter, BrowserRouter, HashRouter, Link, HistoryRouter as unstable_HistoryRouter, NavLink, Form, ScrollRestoration, useLinkClickHandler, useSearchParams, useSubmit, useFormAction, useFetcher, useFetchers, useBeforeUnload, usePrompt as unstable_usePrompt, useViewTransitionState, } from "./lib/dom/lib";
14
- export type { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, SubmitTarget, } from "./lib/dom/dom";
15
- export { createSearchParams } from "./lib/dom/dom";
16
- export type { StaticRouterProps, StaticRouterProviderProps, } from "./lib/dom/server";
17
- export { createStaticHandler, createStaticRouter, StaticRouter, StaticRouterProvider, } from "./lib/dom/server";
18
- export { Meta, Links, Scripts, PrefetchPageLinks, } from "./lib/dom/ssr/components";
19
- export type { ScriptsProps } from "./lib/dom/ssr/components";
20
- export type { EntryContext } from "./lib/dom/ssr/entry";
21
- export type { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, MetaArgs, MetaDescriptor, MetaFunction, LinksFunction, } from "./lib/dom/ssr/routeModules";
22
- export type { ServerRouterProps } from "./lib/dom/ssr/server";
23
- export { ServerRouter } from "./lib/dom/ssr/server";
24
- export type { RoutesTestStubProps } from "./lib/dom/ssr/routes-test-stub";
25
- export { createRoutesStub } from "./lib/dom/ssr/routes-test-stub";
26
- export { createCookie, isCookie } from "./lib/server-runtime/cookies";
27
- export { createRequestHandler } from "./lib/server-runtime/server";
28
- export { createSession, createSessionStorage, isSession, } from "./lib/server-runtime/sessions";
29
- export { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookieStorage";
30
- export { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage";
31
- export { setDevServerHooks as unstable_setDevServerHooks } from "./lib/server-runtime/dev";
32
- export type { IsCookieFunction } from "./lib/server-runtime/cookies";
33
- export type { CreateRequestHandlerFunction } from "./lib/server-runtime/server";
34
- export type { IsSessionFunction } from "./lib/server-runtime/sessions";
35
- export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./lib/server-runtime/build";
36
- export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies";
37
- export type { AppLoadContext } from "./lib/server-runtime/data";
38
- export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links";
39
- export type { HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
40
- export type { RequestHandler } from "./lib/server-runtime/server";
41
- export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions";
42
- /** @internal */
43
- export { createBrowserHistory as UNSAFE_createBrowserHistory, invariant as UNSAFE_invariant, } from "./lib/router/history";
44
- /** @internal */
45
- export { createRouter as UNSAFE_createRouter } from "./lib/router/router";
46
- /** @internal */
47
- export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils";
48
- /** @internal */
49
- export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, FetchersContext as UNSAFE_FetchersContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, } from "./lib/context";
50
- /** @internal */
51
- export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components";
52
- /** @internal */
53
- export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components";
54
- /** @internal */
55
- export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry";
56
- /** @internal */
57
- export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors";
58
- /** @internal */
59
- export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries";
60
- /** @internal */
61
- export { getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, } from "./lib/dom/ssr/fog-of-war";
62
- /** @internal */
63
- export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules";
64
- /** @internal */
65
- export { createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, } from "./lib/dom/ssr/routes";
66
- /** @internal */
67
- export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch";
68
- /** @internal */
69
- export { decodeViaTurboStream as UNSAFE_decodeViaTurboStream, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, } from "./lib/dom/ssr/single-fetch";
70
- /** @internal */
71
- export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode";
72
- /** @internal */
73
- export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib";
1
+ import { R as RouteModules, a as Router, D as DataStrategyFunction, A as ActionFunction, L as LoaderFunction, C as ClientActionFunction, b as ClientLoaderFunction, c as LinksFunction, M as MetaFunction, d as RouteManifest, e as AppLoadContext$1, f as LoaderFunctionArgs, g as ActionFunctionArgs, T as To, h as RelativeRoutingType, i as Location, j as Action, P as ParamParseKey, k as Path, l as PathPattern, m as PathMatch, N as NavigateOptions, n as Params, o as RouteObject, p as Navigation, q as RevalidationState, U as UIMatch, S as SerializeFrom, B as BlockerFunction, r as Blocker, s as StaticHandlerContext, t as StaticHandler, F as FutureConfig$1, u as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, v as IndexRouteObject, w as NonIndexRouteObject, x as RouterState } from './types-BlYP8xpH.js';
2
+ export { aq as ClientActionFunctionArgs, ar as ClientLoaderFunctionArgs, ak as DataRouteMatch, al as DataRouteObject, V as DataStrategyFunctionArgs, W as DataStrategyMatch, X as DataStrategyResult, Z as ErrorResponse, z as Fetcher, _ as FormEncType, $ as FormMethod, G as GetScrollPositionFunction, y as GetScrollRestorationKeyFunction, a0 as HTMLFormMethod, av as HtmlLinkDescriptor, aa as IDLE_BLOCKER, a9 as IDLE_FETCHER, a8 as IDLE_NAVIGATION, a1 as LazyRouteFunction, aw as LinkDescriptor, as as MetaArgs, at as MetaDescriptor, E as NavigationStates, am as Navigator, au as PageLinkDescriptor, an as PatchRoutesOnNavigationFunction, ao as PatchRoutesOnNavigationFunctionArgs, a2 as PathParam, a3 as RedirectFunction, ap as RouteMatch, Q as RouterFetchOptions, J as RouterInit, O as RouterNavigateOptions, K as RouterSubscriber, a4 as ShouldRevalidateFunction, a5 as ShouldRevalidateFunctionArgs, aB as UNSAFE_DataRouterContext, aC as UNSAFE_DataRouterStateContext, Y as UNSAFE_DataWithResponseInit, aA as UNSAFE_ErrorResponseImpl, aD as UNSAFE_FetchersContext, aE as UNSAFE_LocationContext, aF as UNSAFE_NavigationContext, aG as UNSAFE_RouteContext, aH as UNSAFE_ViewTransitionContext, ax as UNSAFE_createBrowserHistory, az as UNSAFE_createRouter, ay as UNSAFE_invariant, a6 as createPath, ab as data, ac as generatePath, ad as isRouteErrorResponse, ae as matchPath, af as matchRoutes, a7 as parsePath, ag as redirect, ah as redirectDocument, ai as replace, aj as resolvePath } from './types-BlYP8xpH.js';
3
+ import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-BijhfqFM.js';
4
+ export { f as Await, b as AwaitProps, G as BrowserRouter, B as BrowserRouterProps, u as FetcherFormProps, y as FetcherSubmitFunction, a3 as FetcherSubmitOptions, z as FetcherWithComponents, U as Form, v as FormProps, J as HashRouter, H as HashRouterProps, p as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, K as Link, q as LinkProps, aa as Links, g as MemoryRouter, M as MemoryRouterProps, a9 as Meta, T as NavLink, s as NavLinkProps, t as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a4 as ParamKeyValuePair, P as PathRouteProps, ac 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, ab as Scripts, ad as ScriptsProps, V as ScrollRestoration, S as ScrollRestorationProps, w as SetURLSearchParams, x as SubmitFunction, a5 as SubmitOptions, a7 as SubmitTarget, af as UNSAFE_FrameworkContext, ai as UNSAFE_createClientRoutes, aj as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ag as UNSAFE_getPatchRoutesOnNavigationFunction, ae as UNSAFE_mapRouteProperties, ak as UNSAFE_shouldHydrateRouteLoader, ah as UNSAFE_useFogOFWarDiscovery, al as UNSAFE_useScrollRestoration, a6 as URLSearchParamsInit, C as createBrowserRouter, D as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, o as createRoutesFromElements, a8 as createSearchParams, r as renderMatches, Q as unstable_HistoryRouter, a1 as unstable_usePrompt, a0 as useBeforeUnload, _ as useFetcher, $ as useFetchers, Z as useFormAction, W as useLinkClickHandler, X as useSearchParams, Y as useSubmit, a2 as useViewTransitionState } from './fog-of-war-BijhfqFM.js';
5
+ import * as React from 'react';
6
+ import { ReactElement } from 'react';
7
+ import { ParseOptions, SerializeOptions } from 'cookie';
8
+ export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
9
+
10
+ declare const SingleFetchRedirectSymbol: unique symbol;
11
+ declare function getSingleFetchDataStrategy(manifest: AssetsManifest, routeModules: RouteModules, getRouter: () => Router): DataStrategyFunction;
12
+ declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
13
+ done: Promise<undefined>;
14
+ value: unknown;
15
+ }>;
16
+
17
+ /**
18
+ * The mode to use when running the server.
19
+ */
20
+ declare enum ServerMode {
21
+ Development = "development",
22
+ Production = "production",
23
+ Test = "test"
24
+ }
25
+
26
+ type HeadersArgs = {
27
+ loaderHeaders: Headers;
28
+ parentHeaders: Headers;
29
+ actionHeaders: Headers;
30
+ errorHeaders: Headers | undefined;
31
+ };
32
+ /**
33
+ * A function that returns HTTP headers to be used for a route. These headers
34
+ * will be merged with (and take precedence over) headers from parent routes.
35
+ */
36
+ interface HeadersFunction {
37
+ (args: HeadersArgs): Headers | HeadersInit;
38
+ }
39
+ /**
40
+ * An arbitrary object that is associated with a route.
41
+ */
42
+ type RouteHandle = unknown;
43
+ interface EntryRouteModule {
44
+ clientAction?: ClientActionFunction;
45
+ clientLoader?: ClientLoaderFunction;
46
+ ErrorBoundary?: any;
47
+ HydrateFallback?: any;
48
+ Layout?: any;
49
+ default: any;
50
+ handle?: RouteHandle;
51
+ links?: LinksFunction;
52
+ meta?: MetaFunction;
53
+ }
54
+ interface ServerRouteModule extends EntryRouteModule {
55
+ action?: ActionFunction;
56
+ headers?: HeadersFunction | {
57
+ [name: string]: string;
58
+ };
59
+ loader?: LoaderFunction;
60
+ }
61
+
62
+ type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
63
+ interface ServerRoute extends Route {
64
+ children: ServerRoute[];
65
+ module: ServerRouteModule;
66
+ }
67
+
68
+ /**
69
+ * The output of the compiler for the server build.
70
+ */
71
+ interface ServerBuild {
72
+ entry: {
73
+ module: ServerEntryModule;
74
+ };
75
+ routes: ServerRouteManifest;
76
+ assets: AssetsManifest;
77
+ basename?: string;
78
+ publicPath: string;
79
+ assetsBuildDirectory: string;
80
+ future: FutureConfig;
81
+ isSpaMode: boolean;
82
+ }
83
+ interface HandleDocumentRequestFunction {
84
+ (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: AppLoadContext$1): Promise<Response> | Response;
85
+ }
86
+ interface HandleDataRequestFunction {
87
+ (response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
88
+ }
89
+ interface HandleErrorFunction {
90
+ (error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
91
+ }
92
+ /**
93
+ * A module that serves as the entry point for a Remix app during server
94
+ * rendering.
95
+ */
96
+ interface ServerEntryModule {
97
+ default: HandleDocumentRequestFunction;
98
+ handleDataRequest?: HandleDataRequestFunction;
99
+ handleError?: HandleErrorFunction;
100
+ streamTimeout?: number;
101
+ }
102
+
103
+ /**
104
+ Resolves a URL against the current location.
105
+
106
+ ```tsx
107
+ import { useHref } from "react-router"
108
+
109
+ function SomeComponent() {
110
+ let href = useHref("some/where");
111
+ // "/resolved/some/where"
112
+ }
113
+ ```
114
+
115
+ @category Hooks
116
+ */
117
+ declare function useHref(to: To, { relative }?: {
118
+ relative?: RelativeRoutingType;
119
+ }): string;
120
+ /**
121
+ * Returns true if this component is a descendant of a Router, useful to ensure
122
+ * a component is used within a Router.
123
+ *
124
+ * @category Hooks
125
+ */
126
+ declare function useInRouterContext(): boolean;
127
+ /**
128
+ Returns the current {@link Location}. This can be useful if you'd like to perform some side effect whenever it changes.
129
+
130
+ ```tsx
131
+ import * as React from 'react'
132
+ import { useLocation } from 'react-router'
133
+
134
+ function SomeComponent() {
135
+ let location = useLocation()
136
+
137
+ React.useEffect(() => {
138
+ // Google Analytics
139
+ ga('send', 'pageview')
140
+ }, [location]);
141
+
142
+ return (
143
+ // ...
144
+ );
145
+ }
146
+ ```
147
+
148
+ @category Hooks
149
+ */
150
+ declare function useLocation(): Location;
151
+ /**
152
+ * Returns the current navigation action which describes how the router came to
153
+ * the current location, either by a pop, push, or replace on the history stack.
154
+ *
155
+ * @category Hooks
156
+ */
157
+ declare function useNavigationType(): Action;
158
+ /**
159
+ * Returns a PathMatch object if the given pattern matches the current URL.
160
+ * This is useful for components that need to know "active" state, e.g.
161
+ * `<NavLink>`.
162
+ *
163
+ * @category Hooks
164
+ */
165
+ declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
166
+ /**
167
+ * The interface for the navigate() function returned from useNavigate().
168
+ */
169
+ interface NavigateFunction {
170
+ (to: To, options?: NavigateOptions): void | Promise<void>;
171
+ (delta: number): void | Promise<void>;
172
+ }
173
+ /**
174
+ Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
175
+
176
+ ```tsx
177
+ import { useNavigate } from "react-router";
178
+
179
+ function SomeComponent() {
180
+ let navigate = useNavigate();
181
+ return (
182
+ <button
183
+ onClick={() => {
184
+ navigate(-1);
185
+ }}
186
+ />
187
+ );
188
+ }
189
+ ```
190
+
191
+ It's often better to use {@link redirect} in {@link ActionFunction | actions} and {@link LoaderFunction | loaders} than this hook.
192
+
193
+ @category Hooks
194
+ */
195
+ declare function useNavigate(): NavigateFunction;
196
+ /**
197
+ * Returns the parent route {@link OutletProps.context | `<Outlet context>`}.
198
+ *
199
+ * @category Hooks
200
+ */
201
+ declare function useOutletContext<Context = unknown>(): Context;
202
+ /**
203
+ * Returns the element for the child route at this level of the route
204
+ * hierarchy. Used internally by `<Outlet>` to render child routes.
205
+ *
206
+ * @category Hooks
207
+ */
208
+ declare function useOutlet(context?: unknown): React.ReactElement | null;
209
+ /**
210
+ Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
211
+
212
+ ```tsx
213
+ import { useParams } from "react-router"
214
+
215
+ function SomeComponent() {
216
+ let params = useParams()
217
+ params.postId
218
+ }
219
+ ```
220
+
221
+ Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
222
+
223
+ @category Hooks
224
+ */
225
+ declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
226
+ ParamsOrKey
227
+ ] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
228
+ /**
229
+ Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
230
+
231
+ ```tsx
232
+ import { useResolvedPath } from "react-router"
233
+
234
+ function SomeComponent() {
235
+ // if the user is at /dashboard/profile
236
+ let path = useResolvedPath("../accounts")
237
+ path.pathname // "/dashboard/accounts"
238
+ path.search // ""
239
+ path.hash // ""
240
+ }
241
+ ```
242
+
243
+ @category Hooks
244
+ */
245
+ declare function useResolvedPath(to: To, { relative }?: {
246
+ relative?: RelativeRoutingType;
247
+ }): Path;
248
+ /**
249
+ Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props.
250
+
251
+ The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
252
+
253
+ ```tsx
254
+ import * as React from "react";
255
+ import { useRoutes } from "react-router";
256
+
257
+ function App() {
258
+ let element = useRoutes([
259
+ {
260
+ path: "/",
261
+ element: <Dashboard />,
262
+ children: [
263
+ {
264
+ path: "messages",
265
+ element: <DashboardMessages />,
266
+ },
267
+ { path: "tasks", element: <DashboardTasks /> },
268
+ ],
269
+ },
270
+ { path: "team", element: <AboutPage /> },
271
+ ]);
272
+
273
+ return element;
274
+ }
275
+ ```
276
+
277
+ @category Hooks
278
+ */
279
+ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
280
+ /**
281
+ Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress. You can use this to render pending UI (like a global spinner) or read FormData from a form navigation.
282
+
283
+ ```tsx
284
+ import { useNavigation } from "react-router"
285
+
286
+ function SomeComponent() {
287
+ let navigation = useNavigation();
288
+ navigation.state
289
+ navigation.formData
290
+ // etc.
291
+ }
292
+ ```
293
+
294
+ @category Hooks
295
+ */
296
+ declare function useNavigation(): Navigation;
297
+ /**
298
+ Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.
299
+
300
+ ```tsx
301
+ import { useRevalidator } from "react-router";
302
+
303
+ function WindowFocusRevalidator() {
304
+ const revalidator = useRevalidator();
305
+
306
+ useFakeWindowFocus(() => {
307
+ revalidator.revalidate();
308
+ });
309
+
310
+ return (
311
+ <div hidden={revalidator.state === "idle"}>
312
+ Revalidating...
313
+ </div>
314
+ );
315
+ }
316
+ ```
317
+
318
+ Note that page data is already revalidated automatically after actions. If you find yourself using this for normal CRUD operations on your data in response to user interactions, you're probably not taking advantage of the other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do this automatically.
319
+
320
+ @category Hooks
321
+ */
322
+ declare function useRevalidator(): {
323
+ revalidate(): Promise<void>;
324
+ state: RevalidationState;
325
+ };
326
+ /**
327
+ * Returns the active route matches, useful for accessing loaderData for
328
+ * parent/child routes or the route "handle" property
329
+ *
330
+ * @category Hooks
331
+ */
332
+ declare function useMatches(): UIMatch[];
333
+ /**
334
+ Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}.
335
+
336
+ ```tsx
337
+ import { useLoaderData } from "react-router"
338
+
339
+ export async function loader() {
340
+ return await fakeDb.invoices.findAll();
341
+ }
342
+
343
+ export default function Invoices() {
344
+ let invoices = useLoaderData<typeof loader>();
345
+ // ...
346
+ }
347
+ ```
348
+
349
+ @category Hooks
350
+ */
351
+ declare function useLoaderData<T = any>(): SerializeFrom<T>;
352
+ /**
353
+ Returns the loader data for a given route by route ID.
354
+
355
+ ```tsx
356
+ import { useRouteLoaderData } from "react-router";
357
+
358
+ function SomeComponent() {
359
+ const { user } = useRouteLoaderData("root");
360
+ }
361
+ ```
362
+
363
+ Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension.
364
+
365
+ | Route Filename | Route ID |
366
+ | -------------------------- | -------------------- |
367
+ | `app/root.tsx` | `"root"` |
368
+ | `app/routes/teams.tsx` | `"routes/teams"` |
369
+ | `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` |
370
+
371
+ If you created an ID manually, you can use that instead:
372
+
373
+ ```tsx
374
+ route("/", "containers/app.tsx", { id: "app" }})
375
+ ```
376
+
377
+ @category Hooks
378
+ */
379
+ declare function useRouteLoaderData<T = any>(routeId: string): SerializeFrom<T> | undefined;
380
+ /**
381
+ Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one.
382
+
383
+ ```tsx
384
+ import { Form, useActionData } from "react-router"
385
+
386
+ export async function action({ request }) {
387
+ const body = await request.formData()
388
+ const name = body.get("visitorsName")
389
+ return { message: `Hello, ${name}` }
390
+ }
391
+
392
+ export default function Invoices() {
393
+ const data = useActionData()
394
+ return (
395
+ <Form method="post">
396
+ <input type="text" name="visitorsName" />
397
+ {data ? data.message : "Waiting..."}
398
+ </Form>
399
+ )
400
+ }
401
+ ```
402
+
403
+ @category Hooks
404
+ */
405
+ declare function useActionData<T = any>(): SerializeFrom<T> | undefined;
406
+ /**
407
+ Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary.
408
+
409
+ ```tsx
410
+ export function ErrorBoundary() {
411
+ const error = useRouteError();
412
+ return <div>{error.message}</div>;
413
+ }
414
+ ```
415
+
416
+ @category Hooks
417
+ */
418
+ declare function useRouteError(): unknown;
419
+ /**
420
+ Returns the resolved promise value from the closest {@link Await | `<Await>`}.
421
+
422
+ ```tsx
423
+ function SomeDescendant() {
424
+ const value = useAsyncValue();
425
+ // ...
426
+ }
427
+
428
+ // somewhere in your app
429
+ <Await resolve={somePromise}>
430
+ <SomeDescendant />
431
+ </Await>
432
+ ```
433
+
434
+ @category Hooks
435
+ */
436
+ declare function useAsyncValue(): unknown;
437
+ /**
438
+ Returns the rejection value from the closest {@link Await | `<Await>`}.
439
+
440
+ ```tsx
441
+ import { Await, useAsyncError } from "react-router"
442
+
443
+ function ErrorElement() {
444
+ const error = useAsyncError();
445
+ return (
446
+ <p>Uh Oh, something went wrong! {error.message}</p>
447
+ );
448
+ }
449
+
450
+ // somewhere in your app
451
+ <Await
452
+ resolve={promiseThatRejects}
453
+ errorElement={<ErrorElement />}
454
+ />
455
+ ```
456
+
457
+ @category Hooks
458
+ */
459
+ declare function useAsyncError(): unknown;
460
+ /**
461
+ * Allow the application to block navigations within the SPA and present the
462
+ * user a confirmation dialog to confirm the navigation. Mostly used to avoid
463
+ * using half-filled form data. This does not handle hard-reloads or
464
+ * cross-origin navigations.
465
+ *
466
+ * @category Hooks
467
+ */
468
+ declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
469
+
470
+ interface StaticRouterProps {
471
+ basename?: string;
472
+ children?: React.ReactNode;
473
+ location: Partial<Location> | string;
474
+ }
475
+ /**
476
+ * A `<Router>` that may not navigate to any other location. This is useful
477
+ * on the server where there is no stateful UI.
478
+ *
479
+ * @category Router Components
480
+ */
481
+ declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
482
+ interface StaticRouterProviderProps {
483
+ context: StaticHandlerContext;
484
+ router: Router;
485
+ hydrate?: boolean;
486
+ nonce?: string;
487
+ }
488
+ /**
489
+ * A Data Router that may not navigate to any other location. This is useful
490
+ * on the server where there is no stateful UI.
491
+ *
492
+ * @category Router Components
493
+ */
494
+ declare function StaticRouterProvider({ context, router, hydrate, nonce, }: StaticRouterProviderProps): React.JSX.Element;
495
+ type CreateStaticHandlerOptions = Omit<CreateStaticHandlerOptions$1, "mapRouteProperties">;
496
+ /**
497
+ * @category Utils
498
+ */
499
+ declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
500
+ /**
501
+ * @category Routers
502
+ */
503
+ declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
504
+ future?: Partial<FutureConfig$1>;
505
+ }): Router;
506
+
507
+ interface ServerRouterProps {
508
+ context: EntryContext;
509
+ url: string | URL;
510
+ abortDelay?: number;
511
+ nonce?: string;
512
+ }
513
+ /**
514
+ * The entry point for a Remix app when it is rendered on the server (in
515
+ * `app/entry.server.js`). This component is used to generate the HTML in the
516
+ * response from the server.
517
+ *
518
+ * @category Components
519
+ */
520
+ declare function ServerRouter({ context, url, abortDelay, nonce, }: ServerRouterProps): ReactElement;
521
+
522
+ interface StubIndexRouteObject extends Omit<IndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
523
+ loader?: LoaderFunction;
524
+ action?: ActionFunction;
525
+ children?: StubRouteObject[];
526
+ meta?: MetaFunction;
527
+ links?: LinksFunction;
528
+ }
529
+ interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
530
+ loader?: LoaderFunction;
531
+ action?: ActionFunction;
532
+ children?: StubRouteObject[];
533
+ meta?: MetaFunction;
534
+ links?: LinksFunction;
535
+ }
536
+ type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
537
+ interface AppLoadContext {
538
+ [key: string]: unknown;
539
+ }
540
+ interface RoutesTestStubProps {
541
+ /**
542
+ * The initial entries in the history stack. This allows you to start a test with
543
+ * multiple locations already in the history stack (for testing a back navigation, etc.)
544
+ * The test will default to the last entry in initialEntries if no initialIndex is provided.
545
+ * e.g. initialEntries={["/home", "/about", "/contact"]}
546
+ */
547
+ initialEntries?: InitialEntry[];
548
+ /**
549
+ * The initial index in the history stack to render. This allows you to start a test at a specific entry.
550
+ * It defaults to the last entry in initialEntries.
551
+ * e.g.
552
+ * initialEntries: ["/", "/events/123"]
553
+ * initialIndex: 1 // start at "/events/123"
554
+ */
555
+ initialIndex?: number;
556
+ /**
557
+ * Used to set the route's initial loader and action data.
558
+ * e.g. hydrationData={{
559
+ * loaderData: { "/contact": { locale: "en-US" } },
560
+ * actionData: { "/login": { errors: { email: "invalid email" } }}
561
+ * }}
562
+ */
563
+ hydrationData?: HydrationState;
564
+ /**
565
+ * Future flags mimicking the settings in remix.config.js
566
+ */
567
+ future?: Partial<FutureConfig>;
568
+ }
569
+ /**
570
+ * @category Utils
571
+ */
572
+ declare function createRoutesStub(routes: StubRouteObject[], context?: AppLoadContext): ({ initialEntries, initialIndex, hydrationData, future, }: RoutesTestStubProps) => React.JSX.Element;
573
+
574
+ interface CookieSignatureOptions {
575
+ /**
576
+ * An array of secrets that may be used to sign/unsign the value of a cookie.
577
+ *
578
+ * The array makes it easy to rotate secrets. New secrets should be added to
579
+ * the beginning of the array. `cookie.serialize()` will always use the first
580
+ * value in the array, but `cookie.parse()` may use any of them so that
581
+ * cookies that were signed with older secrets still work.
582
+ */
583
+ secrets?: string[];
584
+ }
585
+ type CookieOptions = ParseOptions & SerializeOptions & CookieSignatureOptions;
586
+ /**
587
+ * A HTTP cookie.
588
+ *
589
+ * A Cookie is a logical container for metadata about a HTTP cookie; its name
590
+ * and options. But it doesn't contain a value. Instead, it has `parse()` and
591
+ * `serialize()` methods that allow a single instance to be reused for
592
+ * parsing/encoding multiple different values.
593
+ *
594
+ * @see https://remix.run/utils/cookies#cookie-api
595
+ */
596
+ interface Cookie {
597
+ /**
598
+ * The name of the cookie, used in the `Cookie` and `Set-Cookie` headers.
599
+ */
600
+ readonly name: string;
601
+ /**
602
+ * True if this cookie uses one or more secrets for verification.
603
+ */
604
+ readonly isSigned: boolean;
605
+ /**
606
+ * The Date this cookie expires.
607
+ *
608
+ * Note: This is calculated at access time using `maxAge` when no `expires`
609
+ * option is provided to `createCookie()`.
610
+ */
611
+ readonly expires?: Date;
612
+ /**
613
+ * Parses a raw `Cookie` header and returns the value of this cookie or
614
+ * `null` if it's not present.
615
+ */
616
+ parse(cookieHeader: string | null, options?: ParseOptions): Promise<any>;
617
+ /**
618
+ * Serializes the given value to a string and returns the `Set-Cookie`
619
+ * header.
620
+ */
621
+ serialize(value: any, options?: SerializeOptions): Promise<string>;
622
+ }
623
+ /**
624
+ * Creates a logical container for managing a browser cookie from the server.
625
+ */
626
+ declare const createCookie: (name: string, cookieOptions?: CookieOptions) => Cookie;
627
+ type IsCookieFunction = (object: any) => object is Cookie;
628
+ /**
629
+ * Returns true if an object is a Remix cookie container.
630
+ *
631
+ * @see https://remix.run/utils/cookies#iscookie
632
+ */
633
+ declare const isCookie: IsCookieFunction;
634
+
635
+ type RequestHandler = (request: Request, loadContext?: AppLoadContext$1) => Promise<Response>;
636
+ type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
637
+ declare const createRequestHandler: CreateRequestHandlerFunction;
638
+
639
+ /**
640
+ * An object of name/value pairs to be used in the session.
641
+ */
642
+ interface SessionData {
643
+ [name: string]: any;
644
+ }
645
+ /**
646
+ * Session persists data across HTTP requests.
647
+ *
648
+ * @see https://remix.run/utils/sessions#session-api
649
+ */
650
+ interface Session<Data = SessionData, FlashData = Data> {
651
+ /**
652
+ * A unique identifier for this session.
653
+ *
654
+ * Note: This will be the empty string for newly created sessions and
655
+ * sessions that are not backed by a database (i.e. cookie-based sessions).
656
+ */
657
+ readonly id: string;
658
+ /**
659
+ * The raw data contained in this session.
660
+ *
661
+ * This is useful mostly for SessionStorage internally to access the raw
662
+ * session data to persist.
663
+ */
664
+ readonly data: FlashSessionData<Data, FlashData>;
665
+ /**
666
+ * Returns `true` if the session has a value for the given `name`, `false`
667
+ * otherwise.
668
+ */
669
+ has(name: (keyof Data | keyof FlashData) & string): boolean;
670
+ /**
671
+ * Returns the value for the given `name` in this session.
672
+ */
673
+ get<Key extends (keyof Data | keyof FlashData) & string>(name: Key): (Key extends keyof Data ? Data[Key] : undefined) | (Key extends keyof FlashData ? FlashData[Key] : undefined) | undefined;
674
+ /**
675
+ * Sets a value in the session for the given `name`.
676
+ */
677
+ set<Key extends keyof Data & string>(name: Key, value: Data[Key]): void;
678
+ /**
679
+ * Sets a value in the session that is only valid until the next `get()`.
680
+ * This can be useful for temporary values, like error messages.
681
+ */
682
+ flash<Key extends keyof FlashData & string>(name: Key, value: FlashData[Key]): void;
683
+ /**
684
+ * Removes a value from the session.
685
+ */
686
+ unset(name: keyof Data & string): void;
687
+ }
688
+ type FlashSessionData<Data, FlashData> = Partial<Data & {
689
+ [Key in keyof FlashData as FlashDataKey<Key & string>]: FlashData[Key];
690
+ }>;
691
+ type FlashDataKey<Key extends string> = `__flash_${Key}__`;
692
+ type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?: Data, id?: string) => Session<Data, FlashData>;
693
+ /**
694
+ * Creates a new Session object.
695
+ *
696
+ * Note: This function is typically not invoked directly by application code.
697
+ * Instead, use a `SessionStorage` object's `getSession` method.
698
+ *
699
+ * @see https://remix.run/utils/sessions#createsession
700
+ */
701
+ declare const createSession: CreateSessionFunction;
702
+ type IsSessionFunction = (object: any) => object is Session;
703
+ /**
704
+ * Returns true if an object is a Remix session.
705
+ *
706
+ * @see https://remix.run/utils/sessions#issession
707
+ */
708
+ declare const isSession: IsSessionFunction;
709
+ /**
710
+ * SessionStorage stores session data between HTTP requests and knows how to
711
+ * parse and create cookies.
712
+ *
713
+ * A SessionStorage creates Session objects using a `Cookie` header as input.
714
+ * Then, later it generates the `Set-Cookie` header to be used in the response.
715
+ */
716
+ interface SessionStorage<Data = SessionData, FlashData = Data> {
717
+ /**
718
+ * Parses a Cookie header from a HTTP request and returns the associated
719
+ * Session. If there is no session associated with the cookie, this will
720
+ * return a new Session with no data.
721
+ */
722
+ getSession: (cookieHeader?: string | null, options?: ParseOptions) => Promise<Session<Data, FlashData>>;
723
+ /**
724
+ * Stores all data in the Session and returns the Set-Cookie header to be
725
+ * used in the HTTP response.
726
+ */
727
+ commitSession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
728
+ /**
729
+ * Deletes all data associated with the Session and returns the Set-Cookie
730
+ * header to be used in the HTTP response.
731
+ */
732
+ destroySession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
733
+ }
734
+ /**
735
+ * SessionIdStorageStrategy is designed to allow anyone to easily build their
736
+ * own SessionStorage using `createSessionStorage(strategy)`.
737
+ *
738
+ * This strategy describes a common scenario where the session id is stored in
739
+ * a cookie but the actual session data is stored elsewhere, usually in a
740
+ * database or on disk. A set of create, read, update, and delete operations
741
+ * are provided for managing the session data.
742
+ */
743
+ interface SessionIdStorageStrategy<Data = SessionData, FlashData = Data> {
744
+ /**
745
+ * The Cookie used to store the session id, or options used to automatically
746
+ * create one.
747
+ */
748
+ cookie?: Cookie | (CookieOptions & {
749
+ name?: string;
750
+ });
751
+ /**
752
+ * Creates a new record with the given data and returns the session id.
753
+ */
754
+ createData: (data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<string>;
755
+ /**
756
+ * Returns data for a given session id, or `null` if there isn't any.
757
+ */
758
+ readData: (id: string) => Promise<FlashSessionData<Data, FlashData> | null>;
759
+ /**
760
+ * Updates data for the given session id.
761
+ */
762
+ updateData: (id: string, data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<void>;
763
+ /**
764
+ * Deletes data for a given session id from the data store.
765
+ */
766
+ deleteData: (id: string) => Promise<void>;
767
+ }
768
+ /**
769
+ * Creates a SessionStorage object using a SessionIdStorageStrategy.
770
+ *
771
+ * Note: This is a low-level API that should only be used if none of the
772
+ * existing session storage options meet your requirements.
773
+ */
774
+ declare function createSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg, createData, readData, updateData, deleteData, }: SessionIdStorageStrategy<Data, FlashData>): SessionStorage<Data, FlashData>;
775
+
776
+ interface CookieSessionStorageOptions {
777
+ /**
778
+ * The Cookie used to store the session data on the client, or options used
779
+ * to automatically create one.
780
+ */
781
+ cookie?: SessionIdStorageStrategy["cookie"];
782
+ }
783
+ /**
784
+ * Creates and returns a SessionStorage object that stores all session data
785
+ * directly in the session cookie itself.
786
+ *
787
+ * This has the advantage that no database or other backend services are
788
+ * needed, and can help to simplify some load-balanced scenarios. However, it
789
+ * also has the limitation that serialized session data may not exceed the
790
+ * browser's maximum cookie size. Trade-offs!
791
+ */
792
+ declare function createCookieSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg }?: CookieSessionStorageOptions): SessionStorage<Data, FlashData>;
793
+
794
+ interface MemorySessionStorageOptions {
795
+ /**
796
+ * The Cookie used to store the session id on the client, or options used
797
+ * to automatically create one.
798
+ */
799
+ cookie?: SessionIdStorageStrategy["cookie"];
800
+ }
801
+ /**
802
+ * Creates and returns a simple in-memory SessionStorage object, mostly useful
803
+ * for testing and as a reference implementation.
804
+ *
805
+ * Note: This storage does not scale beyond a single process, so it is not
806
+ * suitable for most production scenarios.
807
+ */
808
+ declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({ cookie }?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
809
+
810
+ type DevServerHooks = {
811
+ getCriticalCss?: (build: ServerBuild, pathname: string) => Promise<string | undefined>;
812
+ processRequestError?: (error: unknown) => void;
813
+ };
814
+ declare function setDevServerHooks(devServerHooks: DevServerHooks): void;
815
+
816
+ declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];
817
+
818
+ type RemixErrorBoundaryProps = React.PropsWithChildren<{
819
+ location: Location;
820
+ isOutsideRemixApp?: boolean;
821
+ error?: Error;
822
+ }>;
823
+ type RemixErrorBoundaryState = {
824
+ error: null | Error;
825
+ location: Location;
826
+ };
827
+ declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps, RemixErrorBoundaryState> {
828
+ constructor(props: RemixErrorBoundaryProps);
829
+ static getDerivedStateFromError(error: Error): {
830
+ error: Error;
831
+ };
832
+ static getDerivedStateFromProps(props: RemixErrorBoundaryProps, state: RemixErrorBoundaryState): {
833
+ error: Error | null;
834
+ location: Location<any>;
835
+ };
836
+ render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
837
+ }
838
+
839
+ export { ActionFunction, ActionFunctionArgs, AppLoadContext$1 as AppLoadContext, Blocker, BlockerFunction, ClientActionFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, type HeadersArgs, type HeadersFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, isCookie, isSession, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };