react-router 7.7.0-pre.1 → 7.7.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 (58) hide show
  1. package/CHANGELOG.md +9 -7
  2. package/dist/development/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
  3. package/dist/development/{chunk-6ZHKKNZG.js → chunk-4ADB4KIO.js} +170 -140
  4. package/dist/development/{chunk-YNUF36W5.mjs → chunk-EF7DTUVF.mjs} +52 -22
  5. package/dist/{production/chunk-KZZC37RO.mjs → development/chunk-T3VM44WY.mjs} +31 -26
  6. package/dist/development/{chunk-Z7T4GLA7.js → chunk-V6PEDDZI.js} +1 -1
  7. package/dist/development/components-DzqPLVI1.d.mts +464 -0
  8. package/dist/development/dom-export.d.mts +3 -3
  9. package/dist/development/dom-export.js +3 -3
  10. package/dist/development/dom-export.mjs +3 -3
  11. package/dist/{production/index-react-server-client-DOK8MfYF.d.mts → development/index-react-server-client-CUidsuu_.d.mts} +2 -2
  12. package/dist/development/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
  13. package/dist/development/index-react-server-client.d.mts +3 -3
  14. package/dist/development/index-react-server-client.d.ts +2 -2
  15. package/dist/development/index-react-server-client.js +10 -4
  16. package/dist/development/index-react-server-client.mjs +9 -3
  17. package/dist/development/index-react-server.js +20 -6
  18. package/dist/development/index-react-server.mjs +21 -6
  19. package/dist/development/index.d.mts +396 -9
  20. package/dist/development/index.d.ts +372 -12
  21. package/dist/development/index.js +131 -120
  22. package/dist/development/index.mjs +9 -3
  23. package/dist/development/lib/types/internal.d.mts +1 -1
  24. package/dist/development/lib/types/internal.d.ts +1 -1
  25. package/dist/development/lib/types/internal.js +1 -1
  26. package/dist/development/lib/types/internal.mjs +1 -1
  27. package/dist/{production/route-data-DAw7Esur.d.mts → development/route-data-DjzmHYNR.d.mts} +1 -1
  28. package/dist/{production/route-data-7aXBQ4I3.d.ts → development/routeModules-g5PTiDfO.d.ts} +156 -156
  29. package/dist/production/{browser-BSrXyLft.d.mts → browser-CcxeZJcQ.d.mts} +3 -30
  30. package/dist/production/{chunk-W77PDD2Y.js → chunk-2TYFPE3B.js} +170 -140
  31. package/dist/production/{chunk-SH44XSL4.js → chunk-5KHO4FML.js} +1 -1
  32. package/dist/{development/chunk-YP7CIEHK.mjs → production/chunk-GNZILI6H.mjs} +31 -26
  33. package/dist/production/{chunk-4FKAWASN.mjs → chunk-WPPIQDYG.mjs} +52 -22
  34. package/dist/production/components-DzqPLVI1.d.mts +464 -0
  35. package/dist/production/dom-export.d.mts +3 -3
  36. package/dist/production/dom-export.js +3 -3
  37. package/dist/production/dom-export.mjs +3 -3
  38. package/dist/{development/index-react-server-client-DOK8MfYF.d.mts → production/index-react-server-client-CUidsuu_.d.mts} +2 -2
  39. package/dist/production/{index-react-server-client-LrDNRnlX.d.ts → index-react-server-client-kY8DvDF3.d.ts} +177 -529
  40. package/dist/production/index-react-server-client.d.mts +3 -3
  41. package/dist/production/index-react-server-client.d.ts +2 -2
  42. package/dist/production/index-react-server-client.js +10 -4
  43. package/dist/production/index-react-server-client.mjs +9 -3
  44. package/dist/production/index-react-server.js +20 -6
  45. package/dist/production/index-react-server.mjs +21 -6
  46. package/dist/production/index.d.mts +396 -9
  47. package/dist/production/index.d.ts +372 -12
  48. package/dist/production/index.js +131 -120
  49. package/dist/production/index.mjs +9 -3
  50. package/dist/production/lib/types/internal.d.mts +1 -1
  51. package/dist/production/lib/types/internal.d.ts +1 -1
  52. package/dist/production/lib/types/internal.js +1 -1
  53. package/dist/production/lib/types/internal.mjs +1 -1
  54. package/dist/{development/route-data-DAw7Esur.d.mts → production/route-data-DjzmHYNR.d.mts} +1 -1
  55. package/dist/{development/route-data-7aXBQ4I3.d.ts → production/routeModules-g5PTiDfO.d.ts} +156 -156
  56. package/package.json +1 -1
  57. package/dist/development/components-IaVqGBuO.d.mts +0 -816
  58. package/dist/production/components-IaVqGBuO.d.mts +0 -816
