react-router 7.0.0-pre.2 → 7.0.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chunk-FT3T2DDR.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
@@ -1,372 +0,0 @@
1
- import * as React from "react";
2
- import type { InitialEntry, Location, To } from "./router/history";
3
- import { Action as NavigationType } from "./router/history";
4
- import type { FutureConfig, HydrationState, RelativeRoutingType, Router as DataRouter } from "./router/router";
5
- import type { DataStrategyFunction, LazyRouteFunction } from "./router/utils";
6
- import type { IndexRouteObject, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, RouteMatch, RouteObject } from "./context";
7
- /**
8
- * @private
9
- */
10
- export declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
11
- hasErrorBoundary: boolean;
12
- };
13
- /**
14
- * @category Routers
15
- */
16
- export declare function createMemoryRouter(routes: RouteObject[], opts?: {
17
- basename?: string;
18
- future?: Partial<FutureConfig>;
19
- hydrationData?: HydrationState;
20
- initialEntries?: InitialEntry[];
21
- initialIndex?: number;
22
- dataStrategy?: DataStrategyFunction;
23
- patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
24
- }): DataRouter;
25
- export interface RouterProviderProps {
26
- router: DataRouter;
27
- flushSync?: (fn: () => unknown) => undefined;
28
- }
29
- /**
30
- * Given a Remix Router instance, render the appropriate UI
31
- */
32
- export declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement;
33
- /**
34
- * @category Types
35
- */
36
- export interface MemoryRouterProps {
37
- basename?: string;
38
- children?: React.ReactNode;
39
- initialEntries?: InitialEntry[];
40
- initialIndex?: number;
41
- }
42
- /**
43
- * A `<Router>` that stores all entries in memory.
44
- *
45
- * @category Router Components
46
- */
47
- export declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
48
- /**
49
- * @category Types
50
- */
51
- export interface NavigateProps {
52
- to: To;
53
- replace?: boolean;
54
- state?: any;
55
- relative?: RelativeRoutingType;
56
- }
57
- /**
58
- * A component-based version of {@link useNavigate} to use in a [`React.Component
59
- * Class`](https://reactjs.org/docs/react-component.html) where hooks are not
60
- * able to be used.
61
- *
62
- * It's recommended to avoid using this component in favor of {@link useNavigate}
63
- *
64
- * @category Components
65
- */
66
- export declare function Navigate({ to, replace, state, relative, }: NavigateProps): null;
67
- /**
68
- * @category Types
69
- */
70
- export interface OutletProps {
71
- /**
72
- Provides a context value to the element tree below the outlet. Use when the parent route needs to provide values to child routes.
73
-
74
- ```tsx
75
- <Outlet context={myContextValue} />
76
- ```
77
-
78
- Access the context with {@link useOutletContext}.
79
- */
80
- context?: unknown;
81
- }
82
- /**
83
- Renders the matching child route of a parent route or nothing if no child route matches.
84
-
85
- ```tsx
86
- import { Outlet } from "react-router"
87
-
88
- export default function SomeParent() {
89
- return (
90
- <div>
91
- <h1>Parent Content</h1>
92
- <Outlet />
93
- </div>
94
- );
95
- }
96
- ```
97
-
98
- @category Components
99
- */
100
- export declare function Outlet(props: OutletProps): React.ReactElement | null;
101
- /**
102
- * @category Types
103
- */
104
- export interface PathRouteProps {
105
- caseSensitive?: NonIndexRouteObject["caseSensitive"];
106
- path?: NonIndexRouteObject["path"];
107
- id?: NonIndexRouteObject["id"];
108
- lazy?: LazyRouteFunction<NonIndexRouteObject>;
109
- loader?: NonIndexRouteObject["loader"];
110
- action?: NonIndexRouteObject["action"];
111
- hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"];
112
- shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
113
- handle?: NonIndexRouteObject["handle"];
114
- index?: false;
115
- children?: React.ReactNode;
116
- element?: React.ReactNode | null;
117
- hydrateFallbackElement?: React.ReactNode | null;
118
- errorElement?: React.ReactNode | null;
119
- Component?: React.ComponentType | null;
120
- HydrateFallback?: React.ComponentType | null;
121
- ErrorBoundary?: React.ComponentType | null;
122
- }
123
- /**
124
- * @category Types
125
- */
126
- export interface LayoutRouteProps extends PathRouteProps {
127
- }
128
- /**
129
- * @category Types
130
- */
131
- export interface IndexRouteProps {
132
- caseSensitive?: IndexRouteObject["caseSensitive"];
133
- path?: IndexRouteObject["path"];
134
- id?: IndexRouteObject["id"];
135
- lazy?: LazyRouteFunction<IndexRouteObject>;
136
- loader?: IndexRouteObject["loader"];
137
- action?: IndexRouteObject["action"];
138
- hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"];
139
- shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
140
- handle?: IndexRouteObject["handle"];
141
- index: true;
142
- children?: undefined;
143
- element?: React.ReactNode | null;
144
- hydrateFallbackElement?: React.ReactNode | null;
145
- errorElement?: React.ReactNode | null;
146
- Component?: React.ComponentType | null;
147
- HydrateFallback?: React.ComponentType | null;
148
- ErrorBoundary?: React.ComponentType | null;
149
- }
150
- export type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
151
- /**
152
- * Configures an element to render when a pattern matches the current location.
153
- * It must be rendered within a {@link Routes} element. Note that these routes
154
- * do not participate in data loading, actions, code splitting, or any other
155
- * route module features.
156
- *
157
- * @category Components
158
- */
159
- export declare function Route(_props: RouteProps): React.ReactElement | null;
160
- /**
161
- * @category Types
162
- */
163
- export interface RouterProps {
164
- basename?: string;
165
- children?: React.ReactNode;
166
- location: Partial<Location> | string;
167
- navigationType?: NavigationType;
168
- navigator: Navigator;
169
- static?: boolean;
170
- }
171
- /**
172
- * Provides location context for the rest of the app.
173
- *
174
- * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
175
- * router that is more specific to your environment such as a `<BrowserRouter>`
176
- * in web browsers or a `<StaticRouter>` for server rendering.
177
- *
178
- * @category Components
179
- */
180
- export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
181
- /**
182
- * @category Types
183
- */
184
- export interface RoutesProps {
185
- /**
186
- * Nested {@link Route} elements
187
- */
188
- children?: React.ReactNode;
189
- /**
190
- * The location to match against. Defaults to the current location.
191
- */
192
- location?: Partial<Location> | string;
193
- }
194
- /**
195
- Renders a branch of {@link Route | `<Routes>`} that best matches the current
196
- location. Note that these routes do not participate in data loading, actions,
197
- code splitting, or any other route module features.
198
-
199
- ```tsx
200
- import { Routes, Route } from "react-router"
201
-
202
- <Routes>
203
- <Route index element={<StepOne />} />
204
- <Route path="step-2" element={<StepTwo />} />
205
- <Route path="step-3" element={<StepThree />}>
206
- </Routes>
207
- ```
208
-
209
- @category Components
210
- */
211
- export declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null;
212
- export interface AwaitResolveRenderFunction<Resolve = any> {
213
- (data: Awaited<Resolve>): React.ReactNode;
214
- }
215
- /**
216
- * @category Types
217
- */
218
- export interface AwaitProps<Resolve> {
219
- /**
220
- When using a function, the resolved value is provided as the parameter.
221
-
222
- ```tsx [2]
223
- <Await resolve={reviewsPromise}>
224
- {(resolvedReviews) => <Reviews items={resolvedReviews} />}
225
- </Await>
226
- ```
227
-
228
- When using React elements, {@link useAsyncValue} will provide the
229
- resolved value:
230
-
231
- ```tsx [2]
232
- <Await resolve={reviewsPromise}>
233
- <Reviews />
234
- </Await>
235
-
236
- function Reviews() {
237
- const resolvedReviews = useAsyncValue()
238
- return <div>...</div>
239
- }
240
- ```
241
- */
242
- children: React.ReactNode | AwaitResolveRenderFunction;
243
- /**
244
- The error element renders instead of the children when the promise rejects.
245
-
246
- ```tsx
247
- <Await
248
- errorElement={<div>Oops</div>}
249
- resolve={reviewsPromise}
250
- >
251
- <Reviews />
252
- </Await>
253
- ```
254
-
255
- To provide a more contextual error, you can use the {@link useAsyncError} in a
256
- child component
257
-
258
- ```tsx
259
- <Await
260
- errorElement={<ReviewsError />}
261
- resolve={reviewsPromise}
262
- >
263
- <Reviews />
264
- </Await>
265
-
266
- function ReviewsError() {
267
- const error = useAsyncError()
268
- return <div>Error loading reviews: {error.message}</div>
269
- }
270
- ```
271
-
272
- If you do not provide an errorElement, the rejected value will bubble up to
273
- the nearest route-level {@link NonIndexRouteObject#ErrorBoundary | ErrorBoundary} and be accessible
274
- via {@link useRouteError} hook.
275
- */
276
- errorElement?: React.ReactNode;
277
- /**
278
- Takes a promise returned from a {@link LoaderFunction | loader} value to be resolved and rendered.
279
-
280
- ```jsx
281
- import { useLoaderData, Await } from "react-router"
282
-
283
- export async function loader() {
284
- let reviews = getReviews() // not awaited
285
- let book = await getBook()
286
- return {
287
- book,
288
- reviews, // this is a promise
289
- }
290
- }
291
-
292
- export default function Book() {
293
- const {
294
- book,
295
- reviews, // this is the same promise
296
- } = useLoaderData()
297
-
298
- return (
299
- <div>
300
- <h1>{book.title}</h1>
301
- <p>{book.description}</p>
302
- <React.Suspense fallback={<ReviewsSkeleton />}>
303
- <Await
304
- // and is the promise we pass to Await
305
- resolve={reviews}
306
- >
307
- <Reviews />
308
- </Await>
309
- </React.Suspense>
310
- </div>
311
- );
312
- }
313
- ```
314
- */
315
- resolve: Resolve;
316
- }
317
- /**
318
- Used to render promise values with automatic error handling.
319
-
320
- ```tsx
321
- import { Await, useLoaderData } from "react-router";
322
-
323
- export function loader() {
324
- // not awaited
325
- const reviews = getReviews()
326
- // awaited (blocks the transition)
327
- const book = await fetch("/api/book").then((res) => res.json())
328
- return { book, reviews }
329
- }
330
-
331
- function Book() {
332
- const { book, reviews } = useLoaderData();
333
- return (
334
- <div>
335
- <h1>{book.title}</h1>
336
- <p>{book.description}</p>
337
- <React.Suspense fallback={<ReviewsSkeleton />}>
338
- <Await
339
- resolve={reviews}
340
- errorElement={
341
- <div>Could not load reviews 😬</div>
342
- }
343
- children={(resolvedReviews) => (
344
- <Reviews items={resolvedReviews} />
345
- )}
346
- />
347
- </React.Suspense>
348
- </div>
349
- );
350
- }
351
- ```
352
-
353
- **Note:** `<Await>` expects to be rendered inside of a `<React.Suspense>`
354
-
355
- @category Components
356
-
357
- */
358
- export declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
359
- /**
360
- * Creates a route config from a React "children" object, which is usually
361
- * either a `<Route>` element or an array of them. Used internally by
362
- * `<Routes>` to create a route config from its children.
363
- *
364
- * @category Utils
365
- */
366
- export declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[];
367
- /**
368
- * Renders the result of `matchRoutes()` into a React element.
369
- *
370
- * @category Utils
371
- */
372
- export declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
@@ -1,115 +0,0 @@
1
- import * as React from "react";
2
- import type { History, Action as NavigationType, Location, To } from "./router/history";
3
- import type { RelativeRoutingType, Router, StaticHandlerContext } from "./router/router";
4
- import type { AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, AgnosticRouteMatch, LazyRouteFunction, TrackedPromise } from "./router/utils";
5
- export interface IndexRouteObject {
6
- caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
7
- path?: AgnosticIndexRouteObject["path"];
8
- id?: AgnosticIndexRouteObject["id"];
9
- loader?: AgnosticIndexRouteObject["loader"];
10
- action?: AgnosticIndexRouteObject["action"];
11
- hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
12
- shouldRevalidate?: AgnosticIndexRouteObject["shouldRevalidate"];
13
- handle?: AgnosticIndexRouteObject["handle"];
14
- index: true;
15
- children?: undefined;
16
- element?: React.ReactNode | null;
17
- hydrateFallbackElement?: React.ReactNode | null;
18
- errorElement?: React.ReactNode | null;
19
- Component?: React.ComponentType | null;
20
- HydrateFallback?: React.ComponentType | null;
21
- ErrorBoundary?: React.ComponentType | null;
22
- lazy?: LazyRouteFunction<RouteObject>;
23
- }
24
- export interface NonIndexRouteObject {
25
- caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
26
- path?: AgnosticNonIndexRouteObject["path"];
27
- id?: AgnosticNonIndexRouteObject["id"];
28
- loader?: AgnosticNonIndexRouteObject["loader"];
29
- action?: AgnosticNonIndexRouteObject["action"];
30
- hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
31
- shouldRevalidate?: AgnosticNonIndexRouteObject["shouldRevalidate"];
32
- handle?: AgnosticNonIndexRouteObject["handle"];
33
- index?: false;
34
- children?: RouteObject[];
35
- element?: React.ReactNode | null;
36
- hydrateFallbackElement?: React.ReactNode | null;
37
- errorElement?: React.ReactNode | null;
38
- Component?: React.ComponentType | null;
39
- HydrateFallback?: React.ComponentType | null;
40
- ErrorBoundary?: React.ComponentType | null;
41
- lazy?: LazyRouteFunction<RouteObject>;
42
- }
43
- export type RouteObject = IndexRouteObject | NonIndexRouteObject;
44
- export type DataRouteObject = RouteObject & {
45
- children?: DataRouteObject[];
46
- id: string;
47
- };
48
- export interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> extends AgnosticRouteMatch<ParamKey, RouteObjectType> {
49
- }
50
- export interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
51
- }
52
- export type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
53
- export type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
54
- export interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
55
- router: Router;
56
- staticContext?: StaticHandlerContext;
57
- }
58
- export declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
59
- export declare const DataRouterStateContext: React.Context<import("./router/router").RouterState | null>;
60
- export type ViewTransitionContextObject = {
61
- isTransitioning: false;
62
- } | {
63
- isTransitioning: true;
64
- flushSync: boolean;
65
- currentLocation: Location;
66
- nextLocation: Location;
67
- };
68
- export declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
69
- export type FetchersContextObject = Map<string, any>;
70
- export declare const FetchersContext: React.Context<FetchersContextObject>;
71
- export declare const AwaitContext: React.Context<TrackedPromise | null>;
72
- export interface NavigateOptions {
73
- replace?: boolean;
74
- state?: any;
75
- preventScrollReset?: boolean;
76
- relative?: RelativeRoutingType;
77
- flushSync?: boolean;
78
- viewTransition?: boolean;
79
- }
80
- /**
81
- * A Navigator is a "location changer"; it's how you get to different locations.
82
- *
83
- * Every history instance conforms to the Navigator interface, but the
84
- * distinction is useful primarily when it comes to the low-level `<Router>` API
85
- * where both the location and a navigator must be provided separately in order
86
- * to avoid "tearing" that may occur in a suspense-enabled app if the action
87
- * and/or location were to be read directly from the history instance.
88
- */
89
- export interface Navigator {
90
- createHref: History["createHref"];
91
- encodeLocation?: History["encodeLocation"];
92
- go: History["go"];
93
- push(to: To, state?: any, opts?: NavigateOptions): void;
94
- replace(to: To, state?: any, opts?: NavigateOptions): void;
95
- }
96
- interface NavigationContextObject {
97
- basename: string;
98
- navigator: Navigator;
99
- static: boolean;
100
- future: {};
101
- }
102
- export declare const NavigationContext: React.Context<NavigationContextObject>;
103
- interface LocationContextObject {
104
- location: Location;
105
- navigationType: NavigationType;
106
- }
107
- export declare const LocationContext: React.Context<LocationContextObject>;
108
- export interface RouteContextObject {
109
- outlet: React.ReactElement | null;
110
- matches: RouteMatch[];
111
- isDataRoute: boolean;
112
- }
113
- export declare const RouteContext: React.Context<RouteContextObject>;
114
- export declare const RouteErrorContext: React.Context<any>;
115
- export {};
@@ -1,123 +0,0 @@
1
- import type { RelativeRoutingType } from "../router/router";
2
- import type { FormEncType, HTMLFormMethod } from "../router/utils";
3
- export declare const defaultMethod: HTMLFormMethod;
4
- export declare function isHtmlElement(object: any): object is HTMLElement;
5
- export declare function isButtonElement(object: any): object is HTMLButtonElement;
6
- export declare function isFormElement(object: any): object is HTMLFormElement;
7
- export declare function isInputElement(object: any): object is HTMLInputElement;
8
- type LimitedMouseEvent = Pick<MouseEvent, "button" | "metaKey" | "altKey" | "ctrlKey" | "shiftKey">;
9
- export declare function shouldProcessLinkClick(event: LimitedMouseEvent, target?: string): boolean;
10
- export type ParamKeyValuePair = [string, string];
11
- export type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
12
- /**
13
- Creates a URLSearchParams object using the given initializer.
14
-
15
- This is identical to `new URLSearchParams(init)` except it also
16
- supports arrays as values in the object form of the initializer
17
- instead of just strings. This is convenient when you need multiple
18
- values for a given key, but don't want to use an array initializer.
19
-
20
- For example, instead of:
21
-
22
- ```tsx
23
- let searchParams = new URLSearchParams([
24
- ['sort', 'name'],
25
- ['sort', 'price']
26
- ]);
27
- ```
28
- you can do:
29
-
30
- ```
31
- let searchParams = createSearchParams({
32
- sort: ['name', 'price']
33
- });
34
- ```
35
-
36
- @category Utils
37
- */
38
- export declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;
39
- export declare function getSearchParamsForLocation(locationSearch: string, defaultSearchParams: URLSearchParams | null): URLSearchParams;
40
- type JsonObject = {
41
- [Key in string]: JsonValue;
42
- } & {
43
- [Key in string]?: JsonValue | undefined;
44
- };
45
- type JsonArray = JsonValue[] | readonly JsonValue[];
46
- type JsonPrimitive = string | number | boolean | null;
47
- type JsonValue = JsonPrimitive | JsonObject | JsonArray;
48
- export type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
49
- /**
50
- * Submit options shared by both navigations and fetchers
51
- */
52
- interface SharedSubmitOptions {
53
- /**
54
- * The HTTP method used to submit the form. Overrides `<form method>`.
55
- * Defaults to "GET".
56
- */
57
- method?: HTMLFormMethod;
58
- /**
59
- * The action URL path used to submit the form. Overrides `<form action>`.
60
- * Defaults to the path of the current route.
61
- */
62
- action?: string;
63
- /**
64
- * The encoding used to submit the form. Overrides `<form encType>`.
65
- * Defaults to "application/x-www-form-urlencoded".
66
- */
67
- encType?: FormEncType;
68
- /**
69
- * Determines whether the form action is relative to the route hierarchy or
70
- * the pathname. Use this if you want to opt out of navigating the route
71
- * hierarchy and want to instead route based on /-delimited URL segments
72
- */
73
- relative?: RelativeRoutingType;
74
- /**
75
- * In browser-based environments, prevent resetting scroll after this
76
- * navigation when using the <ScrollRestoration> component
77
- */
78
- preventScrollReset?: boolean;
79
- /**
80
- * Enable flushSync for this submission's state updates
81
- */
82
- flushSync?: boolean;
83
- }
84
- /**
85
- * Submit options available to fetchers
86
- */
87
- export interface FetcherSubmitOptions extends SharedSubmitOptions {
88
- }
89
- /**
90
- * Submit options available to navigations
91
- */
92
- export interface SubmitOptions extends FetcherSubmitOptions {
93
- /**
94
- * Set `true` to replace the current entry in the browser's history stack
95
- * instead of creating a new one (i.e. stay on "the same page"). Defaults
96
- * to `false`.
97
- */
98
- replace?: boolean;
99
- /**
100
- * State object to add to the history stack entry for this navigation
101
- */
102
- state?: any;
103
- /**
104
- * Indicate a specific fetcherKey to use when using navigate=false
105
- */
106
- fetcherKey?: string;
107
- /**
108
- * navigate=false will use a fetcher instead of a navigation
109
- */
110
- navigate?: boolean;
111
- /**
112
- * Enable view transitions on this submission navigation
113
- */
114
- viewTransition?: boolean;
115
- }
116
- export declare function getFormSubmissionInfo(target: SubmitTarget, basename: string): {
117
- action: string | null;
118
- method: string;
119
- encType: string;
120
- formData: FormData | undefined;
121
- body: any;
122
- };
123
- export {};
@@ -1,40 +0,0 @@
1
- import type { HydrationState, Router as DataRouter } from "../router/router";
2
- import type { AssetsManifest, FutureConfig } from "./ssr/entry";
3
- import type { RouteModules } from "./ssr/routeModules";
4
- export type WindowReactRouterContext = {
5
- basename?: string;
6
- state: HydrationState;
7
- criticalCss?: string;
8
- future: FutureConfig;
9
- isSpaMode: boolean;
10
- stream: ReadableStream<Uint8Array> | undefined;
11
- streamController: ReadableStreamDefaultController<Uint8Array>;
12
- a?: number;
13
- dev?: {
14
- port?: number;
15
- hmrRuntime?: string;
16
- };
17
- };
18
- export interface ViewTransition {
19
- finished: Promise<void>;
20
- ready: Promise<void>;
21
- updateCallbackDone: Promise<void>;
22
- skipTransition(): void;
23
- }
24
- declare global {
25
- var __staticRouterHydrationData: HydrationState | undefined;
26
- var __reactRouterVersion: string;
27
- interface Document {
28
- startViewTransition(cb: () => Promise<void> | void): ViewTransition;
29
- }
30
- var __reactRouterContext: WindowReactRouterContext | undefined;
31
- var __reactRouterManifest: AssetsManifest | undefined;
32
- var __reactRouterRouteModules: RouteModules | undefined;
33
- var __reactRouterDataRouter: DataRouter | undefined;
34
- var __reactRouterHdrActive: boolean;
35
- var __reactRouterClearCriticalCss: (() => void) | undefined;
36
- var $RefreshRuntime$: {
37
- performReactRefresh: () => void;
38
- } | undefined;
39
- }
40
- export {};
@@ -1,41 +0,0 @@
1
- import * as React from "react";
2
- import type { Location } from "../router/history";
3
- import type { FutureConfig, Router as DataRouter, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, StaticHandlerContext } from "../router/router";
4
- import type { RouteObject } from "../context";
5
- export interface StaticRouterProps {
6
- basename?: string;
7
- children?: React.ReactNode;
8
- location: Partial<Location> | string;
9
- }
10
- /**
11
- * A `<Router>` that may not navigate to any other location. This is useful
12
- * on the server where there is no stateful UI.
13
- *
14
- * @category Router Components
15
- */
16
- export declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
17
- export interface StaticRouterProviderProps {
18
- context: StaticHandlerContext;
19
- router: DataRouter;
20
- hydrate?: boolean;
21
- nonce?: string;
22
- }
23
- /**
24
- * A Data Router that may not navigate to any other location. This is useful
25
- * on the server where there is no stateful UI.
26
- *
27
- * @category Router Components
28
- */
29
- export declare function StaticRouterProvider({ context, router, hydrate, nonce, }: StaticRouterProviderProps): React.JSX.Element;
30
- type CreateStaticHandlerOptions = Omit<RouterCreateStaticHandlerOptions, "mapRouteProperties">;
31
- /**
32
- * @category Utils
33
- */
34
- export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("../router/router").StaticHandler;
35
- /**
36
- * @category Routers
37
- */
38
- export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
39
- future?: Partial<FutureConfig>;
40
- }): DataRouter;
41
- export {};