react-router 7.6.0 → 7.6.1-pre.0

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 (36) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/development/dom-export.d.mts +1 -2
  3. package/dist/development/dom-export.js +1 -1
  4. package/dist/development/dom-export.mjs +23 -23
  5. package/dist/development/index.d.mts +3740 -260
  6. package/dist/development/index.d.ts +1762 -12
  7. package/dist/development/index.js +16 -7
  8. package/dist/development/index.mjs +11439 -121
  9. package/dist/development/internal-export.d.mts +504 -0
  10. package/dist/development/internal-export.d.ts +504 -0
  11. package/dist/development/{lib/types/route-module.js → internal-export.js} +4 -4
  12. package/dist/development/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
  13. package/dist/production/dom-export.d.mts +1 -2
  14. package/dist/production/dom-export.js +1 -1
  15. package/dist/production/dom-export.mjs +23 -23
  16. package/dist/production/index.d.mts +3740 -260
  17. package/dist/production/index.d.ts +1762 -12
  18. package/dist/production/index.js +16 -7
  19. package/dist/production/index.mjs +11439 -121
  20. package/dist/production/internal-export.d.mts +504 -0
  21. package/dist/production/internal-export.d.ts +504 -0
  22. package/dist/production/{lib/types/route-module.js → internal-export.js} +4 -4
  23. package/dist/production/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
  24. package/package.json +7 -7
  25. package/dist/development/chunk-D4RADZKF.mjs +0 -11556
  26. package/dist/development/lib/types/route-module.d.mts +0 -208
  27. package/dist/development/lib/types/route-module.d.ts +0 -208
  28. package/dist/development/lib-CCSAGgcP.d.mts +0 -1736
  29. package/dist/development/route-data-B9_30zbP.d.ts +0 -1749
  30. package/dist/development/route-data-C6QaL0wu.d.mts +0 -1749
  31. package/dist/production/chunk-CVXGOGHQ.mjs +0 -11556
  32. package/dist/production/lib/types/route-module.d.mts +0 -208
  33. package/dist/production/lib/types/route-module.d.ts +0 -208
  34. package/dist/production/lib-CCSAGgcP.d.mts +0 -1736
  35. package/dist/production/route-data-B9_30zbP.d.ts +0 -1749
  36. package/dist/production/route-data-C6QaL0wu.d.mts +0 -1749