@@ -1,506 +1,6 @@
1
- import { aY as RouteManifest, aZ as ServerRouteModule, m as MiddlewareEnabled, l as unstable_RouterContextProvider, k as AppLoadContext, a9 as LoaderFunctionArgs, $ as ActionFunctionArgs, e as RouteModules, J as StaticHandlerContext, H as HydrationState, x as DataRouteObject, p as ClientLoaderFunction, T as To, aA as NavigateOptions, W as BlockerFunction, V as Blocker, a_ as SerializeFrom, U as RelativeRoutingType, a as Location, ab as ParamParseKey, y as Path, ae as PathPattern, ac as PathMatch, ai as UIMatch, O as Navigation, ak as Action, s as Params, d as Router$1, aE as RouteObject, I as InitialEntry, j as NonIndexRouteObject, a8 as LazyRouteFunction, f as IndexRouteObject, aB as Navigator, t as RouterInit, a$ as FutureConfig$1, D as DataStrategyFunction, w as PatchRoutesOnNavigationFunction, aD as RouteMatch, a7 as HTMLFormMethod, a5 as FormEncType, aJ as PageLinkDescriptor, b0 as History, F as GetScrollRestorationKeyFunction, K as Fetcher, b1 as CreateStaticHandlerOptions$1, z as StaticHandler } from './route-data-7aXBQ4I3.js';
1
+ import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, ag as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aD as Navigator, d as Router$1, V as RouterInit, aZ as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, X as PatchRoutesOnNavigationFunction, p as RouteObject, aF as RouteMatch, o as Params, U as UIMatch, af as HTMLFormMethod, ad as FormEncType, a_ as RouteManifest, a$ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ah as LoaderFunctionArgs, a7 as ActionFunctionArgs, e as RouteModules, Y as DataRouteObject, K as ClientLoaderFunction, a0 as StaticHandlerContext, aK as PageLinkDescriptor, b0 as History, $ as GetScrollRestorationKeyFunction, f as NavigateOptions, a1 as Fetcher, h as SerializeFrom, B as BlockerFunction, b1 as CreateStaticHandlerOptions$1, Z as StaticHandler } from './routeModules-g5PTiDfO.js';
2
2
  import * as React from 'react';
3
3
 