@@ -1,1749 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentType, ReactElement } from 'react';
3
-
4
- /**
5
- * Actions represent the type of change to a location value.
6
- */
7
- declare enum Action {
8
- /**
9
- * A POP indicates a change to an arbitrary index in the history stack, such
10
- * as a back or forward navigation. It does not describe the direction of the
11
- * navigation, only that the current index changed.
12
- *
13
- * Note: This is the default action for newly created history objects.
14
- */
15
- Pop = "POP",
16
- /**
17
- * A PUSH indicates a new entry being added to the history stack, such as when
18
- * a link is clicked and a new page loads. When this happens, all subsequent
19
- * entries in the stack are lost.
20
- */
21
- Push = "PUSH",
22
- /**
23
- * A REPLACE indicates the entry at the current index in the history stack
24
- * being replaced by a new one.
25
- */
26
- Replace = "REPLACE"
27
- }
28
- /**
29
- * The pathname, search, and hash values of a URL.
30
- */
31
- interface Path {
32
- /**
33
- * A URL pathname, beginning with a /.
34
- */
35
- pathname: string;
36
- /**
37
- * A URL search string, beginning with a ?.
38
- */
39
- search: string;
40
- /**
41
- * A URL fragment identifier, beginning with a #.
42
- */
43
- hash: string;
44
- }
45
- /**
46
- * An entry in a history stack. A location contains information about the
47
- * URL path, as well as possibly some arbitrary state and a key.
48
- */
49
- interface Location<State = any> extends Path {
50
- /**
51
- * A value of arbitrary data associated with this location.
52
- */
53
- state: State;
54
- /**
55
- * A unique string associated with this location. May be used to safely store
56
- * and retrieve data in some other storage API, like `localStorage`.
57
- *
58
- * Note: This value is always "default" on the initial location.
59
- */
60
- key: string;
61
- }
62
- /**
63
- * A change to the current location.
64
- */
65
- interface Update {
66
- /**
67
- * The action that triggered the change.
68
- */
69
- action: Action;
70
- /**
71
- * The new location.
72
- */
73
- location: Location;
74
- /**
75
- * The delta between this location and the former location in the history stack
76
- */
77
- delta: number | null;
78
- }
79
- /**
80
- * A function that receives notifications about location changes.
81
- */
82
- interface Listener {
83
- (update: Update): void;
84
- }
85
- /**
86
- * Describes a location that is the destination of some navigation used in
87
- * {@link Link}, {@link useNavigate}, etc.
88
- */
89
- type To = string | Partial<Path>;
90
- /**
91
- * A history is an interface to the navigation stack. The history serves as the
92
- * source of truth for the current location, as well as provides a set of
93
- * methods that may be used to change it.
94
- *
95
- * It is similar to the DOM's `window.history` object, but with a smaller, more
96
- * focused API.
97
- */
98
- interface History {
99
- /**
100
- * The last action that modified the current location. This will always be
101
- * Action.Pop when a history instance is first created. This value is mutable.
102
- */
103
- readonly action: Action;
104
- /**
105
- * The current location. This value is mutable.
106
- */
107
- readonly location: Location;
108
- /**
109
- * Returns a valid href for the given `to` value that may be used as
110
- * the value of an <a href> attribute.
111
- *
112
- * @param to - The destination URL
113
- */
114
- createHref(to: To): string;
115
- /**
116
- * Returns a URL for the given `to` value
117
- *
118
- * @param to - The destination URL
119
- */
120
- createURL(to: To): URL;
121
- /**
122
- * Encode a location the same way window.history would do (no-op for memory
123
- * history) so we ensure our PUSH/REPLACE navigations for data routers
124
- * behave the same as POP
125
- *
126
- * @param to Unencoded path
127
- */
128
- encodeLocation(to: To): Path;
129
- /**
130
- * Pushes a new location onto the history stack, increasing its length by one.
131
- * If there were any entries in the stack after the current one, they are
132
- * lost.
133
- *
134
- * @param to - The new URL
135
- * @param state - Data to associate with the new location
136
- */
137
- push(to: To, state?: any): void;
138
- /**
139
- * Replaces the current location in the history stack with a new one. The
140
- * location that was replaced will no longer be available.
141
- *
142
- * @param to - The new URL
143
- * @param state - Data to associate with the new location
144
- */
145
- replace(to: To, state?: any): void;
146
- /**
147
- * Navigates `n` entries backward/forward in the history stack relative to the
148
- * current index. For example, a "back" navigation would use go(-1).
149
- *
150
- * @param delta - The delta in the stack index
151
- */
152
- go(delta: number): void;
153
- /**
154
- * Sets up a listener that will be called whenever the current location
155
- * changes.
156
- *
157
- * @param listener - A function that will be called when the location changes
158
- * @returns unlisten - A function that may be used to stop listening
159
- */
160
- listen(listener: Listener): () => void;
161
- }
162
- /**
163
- * A user-supplied object that describes a location. Used when providing
164
- * entries to `createMemoryHistory` via its `initialEntries` option.
165
- */
166
- type InitialEntry = string | Partial<Location>;
167
- /**
168
- * A browser history stores the current location in regular URLs in a web
169
- * browser environment. This is the standard for most web apps and provides the
170
- * cleanest URLs the browser's address bar.
171
- *
172
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory
173
- */
174
- interface BrowserHistory extends UrlHistory {
175
- }
176
- type BrowserHistoryOptions = UrlHistoryOptions;
177
- /**
178
- * Browser history stores the location in regular URLs. This is the standard for
179
- * most web apps, but it requires some configuration on the server to ensure you
180
- * serve the same app at multiple URLs.
181
- *
182
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
183
- */
184
- declare function createBrowserHistory(options?: BrowserHistoryOptions): BrowserHistory;
185
- /**
186
- * @private
187
- */
188
- declare function invariant(value: boolean, message?: string): asserts value;
189
- declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
190
- /**
191
- * Creates a string URL path from the given pathname, search, and hash components.
192
- *
193
- * @category Utils
194
- */
195
- declare function createPath({ pathname, search, hash, }: Partial<Path>): string;
196
- /**
197
- * Parses a string URL path into its separate pathname, search, and hash components.
198
- *
199
- * @category Utils
200
- */
201
- declare function parsePath(path: string): Partial<Path>;
202
- interface UrlHistory extends History {
203
- }
204
- type UrlHistoryOptions = {
205
- window?: Window;
206
- v5Compat?: boolean;
207
- };
208
-
209
- /**
210
- * An augmentable interface users can modify in their app-code to opt into
211
- * future-flag-specific types
212
- */
213
- interface Future {
214
- }
215
- type MiddlewareEnabled = Future extends {
216
- unstable_middleware: infer T extends boolean;
217
- } ? T : false;
218
-
219
- type MaybePromise<T> = T | Promise<T>;
220
- /**
221
- * Map of routeId -> data returned from a loader/action/error
222
- */
223
- interface RouteData {
224
- [routeId: string]: any;
225
- }
226
- type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
227
- type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
228
- /**
229
- * Users can specify either lowercase or uppercase form methods on `<Form>`,
230
- * useSubmit(), `<fetcher.Form>`, etc.
231
- */
232
- type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
233
- /**
234
- * Active navigation/fetcher form methods are exposed in uppercase on the
235
- * RouterState. This is to align with the normalization done via fetch().
236
- */
237
- type FormMethod = UpperCaseFormMethod;
238
- type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
239
- type JsonObject = {
240
- [Key in string]: JsonValue;
241
- } & {
242
- [Key in string]?: JsonValue | undefined;
243
- };
244
- type JsonArray = JsonValue[] | readonly JsonValue[];
245
- type JsonPrimitive = string | number | boolean | null;
246
- type JsonValue = JsonPrimitive | JsonObject | JsonArray;
247
- /**
248
- * @private
249
- * Internal interface to pass around for action submissions, not intended for
250
- * external consumption
251
- */
252
- type Submission = {
253
- formMethod: FormMethod;
254
- formAction: string;
255
- formEncType: FormEncType;
256
- formData: FormData;
257
- json: undefined;
258
- text: undefined;
259
- } | {
260
- formMethod: FormMethod;
261
- formAction: string;
262
- formEncType: FormEncType;
263
- formData: undefined;
264
- json: JsonValue;
265
- text: undefined;
266
- } | {
267
- formMethod: FormMethod;
268
- formAction: string;
269
- formEncType: FormEncType;
270
- formData: undefined;
271
- json: undefined;
272
- text: string;
273
- };
274
- interface unstable_RouterContext<T = unknown> {
275
- defaultValue?: T;
276
- }
277
- /**
278
- * Creates a context object that may be used to store and retrieve arbitrary values.
279
- *
280
- * If a `defaultValue` is provided, it will be returned from `context.get()` when no value has been
281
- * set for the context. Otherwise reading this context when no value has been set will throw an
282
- * error.
283
- *
284
- * @param defaultValue The default value for the context
285
- * @returns A context object
286
- */
287
- declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterContext<T>;
288
- /**
289
- * A Map of RouterContext objects to their initial values - used to populate a
290
- * fresh `context` value per request/navigation/fetch
291
- */
292
- type unstable_InitialContext = Map<unstable_RouterContext, unknown>;
293
- /**
294
- * Provides methods for writing/reading values in application context in a typesafe way.
295
- */
296
- declare class unstable_RouterContextProvider {
297
- #private;
298
- constructor(init?: unstable_InitialContext);
299
- get<T>(context: unstable_RouterContext<T>): T;
300
- set<C extends unstable_RouterContext>(context: C, value: C extends unstable_RouterContext<infer T> ? T : never): void;
301
- }
302
- type DefaultContext = MiddlewareEnabled extends true ? unstable_RouterContextProvider : any;
303
- /**
304
- * @private
305
- * Arguments passed to route loader/action functions. Same for now but we keep
306
- * this as a private implementation detail in case they diverge in the future.
307
- */
308
- interface DataFunctionArgs<Context> {
309
- /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
310
- request: Request;
311
- /**
312
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
313
- * @example
314
- * // app/routes.ts
315
- * route("teams/:teamId", "./team.tsx"),
316
- *
317
- * // app/team.tsx
318
- * export function loader({
319
- * params,
320
- * }: Route.LoaderArgs) {
321
- * params.teamId;
322
- * // ^ string
323
- * }
324
- **/
325
- params: Params;
326
- /**
327
- * This is the context passed in to your server adapter's getLoadContext() function.
328
- * It's a way to bridge the gap between the adapter's request/response API with your React Router app.
329
- * It is only applicable if you are using a custom server adapter.
330
- */
331
- context: Context;
332
- }
333
- /**
334
- * Route middleware `next` function to call downstream handlers and then complete
335
- * middlewares from the bottom-up
336
- */
337
- interface unstable_MiddlewareNextFunction<Result = unknown> {
338
- (): MaybePromise<Result>;
339
- }
340
- /**
341
- * Route middleware function signature. Receives the same "data" arguments as a
342
- * `loader`/`action` (`request`, `params`, `context`) as the first parameter and
343
- * a `next` function as the second parameter which will call downstream handlers
344
- * and then complete middlewares from the bottom-up
345
- */
346
- type unstable_MiddlewareFunction<Result = unknown> = (args: DataFunctionArgs<unstable_RouterContextProvider>, next: unstable_MiddlewareNextFunction<Result>) => MaybePromise<Result | void>;
347
- /**
348
- * Arguments passed to loader functions
349
- */
350
- interface LoaderFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
351
- }
352
- /**
353
- * Arguments passed to action functions
354
- */
355
- interface ActionFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
356
- }
357
- /**
358
- * Loaders and actions can return anything
359
- */
360
- type DataFunctionValue = unknown;
361
- type DataFunctionReturnValue = MaybePromise<DataFunctionValue>;
362
- /**
363
- * Route loader function signature
364
- */
365
- type LoaderFunction<Context = DefaultContext> = {
366
- (args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
367
- } & {
368
- hydrate?: boolean;
369
- };
370
- /**
371
- * Route action function signature
372
- */
373
- interface ActionFunction<Context = DefaultContext> {
374
- (args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
375
- }
376
- /**
377
- * Arguments passed to shouldRevalidate function
378
- */
379
- interface ShouldRevalidateFunctionArgs {
380
- /** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
381
- currentUrl: URL;
382
- /** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
383
- currentParams: AgnosticDataRouteMatch["params"];
384
- /** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
385
- nextUrl: URL;
386
- /** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
387
- nextParams: AgnosticDataRouteMatch["params"];
388
- /** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
389
- formMethod?: Submission["formMethod"];
390
- /** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
391
- formAction?: Submission["formAction"];
392
- /** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
393
- formEncType?: Submission["formEncType"];
394
- /** The form submission data when the form's encType is `text/plain` */
395
- text?: Submission["text"];
396
- /** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
397
- formData?: Submission["formData"];
398
- /** The form submission data when the form's encType is `application/json` */
399
- json?: Submission["json"];
400
- /** The status code of the action response */
401
- actionStatus?: number;
402
- /**
403
- * When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
404
- *
405
- * @example
406
- * export async function action() {
407
- * await saveSomeStuff();
408
- * return { ok: true };
409
- * }
410
- *
411
- * export function shouldRevalidate({
412
- * actionResult,
413
- * }) {
414
- * if (actionResult?.ok) {
415
- * return false;
416
- * }
417
- * return true;
418
- * }
419
- */
420
- actionResult?: any;
421
- /**
422
- * By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
423
- *
424
- * /projects/123/tasks/abc
425
- * /projects/123/tasks/def
426
- * React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
427
- *
428
- * It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
429
- */
430
- defaultShouldRevalidate: boolean;
431
- }
432
- /**
433
- * Route shouldRevalidate function signature. This runs after any submission
434
- * (navigation or fetcher), so we flatten the navigation/fetcher submission
435
- * onto the arguments. It shouldn't matter whether it came from a navigation
436
- * or a fetcher, what really matters is the URLs and the formData since loaders
437
- * have to re-run based on the data models that were potentially mutated.
438
- */
439
- interface ShouldRevalidateFunction {
440
- (args: ShouldRevalidateFunctionArgs): boolean;
441
- }
442
- interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
443
- /**
444
- * @private
445
- */
446
- _lazyPromises?: {
447
- middleware: Promise<void> | undefined;
448
- handler: Promise<void> | undefined;
449
- route: Promise<void> | undefined;
450
- };
451
- shouldLoad: boolean;
452
- unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
453
- unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
454
- resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
455
- }
456
- interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
457
- matches: DataStrategyMatch[];
458
- unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
459
- fetcherKey: string | null;
460
- }
461
- /**
462
- * Result from a loader or action called via dataStrategy
463
- */
464
- interface DataStrategyResult {
465
- type: "data" | "error";
466
- result: unknown;
467
- }
468
- interface DataStrategyFunction<Context = DefaultContext> {
469
- (args: DataStrategyFunctionArgs<Context>): Promise<Record<string, DataStrategyResult>>;
470
- }
471
- type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
472
- signal: AbortSignal;
473
- path: string;
474
- matches: M[];
475
- fetcherKey: string | undefined;
476
- patch: (routeId: string | null, children: O[]) => void;
477
- };
478
- type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => MaybePromise<void>;
479
- /**
480
- * Function provided by the framework-aware layers to set any framework-specific
481
- * properties from framework-agnostic properties
482
- */
483
- interface MapRoutePropertiesFunction {
484
- (route: AgnosticRouteObject): {
485
- hasErrorBoundary: boolean;
486
- } & Record<string, any>;
487
- }
488
- /**
489
- * Keys we cannot change from within a lazy object. We spread all other keys
490
- * onto the route. Either they're meaningful to the router, or they'll get
491
- * ignored.
492
- */
493
- type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
494
- /**
495
- * Keys we cannot change from within a lazy() function. We spread all other keys
496
- * onto the route. Either they're meaningful to the router, or they'll get
497
- * ignored.
498
- */
499
- type UnsupportedLazyRouteFunctionKey = UnsupportedLazyRouteObjectKey | "unstable_middleware";
500
- /**
501
- * lazy object to load route properties, which can add non-matching
502
- * related properties to a route
503
- */
504
- type LazyRouteObject<R extends AgnosticRouteObject> = {
505
- [K in keyof R as K extends UnsupportedLazyRouteObjectKey ? never : K]?: () => Promise<R[K] | null | undefined>;
506
- };
507
- /**
508
- * lazy() function to load a route definition, which can add non-matching
509
- * related properties to a route
510
- */
511
- interface LazyRouteFunction<R extends AgnosticRouteObject> {
512
- (): Promise<Omit<R, UnsupportedLazyRouteFunctionKey> & Partial<Record<UnsupportedLazyRouteFunctionKey, never>>>;
513
- }
514
- type LazyRouteDefinition<R extends AgnosticRouteObject> = LazyRouteObject<R> | LazyRouteFunction<R>;
515
- /**
516
- * Base RouteObject with common props shared by all types of routes
517
- */
518
- type AgnosticBaseRouteObject = {
519
- caseSensitive?: boolean;
520
- path?: string;
521
- id?: string;
522
- unstable_middleware?: unstable_MiddlewareFunction[];
523
- loader?: LoaderFunction | boolean;
524
- action?: ActionFunction | boolean;
525
- hasErrorBoundary?: boolean;
526
- shouldRevalidate?: ShouldRevalidateFunction;
527
- handle?: any;
528
- lazy?: LazyRouteDefinition<AgnosticBaseRouteObject>;
529
- };
530
- /**
531
- * Index routes must not have children
532
- */
533
- type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {
534
- children?: undefined;
535
- index: true;
536
- };
537
- /**
538
- * Non-index routes may have children, but cannot have index
539
- */
540
- type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {
541
- children?: AgnosticRouteObject[];
542
- index?: false;
543
- };
544
- /**
545
- * A route object represents a logical route, with (optionally) its child
546
- * routes organized in a tree-like structure.
547
- */
548
- type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
549
- type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
550
- id: string;
551
- };
552
- type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
553
- children?: AgnosticDataRouteObject[];
554
- id: string;
555
- };
556
- /**
557
- * A data route object, which is just a RouteObject with a required unique ID
558
- */
559
- type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
560
- type RouteManifest<R = AgnosticDataRouteObject> = Record<string, R | undefined>;
561
- type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
562
- type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
563
- type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
564
- type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
565
- type ParamChar = Regex_w | "-";
566
- type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
567
- type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
568
- type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
569
- type ParamParseKey<Segment extends string> = [
570
- PathParam<Segment>
571
- ] extends [never] ? string : PathParam<Segment>;
572
- /**
573
- * The parameters that were parsed from the URL path.
574
- */
575
- type Params<Key extends string = string> = {
576
- readonly [key in Key]: string | undefined;
577
- };
578
- /**
579
- * A RouteMatch contains info about how a route matched a URL.
580
- */
581
- interface AgnosticRouteMatch<ParamKey extends string = string, RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject> {
582
- /**
583
- * The names and values of dynamic parameters in the URL.
584
- */
585
- params: Params<ParamKey>;
586
- /**
587
- * The portion of the URL pathname that was matched.
588
- */
589
- pathname: string;
590
- /**
591
- * The portion of the URL pathname that was matched before child routes.
592
- */
593
- pathnameBase: string;
594
- /**
595
- * The route object that was used to match.
596
- */
597
- route: RouteObjectType;
598
- }
599
- interface AgnosticDataRouteMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
600
- }
601
- /**
602
- * Matches the given routes to a location and returns the match data.
603
- *
604
- * @category Utils
605
- */
606
- declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
607
- interface UIMatch<Data = unknown, Handle = unknown> {
608
- id: string;
609
- pathname: string;
610
- /**
611
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
612
- **/
613
- params: AgnosticRouteMatch["params"];
614
- /** The return value from the matched route's loader or clientLoader */
615
- data: Data;
616
- /** The {@link https://reactrouter.com/start/framework/route-module#handle handle object} exported from the matched route module */
617
- handle: Handle;
618
- }
619
- /**
620
- * Returns a path with params interpolated.
621
- *
622
- * @category Utils
623
- */
624
- declare function generatePath<Path extends string>(originalPath: Path, params?: {
625
- [key in PathParam<Path>]: string | null;
626
- }): string;
627
- /**
628
- * A PathPattern is used to match on some portion of a URL pathname.
629
- */
630
- interface PathPattern<Path extends string = string> {
631
- /**
632
- * A string to match against a URL pathname. May contain `:id`-style segments
633
- * to indicate placeholders for dynamic parameters. May also end with `/*` to
634
- * indicate matching the rest of the URL pathname.
635
- */
636
- path: Path;
637
- /**
638
- * Should be `true` if the static portions of the `path` should be matched in
639
- * the same case.
640
- */
641
- caseSensitive?: boolean;
642
- /**
643
- * Should be `true` if this pattern should match the entire URL pathname.
644
- */
645
- end?: boolean;
646
- }
647
- /**
648
- * A PathMatch contains info about how a PathPattern matched on a URL pathname.
649
- */
650
- interface PathMatch<ParamKey extends string = string> {
651
- /**
652
- * The names and values of dynamic parameters in the URL.
653
- */
654
- params: Params<ParamKey>;
655
- /**
656
- * The portion of the URL pathname that was matched.
657
- */
658
- pathname: string;
659
- /**
660
- * The portion of the URL pathname that was matched before child routes.
661
- */
662
- pathnameBase: string;
663
- /**
664
- * The pattern that was used to match.
665
- */
666
- pattern: PathPattern;
667
- }
668
- /**
669
- * Performs pattern matching on a URL pathname and returns information about
670
- * the match.
671
- *
672
- * @category Utils
673
- */
674
- declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
675
- /**
676
- * Returns a resolved path object relative to the given pathname.
677
- *
678
- * @category Utils
679
- */
680
- declare function resolvePath(to: To, fromPathname?: string): Path;
681
- declare class DataWithResponseInit<D> {
682
- type: string;
683
- data: D;
684
- init: ResponseInit | null;
685
- constructor(data: D, init?: ResponseInit);
686
- }
687
- /**
688
- * Create "responses" that contain `status`/`headers` without forcing
689
- * serialization into an actual `Response` - used by Remix single fetch
690
- *
691
- * @category Utils
692
- */
693
- declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
694
- type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
695
- /**
696
- * A redirect response. Sets the status code and the `Location` header.
697
- * Defaults to "302 Found".
698
- *
699
- * @category Utils
700
- */
701
- declare const redirect: RedirectFunction;
702
- /**
703
- * A redirect response that will force a document reload to the new location.
704
- * Sets the status code and the `Location` header.
705
- * Defaults to "302 Found".
706
- *
707
- * @category Utils
708
- */
709
- declare const redirectDocument: RedirectFunction;
710
- /**
711
- * A redirect response that will perform a `history.replaceState` instead of a
712
- * `history.pushState` for client-side navigation redirects.
713
- * Sets the status code and the `Location` header.
714
- * Defaults to "302 Found".
715
- *
716
- * @category Utils
717
- */
718
- declare const replace: RedirectFunction;
719
- type ErrorResponse = {
720
- status: number;
721
- statusText: string;
722
- data: any;
723
- };
724
- /**
725
- * @private
726
- * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies
727
- *
728
- * We don't export the class for public use since it's an implementation
729
- * detail, but we export the interface above so folks can build their own
730
- * abstractions around instances via isRouteErrorResponse()
731
- */
732
- declare class ErrorResponseImpl implements ErrorResponse {
733
- status: number;
734
- statusText: string;
735
- data: any;
736
- private error?;
737
- private internal;
738
- constructor(status: number, statusText: string | undefined, data: any, internal?: boolean);
739
- }
740
- /**
741
- * Check if the given error is an ErrorResponse generated from a 4xx/5xx
742
- * Response thrown from an action/loader
743
- *
744
- * @category Utils
745
- */
746
- declare function isRouteErrorResponse(error: any): error is ErrorResponse;
747
-
748
- /**
749
- * A Router instance manages all navigation and data loading/mutations
750
- */
751
- interface Router {
752
- /**
753
- * @private
754
- * PRIVATE - DO NOT USE
755
- *
756
- * Return the basename for the router
757
- */
758
- get basename(): RouterInit["basename"];
759
- /**
760
- * @private
761
- * PRIVATE - DO NOT USE
762
- *
763
- * Return the future config for the router
764
- */
765
- get future(): FutureConfig;
766
- /**
767
- * @private
768
- * PRIVATE - DO NOT USE
769
- *
770
- * Return the current state of the router
771
- */
772
- get state(): RouterState;
773
- /**
774
- * @private
775
- * PRIVATE - DO NOT USE
776
- *
777
- * Return the routes for this router instance
778
- */
779
- get routes(): AgnosticDataRouteObject[];
780
- /**
781
- * @private
782
- * PRIVATE - DO NOT USE
783
- *
784
- * Return the window associated with the router
785
- */
786
- get window(): RouterInit["window"];
787
- /**
788
- * @private
789
- * PRIVATE - DO NOT USE
790
- *
791
- * Initialize the router, including adding history listeners and kicking off
792
- * initial data fetches. Returns a function to cleanup listeners and abort
793
- * any in-progress loads
794
- */
795
- initialize(): Router;
796
- /**
797
- * @private
798
- * PRIVATE - DO NOT USE
799
- *
800
- * Subscribe to router.state updates
801
- *
802
- * @param fn function to call with the new state
803
- */
804
- subscribe(fn: RouterSubscriber): () => void;
805
- /**
806
- * @private
807
- * PRIVATE - DO NOT USE
808
- *
809
- * Enable scroll restoration behavior in the router
810
- *
811
- * @param savedScrollPositions Object that will manage positions, in case
812
- * it's being restored from sessionStorage
813
- * @param getScrollPosition Function to get the active Y scroll position
814
- * @param getKey Function to get the key to use for restoration
815
- */
816
- enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
817
- /**
818
- * @private
819
- * PRIVATE - DO NOT USE
820
- *
821
- * Navigate forward/backward in the history stack
822
- * @param to Delta to move in the history stack
823
- */
824
- navigate(to: number): Promise<void>;
825
- /**
826
- * Navigate to the given path
827
- * @param to Path to navigate to
828
- * @param opts Navigation options (method, submission, etc.)
829
- */
830
- navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
831
- /**
832
- * @private
833
- * PRIVATE - DO NOT USE
834
- *
835
- * Trigger a fetcher load/submission
836
- *
837
- * @param key Fetcher key
838
- * @param routeId Route that owns the fetcher
839
- * @param href href to fetch
840
- * @param opts Fetcher options, (method, submission, etc.)
841
- */
842
- fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
843
- /**
844
- * @private
845
- * PRIVATE - DO NOT USE
846
- *
847
- * Trigger a revalidation of all current route loaders and fetcher loads
848
- */
849
- revalidate(): Promise<void>;
850
- /**
851
- * @private
852
- * PRIVATE - DO NOT USE
853
- *
854
- * Utility function to create an href for the given location
855
- * @param location
856
- */
857
- createHref(location: Location | URL): string;
858
- /**
859
- * @private
860
- * PRIVATE - DO NOT USE
861
- *
862
- * Utility function to URL encode a destination path according to the internal
863
- * history implementation
864
- * @param to
865
- */
866
- encodeLocation(to: To): Path;
867
- /**
868
- * @private
869
- * PRIVATE - DO NOT USE
870
- *
871
- * Get/create a fetcher for the given key
872
- * @param key
873
- */
874
- getFetcher<TData = any>(key: string): Fetcher<TData>;
875
- /**
876
- * @private
877
- * PRIVATE - DO NOT USE
878
- *
879
- * Delete the fetcher for a given key
880
- * @param key
881
- */
882
- deleteFetcher(key: string): void;
883
- /**
884
- * @private
885
- * PRIVATE - DO NOT USE
886
- *
887
- * Cleanup listeners and abort any in-progress loads
888
- */
889
- dispose(): void;
890
- /**
891
- * @private
892
- * PRIVATE - DO NOT USE
893
- *
894
- * Get a navigation blocker
895
- * @param key The identifier for the blocker
896
- * @param fn The blocker function implementation
897
- */
898
- getBlocker(key: string, fn: BlockerFunction): Blocker;
899
- /**
900
- * @private
901
- * PRIVATE - DO NOT USE
902
- *
903
- * Delete a navigation blocker
904
- * @param key The identifier for the blocker
905
- */
906
- deleteBlocker(key: string): void;
907
- /**
908
- * @private
909
- * PRIVATE DO NOT USE
910
- *
911
- * Patch additional children routes into an existing parent route
912
- * @param routeId The parent route id or a callback function accepting `patch`
913
- * to perform batch patching
914
- * @param children The additional children routes
915
- */
916
- patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
917
- /**
918
- * @private
919
- * PRIVATE - DO NOT USE
920
- *
921
- * HMR needs to pass in-flight route updates to React Router
922
- * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
923
- */
924
- _internalSetRoutes(routes: AgnosticRouteObject[]): void;
925
- /**
926
- * @private
927
- * PRIVATE - DO NOT USE
928
- *
929
- * Internal fetch AbortControllers accessed by unit tests
930
- */
931
- _internalFetchControllers: Map<string, AbortController>;
932
- }
933
- /**
934
- * State maintained internally by the router. During a navigation, all states
935
- * reflect the "old" location unless otherwise noted.
936
- */
937
- interface RouterState {
938
- /**
939
- * The action of the most recent navigation
940
- */
941
- historyAction: Action;
942
- /**
943
- * The current location reflected by the router
944
- */
945
- location: Location;
946
- /**
947
- * The current set of route matches
948
- */
949
- matches: AgnosticDataRouteMatch[];
950
- /**
951
- * Tracks whether we've completed our initial data load
952
- */
953
- initialized: boolean;
954
- /**
955
- * Current scroll position we should start at for a new view
956
- * - number -> scroll position to restore to
957
- * - false -> do not restore scroll at all (used during submissions)
958
- * - null -> don't have a saved position, scroll to hash or top of page
959
- */
960
- restoreScrollPosition: number | false | null;
961
- /**
962
- * Indicate whether this navigation should skip resetting the scroll position
963
- * if we are unable to restore the scroll position
964
- */
965
- preventScrollReset: boolean;
966
- /**
967
- * Tracks the state of the current navigation
968
- */
969
- navigation: Navigation;
970
- /**
971
- * Tracks any in-progress revalidations
972
- */
973
- revalidation: RevalidationState;
974
- /**
975
- * Data from the loaders for the current matches
976
- */
977
- loaderData: RouteData;
978
- /**
979
- * Data from the action for the current matches
980
- */
981
- actionData: RouteData | null;
982
- /**
983
- * Errors caught from loaders for the current matches
984
- */
985
- errors: RouteData | null;
986
- /**
987
- * Map of current fetchers
988
- */
989
- fetchers: Map<string, Fetcher>;
990
- /**
991
- * Map of current blockers
992
- */
993
- blockers: Map<string, Blocker>;
994
- }
995
- /**
996
- * Data that can be passed into hydrate a Router from SSR
997
- */
998
- type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
999
- /**
1000
- * Future flags to toggle new feature behavior
1001
- */
1002
- interface FutureConfig {
1003
- unstable_middleware: boolean;
1004
- }
1005
- /**
1006
- * Initialization options for createRouter
1007
- */
1008
- interface RouterInit {
1009
- routes: AgnosticRouteObject[];
1010
- history: History;
1011
- basename?: string;
1012
- unstable_getContext?: () => MaybePromise<unstable_InitialContext>;
1013
- mapRouteProperties?: MapRoutePropertiesFunction;
1014
- future?: Partial<FutureConfig>;
1015
- hydrationRouteProperties?: string[];
1016
- hydrationData?: HydrationState;
1017
- window?: Window;
1018
- dataStrategy?: DataStrategyFunction;
1019
- patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
1020
- }
1021
- /**
1022
- * State returned from a server-side query() call
1023
- */
1024
- interface StaticHandlerContext {
1025
- basename: Router["basename"];
1026
- location: RouterState["location"];
1027
- matches: RouterState["matches"];
1028
- loaderData: RouterState["loaderData"];
1029
- actionData: RouterState["actionData"];
1030
- errors: RouterState["errors"];
1031
- statusCode: number;
1032
- loaderHeaders: Record<string, Headers>;
1033
- actionHeaders: Record<string, Headers>;
1034
- _deepestRenderedBoundaryId?: string | null;
1035
- }
1036
- /**
1037
- * A StaticHandler instance manages a singular SSR navigation/fetch event
1038
- */
1039
- interface StaticHandler {
1040
- dataRoutes: AgnosticDataRouteObject[];
1041
- query(request: Request, opts?: {
1042
- requestContext?: unknown;
1043
- filterMatchesToLoad?: (match: AgnosticDataRouteMatch) => boolean;
1044
- skipLoaderErrorBubbling?: boolean;
1045
- skipRevalidation?: boolean;
1046
- dataStrategy?: DataStrategyFunction<unknown>;
1047
- unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
1048
- }): Promise<StaticHandlerContext | Response>;
1049
- queryRoute(request: Request, opts?: {
1050
- routeId?: string;
1051
- requestContext?: unknown;
1052
- dataStrategy?: DataStrategyFunction<unknown>;
1053
- unstable_respond?: (res: Response) => MaybePromise<Response>;
1054
- }): Promise<any>;
1055
- }
1056
- type ViewTransitionOpts = {
1057
- currentLocation: Location;
1058
- nextLocation: Location;
1059
- };
1060
- /**
1061
- * Subscriber function signature for changes to router state
1062
- */
1063
- interface RouterSubscriber {
1064
- (state: RouterState, opts: {
1065
- deletedFetchers: string[];
1066
- viewTransitionOpts?: ViewTransitionOpts;
1067
- flushSync: boolean;
1068
- }): void;
1069
- }
1070
- /**
1071
- * Function signature for determining the key to be used in scroll restoration
1072
- * for a given location
1073
- */
1074
- interface GetScrollRestorationKeyFunction {
1075
- (location: Location, matches: UIMatch[]): string | null;
1076
- }
1077
- /**
1078
- * Function signature for determining the current scroll position
1079
- */
1080
- interface GetScrollPositionFunction {
1081
- (): number;
1082
- }
1083
- /**
1084
- - "route": relative to the route hierarchy so `..` means remove all segments of the current route even if it has many. For example, a `route("posts/:id")` would have both `:id` and `posts` removed from the url.
1085
- - "path": relative to the pathname so `..` means remove one segment of the pathname. For example, a `route("posts/:id")` would have only `:id` removed from the url.
1086
- */
1087
- type RelativeRoutingType = "route" | "path";
1088
- type BaseNavigateOrFetchOptions = {
1089
- preventScrollReset?: boolean;
1090
- relative?: RelativeRoutingType;
1091
- flushSync?: boolean;
1092
- };
1093
- type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
1094
- replace?: boolean;
1095
- state?: any;
1096
- fromRouteId?: string;
1097
- viewTransition?: boolean;
1098
- };
1099
- type BaseSubmissionOptions = {
1100
- formMethod?: HTMLFormMethod;
1101
- formEncType?: FormEncType;
1102
- } & ({
1103
- formData: FormData;
1104
- body?: undefined;
1105
- } | {
1106
- formData?: undefined;
1107
- body: any;
1108
- });
1109
- /**
1110
- * Options for a navigate() call for a normal (non-submission) navigation
1111
- */
1112
- type LinkNavigateOptions = BaseNavigateOptions;
1113
- /**
1114
- * Options for a navigate() call for a submission navigation
1115
- */
1116
- type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
1117
- /**
1118
- * Options to pass to navigate() for a navigation
1119
- */
1120
- type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
1121
- /**
1122
- * Options for a fetch() load
1123
- */
1124
- type LoadFetchOptions = BaseNavigateOrFetchOptions;
1125
- /**
1126
- * Options for a fetch() submission
1127
- */
1128
- type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
1129
- /**
1130
- * Options to pass to fetch()
1131
- */
1132
- type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
1133
- /**
1134
- * Potential states for state.navigation
1135
- */
1136
- type NavigationStates = {
1137
- Idle: {
1138
- state: "idle";
1139
- location: undefined;
1140
- formMethod: undefined;
1141
- formAction: undefined;
1142
- formEncType: undefined;
1143
- formData: undefined;
1144
- json: undefined;
1145
- text: undefined;
1146
- };
1147
- Loading: {
1148
- state: "loading";
1149
- location: Location;
1150
- formMethod: Submission["formMethod"] | undefined;
1151
- formAction: Submission["formAction"] | undefined;
1152
- formEncType: Submission["formEncType"] | undefined;
1153
- formData: Submission["formData"] | undefined;
1154
- json: Submission["json"] | undefined;
1155
- text: Submission["text"] | undefined;
1156
- };
1157
- Submitting: {
1158
- state: "submitting";
1159
- location: Location;
1160
- formMethod: Submission["formMethod"];
1161
- formAction: Submission["formAction"];
1162
- formEncType: Submission["formEncType"];
1163
- formData: Submission["formData"];
1164
- json: Submission["json"];
1165
- text: Submission["text"];
1166
- };
1167
- };
1168
- type Navigation = NavigationStates[keyof NavigationStates];
1169
- type RevalidationState = "idle" | "loading";
1170
- /**
1171
- * Potential states for fetchers
1172
- */
1173
- type FetcherStates<TData = any> = {
1174
- /**
1175
- * The fetcher is not calling a loader or action
1176
- *
1177
- * ```tsx
1178
- * fetcher.state === "idle"
1179
- * ```
1180
- */
1181
- Idle: {
1182
- state: "idle";
1183
- formMethod: undefined;
1184
- formAction: undefined;
1185
- formEncType: undefined;
1186
- text: undefined;
1187
- formData: undefined;
1188
- json: undefined;
1189
- /**
1190
- * If the fetcher has never been called, this will be undefined.
1191
- */
1192
- data: TData | undefined;
1193
- };
1194
- /**
1195
- * The fetcher is loading data from a {@link LoaderFunction | loader} from a
1196
- * call to {@link FetcherWithComponents.load | `fetcher.load`}.
1197
- *
1198
- * ```tsx
1199
- * // somewhere
1200
- * <button onClick={() => fetcher.load("/some/route") }>Load</button>
1201
- *
1202
- * // the state will update
1203
- * fetcher.state === "loading"
1204
- * ```
1205
- */
1206
- Loading: {
1207
- state: "loading";
1208
- formMethod: Submission["formMethod"] | undefined;
1209
- formAction: Submission["formAction"] | undefined;
1210
- formEncType: Submission["formEncType"] | undefined;
1211
- text: Submission["text"] | undefined;
1212
- formData: Submission["formData"] | undefined;
1213
- json: Submission["json"] | undefined;
1214
- data: TData | undefined;
1215
- };
1216
- /**
1217
- The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
1218
-
1219
- ```tsx
1220
- // somewhere
1221
- <input
1222
- onChange={e => {
1223
- fetcher.submit(event.currentTarget.form, { method: "post" });
1224
- }}
1225
- />
1226
-
1227
- // the state will update
1228
- fetcher.state === "submitting"
1229
-
1230
- // and formData will be available
1231
- fetcher.formData
1232
- ```
1233
- */
1234
- Submitting: {
1235
- state: "submitting";
1236
- formMethod: Submission["formMethod"];
1237
- formAction: Submission["formAction"];
1238
- formEncType: Submission["formEncType"];
1239
- text: Submission["text"];
1240
- formData: Submission["formData"];
1241
- json: Submission["json"];
1242
- data: TData | undefined;
1243
- };
1244
- };
1245
- type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
1246
- interface BlockerBlocked {
1247
- state: "blocked";
1248
- reset(): void;
1249
- proceed(): void;
1250
- location: Location;
1251
- }
1252
- interface BlockerUnblocked {
1253
- state: "unblocked";
1254
- reset: undefined;
1255
- proceed: undefined;
1256
- location: undefined;
1257
- }
1258
- interface BlockerProceeding {
1259
- state: "proceeding";
1260
- reset: undefined;
1261
- proceed: undefined;
1262
- location: Location;
1263
- }
1264
- type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
1265
- type BlockerFunction = (args: {
1266
- currentLocation: Location;
1267
- nextLocation: Location;
1268
- historyAction: Action;
1269
- }) => boolean;
1270
- declare const IDLE_NAVIGATION: NavigationStates["Idle"];
1271
- declare const IDLE_FETCHER: FetcherStates["Idle"];
1272
- declare const IDLE_BLOCKER: BlockerUnblocked;
1273
- /**
1274
- * Create a router and listen to history POP navigations
1275
- */
1276
- declare function createRouter(init: RouterInit): Router;
1277
- interface CreateStaticHandlerOptions {
1278
- basename?: string;
1279
- mapRouteProperties?: MapRoutePropertiesFunction;
1280
- future?: {};
1281
- }
1282
-
1283
- interface IndexRouteObject {
1284
- caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];
1285
- path?: AgnosticIndexRouteObject["path"];
1286
- id?: AgnosticIndexRouteObject["id"];
1287
- unstable_middleware?: AgnosticIndexRouteObject["unstable_middleware"];
1288
- loader?: AgnosticIndexRouteObject["loader"];
1289
- action?: AgnosticIndexRouteObject["action"];
1290
- hasErrorBoundary?: AgnosticIndexRouteObject["hasErrorBoundary"];
1291
- shouldRevalidate?: AgnosticIndexRouteObject["shouldRevalidate"];
1292
- handle?: AgnosticIndexRouteObject["handle"];
1293
- index: true;
1294
- children?: undefined;
1295
- element?: React.ReactNode | null;
1296
- hydrateFallbackElement?: React.ReactNode | null;
1297
- errorElement?: React.ReactNode | null;
1298
- Component?: React.ComponentType | null;
1299
- HydrateFallback?: React.ComponentType | null;
1300
- ErrorBoundary?: React.ComponentType | null;
1301
- lazy?: LazyRouteDefinition<RouteObject>;
1302
- }
1303
- interface NonIndexRouteObject {
1304
- caseSensitive?: AgnosticNonIndexRouteObject["caseSensitive"];
1305
- path?: AgnosticNonIndexRouteObject["path"];
1306
- id?: AgnosticNonIndexRouteObject["id"];
1307
- unstable_middleware?: AgnosticNonIndexRouteObject["unstable_middleware"];
1308
- loader?: AgnosticNonIndexRouteObject["loader"];
1309
- action?: AgnosticNonIndexRouteObject["action"];
1310
- hasErrorBoundary?: AgnosticNonIndexRouteObject["hasErrorBoundary"];
1311
- shouldRevalidate?: AgnosticNonIndexRouteObject["shouldRevalidate"];
1312
- handle?: AgnosticNonIndexRouteObject["handle"];
1313
- index?: false;
1314
- children?: RouteObject[];
1315
- element?: React.ReactNode | null;
1316
- hydrateFallbackElement?: React.ReactNode | null;
1317
- errorElement?: React.ReactNode | null;
1318
- Component?: React.ComponentType | null;
1319
- HydrateFallback?: React.ComponentType | null;
1320
- ErrorBoundary?: React.ComponentType | null;
1321
- lazy?: LazyRouteDefinition<RouteObject>;
1322
- }
1323
- type RouteObject = IndexRouteObject | NonIndexRouteObject;
1324
- type DataRouteObject = RouteObject & {
1325
- children?: DataRouteObject[];
1326
- id: string;
1327
- };
1328
- interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> extends AgnosticRouteMatch<ParamKey, RouteObjectType> {
1329
- }
1330
- interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
1331
- }
1332
- type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
1333
- type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
1334
- interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {
1335
- router: Router;
1336
- staticContext?: StaticHandlerContext;
1337
- }
1338
- declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
1339
- declare const DataRouterStateContext: React.Context<RouterState | null>;
1340
- type ViewTransitionContextObject = {
1341
- isTransitioning: false;
1342
- } | {
1343
- isTransitioning: true;
1344
- flushSync: boolean;
1345
- currentLocation: Location;
1346
- nextLocation: Location;
1347
- };
1348
- declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
1349
- type FetchersContextObject = Map<string, any>;
1350
- declare const FetchersContext: React.Context<FetchersContextObject>;
1351
- interface NavigateOptions {
1352
- /** Replace the current entry in the history stack instead of pushing a new one */
1353
- replace?: boolean;
1354
- /** Adds persistent client side routing state to the next location */
1355
- state?: any;
1356
- /** If you are using {@link https://api.reactrouter.com/v7/functions/react_router.ScrollRestoration.html <ScrollRestoration>}, prevent the scroll position from being reset to the top of the window when navigating */
1357
- preventScrollReset?: boolean;
1358
- /** Defines the relative path behavior for the link. "route" will use the route hierarchy so ".." will remove all URL segments of the current route pattern while "path" will use the URL path so ".." will remove one URL segment. */
1359
- relative?: RelativeRoutingType;
1360
- /** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
1361
- flushSync?: boolean;
1362
- /** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link https://api.reactrouter.com/v7/functions/react_router.useViewTransitionState.html useViewTransitionState()} hook. */
1363
- viewTransition?: boolean;
1364
- }
1365
- /**
1366
- * A Navigator is a "location changer"; it's how you get to different locations.
1367
- *
1368
- * Every history instance conforms to the Navigator interface, but the
1369
- * distinction is useful primarily when it comes to the low-level `<Router>` API
1370
- * where both the location and a navigator must be provided separately in order
1371
- * to avoid "tearing" that may occur in a suspense-enabled app if the action
1372
- * and/or location were to be read directly from the history instance.
1373
- */
1374
- interface Navigator {
1375
- createHref: History["createHref"];
1376
- encodeLocation?: History["encodeLocation"];
1377
- go: History["go"];
1378
- push(to: To, state?: any, opts?: NavigateOptions): void;
1379
- replace(to: To, state?: any, opts?: NavigateOptions): void;
1380
- }
1381
- interface NavigationContextObject {
1382
- basename: string;
1383
- navigator: Navigator;
1384
- static: boolean;
1385
- future: {};
1386
- }
1387
- declare const NavigationContext: React.Context<NavigationContextObject>;
1388
- interface LocationContextObject {
1389
- location: Location;
1390
- navigationType: Action;
1391
- }
1392
- declare const LocationContext: React.Context<LocationContextObject>;
1393
- interface RouteContextObject {
1394
- outlet: React.ReactElement | null;
1395
- matches: RouteMatch[];
1396
- isDataRoute: boolean;
1397
- }
1398
- declare const RouteContext: React.Context<RouteContextObject>;
1399
-
1400
- /**
1401
- * An object of unknown type for route loaders and actions provided by the
1402
- * server's `getLoadContext()` function. This is defined as an empty interface
1403
- * specifically so apps can leverage declaration merging to augment this type
1404
- * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1405
- */
1406
- interface AppLoadContext {
1407
- [key: string]: unknown;
1408
- }
1409
-
1410
- type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1411
- type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
1412
- interface HtmlLinkProps {
1413
- /**
1414
- * Address of the hyperlink
1415
- */
1416
- href?: string;
1417
- /**
1418
- * How the element handles crossorigin requests
1419
- */
1420
- crossOrigin?: "anonymous" | "use-credentials";
1421
- /**
1422
- * Relationship between the document containing the hyperlink and the destination resource
1423
- */
1424
- rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
1425
- /**
1426
- * Applicable media: "screen", "print", "(max-width: 764px)"
1427
- */
1428
- media?: string;
1429
- /**
1430
- * Integrity metadata used in Subresource Integrity checks
1431
- */
1432
- integrity?: string;
1433
- /**
1434
- * Language of the linked resource
1435
- */
1436
- hrefLang?: string;
1437
- /**
1438
- * Hint for the type of the referenced resource
1439
- */
1440
- type?: string;
1441
- /**
1442
- * Referrer policy for fetches initiated by the element
1443
- */
1444
- referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
1445
- /**
1446
- * Sizes of the icons (for rel="icon")
1447
- */
1448
- sizes?: string;
1449
- /**
1450
- * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1451
- */
1452
- as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
1453
- /**
1454
- * Color to use when customizing a site's icon (for rel="mask-icon")
1455
- */
1456
- color?: string;
1457
- /**
1458
- * Whether the link is disabled
1459
- */
1460
- disabled?: boolean;
1461
- /**
1462
- * The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
1463
- */
1464
- title?: string;
1465
- /**
1466
- * Images to use in different situations, e.g., high-resolution displays,
1467
- * small monitors, etc. (for rel="preload")
1468
- */
1469
- imageSrcSet?: string;
1470
- /**
1471
- * Image sizes for different page layouts (for rel="preload")
1472
- */
1473
- imageSizes?: string;
1474
- }
1475
- interface HtmlLinkPreloadImage extends HtmlLinkProps {
1476
- /**
1477
- * Relationship between the document containing the hyperlink and the destination resource
1478
- */
1479
- rel: "preload";
1480
- /**
1481
- * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
1482
- */
1483
- as: "image";
1484
- /**
1485
- * Address of the hyperlink
1486
- */
1487
- href?: string;
1488
- /**
1489
- * Images to use in different situations, e.g., high-resolution displays,
1490
- * small monitors, etc. (for rel="preload")
1491
- */
1492
- imageSrcSet: string;
1493
- /**
1494
- * Image sizes for different page layouts (for rel="preload")
1495
- */
1496
- imageSizes?: string;
1497
- }
1498
- /**
1499
- * Represents a `<link>` element.
1500
- *
1501
- * WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
1502
- */
1503
- type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
1504
- imageSizes?: never;
1505
- });
1506
- interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
1507
- /**
1508
- * The absolute path of the page to prefetch.
1509
- */
1510
- page: string;
1511
- }
1512
- type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1513
-
1514
- interface RouteModules {
1515
- [routeId: string]: RouteModule | undefined;
1516
- }
1517
- /**
1518
- * The shape of a route module shipped to the client
1519
- */
1520
- interface RouteModule {
1521
- clientAction?: ClientActionFunction;
1522
- clientLoader?: ClientLoaderFunction;
1523
- unstable_clientMiddleware?: unstable_MiddlewareFunction<undefined>[];
1524
- ErrorBoundary?: ErrorBoundaryComponent;
1525
- HydrateFallback?: HydrateFallbackComponent;
1526
- Layout?: LayoutComponent;
1527
- default: RouteComponent;
1528
- handle?: RouteHandle;
1529
- links?: LinksFunction;
1530
- meta?: MetaFunction;
1531
- shouldRevalidate?: ShouldRevalidateFunction;
1532
- }
1533
- /**
1534
- * The shape of a route module on the server
1535
- */
1536
- interface ServerRouteModule extends RouteModule {
1537
- action?: ActionFunction;
1538
- headers?: HeadersFunction | {
1539
- [name: string]: string;
1540
- };
1541
- loader?: LoaderFunction;
1542
- unstable_middleware?: unstable_MiddlewareFunction<Response>[];
1543
- }
1544
- /**
1545
- * A function that handles data mutations for a route on the client
1546
- */
1547
- type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
1548
- /**
1549
- * Arguments passed to a route `clientAction` function
1550
- */
1551
- type ClientActionFunctionArgs = ActionFunctionArgs & {
1552
- serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
1553
- };
1554
- /**
1555
- * A function that loads data for a route on the client
1556
- */
1557
- type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
1558
- hydrate?: boolean;
1559
- };
1560
- /**
1561
- * Arguments passed to a route `clientLoader` function
1562
- */
1563
- type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
1564
- serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
1565
- };
1566
- /**
1567
- * ErrorBoundary to display for this route
1568
- */
1569
- type ErrorBoundaryComponent = ComponentType;
1570
- type HeadersArgs = {
1571
- loaderHeaders: Headers;
1572
- parentHeaders: Headers;
1573
- actionHeaders: Headers;
1574
- errorHeaders: Headers | undefined;
1575
- };
1576
- /**
1577
- * A function that returns HTTP headers to be used for a route. These headers
1578
- * will be merged with (and take precedence over) headers from parent routes.
1579
- */
1580
- interface HeadersFunction {
1581
- (args: HeadersArgs): Headers | HeadersInit;
1582
- }
1583
- /**
1584
- * `<Route HydrateFallback>` component to render on initial loads
1585
- * when client loaders are present
1586
- */
1587
- type HydrateFallbackComponent = ComponentType;
1588
- /**
1589
- * Optional, root-only `<Route Layout>` component to wrap the root content in.
1590
- * Useful for defining the <html>/<head>/<body> document shell shared by the
1591
- * Component, HydrateFallback, and ErrorBoundary
1592
- */
1593
- type LayoutComponent = ComponentType<{
1594
- children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
1595
- }>;
1596
- /**
1597
- * A function that defines `<link>` tags to be inserted into the `<head>` of
1598
- * the document on route transitions.
1599
- *
1600
- * @see https://remix.run/route/meta
1601
- */
1602
- interface LinksFunction {
1603
- (): LinkDescriptor[];
1604
- }
1605
- interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
1606
- id: RouteId;
1607
- pathname: DataRouteMatch["pathname"];
1608
- data: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
1609
- handle?: RouteHandle;
1610
- params: DataRouteMatch["params"];
1611
- meta: MetaDescriptor[];
1612
- error?: unknown;
1613
- }
1614
- type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{
1615
- [K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>;
1616
- }[keyof MatchLoaders]>;
1617
- interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1618
- data: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
1619
- params: Params;
1620
- location: Location;
1621
- matches: MetaMatches<MatchLoaders>;
1622
- error?: unknown;
1623
- }
1624
- /**
1625
- * A function that returns an array of data objects to use for rendering
1626
- * metadata HTML tags in a route. These tags are not rendered on descendant
1627
- * routes in the route hierarchy. In other words, they will only be rendered on
1628
- * the route in which they are exported.
1629
- *
1630
- * @param Loader - The type of the current route's loader function
1631
- * @param MatchLoaders - Mapping from a parent route's filepath to its loader
1632
- * function type
1633
- *
1634
- * Note that parent route filepaths are relative to the `app/` directory.
1635
- *
1636
- * For example, if this meta function is for `/sales/customers/$customerId`:
1637
- *
1638
- * ```ts
1639
- * // app/root.tsx
1640
- * const loader = () => ({ hello: "world" })
1641
- * export type Loader = typeof loader
1642
- *
1643
- * // app/routes/sales.tsx
1644
- * const loader = () => ({ salesCount: 1074 })
1645
- * export type Loader = typeof loader
1646
- *
1647
- * // app/routes/sales/customers.tsx
1648
- * const loader = () => ({ customerCount: 74 })
1649
- * export type Loader = typeof loader
1650
- *
1651
- * // app/routes/sales/customers/$customersId.tsx
1652
- * import type { Loader as RootLoader } from "../../../root"
1653
- * import type { Loader as SalesLoader } from "../../sales"
1654
- * import type { Loader as CustomersLoader } from "../../sales/customers"
1655
- *
1656
- * const loader = () => ({ name: "Customer name" })
1657
- *
1658
- * const meta: MetaFunction<typeof loader, {
1659
- * "root": RootLoader,
1660
- * "routes/sales": SalesLoader,
1661
- * "routes/sales/customers": CustomersLoader,
1662
- * }> = ({ data, matches }) => {
1663
- * const { name } = data
1664
- * // ^? string
1665
- * const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").data
1666
- * // ^? number
1667
- * const { salesCount } = matches.find((match) => match.id === "routes/sales").data
1668
- * // ^? number
1669
- * const { hello } = matches.find((match) => match.id === "root").data
1670
- * // ^? "world"
1671
- * }
1672
- * ```
1673
- */
1674
- interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
1675
- (args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
1676
- }
1677
- type MetaDescriptor = {
1678
- charSet: "utf-8";
1679
- } | {
1680
- title: string;
1681
- } | {
1682
- name: string;
1683
- content: string;
1684
- } | {
1685
- property: string;
1686
- content: string;
1687
- } | {
1688
- httpEquiv: string;
1689
- content: string;
1690
- } | {
1691
- "script:ld+json": LdJsonObject;
1692
- } | {
1693
- tagName: "meta" | "link";
1694
- [name: string]: string;
1695
- } | {
1696
- [name: string]: unknown;
1697
- };
1698
- type LdJsonObject = {
1699
- [Key in string]: LdJsonValue;
1700
- } & {
1701
- [Key in string]?: LdJsonValue | undefined;
1702
- };
1703
- type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
1704
- type LdJsonPrimitive = string | number | boolean | null;
1705
- type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
1706
- /**
1707
- * A React component that is rendered for a route.
1708
- */
1709
- type RouteComponent = ComponentType<{}>;
1710
- /**
1711
- * An arbitrary object that is associated with a route.
1712
- *
1713
- * @see https://remix.run/route/handle
1714
- */
1715
- type RouteHandle = unknown;
1716
-
1717
- type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1718
- [key: PropertyKey]: Serializable;
1719
- } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1720
-
1721
- /**
1722
- * A brand that can be applied to a type to indicate that it will serialize
1723
- * to a specific type when transported to the client from a loader.
1724
- * Only use this if you have additional serialization/deserialization logic
1725
- * in your application.
1726
- */
1727
- type unstable_SerializesTo<T> = {
1728
- unstable__ReactRouter_SerializesTo: [T];
1729
- };
1730
-
1731
- type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1732
- type IsAny<T> = 0 extends 1 & T ? true : false;
1733
- type Func = (...args: any[]) => unknown;
1734
- type Pretty<T> = {
1735
- [K in keyof T]: T[K];
1736
- } & {};
1737
-
1738
- type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1739
- [K in keyof T]: Serialize<T[K]>;
1740
- } : undefined;
1741
- type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1742
- type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1743
- type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
1744
- type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1745
- type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1746
- type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1747
- type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1748
-
1749
- export { type RouterState as $, Action as A, type BlockerFunction as B, type ClientLoaderFunction as C, type DataStrategyFunction as D, type PageLinkDescriptor as E, type FutureConfig as F, type History as G, type HydrationState as H, type InitialEntry as I, type GetScrollRestorationKeyFunction as J, type Fetcher as K, type LazyRouteFunction as L, type MiddlewareEnabled as M, type NonIndexRouteObject as N, type StaticHandler as O, type PatchRoutesOnNavigationFunction as P, type CreateStaticHandlerOptions as Q, type RouteObject as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type unstable_InitialContext as V, type LoaderFunction as W, type ActionFunction as X, type MetaFunction as Y, type LinksFunction as Z, type Equal as _, type RouterInit as a, type GetScrollPositionFunction as a0, type NavigationStates as a1, type RouterSubscriber as a2, type RouterNavigateOptions as a3, type RouterFetchOptions as a4, type RevalidationState as a5, type DataStrategyFunctionArgs as a6, type DataStrategyMatch as a7, type DataStrategyResult as a8, DataWithResponseInit as a9, type ClientActionFunctionArgs as aA, type ClientLoaderFunctionArgs as aB, type HeadersArgs as aC, type HeadersFunction as aD, type MetaArgs as aE, type MetaDescriptor as aF, type HtmlLinkDescriptor as aG, type LinkDescriptor as aH, type Future as aI, type unstable_SerializesTo as aJ, createBrowserHistory as aK, invariant as aL, createRouter as aM, ErrorResponseImpl as aN, DataRouterContext as aO, DataRouterStateContext as aP, FetchersContext as aQ, LocationContext as aR, NavigationContext as aS, RouteContext as aT, ViewTransitionContext as aU, type ServerDataFrom as aV, type ClientDataFrom as aW, type Func as aX, type unstable_MiddlewareNextFunction as aY, type Pretty as aZ, type ErrorResponse as aa, type FormMethod as ab, type unstable_MiddlewareFunction as ac, type PathParam as ad, type RedirectFunction as ae, type unstable_RouterContext as af, type ShouldRevalidateFunction as ag, type ShouldRevalidateFunctionArgs as ah, unstable_createContext as ai, createPath as aj, parsePath as ak, IDLE_NAVIGATION as al, IDLE_FETCHER as am, IDLE_BLOCKER as an, data as ao, generatePath as ap, isRouteErrorResponse as aq, matchPath as ar, matchRoutes as as, redirect as at, redirectDocument as au, replace as av, resolvePath as aw, type DataRouteMatch as ax, type PatchRoutesOnNavigationFunctionArgs as ay, type ClientActionFunction as az, type Router as b, type RelativeRoutingType as c, type IndexRouteObject as d, type Location as e, type Navigator as f, type RouteMatch as g, type RouteManifest as h, type AppLoadContext as i, type LoaderFunctionArgs as j, type ActionFunctionArgs as k, type StaticHandlerContext as l, type RouteModules as m, type DataRouteObject as n, type ParamParseKey as o, type Path as p, type PathPattern as q, type PathMatch as r, type NavigateOptions as s, type Params as t, unstable_RouterContextProvider as u, type Navigation as v, type SerializeFrom as w, type Blocker as x, type HTMLFormMethod as y, type FormEncType as z };