4
- type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
5
- interface ServerRoute extends Route$1 {
6
- children: ServerRoute[];
7
- module: ServerRouteModule;
8
- }
9
-
10
- type OptionalCriticalCss = CriticalCss | undefined;
11
- /**
12
- * The output of the compiler for the server build.
13
- */
14
- interface ServerBuild {
15
- entry: {
16
- module: ServerEntryModule;
17
- };
18
- routes: ServerRouteManifest;
19
- assets: AssetsManifest;
20
- basename?: string;
21
- publicPath: string;
22
- assetsBuildDirectory: string;
23
- future: FutureConfig;
24
- ssr: boolean;
25
- unstable_getCriticalCss?: (args: {
26
- pathname: string;
27
- }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
28
- /**
29
- * @deprecated This is now done via a custom header during prerendering
30
- */
31
- isSpaMode: boolean;
32
- prerender: string[];
33
- routeDiscovery: {
34
- mode: "lazy" | "initial";
35
- manifestPath: string;
36
- };
37
- }
38
- interface HandleDocumentRequestFunction {
39
- (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext): Promise<Response> | Response;
40
- }
41
- interface HandleDataRequestFunction {
42
- (response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
43
- }
44
- interface HandleErrorFunction {
45
- (error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
46
- }
47
- /**
48
- * A module that serves as the entry point for a Remix app during server
49
- * rendering.
50
- */
51
- interface ServerEntryModule {
52
- default: HandleDocumentRequestFunction;
53
- handleDataRequest?: HandleDataRequestFunction;
54
- handleError?: HandleErrorFunction;
55
- streamTimeout?: number;
56
- }
57
-
58
- type SerializedError = {
59
- message: string;
60
- stack?: string;
61
- };
62
- interface FrameworkContextObject {
63
- manifest: AssetsManifest;
64
- routeModules: RouteModules;
65
- criticalCss?: CriticalCss;
66
- serverHandoffString?: string;
67
- future: FutureConfig;
68
- ssr: boolean;
69
- isSpaMode: boolean;
70
- routeDiscovery: ServerBuild["routeDiscovery"];
71
- serializeError?(error: Error): SerializedError;
72
- renderMeta?: {
73
- didRenderScripts?: boolean;
74
- streamCache?: Record<number, Promise<void> & {
75
- result?: {
76
- done: boolean;
77
- value: string;
78
- };
79
- error?: unknown;
80
- }>;
81
- };
82
- }
83
- interface EntryContext extends FrameworkContextObject {
84
- staticHandlerContext: StaticHandlerContext;
85
- serverHandoffStream?: ReadableStream<Uint8Array>;
86
- }
87
- interface FutureConfig {
88
- unstable_subResourceIntegrity: boolean;
89
- unstable_middleware: boolean;
90
- }
91
- type CriticalCss = string | {
92
- rel: "stylesheet";
93
- href: string;
94
- };
95
- interface AssetsManifest {
96
- entry: {
97
- imports: string[];
98
- module: string;
99
- };
100
- routes: RouteManifest<EntryRoute>;
101
- url: string;
102
- version: string;
103
- hmr?: {
104
- timestamp?: number;
105
- runtime: string;
106
- };
107
- sri?: Record<string, string> | true;
108
- }
109
-
110
- interface Route$1 {
111
- index?: boolean;
112
- caseSensitive?: boolean;
113
- id: string;
114
- parentId?: string;
115
- path?: string;
116
- }
117
- interface EntryRoute extends Route$1 {
118
- hasAction: boolean;
119
- hasLoader: boolean;
120
- hasClientAction: boolean;
121
- hasClientLoader: boolean;
122
- hasClientMiddleware: boolean;
123
- hasErrorBoundary: boolean;
124
- imports?: string[];
125
- css?: string[];
126
- module: string;
127
- clientActionModule: string | undefined;
128
- clientLoaderModule: string | undefined;
129
- clientMiddlewareModule: string | undefined;
130
- hydrateFallbackModule: string | undefined;
131
- parentId?: string;
132
- }
133
- declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
134
- declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
135
- declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
136
-
137
- /**
138
- Resolves a URL against the current location.
139
-
140
- ```tsx
141
- import { useHref } from "react-router"
142
-
143
- function SomeComponent() {
144
- let href = useHref("some/where");
145
- // "/resolved/some/where"
146
- }
147
- ```
148
-
149
- @category Hooks
150
- */
151
- declare function useHref(to: To, { relative }?: {
152
- relative?: RelativeRoutingType;
153
- }): string;
154
- /**
155
- * Returns true if this component is a descendant of a Router, useful to ensure
156
- * a component is used within a Router.
157
- *
158
- * @category Hooks
159
- */
160
- declare function useInRouterContext(): boolean;
161
- /**
162
- Returns the current {@link Location}. This can be useful if you'd like to perform some side effect whenever it changes.
163
-
164
- ```tsx
165
- import * as React from 'react'
166
- import { useLocation } from 'react-router'
167
-
168
- function SomeComponent() {
169
- let location = useLocation()
170
-
171
- React.useEffect(() => {
172
- // Google Analytics
173
- ga('send', 'pageview')
174
- }, [location]);
175
-
176
- return (
177
- // ...
178
- );
179
- }
180
- ```
181
-
182
- @category Hooks
183
- */
184
- declare function useLocation(): Location;
185
- /**
186
- * Returns the current navigation action which describes how the router came to
187
- * the current location, either by a pop, push, or replace on the history stack.
188
- *
189
- * @category Hooks
190
- */
191
- declare function useNavigationType(): Action;
192
- /**
193
- * Returns a PathMatch object if the given pattern matches the current URL.
194
- * This is useful for components that need to know "active" state, e.g.
195
- * `<NavLink>`.
196
- *
197
- * @category Hooks
198
- */
199
- declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
200
- /**
201
- * The interface for the navigate() function returned from useNavigate().
202
- */
203
- interface NavigateFunction {
204
- (to: To, options?: NavigateOptions): void | Promise<void>;
205
- (delta: number): void | Promise<void>;
206
- }
207
- /**
208
- Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
209
-
210
- ```tsx
211
- import { useNavigate } from "react-router";
212
-
213
- function SomeComponent() {
214
- let navigate = useNavigate();
215
- return (
216
- <button
217
- onClick={() => {
218
- navigate(-1);
219
- }}
220
- />
221
- );
222
- }
223
- ```
224
-
225
- It's often better to use {@link redirect} in {@link ActionFunction | actions} and {@link LoaderFunction | loaders} than this hook.
226
-
227
- @category Hooks
228
- */
229
- declare function useNavigate(): NavigateFunction;
230
- /**
231
- * Returns the parent route {@link OutletProps.context | `<Outlet context>`}.
232
- *
233
- * @category Hooks
234
- */
235
- declare function useOutletContext<Context = unknown>(): Context;
236
- /**
237
- * Returns the element for the child route at this level of the route
238
- * hierarchy. Used internally by `<Outlet>` to render child routes.
239
- *
240
- * @category Hooks
241
- */
242
- declare function useOutlet(context?: unknown): React.ReactElement | null;
243
- /**
244
- Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
245
-
246
- ```tsx
247
- import { useParams } from "react-router"
248
-
249
- function SomeComponent() {
250
- let params = useParams()
251
- params.postId
252
- }
253
- ```
254
-
255
- Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
256
-
257
- @category Hooks
258
- */
259
- declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
260
- ParamsOrKey
261
- ] extends [string] ? Params<ParamsOrKey> : Partial<ParamsOrKey>>;
262
- /**
263
- Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
264
-
265
- ```tsx
266
- import { useResolvedPath } from "react-router"
267
-
268
- function SomeComponent() {
269
- // if the user is at /dashboard/profile
270
- let path = useResolvedPath("../accounts")
271
- path.pathname // "/dashboard/accounts"
272
- path.search // ""
273
- path.hash // ""
274
- }
275
- ```
276
-
277
- @category Hooks
278
- */
279
- declare function useResolvedPath(to: To, { relative }?: {
280
- relative?: RelativeRoutingType;
281
- }): Path;
282
- /**
283
- Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props.
284
-
285
- The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
286
-
287
- ```tsx
288
- import * as React from "react";
289
- import { useRoutes } from "react-router";
290
-
291
- function App() {
292
- let element = useRoutes([
293
- {
294
- path: "/",
295
- element: <Dashboard />,
296
- children: [
297
- {
298
- path: "messages",
299
- element: <DashboardMessages />,
300
- },
301
- { path: "tasks", element: <DashboardTasks /> },
302
- ],
303
- },
304
- { path: "team", element: <AboutPage /> },
305
- ]);
306
-
307
- return element;
308
- }
309
- ```
310
-
311
- @category Hooks
312
- */
313
- declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
314
- /**
315
- Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress. You can use this to render pending UI (like a global spinner) or read FormData from a form navigation.
316
-
317
- ```tsx
318
- import { useNavigation } from "react-router"
319
-
320
- function SomeComponent() {
321
- let navigation = useNavigation();
322
- navigation.state
323
- navigation.formData
324
- // etc.
325
- }
326
- ```
327
-
328
- @category Hooks
329
- */
330
- declare function useNavigation(): Navigation;
331
- /**
332
- Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.
333
-
334
- ```tsx
335
- import { useRevalidator } from "react-router";
336
-
337
- function WindowFocusRevalidator() {
338
- const revalidator = useRevalidator();
339
-
340
- useFakeWindowFocus(() => {
341
- revalidator.revalidate();
342
- });
343
-
344
- return (
345
- <div hidden={revalidator.state === "idle"}>
346
- Revalidating...
347
- </div>
348
- );
349
- }
350
- ```
351
-
352
- Note that page data is already revalidated automatically after actions. If you find yourself using this for normal CRUD operations on your data in response to user interactions, you're probably not taking advantage of the other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do this automatically.
353
-
354
- @category Hooks
355
- */
356
- declare function useRevalidator(): {
357
- revalidate: () => Promise<void>;
358
- state: Router$1["state"]["revalidation"];
359
- };
360
- /**
361
- * Returns the active route matches, useful for accessing loaderData for
362
- * parent/child routes or the route "handle" property
363
- *
364
- * @category Hooks
365
- */
366
- declare function useMatches(): UIMatch[];
367
- /**
368
- Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}.
369
-
370
- ```tsx
371
- import { useLoaderData } from "react-router"
372
-
373
- export async function loader() {
374
- return await fakeDb.invoices.findAll();
375
- }
376
-
377
- export default function Invoices() {
378
- let invoices = useLoaderData<typeof loader>();
379
- // ...
380
- }
381
- ```
382
-
383
- @category Hooks
384
- */
385
- declare function useLoaderData<T = any>(): SerializeFrom<T>;
386
- /**
387
- Returns the loader data for a given route by route ID.
388
-
389
- ```tsx
390
- import { useRouteLoaderData } from "react-router";
391
-
392
- function SomeComponent() {
393
- const { user } = useRouteLoaderData("root");
394
- }
395
- ```
396
-
397
- Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension.
398
-
399
- | Route Filename | Route ID |
400
- | -------------------------- | -------------------- |
401
- | `app/root.tsx` | `"root"` |
402
- | `app/routes/teams.tsx` | `"routes/teams"` |
403
- | `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` |
404
-
405
- If you created an ID manually, you can use that instead:
406
-
407
- ```tsx
408
- route("/", "containers/app.tsx", { id: "app" }})
409
- ```
410
-
411
- @category Hooks
412
- */
413
- declare function useRouteLoaderData<T = any>(routeId: string): SerializeFrom<T> | undefined;
414
- /**
415
- Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one.
416
-
417
- ```tsx
418
- import { Form, useActionData } from "react-router"
419
-
420
- export async function action({ request }) {
421
- const body = await request.formData()
422
- const name = body.get("visitorsName")
423
- return { message: `Hello, ${name}` }
424
- }
425
-
426
- export default function Invoices() {
427
- const data = useActionData()
428
- return (
429
- <Form method="post">
430
- <input type="text" name="visitorsName" />
431
- {data ? data.message : "Waiting..."}
432
- </Form>
433
- )
434
- }
435
- ```
436
-
437
- @category Hooks
438
- */
439
- declare function useActionData<T = any>(): SerializeFrom<T> | undefined;
440
- /**
441
- Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary.
442
-
443
- ```tsx
444
- export function ErrorBoundary() {
445
- const error = useRouteError();
446
- return <div>{error.message}</div>;
447
- }
448
- ```
449
-
450
- @category Hooks
451
- */
452
- declare function useRouteError(): unknown;
453
- /**
454
- Returns the resolved promise value from the closest {@link Await | `<Await>`}.
455
-
456
- ```tsx
457
- function SomeDescendant() {
458
- const value = useAsyncValue();
459
- // ...
460
- }
461
-
462
- // somewhere in your app
463
- <Await resolve={somePromise}>
464
- <SomeDescendant />
465
- </Await>
466
- ```
467
-
468
- @category Hooks
469
- */
470
- declare function useAsyncValue(): unknown;
471
- /**
472
- Returns the rejection value from the closest {@link Await | `<Await>`}.
473
-
474
- ```tsx
475
- import { Await, useAsyncError } from "react-router"
476
-
477
- function ErrorElement() {
478
- const error = useAsyncError();
479
- return (
480
- <p>Uh Oh, something went wrong! {error.message}</p>
481
- );
482
- }
483
-
484
- // somewhere in your app
485
- <Await
486
- resolve={promiseThatRejects}
487
- errorElement={<ErrorElement />}
488
- />
489
- ```
490
-
491
- @category Hooks
492
- */
493
- declare function useAsyncError(): unknown;
494
- /**
495
- * Allow the application to block navigations within the SPA and present the
496
- * user a confirmation dialog to confirm the navigation. Mostly used to avoid
497
- * using half-filled form data. This does not handle hard-reloads or
498
- * cross-origin navigations.
499
- *
500
- * @category Hooks
501
- */
502
- declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
503
-
504
4
  /**
505
5
  * @private
506
6
  */
@@ -693,7 +193,7 @@ type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
693
193
  *
694
194
  * @category Components
695
195
  */
696
- declare function Route(_props: RouteProps): React.ReactElement | null;
196
+ declare function Route$1(_props: RouteProps): React.ReactElement | null;
697
197
  /**
698
198
  * @category Types
699
199
  */
@@ -911,38 +411,53 @@ declare let createRoutesFromElements: typeof createRoutesFromChildren;
911
411
  * @category Utils
912
412
  */
913
413
  declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
914
- type RouteComponentType = React.ComponentType<{
915
- params: ReturnType<typeof useParams>;
916
- loaderData: ReturnType<typeof useLoaderData>;
917
- actionData: ReturnType<typeof useActionData>;
918
- matches: ReturnType<typeof useMatches>;
919
- }>;
414
+ declare function useRouteComponentProps(): {
415
+ params: Readonly<Params<string>>;
416
+ loaderData: any;
417
+ actionData: any;
418
+ matches: UIMatch<unknown, unknown>[];
419
+ };
420
+ type RouteComponentProps = ReturnType<typeof useRouteComponentProps>;
421
+ type RouteComponentType = React.ComponentType<RouteComponentProps>;
422
+ declare function WithComponentProps({ children, }: {
423
+ children: React.ReactElement;
424
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
920
425
  declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{
921
- params: Readonly<Partial<string | Record<string, string | undefined>>>;
922
- loaderData: unknown;
923
- actionData: unknown;
426
+ params: Readonly<Params<string>>;
427
+ loaderData: any;
428
+ actionData: any;
924
429
  matches: UIMatch<unknown, unknown>[];
925
430
  }, string | React.JSXElementConstructor<any>>;
926
- type HydrateFallbackType = React.ComponentType<{
927
- params: ReturnType<typeof useParams>;
928
- loaderData: ReturnType<typeof useLoaderData>;
929
- actionData: ReturnType<typeof useActionData>;
930
- }>;
431
+ declare function useHydrateFallbackProps(): {
432
+ params: Readonly<Params<string>>;
433
+ loaderData: any;
434
+ actionData: any;
435
+ };
436
+ type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>;
437
+ type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>;
438
+ declare function WithHydrateFallbackProps({ children, }: {
439
+ children: React.ReactElement;
440
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
931
441
  declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{
932
- params: Readonly<Partial<string | Record<string, string | undefined>>>;
933
- loaderData: unknown;
934
- actionData: unknown;
442
+ params: Readonly<Params<string>>;
443
+ loaderData: any;
444
+ actionData: any;
935
445
  }, string | React.JSXElementConstructor<any>>;
936
- type ErrorBoundaryType = React.ComponentType<{
937
- params: ReturnType<typeof useParams>;
938
- loaderData: ReturnType<typeof useLoaderData>;
939
- actionData: ReturnType<typeof useActionData>;
940
- error: ReturnType<typeof useRouteError>;
941
- }>;
446
+ declare function useErrorBoundaryProps(): {
447
+ params: Readonly<Params<string>>;
448
+ loaderData: any;
449
+ actionData: any;
450
+ error: unknown;
451
+ };
452
+ type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>;
453
+ type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>;
454
+ declare function WithErrorBoundaryProps({ children, }: {
455
+ children: React.ReactElement;
456
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
942
457
  declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{
943
- params: Readonly<Partial<string | Record<string, string | undefined>>>;
944
- loaderData: unknown;
945
- actionData: unknown;
458
+ params: Readonly<Params<string>>;
459
+ loaderData: any;
460
+ actionData: any;
946
461
  error: unknown;
947
462
  }, string | React.JSXElementConstructor<any>>;
948
463
 
@@ -1052,6 +567,139 @@ interface SubmitOptions extends FetcherSubmitOptions {
1052
567
  viewTransition?: boolean;
1053
568
  }
1054
569
 
570
+ type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
571
+ interface ServerRoute extends Route {
572
+ children: ServerRoute[];
573
+ module: ServerRouteModule;
574
+ }
575
+
576
+ type OptionalCriticalCss = CriticalCss | undefined;
577
+ /**
578
+ * The output of the compiler for the server build.
579
+ */
580
+ interface ServerBuild {
581
+ entry: {
582
+ module: ServerEntryModule;
583
+ };
584
+ routes: ServerRouteManifest;
585
+ assets: AssetsManifest;
586
+ basename?: string;
587
+ publicPath: string;
588
+ assetsBuildDirectory: string;
589
+ future: FutureConfig;
590
+ ssr: boolean;
591
+ unstable_getCriticalCss?: (args: {
592
+ pathname: string;
593
+ }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
594
+ /**
595
+ * @deprecated This is now done via a custom header during prerendering
596
+ */
597
+ isSpaMode: boolean;
598
+ prerender: string[];
599
+ routeDiscovery: {
600
+ mode: "lazy" | "initial";
601
+ manifestPath: string;
602
+ };
603
+ }
604
+ interface HandleDocumentRequestFunction {
605
+ (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext): Promise<Response> | Response;
606
+ }
607
+ interface HandleDataRequestFunction {
608
+ (response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
609
+ }
610
+ interface HandleErrorFunction {
611
+ (error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
612
+ }
613
+ /**
614
+ * A module that serves as the entry point for a Remix app during server
615
+ * rendering.
616
+ */
617
+ interface ServerEntryModule {
618
+ default: HandleDocumentRequestFunction;
619
+ handleDataRequest?: HandleDataRequestFunction;
620
+ handleError?: HandleErrorFunction;
621
+ streamTimeout?: number;
622
+ }
623
+
624
+ interface Route {
625
+ index?: boolean;
626
+ caseSensitive?: boolean;
627
+ id: string;
628
+ parentId?: string;
629
+ path?: string;
630
+ }
631
+ interface EntryRoute extends Route {
632
+ hasAction: boolean;
633
+ hasLoader: boolean;
634
+ hasClientAction: boolean;
635
+ hasClientLoader: boolean;
636
+ hasClientMiddleware: boolean;
637
+ hasErrorBoundary: boolean;
638
+ imports?: string[];
639
+ css?: string[];
640
+ module: string;
641
+ clientActionModule: string | undefined;
642
+ clientLoaderModule: string | undefined;
643
+ clientMiddlewareModule: string | undefined;
644
+ hydrateFallbackModule: string | undefined;
645
+ parentId?: string;
646
+ }
647
+ declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
648
+ declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
649
+ declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
650
+
651
+ type SerializedError = {
652
+ message: string;
653
+ stack?: string;
654
+ };
655
+ interface FrameworkContextObject {
656
+ manifest: AssetsManifest;
657
+ routeModules: RouteModules;
658
+ criticalCss?: CriticalCss;
659
+ serverHandoffString?: string;
660
+ future: FutureConfig;
661
+ ssr: boolean;
662
+ isSpaMode: boolean;
663
+ routeDiscovery: ServerBuild["routeDiscovery"];
664
+ serializeError?(error: Error): SerializedError;
665
+ renderMeta?: {
666
+ didRenderScripts?: boolean;
667
+ streamCache?: Record<number, Promise<void> & {
668
+ result?: {
669
+ done: boolean;
670
+ value: string;
671
+ };
672
+ error?: unknown;
673
+ }>;
674
+ };
675
+ }
676
+ interface EntryContext extends FrameworkContextObject {
677
+ staticHandlerContext: StaticHandlerContext;
678
+ serverHandoffStream?: ReadableStream<Uint8Array>;
679
+ }
680
+ interface FutureConfig {
681
+ unstable_subResourceIntegrity: boolean;
682
+ unstable_middleware: boolean;
683
+ }
684
+ type CriticalCss = string | {
685
+ rel: "stylesheet";
686
+ href: string;
687
+ };
688
+ interface AssetsManifest {
689
+ entry: {
690
+ imports: string[];
691
+ module: string;
692
+ };
693
+ routes: RouteManifest<EntryRoute>;
694
+ url: string;
695
+ version: string;
696
+ hmr?: {
697
+ timestamp?: number;
698
+ runtime: string;
699
+ };
700
+ sri?: Record<string, string> | true;
701
+ }
702
+
1055
703
  declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
1056
704
  /**
1057
705
  * Defines the discovery behavior of the link:
@@ -2168,4 +1816,4 @@ declare function createStaticRouter(routes: RouteObject[], context: StaticHandle
2168
1816
  future?: Partial<FutureConfig$1>;
2169
1817
  }): Router$1;
2170
1818
 
2171
- export { type BrowserRouterProps as $, type AssetsManifest as A, useLoaderData as B, useLocation as C, useMatch as D, type EntryContext as E, type FutureConfig as F, useMatches as G, type HydrateFallbackType as H, type IndexRouteProps as I, useNavigate as J, useNavigation as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, useNavigationType as Q, type RouteComponentType as R, type ServerBuild as S, useOutlet as T, useOutletContext as U, useParams as V, useResolvedPath as W, useRevalidator as X, useRouteError as Y, useRouteLoaderData as Z, useRoutes as _, type ErrorBoundaryType as a, type DOMRouterOpts as a0, type HashRouterProps as a1, type HistoryRouterProps as a2, type LinkProps as a3, type NavLinkProps as a4, type NavLinkRenderProps as a5, type FetcherFormProps as a6, type FormProps as a7, type ScrollRestorationProps as a8, type SetURLSearchParams as a9, createSearchParams as aA, type StaticRouterProps as aB, type StaticRouterProviderProps as aC, createStaticHandler as aD, createStaticRouter as aE, StaticRouter as aF, StaticRouterProvider as aG, Meta as aH, Links as aI, Scripts as aJ, PrefetchPageLinks as aK, type ScriptsProps as aL, type HandleDataRequestFunction as aM, type HandleDocumentRequestFunction as aN, type HandleErrorFunction as aO, type ServerEntryModule as aP, hydrationRouteProperties as aQ, mapRouteProperties as aR, withComponentProps as aS, withHydrateFallbackProps as aT, withErrorBoundaryProps as aU, FrameworkContext as aV, createClientRoutes as aW, createClientRoutesWithHMRRevalidationOptOut as aX, shouldHydrateRouteLoader as aY, useScrollRestoration as aZ, type SubmitFunction as aa, type FetcherSubmitFunction as ab, type FetcherWithComponents as ac, createBrowserRouter as ad, createHashRouter as ae, BrowserRouter as af, HashRouter as ag, Link as ah, HistoryRouter as ai, NavLink as aj, Form as ak, ScrollRestoration as al, useLinkClickHandler as am, useSearchParams as an, useSubmit as ao, useFormAction as ap, useFetcher as aq, useFetchers as ar, useBeforeUnload as as, usePrompt as at, useViewTransitionState as au, type FetcherSubmitOptions as av, type ParamKeyValuePair as aw, type SubmitOptions as ax, type URLSearchParamsInit as ay, type SubmitTarget as az, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RouterProviderProps as f, type RoutesProps as g, Await as h, MemoryRouter as i, Navigate as j, Outlet as k, Route as l, Router as m, RouterProvider as n, Routes as o, createMemoryRouter as p, createRoutesFromChildren as q, createRoutesFromElements as r, renderMatches as s, type NavigateFunction as t, useBlocker as u, useActionData as v, useAsyncError as w, useAsyncValue as x, useHref as y, useInRouterContext as z };
1819
+ export { ScrollRestoration as $, type AssetsManifest as A, type BrowserRouterProps as B, type ScrollRestorationProps as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type SetURLSearchParams as G, type HydrateFallbackType as H, type IndexRouteProps as I, type SubmitFunction as J, type FetcherSubmitFunction as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, type FetcherWithComponents as Q, type RouteComponentType as R, type ServerBuild as S, createBrowserRouter as T, createHashRouter as U, BrowserRouter as V, HashRouter as W, Link as X, HistoryRouter as Y, NavLink as Z, Form as _, type ErrorBoundaryType as a, useLinkClickHandler as a0, useSearchParams as a1, useSubmit as a2, useFormAction as a3, useFetcher as a4, useFetchers as a5, useBeforeUnload as a6, usePrompt as a7, useViewTransitionState as a8, type FetcherSubmitOptions as a9, WithErrorBoundaryProps as aA, withErrorBoundaryProps as aB, FrameworkContext as aC, createClientRoutes as aD, createClientRoutesWithHMRRevalidationOptOut as aE, shouldHydrateRouteLoader as aF, useScrollRestoration as aG, type ParamKeyValuePair as aa, type SubmitOptions as ab, type URLSearchParamsInit as ac, type SubmitTarget as ad, createSearchParams as ae, type StaticRouterProps as af, type StaticRouterProviderProps as ag, createStaticHandler as ah, createStaticRouter as ai, StaticRouter as aj, StaticRouterProvider as ak, Meta as al, Links as am, Scripts as an, PrefetchPageLinks as ao, type ScriptsProps as ap, type HandleDataRequestFunction as aq, type HandleDocumentRequestFunction as ar, type HandleErrorFunction as as, type ServerEntryModule as at, hydrationRouteProperties as au, mapRouteProperties as av, WithComponentProps as aw, withComponentProps as ax, WithHydrateFallbackProps as ay, withHydrateFallbackProps as az, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RouterProviderProps as f, type RoutesProps as g, Await as h, MemoryRouter as i, Navigate as j, Outlet as k, Route$1 as l, Router as m, RouterProvider as n, Routes as o, createMemoryRouter as p, createRoutesFromChildren as q, createRoutesFromElements as r, renderMatches as s, type HashRouterProps as t, type HistoryRouterProps as u, type LinkProps as v, type NavLinkProps as w, type NavLinkRenderProps as x, type FetcherFormProps as y, type FormProps as z };