react-router
Advanced tools
| import * as React from 'react'; | ||
| import { R as RouterInit } from './instrumentation-1q4YhLGP.js'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-D4xhSy90.js'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './context-m8rizgnE.mjs'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-U8FS-wNn.mjs'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.16.0 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkSRID2YZ2js = require('./chunk-SRID2YZ2.js'); | ||
| // lib/dom/dom.ts | ||
| var defaultMethod = "get"; | ||
| var defaultEncType = "application/x-www-form-urlencoded"; | ||
| function isHtmlElement(object) { | ||
| return typeof HTMLElement !== "undefined" && object instanceof HTMLElement; | ||
| } | ||
| function isButtonElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; | ||
| } | ||
| function isFormElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; | ||
| } | ||
| function isInputElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; | ||
| } | ||
| function isModifiedEvent(event) { | ||
| return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
| } | ||
| function shouldProcessLinkClick(event, target) { | ||
| return event.button === 0 && // Ignore everything but left clicks | ||
| (!target || target === "_self") && // Let browser handle "target=_blank" etc. | ||
| !isModifiedEvent(event); | ||
| } | ||
| function createSearchParams(init = "") { | ||
| return new URLSearchParams( | ||
| typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { | ||
| let value = init[key]; | ||
| return memo.concat( | ||
| Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] | ||
| ); | ||
| }, []) | ||
| ); | ||
| } | ||
| function getSearchParamsForLocation(locationSearch, defaultSearchParams) { | ||
| let searchParams = createSearchParams(locationSearch); | ||
| if (defaultSearchParams) { | ||
| defaultSearchParams.forEach((_, key) => { | ||
| if (!searchParams.has(key)) { | ||
| defaultSearchParams.getAll(key).forEach((value) => { | ||
| searchParams.append(key, value); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| return searchParams; | ||
| } | ||
| var _formDataSupportsSubmitter = null; | ||
| function isFormDataSubmitterSupported() { | ||
| if (_formDataSupportsSubmitter === null) { | ||
| try { | ||
| new FormData( | ||
| document.createElement("form"), | ||
| // @ts-expect-error if FormData supports the submitter parameter, this will throw | ||
| 0 | ||
| ); | ||
| _formDataSupportsSubmitter = false; | ||
| } catch (e) { | ||
| _formDataSupportsSubmitter = true; | ||
| } | ||
| } | ||
| return _formDataSupportsSubmitter; | ||
| } | ||
| var supportedFormEncTypes = /* @__PURE__ */ new Set([ | ||
| "application/x-www-form-urlencoded", | ||
| "multipart/form-data", | ||
| "text/plain" | ||
| ]); | ||
| function getFormEncType(encType) { | ||
| if (encType != null && !supportedFormEncTypes.has(encType)) { | ||
| _chunkSRID2YZ2js.warning.call(void 0, | ||
| false, | ||
| `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"` | ||
| ); | ||
| return null; | ||
| } | ||
| return encType; | ||
| } | ||
| function getFormSubmissionInfo(target, basename) { | ||
| let method; | ||
| let action; | ||
| let encType; | ||
| let formData; | ||
| let body; | ||
| if (isFormElement(target)) { | ||
| let attr = target.getAttribute("action"); | ||
| action = attr ? _chunkSRID2YZ2js.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(target); | ||
| } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { | ||
| let form = target.form; | ||
| if (form == null) { | ||
| throw new Error( | ||
| `Cannot submit a <button> or <input type="submit"> without a <form>` | ||
| ); | ||
| } | ||
| let attr = target.getAttribute("formaction") || form.getAttribute("action"); | ||
| action = attr ? _chunkSRID2YZ2js.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(form, target); | ||
| if (!isFormDataSubmitterSupported()) { | ||
| let { name, type, value } = target; | ||
| if (type === "image") { | ||
| let prefix = name ? `${name}.` : ""; | ||
| formData.append(`${prefix}x`, "0"); | ||
| formData.append(`${prefix}y`, "0"); | ||
| } else if (name) { | ||
| formData.append(name, value); | ||
| } | ||
| } | ||
| } else if (isHtmlElement(target)) { | ||
| throw new Error( | ||
| `Cannot submit element that is not <form>, <button>, or <input type="submit|image">` | ||
| ); | ||
| } else { | ||
| method = defaultMethod; | ||
| action = null; | ||
| encType = defaultEncType; | ||
| body = target; | ||
| } | ||
| if (formData && encType === "text/plain") { | ||
| body = formData; | ||
| formData = void 0; | ||
| } | ||
| return { action, method: method.toLowerCase(), encType, formData, body }; | ||
| } | ||
| // lib/dom/lib.tsx | ||
| var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); | ||
| var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; | ||
| try { | ||
| if (isBrowser) { | ||
| window.__reactRouterVersion = // @ts-expect-error | ||
| "7.16.0"; | ||
| } | ||
| } catch (e) { | ||
| } | ||
| function createBrowserRouter(routes, opts) { | ||
| return _chunkSRID2YZ2js.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]), | ||
| history: _chunkSRID2YZ2js.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkSRID2YZ2js.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function createHashRouter(routes, opts) { | ||
| return _chunkSRID2YZ2js.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]), | ||
| history: _chunkSRID2YZ2js.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkSRID2YZ2js.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function parseHydrationData() { | ||
| let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]); | ||
| if (state && state.errors) { | ||
| state = { | ||
| ...state, | ||
| errors: deserializeErrors(state.errors) | ||
| }; | ||
| } | ||
| return state; | ||
| } | ||
| function deserializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (val && val.__type === "RouteErrorResponse") { | ||
| serialized[key] = new (0, _chunkSRID2YZ2js.ErrorResponseImpl)( | ||
| val.status, | ||
| val.statusText, | ||
| val.data, | ||
| val.internal === true | ||
| ); | ||
| } else if (val && val.__type === "Error") { | ||
| if (val.__subType) { | ||
| let ErrorConstructor = window[val.__subType]; | ||
| if (typeof ErrorConstructor === "function") { | ||
| try { | ||
| let error = new ErrorConstructor(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } catch (e) { | ||
| } | ||
| } | ||
| } | ||
| if (serialized[key] == null) { | ||
| let error = new Error(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function BrowserRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkSRID2YZ2js.createBrowserHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkSRID2YZ2js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HashRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkSRID2YZ2js.createHashHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkSRID2YZ2js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HistoryRouter({ | ||
| basename, | ||
| children, | ||
| history, | ||
| useTransitions | ||
| }) { | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkSRID2YZ2js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| HistoryRouter.displayName = "unstable_HistoryRouter"; | ||
| var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| var Link = React.forwardRef( | ||
| function LinkWithRef({ | ||
| onClick, | ||
| discover = "render", | ||
| prefetch = "none", | ||
| relative, | ||
| reloadDocument, | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...rest | ||
| }, forwardedRef) { | ||
| let { basename, navigator, useTransitions } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to); | ||
| let parsed = _chunkSRID2YZ2js.parseToInfo.call(void 0, to, basename); | ||
| to = parsed.to; | ||
| let href = _chunkSRID2YZ2js.useHref.call(void 0, to, { relative }); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let maskedHref = null; | ||
| if (mask) { | ||
| let resolved = _chunkSRID2YZ2js.resolveTo.call(void 0, | ||
| mask, | ||
| [], | ||
| location.mask ? location.mask.pathname : "/", | ||
| true | ||
| ); | ||
| if (basename !== "/") { | ||
| resolved.pathname = resolved.pathname === "/" ? basename : _chunkSRID2YZ2js.joinPaths.call(void 0, [basename, resolved.pathname]); | ||
| } | ||
| maskedHref = navigator.createHref(resolved); | ||
| } | ||
| let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkSRID2YZ2js.usePrefetchBehavior.call(void 0, | ||
| prefetch, | ||
| rest | ||
| ); | ||
| let internalOnClick = useLinkClickHandler(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| }); | ||
| function handleClick(event) { | ||
| if (onClick) onClick(event); | ||
| if (!event.defaultPrevented) { | ||
| internalOnClick(event); | ||
| } | ||
| } | ||
| let isSpaLink = !(parsed.isExternal || reloadDocument); | ||
| let link = ( | ||
| // eslint-disable-next-line jsx-a11y/anchor-has-content | ||
| /* @__PURE__ */ React.createElement( | ||
| "a", | ||
| { | ||
| ...rest, | ||
| ...prefetchHandlers, | ||
| href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href, | ||
| onClick: isSpaLink ? handleClick : onClick, | ||
| ref: _chunkSRID2YZ2js.mergeRefs.call(void 0, forwardedRef, prefetchRef), | ||
| target, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ) | ||
| ); | ||
| return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkSRID2YZ2js.PrefetchPageLinks, { page: href })) : link; | ||
| } | ||
| ); | ||
| Link.displayName = "Link"; | ||
| var NavLink = React.forwardRef( | ||
| function NavLinkWithRef({ | ||
| "aria-current": ariaCurrentProp = "page", | ||
| caseSensitive = false, | ||
| className: classNameProp = "", | ||
| end = false, | ||
| style: styleProp, | ||
| to, | ||
| viewTransition, | ||
| children, | ||
| ...rest | ||
| }, ref) { | ||
| let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative: rest.relative }); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let routerState = React.useContext(_chunkSRID2YZ2js.DataRouterStateContext); | ||
| let { navigator, basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| useViewTransitionState(path) && viewTransition === true; | ||
| let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; | ||
| let locationPathname = location.pathname; | ||
| let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; | ||
| if (!caseSensitive) { | ||
| locationPathname = locationPathname.toLowerCase(); | ||
| nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; | ||
| toPathname = toPathname.toLowerCase(); | ||
| } | ||
| if (nextLocationPathname && basename) { | ||
| nextLocationPathname = _chunkSRID2YZ2js.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname; | ||
| } | ||
| const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length; | ||
| let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/"; | ||
| let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); | ||
| let renderProps = { | ||
| isActive, | ||
| isPending, | ||
| isTransitioning | ||
| }; | ||
| let ariaCurrent = isActive ? ariaCurrentProp : void 0; | ||
| let className; | ||
| if (typeof classNameProp === "function") { | ||
| className = classNameProp(renderProps); | ||
| } else { | ||
| className = [ | ||
| classNameProp, | ||
| isActive ? "active" : null, | ||
| isPending ? "pending" : null, | ||
| isTransitioning ? "transitioning" : null | ||
| ].filter(Boolean).join(" "); | ||
| } | ||
| let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp; | ||
| return /* @__PURE__ */ React.createElement( | ||
| Link, | ||
| { | ||
| ...rest, | ||
| "aria-current": ariaCurrent, | ||
| className, | ||
| ref, | ||
| style, | ||
| to, | ||
| viewTransition | ||
| }, | ||
| typeof children === "function" ? children(renderProps) : children | ||
| ); | ||
| } | ||
| ); | ||
| NavLink.displayName = "NavLink"; | ||
| var Form = React.forwardRef( | ||
| ({ | ||
| discover = "render", | ||
| fetcherKey, | ||
| navigate, | ||
| reloadDocument, | ||
| replace, | ||
| state, | ||
| method = defaultMethod, | ||
| action, | ||
| onSubmit, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...props | ||
| }, forwardedRef) => { | ||
| let { useTransitions } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let submit = useSubmit(); | ||
| let formAction = useFormAction(action, { relative }); | ||
| let formMethod = method.toLowerCase() === "get" ? "get" : "post"; | ||
| let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action); | ||
| let submitHandler = (event) => { | ||
| onSubmit && onSubmit(event); | ||
| if (event.defaultPrevented) return; | ||
| event.preventDefault(); | ||
| let submitter = event.nativeEvent.submitter; | ||
| let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method; | ||
| let doSubmit = () => submit(submitter || event.currentTarget, { | ||
| fetcherKey, | ||
| method: submitMethod, | ||
| navigate, | ||
| replace, | ||
| state, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions && navigate !== false) { | ||
| React.startTransition(() => doSubmit()); | ||
| } else { | ||
| doSubmit(); | ||
| } | ||
| }; | ||
| return /* @__PURE__ */ React.createElement( | ||
| "form", | ||
| { | ||
| ref: forwardedRef, | ||
| method: formMethod, | ||
| action: formAction, | ||
| onSubmit: reloadDocument ? onSubmit : submitHandler, | ||
| ...props, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ); | ||
| } | ||
| ); | ||
| Form.displayName = "Form"; | ||
| function ScrollRestoration({ | ||
| getKey, | ||
| storageKey, | ||
| ...props | ||
| }) { | ||
| let remixContext = React.useContext(_chunkSRID2YZ2js.FrameworkContext); | ||
| let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let matches = _chunkSRID2YZ2js.useMatches.call(void 0, ); | ||
| useScrollRestoration({ getKey, storageKey }); | ||
| let ssrKey = React.useMemo( | ||
| () => { | ||
| if (!remixContext || !getKey) return null; | ||
| let userKey = getScrollRestorationKey( | ||
| location, | ||
| matches, | ||
| basename, | ||
| getKey | ||
| ); | ||
| return userKey !== location.key ? userKey : null; | ||
| }, | ||
| // Nah, we only need this the first time for the SSR render | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [] | ||
| ); | ||
| if (!remixContext || remixContext.isSpaMode) { | ||
| return null; | ||
| } | ||
| let restoreScroll = ((storageKey2, restoreKey) => { | ||
| if (!window.history.state || !window.history.state.key) { | ||
| let key = Math.random().toString(32).slice(2); | ||
| window.history.replaceState({ key }, ""); | ||
| } | ||
| try { | ||
| let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}"); | ||
| let storedY = positions[restoreKey || window.history.state.key]; | ||
| if (typeof storedY === "number") { | ||
| window.scrollTo(0, storedY); | ||
| } | ||
| } catch (error) { | ||
| console.error(error); | ||
| sessionStorage.removeItem(storageKey2); | ||
| } | ||
| }).toString(); | ||
| return /* @__PURE__ */ React.createElement( | ||
| "script", | ||
| { | ||
| ...props, | ||
| suppressHydrationWarning: true, | ||
| dangerouslySetInnerHTML: { | ||
| __html: `(${restoreScroll})(${_chunkSRID2YZ2js.escapeHtml.call(void 0, | ||
| JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY) | ||
| )}, ${_chunkSRID2YZ2js.escapeHtml.call(void 0, JSON.stringify(ssrKey))})` | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| ScrollRestoration.displayName = "ScrollRestoration"; | ||
| function getDataRouterConsoleError(hookName) { | ||
| return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`; | ||
| } | ||
| function useDataRouterContext(hookName) { | ||
| let ctx = React.useContext(_chunkSRID2YZ2js.DataRouterContext); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName)); | ||
| return ctx; | ||
| } | ||
| function useDataRouterState(hookName) { | ||
| let state = React.useContext(_chunkSRID2YZ2js.DataRouterStateContext); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, state, getDataRouterConsoleError(hookName)); | ||
| return state; | ||
| } | ||
| function useLinkClickHandler(to, { | ||
| target, | ||
| replace: replaceProp, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| } = {}) { | ||
| let navigate = _chunkSRID2YZ2js.useNavigate.call(void 0, ); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative }); | ||
| return React.useCallback( | ||
| (event) => { | ||
| if (shouldProcessLinkClick(event, target)) { | ||
| event.preventDefault(); | ||
| let replace = replaceProp !== void 0 ? replaceProp : _chunkSRID2YZ2js.createPath.call(void 0, location) === _chunkSRID2YZ2js.createPath.call(void 0, path); | ||
| let doNavigate = () => navigate(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions) { | ||
| React.startTransition(() => doNavigate()); | ||
| } else { | ||
| doNavigate(); | ||
| } | ||
| } | ||
| }, | ||
| [ | ||
| location, | ||
| navigate, | ||
| path, | ||
| replaceProp, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| ] | ||
| ); | ||
| } | ||
| function useSearchParams(defaultInit) { | ||
| _chunkSRID2YZ2js.warning.call(void 0, | ||
| typeof URLSearchParams !== "undefined", | ||
| `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.` | ||
| ); | ||
| let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit)); | ||
| let hasSetSearchParamsRef = React.useRef(false); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let searchParams = React.useMemo( | ||
| () => ( | ||
| // Only merge in the defaults if we haven't yet called setSearchParams. | ||
| // Once we call that we want those to take precedence, otherwise you can't | ||
| // remove a param with setSearchParams({}) if it has an initial value | ||
| getSearchParamsForLocation( | ||
| location.search, | ||
| hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current | ||
| ) | ||
| ), | ||
| [location.search] | ||
| ); | ||
| let navigate = _chunkSRID2YZ2js.useNavigate.call(void 0, ); | ||
| let setSearchParams = React.useCallback( | ||
| (nextInit, navigateOptions) => { | ||
| const newSearchParams = createSearchParams( | ||
| typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit | ||
| ); | ||
| hasSetSearchParamsRef.current = true; | ||
| navigate("?" + newSearchParams, navigateOptions); | ||
| }, | ||
| [navigate, searchParams] | ||
| ); | ||
| return [searchParams, setSearchParams]; | ||
| } | ||
| var fetcherId = 0; | ||
| var getUniqueFetcherId = () => `__${String(++fetcherId)}__`; | ||
| function useSubmit() { | ||
| let { router } = useDataRouterContext("useSubmit" /* UseSubmit */); | ||
| let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let currentRouteId = _chunkSRID2YZ2js.useRouteId.call(void 0, ); | ||
| let routerFetch = router.fetch; | ||
| let routerNavigate = router.navigate; | ||
| return React.useCallback( | ||
| async (target, options = {}) => { | ||
| let { action, method, encType, formData, body } = getFormSubmissionInfo( | ||
| target, | ||
| basename | ||
| ); | ||
| if (options.navigate === false) { | ||
| let key = options.fetcherKey || getUniqueFetcherId(); | ||
| await routerFetch(key, currentRouteId, options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| flushSync: options.flushSync | ||
| }); | ||
| } else { | ||
| await routerNavigate(options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| replace: options.replace, | ||
| state: options.state, | ||
| fromRouteId: currentRouteId, | ||
| flushSync: options.flushSync, | ||
| viewTransition: options.viewTransition | ||
| }); | ||
| } | ||
| }, | ||
| [routerFetch, routerNavigate, basename, currentRouteId] | ||
| ); | ||
| } | ||
| function useFormAction(action, { relative } = {}) { | ||
| let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let routeContext = React.useContext(_chunkSRID2YZ2js.RouteContext); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext"); | ||
| let [match] = routeContext.matches.slice(-1); | ||
| let path = { ..._chunkSRID2YZ2js.useResolvedPath.call(void 0, action ? action : ".", { relative }) }; | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| if (action == null) { | ||
| path.search = location.search; | ||
| let params = new URLSearchParams(path.search); | ||
| let indexValues = params.getAll("index"); | ||
| let hasNakedIndexParam = indexValues.some((v) => v === ""); | ||
| if (hasNakedIndexParam) { | ||
| params.delete("index"); | ||
| indexValues.filter((v) => v).forEach((v) => params.append("index", v)); | ||
| let qs = params.toString(); | ||
| path.search = qs ? `?${qs}` : ""; | ||
| } | ||
| } | ||
| if ((!action || action === ".") && match.route.index) { | ||
| path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; | ||
| } | ||
| if (basename !== "/") { | ||
| path.pathname = path.pathname === "/" ? basename : _chunkSRID2YZ2js.joinPaths.call(void 0, [basename, path.pathname]); | ||
| } | ||
| return _chunkSRID2YZ2js.createPath.call(void 0, path); | ||
| } | ||
| function useFetcher({ | ||
| key | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useFetcher" /* UseFetcher */); | ||
| let state = useDataRouterState("useFetcher" /* UseFetcher */); | ||
| let fetcherData = React.useContext(_chunkSRID2YZ2js.FetchersContext); | ||
| let route = React.useContext(_chunkSRID2YZ2js.RouteContext); | ||
| let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, | ||
| routeId != null, | ||
| `useFetcher can only be used on routes that contain a unique "id"` | ||
| ); | ||
| let defaultKey = React.useId(); | ||
| let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey); | ||
| if (key && key !== fetcherKey) { | ||
| setFetcherKey(key); | ||
| } | ||
| let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router; | ||
| React.useEffect(() => { | ||
| getFetcher(fetcherKey); | ||
| return () => deleteFetcher(fetcherKey); | ||
| }, [deleteFetcher, getFetcher, fetcherKey]); | ||
| let load = React.useCallback( | ||
| async (href, opts) => { | ||
| _chunkSRID2YZ2js.invariant.call(void 0, routeId, "No routeId available for fetcher.load()"); | ||
| await routerFetch(fetcherKey, routeId, href, opts); | ||
| }, | ||
| [fetcherKey, routeId, routerFetch] | ||
| ); | ||
| let submitImpl = useSubmit(); | ||
| let submit = React.useCallback( | ||
| async (target, opts) => { | ||
| await submitImpl(target, { | ||
| ...opts, | ||
| navigate: false, | ||
| fetcherKey | ||
| }); | ||
| }, | ||
| [fetcherKey, submitImpl] | ||
| ); | ||
| let reset = React.useCallback( | ||
| (opts) => resetFetcher(fetcherKey, opts), | ||
| [resetFetcher, fetcherKey] | ||
| ); | ||
| let FetcherForm = React.useMemo(() => { | ||
| let FetcherForm2 = React.forwardRef( | ||
| (props, ref) => { | ||
| return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref }); | ||
| } | ||
| ); | ||
| FetcherForm2.displayName = "fetcher.Form"; | ||
| return FetcherForm2; | ||
| }, [fetcherKey]); | ||
| let fetcher = state.fetchers.get(fetcherKey) || _chunkSRID2YZ2js.IDLE_FETCHER; | ||
| let data = fetcherData.get(fetcherKey); | ||
| let fetcherWithComponents = React.useMemo( | ||
| () => ({ | ||
| Form: FetcherForm, | ||
| submit, | ||
| load, | ||
| reset, | ||
| ...fetcher, | ||
| data | ||
| }), | ||
| [FetcherForm, submit, load, reset, fetcher, data] | ||
| ); | ||
| return fetcherWithComponents; | ||
| } | ||
| function useFetchers() { | ||
| let state = useDataRouterState("useFetchers" /* UseFetchers */); | ||
| return React.useMemo( | ||
| () => Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({ | ||
| ...fetcher, | ||
| key | ||
| })), | ||
| [state.fetchers] | ||
| ); | ||
| } | ||
| var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; | ||
| var savedScrollPositions = {}; | ||
| function getScrollRestorationKey(location, matches, basename, getKey) { | ||
| let key = null; | ||
| if (getKey) { | ||
| if (basename !== "/") { | ||
| key = getKey( | ||
| { | ||
| ...location, | ||
| pathname: _chunkSRID2YZ2js.stripBasename.call(void 0, location.pathname, basename) || location.pathname | ||
| }, | ||
| matches | ||
| ); | ||
| } else { | ||
| key = getKey(location, matches); | ||
| } | ||
| } | ||
| if (key == null) { | ||
| key = location.key; | ||
| } | ||
| return key; | ||
| } | ||
| function useScrollRestoration({ | ||
| getKey, | ||
| storageKey | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */); | ||
| let { restoreScrollPosition, preventScrollReset } = useDataRouterState( | ||
| "useScrollRestoration" /* UseScrollRestoration */ | ||
| ); | ||
| let { basename } = React.useContext(_chunkSRID2YZ2js.NavigationContext); | ||
| let location = _chunkSRID2YZ2js.useLocation.call(void 0, ); | ||
| let matches = _chunkSRID2YZ2js.useMatches.call(void 0, ); | ||
| let navigation = _chunkSRID2YZ2js.useNavigation.call(void 0, ); | ||
| React.useEffect(() => { | ||
| window.history.scrollRestoration = "manual"; | ||
| return () => { | ||
| window.history.scrollRestoration = "auto"; | ||
| }; | ||
| }, []); | ||
| usePageHide( | ||
| React.useCallback(() => { | ||
| if (navigation.state === "idle") { | ||
| let key = getScrollRestorationKey(location, matches, basename, getKey); | ||
| savedScrollPositions[key] = window.scrollY; | ||
| } | ||
| try { | ||
| sessionStorage.setItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY, | ||
| JSON.stringify(savedScrollPositions) | ||
| ); | ||
| } catch (error) { | ||
| _chunkSRID2YZ2js.warning.call(void 0, | ||
| false, | ||
| `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).` | ||
| ); | ||
| } | ||
| window.history.scrollRestoration = "auto"; | ||
| }, [navigation.state, getKey, basename, location, matches, storageKey]) | ||
| ); | ||
| if (typeof document !== "undefined") { | ||
| React.useLayoutEffect(() => { | ||
| try { | ||
| let sessionPositions = sessionStorage.getItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY | ||
| ); | ||
| if (sessionPositions) { | ||
| savedScrollPositions = JSON.parse(sessionPositions); | ||
| } | ||
| } catch (e) { | ||
| } | ||
| }, [storageKey]); | ||
| React.useLayoutEffect(() => { | ||
| let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28( | ||
| savedScrollPositions, | ||
| () => window.scrollY, | ||
| getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0 | ||
| )]); | ||
| return () => disableScrollRestoration && disableScrollRestoration(); | ||
| }, [router, basename, getKey]); | ||
| React.useLayoutEffect(() => { | ||
| if (restoreScrollPosition === false) { | ||
| return; | ||
| } | ||
| if (typeof restoreScrollPosition === "number") { | ||
| window.scrollTo(0, restoreScrollPosition); | ||
| return; | ||
| } | ||
| try { | ||
| if (location.hash) { | ||
| let el = document.getElementById( | ||
| decodeURIComponent(location.hash.slice(1)) | ||
| ); | ||
| if (el) { | ||
| el.scrollIntoView(); | ||
| return; | ||
| } | ||
| } | ||
| } catch (e2) { | ||
| _chunkSRID2YZ2js.warning.call(void 0, | ||
| false, | ||
| `"${location.hash.slice( | ||
| 1 | ||
| )}" is not a decodable element ID. The view will not scroll to it.` | ||
| ); | ||
| } | ||
| if (preventScrollReset === true) { | ||
| return; | ||
| } | ||
| window.scrollTo(0, 0); | ||
| }, [location, restoreScrollPosition, preventScrollReset]); | ||
| } | ||
| } | ||
| function useBeforeUnload(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("beforeunload", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("beforeunload", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePageHide(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("pagehide", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("pagehide", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePrompt({ | ||
| when, | ||
| message | ||
| }) { | ||
| let blocker = _chunkSRID2YZ2js.useBlocker.call(void 0, when); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked") { | ||
| let proceed = window.confirm(message); | ||
| if (proceed) { | ||
| setTimeout(blocker.proceed, 0); | ||
| } else { | ||
| blocker.reset(); | ||
| } | ||
| } | ||
| }, [blocker, message]); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked" && !when) { | ||
| blocker.reset(); | ||
| } | ||
| }, [blocker, when]); | ||
| } | ||
| function useViewTransitionState(to, { relative } = {}) { | ||
| let vtContext = React.useContext(_chunkSRID2YZ2js.ViewTransitionContext); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, | ||
| vtContext != null, | ||
| "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?" | ||
| ); | ||
| let { basename } = useDataRouterContext( | ||
| "useViewTransitionState" /* useViewTransitionState */ | ||
| ); | ||
| let path = _chunkSRID2YZ2js.useResolvedPath.call(void 0, to, { relative }); | ||
| if (!vtContext.isTransitioning) { | ||
| return false; | ||
| } | ||
| let currentPath = _chunkSRID2YZ2js.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname; | ||
| let nextPath = _chunkSRID2YZ2js.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname; | ||
| return _chunkSRID2YZ2js.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkSRID2YZ2js.matchPath.call(void 0, path.pathname, currentPath) != null; | ||
| } | ||
| // lib/dom/server.tsx | ||
| function StaticRouter({ | ||
| basename, | ||
| children, | ||
| location: locationProp = "/" | ||
| }) { | ||
| if (typeof locationProp === "string") { | ||
| locationProp = _chunkSRID2YZ2js.parsePath.call(void 0, locationProp); | ||
| } | ||
| let action = "POP" /* Pop */; | ||
| let location = { | ||
| pathname: locationProp.pathname || "/", | ||
| search: locationProp.search || "", | ||
| hash: locationProp.hash || "", | ||
| state: locationProp.state != null ? locationProp.state : null, | ||
| key: locationProp.key || "default", | ||
| mask: void 0 | ||
| }; | ||
| let staticNavigator = getStatelessNavigator(); | ||
| return /* @__PURE__ */ React2.createElement( | ||
| _chunkSRID2YZ2js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location, | ||
| navigationType: action, | ||
| navigator: staticNavigator, | ||
| static: true, | ||
| useTransitions: false | ||
| } | ||
| ); | ||
| } | ||
| function StaticRouterProvider({ | ||
| context, | ||
| router, | ||
| hydrate = true, | ||
| nonce | ||
| }) { | ||
| _chunkSRID2YZ2js.invariant.call(void 0, | ||
| router && context, | ||
| "You must provide `router` and `context` to <StaticRouterProvider>" | ||
| ); | ||
| let dataRouterContext = { | ||
| router, | ||
| navigator: getStatelessNavigator(), | ||
| static: true, | ||
| staticContext: context, | ||
| basename: context.basename || "/" | ||
| }; | ||
| let fetchersContext = /* @__PURE__ */ new Map(); | ||
| let hydrateScript = ""; | ||
| if (hydrate !== false) { | ||
| let data = { | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: serializeErrors(context.errors) | ||
| }; | ||
| let json = _chunkSRID2YZ2js.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data))); | ||
| hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`; | ||
| } | ||
| let { state } = dataRouterContext.router; | ||
| return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkSRID2YZ2js.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement( | ||
| _chunkSRID2YZ2js.Router, | ||
| { | ||
| basename: dataRouterContext.basename, | ||
| location: state.location, | ||
| navigationType: state.historyAction, | ||
| navigator: dataRouterContext.navigator, | ||
| static: dataRouterContext.static, | ||
| useTransitions: false | ||
| }, | ||
| /* @__PURE__ */ React2.createElement( | ||
| _chunkSRID2YZ2js.DataRoutes, | ||
| { | ||
| manifest: router.manifest, | ||
| routes: router.routes, | ||
| future: router.future, | ||
| state, | ||
| isStatic: true | ||
| } | ||
| ) | ||
| ))))), hydrateScript ? /* @__PURE__ */ React2.createElement( | ||
| "script", | ||
| { | ||
| suppressHydrationWarning: true, | ||
| nonce, | ||
| dangerouslySetInnerHTML: { __html: hydrateScript } | ||
| } | ||
| ) : null); | ||
| } | ||
| function serializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (_chunkSRID2YZ2js.isRouteErrorResponse.call(void 0, val)) { | ||
| serialized[key] = { ...val, __type: "RouteErrorResponse" }; | ||
| } else if (val instanceof Error) { | ||
| serialized[key] = { | ||
| message: val.message, | ||
| __type: "Error", | ||
| // If this is a subclass (i.e., ReferenceError), send up the type so we | ||
| // can re-create the same type during hydration. | ||
| ...val.name !== "Error" ? { | ||
| __subType: val.name | ||
| } : {} | ||
| }; | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function getStatelessNavigator() { | ||
| return { | ||
| createHref, | ||
| encodeLocation, | ||
| push(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| replace(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| go(delta) { | ||
| throw new Error( | ||
| `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| back() { | ||
| throw new Error( | ||
| `You cannot use navigator.back() on the server because it is a stateless environment.` | ||
| ); | ||
| }, | ||
| forward() { | ||
| throw new Error( | ||
| `You cannot use navigator.forward() on the server because it is a stateless environment.` | ||
| ); | ||
| } | ||
| }; | ||
| } | ||
| function createStaticHandler2(routes, opts) { | ||
| return _chunkSRID2YZ2js.createStaticHandler.call(void 0, routes, { | ||
| ...opts, | ||
| mapRouteProperties: _chunkSRID2YZ2js.mapRouteProperties | ||
| }); | ||
| } | ||
| function createStaticRouter(routes, context, opts = {}) { | ||
| let manifest = {}; | ||
| let dataRoutes = _chunkSRID2YZ2js.convertRoutesToDataRoutes.call(void 0, | ||
| routes, | ||
| _chunkSRID2YZ2js.mapRouteProperties, | ||
| void 0, | ||
| manifest | ||
| ); | ||
| let matches = context.matches.map((match) => { | ||
| let route = manifest[match.route.id] || match.route; | ||
| return { | ||
| ...match, | ||
| route | ||
| }; | ||
| }); | ||
| let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`; | ||
| return { | ||
| get basename() { | ||
| return context.basename; | ||
| }, | ||
| get future() { | ||
| return { | ||
| v8_middleware: false, | ||
| v8_passThroughRequests: false, | ||
| v8_trailingSlashAwareDataRequests: false, | ||
| ..._optionalChain([opts, 'optionalAccess', _29 => _29.future]) | ||
| }; | ||
| }, | ||
| get state() { | ||
| return { | ||
| historyAction: "POP" /* Pop */, | ||
| location: context.location, | ||
| matches, | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: context.errors, | ||
| initialized: true, | ||
| renderFallback: false, | ||
| navigation: _chunkSRID2YZ2js.IDLE_NAVIGATION, | ||
| restoreScrollPosition: null, | ||
| preventScrollReset: false, | ||
| revalidation: "idle", | ||
| fetchers: /* @__PURE__ */ new Map(), | ||
| blockers: /* @__PURE__ */ new Map() | ||
| }; | ||
| }, | ||
| get routes() { | ||
| return dataRoutes; | ||
| }, | ||
| get branches() { | ||
| return opts.branches; | ||
| }, | ||
| get manifest() { | ||
| return manifest; | ||
| }, | ||
| get window() { | ||
| return void 0; | ||
| }, | ||
| initialize() { | ||
| throw msg("initialize"); | ||
| }, | ||
| subscribe() { | ||
| throw msg("subscribe"); | ||
| }, | ||
| enableScrollRestoration() { | ||
| throw msg("enableScrollRestoration"); | ||
| }, | ||
| navigate() { | ||
| throw msg("navigate"); | ||
| }, | ||
| fetch() { | ||
| throw msg("fetch"); | ||
| }, | ||
| revalidate() { | ||
| throw msg("revalidate"); | ||
| }, | ||
| createHref, | ||
| encodeLocation, | ||
| getFetcher() { | ||
| return _chunkSRID2YZ2js.IDLE_FETCHER; | ||
| }, | ||
| deleteFetcher() { | ||
| throw msg("deleteFetcher"); | ||
| }, | ||
| resetFetcher() { | ||
| throw msg("resetFetcher"); | ||
| }, | ||
| dispose() { | ||
| throw msg("dispose"); | ||
| }, | ||
| getBlocker() { | ||
| return _chunkSRID2YZ2js.IDLE_BLOCKER; | ||
| }, | ||
| deleteBlocker() { | ||
| throw msg("deleteBlocker"); | ||
| }, | ||
| patchRoutes() { | ||
| throw msg("patchRoutes"); | ||
| }, | ||
| _internalFetchControllers: /* @__PURE__ */ new Map(), | ||
| _internalSetRoutes() { | ||
| throw msg("_internalSetRoutes"); | ||
| }, | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp() { | ||
| throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp"); | ||
| } | ||
| }; | ||
| } | ||
| function createHref(to) { | ||
| return typeof to === "string" ? to : _chunkSRID2YZ2js.createPath.call(void 0, to); | ||
| } | ||
| function encodeLocation(to) { | ||
| let href = typeof to === "string" ? to : _chunkSRID2YZ2js.createPath.call(void 0, to); | ||
| href = href.replace(/ $/, "%20"); | ||
| let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost"); | ||
| return { | ||
| pathname: encoded.pathname, | ||
| search: encoded.search, | ||
| hash: encoded.hash | ||
| }; | ||
| } | ||
| var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/** | ||
| * react-router v7.16.0 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkSRID2YZ2js = require('./chunk-SRID2YZ2.js'); | ||
| // lib/dom/ssr/hydration.tsx | ||
| function getHydrationData({ | ||
| state, | ||
| routes, | ||
| getRouteInfo, | ||
| location, | ||
| basename, | ||
| isSpaMode | ||
| }) { | ||
| let hydrationData = { | ||
| ...state, | ||
| loaderData: { ...state.loaderData } | ||
| }; | ||
| let initialMatches = _chunkSRID2YZ2js.matchRoutes.call(void 0, routes, location, basename); | ||
| if (initialMatches) { | ||
| for (let match of initialMatches) { | ||
| let routeId = match.route.id; | ||
| let routeInfo = getRouteInfo(routeId); | ||
| if (_chunkSRID2YZ2js.shouldHydrateRouteLoader.call(void 0, | ||
| routeId, | ||
| routeInfo.clientLoader, | ||
| routeInfo.hasLoader, | ||
| isSpaMode | ||
| ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) { | ||
| delete hydrationData.loaderData[routeId]; | ||
| } else if (!routeInfo.hasLoader) { | ||
| hydrationData.loaderData[routeId] = null; | ||
| } | ||
| } | ||
| } | ||
| return hydrationData; | ||
| } | ||
| // lib/rsc/errorBoundaries.tsx | ||
| var _react = require('react'); var _react2 = _interopRequireDefault(_react); | ||
| var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { error: null, location: props.location }; | ||
| } | ||
| static getDerivedStateFromError(error) { | ||
| return { error }; | ||
| } | ||
| static getDerivedStateFromProps(props, state) { | ||
| if (state.location !== props.location) { | ||
| return { error: null, location: props.location }; | ||
| } | ||
| return { error: state.error, location: state.location }; | ||
| } | ||
| render() { | ||
| if (this.state.error) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| error: this.state.error, | ||
| renderAppShell: true | ||
| } | ||
| ); | ||
| } else { | ||
| return this.props.children; | ||
| } | ||
| } | ||
| }; | ||
| function ErrorWrapper({ | ||
| renderAppShell, | ||
| title, | ||
| children | ||
| }) { | ||
| if (!renderAppShell) { | ||
| return children; | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement( | ||
| "meta", | ||
| { | ||
| name: "viewport", | ||
| content: "width=device-width,initial-scale=1,viewport-fit=cover" | ||
| } | ||
| ), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children))); | ||
| } | ||
| function RSCDefaultRootErrorBoundaryImpl({ | ||
| error, | ||
| renderAppShell | ||
| }) { | ||
| console.error(error); | ||
| let heyDeveloper = /* @__PURE__ */ _react2.default.createElement( | ||
| "script", | ||
| { | ||
| dangerouslySetInnerHTML: { | ||
| __html: ` | ||
| console.log( | ||
| "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information." | ||
| ); | ||
| ` | ||
| } | ||
| } | ||
| ); | ||
| if (_chunkSRID2YZ2js.isRouteErrorResponse.call(void 0, error)) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| ErrorWrapper, | ||
| { | ||
| renderAppShell, | ||
| title: "Unhandled Thrown Response!" | ||
| }, | ||
| /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), | ||
| _chunkSRID2YZ2js.ENABLE_DEV_WARNINGS ? heyDeveloper : null | ||
| ); | ||
| } | ||
| let errorInstance; | ||
| if (error instanceof Error) { | ||
| errorInstance = error; | ||
| } else { | ||
| let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error); | ||
| errorInstance = new Error(errorString); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement( | ||
| "pre", | ||
| { | ||
| style: { | ||
| padding: "2rem", | ||
| background: "hsla(10, 50%, 50%, 0.1)", | ||
| color: "red", | ||
| overflow: "auto" | ||
| } | ||
| }, | ||
| errorInstance.stack | ||
| ), heyDeveloper); | ||
| } | ||
| function RSCDefaultRootErrorBoundary({ | ||
| hasRootLayout | ||
| }) { | ||
| let error = _chunkSRID2YZ2js.useRouteError.call(void 0, ); | ||
| if (hasRootLayout === void 0) { | ||
| throw new Error("Missing 'hasRootLayout' prop"); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| renderAppShell: !hasRootLayout, | ||
| error | ||
| } | ||
| ); | ||
| } | ||
| // lib/rsc/route-modules.ts | ||
| function createRSCRouteModules(payload) { | ||
| const routeModules = {}; | ||
| for (const match of payload.matches) { | ||
| populateRSCRouteModules(routeModules, match); | ||
| } | ||
| return routeModules; | ||
| } | ||
| function populateRSCRouteModules(routeModules, matches) { | ||
| matches = Array.isArray(matches) ? matches : [matches]; | ||
| for (const match of matches) { | ||
| routeModules[match.id] = { | ||
| links: match.links, | ||
| meta: match.meta, | ||
| default: noopComponent | ||
| }; | ||
| } | ||
| } | ||
| var noopComponent = () => null; | ||
| exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules; |
| import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-U8FS-wNn.mjs'; | ||
| import * as React from 'react'; | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router$1 { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router$1; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router$1["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router$1; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
| hasErrorBoundary: boolean; | ||
| }; | ||
| declare const hydrationRouteProperties: (keyof RouteObject)[]; | ||
| /** | ||
| * @category Data Routers | ||
| */ | ||
| interface MemoryRouterOpts { | ||
| /** | ||
| * Basename path for the application. | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| /** | ||
| * Future flags to enable for the router. | ||
| */ | ||
| future?: Partial<FutureConfig>; | ||
| /** | ||
| * Hydration data to initialize the router with if you have already performed | ||
| * data loading on the server. | ||
| */ | ||
| hydrationData?: HydrationState; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Array of instrumentation objects allowing you to instrument the router and | ||
| * individual routes prior to router initialization (and on any subsequently | ||
| * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is | ||
| * mostly useful for observability such as wrapping navigations, fetches, | ||
| * as well as route loaders/actions/middlewares with logging and/or performance | ||
| * tracing. See the [docs](../../how-to/instrumentation) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * instrumentations: [logging] | ||
| * }); | ||
| * | ||
| * | ||
| * let logging = { | ||
| * router({ instrument }) { | ||
| * instrument({ | ||
| * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl), | ||
| * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl) | ||
| * }); | ||
| * }, | ||
| * route({ instrument, id }) { | ||
| * instrument({ | ||
| * middleware: (impl, info) => logExecution( | ||
| * `middleware ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * loader: (impl, info) => logExecution( | ||
| * `loader ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * action: (impl, info) => logExecution( | ||
| * `action ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * }) | ||
| * } | ||
| * }; | ||
| * | ||
| * async function logExecution(label: string, impl: () => Promise<void>) { | ||
| * let start = performance.now(); | ||
| * console.log(`start ${label}`); | ||
| * await impl(); | ||
| * let duration = Math.round(performance.now() - start); | ||
| * console.log(`end ${label} (${duration}ms)`); | ||
| * } | ||
| * ``` | ||
| */ | ||
| instrumentations?: ClientInstrumentation[]; | ||
| /** | ||
| * Override the default data strategy of running loaders in parallel - | ||
| * see the [docs](../../how-to/data-strategy) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * async dataStrategy({ | ||
| * matches, | ||
| * request, | ||
| * runClientMiddleware, | ||
| * }) { | ||
| * const matchesToLoad = matches.filter((m) => | ||
| * m.shouldCallHandler(), | ||
| * ); | ||
| * | ||
| * const results: Record<string, DataStrategyResult> = {}; | ||
| * await runClientMiddleware(() => | ||
| * Promise.all( | ||
| * matchesToLoad.map(async (match) => { | ||
| * results[match.route.id] = await match.resolve(); | ||
| * }), | ||
| * ), | ||
| * ); | ||
| * return results; | ||
| * }, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| dataStrategy?: DataStrategyFunction; | ||
| /** | ||
| * Lazily define portions of the route tree on navigations. | ||
| */ | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * Create a new {@link DataRouter} that manages the application path using an | ||
| * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack. Useful for non-browser environments without a DOM API. | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param routes Application routes | ||
| * @param opts Options | ||
| * @param {MemoryRouterOpts.basename} opts.basename n/a | ||
| * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a | ||
| * @param {MemoryRouterOpts.future} opts.future n/a | ||
| * @param {MemoryRouterOpts.getContext} opts.getContext n/a | ||
| * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a | ||
| * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a | ||
| * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a | ||
| * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a | ||
| * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a | ||
| * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`} | ||
| */ | ||
| declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1; | ||
| /** | ||
| * Function signature for client side error handling for loader/actions errors | ||
| * and rendering errors via `componentDidCatch` | ||
| */ | ||
| interface ClientOnErrorFunction { | ||
| (error: unknown, info: { | ||
| location: Location; | ||
| params: Params; | ||
| pattern: string; | ||
| errorInfo?: React.ErrorInfo; | ||
| }): void; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProviderProps { | ||
| /** | ||
| * The {@link DataRouter} instance to use for navigation and data fetching. | ||
| */ | ||
| router: Router$1; | ||
| /** | ||
| * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation to use for flushing updates. | ||
| * | ||
| * You usually don't have to worry about this: | ||
| * - The `RouterProvider` exported from `react-router/dom` handles this internally for you | ||
| * - If you are rendering in a non-DOM environment, you can import | ||
| * `RouterProvider` from `react-router` and ignore this prop | ||
| */ | ||
| flushSync?: (fn: () => unknown) => undefined; | ||
| /** | ||
| * An error handler function that will be called for any middleware, loader, action, | ||
| * or render errors that are encountered in your application. This is useful for | ||
| * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not | ||
| * subject to re-rendering and will only run one time per error. | ||
| * | ||
| * The `errorInfo` parameter is passed along from | ||
| * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch) | ||
| * and is only present for render errors. | ||
| * | ||
| * ```tsx | ||
| * <RouterProvider onError=(error, info) => { | ||
| * let { location, params, pattern, errorInfo } = info; | ||
| * console.error(error, location, errorInfo); | ||
| * reportToErrorService(error, location, errorInfo); | ||
| * }} /> | ||
| * ``` | ||
| */ | ||
| onError?: ClientOnErrorFunction; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - This can lead to buggy behaviors if you are wrapping your own | ||
| * navigations/fetchers in `startTransition`. | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and router state changes will be wrapped in | ||
| * `React.startTransition` and also sent through | ||
| * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to | ||
| * surface mid-navigation router state changes to the UI. | ||
| * - When set to `false`, the router will not leverage `React.startTransition` or | ||
| * `React.useOptimistic` on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Render the UI for the given {@link DataRouter}. This component should | ||
| * typically be at the top of an app's element tree. | ||
| * | ||
| * ```tsx | ||
| * import { createBrowserRouter } from "react-router"; | ||
| * import { RouterProvider } from "react-router/dom"; | ||
| * import { createRoot } from "react-dom/client"; | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * createRoot(document.getElementById("root")).render( | ||
| * <RouterProvider router={router} /> | ||
| * ); | ||
| * ``` | ||
| * | ||
| * <docs-info>Please note that this component is exported both from | ||
| * `react-router` and `react-router/dom` with the only difference being that the | ||
| * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation. You _almost always_ want to use the version from | ||
| * `react-router/dom` unless you're running in a non-DOM environment.</docs-info> | ||
| * | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {RouterProviderProps.flushSync} props.flushSync n/a | ||
| * @param {RouterProviderProps.onError} props.onError n/a | ||
| * @param {RouterProviderProps.router} props.router n/a | ||
| * @param {RouterProviderProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router | ||
| */ | ||
| declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface MemoryRouterProps { | ||
| /** | ||
| * Application basename | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * A declarative {@link Router | `<Router>`} that stores all entries in memory. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {MemoryRouterProps.basename} props.basename n/a | ||
| * @param {MemoryRouterProps.children} props.children n/a | ||
| * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a | ||
| * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a | ||
| * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns A declarative in-memory {@link Router | `<Router>`} for client-side | ||
| * routing. | ||
| */ | ||
| declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface NavigateProps { | ||
| /** | ||
| * The path to navigate to. This can be a string or a {@link Path} object | ||
| */ | ||
| to: To; | ||
| /** | ||
| * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack | ||
| */ | ||
| replace?: boolean; | ||
| /** | ||
| * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state). | ||
| */ | ||
| state?: any; | ||
| /** | ||
| * How to interpret relative routing in the `to` prop. | ||
| * See {@link RelativeRoutingType}. | ||
| */ | ||
| relative?: RelativeRoutingType; | ||
| } | ||
| /** | ||
| * A component-based version of {@link useNavigate} to use in a | ||
| * [`React.Component` class](https://react.dev/reference/react/Component) where | ||
| * hooks cannot be used. | ||
| * | ||
| * It's recommended to avoid using this component in favor of {@link useNavigate}. | ||
| * | ||
| * @example | ||
| * <Navigate to="/tasks" /> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {NavigateProps.relative} props.relative n/a | ||
| * @param {NavigateProps.replace} props.replace n/a | ||
| * @param {NavigateProps.state} props.state n/a | ||
| * @param {NavigateProps.to} props.to n/a | ||
| * @returns {void} | ||
| * | ||
| */ | ||
| declare function Navigate({ to, replace, state, relative, }: NavigateProps): null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface OutletProps { | ||
| /** | ||
| * Provides a context value to the element tree below the outlet. Use when | ||
| * the parent route needs to provide values to child routes. | ||
| * | ||
| * ```tsx | ||
| * <Outlet context={myContextValue} /> | ||
| * ``` | ||
| * | ||
| * Access the context with {@link useOutletContext}. | ||
| */ | ||
| context?: unknown; | ||
| } | ||
| /** | ||
| * Renders the matching child route of a parent route or nothing if no child | ||
| * route matches. | ||
| * | ||
| * @example | ||
| * import { Outlet } from "react-router"; | ||
| * | ||
| * export default function SomeParent() { | ||
| * return ( | ||
| * <div> | ||
| * <h1>Parent Content</h1> | ||
| * <Outlet /> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {OutletProps.context} props.context n/a | ||
| * @returns React element for the rendered outlet or `null` if no child route matches. | ||
| */ | ||
| declare function Outlet(props: OutletProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface PathRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: NonIndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: NonIndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: NonIndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<NonIndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: NonIndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: NonIndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: NonIndexRouteObject["action"]; | ||
| hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: NonIndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index?: false; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface LayoutRouteProps extends PathRouteProps { | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface IndexRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: IndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: IndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: IndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<IndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: IndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: IndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: IndexRouteObject["action"]; | ||
| hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: IndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: IndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index: true; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: undefined; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps; | ||
| /** | ||
| * Configures an element to render when a pattern matches the current location. | ||
| * It must be rendered within a {@link Routes} element. Note that these routes | ||
| * do not participate in data loading, actions, code splitting, or any other | ||
| * route module features. | ||
| * | ||
| * @example | ||
| * // Usually used in a declarative router | ||
| * function App() { | ||
| * return ( | ||
| * <BrowserRouter> | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * </BrowserRouter> | ||
| * ); | ||
| * } | ||
| * | ||
| * // But can be used with a data router as well if you prefer the JSX notation | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {PathRouteProps.action} props.action n/a | ||
| * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a | ||
| * @param {PathRouteProps.Component} props.Component n/a | ||
| * @param {PathRouteProps.children} props.children n/a | ||
| * @param {PathRouteProps.element} props.element n/a | ||
| * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a | ||
| * @param {PathRouteProps.errorElement} props.errorElement n/a | ||
| * @param {PathRouteProps.handle} props.handle n/a | ||
| * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a | ||
| * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a | ||
| * @param {PathRouteProps.id} props.id n/a | ||
| * @param {PathRouteProps.index} props.index n/a | ||
| * @param {PathRouteProps.lazy} props.lazy n/a | ||
| * @param {PathRouteProps.loader} props.loader n/a | ||
| * @param {PathRouteProps.path} props.path n/a | ||
| * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a | ||
| * @returns {void} | ||
| */ | ||
| declare function Route(props: RouteProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProps { | ||
| /** | ||
| * The base path for the application. This is prepended to all locations | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The location to match against. Defaults to the current location. | ||
| * This can be a string or a {@link Location} object. | ||
| */ | ||
| location: Partial<Location> | string; | ||
| /** | ||
| * The type of navigation that triggered this `location` change. | ||
| * Defaults to {@link NavigationType.Pop}. | ||
| */ | ||
| navigationType?: Action; | ||
| /** | ||
| * The navigator to use for navigation. This is usually a history object | ||
| * or a custom navigator that implements the {@link Navigator} interface. | ||
| */ | ||
| navigator: Navigator; | ||
| /** | ||
| * Whether this router is static or not (used for SSR). If `true`, the router | ||
| * will not be reactive to location changes. | ||
| */ | ||
| static?: boolean; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Provides location context for the rest of the app. | ||
| * | ||
| * Note: You usually won't render a `<Router>` directly. Instead, you'll render a | ||
| * router that is more specific to your environment such as a {@link BrowserRouter} | ||
| * in web browsers or a {@link ServerRouter} for server rendering. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {RouterProps.basename} props.basename n/a | ||
| * @param {RouterProps.children} props.children n/a | ||
| * @param {RouterProps.location} props.location n/a | ||
| * @param {RouterProps.navigationType} props.navigationType n/a | ||
| * @param {RouterProps.navigator} props.navigator n/a | ||
| * @param {RouterProps.static} props.static n/a | ||
| * @param {RouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router or `null` if the location does | ||
| * not match the {@link props.basename} | ||
| */ | ||
| declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RoutesProps { | ||
| /** | ||
| * Nested {@link Route} elements | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The {@link Location} to match against. Defaults to the current location. | ||
| */ | ||
| location?: Partial<Location> | string; | ||
| } | ||
| /** | ||
| * Renders a branch of {@link Route | `<Route>`s} that best matches the current | ||
| * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader), | ||
| * [`action`](../../start/framework/route-module#action), code splitting, or | ||
| * any other [route module](../../start/framework/route-module) features. | ||
| * | ||
| * @example | ||
| * import { Route, Routes } from "react-router"; | ||
| * | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {RoutesProps.children} props.children n/a | ||
| * @param {RoutesProps.location} props.location n/a | ||
| * @returns React element for the rendered routes or `null` if no route matches | ||
| */ | ||
| declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; | ||
| interface AwaitResolveRenderFunction<Resolve = any> { | ||
| (data: Awaited<Resolve>): React.ReactNode; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface AwaitProps<Resolve> { | ||
| /** | ||
| * When using a function, the resolved value is provided as the parameter. | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * {(resolvedReviews) => <Reviews items={resolvedReviews} />} | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * When using React elements, {@link useAsyncValue} will provide the | ||
| * resolved value: | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function Reviews() { | ||
| * const resolvedReviews = useAsyncValue(); | ||
| * return <div>...</div>; | ||
| * } | ||
| * ``` | ||
| */ | ||
| children: React.ReactNode | AwaitResolveRenderFunction<Resolve>; | ||
| /** | ||
| * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * rejects. | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<div>Oops</div>} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * To provide a more contextual error, you can use the {@link useAsyncError} in a | ||
| * child component | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<ReviewsError />} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function ReviewsError() { | ||
| * const error = useAsyncError(); | ||
| * return <div>Error loading reviews: {error.message}</div>; | ||
| * } | ||
| * ``` | ||
| * | ||
| * If you do not provide an `errorElement`, the rejected value will bubble up | ||
| * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary) | ||
| * and be accessible via the {@link useRouteError} hook. | ||
| */ | ||
| errorElement?: React.ReactNode; | ||
| /** | ||
| * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * returned from a [`loader`](../../start/framework/route-module#loader) to be | ||
| * resolved and rendered. | ||
| * | ||
| * ```tsx | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * let reviews = getReviews(); // not awaited | ||
| * let book = await getBook(); | ||
| * return { | ||
| * book, | ||
| * reviews, // this is a promise | ||
| * }; | ||
| * } | ||
| * | ||
| * export default function Book() { | ||
| * const { | ||
| * book, | ||
| * reviews, // this is the same promise | ||
| * } = useLoaderData(); | ||
| * | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * // and is the promise we pass to Await | ||
| * resolve={reviews} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| */ | ||
| resolve: Resolve; | ||
| } | ||
| /** | ||
| * Used to render promise values with automatic error handling. | ||
| * | ||
| * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense) | ||
| * | ||
| * @example | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * // not awaited | ||
| * const reviews = getReviews(); | ||
| * // awaited (blocks the transition) | ||
| * const book = await fetch("/api/book").then((res) => res.json()); | ||
| * return { book, reviews }; | ||
| * } | ||
| * | ||
| * function Book() { | ||
| * const { book, reviews } = useLoaderData(); | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * resolve={reviews} | ||
| * errorElement={ | ||
| * <div>Could not load reviews 😬</div> | ||
| * } | ||
| * children={(resolvedReviews) => ( | ||
| * <Reviews items={resolvedReviews} /> | ||
| * )} | ||
| * /> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @mode framework | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {AwaitProps.children} props.children n/a | ||
| * @param {AwaitProps.errorElement} props.errorElement n/a | ||
| * @param {AwaitProps.resolve} props.resolve n/a | ||
| * @returns React element for the rendered awaited value | ||
| */ | ||
| declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element; | ||
| /** | ||
| * Creates a route config from a React "children" object, which is usually | ||
| * either a `<Route>` element or an array of them. Used internally by | ||
| * `<Routes>` to create a route config from its children. | ||
| * | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; | ||
| /** | ||
| * Create route objects from JSX elements instead of arrays of objects. | ||
| * | ||
| * @example | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @name createRoutesFromElements | ||
| * @public | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * This is used for internal recursion and is not intended to be used by the | ||
| * application developer. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare const createRoutesFromElements: typeof createRoutesFromChildren; | ||
| /** | ||
| * Renders the result of {@link matchRoutes} into a React element. | ||
| * | ||
| * @public | ||
| * @category Utils | ||
| * @param matches The array of {@link RouteMatch | route matches} to render | ||
| * @returns A React element that renders the matched routes or `null` if no matches | ||
| */ | ||
| declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; | ||
| declare function useRouteComponentProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }; | ||
| type RouteComponentProps = ReturnType<typeof useRouteComponentProps>; | ||
| type RouteComponentType = React.ComponentType<RouteComponentProps>; | ||
| declare function WithComponentProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useHydrateFallbackProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }; | ||
| type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>; | ||
| type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>; | ||
| declare function WithHydrateFallbackProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useErrorBoundaryProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }; | ||
| type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>; | ||
| type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>; | ||
| declare function WithErrorBoundaryProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> { | ||
| router: Router$1; | ||
| staticContext?: StaticHandlerContext; | ||
| onError?: ClientOnErrorFunction; | ||
| } | ||
| declare const DataRouterContext: React.Context<DataRouterContextObject | null>; | ||
| declare const DataRouterStateContext: React.Context<RouterState | null>; | ||
| type ViewTransitionContextObject = { | ||
| isTransitioning: false; | ||
| } | { | ||
| isTransitioning: true; | ||
| flushSync: boolean; | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>; | ||
| type FetchersContextObject = Map<string, any>; | ||
| declare const FetchersContext: React.Context<FetchersContextObject>; | ||
| declare const AwaitContext: React.Context<TrackedPromise | null>; | ||
| declare const AwaitContextProvider: (props: React.ComponentProps<typeof AwaitContext.Provider>) => React.FunctionComponentElement<React.ProviderProps<TrackedPromise | null>>; | ||
| interface NavigateOptions { | ||
| /** Replace the current entry in the history stack instead of pushing a new one */ | ||
| replace?: boolean; | ||
| /** Masked URL */ | ||
| mask?: To; | ||
| /** Adds persistent client side routing state to the next location */ | ||
| state?: any; | ||
| /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */ | ||
| preventScrollReset?: boolean; | ||
| /** 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. */ | ||
| relative?: RelativeRoutingType; | ||
| /** 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} */ | ||
| flushSync?: boolean; | ||
| /** 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 useViewTransitionState `useViewTransitionState()`} hook. */ | ||
| viewTransition?: boolean; | ||
| /** Specifies the default revalidation behavior after this submission */ | ||
| defaultShouldRevalidate?: boolean; | ||
| } | ||
| /** | ||
| * A Navigator is a "location changer"; it's how you get to different locations. | ||
| * | ||
| * Every history instance conforms to the Navigator interface, but the | ||
| * distinction is useful primarily when it comes to the low-level `<Router>` API | ||
| * where both the location and a navigator must be provided separately in order | ||
| * to avoid "tearing" that may occur in a suspense-enabled app if the action | ||
| * and/or location were to be read directly from the history instance. | ||
| */ | ||
| interface Navigator { | ||
| createHref: History["createHref"]; | ||
| encodeLocation?: History["encodeLocation"]; | ||
| go: History["go"]; | ||
| push(to: To, state?: any, opts?: NavigateOptions): void; | ||
| replace(to: To, state?: any, opts?: NavigateOptions): void; | ||
| } | ||
| interface NavigationContextObject { | ||
| basename: string; | ||
| navigator: Navigator; | ||
| static: boolean; | ||
| useTransitions: boolean | undefined; | ||
| future: {}; | ||
| } | ||
| declare const NavigationContext: React.Context<NavigationContextObject>; | ||
| interface LocationContextObject { | ||
| location: Location; | ||
| navigationType: Action; | ||
| } | ||
| declare const LocationContext: React.Context<LocationContextObject>; | ||
| interface RouteContextObject { | ||
| outlet: React.ReactElement | null; | ||
| matches: RouteMatch[]; | ||
| isDataRoute: boolean; | ||
| } | ||
| declare const RouteContext: React.Context<RouteContextObject>; | ||
| export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type RouterState as g, type GetScrollRestorationKeyFunction as h, type StaticHandlerContext as i, type Navigation as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-D4xhSy90.js'; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type Navigation as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u }; |
| import { R as RouteModule } from './data-D4xhSy90.js'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import { R as RouteModule } from './data-U8FS-wNn.mjs'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './instrumentation-1q4YhLGP.js'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-D4xhSy90.js'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './context-m8rizgnE.mjs'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-U8FS-wNn.mjs'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/** | ||
| * react-router v7.16.0 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkY7DNFQZPjs = require('./chunk-Y7DNFQZP.js'); | ||
| // lib/dom/ssr/hydration.tsx | ||
| function getHydrationData({ | ||
| state, | ||
| routes, | ||
| getRouteInfo, | ||
| location, | ||
| basename, | ||
| isSpaMode | ||
| }) { | ||
| let hydrationData = { | ||
| ...state, | ||
| loaderData: { ...state.loaderData } | ||
| }; | ||
| let initialMatches = _chunkY7DNFQZPjs.matchRoutes.call(void 0, routes, location, basename); | ||
| if (initialMatches) { | ||
| for (let match of initialMatches) { | ||
| let routeId = match.route.id; | ||
| let routeInfo = getRouteInfo(routeId); | ||
| if (_chunkY7DNFQZPjs.shouldHydrateRouteLoader.call(void 0, | ||
| routeId, | ||
| routeInfo.clientLoader, | ||
| routeInfo.hasLoader, | ||
| isSpaMode | ||
| ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) { | ||
| delete hydrationData.loaderData[routeId]; | ||
| } else if (!routeInfo.hasLoader) { | ||
| hydrationData.loaderData[routeId] = null; | ||
| } | ||
| } | ||
| } | ||
| return hydrationData; | ||
| } | ||
| // lib/rsc/errorBoundaries.tsx | ||
| var _react = require('react'); var _react2 = _interopRequireDefault(_react); | ||
| var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { error: null, location: props.location }; | ||
| } | ||
| static getDerivedStateFromError(error) { | ||
| return { error }; | ||
| } | ||
| static getDerivedStateFromProps(props, state) { | ||
| if (state.location !== props.location) { | ||
| return { error: null, location: props.location }; | ||
| } | ||
| return { error: state.error, location: state.location }; | ||
| } | ||
| render() { | ||
| if (this.state.error) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| error: this.state.error, | ||
| renderAppShell: true | ||
| } | ||
| ); | ||
| } else { | ||
| return this.props.children; | ||
| } | ||
| } | ||
| }; | ||
| function ErrorWrapper({ | ||
| renderAppShell, | ||
| title, | ||
| children | ||
| }) { | ||
| if (!renderAppShell) { | ||
| return children; | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement( | ||
| "meta", | ||
| { | ||
| name: "viewport", | ||
| content: "width=device-width,initial-scale=1,viewport-fit=cover" | ||
| } | ||
| ), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children))); | ||
| } | ||
| function RSCDefaultRootErrorBoundaryImpl({ | ||
| error, | ||
| renderAppShell | ||
| }) { | ||
| console.error(error); | ||
| let heyDeveloper = /* @__PURE__ */ _react2.default.createElement( | ||
| "script", | ||
| { | ||
| dangerouslySetInnerHTML: { | ||
| __html: ` | ||
| console.log( | ||
| "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information." | ||
| ); | ||
| ` | ||
| } | ||
| } | ||
| ); | ||
| if (_chunkY7DNFQZPjs.isRouteErrorResponse.call(void 0, error)) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| ErrorWrapper, | ||
| { | ||
| renderAppShell, | ||
| title: "Unhandled Thrown Response!" | ||
| }, | ||
| /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), | ||
| _chunkY7DNFQZPjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null | ||
| ); | ||
| } | ||
| let errorInstance; | ||
| if (error instanceof Error) { | ||
| errorInstance = error; | ||
| } else { | ||
| let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error); | ||
| errorInstance = new Error(errorString); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement( | ||
| "pre", | ||
| { | ||
| style: { | ||
| padding: "2rem", | ||
| background: "hsla(10, 50%, 50%, 0.1)", | ||
| color: "red", | ||
| overflow: "auto" | ||
| } | ||
| }, | ||
| errorInstance.stack | ||
| ), heyDeveloper); | ||
| } | ||
| function RSCDefaultRootErrorBoundary({ | ||
| hasRootLayout | ||
| }) { | ||
| let error = _chunkY7DNFQZPjs.useRouteError.call(void 0, ); | ||
| if (hasRootLayout === void 0) { | ||
| throw new Error("Missing 'hasRootLayout' prop"); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| renderAppShell: !hasRootLayout, | ||
| error | ||
| } | ||
| ); | ||
| } | ||
| // lib/rsc/route-modules.ts | ||
| function createRSCRouteModules(payload) { | ||
| const routeModules = {}; | ||
| for (const match of payload.matches) { | ||
| populateRSCRouteModules(routeModules, match); | ||
| } | ||
| return routeModules; | ||
| } | ||
| function populateRSCRouteModules(routeModules, matches) { | ||
| matches = Array.isArray(matches) ? matches : [matches]; | ||
| for (const match of matches) { | ||
| routeModules[match.id] = { | ||
| links: match.links, | ||
| meta: match.meta, | ||
| default: noopComponent | ||
| }; | ||
| } | ||
| } | ||
| var noopComponent = () => null; | ||
| exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.16.0 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkY7DNFQZPjs = require('./chunk-Y7DNFQZP.js'); | ||
| // lib/dom/dom.ts | ||
| var defaultMethod = "get"; | ||
| var defaultEncType = "application/x-www-form-urlencoded"; | ||
| function isHtmlElement(object) { | ||
| return typeof HTMLElement !== "undefined" && object instanceof HTMLElement; | ||
| } | ||
| function isButtonElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; | ||
| } | ||
| function isFormElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; | ||
| } | ||
| function isInputElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; | ||
| } | ||
| function isModifiedEvent(event) { | ||
| return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
| } | ||
| function shouldProcessLinkClick(event, target) { | ||
| return event.button === 0 && // Ignore everything but left clicks | ||
| (!target || target === "_self") && // Let browser handle "target=_blank" etc. | ||
| !isModifiedEvent(event); | ||
| } | ||
| function createSearchParams(init = "") { | ||
| return new URLSearchParams( | ||
| typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { | ||
| let value = init[key]; | ||
| return memo.concat( | ||
| Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] | ||
| ); | ||
| }, []) | ||
| ); | ||
| } | ||
| function getSearchParamsForLocation(locationSearch, defaultSearchParams) { | ||
| let searchParams = createSearchParams(locationSearch); | ||
| if (defaultSearchParams) { | ||
| defaultSearchParams.forEach((_, key) => { | ||
| if (!searchParams.has(key)) { | ||
| defaultSearchParams.getAll(key).forEach((value) => { | ||
| searchParams.append(key, value); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| return searchParams; | ||
| } | ||
| var _formDataSupportsSubmitter = null; | ||
| function isFormDataSubmitterSupported() { | ||
| if (_formDataSupportsSubmitter === null) { | ||
| try { | ||
| new FormData( | ||
| document.createElement("form"), | ||
| // @ts-expect-error if FormData supports the submitter parameter, this will throw | ||
| 0 | ||
| ); | ||
| _formDataSupportsSubmitter = false; | ||
| } catch (e) { | ||
| _formDataSupportsSubmitter = true; | ||
| } | ||
| } | ||
| return _formDataSupportsSubmitter; | ||
| } | ||
| var supportedFormEncTypes = /* @__PURE__ */ new Set([ | ||
| "application/x-www-form-urlencoded", | ||
| "multipart/form-data", | ||
| "text/plain" | ||
| ]); | ||
| function getFormEncType(encType) { | ||
| if (encType != null && !supportedFormEncTypes.has(encType)) { | ||
| _chunkY7DNFQZPjs.warning.call(void 0, | ||
| false, | ||
| `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"` | ||
| ); | ||
| return null; | ||
| } | ||
| return encType; | ||
| } | ||
| function getFormSubmissionInfo(target, basename) { | ||
| let method; | ||
| let action; | ||
| let encType; | ||
| let formData; | ||
| let body; | ||
| if (isFormElement(target)) { | ||
| let attr = target.getAttribute("action"); | ||
| action = attr ? _chunkY7DNFQZPjs.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(target); | ||
| } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { | ||
| let form = target.form; | ||
| if (form == null) { | ||
| throw new Error( | ||
| `Cannot submit a <button> or <input type="submit"> without a <form>` | ||
| ); | ||
| } | ||
| let attr = target.getAttribute("formaction") || form.getAttribute("action"); | ||
| action = attr ? _chunkY7DNFQZPjs.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(form, target); | ||
| if (!isFormDataSubmitterSupported()) { | ||
| let { name, type, value } = target; | ||
| if (type === "image") { | ||
| let prefix = name ? `${name}.` : ""; | ||
| formData.append(`${prefix}x`, "0"); | ||
| formData.append(`${prefix}y`, "0"); | ||
| } else if (name) { | ||
| formData.append(name, value); | ||
| } | ||
| } | ||
| } else if (isHtmlElement(target)) { | ||
| throw new Error( | ||
| `Cannot submit element that is not <form>, <button>, or <input type="submit|image">` | ||
| ); | ||
| } else { | ||
| method = defaultMethod; | ||
| action = null; | ||
| encType = defaultEncType; | ||
| body = target; | ||
| } | ||
| if (formData && encType === "text/plain") { | ||
| body = formData; | ||
| formData = void 0; | ||
| } | ||
| return { action, method: method.toLowerCase(), encType, formData, body }; | ||
| } | ||
| // lib/dom/lib.tsx | ||
| var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); | ||
| var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; | ||
| try { | ||
| if (isBrowser) { | ||
| window.__reactRouterVersion = // @ts-expect-error | ||
| "7.16.0"; | ||
| } | ||
| } catch (e) { | ||
| } | ||
| function createBrowserRouter(routes, opts) { | ||
| return _chunkY7DNFQZPjs.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]), | ||
| history: _chunkY7DNFQZPjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkY7DNFQZPjs.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkY7DNFQZPjs.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function createHashRouter(routes, opts) { | ||
| return _chunkY7DNFQZPjs.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]), | ||
| history: _chunkY7DNFQZPjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkY7DNFQZPjs.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkY7DNFQZPjs.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function parseHydrationData() { | ||
| let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]); | ||
| if (state && state.errors) { | ||
| state = { | ||
| ...state, | ||
| errors: deserializeErrors(state.errors) | ||
| }; | ||
| } | ||
| return state; | ||
| } | ||
| function deserializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (val && val.__type === "RouteErrorResponse") { | ||
| serialized[key] = new (0, _chunkY7DNFQZPjs.ErrorResponseImpl)( | ||
| val.status, | ||
| val.statusText, | ||
| val.data, | ||
| val.internal === true | ||
| ); | ||
| } else if (val && val.__type === "Error") { | ||
| if (val.__subType) { | ||
| let ErrorConstructor = window[val.__subType]; | ||
| if (typeof ErrorConstructor === "function") { | ||
| try { | ||
| let error = new ErrorConstructor(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } catch (e) { | ||
| } | ||
| } | ||
| } | ||
| if (serialized[key] == null) { | ||
| let error = new Error(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function BrowserRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkY7DNFQZPjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkY7DNFQZPjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HashRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkY7DNFQZPjs.createHashHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkY7DNFQZPjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HistoryRouter({ | ||
| basename, | ||
| children, | ||
| history, | ||
| useTransitions | ||
| }) { | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkY7DNFQZPjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| HistoryRouter.displayName = "unstable_HistoryRouter"; | ||
| var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| var Link = React.forwardRef( | ||
| function LinkWithRef({ | ||
| onClick, | ||
| discover = "render", | ||
| prefetch = "none", | ||
| relative, | ||
| reloadDocument, | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...rest | ||
| }, forwardedRef) { | ||
| let { basename, navigator, useTransitions } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to); | ||
| let parsed = _chunkY7DNFQZPjs.parseToInfo.call(void 0, to, basename); | ||
| to = parsed.to; | ||
| let href = _chunkY7DNFQZPjs.useHref.call(void 0, to, { relative }); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let maskedHref = null; | ||
| if (mask) { | ||
| let resolved = _chunkY7DNFQZPjs.resolveTo.call(void 0, | ||
| mask, | ||
| [], | ||
| location.mask ? location.mask.pathname : "/", | ||
| true | ||
| ); | ||
| if (basename !== "/") { | ||
| resolved.pathname = resolved.pathname === "/" ? basename : _chunkY7DNFQZPjs.joinPaths.call(void 0, [basename, resolved.pathname]); | ||
| } | ||
| maskedHref = navigator.createHref(resolved); | ||
| } | ||
| let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkY7DNFQZPjs.usePrefetchBehavior.call(void 0, | ||
| prefetch, | ||
| rest | ||
| ); | ||
| let internalOnClick = useLinkClickHandler(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| }); | ||
| function handleClick(event) { | ||
| if (onClick) onClick(event); | ||
| if (!event.defaultPrevented) { | ||
| internalOnClick(event); | ||
| } | ||
| } | ||
| let isSpaLink = !(parsed.isExternal || reloadDocument); | ||
| let link = ( | ||
| // eslint-disable-next-line jsx-a11y/anchor-has-content | ||
| /* @__PURE__ */ React.createElement( | ||
| "a", | ||
| { | ||
| ...rest, | ||
| ...prefetchHandlers, | ||
| href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href, | ||
| onClick: isSpaLink ? handleClick : onClick, | ||
| ref: _chunkY7DNFQZPjs.mergeRefs.call(void 0, forwardedRef, prefetchRef), | ||
| target, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ) | ||
| ); | ||
| return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkY7DNFQZPjs.PrefetchPageLinks, { page: href })) : link; | ||
| } | ||
| ); | ||
| Link.displayName = "Link"; | ||
| var NavLink = React.forwardRef( | ||
| function NavLinkWithRef({ | ||
| "aria-current": ariaCurrentProp = "page", | ||
| caseSensitive = false, | ||
| className: classNameProp = "", | ||
| end = false, | ||
| style: styleProp, | ||
| to, | ||
| viewTransition, | ||
| children, | ||
| ...rest | ||
| }, ref) { | ||
| let path = _chunkY7DNFQZPjs.useResolvedPath.call(void 0, to, { relative: rest.relative }); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let routerState = React.useContext(_chunkY7DNFQZPjs.DataRouterStateContext); | ||
| let { navigator, basename } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| useViewTransitionState(path) && viewTransition === true; | ||
| let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; | ||
| let locationPathname = location.pathname; | ||
| let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; | ||
| if (!caseSensitive) { | ||
| locationPathname = locationPathname.toLowerCase(); | ||
| nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; | ||
| toPathname = toPathname.toLowerCase(); | ||
| } | ||
| if (nextLocationPathname && basename) { | ||
| nextLocationPathname = _chunkY7DNFQZPjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname; | ||
| } | ||
| const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length; | ||
| let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/"; | ||
| let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); | ||
| let renderProps = { | ||
| isActive, | ||
| isPending, | ||
| isTransitioning | ||
| }; | ||
| let ariaCurrent = isActive ? ariaCurrentProp : void 0; | ||
| let className; | ||
| if (typeof classNameProp === "function") { | ||
| className = classNameProp(renderProps); | ||
| } else { | ||
| className = [ | ||
| classNameProp, | ||
| isActive ? "active" : null, | ||
| isPending ? "pending" : null, | ||
| isTransitioning ? "transitioning" : null | ||
| ].filter(Boolean).join(" "); | ||
| } | ||
| let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp; | ||
| return /* @__PURE__ */ React.createElement( | ||
| Link, | ||
| { | ||
| ...rest, | ||
| "aria-current": ariaCurrent, | ||
| className, | ||
| ref, | ||
| style, | ||
| to, | ||
| viewTransition | ||
| }, | ||
| typeof children === "function" ? children(renderProps) : children | ||
| ); | ||
| } | ||
| ); | ||
| NavLink.displayName = "NavLink"; | ||
| var Form = React.forwardRef( | ||
| ({ | ||
| discover = "render", | ||
| fetcherKey, | ||
| navigate, | ||
| reloadDocument, | ||
| replace, | ||
| state, | ||
| method = defaultMethod, | ||
| action, | ||
| onSubmit, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...props | ||
| }, forwardedRef) => { | ||
| let { useTransitions } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let submit = useSubmit(); | ||
| let formAction = useFormAction(action, { relative }); | ||
| let formMethod = method.toLowerCase() === "get" ? "get" : "post"; | ||
| let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action); | ||
| let submitHandler = (event) => { | ||
| onSubmit && onSubmit(event); | ||
| if (event.defaultPrevented) return; | ||
| event.preventDefault(); | ||
| let submitter = event.nativeEvent.submitter; | ||
| let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method; | ||
| let doSubmit = () => submit(submitter || event.currentTarget, { | ||
| fetcherKey, | ||
| method: submitMethod, | ||
| navigate, | ||
| replace, | ||
| state, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions && navigate !== false) { | ||
| React.startTransition(() => doSubmit()); | ||
| } else { | ||
| doSubmit(); | ||
| } | ||
| }; | ||
| return /* @__PURE__ */ React.createElement( | ||
| "form", | ||
| { | ||
| ref: forwardedRef, | ||
| method: formMethod, | ||
| action: formAction, | ||
| onSubmit: reloadDocument ? onSubmit : submitHandler, | ||
| ...props, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ); | ||
| } | ||
| ); | ||
| Form.displayName = "Form"; | ||
| function ScrollRestoration({ | ||
| getKey, | ||
| storageKey, | ||
| ...props | ||
| }) { | ||
| let remixContext = React.useContext(_chunkY7DNFQZPjs.FrameworkContext); | ||
| let { basename } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let matches = _chunkY7DNFQZPjs.useMatches.call(void 0, ); | ||
| useScrollRestoration({ getKey, storageKey }); | ||
| let ssrKey = React.useMemo( | ||
| () => { | ||
| if (!remixContext || !getKey) return null; | ||
| let userKey = getScrollRestorationKey( | ||
| location, | ||
| matches, | ||
| basename, | ||
| getKey | ||
| ); | ||
| return userKey !== location.key ? userKey : null; | ||
| }, | ||
| // Nah, we only need this the first time for the SSR render | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [] | ||
| ); | ||
| if (!remixContext || remixContext.isSpaMode) { | ||
| return null; | ||
| } | ||
| let restoreScroll = ((storageKey2, restoreKey) => { | ||
| if (!window.history.state || !window.history.state.key) { | ||
| let key = Math.random().toString(32).slice(2); | ||
| window.history.replaceState({ key }, ""); | ||
| } | ||
| try { | ||
| let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}"); | ||
| let storedY = positions[restoreKey || window.history.state.key]; | ||
| if (typeof storedY === "number") { | ||
| window.scrollTo(0, storedY); | ||
| } | ||
| } catch (error) { | ||
| console.error(error); | ||
| sessionStorage.removeItem(storageKey2); | ||
| } | ||
| }).toString(); | ||
| return /* @__PURE__ */ React.createElement( | ||
| "script", | ||
| { | ||
| ...props, | ||
| suppressHydrationWarning: true, | ||
| dangerouslySetInnerHTML: { | ||
| __html: `(${restoreScroll})(${_chunkY7DNFQZPjs.escapeHtml.call(void 0, | ||
| JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY) | ||
| )}, ${_chunkY7DNFQZPjs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})` | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| ScrollRestoration.displayName = "ScrollRestoration"; | ||
| function getDataRouterConsoleError(hookName) { | ||
| return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`; | ||
| } | ||
| function useDataRouterContext(hookName) { | ||
| let ctx = React.useContext(_chunkY7DNFQZPjs.DataRouterContext); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName)); | ||
| return ctx; | ||
| } | ||
| function useDataRouterState(hookName) { | ||
| let state = React.useContext(_chunkY7DNFQZPjs.DataRouterStateContext); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName)); | ||
| return state; | ||
| } | ||
| function useLinkClickHandler(to, { | ||
| target, | ||
| replace: replaceProp, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| } = {}) { | ||
| let navigate = _chunkY7DNFQZPjs.useNavigate.call(void 0, ); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let path = _chunkY7DNFQZPjs.useResolvedPath.call(void 0, to, { relative }); | ||
| return React.useCallback( | ||
| (event) => { | ||
| if (shouldProcessLinkClick(event, target)) { | ||
| event.preventDefault(); | ||
| let replace = replaceProp !== void 0 ? replaceProp : _chunkY7DNFQZPjs.createPath.call(void 0, location) === _chunkY7DNFQZPjs.createPath.call(void 0, path); | ||
| let doNavigate = () => navigate(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions) { | ||
| React.startTransition(() => doNavigate()); | ||
| } else { | ||
| doNavigate(); | ||
| } | ||
| } | ||
| }, | ||
| [ | ||
| location, | ||
| navigate, | ||
| path, | ||
| replaceProp, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| ] | ||
| ); | ||
| } | ||
| function useSearchParams(defaultInit) { | ||
| _chunkY7DNFQZPjs.warning.call(void 0, | ||
| typeof URLSearchParams !== "undefined", | ||
| `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.` | ||
| ); | ||
| let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit)); | ||
| let hasSetSearchParamsRef = React.useRef(false); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let searchParams = React.useMemo( | ||
| () => ( | ||
| // Only merge in the defaults if we haven't yet called setSearchParams. | ||
| // Once we call that we want those to take precedence, otherwise you can't | ||
| // remove a param with setSearchParams({}) if it has an initial value | ||
| getSearchParamsForLocation( | ||
| location.search, | ||
| hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current | ||
| ) | ||
| ), | ||
| [location.search] | ||
| ); | ||
| let navigate = _chunkY7DNFQZPjs.useNavigate.call(void 0, ); | ||
| let setSearchParams = React.useCallback( | ||
| (nextInit, navigateOptions) => { | ||
| const newSearchParams = createSearchParams( | ||
| typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit | ||
| ); | ||
| hasSetSearchParamsRef.current = true; | ||
| navigate("?" + newSearchParams, navigateOptions); | ||
| }, | ||
| [navigate, searchParams] | ||
| ); | ||
| return [searchParams, setSearchParams]; | ||
| } | ||
| var fetcherId = 0; | ||
| var getUniqueFetcherId = () => `__${String(++fetcherId)}__`; | ||
| function useSubmit() { | ||
| let { router } = useDataRouterContext("useSubmit" /* UseSubmit */); | ||
| let { basename } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let currentRouteId = _chunkY7DNFQZPjs.useRouteId.call(void 0, ); | ||
| let routerFetch = router.fetch; | ||
| let routerNavigate = router.navigate; | ||
| return React.useCallback( | ||
| async (target, options = {}) => { | ||
| let { action, method, encType, formData, body } = getFormSubmissionInfo( | ||
| target, | ||
| basename | ||
| ); | ||
| if (options.navigate === false) { | ||
| let key = options.fetcherKey || getUniqueFetcherId(); | ||
| await routerFetch(key, currentRouteId, options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| flushSync: options.flushSync | ||
| }); | ||
| } else { | ||
| await routerNavigate(options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| replace: options.replace, | ||
| state: options.state, | ||
| fromRouteId: currentRouteId, | ||
| flushSync: options.flushSync, | ||
| viewTransition: options.viewTransition | ||
| }); | ||
| } | ||
| }, | ||
| [routerFetch, routerNavigate, basename, currentRouteId] | ||
| ); | ||
| } | ||
| function useFormAction(action, { relative } = {}) { | ||
| let { basename } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let routeContext = React.useContext(_chunkY7DNFQZPjs.RouteContext); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext"); | ||
| let [match] = routeContext.matches.slice(-1); | ||
| let path = { ..._chunkY7DNFQZPjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) }; | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| if (action == null) { | ||
| path.search = location.search; | ||
| let params = new URLSearchParams(path.search); | ||
| let indexValues = params.getAll("index"); | ||
| let hasNakedIndexParam = indexValues.some((v) => v === ""); | ||
| if (hasNakedIndexParam) { | ||
| params.delete("index"); | ||
| indexValues.filter((v) => v).forEach((v) => params.append("index", v)); | ||
| let qs = params.toString(); | ||
| path.search = qs ? `?${qs}` : ""; | ||
| } | ||
| } | ||
| if ((!action || action === ".") && match.route.index) { | ||
| path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; | ||
| } | ||
| if (basename !== "/") { | ||
| path.pathname = path.pathname === "/" ? basename : _chunkY7DNFQZPjs.joinPaths.call(void 0, [basename, path.pathname]); | ||
| } | ||
| return _chunkY7DNFQZPjs.createPath.call(void 0, path); | ||
| } | ||
| function useFetcher({ | ||
| key | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useFetcher" /* UseFetcher */); | ||
| let state = useDataRouterState("useFetcher" /* UseFetcher */); | ||
| let fetcherData = React.useContext(_chunkY7DNFQZPjs.FetchersContext); | ||
| let route = React.useContext(_chunkY7DNFQZPjs.RouteContext); | ||
| let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, | ||
| routeId != null, | ||
| `useFetcher can only be used on routes that contain a unique "id"` | ||
| ); | ||
| let defaultKey = React.useId(); | ||
| let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey); | ||
| if (key && key !== fetcherKey) { | ||
| setFetcherKey(key); | ||
| } | ||
| let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router; | ||
| React.useEffect(() => { | ||
| getFetcher(fetcherKey); | ||
| return () => deleteFetcher(fetcherKey); | ||
| }, [deleteFetcher, getFetcher, fetcherKey]); | ||
| let load = React.useCallback( | ||
| async (href, opts) => { | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()"); | ||
| await routerFetch(fetcherKey, routeId, href, opts); | ||
| }, | ||
| [fetcherKey, routeId, routerFetch] | ||
| ); | ||
| let submitImpl = useSubmit(); | ||
| let submit = React.useCallback( | ||
| async (target, opts) => { | ||
| await submitImpl(target, { | ||
| ...opts, | ||
| navigate: false, | ||
| fetcherKey | ||
| }); | ||
| }, | ||
| [fetcherKey, submitImpl] | ||
| ); | ||
| let reset = React.useCallback( | ||
| (opts) => resetFetcher(fetcherKey, opts), | ||
| [resetFetcher, fetcherKey] | ||
| ); | ||
| let FetcherForm = React.useMemo(() => { | ||
| let FetcherForm2 = React.forwardRef( | ||
| (props, ref) => { | ||
| return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref }); | ||
| } | ||
| ); | ||
| FetcherForm2.displayName = "fetcher.Form"; | ||
| return FetcherForm2; | ||
| }, [fetcherKey]); | ||
| let fetcher = state.fetchers.get(fetcherKey) || _chunkY7DNFQZPjs.IDLE_FETCHER; | ||
| let data = fetcherData.get(fetcherKey); | ||
| let fetcherWithComponents = React.useMemo( | ||
| () => ({ | ||
| Form: FetcherForm, | ||
| submit, | ||
| load, | ||
| reset, | ||
| ...fetcher, | ||
| data | ||
| }), | ||
| [FetcherForm, submit, load, reset, fetcher, data] | ||
| ); | ||
| return fetcherWithComponents; | ||
| } | ||
| function useFetchers() { | ||
| let state = useDataRouterState("useFetchers" /* UseFetchers */); | ||
| return React.useMemo( | ||
| () => Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({ | ||
| ...fetcher, | ||
| key | ||
| })), | ||
| [state.fetchers] | ||
| ); | ||
| } | ||
| var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; | ||
| var savedScrollPositions = {}; | ||
| function getScrollRestorationKey(location, matches, basename, getKey) { | ||
| let key = null; | ||
| if (getKey) { | ||
| if (basename !== "/") { | ||
| key = getKey( | ||
| { | ||
| ...location, | ||
| pathname: _chunkY7DNFQZPjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname | ||
| }, | ||
| matches | ||
| ); | ||
| } else { | ||
| key = getKey(location, matches); | ||
| } | ||
| } | ||
| if (key == null) { | ||
| key = location.key; | ||
| } | ||
| return key; | ||
| } | ||
| function useScrollRestoration({ | ||
| getKey, | ||
| storageKey | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */); | ||
| let { restoreScrollPosition, preventScrollReset } = useDataRouterState( | ||
| "useScrollRestoration" /* UseScrollRestoration */ | ||
| ); | ||
| let { basename } = React.useContext(_chunkY7DNFQZPjs.NavigationContext); | ||
| let location = _chunkY7DNFQZPjs.useLocation.call(void 0, ); | ||
| let matches = _chunkY7DNFQZPjs.useMatches.call(void 0, ); | ||
| let navigation = _chunkY7DNFQZPjs.useNavigation.call(void 0, ); | ||
| React.useEffect(() => { | ||
| window.history.scrollRestoration = "manual"; | ||
| return () => { | ||
| window.history.scrollRestoration = "auto"; | ||
| }; | ||
| }, []); | ||
| usePageHide( | ||
| React.useCallback(() => { | ||
| if (navigation.state === "idle") { | ||
| let key = getScrollRestorationKey(location, matches, basename, getKey); | ||
| savedScrollPositions[key] = window.scrollY; | ||
| } | ||
| try { | ||
| sessionStorage.setItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY, | ||
| JSON.stringify(savedScrollPositions) | ||
| ); | ||
| } catch (error) { | ||
| _chunkY7DNFQZPjs.warning.call(void 0, | ||
| false, | ||
| `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).` | ||
| ); | ||
| } | ||
| window.history.scrollRestoration = "auto"; | ||
| }, [navigation.state, getKey, basename, location, matches, storageKey]) | ||
| ); | ||
| if (typeof document !== "undefined") { | ||
| React.useLayoutEffect(() => { | ||
| try { | ||
| let sessionPositions = sessionStorage.getItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY | ||
| ); | ||
| if (sessionPositions) { | ||
| savedScrollPositions = JSON.parse(sessionPositions); | ||
| } | ||
| } catch (e) { | ||
| } | ||
| }, [storageKey]); | ||
| React.useLayoutEffect(() => { | ||
| let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28( | ||
| savedScrollPositions, | ||
| () => window.scrollY, | ||
| getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0 | ||
| )]); | ||
| return () => disableScrollRestoration && disableScrollRestoration(); | ||
| }, [router, basename, getKey]); | ||
| React.useLayoutEffect(() => { | ||
| if (restoreScrollPosition === false) { | ||
| return; | ||
| } | ||
| if (typeof restoreScrollPosition === "number") { | ||
| window.scrollTo(0, restoreScrollPosition); | ||
| return; | ||
| } | ||
| try { | ||
| if (location.hash) { | ||
| let el = document.getElementById( | ||
| decodeURIComponent(location.hash.slice(1)) | ||
| ); | ||
| if (el) { | ||
| el.scrollIntoView(); | ||
| return; | ||
| } | ||
| } | ||
| } catch (e2) { | ||
| _chunkY7DNFQZPjs.warning.call(void 0, | ||
| false, | ||
| `"${location.hash.slice( | ||
| 1 | ||
| )}" is not a decodable element ID. The view will not scroll to it.` | ||
| ); | ||
| } | ||
| if (preventScrollReset === true) { | ||
| return; | ||
| } | ||
| window.scrollTo(0, 0); | ||
| }, [location, restoreScrollPosition, preventScrollReset]); | ||
| } | ||
| } | ||
| function useBeforeUnload(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("beforeunload", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("beforeunload", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePageHide(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("pagehide", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("pagehide", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePrompt({ | ||
| when, | ||
| message | ||
| }) { | ||
| let blocker = _chunkY7DNFQZPjs.useBlocker.call(void 0, when); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked") { | ||
| let proceed = window.confirm(message); | ||
| if (proceed) { | ||
| setTimeout(blocker.proceed, 0); | ||
| } else { | ||
| blocker.reset(); | ||
| } | ||
| } | ||
| }, [blocker, message]); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked" && !when) { | ||
| blocker.reset(); | ||
| } | ||
| }, [blocker, when]); | ||
| } | ||
| function useViewTransitionState(to, { relative } = {}) { | ||
| let vtContext = React.useContext(_chunkY7DNFQZPjs.ViewTransitionContext); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, | ||
| vtContext != null, | ||
| "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?" | ||
| ); | ||
| let { basename } = useDataRouterContext( | ||
| "useViewTransitionState" /* useViewTransitionState */ | ||
| ); | ||
| let path = _chunkY7DNFQZPjs.useResolvedPath.call(void 0, to, { relative }); | ||
| if (!vtContext.isTransitioning) { | ||
| return false; | ||
| } | ||
| let currentPath = _chunkY7DNFQZPjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname; | ||
| let nextPath = _chunkY7DNFQZPjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname; | ||
| return _chunkY7DNFQZPjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkY7DNFQZPjs.matchPath.call(void 0, path.pathname, currentPath) != null; | ||
| } | ||
| // lib/dom/server.tsx | ||
| function StaticRouter({ | ||
| basename, | ||
| children, | ||
| location: locationProp = "/" | ||
| }) { | ||
| if (typeof locationProp === "string") { | ||
| locationProp = _chunkY7DNFQZPjs.parsePath.call(void 0, locationProp); | ||
| } | ||
| let action = "POP" /* Pop */; | ||
| let location = { | ||
| pathname: locationProp.pathname || "/", | ||
| search: locationProp.search || "", | ||
| hash: locationProp.hash || "", | ||
| state: locationProp.state != null ? locationProp.state : null, | ||
| key: locationProp.key || "default", | ||
| mask: void 0 | ||
| }; | ||
| let staticNavigator = getStatelessNavigator(); | ||
| return /* @__PURE__ */ React2.createElement( | ||
| _chunkY7DNFQZPjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location, | ||
| navigationType: action, | ||
| navigator: staticNavigator, | ||
| static: true, | ||
| useTransitions: false | ||
| } | ||
| ); | ||
| } | ||
| function StaticRouterProvider({ | ||
| context, | ||
| router, | ||
| hydrate = true, | ||
| nonce | ||
| }) { | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, | ||
| router && context, | ||
| "You must provide `router` and `context` to <StaticRouterProvider>" | ||
| ); | ||
| let dataRouterContext = { | ||
| router, | ||
| navigator: getStatelessNavigator(), | ||
| static: true, | ||
| staticContext: context, | ||
| basename: context.basename || "/" | ||
| }; | ||
| let fetchersContext = /* @__PURE__ */ new Map(); | ||
| let hydrateScript = ""; | ||
| if (hydrate !== false) { | ||
| let data = { | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: serializeErrors(context.errors) | ||
| }; | ||
| let json = _chunkY7DNFQZPjs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data))); | ||
| hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`; | ||
| } | ||
| let { state } = dataRouterContext.router; | ||
| return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkY7DNFQZPjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkY7DNFQZPjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkY7DNFQZPjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkY7DNFQZPjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement( | ||
| _chunkY7DNFQZPjs.Router, | ||
| { | ||
| basename: dataRouterContext.basename, | ||
| location: state.location, | ||
| navigationType: state.historyAction, | ||
| navigator: dataRouterContext.navigator, | ||
| static: dataRouterContext.static, | ||
| useTransitions: false | ||
| }, | ||
| /* @__PURE__ */ React2.createElement( | ||
| _chunkY7DNFQZPjs.DataRoutes, | ||
| { | ||
| manifest: router.manifest, | ||
| routes: router.routes, | ||
| future: router.future, | ||
| state, | ||
| isStatic: true | ||
| } | ||
| ) | ||
| ))))), hydrateScript ? /* @__PURE__ */ React2.createElement( | ||
| "script", | ||
| { | ||
| suppressHydrationWarning: true, | ||
| nonce, | ||
| dangerouslySetInnerHTML: { __html: hydrateScript } | ||
| } | ||
| ) : null); | ||
| } | ||
| function serializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (_chunkY7DNFQZPjs.isRouteErrorResponse.call(void 0, val)) { | ||
| serialized[key] = { ...val, __type: "RouteErrorResponse" }; | ||
| } else if (val instanceof Error) { | ||
| serialized[key] = { | ||
| message: val.message, | ||
| __type: "Error", | ||
| // If this is a subclass (i.e., ReferenceError), send up the type so we | ||
| // can re-create the same type during hydration. | ||
| ...val.name !== "Error" ? { | ||
| __subType: val.name | ||
| } : {} | ||
| }; | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function getStatelessNavigator() { | ||
| return { | ||
| createHref, | ||
| encodeLocation, | ||
| push(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| replace(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| go(delta) { | ||
| throw new Error( | ||
| `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| back() { | ||
| throw new Error( | ||
| `You cannot use navigator.back() on the server because it is a stateless environment.` | ||
| ); | ||
| }, | ||
| forward() { | ||
| throw new Error( | ||
| `You cannot use navigator.forward() on the server because it is a stateless environment.` | ||
| ); | ||
| } | ||
| }; | ||
| } | ||
| function createStaticHandler2(routes, opts) { | ||
| return _chunkY7DNFQZPjs.createStaticHandler.call(void 0, routes, { | ||
| ...opts, | ||
| mapRouteProperties: _chunkY7DNFQZPjs.mapRouteProperties | ||
| }); | ||
| } | ||
| function createStaticRouter(routes, context, opts = {}) { | ||
| let manifest = {}; | ||
| let dataRoutes = _chunkY7DNFQZPjs.convertRoutesToDataRoutes.call(void 0, | ||
| routes, | ||
| _chunkY7DNFQZPjs.mapRouteProperties, | ||
| void 0, | ||
| manifest | ||
| ); | ||
| let matches = context.matches.map((match) => { | ||
| let route = manifest[match.route.id] || match.route; | ||
| return { | ||
| ...match, | ||
| route | ||
| }; | ||
| }); | ||
| let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`; | ||
| return { | ||
| get basename() { | ||
| return context.basename; | ||
| }, | ||
| get future() { | ||
| return { | ||
| v8_middleware: false, | ||
| v8_passThroughRequests: false, | ||
| v8_trailingSlashAwareDataRequests: false, | ||
| ..._optionalChain([opts, 'optionalAccess', _29 => _29.future]) | ||
| }; | ||
| }, | ||
| get state() { | ||
| return { | ||
| historyAction: "POP" /* Pop */, | ||
| location: context.location, | ||
| matches, | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: context.errors, | ||
| initialized: true, | ||
| renderFallback: false, | ||
| navigation: _chunkY7DNFQZPjs.IDLE_NAVIGATION, | ||
| restoreScrollPosition: null, | ||
| preventScrollReset: false, | ||
| revalidation: "idle", | ||
| fetchers: /* @__PURE__ */ new Map(), | ||
| blockers: /* @__PURE__ */ new Map() | ||
| }; | ||
| }, | ||
| get routes() { | ||
| return dataRoutes; | ||
| }, | ||
| get branches() { | ||
| return opts.branches; | ||
| }, | ||
| get manifest() { | ||
| return manifest; | ||
| }, | ||
| get window() { | ||
| return void 0; | ||
| }, | ||
| initialize() { | ||
| throw msg("initialize"); | ||
| }, | ||
| subscribe() { | ||
| throw msg("subscribe"); | ||
| }, | ||
| enableScrollRestoration() { | ||
| throw msg("enableScrollRestoration"); | ||
| }, | ||
| navigate() { | ||
| throw msg("navigate"); | ||
| }, | ||
| fetch() { | ||
| throw msg("fetch"); | ||
| }, | ||
| revalidate() { | ||
| throw msg("revalidate"); | ||
| }, | ||
| createHref, | ||
| encodeLocation, | ||
| getFetcher() { | ||
| return _chunkY7DNFQZPjs.IDLE_FETCHER; | ||
| }, | ||
| deleteFetcher() { | ||
| throw msg("deleteFetcher"); | ||
| }, | ||
| resetFetcher() { | ||
| throw msg("resetFetcher"); | ||
| }, | ||
| dispose() { | ||
| throw msg("dispose"); | ||
| }, | ||
| getBlocker() { | ||
| return _chunkY7DNFQZPjs.IDLE_BLOCKER; | ||
| }, | ||
| deleteBlocker() { | ||
| throw msg("deleteBlocker"); | ||
| }, | ||
| patchRoutes() { | ||
| throw msg("patchRoutes"); | ||
| }, | ||
| _internalFetchControllers: /* @__PURE__ */ new Map(), | ||
| _internalSetRoutes() { | ||
| throw msg("_internalSetRoutes"); | ||
| }, | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp() { | ||
| throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp"); | ||
| } | ||
| }; | ||
| } | ||
| function createHref(to) { | ||
| return typeof to === "string" ? to : _chunkY7DNFQZPjs.createPath.call(void 0, to); | ||
| } | ||
| function encodeLocation(to) { | ||
| let href = typeof to === "string" ? to : _chunkY7DNFQZPjs.createPath.call(void 0, to); | ||
| href = href.replace(/ $/, "%20"); | ||
| let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost"); | ||
| return { | ||
| pathname: encoded.pathname, | ||
| search: encoded.search, | ||
| hash: encoded.hash | ||
| }; | ||
| } | ||
| var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter; |
Sorry, the diff of this file is too big to display
| import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-U8FS-wNn.mjs'; | ||
| import * as React from 'react'; | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router$1 { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router$1; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router$1["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router$1; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
| hasErrorBoundary: boolean; | ||
| }; | ||
| declare const hydrationRouteProperties: (keyof RouteObject)[]; | ||
| /** | ||
| * @category Data Routers | ||
| */ | ||
| interface MemoryRouterOpts { | ||
| /** | ||
| * Basename path for the application. | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| /** | ||
| * Future flags to enable for the router. | ||
| */ | ||
| future?: Partial<FutureConfig>; | ||
| /** | ||
| * Hydration data to initialize the router with if you have already performed | ||
| * data loading on the server. | ||
| */ | ||
| hydrationData?: HydrationState; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Array of instrumentation objects allowing you to instrument the router and | ||
| * individual routes prior to router initialization (and on any subsequently | ||
| * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is | ||
| * mostly useful for observability such as wrapping navigations, fetches, | ||
| * as well as route loaders/actions/middlewares with logging and/or performance | ||
| * tracing. See the [docs](../../how-to/instrumentation) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * instrumentations: [logging] | ||
| * }); | ||
| * | ||
| * | ||
| * let logging = { | ||
| * router({ instrument }) { | ||
| * instrument({ | ||
| * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl), | ||
| * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl) | ||
| * }); | ||
| * }, | ||
| * route({ instrument, id }) { | ||
| * instrument({ | ||
| * middleware: (impl, info) => logExecution( | ||
| * `middleware ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * loader: (impl, info) => logExecution( | ||
| * `loader ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * action: (impl, info) => logExecution( | ||
| * `action ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * }) | ||
| * } | ||
| * }; | ||
| * | ||
| * async function logExecution(label: string, impl: () => Promise<void>) { | ||
| * let start = performance.now(); | ||
| * console.log(`start ${label}`); | ||
| * await impl(); | ||
| * let duration = Math.round(performance.now() - start); | ||
| * console.log(`end ${label} (${duration}ms)`); | ||
| * } | ||
| * ``` | ||
| */ | ||
| instrumentations?: ClientInstrumentation[]; | ||
| /** | ||
| * Override the default data strategy of running loaders in parallel - | ||
| * see the [docs](../../how-to/data-strategy) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * async dataStrategy({ | ||
| * matches, | ||
| * request, | ||
| * runClientMiddleware, | ||
| * }) { | ||
| * const matchesToLoad = matches.filter((m) => | ||
| * m.shouldCallHandler(), | ||
| * ); | ||
| * | ||
| * const results: Record<string, DataStrategyResult> = {}; | ||
| * await runClientMiddleware(() => | ||
| * Promise.all( | ||
| * matchesToLoad.map(async (match) => { | ||
| * results[match.route.id] = await match.resolve(); | ||
| * }), | ||
| * ), | ||
| * ); | ||
| * return results; | ||
| * }, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| dataStrategy?: DataStrategyFunction; | ||
| /** | ||
| * Lazily define portions of the route tree on navigations. | ||
| */ | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * Create a new {@link DataRouter} that manages the application path using an | ||
| * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack. Useful for non-browser environments without a DOM API. | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param routes Application routes | ||
| * @param opts Options | ||
| * @param {MemoryRouterOpts.basename} opts.basename n/a | ||
| * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a | ||
| * @param {MemoryRouterOpts.future} opts.future n/a | ||
| * @param {MemoryRouterOpts.getContext} opts.getContext n/a | ||
| * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a | ||
| * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a | ||
| * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a | ||
| * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a | ||
| * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a | ||
| * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`} | ||
| */ | ||
| declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1; | ||
| /** | ||
| * Function signature for client side error handling for loader/actions errors | ||
| * and rendering errors via `componentDidCatch` | ||
| */ | ||
| interface ClientOnErrorFunction { | ||
| (error: unknown, info: { | ||
| location: Location; | ||
| params: Params; | ||
| pattern: string; | ||
| errorInfo?: React.ErrorInfo; | ||
| }): void; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProviderProps { | ||
| /** | ||
| * The {@link DataRouter} instance to use for navigation and data fetching. | ||
| */ | ||
| router: Router$1; | ||
| /** | ||
| * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation to use for flushing updates. | ||
| * | ||
| * You usually don't have to worry about this: | ||
| * - The `RouterProvider` exported from `react-router/dom` handles this internally for you | ||
| * - If you are rendering in a non-DOM environment, you can import | ||
| * `RouterProvider` from `react-router` and ignore this prop | ||
| */ | ||
| flushSync?: (fn: () => unknown) => undefined; | ||
| /** | ||
| * An error handler function that will be called for any middleware, loader, action, | ||
| * or render errors that are encountered in your application. This is useful for | ||
| * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not | ||
| * subject to re-rendering and will only run one time per error. | ||
| * | ||
| * The `errorInfo` parameter is passed along from | ||
| * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch) | ||
| * and is only present for render errors. | ||
| * | ||
| * ```tsx | ||
| * <RouterProvider onError=(error, info) => { | ||
| * let { location, params, pattern, errorInfo } = info; | ||
| * console.error(error, location, errorInfo); | ||
| * reportToErrorService(error, location, errorInfo); | ||
| * }} /> | ||
| * ``` | ||
| */ | ||
| onError?: ClientOnErrorFunction; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - This can lead to buggy behaviors if you are wrapping your own | ||
| * navigations/fetchers in `startTransition`. | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and router state changes will be wrapped in | ||
| * `React.startTransition` and also sent through | ||
| * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to | ||
| * surface mid-navigation router state changes to the UI. | ||
| * - When set to `false`, the router will not leverage `React.startTransition` or | ||
| * `React.useOptimistic` on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Render the UI for the given {@link DataRouter}. This component should | ||
| * typically be at the top of an app's element tree. | ||
| * | ||
| * ```tsx | ||
| * import { createBrowserRouter } from "react-router"; | ||
| * import { RouterProvider } from "react-router/dom"; | ||
| * import { createRoot } from "react-dom/client"; | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * createRoot(document.getElementById("root")).render( | ||
| * <RouterProvider router={router} /> | ||
| * ); | ||
| * ``` | ||
| * | ||
| * <docs-info>Please note that this component is exported both from | ||
| * `react-router` and `react-router/dom` with the only difference being that the | ||
| * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation. You _almost always_ want to use the version from | ||
| * `react-router/dom` unless you're running in a non-DOM environment.</docs-info> | ||
| * | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {RouterProviderProps.flushSync} props.flushSync n/a | ||
| * @param {RouterProviderProps.onError} props.onError n/a | ||
| * @param {RouterProviderProps.router} props.router n/a | ||
| * @param {RouterProviderProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router | ||
| */ | ||
| declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface MemoryRouterProps { | ||
| /** | ||
| * Application basename | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * A declarative {@link Router | `<Router>`} that stores all entries in memory. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {MemoryRouterProps.basename} props.basename n/a | ||
| * @param {MemoryRouterProps.children} props.children n/a | ||
| * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a | ||
| * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a | ||
| * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns A declarative in-memory {@link Router | `<Router>`} for client-side | ||
| * routing. | ||
| */ | ||
| declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface NavigateProps { | ||
| /** | ||
| * The path to navigate to. This can be a string or a {@link Path} object | ||
| */ | ||
| to: To; | ||
| /** | ||
| * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack | ||
| */ | ||
| replace?: boolean; | ||
| /** | ||
| * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state). | ||
| */ | ||
| state?: any; | ||
| /** | ||
| * How to interpret relative routing in the `to` prop. | ||
| * See {@link RelativeRoutingType}. | ||
| */ | ||
| relative?: RelativeRoutingType; | ||
| } | ||
| /** | ||
| * A component-based version of {@link useNavigate} to use in a | ||
| * [`React.Component` class](https://react.dev/reference/react/Component) where | ||
| * hooks cannot be used. | ||
| * | ||
| * It's recommended to avoid using this component in favor of {@link useNavigate}. | ||
| * | ||
| * @example | ||
| * <Navigate to="/tasks" /> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {NavigateProps.relative} props.relative n/a | ||
| * @param {NavigateProps.replace} props.replace n/a | ||
| * @param {NavigateProps.state} props.state n/a | ||
| * @param {NavigateProps.to} props.to n/a | ||
| * @returns {void} | ||
| * | ||
| */ | ||
| declare function Navigate({ to, replace, state, relative, }: NavigateProps): null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface OutletProps { | ||
| /** | ||
| * Provides a context value to the element tree below the outlet. Use when | ||
| * the parent route needs to provide values to child routes. | ||
| * | ||
| * ```tsx | ||
| * <Outlet context={myContextValue} /> | ||
| * ``` | ||
| * | ||
| * Access the context with {@link useOutletContext}. | ||
| */ | ||
| context?: unknown; | ||
| } | ||
| /** | ||
| * Renders the matching child route of a parent route or nothing if no child | ||
| * route matches. | ||
| * | ||
| * @example | ||
| * import { Outlet } from "react-router"; | ||
| * | ||
| * export default function SomeParent() { | ||
| * return ( | ||
| * <div> | ||
| * <h1>Parent Content</h1> | ||
| * <Outlet /> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {OutletProps.context} props.context n/a | ||
| * @returns React element for the rendered outlet or `null` if no child route matches. | ||
| */ | ||
| declare function Outlet(props: OutletProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface PathRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: NonIndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: NonIndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: NonIndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<NonIndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: NonIndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: NonIndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: NonIndexRouteObject["action"]; | ||
| hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: NonIndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index?: false; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface LayoutRouteProps extends PathRouteProps { | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface IndexRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: IndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: IndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: IndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<IndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: IndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: IndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: IndexRouteObject["action"]; | ||
| hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: IndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: IndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index: true; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: undefined; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps; | ||
| /** | ||
| * Configures an element to render when a pattern matches the current location. | ||
| * It must be rendered within a {@link Routes} element. Note that these routes | ||
| * do not participate in data loading, actions, code splitting, or any other | ||
| * route module features. | ||
| * | ||
| * @example | ||
| * // Usually used in a declarative router | ||
| * function App() { | ||
| * return ( | ||
| * <BrowserRouter> | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * </BrowserRouter> | ||
| * ); | ||
| * } | ||
| * | ||
| * // But can be used with a data router as well if you prefer the JSX notation | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {PathRouteProps.action} props.action n/a | ||
| * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a | ||
| * @param {PathRouteProps.Component} props.Component n/a | ||
| * @param {PathRouteProps.children} props.children n/a | ||
| * @param {PathRouteProps.element} props.element n/a | ||
| * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a | ||
| * @param {PathRouteProps.errorElement} props.errorElement n/a | ||
| * @param {PathRouteProps.handle} props.handle n/a | ||
| * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a | ||
| * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a | ||
| * @param {PathRouteProps.id} props.id n/a | ||
| * @param {PathRouteProps.index} props.index n/a | ||
| * @param {PathRouteProps.lazy} props.lazy n/a | ||
| * @param {PathRouteProps.loader} props.loader n/a | ||
| * @param {PathRouteProps.path} props.path n/a | ||
| * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a | ||
| * @returns {void} | ||
| */ | ||
| declare function Route(props: RouteProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProps { | ||
| /** | ||
| * The base path for the application. This is prepended to all locations | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The location to match against. Defaults to the current location. | ||
| * This can be a string or a {@link Location} object. | ||
| */ | ||
| location: Partial<Location> | string; | ||
| /** | ||
| * The type of navigation that triggered this `location` change. | ||
| * Defaults to {@link NavigationType.Pop}. | ||
| */ | ||
| navigationType?: Action; | ||
| /** | ||
| * The navigator to use for navigation. This is usually a history object | ||
| * or a custom navigator that implements the {@link Navigator} interface. | ||
| */ | ||
| navigator: Navigator; | ||
| /** | ||
| * Whether this router is static or not (used for SSR). If `true`, the router | ||
| * will not be reactive to location changes. | ||
| */ | ||
| static?: boolean; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Provides location context for the rest of the app. | ||
| * | ||
| * Note: You usually won't render a `<Router>` directly. Instead, you'll render a | ||
| * router that is more specific to your environment such as a {@link BrowserRouter} | ||
| * in web browsers or a {@link ServerRouter} for server rendering. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {RouterProps.basename} props.basename n/a | ||
| * @param {RouterProps.children} props.children n/a | ||
| * @param {RouterProps.location} props.location n/a | ||
| * @param {RouterProps.navigationType} props.navigationType n/a | ||
| * @param {RouterProps.navigator} props.navigator n/a | ||
| * @param {RouterProps.static} props.static n/a | ||
| * @param {RouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router or `null` if the location does | ||
| * not match the {@link props.basename} | ||
| */ | ||
| declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RoutesProps { | ||
| /** | ||
| * Nested {@link Route} elements | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The {@link Location} to match against. Defaults to the current location. | ||
| */ | ||
| location?: Partial<Location> | string; | ||
| } | ||
| /** | ||
| * Renders a branch of {@link Route | `<Route>`s} that best matches the current | ||
| * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader), | ||
| * [`action`](../../start/framework/route-module#action), code splitting, or | ||
| * any other [route module](../../start/framework/route-module) features. | ||
| * | ||
| * @example | ||
| * import { Route, Routes } from "react-router"; | ||
| * | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {RoutesProps.children} props.children n/a | ||
| * @param {RoutesProps.location} props.location n/a | ||
| * @returns React element for the rendered routes or `null` if no route matches | ||
| */ | ||
| declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; | ||
| interface AwaitResolveRenderFunction<Resolve = any> { | ||
| (data: Awaited<Resolve>): React.ReactNode; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface AwaitProps<Resolve> { | ||
| /** | ||
| * When using a function, the resolved value is provided as the parameter. | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * {(resolvedReviews) => <Reviews items={resolvedReviews} />} | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * When using React elements, {@link useAsyncValue} will provide the | ||
| * resolved value: | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function Reviews() { | ||
| * const resolvedReviews = useAsyncValue(); | ||
| * return <div>...</div>; | ||
| * } | ||
| * ``` | ||
| */ | ||
| children: React.ReactNode | AwaitResolveRenderFunction<Resolve>; | ||
| /** | ||
| * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * rejects. | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<div>Oops</div>} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * To provide a more contextual error, you can use the {@link useAsyncError} in a | ||
| * child component | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<ReviewsError />} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function ReviewsError() { | ||
| * const error = useAsyncError(); | ||
| * return <div>Error loading reviews: {error.message}</div>; | ||
| * } | ||
| * ``` | ||
| * | ||
| * If you do not provide an `errorElement`, the rejected value will bubble up | ||
| * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary) | ||
| * and be accessible via the {@link useRouteError} hook. | ||
| */ | ||
| errorElement?: React.ReactNode; | ||
| /** | ||
| * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * returned from a [`loader`](../../start/framework/route-module#loader) to be | ||
| * resolved and rendered. | ||
| * | ||
| * ```tsx | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * let reviews = getReviews(); // not awaited | ||
| * let book = await getBook(); | ||
| * return { | ||
| * book, | ||
| * reviews, // this is a promise | ||
| * }; | ||
| * } | ||
| * | ||
| * export default function Book() { | ||
| * const { | ||
| * book, | ||
| * reviews, // this is the same promise | ||
| * } = useLoaderData(); | ||
| * | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * // and is the promise we pass to Await | ||
| * resolve={reviews} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| */ | ||
| resolve: Resolve; | ||
| } | ||
| /** | ||
| * Used to render promise values with automatic error handling. | ||
| * | ||
| * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense) | ||
| * | ||
| * @example | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * // not awaited | ||
| * const reviews = getReviews(); | ||
| * // awaited (blocks the transition) | ||
| * const book = await fetch("/api/book").then((res) => res.json()); | ||
| * return { book, reviews }; | ||
| * } | ||
| * | ||
| * function Book() { | ||
| * const { book, reviews } = useLoaderData(); | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * resolve={reviews} | ||
| * errorElement={ | ||
| * <div>Could not load reviews 😬</div> | ||
| * } | ||
| * children={(resolvedReviews) => ( | ||
| * <Reviews items={resolvedReviews} /> | ||
| * )} | ||
| * /> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @mode framework | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {AwaitProps.children} props.children n/a | ||
| * @param {AwaitProps.errorElement} props.errorElement n/a | ||
| * @param {AwaitProps.resolve} props.resolve n/a | ||
| * @returns React element for the rendered awaited value | ||
| */ | ||
| declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element; | ||
| /** | ||
| * Creates a route config from a React "children" object, which is usually | ||
| * either a `<Route>` element or an array of them. Used internally by | ||
| * `<Routes>` to create a route config from its children. | ||
| * | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; | ||
| /** | ||
| * Create route objects from JSX elements instead of arrays of objects. | ||
| * | ||
| * @example | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @name createRoutesFromElements | ||
| * @public | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * This is used for internal recursion and is not intended to be used by the | ||
| * application developer. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare const createRoutesFromElements: typeof createRoutesFromChildren; | ||
| /** | ||
| * Renders the result of {@link matchRoutes} into a React element. | ||
| * | ||
| * @public | ||
| * @category Utils | ||
| * @param matches The array of {@link RouteMatch | route matches} to render | ||
| * @returns A React element that renders the matched routes or `null` if no matches | ||
| */ | ||
| declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; | ||
| declare function useRouteComponentProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }; | ||
| type RouteComponentProps = ReturnType<typeof useRouteComponentProps>; | ||
| type RouteComponentType = React.ComponentType<RouteComponentProps>; | ||
| declare function WithComponentProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useHydrateFallbackProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }; | ||
| type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>; | ||
| type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>; | ||
| declare function WithHydrateFallbackProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useErrorBoundaryProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }; | ||
| type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>; | ||
| type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>; | ||
| declare function WithErrorBoundaryProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> { | ||
| router: Router$1; | ||
| staticContext?: StaticHandlerContext; | ||
| onError?: ClientOnErrorFunction; | ||
| } | ||
| declare const DataRouterContext: React.Context<DataRouterContextObject | null>; | ||
| declare const DataRouterStateContext: React.Context<RouterState | null>; | ||
| type ViewTransitionContextObject = { | ||
| isTransitioning: false; | ||
| } | { | ||
| isTransitioning: true; | ||
| flushSync: boolean; | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>; | ||
| type FetchersContextObject = Map<string, any>; | ||
| declare const FetchersContext: React.Context<FetchersContextObject>; | ||
| declare const AwaitContext: React.Context<TrackedPromise | null>; | ||
| declare const AwaitContextProvider: (props: React.ComponentProps<typeof AwaitContext.Provider>) => React.FunctionComponentElement<React.ProviderProps<TrackedPromise | null>>; | ||
| interface NavigateOptions { | ||
| /** Replace the current entry in the history stack instead of pushing a new one */ | ||
| replace?: boolean; | ||
| /** Masked URL */ | ||
| mask?: To; | ||
| /** Adds persistent client side routing state to the next location */ | ||
| state?: any; | ||
| /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */ | ||
| preventScrollReset?: boolean; | ||
| /** 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. */ | ||
| relative?: RelativeRoutingType; | ||
| /** 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} */ | ||
| flushSync?: boolean; | ||
| /** 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 useViewTransitionState `useViewTransitionState()`} hook. */ | ||
| viewTransition?: boolean; | ||
| /** Specifies the default revalidation behavior after this submission */ | ||
| defaultShouldRevalidate?: boolean; | ||
| } | ||
| /** | ||
| * A Navigator is a "location changer"; it's how you get to different locations. | ||
| * | ||
| * Every history instance conforms to the Navigator interface, but the | ||
| * distinction is useful primarily when it comes to the low-level `<Router>` API | ||
| * where both the location and a navigator must be provided separately in order | ||
| * to avoid "tearing" that may occur in a suspense-enabled app if the action | ||
| * and/or location were to be read directly from the history instance. | ||
| */ | ||
| interface Navigator { | ||
| createHref: History["createHref"]; | ||
| encodeLocation?: History["encodeLocation"]; | ||
| go: History["go"]; | ||
| push(to: To, state?: any, opts?: NavigateOptions): void; | ||
| replace(to: To, state?: any, opts?: NavigateOptions): void; | ||
| } | ||
| interface NavigationContextObject { | ||
| basename: string; | ||
| navigator: Navigator; | ||
| static: boolean; | ||
| useTransitions: boolean | undefined; | ||
| future: {}; | ||
| } | ||
| declare const NavigationContext: React.Context<NavigationContextObject>; | ||
| interface LocationContextObject { | ||
| location: Location; | ||
| navigationType: Action; | ||
| } | ||
| declare const LocationContext: React.Context<LocationContextObject>; | ||
| interface RouteContextObject { | ||
| outlet: React.ReactElement | null; | ||
| matches: RouteMatch[]; | ||
| isDataRoute: boolean; | ||
| } | ||
| declare const RouteContext: React.Context<RouteContextObject>; | ||
| export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type RouterState as g, type GetScrollRestorationKeyFunction as h, type StaticHandlerContext as i, type Navigation as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-D4xhSy90.js'; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type Navigation as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u }; |
| import { R as RouteModule } from './data-D4xhSy90.js'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import { R as RouteModule } from './data-U8FS-wNn.mjs'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import * as React from 'react'; | ||
| import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-ByvtofY2.mjs'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-3AnU12UI.mjs'; | ||
| import './data-BVUf681J.mjs'; | ||
| import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-m8rizgnE.mjs'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-nIQ4Nsyi.mjs'; | ||
| import './data-U8FS-wNn.mjs'; | ||
@@ -6,0 +6,0 @@ type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">; |
| import * as React from 'react'; | ||
| import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router'; | ||
| import { C as ClientInstrumentation } from './instrumentation-cRWWLfsU.js'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BOdXz9dK.js'; | ||
| import './data-BqZ2x964.js'; | ||
| import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js'; | ||
| import './data-D4xhSy90.js'; | ||
@@ -7,0 +7,0 @@ type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -16,3 +16,3 @@ * Copyright (c) Remix Software Inc. | ||
| var _chunk4YRVXM2Ujs = require('./chunk-4YRVXM2U.js'); | ||
| var _chunkXEJDWL2Bjs = require('./chunk-XEJDWL2B.js'); | ||
@@ -38,3 +38,3 @@ | ||
| var _chunkD6LUOGOQjs = require('./chunk-D6LUOGOQ.js'); | ||
| var _chunkSRID2YZ2js = require('./chunk-SRID2YZ2.js'); | ||
@@ -180,3 +180,3 @@ // lib/dom-export/dom-router-provider.tsx | ||
| ssrInfo.context.basename, | ||
| ssrInfo.context.future.unstable_trailingSlashAwareDataRequests | ||
| ssrInfo.context.future.v8_trailingSlashAwareDataRequests | ||
| ), | ||
@@ -220,3 +220,3 @@ patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0, | ||
| if (process.env.NODE_ENV === "development" && criticalCss === void 0) { | ||
| document.querySelectorAll(`[${_chunkD6LUOGOQjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); | ||
| document.querySelectorAll(`[${_chunkSRID2YZ2js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); | ||
| } | ||
@@ -400,3 +400,3 @@ }, [criticalCss]); | ||
| globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {})); | ||
| _chunk4YRVXM2Ujs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); | ||
| _chunkXEJDWL2Bjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); | ||
| let routes = payload.matches.reduceRight((previous, match) => { | ||
@@ -415,8 +415,8 @@ const route = createRouteFromServerManifest( | ||
| let applyPatchesPromise; | ||
| globalVar.__reactRouterDataRouter = _chunkD6LUOGOQjs.createRouter.call(void 0, { | ||
| globalVar.__reactRouterDataRouter = _chunkSRID2YZ2js.createRouter.call(void 0, { | ||
| routes, | ||
| getContext, | ||
| basename: payload.basename, | ||
| history: _chunkD6LUOGOQjs.createBrowserHistory.call(void 0, ), | ||
| hydrationData: _chunk4YRVXM2Ujs.getHydrationData.call(void 0, { | ||
| history: _chunkSRID2YZ2js.createBrowserHistory.call(void 0, ), | ||
| hydrationData: _chunkXEJDWL2Bjs.getHydrationData.call(void 0, { | ||
| state: { | ||
@@ -430,3 +430,3 @@ loaderData: payload.loaderData, | ||
| let match = payload.matches.find((m) => m.id === routeId); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, match, "Route not found in payload"); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, match, "Route not found in payload"); | ||
| return { | ||
@@ -546,5 +546,5 @@ clientLoader: match.clientLoader, | ||
| } | ||
| var renderedRoutesContext = _chunkD6LUOGOQjs.createContext.call(void 0, ); | ||
| var renderedRoutesContext = _chunkSRID2YZ2js.createContext.call(void 0, ); | ||
| function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) { | ||
| let dataStrategy = _chunkD6LUOGOQjs.getSingleFetchDataStrategyImpl.call(void 0, | ||
| let dataStrategy = _chunkSRID2YZ2js.getSingleFetchDataStrategyImpl.call(void 0, | ||
| getRouter, | ||
@@ -606,5 +606,5 @@ (match) => { | ||
| let { request, context } = args; | ||
| let url = _chunkD6LUOGOQjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc"); | ||
| let url = _chunkSRID2YZ2js.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc"); | ||
| if (request.method === "GET") { | ||
| url = _chunkD6LUOGOQjs.stripIndexParam.call(void 0, url); | ||
| url = _chunkSRID2YZ2js.stripIndexParam.call(void 0, url); | ||
| if (targetRoutes) { | ||
@@ -615,8 +615,8 @@ url.searchParams.set("_routes", targetRoutes.join(",")); | ||
| let res = await fetchImplementation( | ||
| new Request(url, await _chunkD6LUOGOQjs.createRequestInit.call(void 0, request)) | ||
| new Request(url, await _chunkSRID2YZ2js.createRequestInit.call(void 0, request)) | ||
| ); | ||
| if (res.status >= 400 && !res.headers.has("X-Remix-Response")) { | ||
| throw new (0, _chunkD6LUOGOQjs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); | ||
| throw new (0, _chunkSRID2YZ2js.ErrorResponseImpl)(res.status, res.statusText, await res.text()); | ||
| } | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, res.body, "No response body to decode"); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, res.body, "No response body to decode"); | ||
| try { | ||
@@ -645,3 +645,3 @@ const payload = await createFromReadableStream(res.body, { | ||
| let results = { routes: {} }; | ||
| const dataKey = _chunkD6LUOGOQjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; | ||
| const dataKey = _chunkSRID2YZ2js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; | ||
| for (let [routeId, data] of Object.entries(payload[dataKey] || {})) { | ||
@@ -679,3 +679,3 @@ results.routes[routeId] = { data }; | ||
| React3.useEffect(() => { | ||
| _chunkD6LUOGOQjs.setIsHydrated.call(void 0, ); | ||
| _chunkSRID2YZ2js.setIsHydrated.call(void 0, ); | ||
| }, []); | ||
@@ -765,3 +765,3 @@ React3.useLayoutEffect(() => { | ||
| v8_middleware: false, | ||
| unstable_trailingSlashAwareDataRequests: true, | ||
| v8_trailingSlashAwareDataRequests: true, | ||
| // always on for RSC | ||
@@ -789,4 +789,4 @@ v8_passThroughRequests: true | ||
| }; | ||
| return /* @__PURE__ */ React3.createElement(_chunkD6LUOGOQjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk4YRVXM2Ujs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkD6LUOGOQjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( | ||
| _chunkD6LUOGOQjs.RouterProvider, | ||
| return /* @__PURE__ */ React3.createElement(_chunkSRID2YZ2js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkXEJDWL2Bjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkSRID2YZ2js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( | ||
| _chunkSRID2YZ2js.RouterProvider, | ||
| { | ||
@@ -807,4 +807,4 @@ router: transitionEnabledRouter, | ||
| match.hasComponent && !match.element; | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, window.__reactRouterRouteModules); | ||
| _chunk4YRVXM2Ujs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, window.__reactRouterRouteModules); | ||
| _chunkXEJDWL2Bjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); | ||
| let dataRoute = { | ||
@@ -857,3 +857,3 @@ id: match.id, | ||
| }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => { | ||
| throw _chunkD6LUOGOQjs.noActionDefinedError.call(void 0, "action", match.id); | ||
| throw _chunkSRID2YZ2js.noActionDefinedError.call(void 0, "action", match.id); | ||
| }, | ||
@@ -870,3 +870,3 @@ path: match.path, | ||
| if (typeof dataRoute.loader === "function") { | ||
| dataRoute.loader.hydrate = _chunkD6LUOGOQjs.shouldHydrateRouteLoader.call(void 0, | ||
| dataRoute.loader.hydrate = _chunkSRID2YZ2js.shouldHydrateRouteLoader.call(void 0, | ||
| match.id, | ||
@@ -881,3 +881,3 @@ match.clientLoader, | ||
| function callSingleFetch(singleFetch) { | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); | ||
| _chunkSRID2YZ2js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); | ||
| return singleFetch(); | ||
@@ -890,3 +890,3 @@ } | ||
| console.error(msg); | ||
| throw new (0, _chunkD6LUOGOQjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); | ||
| throw new (0, _chunkSRID2YZ2js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); | ||
| } | ||
@@ -918,3 +918,3 @@ } | ||
| } | ||
| if (url.toString().length > _chunkD6LUOGOQjs.URL_LIMIT) { | ||
| if (url.toString().length > _chunkSRID2YZ2js.URL_LIMIT) { | ||
| nextPaths.clear(); | ||
@@ -964,3 +964,3 @@ return; | ||
| try { | ||
| return _chunkD6LUOGOQjs.invalidProtocols.includes(new URL(location2).protocol); | ||
| return _chunkSRID2YZ2js.invalidProtocols.includes(new URL(location2).protocol); | ||
| } catch (e2) { | ||
@@ -967,0 +967,0 @@ return false; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -17,3 +17,3 @@ * Copyright (c) Remix Software Inc. | ||
| populateRSCRouteModules | ||
| } from "./chunk-RJYABSBD.mjs"; | ||
| } from "./chunk-S54KXAEJ.mjs"; | ||
| import { | ||
@@ -48,3 +48,3 @@ CRITICAL_CSS_DATA_ATTRIBUTE, | ||
| useFogOFWarDiscovery | ||
| } from "./chunk-4N6VE7H7.mjs"; | ||
| } from "./chunk-QUQL4437.mjs"; | ||
@@ -172,3 +172,3 @@ // lib/dom-export/dom-router-provider.tsx | ||
| ssrInfo.context.basename, | ||
| ssrInfo.context.future.unstable_trailingSlashAwareDataRequests | ||
| ssrInfo.context.future.v8_trailingSlashAwareDataRequests | ||
| ), | ||
@@ -748,3 +748,3 @@ patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction( | ||
| v8_middleware: false, | ||
| unstable_trailingSlashAwareDataRequests: true, | ||
| v8_trailingSlashAwareDataRequests: true, | ||
| // always on for RSC | ||
@@ -751,0 +751,0 @@ v8_passThroughRequests: true |
@@ -1,4 +0,4 @@ | ||
| export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-ByvtofY2.mjs'; | ||
| export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DY04-103.mjs'; | ||
| import './data-BVUf681J.mjs'; | ||
| export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-m8rizgnE.mjs'; | ||
| export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CdKROblb.mjs'; | ||
| import './data-U8FS-wNn.mjs'; | ||
| import 'react'; |
@@ -1,4 +0,4 @@ | ||
| export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BS5F89FR.js'; | ||
| import './instrumentation-cRWWLfsU.js'; | ||
| import './data-BqZ2x964.js'; | ||
| export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BLiUx67a.js'; | ||
| import './instrumentation-1q4YhLGP.js'; | ||
| import './data-D4xhSy90.js'; | ||
| import 'react'; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true});/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -22,3 +22,3 @@ * Copyright (c) Remix Software Inc. | ||
| var _chunk66UKHEGQjs = require('./chunk-66UKHEGQ.js'); | ||
| var _chunkIBI7OMNBjs = require('./chunk-IBI7OMNB.js'); | ||
@@ -38,3 +38,3 @@ | ||
| var _chunkD6LUOGOQjs = require('./chunk-D6LUOGOQ.js'); | ||
| var _chunkSRID2YZ2js = require('./chunk-SRID2YZ2.js'); | ||
@@ -63,2 +63,2 @@ | ||
| exports.BrowserRouter = _chunk66UKHEGQjs.BrowserRouter; exports.Form = _chunk66UKHEGQjs.Form; exports.HashRouter = _chunk66UKHEGQjs.HashRouter; exports.Link = _chunk66UKHEGQjs.Link; exports.Links = _chunkD6LUOGOQjs.Links; exports.MemoryRouter = _chunkD6LUOGOQjs.MemoryRouter; exports.Meta = _chunkD6LUOGOQjs.Meta; exports.NavLink = _chunk66UKHEGQjs.NavLink; exports.Navigate = _chunkD6LUOGOQjs.Navigate; exports.Outlet = _chunkD6LUOGOQjs.Outlet; exports.Route = _chunkD6LUOGOQjs.Route; exports.Router = _chunkD6LUOGOQjs.Router; exports.RouterProvider = _chunkD6LUOGOQjs.RouterProvider; exports.Routes = _chunkD6LUOGOQjs.Routes; exports.ScrollRestoration = _chunk66UKHEGQjs.ScrollRestoration; exports.StaticRouter = _chunk66UKHEGQjs.StaticRouter; exports.StaticRouterProvider = _chunk66UKHEGQjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkD6LUOGOQjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkD6LUOGOQjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkD6LUOGOQjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkD6LUOGOQjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunk66UKHEGQjs.HistoryRouter; | ||
| exports.BrowserRouter = _chunkIBI7OMNBjs.BrowserRouter; exports.Form = _chunkIBI7OMNBjs.Form; exports.HashRouter = _chunkIBI7OMNBjs.HashRouter; exports.Link = _chunkIBI7OMNBjs.Link; exports.Links = _chunkSRID2YZ2js.Links; exports.MemoryRouter = _chunkSRID2YZ2js.MemoryRouter; exports.Meta = _chunkSRID2YZ2js.Meta; exports.NavLink = _chunkIBI7OMNBjs.NavLink; exports.Navigate = _chunkSRID2YZ2js.Navigate; exports.Outlet = _chunkSRID2YZ2js.Outlet; exports.Route = _chunkSRID2YZ2js.Route; exports.Router = _chunkSRID2YZ2js.Router; exports.RouterProvider = _chunkSRID2YZ2js.RouterProvider; exports.Routes = _chunkSRID2YZ2js.Routes; exports.ScrollRestoration = _chunkIBI7OMNBjs.ScrollRestoration; exports.StaticRouter = _chunkIBI7OMNBjs.StaticRouter; exports.StaticRouterProvider = _chunkIBI7OMNBjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkSRID2YZ2js.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkSRID2YZ2js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkSRID2YZ2js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkSRID2YZ2js.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkIBI7OMNBjs.HistoryRouter; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -35,3 +35,3 @@ * Copyright (c) Remix Software Inc. | ||
| WithHydrateFallbackProps | ||
| } from "./chunk-4N6VE7H7.mjs"; | ||
| } from "./chunk-QUQL4437.mjs"; | ||
| export { | ||
@@ -38,0 +38,0 @@ BrowserRouter, |
@@ -1,15 +0,15 @@ | ||
| import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-BVUf681J.mjs'; | ||
| export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-BVUf681J.mjs'; | ||
| import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, g as Navigation, H as HydrationState, h as RouterState } from './context-ByvtofY2.mjs'; | ||
| export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, i as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, j as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-ByvtofY2.mjs'; | ||
| import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-U8FS-wNn.mjs'; | ||
| export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-U8FS-wNn.mjs'; | ||
| import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, H as HydrationState, g as RouterState } from './context-m8rizgnE.mjs'; | ||
| export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, h as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, j as Navigation, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, i as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-m8rizgnE.mjs'; | ||
| import * as React from 'react'; | ||
| import React__default, { ReactElement } from 'react'; | ||
| import { a as RouteModules$1, P as Pages } from './register-Df8okEea.mjs'; | ||
| export { b as Register } from './register-Df8okEea.mjs'; | ||
| import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DY04-103.mjs'; | ||
| export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DY04-103.mjs'; | ||
| import { a as RouteModules$1, P as Pages } from './register-CqK96Zfk.mjs'; | ||
| export { b as Register } from './register-CqK96Zfk.mjs'; | ||
| import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CdKROblb.mjs'; | ||
| export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CdKROblb.mjs'; | ||
| import { ParseOptions, SerializeOptions } from 'cookie'; | ||
| export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-3AnU12UI.mjs'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-3AnU12UI.mjs'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-nIQ4Nsyi.mjs'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-nIQ4Nsyi.mjs'; | ||
@@ -529,2 +529,8 @@ declare const SingleFetchRedirectSymbol: unique symbol; | ||
| declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
| type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates]; | ||
| type UseNavigationResultStates = { | ||
| Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">; | ||
| Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">; | ||
| Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">; | ||
| }; | ||
| /** | ||
@@ -552,3 +558,3 @@ * Returns the current {@link Navigation}, defaulting to an "idle" navigation | ||
| */ | ||
| declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">; | ||
| declare function useNavigation(): UseNavigationResult; | ||
| /** | ||
@@ -1474,2 +1480,2 @@ * Revalidate the data on the page for reasons outside of normal data mutations | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; |
@@ -1,15 +0,15 @@ | ||
| import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-BqZ2x964.js'; | ||
| export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-BqZ2x964.js'; | ||
| import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, d as Navigation, H as HydrationState, e as RouterState } from './instrumentation-cRWWLfsU.js'; | ||
| export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, f as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, g as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-cRWWLfsU.js'; | ||
| import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-BS5F89FR.js'; | ||
| export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-BS5F89FR.js'; | ||
| import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-D4xhSy90.js'; | ||
| export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-D4xhSy90.js'; | ||
| import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, H as HydrationState, d as RouterState } from './instrumentation-1q4YhLGP.js'; | ||
| export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, g as Navigation, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-1q4YhLGP.js'; | ||
| import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-BLiUx67a.js'; | ||
| export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-BLiUx67a.js'; | ||
| import * as React from 'react'; | ||
| import React__default, { ReactElement } from 'react'; | ||
| import { a as RouteModules$1, P as Pages } from './register-Bsscfj79.js'; | ||
| export { b as Register } from './register-Bsscfj79.js'; | ||
| import { a as RouteModules$1, P as Pages } from './register-CNAx3TXj.js'; | ||
| export { b as Register } from './register-CNAx3TXj.js'; | ||
| import { ParseOptions, SerializeOptions } from 'cookie'; | ||
| export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-BOdXz9dK.js'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-BOdXz9dK.js'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-D3uq9sI1.js'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-D3uq9sI1.js'; | ||
@@ -529,2 +529,8 @@ declare const SingleFetchRedirectSymbol: unique symbol; | ||
| declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
| type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates]; | ||
| type UseNavigationResultStates = { | ||
| Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">; | ||
| Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">; | ||
| Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">; | ||
| }; | ||
| /** | ||
@@ -552,3 +558,3 @@ * Returns the current {@link Navigation}, defaulting to an "idle" navigation | ||
| */ | ||
| declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">; | ||
| declare function useNavigation(): UseNavigationResult; | ||
| /** | ||
@@ -1474,2 +1480,2 @@ * Revalidate the data on the page for reasons outside of normal data mutations | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -31,3 +31,3 @@ * Copyright (c) Remix Software Inc. | ||
| setDevServerHooks | ||
| } from "./chunk-RJYABSBD.mjs"; | ||
| } from "./chunk-S54KXAEJ.mjs"; | ||
| import { | ||
@@ -146,3 +146,3 @@ Action, | ||
| withHydrateFallbackProps | ||
| } from "./chunk-4N6VE7H7.mjs"; | ||
| } from "./chunk-QUQL4437.mjs"; | ||
| export { | ||
@@ -149,0 +149,0 @@ Await, |
@@ -1,3 +0,3 @@ | ||
| import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-BVUf681J.mjs'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-Df8okEea.mjs'; | ||
| import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-U8FS-wNn.mjs'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs'; | ||
| import 'react'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
| import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-BqZ2x964.js'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-Bsscfj79.js'; | ||
| import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-D4xhSy90.js'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js'; | ||
| import 'react'; | ||
@@ -4,0 +4,0 @@ |
| "use strict";/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| import * as React from 'react'; | ||
| import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-ByvtofY2.mjs'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-3AnU12UI.mjs'; | ||
| import './data-BVUf681J.mjs'; | ||
| import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-m8rizgnE.mjs'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-nIQ4Nsyi.mjs'; | ||
| import './data-U8FS-wNn.mjs'; | ||
@@ -6,0 +6,0 @@ type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">; |
| import * as React from 'react'; | ||
| import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router'; | ||
| import { C as ClientInstrumentation } from './instrumentation-cRWWLfsU.js'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BOdXz9dK.js'; | ||
| import './data-BqZ2x964.js'; | ||
| import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js'; | ||
| export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js'; | ||
| import './data-D4xhSy90.js'; | ||
@@ -7,0 +7,0 @@ type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -16,3 +16,3 @@ * Copyright (c) Remix Software Inc. | ||
| var _chunkY6IFXO7Vjs = require('./chunk-Y6IFXO7V.js'); | ||
| var _chunkEAQNHM3Njs = require('./chunk-EAQNHM3N.js'); | ||
@@ -38,3 +38,3 @@ | ||
| var _chunkHUBUW7R3js = require('./chunk-HUBUW7R3.js'); | ||
| var _chunkY7DNFQZPjs = require('./chunk-Y7DNFQZP.js'); | ||
@@ -180,3 +180,3 @@ // lib/dom-export/dom-router-provider.tsx | ||
| ssrInfo.context.basename, | ||
| ssrInfo.context.future.unstable_trailingSlashAwareDataRequests | ||
| ssrInfo.context.future.v8_trailingSlashAwareDataRequests | ||
| ), | ||
@@ -220,3 +220,3 @@ patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0, | ||
| if (process.env.NODE_ENV === "development" && criticalCss === void 0) { | ||
| document.querySelectorAll(`[${_chunkHUBUW7R3js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); | ||
| document.querySelectorAll(`[${_chunkY7DNFQZPjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove()); | ||
| } | ||
@@ -400,3 +400,3 @@ }, [criticalCss]); | ||
| globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {})); | ||
| _chunkY6IFXO7Vjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); | ||
| _chunkEAQNHM3Njs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches); | ||
| let routes = payload.matches.reduceRight((previous, match) => { | ||
@@ -415,8 +415,8 @@ const route = createRouteFromServerManifest( | ||
| let applyPatchesPromise; | ||
| globalVar.__reactRouterDataRouter = _chunkHUBUW7R3js.createRouter.call(void 0, { | ||
| globalVar.__reactRouterDataRouter = _chunkY7DNFQZPjs.createRouter.call(void 0, { | ||
| routes, | ||
| getContext, | ||
| basename: payload.basename, | ||
| history: _chunkHUBUW7R3js.createBrowserHistory.call(void 0, ), | ||
| hydrationData: _chunkY6IFXO7Vjs.getHydrationData.call(void 0, { | ||
| history: _chunkY7DNFQZPjs.createBrowserHistory.call(void 0, ), | ||
| hydrationData: _chunkEAQNHM3Njs.getHydrationData.call(void 0, { | ||
| state: { | ||
@@ -430,3 +430,3 @@ loaderData: payload.loaderData, | ||
| let match = payload.matches.find((m) => m.id === routeId); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, match, "Route not found in payload"); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, match, "Route not found in payload"); | ||
| return { | ||
@@ -546,5 +546,5 @@ clientLoader: match.clientLoader, | ||
| } | ||
| var renderedRoutesContext = _chunkHUBUW7R3js.createContext.call(void 0, ); | ||
| var renderedRoutesContext = _chunkY7DNFQZPjs.createContext.call(void 0, ); | ||
| function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) { | ||
| let dataStrategy = _chunkHUBUW7R3js.getSingleFetchDataStrategyImpl.call(void 0, | ||
| let dataStrategy = _chunkY7DNFQZPjs.getSingleFetchDataStrategyImpl.call(void 0, | ||
| getRouter, | ||
@@ -606,5 +606,5 @@ (match) => { | ||
| let { request, context } = args; | ||
| let url = _chunkHUBUW7R3js.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc"); | ||
| let url = _chunkY7DNFQZPjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc"); | ||
| if (request.method === "GET") { | ||
| url = _chunkHUBUW7R3js.stripIndexParam.call(void 0, url); | ||
| url = _chunkY7DNFQZPjs.stripIndexParam.call(void 0, url); | ||
| if (targetRoutes) { | ||
@@ -615,8 +615,8 @@ url.searchParams.set("_routes", targetRoutes.join(",")); | ||
| let res = await fetchImplementation( | ||
| new Request(url, await _chunkHUBUW7R3js.createRequestInit.call(void 0, request)) | ||
| new Request(url, await _chunkY7DNFQZPjs.createRequestInit.call(void 0, request)) | ||
| ); | ||
| if (res.status >= 400 && !res.headers.has("X-Remix-Response")) { | ||
| throw new (0, _chunkHUBUW7R3js.ErrorResponseImpl)(res.status, res.statusText, await res.text()); | ||
| throw new (0, _chunkY7DNFQZPjs.ErrorResponseImpl)(res.status, res.statusText, await res.text()); | ||
| } | ||
| _chunkHUBUW7R3js.invariant.call(void 0, res.body, "No response body to decode"); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, res.body, "No response body to decode"); | ||
| try { | ||
@@ -645,3 +645,3 @@ const payload = await createFromReadableStream(res.body, { | ||
| let results = { routes: {} }; | ||
| const dataKey = _chunkHUBUW7R3js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; | ||
| const dataKey = _chunkY7DNFQZPjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData"; | ||
| for (let [routeId, data] of Object.entries(payload[dataKey] || {})) { | ||
@@ -679,3 +679,3 @@ results.routes[routeId] = { data }; | ||
| React3.useEffect(() => { | ||
| _chunkHUBUW7R3js.setIsHydrated.call(void 0, ); | ||
| _chunkY7DNFQZPjs.setIsHydrated.call(void 0, ); | ||
| }, []); | ||
@@ -765,3 +765,3 @@ React3.useLayoutEffect(() => { | ||
| v8_middleware: false, | ||
| unstable_trailingSlashAwareDataRequests: true, | ||
| v8_trailingSlashAwareDataRequests: true, | ||
| // always on for RSC | ||
@@ -789,4 +789,4 @@ v8_passThroughRequests: true | ||
| }; | ||
| return /* @__PURE__ */ React3.createElement(_chunkHUBUW7R3js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkY6IFXO7Vjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkHUBUW7R3js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( | ||
| _chunkHUBUW7R3js.RouterProvider, | ||
| return /* @__PURE__ */ React3.createElement(_chunkY7DNFQZPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkEAQNHM3Njs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkY7DNFQZPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement( | ||
| _chunkY7DNFQZPjs.RouterProvider, | ||
| { | ||
@@ -807,4 +807,4 @@ router: transitionEnabledRouter, | ||
| match.hasComponent && !match.element; | ||
| _chunkHUBUW7R3js.invariant.call(void 0, window.__reactRouterRouteModules); | ||
| _chunkY6IFXO7Vjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, window.__reactRouterRouteModules); | ||
| _chunkEAQNHM3Njs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match); | ||
| let dataRoute = { | ||
@@ -857,3 +857,3 @@ id: match.id, | ||
| }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => { | ||
| throw _chunkHUBUW7R3js.noActionDefinedError.call(void 0, "action", match.id); | ||
| throw _chunkY7DNFQZPjs.noActionDefinedError.call(void 0, "action", match.id); | ||
| }, | ||
@@ -870,3 +870,3 @@ path: match.path, | ||
| if (typeof dataRoute.loader === "function") { | ||
| dataRoute.loader.hydrate = _chunkHUBUW7R3js.shouldHydrateRouteLoader.call(void 0, | ||
| dataRoute.loader.hydrate = _chunkY7DNFQZPjs.shouldHydrateRouteLoader.call(void 0, | ||
| match.id, | ||
@@ -881,3 +881,3 @@ match.clientLoader, | ||
| function callSingleFetch(singleFetch) { | ||
| _chunkHUBUW7R3js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); | ||
| _chunkY7DNFQZPjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter"); | ||
| return singleFetch(); | ||
@@ -890,3 +890,3 @@ } | ||
| console.error(msg); | ||
| throw new (0, _chunkHUBUW7R3js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); | ||
| throw new (0, _chunkY7DNFQZPjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true); | ||
| } | ||
@@ -918,3 +918,3 @@ } | ||
| } | ||
| if (url.toString().length > _chunkHUBUW7R3js.URL_LIMIT) { | ||
| if (url.toString().length > _chunkY7DNFQZPjs.URL_LIMIT) { | ||
| nextPaths.clear(); | ||
@@ -964,3 +964,3 @@ return; | ||
| try { | ||
| return _chunkHUBUW7R3js.invalidProtocols.includes(new URL(location2).protocol); | ||
| return _chunkY7DNFQZPjs.invalidProtocols.includes(new URL(location2).protocol); | ||
| } catch (e2) { | ||
@@ -967,0 +967,0 @@ return false; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -17,3 +17,3 @@ * Copyright (c) Remix Software Inc. | ||
| populateRSCRouteModules | ||
| } from "./chunk-6S4627ZB.mjs"; | ||
| } from "./chunk-NALGHHKE.mjs"; | ||
| import { | ||
@@ -48,3 +48,3 @@ CRITICAL_CSS_DATA_ATTRIBUTE, | ||
| useFogOFWarDiscovery | ||
| } from "./chunk-JAKZPQZC.mjs"; | ||
| } from "./chunk-Q65P7S7Y.mjs"; | ||
@@ -172,3 +172,3 @@ // lib/dom-export/dom-router-provider.tsx | ||
| ssrInfo.context.basename, | ||
| ssrInfo.context.future.unstable_trailingSlashAwareDataRequests | ||
| ssrInfo.context.future.v8_trailingSlashAwareDataRequests | ||
| ), | ||
@@ -748,3 +748,3 @@ patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction( | ||
| v8_middleware: false, | ||
| unstable_trailingSlashAwareDataRequests: true, | ||
| v8_trailingSlashAwareDataRequests: true, | ||
| // always on for RSC | ||
@@ -751,0 +751,0 @@ v8_passThroughRequests: true |
@@ -1,4 +0,4 @@ | ||
| export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-ByvtofY2.mjs'; | ||
| export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DY04-103.mjs'; | ||
| import './data-BVUf681J.mjs'; | ||
| export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-m8rizgnE.mjs'; | ||
| export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CdKROblb.mjs'; | ||
| import './data-U8FS-wNn.mjs'; | ||
| import 'react'; |
@@ -1,4 +0,4 @@ | ||
| export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BS5F89FR.js'; | ||
| import './instrumentation-cRWWLfsU.js'; | ||
| import './data-BqZ2x964.js'; | ||
| export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BLiUx67a.js'; | ||
| import './instrumentation-1q4YhLGP.js'; | ||
| import './data-D4xhSy90.js'; | ||
| import 'react'; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true});/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -22,3 +22,3 @@ * Copyright (c) Remix Software Inc. | ||
| var _chunkPNZCCTKTjs = require('./chunk-PNZCCTKT.js'); | ||
| var _chunkSKEDDLRMjs = require('./chunk-SKEDDLRM.js'); | ||
@@ -38,3 +38,3 @@ | ||
| var _chunkHUBUW7R3js = require('./chunk-HUBUW7R3.js'); | ||
| var _chunkY7DNFQZPjs = require('./chunk-Y7DNFQZP.js'); | ||
@@ -63,2 +63,2 @@ | ||
| exports.BrowserRouter = _chunkPNZCCTKTjs.BrowserRouter; exports.Form = _chunkPNZCCTKTjs.Form; exports.HashRouter = _chunkPNZCCTKTjs.HashRouter; exports.Link = _chunkPNZCCTKTjs.Link; exports.Links = _chunkHUBUW7R3js.Links; exports.MemoryRouter = _chunkHUBUW7R3js.MemoryRouter; exports.Meta = _chunkHUBUW7R3js.Meta; exports.NavLink = _chunkPNZCCTKTjs.NavLink; exports.Navigate = _chunkHUBUW7R3js.Navigate; exports.Outlet = _chunkHUBUW7R3js.Outlet; exports.Route = _chunkHUBUW7R3js.Route; exports.Router = _chunkHUBUW7R3js.Router; exports.RouterProvider = _chunkHUBUW7R3js.RouterProvider; exports.Routes = _chunkHUBUW7R3js.Routes; exports.ScrollRestoration = _chunkPNZCCTKTjs.ScrollRestoration; exports.StaticRouter = _chunkPNZCCTKTjs.StaticRouter; exports.StaticRouterProvider = _chunkPNZCCTKTjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkHUBUW7R3js.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkHUBUW7R3js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkHUBUW7R3js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkHUBUW7R3js.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkPNZCCTKTjs.HistoryRouter; | ||
| exports.BrowserRouter = _chunkSKEDDLRMjs.BrowserRouter; exports.Form = _chunkSKEDDLRMjs.Form; exports.HashRouter = _chunkSKEDDLRMjs.HashRouter; exports.Link = _chunkSKEDDLRMjs.Link; exports.Links = _chunkY7DNFQZPjs.Links; exports.MemoryRouter = _chunkY7DNFQZPjs.MemoryRouter; exports.Meta = _chunkY7DNFQZPjs.Meta; exports.NavLink = _chunkSKEDDLRMjs.NavLink; exports.Navigate = _chunkY7DNFQZPjs.Navigate; exports.Outlet = _chunkY7DNFQZPjs.Outlet; exports.Route = _chunkY7DNFQZPjs.Route; exports.Router = _chunkY7DNFQZPjs.Router; exports.RouterProvider = _chunkY7DNFQZPjs.RouterProvider; exports.Routes = _chunkY7DNFQZPjs.Routes; exports.ScrollRestoration = _chunkSKEDDLRMjs.ScrollRestoration; exports.StaticRouter = _chunkSKEDDLRMjs.StaticRouter; exports.StaticRouterProvider = _chunkSKEDDLRMjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkY7DNFQZPjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkY7DNFQZPjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkY7DNFQZPjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkY7DNFQZPjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkSKEDDLRMjs.HistoryRouter; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -35,3 +35,3 @@ * Copyright (c) Remix Software Inc. | ||
| WithHydrateFallbackProps | ||
| } from "./chunk-JAKZPQZC.mjs"; | ||
| } from "./chunk-Q65P7S7Y.mjs"; | ||
| export { | ||
@@ -38,0 +38,0 @@ BrowserRouter, |
@@ -1,15 +0,15 @@ | ||
| import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-BVUf681J.mjs'; | ||
| export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-BVUf681J.mjs'; | ||
| import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, g as Navigation, H as HydrationState, h as RouterState } from './context-ByvtofY2.mjs'; | ||
| export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, i as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, j as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-ByvtofY2.mjs'; | ||
| import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-U8FS-wNn.mjs'; | ||
| export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-U8FS-wNn.mjs'; | ||
| import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, H as HydrationState, g as RouterState } from './context-m8rizgnE.mjs'; | ||
| export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, h as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, j as Navigation, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, i as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-m8rizgnE.mjs'; | ||
| import * as React from 'react'; | ||
| import React__default, { ReactElement } from 'react'; | ||
| import { a as RouteModules$1, P as Pages } from './register-Df8okEea.mjs'; | ||
| export { b as Register } from './register-Df8okEea.mjs'; | ||
| import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DY04-103.mjs'; | ||
| export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DY04-103.mjs'; | ||
| import { a as RouteModules$1, P as Pages } from './register-CqK96Zfk.mjs'; | ||
| export { b as Register } from './register-CqK96Zfk.mjs'; | ||
| import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-CdKROblb.mjs'; | ||
| export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-CdKROblb.mjs'; | ||
| import { ParseOptions, SerializeOptions } from 'cookie'; | ||
| export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-3AnU12UI.mjs'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-3AnU12UI.mjs'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-nIQ4Nsyi.mjs'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-nIQ4Nsyi.mjs'; | ||
@@ -529,2 +529,8 @@ declare const SingleFetchRedirectSymbol: unique symbol; | ||
| declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
| type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates]; | ||
| type UseNavigationResultStates = { | ||
| Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">; | ||
| Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">; | ||
| Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">; | ||
| }; | ||
| /** | ||
@@ -552,3 +558,3 @@ * Returns the current {@link Navigation}, defaulting to an "idle" navigation | ||
| */ | ||
| declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">; | ||
| declare function useNavigation(): UseNavigationResult; | ||
| /** | ||
@@ -1474,2 +1480,2 @@ * Revalidate the data on the page for reasons outside of normal data mutations | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; |
@@ -1,15 +0,15 @@ | ||
| import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-BqZ2x964.js'; | ||
| export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-BqZ2x964.js'; | ||
| import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, d as Navigation, H as HydrationState, e as RouterState } from './instrumentation-cRWWLfsU.js'; | ||
| export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, f as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, g as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-cRWWLfsU.js'; | ||
| import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-BS5F89FR.js'; | ||
| export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-BS5F89FR.js'; | ||
| import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-D4xhSy90.js'; | ||
| export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-D4xhSy90.js'; | ||
| import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, H as HydrationState, d as RouterState } from './instrumentation-1q4YhLGP.js'; | ||
| export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, g as Navigation, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-1q4YhLGP.js'; | ||
| import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-BLiUx67a.js'; | ||
| export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-BLiUx67a.js'; | ||
| import * as React from 'react'; | ||
| import React__default, { ReactElement } from 'react'; | ||
| import { a as RouteModules$1, P as Pages } from './register-Bsscfj79.js'; | ||
| export { b as Register } from './register-Bsscfj79.js'; | ||
| import { a as RouteModules$1, P as Pages } from './register-CNAx3TXj.js'; | ||
| export { b as Register } from './register-CNAx3TXj.js'; | ||
| import { ParseOptions, SerializeOptions } from 'cookie'; | ||
| export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-BOdXz9dK.js'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-BOdXz9dK.js'; | ||
| import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-D3uq9sI1.js'; | ||
| export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-D3uq9sI1.js'; | ||
@@ -529,2 +529,8 @@ declare const SingleFetchRedirectSymbol: unique symbol; | ||
| declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
| type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates]; | ||
| type UseNavigationResultStates = { | ||
| Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">; | ||
| Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">; | ||
| Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">; | ||
| }; | ||
| /** | ||
@@ -552,3 +558,3 @@ * Returns the current {@link Navigation}, defaulting to an "idle" navigation | ||
| */ | ||
| declare function useNavigation(): Omit<Navigation, "matches" | "historyAction">; | ||
| declare function useNavigation(): UseNavigationResult; | ||
| /** | ||
@@ -1474,2 +1480,2 @@ * Revalidate the data on the page for reasons outside of normal data mutations | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; | ||
| export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes }; |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -31,3 +31,3 @@ * Copyright (c) Remix Software Inc. | ||
| setDevServerHooks | ||
| } from "./chunk-6S4627ZB.mjs"; | ||
| } from "./chunk-NALGHHKE.mjs"; | ||
| import { | ||
@@ -146,3 +146,3 @@ Action, | ||
| withHydrateFallbackProps | ||
| } from "./chunk-JAKZPQZC.mjs"; | ||
| } from "./chunk-Q65P7S7Y.mjs"; | ||
| export { | ||
@@ -149,0 +149,0 @@ Await, |
@@ -1,3 +0,3 @@ | ||
| import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-BVUf681J.mjs'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-Df8okEea.mjs'; | ||
| import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-U8FS-wNn.mjs'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs'; | ||
| import 'react'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
| import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-BqZ2x964.js'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-Bsscfj79.js'; | ||
| import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-D4xhSy90.js'; | ||
| import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js'; | ||
| import 'react'; | ||
@@ -4,0 +4,0 @@ |
| "use strict";/** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
| /** | ||
| * react-router v7.15.1 | ||
| * react-router v7.16.0 | ||
| * | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
+1
-1
| { | ||
| "name": "react-router", | ||
| "version": "7.15.1", | ||
| "version": "7.16.0", | ||
| "description": "Declarative routing for React", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './context-ByvtofY2.mjs'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BVUf681J.mjs'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './instrumentation-cRWWLfsU.js'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BqZ2x964.js'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
Sorry, the diff of this file is too big to display
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/** | ||
| * react-router v7.15.1 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkD6LUOGOQjs = require('./chunk-D6LUOGOQ.js'); | ||
| // lib/dom/ssr/hydration.tsx | ||
| function getHydrationData({ | ||
| state, | ||
| routes, | ||
| getRouteInfo, | ||
| location, | ||
| basename, | ||
| isSpaMode | ||
| }) { | ||
| let hydrationData = { | ||
| ...state, | ||
| loaderData: { ...state.loaderData } | ||
| }; | ||
| let initialMatches = _chunkD6LUOGOQjs.matchRoutes.call(void 0, routes, location, basename); | ||
| if (initialMatches) { | ||
| for (let match of initialMatches) { | ||
| let routeId = match.route.id; | ||
| let routeInfo = getRouteInfo(routeId); | ||
| if (_chunkD6LUOGOQjs.shouldHydrateRouteLoader.call(void 0, | ||
| routeId, | ||
| routeInfo.clientLoader, | ||
| routeInfo.hasLoader, | ||
| isSpaMode | ||
| ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) { | ||
| delete hydrationData.loaderData[routeId]; | ||
| } else if (!routeInfo.hasLoader) { | ||
| hydrationData.loaderData[routeId] = null; | ||
| } | ||
| } | ||
| } | ||
| return hydrationData; | ||
| } | ||
| // lib/rsc/errorBoundaries.tsx | ||
| var _react = require('react'); var _react2 = _interopRequireDefault(_react); | ||
| var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { error: null, location: props.location }; | ||
| } | ||
| static getDerivedStateFromError(error) { | ||
| return { error }; | ||
| } | ||
| static getDerivedStateFromProps(props, state) { | ||
| if (state.location !== props.location) { | ||
| return { error: null, location: props.location }; | ||
| } | ||
| return { error: state.error, location: state.location }; | ||
| } | ||
| render() { | ||
| if (this.state.error) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| error: this.state.error, | ||
| renderAppShell: true | ||
| } | ||
| ); | ||
| } else { | ||
| return this.props.children; | ||
| } | ||
| } | ||
| }; | ||
| function ErrorWrapper({ | ||
| renderAppShell, | ||
| title, | ||
| children | ||
| }) { | ||
| if (!renderAppShell) { | ||
| return children; | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement( | ||
| "meta", | ||
| { | ||
| name: "viewport", | ||
| content: "width=device-width,initial-scale=1,viewport-fit=cover" | ||
| } | ||
| ), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children))); | ||
| } | ||
| function RSCDefaultRootErrorBoundaryImpl({ | ||
| error, | ||
| renderAppShell | ||
| }) { | ||
| console.error(error); | ||
| let heyDeveloper = /* @__PURE__ */ _react2.default.createElement( | ||
| "script", | ||
| { | ||
| dangerouslySetInnerHTML: { | ||
| __html: ` | ||
| console.log( | ||
| "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information." | ||
| ); | ||
| ` | ||
| } | ||
| } | ||
| ); | ||
| if (_chunkD6LUOGOQjs.isRouteErrorResponse.call(void 0, error)) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| ErrorWrapper, | ||
| { | ||
| renderAppShell, | ||
| title: "Unhandled Thrown Response!" | ||
| }, | ||
| /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), | ||
| _chunkD6LUOGOQjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null | ||
| ); | ||
| } | ||
| let errorInstance; | ||
| if (error instanceof Error) { | ||
| errorInstance = error; | ||
| } else { | ||
| let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error); | ||
| errorInstance = new Error(errorString); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement( | ||
| "pre", | ||
| { | ||
| style: { | ||
| padding: "2rem", | ||
| background: "hsla(10, 50%, 50%, 0.1)", | ||
| color: "red", | ||
| overflow: "auto" | ||
| } | ||
| }, | ||
| errorInstance.stack | ||
| ), heyDeveloper); | ||
| } | ||
| function RSCDefaultRootErrorBoundary({ | ||
| hasRootLayout | ||
| }) { | ||
| let error = _chunkD6LUOGOQjs.useRouteError.call(void 0, ); | ||
| if (hasRootLayout === void 0) { | ||
| throw new Error("Missing 'hasRootLayout' prop"); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| renderAppShell: !hasRootLayout, | ||
| error | ||
| } | ||
| ); | ||
| } | ||
| // lib/rsc/route-modules.ts | ||
| function createRSCRouteModules(payload) { | ||
| const routeModules = {}; | ||
| for (const match of payload.matches) { | ||
| populateRSCRouteModules(routeModules, match); | ||
| } | ||
| return routeModules; | ||
| } | ||
| function populateRSCRouteModules(routeModules, matches) { | ||
| matches = Array.isArray(matches) ? matches : [matches]; | ||
| for (const match of matches) { | ||
| routeModules[match.id] = { | ||
| links: match.links, | ||
| meta: match.meta, | ||
| default: noopComponent | ||
| }; | ||
| } | ||
| } | ||
| var noopComponent = () => null; | ||
| exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.15.1 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkD6LUOGOQjs = require('./chunk-D6LUOGOQ.js'); | ||
| // lib/dom/dom.ts | ||
| var defaultMethod = "get"; | ||
| var defaultEncType = "application/x-www-form-urlencoded"; | ||
| function isHtmlElement(object) { | ||
| return typeof HTMLElement !== "undefined" && object instanceof HTMLElement; | ||
| } | ||
| function isButtonElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; | ||
| } | ||
| function isFormElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; | ||
| } | ||
| function isInputElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; | ||
| } | ||
| function isModifiedEvent(event) { | ||
| return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
| } | ||
| function shouldProcessLinkClick(event, target) { | ||
| return event.button === 0 && // Ignore everything but left clicks | ||
| (!target || target === "_self") && // Let browser handle "target=_blank" etc. | ||
| !isModifiedEvent(event); | ||
| } | ||
| function createSearchParams(init = "") { | ||
| return new URLSearchParams( | ||
| typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { | ||
| let value = init[key]; | ||
| return memo.concat( | ||
| Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] | ||
| ); | ||
| }, []) | ||
| ); | ||
| } | ||
| function getSearchParamsForLocation(locationSearch, defaultSearchParams) { | ||
| let searchParams = createSearchParams(locationSearch); | ||
| if (defaultSearchParams) { | ||
| defaultSearchParams.forEach((_, key) => { | ||
| if (!searchParams.has(key)) { | ||
| defaultSearchParams.getAll(key).forEach((value) => { | ||
| searchParams.append(key, value); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| return searchParams; | ||
| } | ||
| var _formDataSupportsSubmitter = null; | ||
| function isFormDataSubmitterSupported() { | ||
| if (_formDataSupportsSubmitter === null) { | ||
| try { | ||
| new FormData( | ||
| document.createElement("form"), | ||
| // @ts-expect-error if FormData supports the submitter parameter, this will throw | ||
| 0 | ||
| ); | ||
| _formDataSupportsSubmitter = false; | ||
| } catch (e) { | ||
| _formDataSupportsSubmitter = true; | ||
| } | ||
| } | ||
| return _formDataSupportsSubmitter; | ||
| } | ||
| var supportedFormEncTypes = /* @__PURE__ */ new Set([ | ||
| "application/x-www-form-urlencoded", | ||
| "multipart/form-data", | ||
| "text/plain" | ||
| ]); | ||
| function getFormEncType(encType) { | ||
| if (encType != null && !supportedFormEncTypes.has(encType)) { | ||
| _chunkD6LUOGOQjs.warning.call(void 0, | ||
| false, | ||
| `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"` | ||
| ); | ||
| return null; | ||
| } | ||
| return encType; | ||
| } | ||
| function getFormSubmissionInfo(target, basename) { | ||
| let method; | ||
| let action; | ||
| let encType; | ||
| let formData; | ||
| let body; | ||
| if (isFormElement(target)) { | ||
| let attr = target.getAttribute("action"); | ||
| action = attr ? _chunkD6LUOGOQjs.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(target); | ||
| } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { | ||
| let form = target.form; | ||
| if (form == null) { | ||
| throw new Error( | ||
| `Cannot submit a <button> or <input type="submit"> without a <form>` | ||
| ); | ||
| } | ||
| let attr = target.getAttribute("formaction") || form.getAttribute("action"); | ||
| action = attr ? _chunkD6LUOGOQjs.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(form, target); | ||
| if (!isFormDataSubmitterSupported()) { | ||
| let { name, type, value } = target; | ||
| if (type === "image") { | ||
| let prefix = name ? `${name}.` : ""; | ||
| formData.append(`${prefix}x`, "0"); | ||
| formData.append(`${prefix}y`, "0"); | ||
| } else if (name) { | ||
| formData.append(name, value); | ||
| } | ||
| } | ||
| } else if (isHtmlElement(target)) { | ||
| throw new Error( | ||
| `Cannot submit element that is not <form>, <button>, or <input type="submit|image">` | ||
| ); | ||
| } else { | ||
| method = defaultMethod; | ||
| action = null; | ||
| encType = defaultEncType; | ||
| body = target; | ||
| } | ||
| if (formData && encType === "text/plain") { | ||
| body = formData; | ||
| formData = void 0; | ||
| } | ||
| return { action, method: method.toLowerCase(), encType, formData, body }; | ||
| } | ||
| // lib/dom/lib.tsx | ||
| var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); | ||
| var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; | ||
| try { | ||
| if (isBrowser) { | ||
| window.__reactRouterVersion = // @ts-expect-error | ||
| "7.15.1"; | ||
| } | ||
| } catch (e) { | ||
| } | ||
| function createBrowserRouter(routes, opts) { | ||
| return _chunkD6LUOGOQjs.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]), | ||
| history: _chunkD6LUOGOQjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkD6LUOGOQjs.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkD6LUOGOQjs.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function createHashRouter(routes, opts) { | ||
| return _chunkD6LUOGOQjs.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]), | ||
| history: _chunkD6LUOGOQjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkD6LUOGOQjs.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkD6LUOGOQjs.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function parseHydrationData() { | ||
| let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]); | ||
| if (state && state.errors) { | ||
| state = { | ||
| ...state, | ||
| errors: deserializeErrors(state.errors) | ||
| }; | ||
| } | ||
| return state; | ||
| } | ||
| function deserializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (val && val.__type === "RouteErrorResponse") { | ||
| serialized[key] = new (0, _chunkD6LUOGOQjs.ErrorResponseImpl)( | ||
| val.status, | ||
| val.statusText, | ||
| val.data, | ||
| val.internal === true | ||
| ); | ||
| } else if (val && val.__type === "Error") { | ||
| if (val.__subType) { | ||
| let ErrorConstructor = window[val.__subType]; | ||
| if (typeof ErrorConstructor === "function") { | ||
| try { | ||
| let error = new ErrorConstructor(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } catch (e) { | ||
| } | ||
| } | ||
| } | ||
| if (serialized[key] == null) { | ||
| let error = new Error(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function BrowserRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkD6LUOGOQjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkD6LUOGOQjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HashRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkD6LUOGOQjs.createHashHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkD6LUOGOQjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HistoryRouter({ | ||
| basename, | ||
| children, | ||
| history, | ||
| useTransitions | ||
| }) { | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkD6LUOGOQjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| HistoryRouter.displayName = "unstable_HistoryRouter"; | ||
| var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| var Link = React.forwardRef( | ||
| function LinkWithRef({ | ||
| onClick, | ||
| discover = "render", | ||
| prefetch = "none", | ||
| relative, | ||
| reloadDocument, | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...rest | ||
| }, forwardedRef) { | ||
| let { basename, navigator, useTransitions } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to); | ||
| let parsed = _chunkD6LUOGOQjs.parseToInfo.call(void 0, to, basename); | ||
| to = parsed.to; | ||
| let href = _chunkD6LUOGOQjs.useHref.call(void 0, to, { relative }); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let maskedHref = null; | ||
| if (mask) { | ||
| let resolved = _chunkD6LUOGOQjs.resolveTo.call(void 0, | ||
| mask, | ||
| [], | ||
| location.mask ? location.mask.pathname : "/", | ||
| true | ||
| ); | ||
| if (basename !== "/") { | ||
| resolved.pathname = resolved.pathname === "/" ? basename : _chunkD6LUOGOQjs.joinPaths.call(void 0, [basename, resolved.pathname]); | ||
| } | ||
| maskedHref = navigator.createHref(resolved); | ||
| } | ||
| let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkD6LUOGOQjs.usePrefetchBehavior.call(void 0, | ||
| prefetch, | ||
| rest | ||
| ); | ||
| let internalOnClick = useLinkClickHandler(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| }); | ||
| function handleClick(event) { | ||
| if (onClick) onClick(event); | ||
| if (!event.defaultPrevented) { | ||
| internalOnClick(event); | ||
| } | ||
| } | ||
| let isSpaLink = !(parsed.isExternal || reloadDocument); | ||
| let link = ( | ||
| // eslint-disable-next-line jsx-a11y/anchor-has-content | ||
| /* @__PURE__ */ React.createElement( | ||
| "a", | ||
| { | ||
| ...rest, | ||
| ...prefetchHandlers, | ||
| href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href, | ||
| onClick: isSpaLink ? handleClick : onClick, | ||
| ref: _chunkD6LUOGOQjs.mergeRefs.call(void 0, forwardedRef, prefetchRef), | ||
| target, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ) | ||
| ); | ||
| return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkD6LUOGOQjs.PrefetchPageLinks, { page: href })) : link; | ||
| } | ||
| ); | ||
| Link.displayName = "Link"; | ||
| var NavLink = React.forwardRef( | ||
| function NavLinkWithRef({ | ||
| "aria-current": ariaCurrentProp = "page", | ||
| caseSensitive = false, | ||
| className: classNameProp = "", | ||
| end = false, | ||
| style: styleProp, | ||
| to, | ||
| viewTransition, | ||
| children, | ||
| ...rest | ||
| }, ref) { | ||
| let path = _chunkD6LUOGOQjs.useResolvedPath.call(void 0, to, { relative: rest.relative }); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let routerState = React.useContext(_chunkD6LUOGOQjs.DataRouterStateContext); | ||
| let { navigator, basename } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| useViewTransitionState(path) && viewTransition === true; | ||
| let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; | ||
| let locationPathname = location.pathname; | ||
| let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; | ||
| if (!caseSensitive) { | ||
| locationPathname = locationPathname.toLowerCase(); | ||
| nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; | ||
| toPathname = toPathname.toLowerCase(); | ||
| } | ||
| if (nextLocationPathname && basename) { | ||
| nextLocationPathname = _chunkD6LUOGOQjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname; | ||
| } | ||
| const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length; | ||
| let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/"; | ||
| let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); | ||
| let renderProps = { | ||
| isActive, | ||
| isPending, | ||
| isTransitioning | ||
| }; | ||
| let ariaCurrent = isActive ? ariaCurrentProp : void 0; | ||
| let className; | ||
| if (typeof classNameProp === "function") { | ||
| className = classNameProp(renderProps); | ||
| } else { | ||
| className = [ | ||
| classNameProp, | ||
| isActive ? "active" : null, | ||
| isPending ? "pending" : null, | ||
| isTransitioning ? "transitioning" : null | ||
| ].filter(Boolean).join(" "); | ||
| } | ||
| let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp; | ||
| return /* @__PURE__ */ React.createElement( | ||
| Link, | ||
| { | ||
| ...rest, | ||
| "aria-current": ariaCurrent, | ||
| className, | ||
| ref, | ||
| style, | ||
| to, | ||
| viewTransition | ||
| }, | ||
| typeof children === "function" ? children(renderProps) : children | ||
| ); | ||
| } | ||
| ); | ||
| NavLink.displayName = "NavLink"; | ||
| var Form = React.forwardRef( | ||
| ({ | ||
| discover = "render", | ||
| fetcherKey, | ||
| navigate, | ||
| reloadDocument, | ||
| replace, | ||
| state, | ||
| method = defaultMethod, | ||
| action, | ||
| onSubmit, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...props | ||
| }, forwardedRef) => { | ||
| let { useTransitions } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let submit = useSubmit(); | ||
| let formAction = useFormAction(action, { relative }); | ||
| let formMethod = method.toLowerCase() === "get" ? "get" : "post"; | ||
| let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action); | ||
| let submitHandler = (event) => { | ||
| onSubmit && onSubmit(event); | ||
| if (event.defaultPrevented) return; | ||
| event.preventDefault(); | ||
| let submitter = event.nativeEvent.submitter; | ||
| let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method; | ||
| let doSubmit = () => submit(submitter || event.currentTarget, { | ||
| fetcherKey, | ||
| method: submitMethod, | ||
| navigate, | ||
| replace, | ||
| state, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions && navigate !== false) { | ||
| React.startTransition(() => doSubmit()); | ||
| } else { | ||
| doSubmit(); | ||
| } | ||
| }; | ||
| return /* @__PURE__ */ React.createElement( | ||
| "form", | ||
| { | ||
| ref: forwardedRef, | ||
| method: formMethod, | ||
| action: formAction, | ||
| onSubmit: reloadDocument ? onSubmit : submitHandler, | ||
| ...props, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ); | ||
| } | ||
| ); | ||
| Form.displayName = "Form"; | ||
| function ScrollRestoration({ | ||
| getKey, | ||
| storageKey, | ||
| ...props | ||
| }) { | ||
| let remixContext = React.useContext(_chunkD6LUOGOQjs.FrameworkContext); | ||
| let { basename } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let matches = _chunkD6LUOGOQjs.useMatches.call(void 0, ); | ||
| useScrollRestoration({ getKey, storageKey }); | ||
| let ssrKey = React.useMemo( | ||
| () => { | ||
| if (!remixContext || !getKey) return null; | ||
| let userKey = getScrollRestorationKey( | ||
| location, | ||
| matches, | ||
| basename, | ||
| getKey | ||
| ); | ||
| return userKey !== location.key ? userKey : null; | ||
| }, | ||
| // Nah, we only need this the first time for the SSR render | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [] | ||
| ); | ||
| if (!remixContext || remixContext.isSpaMode) { | ||
| return null; | ||
| } | ||
| let restoreScroll = ((storageKey2, restoreKey) => { | ||
| if (!window.history.state || !window.history.state.key) { | ||
| let key = Math.random().toString(32).slice(2); | ||
| window.history.replaceState({ key }, ""); | ||
| } | ||
| try { | ||
| let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}"); | ||
| let storedY = positions[restoreKey || window.history.state.key]; | ||
| if (typeof storedY === "number") { | ||
| window.scrollTo(0, storedY); | ||
| } | ||
| } catch (error) { | ||
| console.error(error); | ||
| sessionStorage.removeItem(storageKey2); | ||
| } | ||
| }).toString(); | ||
| return /* @__PURE__ */ React.createElement( | ||
| "script", | ||
| { | ||
| ...props, | ||
| suppressHydrationWarning: true, | ||
| dangerouslySetInnerHTML: { | ||
| __html: `(${restoreScroll})(${_chunkD6LUOGOQjs.escapeHtml.call(void 0, | ||
| JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY) | ||
| )}, ${_chunkD6LUOGOQjs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})` | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| ScrollRestoration.displayName = "ScrollRestoration"; | ||
| function getDataRouterConsoleError(hookName) { | ||
| return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`; | ||
| } | ||
| function useDataRouterContext(hookName) { | ||
| let ctx = React.useContext(_chunkD6LUOGOQjs.DataRouterContext); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName)); | ||
| return ctx; | ||
| } | ||
| function useDataRouterState(hookName) { | ||
| let state = React.useContext(_chunkD6LUOGOQjs.DataRouterStateContext); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName)); | ||
| return state; | ||
| } | ||
| function useLinkClickHandler(to, { | ||
| target, | ||
| replace: replaceProp, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| } = {}) { | ||
| let navigate = _chunkD6LUOGOQjs.useNavigate.call(void 0, ); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let path = _chunkD6LUOGOQjs.useResolvedPath.call(void 0, to, { relative }); | ||
| return React.useCallback( | ||
| (event) => { | ||
| if (shouldProcessLinkClick(event, target)) { | ||
| event.preventDefault(); | ||
| let replace = replaceProp !== void 0 ? replaceProp : _chunkD6LUOGOQjs.createPath.call(void 0, location) === _chunkD6LUOGOQjs.createPath.call(void 0, path); | ||
| let doNavigate = () => navigate(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions) { | ||
| React.startTransition(() => doNavigate()); | ||
| } else { | ||
| doNavigate(); | ||
| } | ||
| } | ||
| }, | ||
| [ | ||
| location, | ||
| navigate, | ||
| path, | ||
| replaceProp, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| ] | ||
| ); | ||
| } | ||
| function useSearchParams(defaultInit) { | ||
| _chunkD6LUOGOQjs.warning.call(void 0, | ||
| typeof URLSearchParams !== "undefined", | ||
| `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.` | ||
| ); | ||
| let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit)); | ||
| let hasSetSearchParamsRef = React.useRef(false); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let searchParams = React.useMemo( | ||
| () => ( | ||
| // Only merge in the defaults if we haven't yet called setSearchParams. | ||
| // Once we call that we want those to take precedence, otherwise you can't | ||
| // remove a param with setSearchParams({}) if it has an initial value | ||
| getSearchParamsForLocation( | ||
| location.search, | ||
| hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current | ||
| ) | ||
| ), | ||
| [location.search] | ||
| ); | ||
| let navigate = _chunkD6LUOGOQjs.useNavigate.call(void 0, ); | ||
| let setSearchParams = React.useCallback( | ||
| (nextInit, navigateOptions) => { | ||
| const newSearchParams = createSearchParams( | ||
| typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit | ||
| ); | ||
| hasSetSearchParamsRef.current = true; | ||
| navigate("?" + newSearchParams, navigateOptions); | ||
| }, | ||
| [navigate, searchParams] | ||
| ); | ||
| return [searchParams, setSearchParams]; | ||
| } | ||
| var fetcherId = 0; | ||
| var getUniqueFetcherId = () => `__${String(++fetcherId)}__`; | ||
| function useSubmit() { | ||
| let { router } = useDataRouterContext("useSubmit" /* UseSubmit */); | ||
| let { basename } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let currentRouteId = _chunkD6LUOGOQjs.useRouteId.call(void 0, ); | ||
| let routerFetch = router.fetch; | ||
| let routerNavigate = router.navigate; | ||
| return React.useCallback( | ||
| async (target, options = {}) => { | ||
| let { action, method, encType, formData, body } = getFormSubmissionInfo( | ||
| target, | ||
| basename | ||
| ); | ||
| if (options.navigate === false) { | ||
| let key = options.fetcherKey || getUniqueFetcherId(); | ||
| await routerFetch(key, currentRouteId, options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| flushSync: options.flushSync | ||
| }); | ||
| } else { | ||
| await routerNavigate(options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| replace: options.replace, | ||
| state: options.state, | ||
| fromRouteId: currentRouteId, | ||
| flushSync: options.flushSync, | ||
| viewTransition: options.viewTransition | ||
| }); | ||
| } | ||
| }, | ||
| [routerFetch, routerNavigate, basename, currentRouteId] | ||
| ); | ||
| } | ||
| function useFormAction(action, { relative } = {}) { | ||
| let { basename } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let routeContext = React.useContext(_chunkD6LUOGOQjs.RouteContext); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext"); | ||
| let [match] = routeContext.matches.slice(-1); | ||
| let path = { ..._chunkD6LUOGOQjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) }; | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| if (action == null) { | ||
| path.search = location.search; | ||
| let params = new URLSearchParams(path.search); | ||
| let indexValues = params.getAll("index"); | ||
| let hasNakedIndexParam = indexValues.some((v) => v === ""); | ||
| if (hasNakedIndexParam) { | ||
| params.delete("index"); | ||
| indexValues.filter((v) => v).forEach((v) => params.append("index", v)); | ||
| let qs = params.toString(); | ||
| path.search = qs ? `?${qs}` : ""; | ||
| } | ||
| } | ||
| if ((!action || action === ".") && match.route.index) { | ||
| path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; | ||
| } | ||
| if (basename !== "/") { | ||
| path.pathname = path.pathname === "/" ? basename : _chunkD6LUOGOQjs.joinPaths.call(void 0, [basename, path.pathname]); | ||
| } | ||
| return _chunkD6LUOGOQjs.createPath.call(void 0, path); | ||
| } | ||
| function useFetcher({ | ||
| key | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useFetcher" /* UseFetcher */); | ||
| let state = useDataRouterState("useFetcher" /* UseFetcher */); | ||
| let fetcherData = React.useContext(_chunkD6LUOGOQjs.FetchersContext); | ||
| let route = React.useContext(_chunkD6LUOGOQjs.RouteContext); | ||
| let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, | ||
| routeId != null, | ||
| `useFetcher can only be used on routes that contain a unique "id"` | ||
| ); | ||
| let defaultKey = React.useId(); | ||
| let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey); | ||
| if (key && key !== fetcherKey) { | ||
| setFetcherKey(key); | ||
| } | ||
| let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router; | ||
| React.useEffect(() => { | ||
| getFetcher(fetcherKey); | ||
| return () => deleteFetcher(fetcherKey); | ||
| }, [deleteFetcher, getFetcher, fetcherKey]); | ||
| let load = React.useCallback( | ||
| async (href, opts) => { | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()"); | ||
| await routerFetch(fetcherKey, routeId, href, opts); | ||
| }, | ||
| [fetcherKey, routeId, routerFetch] | ||
| ); | ||
| let submitImpl = useSubmit(); | ||
| let submit = React.useCallback( | ||
| async (target, opts) => { | ||
| await submitImpl(target, { | ||
| ...opts, | ||
| navigate: false, | ||
| fetcherKey | ||
| }); | ||
| }, | ||
| [fetcherKey, submitImpl] | ||
| ); | ||
| let reset = React.useCallback( | ||
| (opts) => resetFetcher(fetcherKey, opts), | ||
| [resetFetcher, fetcherKey] | ||
| ); | ||
| let FetcherForm = React.useMemo(() => { | ||
| let FetcherForm2 = React.forwardRef( | ||
| (props, ref) => { | ||
| return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref }); | ||
| } | ||
| ); | ||
| FetcherForm2.displayName = "fetcher.Form"; | ||
| return FetcherForm2; | ||
| }, [fetcherKey]); | ||
| let fetcher = state.fetchers.get(fetcherKey) || _chunkD6LUOGOQjs.IDLE_FETCHER; | ||
| let data = fetcherData.get(fetcherKey); | ||
| let fetcherWithComponents = React.useMemo( | ||
| () => ({ | ||
| Form: FetcherForm, | ||
| submit, | ||
| load, | ||
| reset, | ||
| ...fetcher, | ||
| data | ||
| }), | ||
| [FetcherForm, submit, load, reset, fetcher, data] | ||
| ); | ||
| return fetcherWithComponents; | ||
| } | ||
| function useFetchers() { | ||
| let state = useDataRouterState("useFetchers" /* UseFetchers */); | ||
| return React.useMemo( | ||
| () => Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({ | ||
| ...fetcher, | ||
| key | ||
| })), | ||
| [state.fetchers] | ||
| ); | ||
| } | ||
| var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; | ||
| var savedScrollPositions = {}; | ||
| function getScrollRestorationKey(location, matches, basename, getKey) { | ||
| let key = null; | ||
| if (getKey) { | ||
| if (basename !== "/") { | ||
| key = getKey( | ||
| { | ||
| ...location, | ||
| pathname: _chunkD6LUOGOQjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname | ||
| }, | ||
| matches | ||
| ); | ||
| } else { | ||
| key = getKey(location, matches); | ||
| } | ||
| } | ||
| if (key == null) { | ||
| key = location.key; | ||
| } | ||
| return key; | ||
| } | ||
| function useScrollRestoration({ | ||
| getKey, | ||
| storageKey | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */); | ||
| let { restoreScrollPosition, preventScrollReset } = useDataRouterState( | ||
| "useScrollRestoration" /* UseScrollRestoration */ | ||
| ); | ||
| let { basename } = React.useContext(_chunkD6LUOGOQjs.NavigationContext); | ||
| let location = _chunkD6LUOGOQjs.useLocation.call(void 0, ); | ||
| let matches = _chunkD6LUOGOQjs.useMatches.call(void 0, ); | ||
| let navigation = _chunkD6LUOGOQjs.useNavigation.call(void 0, ); | ||
| React.useEffect(() => { | ||
| window.history.scrollRestoration = "manual"; | ||
| return () => { | ||
| window.history.scrollRestoration = "auto"; | ||
| }; | ||
| }, []); | ||
| usePageHide( | ||
| React.useCallback(() => { | ||
| if (navigation.state === "idle") { | ||
| let key = getScrollRestorationKey(location, matches, basename, getKey); | ||
| savedScrollPositions[key] = window.scrollY; | ||
| } | ||
| try { | ||
| sessionStorage.setItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY, | ||
| JSON.stringify(savedScrollPositions) | ||
| ); | ||
| } catch (error) { | ||
| _chunkD6LUOGOQjs.warning.call(void 0, | ||
| false, | ||
| `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).` | ||
| ); | ||
| } | ||
| window.history.scrollRestoration = "auto"; | ||
| }, [navigation.state, getKey, basename, location, matches, storageKey]) | ||
| ); | ||
| if (typeof document !== "undefined") { | ||
| React.useLayoutEffect(() => { | ||
| try { | ||
| let sessionPositions = sessionStorage.getItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY | ||
| ); | ||
| if (sessionPositions) { | ||
| savedScrollPositions = JSON.parse(sessionPositions); | ||
| } | ||
| } catch (e) { | ||
| } | ||
| }, [storageKey]); | ||
| React.useLayoutEffect(() => { | ||
| let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28( | ||
| savedScrollPositions, | ||
| () => window.scrollY, | ||
| getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0 | ||
| )]); | ||
| return () => disableScrollRestoration && disableScrollRestoration(); | ||
| }, [router, basename, getKey]); | ||
| React.useLayoutEffect(() => { | ||
| if (restoreScrollPosition === false) { | ||
| return; | ||
| } | ||
| if (typeof restoreScrollPosition === "number") { | ||
| window.scrollTo(0, restoreScrollPosition); | ||
| return; | ||
| } | ||
| try { | ||
| if (location.hash) { | ||
| let el = document.getElementById( | ||
| decodeURIComponent(location.hash.slice(1)) | ||
| ); | ||
| if (el) { | ||
| el.scrollIntoView(); | ||
| return; | ||
| } | ||
| } | ||
| } catch (e2) { | ||
| _chunkD6LUOGOQjs.warning.call(void 0, | ||
| false, | ||
| `"${location.hash.slice( | ||
| 1 | ||
| )}" is not a decodable element ID. The view will not scroll to it.` | ||
| ); | ||
| } | ||
| if (preventScrollReset === true) { | ||
| return; | ||
| } | ||
| window.scrollTo(0, 0); | ||
| }, [location, restoreScrollPosition, preventScrollReset]); | ||
| } | ||
| } | ||
| function useBeforeUnload(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("beforeunload", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("beforeunload", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePageHide(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("pagehide", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("pagehide", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePrompt({ | ||
| when, | ||
| message | ||
| }) { | ||
| let blocker = _chunkD6LUOGOQjs.useBlocker.call(void 0, when); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked") { | ||
| let proceed = window.confirm(message); | ||
| if (proceed) { | ||
| setTimeout(blocker.proceed, 0); | ||
| } else { | ||
| blocker.reset(); | ||
| } | ||
| } | ||
| }, [blocker, message]); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked" && !when) { | ||
| blocker.reset(); | ||
| } | ||
| }, [blocker, when]); | ||
| } | ||
| function useViewTransitionState(to, { relative } = {}) { | ||
| let vtContext = React.useContext(_chunkD6LUOGOQjs.ViewTransitionContext); | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, | ||
| vtContext != null, | ||
| "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?" | ||
| ); | ||
| let { basename } = useDataRouterContext( | ||
| "useViewTransitionState" /* useViewTransitionState */ | ||
| ); | ||
| let path = _chunkD6LUOGOQjs.useResolvedPath.call(void 0, to, { relative }); | ||
| if (!vtContext.isTransitioning) { | ||
| return false; | ||
| } | ||
| let currentPath = _chunkD6LUOGOQjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname; | ||
| let nextPath = _chunkD6LUOGOQjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname; | ||
| return _chunkD6LUOGOQjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkD6LUOGOQjs.matchPath.call(void 0, path.pathname, currentPath) != null; | ||
| } | ||
| // lib/dom/server.tsx | ||
| function StaticRouter({ | ||
| basename, | ||
| children, | ||
| location: locationProp = "/" | ||
| }) { | ||
| if (typeof locationProp === "string") { | ||
| locationProp = _chunkD6LUOGOQjs.parsePath.call(void 0, locationProp); | ||
| } | ||
| let action = "POP" /* Pop */; | ||
| let location = { | ||
| pathname: locationProp.pathname || "/", | ||
| search: locationProp.search || "", | ||
| hash: locationProp.hash || "", | ||
| state: locationProp.state != null ? locationProp.state : null, | ||
| key: locationProp.key || "default", | ||
| mask: void 0 | ||
| }; | ||
| let staticNavigator = getStatelessNavigator(); | ||
| return /* @__PURE__ */ React2.createElement( | ||
| _chunkD6LUOGOQjs.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location, | ||
| navigationType: action, | ||
| navigator: staticNavigator, | ||
| static: true, | ||
| useTransitions: false | ||
| } | ||
| ); | ||
| } | ||
| function StaticRouterProvider({ | ||
| context, | ||
| router, | ||
| hydrate = true, | ||
| nonce | ||
| }) { | ||
| _chunkD6LUOGOQjs.invariant.call(void 0, | ||
| router && context, | ||
| "You must provide `router` and `context` to <StaticRouterProvider>" | ||
| ); | ||
| let dataRouterContext = { | ||
| router, | ||
| navigator: getStatelessNavigator(), | ||
| static: true, | ||
| staticContext: context, | ||
| basename: context.basename || "/" | ||
| }; | ||
| let fetchersContext = /* @__PURE__ */ new Map(); | ||
| let hydrateScript = ""; | ||
| if (hydrate !== false) { | ||
| let data = { | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: serializeErrors(context.errors) | ||
| }; | ||
| let json = _chunkD6LUOGOQjs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data))); | ||
| hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`; | ||
| } | ||
| let { state } = dataRouterContext.router; | ||
| return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkD6LUOGOQjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkD6LUOGOQjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkD6LUOGOQjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkD6LUOGOQjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement( | ||
| _chunkD6LUOGOQjs.Router, | ||
| { | ||
| basename: dataRouterContext.basename, | ||
| location: state.location, | ||
| navigationType: state.historyAction, | ||
| navigator: dataRouterContext.navigator, | ||
| static: dataRouterContext.static, | ||
| useTransitions: false | ||
| }, | ||
| /* @__PURE__ */ React2.createElement( | ||
| _chunkD6LUOGOQjs.DataRoutes, | ||
| { | ||
| manifest: router.manifest, | ||
| routes: router.routes, | ||
| future: router.future, | ||
| state, | ||
| isStatic: true | ||
| } | ||
| ) | ||
| ))))), hydrateScript ? /* @__PURE__ */ React2.createElement( | ||
| "script", | ||
| { | ||
| suppressHydrationWarning: true, | ||
| nonce, | ||
| dangerouslySetInnerHTML: { __html: hydrateScript } | ||
| } | ||
| ) : null); | ||
| } | ||
| function serializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (_chunkD6LUOGOQjs.isRouteErrorResponse.call(void 0, val)) { | ||
| serialized[key] = { ...val, __type: "RouteErrorResponse" }; | ||
| } else if (val instanceof Error) { | ||
| serialized[key] = { | ||
| message: val.message, | ||
| __type: "Error", | ||
| // If this is a subclass (i.e., ReferenceError), send up the type so we | ||
| // can re-create the same type during hydration. | ||
| ...val.name !== "Error" ? { | ||
| __subType: val.name | ||
| } : {} | ||
| }; | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function getStatelessNavigator() { | ||
| return { | ||
| createHref, | ||
| encodeLocation, | ||
| push(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| replace(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| go(delta) { | ||
| throw new Error( | ||
| `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| back() { | ||
| throw new Error( | ||
| `You cannot use navigator.back() on the server because it is a stateless environment.` | ||
| ); | ||
| }, | ||
| forward() { | ||
| throw new Error( | ||
| `You cannot use navigator.forward() on the server because it is a stateless environment.` | ||
| ); | ||
| } | ||
| }; | ||
| } | ||
| function createStaticHandler2(routes, opts) { | ||
| return _chunkD6LUOGOQjs.createStaticHandler.call(void 0, routes, { | ||
| ...opts, | ||
| mapRouteProperties: _chunkD6LUOGOQjs.mapRouteProperties | ||
| }); | ||
| } | ||
| function createStaticRouter(routes, context, opts = {}) { | ||
| let manifest = {}; | ||
| let dataRoutes = _chunkD6LUOGOQjs.convertRoutesToDataRoutes.call(void 0, | ||
| routes, | ||
| _chunkD6LUOGOQjs.mapRouteProperties, | ||
| void 0, | ||
| manifest | ||
| ); | ||
| let matches = context.matches.map((match) => { | ||
| let route = manifest[match.route.id] || match.route; | ||
| return { | ||
| ...match, | ||
| route | ||
| }; | ||
| }); | ||
| let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`; | ||
| return { | ||
| get basename() { | ||
| return context.basename; | ||
| }, | ||
| get future() { | ||
| return { | ||
| v8_middleware: false, | ||
| v8_passThroughRequests: false, | ||
| ..._optionalChain([opts, 'optionalAccess', _29 => _29.future]) | ||
| }; | ||
| }, | ||
| get state() { | ||
| return { | ||
| historyAction: "POP" /* Pop */, | ||
| location: context.location, | ||
| matches, | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: context.errors, | ||
| initialized: true, | ||
| renderFallback: false, | ||
| navigation: _chunkD6LUOGOQjs.IDLE_NAVIGATION, | ||
| restoreScrollPosition: null, | ||
| preventScrollReset: false, | ||
| revalidation: "idle", | ||
| fetchers: /* @__PURE__ */ new Map(), | ||
| blockers: /* @__PURE__ */ new Map() | ||
| }; | ||
| }, | ||
| get routes() { | ||
| return dataRoutes; | ||
| }, | ||
| get branches() { | ||
| return opts.branches; | ||
| }, | ||
| get manifest() { | ||
| return manifest; | ||
| }, | ||
| get window() { | ||
| return void 0; | ||
| }, | ||
| initialize() { | ||
| throw msg("initialize"); | ||
| }, | ||
| subscribe() { | ||
| throw msg("subscribe"); | ||
| }, | ||
| enableScrollRestoration() { | ||
| throw msg("enableScrollRestoration"); | ||
| }, | ||
| navigate() { | ||
| throw msg("navigate"); | ||
| }, | ||
| fetch() { | ||
| throw msg("fetch"); | ||
| }, | ||
| revalidate() { | ||
| throw msg("revalidate"); | ||
| }, | ||
| createHref, | ||
| encodeLocation, | ||
| getFetcher() { | ||
| return _chunkD6LUOGOQjs.IDLE_FETCHER; | ||
| }, | ||
| deleteFetcher() { | ||
| throw msg("deleteFetcher"); | ||
| }, | ||
| resetFetcher() { | ||
| throw msg("resetFetcher"); | ||
| }, | ||
| dispose() { | ||
| throw msg("dispose"); | ||
| }, | ||
| getBlocker() { | ||
| return _chunkD6LUOGOQjs.IDLE_BLOCKER; | ||
| }, | ||
| deleteBlocker() { | ||
| throw msg("deleteBlocker"); | ||
| }, | ||
| patchRoutes() { | ||
| throw msg("patchRoutes"); | ||
| }, | ||
| _internalFetchControllers: /* @__PURE__ */ new Map(), | ||
| _internalSetRoutes() { | ||
| throw msg("_internalSetRoutes"); | ||
| }, | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp() { | ||
| throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp"); | ||
| } | ||
| }; | ||
| } | ||
| function createHref(to) { | ||
| return typeof to === "string" ? to : _chunkD6LUOGOQjs.createPath.call(void 0, to); | ||
| } | ||
| function encodeLocation(to) { | ||
| let href = typeof to === "string" ? to : _chunkD6LUOGOQjs.createPath.call(void 0, to); | ||
| href = href.replace(/ $/, "%20"); | ||
| let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost"); | ||
| return { | ||
| pathname: encoded.pathname, | ||
| search: encoded.search, | ||
| hash: encoded.hash | ||
| }; | ||
| } | ||
| var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-BVUf681J.mjs'; | ||
| import * as React from 'react'; | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router$1 { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router$1; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router$1["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router$1; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
| hasErrorBoundary: boolean; | ||
| }; | ||
| declare const hydrationRouteProperties: (keyof RouteObject)[]; | ||
| /** | ||
| * @category Data Routers | ||
| */ | ||
| interface MemoryRouterOpts { | ||
| /** | ||
| * Basename path for the application. | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| /** | ||
| * Future flags to enable for the router. | ||
| */ | ||
| future?: Partial<FutureConfig>; | ||
| /** | ||
| * Hydration data to initialize the router with if you have already performed | ||
| * data loading on the server. | ||
| */ | ||
| hydrationData?: HydrationState; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Array of instrumentation objects allowing you to instrument the router and | ||
| * individual routes prior to router initialization (and on any subsequently | ||
| * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is | ||
| * mostly useful for observability such as wrapping navigations, fetches, | ||
| * as well as route loaders/actions/middlewares with logging and/or performance | ||
| * tracing. See the [docs](../../how-to/instrumentation) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * instrumentations: [logging] | ||
| * }); | ||
| * | ||
| * | ||
| * let logging = { | ||
| * router({ instrument }) { | ||
| * instrument({ | ||
| * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl), | ||
| * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl) | ||
| * }); | ||
| * }, | ||
| * route({ instrument, id }) { | ||
| * instrument({ | ||
| * middleware: (impl, info) => logExecution( | ||
| * `middleware ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * loader: (impl, info) => logExecution( | ||
| * `loader ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * action: (impl, info) => logExecution( | ||
| * `action ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * }) | ||
| * } | ||
| * }; | ||
| * | ||
| * async function logExecution(label: string, impl: () => Promise<void>) { | ||
| * let start = performance.now(); | ||
| * console.log(`start ${label}`); | ||
| * await impl(); | ||
| * let duration = Math.round(performance.now() - start); | ||
| * console.log(`end ${label} (${duration}ms)`); | ||
| * } | ||
| * ``` | ||
| */ | ||
| instrumentations?: ClientInstrumentation[]; | ||
| /** | ||
| * Override the default data strategy of running loaders in parallel - | ||
| * see the [docs](../../how-to/data-strategy) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * async dataStrategy({ | ||
| * matches, | ||
| * request, | ||
| * runClientMiddleware, | ||
| * }) { | ||
| * const matchesToLoad = matches.filter((m) => | ||
| * m.shouldCallHandler(), | ||
| * ); | ||
| * | ||
| * const results: Record<string, DataStrategyResult> = {}; | ||
| * await runClientMiddleware(() => | ||
| * Promise.all( | ||
| * matchesToLoad.map(async (match) => { | ||
| * results[match.route.id] = await match.resolve(); | ||
| * }), | ||
| * ), | ||
| * ); | ||
| * return results; | ||
| * }, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| dataStrategy?: DataStrategyFunction; | ||
| /** | ||
| * Lazily define portions of the route tree on navigations. | ||
| */ | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * Create a new {@link DataRouter} that manages the application path using an | ||
| * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack. Useful for non-browser environments without a DOM API. | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param routes Application routes | ||
| * @param opts Options | ||
| * @param {MemoryRouterOpts.basename} opts.basename n/a | ||
| * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a | ||
| * @param {MemoryRouterOpts.future} opts.future n/a | ||
| * @param {MemoryRouterOpts.getContext} opts.getContext n/a | ||
| * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a | ||
| * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a | ||
| * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a | ||
| * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a | ||
| * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a | ||
| * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`} | ||
| */ | ||
| declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1; | ||
| /** | ||
| * Function signature for client side error handling for loader/actions errors | ||
| * and rendering errors via `componentDidCatch` | ||
| */ | ||
| interface ClientOnErrorFunction { | ||
| (error: unknown, info: { | ||
| location: Location; | ||
| params: Params; | ||
| pattern: string; | ||
| errorInfo?: React.ErrorInfo; | ||
| }): void; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProviderProps { | ||
| /** | ||
| * The {@link DataRouter} instance to use for navigation and data fetching. | ||
| */ | ||
| router: Router$1; | ||
| /** | ||
| * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation to use for flushing updates. | ||
| * | ||
| * You usually don't have to worry about this: | ||
| * - The `RouterProvider` exported from `react-router/dom` handles this internally for you | ||
| * - If you are rendering in a non-DOM environment, you can import | ||
| * `RouterProvider` from `react-router` and ignore this prop | ||
| */ | ||
| flushSync?: (fn: () => unknown) => undefined; | ||
| /** | ||
| * An error handler function that will be called for any middleware, loader, action, | ||
| * or render errors that are encountered in your application. This is useful for | ||
| * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not | ||
| * subject to re-rendering and will only run one time per error. | ||
| * | ||
| * The `errorInfo` parameter is passed along from | ||
| * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch) | ||
| * and is only present for render errors. | ||
| * | ||
| * ```tsx | ||
| * <RouterProvider onError=(error, info) => { | ||
| * let { location, params, pattern, errorInfo } = info; | ||
| * console.error(error, location, errorInfo); | ||
| * reportToErrorService(error, location, errorInfo); | ||
| * }} /> | ||
| * ``` | ||
| */ | ||
| onError?: ClientOnErrorFunction; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - This can lead to buggy behaviors if you are wrapping your own | ||
| * navigations/fetchers in `startTransition`. | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and router state changes will be wrapped in | ||
| * `React.startTransition` and also sent through | ||
| * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to | ||
| * surface mid-navigation router state changes to the UI. | ||
| * - When set to `false`, the router will not leverage `React.startTransition` or | ||
| * `React.useOptimistic` on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Render the UI for the given {@link DataRouter}. This component should | ||
| * typically be at the top of an app's element tree. | ||
| * | ||
| * ```tsx | ||
| * import { createBrowserRouter } from "react-router"; | ||
| * import { RouterProvider } from "react-router/dom"; | ||
| * import { createRoot } from "react-dom/client"; | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * createRoot(document.getElementById("root")).render( | ||
| * <RouterProvider router={router} /> | ||
| * ); | ||
| * ``` | ||
| * | ||
| * <docs-info>Please note that this component is exported both from | ||
| * `react-router` and `react-router/dom` with the only difference being that the | ||
| * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation. You _almost always_ want to use the version from | ||
| * `react-router/dom` unless you're running in a non-DOM environment.</docs-info> | ||
| * | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {RouterProviderProps.flushSync} props.flushSync n/a | ||
| * @param {RouterProviderProps.onError} props.onError n/a | ||
| * @param {RouterProviderProps.router} props.router n/a | ||
| * @param {RouterProviderProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router | ||
| */ | ||
| declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface MemoryRouterProps { | ||
| /** | ||
| * Application basename | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * A declarative {@link Router | `<Router>`} that stores all entries in memory. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {MemoryRouterProps.basename} props.basename n/a | ||
| * @param {MemoryRouterProps.children} props.children n/a | ||
| * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a | ||
| * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a | ||
| * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns A declarative in-memory {@link Router | `<Router>`} for client-side | ||
| * routing. | ||
| */ | ||
| declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface NavigateProps { | ||
| /** | ||
| * The path to navigate to. This can be a string or a {@link Path} object | ||
| */ | ||
| to: To; | ||
| /** | ||
| * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack | ||
| */ | ||
| replace?: boolean; | ||
| /** | ||
| * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state). | ||
| */ | ||
| state?: any; | ||
| /** | ||
| * How to interpret relative routing in the `to` prop. | ||
| * See {@link RelativeRoutingType}. | ||
| */ | ||
| relative?: RelativeRoutingType; | ||
| } | ||
| /** | ||
| * A component-based version of {@link useNavigate} to use in a | ||
| * [`React.Component` class](https://react.dev/reference/react/Component) where | ||
| * hooks cannot be used. | ||
| * | ||
| * It's recommended to avoid using this component in favor of {@link useNavigate}. | ||
| * | ||
| * @example | ||
| * <Navigate to="/tasks" /> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {NavigateProps.relative} props.relative n/a | ||
| * @param {NavigateProps.replace} props.replace n/a | ||
| * @param {NavigateProps.state} props.state n/a | ||
| * @param {NavigateProps.to} props.to n/a | ||
| * @returns {void} | ||
| * | ||
| */ | ||
| declare function Navigate({ to, replace, state, relative, }: NavigateProps): null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface OutletProps { | ||
| /** | ||
| * Provides a context value to the element tree below the outlet. Use when | ||
| * the parent route needs to provide values to child routes. | ||
| * | ||
| * ```tsx | ||
| * <Outlet context={myContextValue} /> | ||
| * ``` | ||
| * | ||
| * Access the context with {@link useOutletContext}. | ||
| */ | ||
| context?: unknown; | ||
| } | ||
| /** | ||
| * Renders the matching child route of a parent route or nothing if no child | ||
| * route matches. | ||
| * | ||
| * @example | ||
| * import { Outlet } from "react-router"; | ||
| * | ||
| * export default function SomeParent() { | ||
| * return ( | ||
| * <div> | ||
| * <h1>Parent Content</h1> | ||
| * <Outlet /> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {OutletProps.context} props.context n/a | ||
| * @returns React element for the rendered outlet or `null` if no child route matches. | ||
| */ | ||
| declare function Outlet(props: OutletProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface PathRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: NonIndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: NonIndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: NonIndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<NonIndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: NonIndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: NonIndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: NonIndexRouteObject["action"]; | ||
| hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: NonIndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index?: false; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface LayoutRouteProps extends PathRouteProps { | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface IndexRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: IndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: IndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: IndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<IndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: IndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: IndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: IndexRouteObject["action"]; | ||
| hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: IndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: IndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index: true; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: undefined; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps; | ||
| /** | ||
| * Configures an element to render when a pattern matches the current location. | ||
| * It must be rendered within a {@link Routes} element. Note that these routes | ||
| * do not participate in data loading, actions, code splitting, or any other | ||
| * route module features. | ||
| * | ||
| * @example | ||
| * // Usually used in a declarative router | ||
| * function App() { | ||
| * return ( | ||
| * <BrowserRouter> | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * </BrowserRouter> | ||
| * ); | ||
| * } | ||
| * | ||
| * // But can be used with a data router as well if you prefer the JSX notation | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {PathRouteProps.action} props.action n/a | ||
| * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a | ||
| * @param {PathRouteProps.Component} props.Component n/a | ||
| * @param {PathRouteProps.children} props.children n/a | ||
| * @param {PathRouteProps.element} props.element n/a | ||
| * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a | ||
| * @param {PathRouteProps.errorElement} props.errorElement n/a | ||
| * @param {PathRouteProps.handle} props.handle n/a | ||
| * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a | ||
| * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a | ||
| * @param {PathRouteProps.id} props.id n/a | ||
| * @param {PathRouteProps.index} props.index n/a | ||
| * @param {PathRouteProps.lazy} props.lazy n/a | ||
| * @param {PathRouteProps.loader} props.loader n/a | ||
| * @param {PathRouteProps.path} props.path n/a | ||
| * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a | ||
| * @returns {void} | ||
| */ | ||
| declare function Route(props: RouteProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProps { | ||
| /** | ||
| * The base path for the application. This is prepended to all locations | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The location to match against. Defaults to the current location. | ||
| * This can be a string or a {@link Location} object. | ||
| */ | ||
| location: Partial<Location> | string; | ||
| /** | ||
| * The type of navigation that triggered this `location` change. | ||
| * Defaults to {@link NavigationType.Pop}. | ||
| */ | ||
| navigationType?: Action; | ||
| /** | ||
| * The navigator to use for navigation. This is usually a history object | ||
| * or a custom navigator that implements the {@link Navigator} interface. | ||
| */ | ||
| navigator: Navigator; | ||
| /** | ||
| * Whether this router is static or not (used for SSR). If `true`, the router | ||
| * will not be reactive to location changes. | ||
| */ | ||
| static?: boolean; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Provides location context for the rest of the app. | ||
| * | ||
| * Note: You usually won't render a `<Router>` directly. Instead, you'll render a | ||
| * router that is more specific to your environment such as a {@link BrowserRouter} | ||
| * in web browsers or a {@link ServerRouter} for server rendering. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {RouterProps.basename} props.basename n/a | ||
| * @param {RouterProps.children} props.children n/a | ||
| * @param {RouterProps.location} props.location n/a | ||
| * @param {RouterProps.navigationType} props.navigationType n/a | ||
| * @param {RouterProps.navigator} props.navigator n/a | ||
| * @param {RouterProps.static} props.static n/a | ||
| * @param {RouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router or `null` if the location does | ||
| * not match the {@link props.basename} | ||
| */ | ||
| declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RoutesProps { | ||
| /** | ||
| * Nested {@link Route} elements | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The {@link Location} to match against. Defaults to the current location. | ||
| */ | ||
| location?: Partial<Location> | string; | ||
| } | ||
| /** | ||
| * Renders a branch of {@link Route | `<Route>`s} that best matches the current | ||
| * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader), | ||
| * [`action`](../../start/framework/route-module#action), code splitting, or | ||
| * any other [route module](../../start/framework/route-module) features. | ||
| * | ||
| * @example | ||
| * import { Route, Routes } from "react-router"; | ||
| * | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {RoutesProps.children} props.children n/a | ||
| * @param {RoutesProps.location} props.location n/a | ||
| * @returns React element for the rendered routes or `null` if no route matches | ||
| */ | ||
| declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; | ||
| interface AwaitResolveRenderFunction<Resolve = any> { | ||
| (data: Awaited<Resolve>): React.ReactNode; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface AwaitProps<Resolve> { | ||
| /** | ||
| * When using a function, the resolved value is provided as the parameter. | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * {(resolvedReviews) => <Reviews items={resolvedReviews} />} | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * When using React elements, {@link useAsyncValue} will provide the | ||
| * resolved value: | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function Reviews() { | ||
| * const resolvedReviews = useAsyncValue(); | ||
| * return <div>...</div>; | ||
| * } | ||
| * ``` | ||
| */ | ||
| children: React.ReactNode | AwaitResolveRenderFunction<Resolve>; | ||
| /** | ||
| * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * rejects. | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<div>Oops</div>} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * To provide a more contextual error, you can use the {@link useAsyncError} in a | ||
| * child component | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<ReviewsError />} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function ReviewsError() { | ||
| * const error = useAsyncError(); | ||
| * return <div>Error loading reviews: {error.message}</div>; | ||
| * } | ||
| * ``` | ||
| * | ||
| * If you do not provide an `errorElement`, the rejected value will bubble up | ||
| * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary) | ||
| * and be accessible via the {@link useRouteError} hook. | ||
| */ | ||
| errorElement?: React.ReactNode; | ||
| /** | ||
| * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * returned from a [`loader`](../../start/framework/route-module#loader) to be | ||
| * resolved and rendered. | ||
| * | ||
| * ```tsx | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * let reviews = getReviews(); // not awaited | ||
| * let book = await getBook(); | ||
| * return { | ||
| * book, | ||
| * reviews, // this is a promise | ||
| * }; | ||
| * } | ||
| * | ||
| * export default function Book() { | ||
| * const { | ||
| * book, | ||
| * reviews, // this is the same promise | ||
| * } = useLoaderData(); | ||
| * | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * // and is the promise we pass to Await | ||
| * resolve={reviews} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| */ | ||
| resolve: Resolve; | ||
| } | ||
| /** | ||
| * Used to render promise values with automatic error handling. | ||
| * | ||
| * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense) | ||
| * | ||
| * @example | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * // not awaited | ||
| * const reviews = getReviews(); | ||
| * // awaited (blocks the transition) | ||
| * const book = await fetch("/api/book").then((res) => res.json()); | ||
| * return { book, reviews }; | ||
| * } | ||
| * | ||
| * function Book() { | ||
| * const { book, reviews } = useLoaderData(); | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * resolve={reviews} | ||
| * errorElement={ | ||
| * <div>Could not load reviews 😬</div> | ||
| * } | ||
| * children={(resolvedReviews) => ( | ||
| * <Reviews items={resolvedReviews} /> | ||
| * )} | ||
| * /> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @mode framework | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {AwaitProps.children} props.children n/a | ||
| * @param {AwaitProps.errorElement} props.errorElement n/a | ||
| * @param {AwaitProps.resolve} props.resolve n/a | ||
| * @returns React element for the rendered awaited value | ||
| */ | ||
| declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element; | ||
| /** | ||
| * Creates a route config from a React "children" object, which is usually | ||
| * either a `<Route>` element or an array of them. Used internally by | ||
| * `<Routes>` to create a route config from its children. | ||
| * | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; | ||
| /** | ||
| * Create route objects from JSX elements instead of arrays of objects. | ||
| * | ||
| * @example | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @name createRoutesFromElements | ||
| * @public | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * This is used for internal recursion and is not intended to be used by the | ||
| * application developer. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare const createRoutesFromElements: typeof createRoutesFromChildren; | ||
| /** | ||
| * Renders the result of {@link matchRoutes} into a React element. | ||
| * | ||
| * @public | ||
| * @category Utils | ||
| * @param matches The array of {@link RouteMatch | route matches} to render | ||
| * @returns A React element that renders the matched routes or `null` if no matches | ||
| */ | ||
| declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; | ||
| declare function useRouteComponentProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }; | ||
| type RouteComponentProps = ReturnType<typeof useRouteComponentProps>; | ||
| type RouteComponentType = React.ComponentType<RouteComponentProps>; | ||
| declare function WithComponentProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useHydrateFallbackProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }; | ||
| type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>; | ||
| type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>; | ||
| declare function WithHydrateFallbackProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useErrorBoundaryProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }; | ||
| type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>; | ||
| type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>; | ||
| declare function WithErrorBoundaryProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> { | ||
| router: Router$1; | ||
| staticContext?: StaticHandlerContext; | ||
| onError?: ClientOnErrorFunction; | ||
| } | ||
| declare const DataRouterContext: React.Context<DataRouterContextObject | null>; | ||
| declare const DataRouterStateContext: React.Context<RouterState | null>; | ||
| type ViewTransitionContextObject = { | ||
| isTransitioning: false; | ||
| } | { | ||
| isTransitioning: true; | ||
| flushSync: boolean; | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>; | ||
| type FetchersContextObject = Map<string, any>; | ||
| declare const FetchersContext: React.Context<FetchersContextObject>; | ||
| declare const AwaitContext: React.Context<TrackedPromise | null>; | ||
| declare const AwaitContextProvider: (props: React.ComponentProps<typeof AwaitContext.Provider>) => React.FunctionComponentElement<React.ProviderProps<TrackedPromise | null>>; | ||
| interface NavigateOptions { | ||
| /** Replace the current entry in the history stack instead of pushing a new one */ | ||
| replace?: boolean; | ||
| /** Masked URL */ | ||
| mask?: To; | ||
| /** Adds persistent client side routing state to the next location */ | ||
| state?: any; | ||
| /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */ | ||
| preventScrollReset?: boolean; | ||
| /** 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. */ | ||
| relative?: RelativeRoutingType; | ||
| /** 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} */ | ||
| flushSync?: boolean; | ||
| /** 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 useViewTransitionState `useViewTransitionState()`} hook. */ | ||
| viewTransition?: boolean; | ||
| /** Specifies the default revalidation behavior after this submission */ | ||
| defaultShouldRevalidate?: boolean; | ||
| } | ||
| /** | ||
| * A Navigator is a "location changer"; it's how you get to different locations. | ||
| * | ||
| * Every history instance conforms to the Navigator interface, but the | ||
| * distinction is useful primarily when it comes to the low-level `<Router>` API | ||
| * where both the location and a navigator must be provided separately in order | ||
| * to avoid "tearing" that may occur in a suspense-enabled app if the action | ||
| * and/or location were to be read directly from the history instance. | ||
| */ | ||
| interface Navigator { | ||
| createHref: History["createHref"]; | ||
| encodeLocation?: History["encodeLocation"]; | ||
| go: History["go"]; | ||
| push(to: To, state?: any, opts?: NavigateOptions): void; | ||
| replace(to: To, state?: any, opts?: NavigateOptions): void; | ||
| } | ||
| interface NavigationContextObject { | ||
| basename: string; | ||
| navigator: Navigator; | ||
| static: boolean; | ||
| useTransitions: boolean | undefined; | ||
| future: {}; | ||
| } | ||
| declare const NavigationContext: React.Context<NavigationContextObject>; | ||
| interface LocationContextObject { | ||
| location: Location; | ||
| navigationType: Action; | ||
| } | ||
| declare const LocationContext: React.Context<LocationContextObject>; | ||
| interface RouteContextObject { | ||
| outlet: React.ReactElement | null; | ||
| matches: RouteMatch[]; | ||
| isDataRoute: boolean; | ||
| } | ||
| declare const RouteContext: React.Context<RouteContextObject>; | ||
| export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type Navigation as g, type RouterState as h, type GetScrollRestorationKeyFunction as i, type StaticHandlerContext as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-BqZ2x964.js'; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type Navigation as d, type RouterState as e, type GetScrollRestorationKeyFunction as f, type StaticHandlerContext as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u }; |
| import { R as RouteModule } from './data-BqZ2x964.js'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import { R as RouteModule } from './data-BVUf681J.mjs'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './context-ByvtofY2.mjs'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BVUf681J.mjs'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
| import * as React from 'react'; | ||
| import { R as RouterInit } from './instrumentation-cRWWLfsU.js'; | ||
| import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BqZ2x964.js'; | ||
| declare function getRequest(): Request; | ||
| type RSCRouteConfigEntryBase = { | ||
| action?: ActionFunction; | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| ErrorBoundary?: React.ComponentType<any>; | ||
| handle?: any; | ||
| headers?: HeadersFunction; | ||
| HydrateFallback?: React.ComponentType<any>; | ||
| Layout?: React.ComponentType<any>; | ||
| links?: LinksFunction; | ||
| loader?: LoaderFunction; | ||
| meta?: MetaFunction; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteConfigEntry = RSCRouteConfigEntryBase & { | ||
| id: string; | ||
| path?: string; | ||
| Component?: React.ComponentType<any>; | ||
| lazy?: () => Promise<RSCRouteConfigEntryBase & ({ | ||
| default?: React.ComponentType<any>; | ||
| Component?: never; | ||
| } | { | ||
| default?: never; | ||
| Component?: React.ComponentType<any>; | ||
| })>; | ||
| } & ({ | ||
| index: true; | ||
| } | { | ||
| children?: RSCRouteConfigEntry[]; | ||
| }); | ||
| type RSCRouteConfig = Array<RSCRouteConfigEntry>; | ||
| type RSCRouteManifest = { | ||
| clientAction?: ClientActionFunction; | ||
| clientLoader?: ClientLoaderFunction; | ||
| element?: React.ReactElement | false; | ||
| errorElement?: React.ReactElement; | ||
| handle?: any; | ||
| hasAction: boolean; | ||
| hasComponent: boolean; | ||
| hasErrorBoundary: boolean; | ||
| hasLoader: boolean; | ||
| hydrateFallbackElement?: React.ReactElement; | ||
| id: string; | ||
| index?: boolean; | ||
| links?: LinksFunction; | ||
| meta?: MetaFunction; | ||
| parentId?: string; | ||
| path?: string; | ||
| shouldRevalidate?: ShouldRevalidateFunction; | ||
| }; | ||
| type RSCRouteMatch = RSCRouteManifest & { | ||
| params: Params; | ||
| pathname: string; | ||
| pathnameBase: string; | ||
| }; | ||
| type RSCRenderPayload = { | ||
| type: "render"; | ||
| actionData: Record<string, any> | null; | ||
| basename: string | undefined; | ||
| errors: Record<string, any> | null; | ||
| loaderData: Record<string, any>; | ||
| location: Location; | ||
| routeDiscovery: RouteDiscovery; | ||
| matches: RSCRouteMatch[]; | ||
| patches?: Promise<RSCRouteManifest[]>; | ||
| nonce?: string; | ||
| formState?: unknown; | ||
| }; | ||
| type RSCManifestPayload = { | ||
| type: "manifest"; | ||
| patches: Promise<RSCRouteManifest[]>; | ||
| }; | ||
| type RSCActionPayload = { | ||
| type: "action"; | ||
| actionResult: Promise<unknown>; | ||
| rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>; | ||
| }; | ||
| type RSCRedirectPayload = { | ||
| type: "redirect"; | ||
| status: number; | ||
| location: string; | ||
| replace: boolean; | ||
| reload: boolean; | ||
| actionResult?: Promise<unknown>; | ||
| }; | ||
| type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload; | ||
| type RSCMatch = { | ||
| statusCode: number; | ||
| headers: Headers; | ||
| payload: RSCPayload; | ||
| }; | ||
| type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>; | ||
| type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown; | ||
| type DecodeReplyFunction = (reply: FormData | string, options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown[]>; | ||
| type LoadServerActionFunction = (id: string) => Promise<Function>; | ||
| type RouteDiscovery = { | ||
| mode: "lazy"; | ||
| manifestPath?: string | undefined; | ||
| } | { | ||
| mode: "initial"; | ||
| }; | ||
| /** | ||
| * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * and returns an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components) | ||
| * enabled client router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * renderToReadableStream, | ||
| * } from "@vitejs/plugin-rsc/rsc"; | ||
| * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; | ||
| * | ||
| * matchRSCServerRequest({ | ||
| * createTemporaryReferenceSet, | ||
| * decodeAction, | ||
| * decodeFormState, | ||
| * decodeReply, | ||
| * loadServerAction, | ||
| * request, | ||
| * routes: routes(), | ||
| * generateResponse(match) { | ||
| * return new Response( | ||
| * renderToReadableStream(match.payload), | ||
| * { | ||
| * status: match.statusCode, | ||
| * headers: match.headers, | ||
| * } | ||
| * ); | ||
| * }, | ||
| * }); | ||
| * | ||
| * @name unstable_matchRSCServerRequest | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions. | ||
| * @param opts.basename The basename to use when matching the request. | ||
| * @param opts.createTemporaryReferenceSet A function that returns a temporary | ||
| * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * stream. | ||
| * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction` | ||
| * function, responsible for loading a server action. | ||
| * @param opts.decodeFormState A function responsible for decoding form state for | ||
| * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState) | ||
| * using your `react-server-dom-xyz/server`'s `decodeFormState`. | ||
| * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply` | ||
| * function, used to decode the server function's arguments and bind them to the | ||
| * implementation for invocation by the router. | ||
| * @param opts.generateResponse A function responsible for using your | ||
| * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * encoding the {@link unstable_RSCPayload}. | ||
| * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s | ||
| * `loadServerAction` function, used to load a server action by ID. | ||
| * @param opts.onError An optional error handler that will be called with any | ||
| * errors that occur during the request processing. | ||
| * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) | ||
| * to match against. | ||
| * @param opts.requestContext An instance of {@link RouterContextProvider} | ||
| * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations. | ||
| * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}. | ||
| * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
| * that contains the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * data for hydration. | ||
| */ | ||
| declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: { | ||
| allowedActionOrigins?: string[]; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| basename?: string; | ||
| decodeReply?: DecodeReplyFunction; | ||
| decodeAction?: DecodeActionFunction; | ||
| decodeFormState?: DecodeFormStateFunction; | ||
| requestContext?: RouterContextProvider; | ||
| loadServerAction?: LoadServerActionFunction; | ||
| onError?: (error: unknown) => void; | ||
| request: Request; | ||
| routes: RSCRouteConfigEntry[]; | ||
| routeDiscovery?: RouteDiscovery; | ||
| generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: { | ||
| onError(error: unknown): string | undefined; | ||
| temporaryReferences: unknown; | ||
| }) => Response; | ||
| }): Promise<Response>; | ||
| type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<unknown>; | ||
| type EncodeReplyFunction = (args: unknown[], options: { | ||
| temporaryReferences: unknown; | ||
| }) => Promise<BodyInit>; | ||
| /** | ||
| * Create a React `callServer` implementation for React Router. | ||
| * | ||
| * @example | ||
| * import { | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * setServerCallback, | ||
| * } from "@vitejs/plugin-rsc/browser"; | ||
| * import { unstable_createCallServer as createCallServer } from "react-router"; | ||
| * | ||
| * setServerCallback( | ||
| * createCallServer({ | ||
| * createFromReadableStream, | ||
| * createTemporaryReferenceSet, | ||
| * encodeReply, | ||
| * }) | ||
| * ); | ||
| * | ||
| * @name unstable_createCallServer | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param opts Options | ||
| * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s | ||
| * `createFromReadableStream`. Used to decode payloads from the server. | ||
| * @param opts.createTemporaryReferenceSet A function that creates a temporary | ||
| * reference set for the [RSC](https://react.dev/reference/rsc/server-components) | ||
| * payload. | ||
| * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`. | ||
| * Used when sending payloads to the server. | ||
| * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
| * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| * @returns A function that can be used to call server actions. | ||
| */ | ||
| declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: { | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| createTemporaryReferenceSet: () => unknown; | ||
| encodeReply: EncodeReplyFunction; | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| }): (id: string, args: unknown[]) => Promise<unknown>; | ||
| /** | ||
| * Props for the {@link unstable_RSCHydratedRouter} component. | ||
| * | ||
| * @name unstable_RSCHydratedRouterProps | ||
| * @category Types | ||
| */ | ||
| interface RSCHydratedRouterProps { | ||
| /** | ||
| * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, | ||
| * used to decode payloads from the server. | ||
| */ | ||
| createFromReadableStream: BrowserCreateFromReadableStreamFunction; | ||
| /** | ||
| * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch). | ||
| */ | ||
| fetch?: (request: Request) => Promise<Response>; | ||
| /** | ||
| * The decoded {@link unstable_RSCPayload} to hydrate. | ||
| */ | ||
| payload: RSCPayload; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| } | ||
| /** | ||
| * Hydrates a server rendered {@link unstable_RSCPayload} in the browser. | ||
| * | ||
| * @example | ||
| * import { startTransition, StrictMode } from "react"; | ||
| * import { hydrateRoot } from "react-dom/client"; | ||
| * import { | ||
| * unstable_getRSCStream as getRSCStream, | ||
| * unstable_RSCHydratedRouter as RSCHydratedRouter, | ||
| * } from "react-router"; | ||
| * import type { unstable_RSCPayload as RSCPayload } from "react-router"; | ||
| * | ||
| * createFromReadableStream(getRSCStream()).then((payload) => | ||
| * startTransition(async () => { | ||
| * hydrateRoot( | ||
| * document, | ||
| * <StrictMode> | ||
| * <RSCHydratedRouter | ||
| * createFromReadableStream={createFromReadableStream} | ||
| * payload={payload} | ||
| * /> | ||
| * </StrictMode>, | ||
| * { formState: await getFormState(payload) }, | ||
| * ); | ||
| * }), | ||
| * ); | ||
| * | ||
| * @name unstable_RSCHydratedRouter | ||
| * @public | ||
| * @category RSC | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a | ||
| * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a | ||
| * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a | ||
| * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a | ||
| * @returns A hydrated {@link DataRouter} that can be used to navigate and | ||
| * render routes. | ||
| */ | ||
| declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element; | ||
| export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/** | ||
| * react-router v7.15.1 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkHUBUW7R3js = require('./chunk-HUBUW7R3.js'); | ||
| // lib/dom/dom.ts | ||
| var defaultMethod = "get"; | ||
| var defaultEncType = "application/x-www-form-urlencoded"; | ||
| function isHtmlElement(object) { | ||
| return typeof HTMLElement !== "undefined" && object instanceof HTMLElement; | ||
| } | ||
| function isButtonElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; | ||
| } | ||
| function isFormElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; | ||
| } | ||
| function isInputElement(object) { | ||
| return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; | ||
| } | ||
| function isModifiedEvent(event) { | ||
| return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
| } | ||
| function shouldProcessLinkClick(event, target) { | ||
| return event.button === 0 && // Ignore everything but left clicks | ||
| (!target || target === "_self") && // Let browser handle "target=_blank" etc. | ||
| !isModifiedEvent(event); | ||
| } | ||
| function createSearchParams(init = "") { | ||
| return new URLSearchParams( | ||
| typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { | ||
| let value = init[key]; | ||
| return memo.concat( | ||
| Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] | ||
| ); | ||
| }, []) | ||
| ); | ||
| } | ||
| function getSearchParamsForLocation(locationSearch, defaultSearchParams) { | ||
| let searchParams = createSearchParams(locationSearch); | ||
| if (defaultSearchParams) { | ||
| defaultSearchParams.forEach((_, key) => { | ||
| if (!searchParams.has(key)) { | ||
| defaultSearchParams.getAll(key).forEach((value) => { | ||
| searchParams.append(key, value); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| return searchParams; | ||
| } | ||
| var _formDataSupportsSubmitter = null; | ||
| function isFormDataSubmitterSupported() { | ||
| if (_formDataSupportsSubmitter === null) { | ||
| try { | ||
| new FormData( | ||
| document.createElement("form"), | ||
| // @ts-expect-error if FormData supports the submitter parameter, this will throw | ||
| 0 | ||
| ); | ||
| _formDataSupportsSubmitter = false; | ||
| } catch (e) { | ||
| _formDataSupportsSubmitter = true; | ||
| } | ||
| } | ||
| return _formDataSupportsSubmitter; | ||
| } | ||
| var supportedFormEncTypes = /* @__PURE__ */ new Set([ | ||
| "application/x-www-form-urlencoded", | ||
| "multipart/form-data", | ||
| "text/plain" | ||
| ]); | ||
| function getFormEncType(encType) { | ||
| if (encType != null && !supportedFormEncTypes.has(encType)) { | ||
| _chunkHUBUW7R3js.warning.call(void 0, | ||
| false, | ||
| `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"` | ||
| ); | ||
| return null; | ||
| } | ||
| return encType; | ||
| } | ||
| function getFormSubmissionInfo(target, basename) { | ||
| let method; | ||
| let action; | ||
| let encType; | ||
| let formData; | ||
| let body; | ||
| if (isFormElement(target)) { | ||
| let attr = target.getAttribute("action"); | ||
| action = attr ? _chunkHUBUW7R3js.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(target); | ||
| } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { | ||
| let form = target.form; | ||
| if (form == null) { | ||
| throw new Error( | ||
| `Cannot submit a <button> or <input type="submit"> without a <form>` | ||
| ); | ||
| } | ||
| let attr = target.getAttribute("formaction") || form.getAttribute("action"); | ||
| action = attr ? _chunkHUBUW7R3js.stripBasename.call(void 0, attr, basename) : null; | ||
| method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; | ||
| encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType; | ||
| formData = new FormData(form, target); | ||
| if (!isFormDataSubmitterSupported()) { | ||
| let { name, type, value } = target; | ||
| if (type === "image") { | ||
| let prefix = name ? `${name}.` : ""; | ||
| formData.append(`${prefix}x`, "0"); | ||
| formData.append(`${prefix}y`, "0"); | ||
| } else if (name) { | ||
| formData.append(name, value); | ||
| } | ||
| } | ||
| } else if (isHtmlElement(target)) { | ||
| throw new Error( | ||
| `Cannot submit element that is not <form>, <button>, or <input type="submit|image">` | ||
| ); | ||
| } else { | ||
| method = defaultMethod; | ||
| action = null; | ||
| encType = defaultEncType; | ||
| body = target; | ||
| } | ||
| if (formData && encType === "text/plain") { | ||
| body = formData; | ||
| formData = void 0; | ||
| } | ||
| return { action, method: method.toLowerCase(), encType, formData, body }; | ||
| } | ||
| // lib/dom/lib.tsx | ||
| var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); | ||
| var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; | ||
| try { | ||
| if (isBrowser) { | ||
| window.__reactRouterVersion = // @ts-expect-error | ||
| "7.15.1"; | ||
| } | ||
| } catch (e) { | ||
| } | ||
| function createBrowserRouter(routes, opts) { | ||
| return _chunkHUBUW7R3js.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]), | ||
| history: _chunkHUBUW7R3js.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkHUBUW7R3js.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkHUBUW7R3js.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function createHashRouter(routes, opts) { | ||
| return _chunkHUBUW7R3js.createRouter.call(void 0, { | ||
| basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]), | ||
| getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]), | ||
| future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]), | ||
| history: _chunkHUBUW7R3js.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }), | ||
| hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(), | ||
| routes, | ||
| mapRouteProperties: _chunkHUBUW7R3js.mapRouteProperties, | ||
| hydrationRouteProperties: _chunkHUBUW7R3js.hydrationRouteProperties, | ||
| dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]), | ||
| patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]), | ||
| window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]), | ||
| instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.instrumentations]) | ||
| }).initialize(); | ||
| } | ||
| function parseHydrationData() { | ||
| let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]); | ||
| if (state && state.errors) { | ||
| state = { | ||
| ...state, | ||
| errors: deserializeErrors(state.errors) | ||
| }; | ||
| } | ||
| return state; | ||
| } | ||
| function deserializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (val && val.__type === "RouteErrorResponse") { | ||
| serialized[key] = new (0, _chunkHUBUW7R3js.ErrorResponseImpl)( | ||
| val.status, | ||
| val.statusText, | ||
| val.data, | ||
| val.internal === true | ||
| ); | ||
| } else if (val && val.__type === "Error") { | ||
| if (val.__subType) { | ||
| let ErrorConstructor = window[val.__subType]; | ||
| if (typeof ErrorConstructor === "function") { | ||
| try { | ||
| let error = new ErrorConstructor(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } catch (e) { | ||
| } | ||
| } | ||
| } | ||
| if (serialized[key] == null) { | ||
| let error = new Error(val.message); | ||
| error.stack = ""; | ||
| serialized[key] = error; | ||
| } | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function BrowserRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkHUBUW7R3js.createBrowserHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkHUBUW7R3js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HashRouter({ | ||
| basename, | ||
| children, | ||
| useTransitions, | ||
| window: window2 | ||
| }) { | ||
| let historyRef = React.useRef(); | ||
| if (historyRef.current == null) { | ||
| historyRef.current = _chunkHUBUW7R3js.createHashHistory.call(void 0, { window: window2, v5Compat: true }); | ||
| } | ||
| let history = historyRef.current; | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkHUBUW7R3js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| function HistoryRouter({ | ||
| basename, | ||
| children, | ||
| history, | ||
| useTransitions | ||
| }) { | ||
| let [state, setStateImpl] = React.useState({ | ||
| action: history.action, | ||
| location: history.location | ||
| }); | ||
| let setState = React.useCallback( | ||
| (newState) => { | ||
| if (useTransitions === false) { | ||
| setStateImpl(newState); | ||
| } else { | ||
| React.startTransition(() => setStateImpl(newState)); | ||
| } | ||
| }, | ||
| [useTransitions] | ||
| ); | ||
| React.useLayoutEffect(() => history.listen(setState), [history, setState]); | ||
| return /* @__PURE__ */ React.createElement( | ||
| _chunkHUBUW7R3js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location: state.location, | ||
| navigationType: state.action, | ||
| navigator: history, | ||
| useTransitions | ||
| } | ||
| ); | ||
| } | ||
| HistoryRouter.displayName = "unstable_HistoryRouter"; | ||
| var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| var Link = React.forwardRef( | ||
| function LinkWithRef({ | ||
| onClick, | ||
| discover = "render", | ||
| prefetch = "none", | ||
| relative, | ||
| reloadDocument, | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...rest | ||
| }, forwardedRef) { | ||
| let { basename, navigator, useTransitions } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to); | ||
| let parsed = _chunkHUBUW7R3js.parseToInfo.call(void 0, to, basename); | ||
| to = parsed.to; | ||
| let href = _chunkHUBUW7R3js.useHref.call(void 0, to, { relative }); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let maskedHref = null; | ||
| if (mask) { | ||
| let resolved = _chunkHUBUW7R3js.resolveTo.call(void 0, | ||
| mask, | ||
| [], | ||
| location.mask ? location.mask.pathname : "/", | ||
| true | ||
| ); | ||
| if (basename !== "/") { | ||
| resolved.pathname = resolved.pathname === "/" ? basename : _chunkHUBUW7R3js.joinPaths.call(void 0, [basename, resolved.pathname]); | ||
| } | ||
| maskedHref = navigator.createHref(resolved); | ||
| } | ||
| let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkHUBUW7R3js.usePrefetchBehavior.call(void 0, | ||
| prefetch, | ||
| rest | ||
| ); | ||
| let internalOnClick = useLinkClickHandler(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| target, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| }); | ||
| function handleClick(event) { | ||
| if (onClick) onClick(event); | ||
| if (!event.defaultPrevented) { | ||
| internalOnClick(event); | ||
| } | ||
| } | ||
| let isSpaLink = !(parsed.isExternal || reloadDocument); | ||
| let link = ( | ||
| // eslint-disable-next-line jsx-a11y/anchor-has-content | ||
| /* @__PURE__ */ React.createElement( | ||
| "a", | ||
| { | ||
| ...rest, | ||
| ...prefetchHandlers, | ||
| href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href, | ||
| onClick: isSpaLink ? handleClick : onClick, | ||
| ref: _chunkHUBUW7R3js.mergeRefs.call(void 0, forwardedRef, prefetchRef), | ||
| target, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ) | ||
| ); | ||
| return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkHUBUW7R3js.PrefetchPageLinks, { page: href })) : link; | ||
| } | ||
| ); | ||
| Link.displayName = "Link"; | ||
| var NavLink = React.forwardRef( | ||
| function NavLinkWithRef({ | ||
| "aria-current": ariaCurrentProp = "page", | ||
| caseSensitive = false, | ||
| className: classNameProp = "", | ||
| end = false, | ||
| style: styleProp, | ||
| to, | ||
| viewTransition, | ||
| children, | ||
| ...rest | ||
| }, ref) { | ||
| let path = _chunkHUBUW7R3js.useResolvedPath.call(void 0, to, { relative: rest.relative }); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let routerState = React.useContext(_chunkHUBUW7R3js.DataRouterStateContext); | ||
| let { navigator, basename } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| useViewTransitionState(path) && viewTransition === true; | ||
| let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; | ||
| let locationPathname = location.pathname; | ||
| let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; | ||
| if (!caseSensitive) { | ||
| locationPathname = locationPathname.toLowerCase(); | ||
| nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; | ||
| toPathname = toPathname.toLowerCase(); | ||
| } | ||
| if (nextLocationPathname && basename) { | ||
| nextLocationPathname = _chunkHUBUW7R3js.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname; | ||
| } | ||
| const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length; | ||
| let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/"; | ||
| let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); | ||
| let renderProps = { | ||
| isActive, | ||
| isPending, | ||
| isTransitioning | ||
| }; | ||
| let ariaCurrent = isActive ? ariaCurrentProp : void 0; | ||
| let className; | ||
| if (typeof classNameProp === "function") { | ||
| className = classNameProp(renderProps); | ||
| } else { | ||
| className = [ | ||
| classNameProp, | ||
| isActive ? "active" : null, | ||
| isPending ? "pending" : null, | ||
| isTransitioning ? "transitioning" : null | ||
| ].filter(Boolean).join(" "); | ||
| } | ||
| let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp; | ||
| return /* @__PURE__ */ React.createElement( | ||
| Link, | ||
| { | ||
| ...rest, | ||
| "aria-current": ariaCurrent, | ||
| className, | ||
| ref, | ||
| style, | ||
| to, | ||
| viewTransition | ||
| }, | ||
| typeof children === "function" ? children(renderProps) : children | ||
| ); | ||
| } | ||
| ); | ||
| NavLink.displayName = "NavLink"; | ||
| var Form = React.forwardRef( | ||
| ({ | ||
| discover = "render", | ||
| fetcherKey, | ||
| navigate, | ||
| reloadDocument, | ||
| replace, | ||
| state, | ||
| method = defaultMethod, | ||
| action, | ||
| onSubmit, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| ...props | ||
| }, forwardedRef) => { | ||
| let { useTransitions } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let submit = useSubmit(); | ||
| let formAction = useFormAction(action, { relative }); | ||
| let formMethod = method.toLowerCase() === "get" ? "get" : "post"; | ||
| let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action); | ||
| let submitHandler = (event) => { | ||
| onSubmit && onSubmit(event); | ||
| if (event.defaultPrevented) return; | ||
| event.preventDefault(); | ||
| let submitter = event.nativeEvent.submitter; | ||
| let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method; | ||
| let doSubmit = () => submit(submitter || event.currentTarget, { | ||
| fetcherKey, | ||
| method: submitMethod, | ||
| navigate, | ||
| replace, | ||
| state, | ||
| relative, | ||
| preventScrollReset, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions && navigate !== false) { | ||
| React.startTransition(() => doSubmit()); | ||
| } else { | ||
| doSubmit(); | ||
| } | ||
| }; | ||
| return /* @__PURE__ */ React.createElement( | ||
| "form", | ||
| { | ||
| ref: forwardedRef, | ||
| method: formMethod, | ||
| action: formAction, | ||
| onSubmit: reloadDocument ? onSubmit : submitHandler, | ||
| ...props, | ||
| "data-discover": !isAbsolute && discover === "render" ? "true" : void 0 | ||
| } | ||
| ); | ||
| } | ||
| ); | ||
| Form.displayName = "Form"; | ||
| function ScrollRestoration({ | ||
| getKey, | ||
| storageKey, | ||
| ...props | ||
| }) { | ||
| let remixContext = React.useContext(_chunkHUBUW7R3js.FrameworkContext); | ||
| let { basename } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let matches = _chunkHUBUW7R3js.useMatches.call(void 0, ); | ||
| useScrollRestoration({ getKey, storageKey }); | ||
| let ssrKey = React.useMemo( | ||
| () => { | ||
| if (!remixContext || !getKey) return null; | ||
| let userKey = getScrollRestorationKey( | ||
| location, | ||
| matches, | ||
| basename, | ||
| getKey | ||
| ); | ||
| return userKey !== location.key ? userKey : null; | ||
| }, | ||
| // Nah, we only need this the first time for the SSR render | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [] | ||
| ); | ||
| if (!remixContext || remixContext.isSpaMode) { | ||
| return null; | ||
| } | ||
| let restoreScroll = ((storageKey2, restoreKey) => { | ||
| if (!window.history.state || !window.history.state.key) { | ||
| let key = Math.random().toString(32).slice(2); | ||
| window.history.replaceState({ key }, ""); | ||
| } | ||
| try { | ||
| let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}"); | ||
| let storedY = positions[restoreKey || window.history.state.key]; | ||
| if (typeof storedY === "number") { | ||
| window.scrollTo(0, storedY); | ||
| } | ||
| } catch (error) { | ||
| console.error(error); | ||
| sessionStorage.removeItem(storageKey2); | ||
| } | ||
| }).toString(); | ||
| return /* @__PURE__ */ React.createElement( | ||
| "script", | ||
| { | ||
| ...props, | ||
| suppressHydrationWarning: true, | ||
| dangerouslySetInnerHTML: { | ||
| __html: `(${restoreScroll})(${_chunkHUBUW7R3js.escapeHtml.call(void 0, | ||
| JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY) | ||
| )}, ${_chunkHUBUW7R3js.escapeHtml.call(void 0, JSON.stringify(ssrKey))})` | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| ScrollRestoration.displayName = "ScrollRestoration"; | ||
| function getDataRouterConsoleError(hookName) { | ||
| return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`; | ||
| } | ||
| function useDataRouterContext(hookName) { | ||
| let ctx = React.useContext(_chunkHUBUW7R3js.DataRouterContext); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName)); | ||
| return ctx; | ||
| } | ||
| function useDataRouterState(hookName) { | ||
| let state = React.useContext(_chunkHUBUW7R3js.DataRouterStateContext); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, state, getDataRouterConsoleError(hookName)); | ||
| return state; | ||
| } | ||
| function useLinkClickHandler(to, { | ||
| target, | ||
| replace: replaceProp, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| } = {}) { | ||
| let navigate = _chunkHUBUW7R3js.useNavigate.call(void 0, ); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let path = _chunkHUBUW7R3js.useResolvedPath.call(void 0, to, { relative }); | ||
| return React.useCallback( | ||
| (event) => { | ||
| if (shouldProcessLinkClick(event, target)) { | ||
| event.preventDefault(); | ||
| let replace = replaceProp !== void 0 ? replaceProp : _chunkHUBUW7R3js.createPath.call(void 0, location) === _chunkHUBUW7R3js.createPath.call(void 0, path); | ||
| let doNavigate = () => navigate(to, { | ||
| replace, | ||
| mask, | ||
| state, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate | ||
| }); | ||
| if (useTransitions) { | ||
| React.startTransition(() => doNavigate()); | ||
| } else { | ||
| doNavigate(); | ||
| } | ||
| } | ||
| }, | ||
| [ | ||
| location, | ||
| navigate, | ||
| path, | ||
| replaceProp, | ||
| mask, | ||
| state, | ||
| target, | ||
| to, | ||
| preventScrollReset, | ||
| relative, | ||
| viewTransition, | ||
| defaultShouldRevalidate, | ||
| useTransitions | ||
| ] | ||
| ); | ||
| } | ||
| function useSearchParams(defaultInit) { | ||
| _chunkHUBUW7R3js.warning.call(void 0, | ||
| typeof URLSearchParams !== "undefined", | ||
| `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.` | ||
| ); | ||
| let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit)); | ||
| let hasSetSearchParamsRef = React.useRef(false); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let searchParams = React.useMemo( | ||
| () => ( | ||
| // Only merge in the defaults if we haven't yet called setSearchParams. | ||
| // Once we call that we want those to take precedence, otherwise you can't | ||
| // remove a param with setSearchParams({}) if it has an initial value | ||
| getSearchParamsForLocation( | ||
| location.search, | ||
| hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current | ||
| ) | ||
| ), | ||
| [location.search] | ||
| ); | ||
| let navigate = _chunkHUBUW7R3js.useNavigate.call(void 0, ); | ||
| let setSearchParams = React.useCallback( | ||
| (nextInit, navigateOptions) => { | ||
| const newSearchParams = createSearchParams( | ||
| typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit | ||
| ); | ||
| hasSetSearchParamsRef.current = true; | ||
| navigate("?" + newSearchParams, navigateOptions); | ||
| }, | ||
| [navigate, searchParams] | ||
| ); | ||
| return [searchParams, setSearchParams]; | ||
| } | ||
| var fetcherId = 0; | ||
| var getUniqueFetcherId = () => `__${String(++fetcherId)}__`; | ||
| function useSubmit() { | ||
| let { router } = useDataRouterContext("useSubmit" /* UseSubmit */); | ||
| let { basename } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let currentRouteId = _chunkHUBUW7R3js.useRouteId.call(void 0, ); | ||
| let routerFetch = router.fetch; | ||
| let routerNavigate = router.navigate; | ||
| return React.useCallback( | ||
| async (target, options = {}) => { | ||
| let { action, method, encType, formData, body } = getFormSubmissionInfo( | ||
| target, | ||
| basename | ||
| ); | ||
| if (options.navigate === false) { | ||
| let key = options.fetcherKey || getUniqueFetcherId(); | ||
| await routerFetch(key, currentRouteId, options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| flushSync: options.flushSync | ||
| }); | ||
| } else { | ||
| await routerNavigate(options.action || action, { | ||
| defaultShouldRevalidate: options.defaultShouldRevalidate, | ||
| preventScrollReset: options.preventScrollReset, | ||
| formData, | ||
| body, | ||
| formMethod: options.method || method, | ||
| formEncType: options.encType || encType, | ||
| replace: options.replace, | ||
| state: options.state, | ||
| fromRouteId: currentRouteId, | ||
| flushSync: options.flushSync, | ||
| viewTransition: options.viewTransition | ||
| }); | ||
| } | ||
| }, | ||
| [routerFetch, routerNavigate, basename, currentRouteId] | ||
| ); | ||
| } | ||
| function useFormAction(action, { relative } = {}) { | ||
| let { basename } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let routeContext = React.useContext(_chunkHUBUW7R3js.RouteContext); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext"); | ||
| let [match] = routeContext.matches.slice(-1); | ||
| let path = { ..._chunkHUBUW7R3js.useResolvedPath.call(void 0, action ? action : ".", { relative }) }; | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| if (action == null) { | ||
| path.search = location.search; | ||
| let params = new URLSearchParams(path.search); | ||
| let indexValues = params.getAll("index"); | ||
| let hasNakedIndexParam = indexValues.some((v) => v === ""); | ||
| if (hasNakedIndexParam) { | ||
| params.delete("index"); | ||
| indexValues.filter((v) => v).forEach((v) => params.append("index", v)); | ||
| let qs = params.toString(); | ||
| path.search = qs ? `?${qs}` : ""; | ||
| } | ||
| } | ||
| if ((!action || action === ".") && match.route.index) { | ||
| path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; | ||
| } | ||
| if (basename !== "/") { | ||
| path.pathname = path.pathname === "/" ? basename : _chunkHUBUW7R3js.joinPaths.call(void 0, [basename, path.pathname]); | ||
| } | ||
| return _chunkHUBUW7R3js.createPath.call(void 0, path); | ||
| } | ||
| function useFetcher({ | ||
| key | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useFetcher" /* UseFetcher */); | ||
| let state = useDataRouterState("useFetcher" /* UseFetcher */); | ||
| let fetcherData = React.useContext(_chunkHUBUW7R3js.FetchersContext); | ||
| let route = React.useContext(_chunkHUBUW7R3js.RouteContext); | ||
| let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, | ||
| routeId != null, | ||
| `useFetcher can only be used on routes that contain a unique "id"` | ||
| ); | ||
| let defaultKey = React.useId(); | ||
| let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey); | ||
| if (key && key !== fetcherKey) { | ||
| setFetcherKey(key); | ||
| } | ||
| let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router; | ||
| React.useEffect(() => { | ||
| getFetcher(fetcherKey); | ||
| return () => deleteFetcher(fetcherKey); | ||
| }, [deleteFetcher, getFetcher, fetcherKey]); | ||
| let load = React.useCallback( | ||
| async (href, opts) => { | ||
| _chunkHUBUW7R3js.invariant.call(void 0, routeId, "No routeId available for fetcher.load()"); | ||
| await routerFetch(fetcherKey, routeId, href, opts); | ||
| }, | ||
| [fetcherKey, routeId, routerFetch] | ||
| ); | ||
| let submitImpl = useSubmit(); | ||
| let submit = React.useCallback( | ||
| async (target, opts) => { | ||
| await submitImpl(target, { | ||
| ...opts, | ||
| navigate: false, | ||
| fetcherKey | ||
| }); | ||
| }, | ||
| [fetcherKey, submitImpl] | ||
| ); | ||
| let reset = React.useCallback( | ||
| (opts) => resetFetcher(fetcherKey, opts), | ||
| [resetFetcher, fetcherKey] | ||
| ); | ||
| let FetcherForm = React.useMemo(() => { | ||
| let FetcherForm2 = React.forwardRef( | ||
| (props, ref) => { | ||
| return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref }); | ||
| } | ||
| ); | ||
| FetcherForm2.displayName = "fetcher.Form"; | ||
| return FetcherForm2; | ||
| }, [fetcherKey]); | ||
| let fetcher = state.fetchers.get(fetcherKey) || _chunkHUBUW7R3js.IDLE_FETCHER; | ||
| let data = fetcherData.get(fetcherKey); | ||
| let fetcherWithComponents = React.useMemo( | ||
| () => ({ | ||
| Form: FetcherForm, | ||
| submit, | ||
| load, | ||
| reset, | ||
| ...fetcher, | ||
| data | ||
| }), | ||
| [FetcherForm, submit, load, reset, fetcher, data] | ||
| ); | ||
| return fetcherWithComponents; | ||
| } | ||
| function useFetchers() { | ||
| let state = useDataRouterState("useFetchers" /* UseFetchers */); | ||
| return React.useMemo( | ||
| () => Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({ | ||
| ...fetcher, | ||
| key | ||
| })), | ||
| [state.fetchers] | ||
| ); | ||
| } | ||
| var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; | ||
| var savedScrollPositions = {}; | ||
| function getScrollRestorationKey(location, matches, basename, getKey) { | ||
| let key = null; | ||
| if (getKey) { | ||
| if (basename !== "/") { | ||
| key = getKey( | ||
| { | ||
| ...location, | ||
| pathname: _chunkHUBUW7R3js.stripBasename.call(void 0, location.pathname, basename) || location.pathname | ||
| }, | ||
| matches | ||
| ); | ||
| } else { | ||
| key = getKey(location, matches); | ||
| } | ||
| } | ||
| if (key == null) { | ||
| key = location.key; | ||
| } | ||
| return key; | ||
| } | ||
| function useScrollRestoration({ | ||
| getKey, | ||
| storageKey | ||
| } = {}) { | ||
| let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */); | ||
| let { restoreScrollPosition, preventScrollReset } = useDataRouterState( | ||
| "useScrollRestoration" /* UseScrollRestoration */ | ||
| ); | ||
| let { basename } = React.useContext(_chunkHUBUW7R3js.NavigationContext); | ||
| let location = _chunkHUBUW7R3js.useLocation.call(void 0, ); | ||
| let matches = _chunkHUBUW7R3js.useMatches.call(void 0, ); | ||
| let navigation = _chunkHUBUW7R3js.useNavigation.call(void 0, ); | ||
| React.useEffect(() => { | ||
| window.history.scrollRestoration = "manual"; | ||
| return () => { | ||
| window.history.scrollRestoration = "auto"; | ||
| }; | ||
| }, []); | ||
| usePageHide( | ||
| React.useCallback(() => { | ||
| if (navigation.state === "idle") { | ||
| let key = getScrollRestorationKey(location, matches, basename, getKey); | ||
| savedScrollPositions[key] = window.scrollY; | ||
| } | ||
| try { | ||
| sessionStorage.setItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY, | ||
| JSON.stringify(savedScrollPositions) | ||
| ); | ||
| } catch (error) { | ||
| _chunkHUBUW7R3js.warning.call(void 0, | ||
| false, | ||
| `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).` | ||
| ); | ||
| } | ||
| window.history.scrollRestoration = "auto"; | ||
| }, [navigation.state, getKey, basename, location, matches, storageKey]) | ||
| ); | ||
| if (typeof document !== "undefined") { | ||
| React.useLayoutEffect(() => { | ||
| try { | ||
| let sessionPositions = sessionStorage.getItem( | ||
| storageKey || SCROLL_RESTORATION_STORAGE_KEY | ||
| ); | ||
| if (sessionPositions) { | ||
| savedScrollPositions = JSON.parse(sessionPositions); | ||
| } | ||
| } catch (e) { | ||
| } | ||
| }, [storageKey]); | ||
| React.useLayoutEffect(() => { | ||
| let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28( | ||
| savedScrollPositions, | ||
| () => window.scrollY, | ||
| getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0 | ||
| )]); | ||
| return () => disableScrollRestoration && disableScrollRestoration(); | ||
| }, [router, basename, getKey]); | ||
| React.useLayoutEffect(() => { | ||
| if (restoreScrollPosition === false) { | ||
| return; | ||
| } | ||
| if (typeof restoreScrollPosition === "number") { | ||
| window.scrollTo(0, restoreScrollPosition); | ||
| return; | ||
| } | ||
| try { | ||
| if (location.hash) { | ||
| let el = document.getElementById( | ||
| decodeURIComponent(location.hash.slice(1)) | ||
| ); | ||
| if (el) { | ||
| el.scrollIntoView(); | ||
| return; | ||
| } | ||
| } | ||
| } catch (e2) { | ||
| _chunkHUBUW7R3js.warning.call(void 0, | ||
| false, | ||
| `"${location.hash.slice( | ||
| 1 | ||
| )}" is not a decodable element ID. The view will not scroll to it.` | ||
| ); | ||
| } | ||
| if (preventScrollReset === true) { | ||
| return; | ||
| } | ||
| window.scrollTo(0, 0); | ||
| }, [location, restoreScrollPosition, preventScrollReset]); | ||
| } | ||
| } | ||
| function useBeforeUnload(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("beforeunload", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("beforeunload", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePageHide(callback, options) { | ||
| let { capture } = options || {}; | ||
| React.useEffect(() => { | ||
| let opts = capture != null ? { capture } : void 0; | ||
| window.addEventListener("pagehide", callback, opts); | ||
| return () => { | ||
| window.removeEventListener("pagehide", callback, opts); | ||
| }; | ||
| }, [callback, capture]); | ||
| } | ||
| function usePrompt({ | ||
| when, | ||
| message | ||
| }) { | ||
| let blocker = _chunkHUBUW7R3js.useBlocker.call(void 0, when); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked") { | ||
| let proceed = window.confirm(message); | ||
| if (proceed) { | ||
| setTimeout(blocker.proceed, 0); | ||
| } else { | ||
| blocker.reset(); | ||
| } | ||
| } | ||
| }, [blocker, message]); | ||
| React.useEffect(() => { | ||
| if (blocker.state === "blocked" && !when) { | ||
| blocker.reset(); | ||
| } | ||
| }, [blocker, when]); | ||
| } | ||
| function useViewTransitionState(to, { relative } = {}) { | ||
| let vtContext = React.useContext(_chunkHUBUW7R3js.ViewTransitionContext); | ||
| _chunkHUBUW7R3js.invariant.call(void 0, | ||
| vtContext != null, | ||
| "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?" | ||
| ); | ||
| let { basename } = useDataRouterContext( | ||
| "useViewTransitionState" /* useViewTransitionState */ | ||
| ); | ||
| let path = _chunkHUBUW7R3js.useResolvedPath.call(void 0, to, { relative }); | ||
| if (!vtContext.isTransitioning) { | ||
| return false; | ||
| } | ||
| let currentPath = _chunkHUBUW7R3js.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname; | ||
| let nextPath = _chunkHUBUW7R3js.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname; | ||
| return _chunkHUBUW7R3js.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkHUBUW7R3js.matchPath.call(void 0, path.pathname, currentPath) != null; | ||
| } | ||
| // lib/dom/server.tsx | ||
| function StaticRouter({ | ||
| basename, | ||
| children, | ||
| location: locationProp = "/" | ||
| }) { | ||
| if (typeof locationProp === "string") { | ||
| locationProp = _chunkHUBUW7R3js.parsePath.call(void 0, locationProp); | ||
| } | ||
| let action = "POP" /* Pop */; | ||
| let location = { | ||
| pathname: locationProp.pathname || "/", | ||
| search: locationProp.search || "", | ||
| hash: locationProp.hash || "", | ||
| state: locationProp.state != null ? locationProp.state : null, | ||
| key: locationProp.key || "default", | ||
| mask: void 0 | ||
| }; | ||
| let staticNavigator = getStatelessNavigator(); | ||
| return /* @__PURE__ */ React2.createElement( | ||
| _chunkHUBUW7R3js.Router, | ||
| { | ||
| basename, | ||
| children, | ||
| location, | ||
| navigationType: action, | ||
| navigator: staticNavigator, | ||
| static: true, | ||
| useTransitions: false | ||
| } | ||
| ); | ||
| } | ||
| function StaticRouterProvider({ | ||
| context, | ||
| router, | ||
| hydrate = true, | ||
| nonce | ||
| }) { | ||
| _chunkHUBUW7R3js.invariant.call(void 0, | ||
| router && context, | ||
| "You must provide `router` and `context` to <StaticRouterProvider>" | ||
| ); | ||
| let dataRouterContext = { | ||
| router, | ||
| navigator: getStatelessNavigator(), | ||
| static: true, | ||
| staticContext: context, | ||
| basename: context.basename || "/" | ||
| }; | ||
| let fetchersContext = /* @__PURE__ */ new Map(); | ||
| let hydrateScript = ""; | ||
| if (hydrate !== false) { | ||
| let data = { | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: serializeErrors(context.errors) | ||
| }; | ||
| let json = _chunkHUBUW7R3js.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data))); | ||
| hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`; | ||
| } | ||
| let { state } = dataRouterContext.router; | ||
| return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkHUBUW7R3js.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkHUBUW7R3js.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkHUBUW7R3js.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkHUBUW7R3js.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement( | ||
| _chunkHUBUW7R3js.Router, | ||
| { | ||
| basename: dataRouterContext.basename, | ||
| location: state.location, | ||
| navigationType: state.historyAction, | ||
| navigator: dataRouterContext.navigator, | ||
| static: dataRouterContext.static, | ||
| useTransitions: false | ||
| }, | ||
| /* @__PURE__ */ React2.createElement( | ||
| _chunkHUBUW7R3js.DataRoutes, | ||
| { | ||
| manifest: router.manifest, | ||
| routes: router.routes, | ||
| future: router.future, | ||
| state, | ||
| isStatic: true | ||
| } | ||
| ) | ||
| ))))), hydrateScript ? /* @__PURE__ */ React2.createElement( | ||
| "script", | ||
| { | ||
| suppressHydrationWarning: true, | ||
| nonce, | ||
| dangerouslySetInnerHTML: { __html: hydrateScript } | ||
| } | ||
| ) : null); | ||
| } | ||
| function serializeErrors(errors) { | ||
| if (!errors) return null; | ||
| let entries = Object.entries(errors); | ||
| let serialized = {}; | ||
| for (let [key, val] of entries) { | ||
| if (_chunkHUBUW7R3js.isRouteErrorResponse.call(void 0, val)) { | ||
| serialized[key] = { ...val, __type: "RouteErrorResponse" }; | ||
| } else if (val instanceof Error) { | ||
| serialized[key] = { | ||
| message: val.message, | ||
| __type: "Error", | ||
| // If this is a subclass (i.e., ReferenceError), send up the type so we | ||
| // can re-create the same type during hydration. | ||
| ...val.name !== "Error" ? { | ||
| __subType: val.name | ||
| } : {} | ||
| }; | ||
| } else { | ||
| serialized[key] = val; | ||
| } | ||
| } | ||
| return serialized; | ||
| } | ||
| function getStatelessNavigator() { | ||
| return { | ||
| createHref, | ||
| encodeLocation, | ||
| push(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| replace(to) { | ||
| throw new Error( | ||
| `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| go(delta) { | ||
| throw new Error( | ||
| `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.` | ||
| ); | ||
| }, | ||
| back() { | ||
| throw new Error( | ||
| `You cannot use navigator.back() on the server because it is a stateless environment.` | ||
| ); | ||
| }, | ||
| forward() { | ||
| throw new Error( | ||
| `You cannot use navigator.forward() on the server because it is a stateless environment.` | ||
| ); | ||
| } | ||
| }; | ||
| } | ||
| function createStaticHandler2(routes, opts) { | ||
| return _chunkHUBUW7R3js.createStaticHandler.call(void 0, routes, { | ||
| ...opts, | ||
| mapRouteProperties: _chunkHUBUW7R3js.mapRouteProperties | ||
| }); | ||
| } | ||
| function createStaticRouter(routes, context, opts = {}) { | ||
| let manifest = {}; | ||
| let dataRoutes = _chunkHUBUW7R3js.convertRoutesToDataRoutes.call(void 0, | ||
| routes, | ||
| _chunkHUBUW7R3js.mapRouteProperties, | ||
| void 0, | ||
| manifest | ||
| ); | ||
| let matches = context.matches.map((match) => { | ||
| let route = manifest[match.route.id] || match.route; | ||
| return { | ||
| ...match, | ||
| route | ||
| }; | ||
| }); | ||
| let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`; | ||
| return { | ||
| get basename() { | ||
| return context.basename; | ||
| }, | ||
| get future() { | ||
| return { | ||
| v8_middleware: false, | ||
| v8_passThroughRequests: false, | ||
| ..._optionalChain([opts, 'optionalAccess', _29 => _29.future]) | ||
| }; | ||
| }, | ||
| get state() { | ||
| return { | ||
| historyAction: "POP" /* Pop */, | ||
| location: context.location, | ||
| matches, | ||
| loaderData: context.loaderData, | ||
| actionData: context.actionData, | ||
| errors: context.errors, | ||
| initialized: true, | ||
| renderFallback: false, | ||
| navigation: _chunkHUBUW7R3js.IDLE_NAVIGATION, | ||
| restoreScrollPosition: null, | ||
| preventScrollReset: false, | ||
| revalidation: "idle", | ||
| fetchers: /* @__PURE__ */ new Map(), | ||
| blockers: /* @__PURE__ */ new Map() | ||
| }; | ||
| }, | ||
| get routes() { | ||
| return dataRoutes; | ||
| }, | ||
| get branches() { | ||
| return opts.branches; | ||
| }, | ||
| get manifest() { | ||
| return manifest; | ||
| }, | ||
| get window() { | ||
| return void 0; | ||
| }, | ||
| initialize() { | ||
| throw msg("initialize"); | ||
| }, | ||
| subscribe() { | ||
| throw msg("subscribe"); | ||
| }, | ||
| enableScrollRestoration() { | ||
| throw msg("enableScrollRestoration"); | ||
| }, | ||
| navigate() { | ||
| throw msg("navigate"); | ||
| }, | ||
| fetch() { | ||
| throw msg("fetch"); | ||
| }, | ||
| revalidate() { | ||
| throw msg("revalidate"); | ||
| }, | ||
| createHref, | ||
| encodeLocation, | ||
| getFetcher() { | ||
| return _chunkHUBUW7R3js.IDLE_FETCHER; | ||
| }, | ||
| deleteFetcher() { | ||
| throw msg("deleteFetcher"); | ||
| }, | ||
| resetFetcher() { | ||
| throw msg("resetFetcher"); | ||
| }, | ||
| dispose() { | ||
| throw msg("dispose"); | ||
| }, | ||
| getBlocker() { | ||
| return _chunkHUBUW7R3js.IDLE_BLOCKER; | ||
| }, | ||
| deleteBlocker() { | ||
| throw msg("deleteBlocker"); | ||
| }, | ||
| patchRoutes() { | ||
| throw msg("patchRoutes"); | ||
| }, | ||
| _internalFetchControllers: /* @__PURE__ */ new Map(), | ||
| _internalSetRoutes() { | ||
| throw msg("_internalSetRoutes"); | ||
| }, | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp() { | ||
| throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp"); | ||
| } | ||
| }; | ||
| } | ||
| function createHref(to) { | ||
| return typeof to === "string" ? to : _chunkHUBUW7R3js.createPath.call(void 0, to); | ||
| } | ||
| function encodeLocation(to) { | ||
| let href = typeof to === "string" ? to : _chunkHUBUW7R3js.createPath.call(void 0, to); | ||
| href = href.replace(/ $/, "%20"); | ||
| let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost"); | ||
| return { | ||
| pathname: encoded.pathname, | ||
| search: encoded.search, | ||
| hash: encoded.hash | ||
| }; | ||
| } | ||
| var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i; | ||
| exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter; |
| "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/** | ||
| * react-router v7.15.1 | ||
| * | ||
| * Copyright (c) Remix Software Inc. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE.md file in the root directory of this source tree. | ||
| * | ||
| * @license MIT | ||
| */ | ||
| var _chunkHUBUW7R3js = require('./chunk-HUBUW7R3.js'); | ||
| // lib/dom/ssr/hydration.tsx | ||
| function getHydrationData({ | ||
| state, | ||
| routes, | ||
| getRouteInfo, | ||
| location, | ||
| basename, | ||
| isSpaMode | ||
| }) { | ||
| let hydrationData = { | ||
| ...state, | ||
| loaderData: { ...state.loaderData } | ||
| }; | ||
| let initialMatches = _chunkHUBUW7R3js.matchRoutes.call(void 0, routes, location, basename); | ||
| if (initialMatches) { | ||
| for (let match of initialMatches) { | ||
| let routeId = match.route.id; | ||
| let routeInfo = getRouteInfo(routeId); | ||
| if (_chunkHUBUW7R3js.shouldHydrateRouteLoader.call(void 0, | ||
| routeId, | ||
| routeInfo.clientLoader, | ||
| routeInfo.hasLoader, | ||
| isSpaMode | ||
| ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) { | ||
| delete hydrationData.loaderData[routeId]; | ||
| } else if (!routeInfo.hasLoader) { | ||
| hydrationData.loaderData[routeId] = null; | ||
| } | ||
| } | ||
| } | ||
| return hydrationData; | ||
| } | ||
| // lib/rsc/errorBoundaries.tsx | ||
| var _react = require('react'); var _react2 = _interopRequireDefault(_react); | ||
| var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { error: null, location: props.location }; | ||
| } | ||
| static getDerivedStateFromError(error) { | ||
| return { error }; | ||
| } | ||
| static getDerivedStateFromProps(props, state) { | ||
| if (state.location !== props.location) { | ||
| return { error: null, location: props.location }; | ||
| } | ||
| return { error: state.error, location: state.location }; | ||
| } | ||
| render() { | ||
| if (this.state.error) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| error: this.state.error, | ||
| renderAppShell: true | ||
| } | ||
| ); | ||
| } else { | ||
| return this.props.children; | ||
| } | ||
| } | ||
| }; | ||
| function ErrorWrapper({ | ||
| renderAppShell, | ||
| title, | ||
| children | ||
| }) { | ||
| if (!renderAppShell) { | ||
| return children; | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement( | ||
| "meta", | ||
| { | ||
| name: "viewport", | ||
| content: "width=device-width,initial-scale=1,viewport-fit=cover" | ||
| } | ||
| ), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children))); | ||
| } | ||
| function RSCDefaultRootErrorBoundaryImpl({ | ||
| error, | ||
| renderAppShell | ||
| }) { | ||
| console.error(error); | ||
| let heyDeveloper = /* @__PURE__ */ _react2.default.createElement( | ||
| "script", | ||
| { | ||
| dangerouslySetInnerHTML: { | ||
| __html: ` | ||
| console.log( | ||
| "\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information." | ||
| ); | ||
| ` | ||
| } | ||
| } | ||
| ); | ||
| if (_chunkHUBUW7R3js.isRouteErrorResponse.call(void 0, error)) { | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| ErrorWrapper, | ||
| { | ||
| renderAppShell, | ||
| title: "Unhandled Thrown Response!" | ||
| }, | ||
| /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), | ||
| _chunkHUBUW7R3js.ENABLE_DEV_WARNINGS ? heyDeveloper : null | ||
| ); | ||
| } | ||
| let errorInstance; | ||
| if (error instanceof Error) { | ||
| errorInstance = error; | ||
| } else { | ||
| let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error); | ||
| errorInstance = new Error(errorString); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement( | ||
| "pre", | ||
| { | ||
| style: { | ||
| padding: "2rem", | ||
| background: "hsla(10, 50%, 50%, 0.1)", | ||
| color: "red", | ||
| overflow: "auto" | ||
| } | ||
| }, | ||
| errorInstance.stack | ||
| ), heyDeveloper); | ||
| } | ||
| function RSCDefaultRootErrorBoundary({ | ||
| hasRootLayout | ||
| }) { | ||
| let error = _chunkHUBUW7R3js.useRouteError.call(void 0, ); | ||
| if (hasRootLayout === void 0) { | ||
| throw new Error("Missing 'hasRootLayout' prop"); | ||
| } | ||
| return /* @__PURE__ */ _react2.default.createElement( | ||
| RSCDefaultRootErrorBoundaryImpl, | ||
| { | ||
| renderAppShell: !hasRootLayout, | ||
| error | ||
| } | ||
| ); | ||
| } | ||
| // lib/rsc/route-modules.ts | ||
| function createRSCRouteModules(payload) { | ||
| const routeModules = {}; | ||
| for (const match of payload.matches) { | ||
| populateRSCRouteModules(routeModules, match); | ||
| } | ||
| return routeModules; | ||
| } | ||
| function populateRSCRouteModules(routeModules, matches) { | ||
| matches = Array.isArray(matches) ? matches : [matches]; | ||
| for (const match of matches) { | ||
| routeModules[match.id] = { | ||
| links: match.links, | ||
| meta: match.meta, | ||
| default: noopComponent | ||
| }; | ||
| } | ||
| } | ||
| var noopComponent = () => null; | ||
| exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules; |
| import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-BVUf681J.mjs'; | ||
| import * as React from 'react'; | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router$1 { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router$1; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router$1["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router$1; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
| hasErrorBoundary: boolean; | ||
| }; | ||
| declare const hydrationRouteProperties: (keyof RouteObject)[]; | ||
| /** | ||
| * @category Data Routers | ||
| */ | ||
| interface MemoryRouterOpts { | ||
| /** | ||
| * Basename path for the application. | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * A function that returns an {@link RouterContextProvider} instance | ||
| * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s, | ||
| * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware). | ||
| * This function is called to generate a fresh `context` instance on each | ||
| * navigation or fetcher call. | ||
| */ | ||
| getContext?: RouterInit["getContext"]; | ||
| /** | ||
| * Future flags to enable for the router. | ||
| */ | ||
| future?: Partial<FutureConfig>; | ||
| /** | ||
| * Hydration data to initialize the router with if you have already performed | ||
| * data loading on the server. | ||
| */ | ||
| hydrationData?: HydrationState; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Array of instrumentation objects allowing you to instrument the router and | ||
| * individual routes prior to router initialization (and on any subsequently | ||
| * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is | ||
| * mostly useful for observability such as wrapping navigations, fetches, | ||
| * as well as route loaders/actions/middlewares with logging and/or performance | ||
| * tracing. See the [docs](../../how-to/instrumentation) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * instrumentations: [logging] | ||
| * }); | ||
| * | ||
| * | ||
| * let logging = { | ||
| * router({ instrument }) { | ||
| * instrument({ | ||
| * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl), | ||
| * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl) | ||
| * }); | ||
| * }, | ||
| * route({ instrument, id }) { | ||
| * instrument({ | ||
| * middleware: (impl, info) => logExecution( | ||
| * `middleware ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * loader: (impl, info) => logExecution( | ||
| * `loader ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * action: (impl, info) => logExecution( | ||
| * `action ${info.request.url} (route ${id})`, | ||
| * impl | ||
| * ), | ||
| * }) | ||
| * } | ||
| * }; | ||
| * | ||
| * async function logExecution(label: string, impl: () => Promise<void>) { | ||
| * let start = performance.now(); | ||
| * console.log(`start ${label}`); | ||
| * await impl(); | ||
| * let duration = Math.round(performance.now() - start); | ||
| * console.log(`end ${label} (${duration}ms)`); | ||
| * } | ||
| * ``` | ||
| */ | ||
| instrumentations?: ClientInstrumentation[]; | ||
| /** | ||
| * Override the default data strategy of running loaders in parallel - | ||
| * see the [docs](../../how-to/data-strategy) for more information. | ||
| * | ||
| * ```tsx | ||
| * let router = createBrowserRouter(routes, { | ||
| * async dataStrategy({ | ||
| * matches, | ||
| * request, | ||
| * runClientMiddleware, | ||
| * }) { | ||
| * const matchesToLoad = matches.filter((m) => | ||
| * m.shouldCallHandler(), | ||
| * ); | ||
| * | ||
| * const results: Record<string, DataStrategyResult> = {}; | ||
| * await runClientMiddleware(() => | ||
| * Promise.all( | ||
| * matchesToLoad.map(async (match) => { | ||
| * results[match.route.id] = await match.resolve(); | ||
| * }), | ||
| * ), | ||
| * ); | ||
| * return results; | ||
| * }, | ||
| * }); | ||
| * ``` | ||
| */ | ||
| dataStrategy?: DataStrategyFunction; | ||
| /** | ||
| * Lazily define portions of the route tree on navigations. | ||
| */ | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * Create a new {@link DataRouter} that manages the application path using an | ||
| * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack. Useful for non-browser environments without a DOM API. | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param routes Application routes | ||
| * @param opts Options | ||
| * @param {MemoryRouterOpts.basename} opts.basename n/a | ||
| * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a | ||
| * @param {MemoryRouterOpts.future} opts.future n/a | ||
| * @param {MemoryRouterOpts.getContext} opts.getContext n/a | ||
| * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a | ||
| * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a | ||
| * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a | ||
| * @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a | ||
| * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a | ||
| * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`} | ||
| */ | ||
| declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1; | ||
| /** | ||
| * Function signature for client side error handling for loader/actions errors | ||
| * and rendering errors via `componentDidCatch` | ||
| */ | ||
| interface ClientOnErrorFunction { | ||
| (error: unknown, info: { | ||
| location: Location; | ||
| params: Params; | ||
| pattern: string; | ||
| errorInfo?: React.ErrorInfo; | ||
| }): void; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProviderProps { | ||
| /** | ||
| * The {@link DataRouter} instance to use for navigation and data fetching. | ||
| */ | ||
| router: Router$1; | ||
| /** | ||
| * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation to use for flushing updates. | ||
| * | ||
| * You usually don't have to worry about this: | ||
| * - The `RouterProvider` exported from `react-router/dom` handles this internally for you | ||
| * - If you are rendering in a non-DOM environment, you can import | ||
| * `RouterProvider` from `react-router` and ignore this prop | ||
| */ | ||
| flushSync?: (fn: () => unknown) => undefined; | ||
| /** | ||
| * An error handler function that will be called for any middleware, loader, action, | ||
| * or render errors that are encountered in your application. This is useful for | ||
| * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not | ||
| * subject to re-rendering and will only run one time per error. | ||
| * | ||
| * The `errorInfo` parameter is passed along from | ||
| * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch) | ||
| * and is only present for render errors. | ||
| * | ||
| * ```tsx | ||
| * <RouterProvider onError=(error, info) => { | ||
| * let { location, params, pattern, errorInfo } = info; | ||
| * console.error(error, location, errorInfo); | ||
| * reportToErrorService(error, location, errorInfo); | ||
| * }} /> | ||
| * ``` | ||
| */ | ||
| onError?: ClientOnErrorFunction; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - This can lead to buggy behaviors if you are wrapping your own | ||
| * navigations/fetchers in `startTransition`. | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and router state changes will be wrapped in | ||
| * `React.startTransition` and also sent through | ||
| * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to | ||
| * surface mid-navigation router state changes to the UI. | ||
| * - When set to `false`, the router will not leverage `React.startTransition` or | ||
| * `React.useOptimistic` on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Render the UI for the given {@link DataRouter}. This component should | ||
| * typically be at the top of an app's element tree. | ||
| * | ||
| * ```tsx | ||
| * import { createBrowserRouter } from "react-router"; | ||
| * import { RouterProvider } from "react-router/dom"; | ||
| * import { createRoot } from "react-dom/client"; | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * createRoot(document.getElementById("root")).render( | ||
| * <RouterProvider router={router} /> | ||
| * ); | ||
| * ``` | ||
| * | ||
| * <docs-info>Please note that this component is exported both from | ||
| * `react-router` and `react-router/dom` with the only difference being that the | ||
| * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync) | ||
| * implementation. You _almost always_ want to use the version from | ||
| * `react-router/dom` unless you're running in a non-DOM environment.</docs-info> | ||
| * | ||
| * | ||
| * @public | ||
| * @category Data Routers | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {RouterProviderProps.flushSync} props.flushSync n/a | ||
| * @param {RouterProviderProps.onError} props.onError n/a | ||
| * @param {RouterProviderProps.router} props.router n/a | ||
| * @param {RouterProviderProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router | ||
| */ | ||
| declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions, }: RouterProviderProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface MemoryRouterProps { | ||
| /** | ||
| * Application basename | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * Initial entries in the in-memory history stack | ||
| */ | ||
| initialEntries?: InitialEntry[]; | ||
| /** | ||
| * Index of `initialEntries` the application should initialize to | ||
| */ | ||
| initialIndex?: number; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * A declarative {@link Router | `<Router>`} that stores all entries in memory. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {MemoryRouterProps.basename} props.basename n/a | ||
| * @param {MemoryRouterProps.children} props.children n/a | ||
| * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a | ||
| * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a | ||
| * @param {MemoryRouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns A declarative in-memory {@link Router | `<Router>`} for client-side | ||
| * routing. | ||
| */ | ||
| declare function MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions, }: MemoryRouterProps): React.ReactElement; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface NavigateProps { | ||
| /** | ||
| * The path to navigate to. This can be a string or a {@link Path} object | ||
| */ | ||
| to: To; | ||
| /** | ||
| * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) | ||
| * stack | ||
| */ | ||
| replace?: boolean; | ||
| /** | ||
| * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state). | ||
| */ | ||
| state?: any; | ||
| /** | ||
| * How to interpret relative routing in the `to` prop. | ||
| * See {@link RelativeRoutingType}. | ||
| */ | ||
| relative?: RelativeRoutingType; | ||
| } | ||
| /** | ||
| * A component-based version of {@link useNavigate} to use in a | ||
| * [`React.Component` class](https://react.dev/reference/react/Component) where | ||
| * hooks cannot be used. | ||
| * | ||
| * It's recommended to avoid using this component in favor of {@link useNavigate}. | ||
| * | ||
| * @example | ||
| * <Navigate to="/tasks" /> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {NavigateProps.relative} props.relative n/a | ||
| * @param {NavigateProps.replace} props.replace n/a | ||
| * @param {NavigateProps.state} props.state n/a | ||
| * @param {NavigateProps.to} props.to n/a | ||
| * @returns {void} | ||
| * | ||
| */ | ||
| declare function Navigate({ to, replace, state, relative, }: NavigateProps): null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface OutletProps { | ||
| /** | ||
| * Provides a context value to the element tree below the outlet. Use when | ||
| * the parent route needs to provide values to child routes. | ||
| * | ||
| * ```tsx | ||
| * <Outlet context={myContextValue} /> | ||
| * ``` | ||
| * | ||
| * Access the context with {@link useOutletContext}. | ||
| */ | ||
| context?: unknown; | ||
| } | ||
| /** | ||
| * Renders the matching child route of a parent route or nothing if no child | ||
| * route matches. | ||
| * | ||
| * @example | ||
| * import { Outlet } from "react-router"; | ||
| * | ||
| * export default function SomeParent() { | ||
| * return ( | ||
| * <div> | ||
| * <h1>Parent Content</h1> | ||
| * <Outlet /> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {OutletProps.context} props.context n/a | ||
| * @returns React element for the rendered outlet or `null` if no child route matches. | ||
| */ | ||
| declare function Outlet(props: OutletProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface PathRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: NonIndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: NonIndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: NonIndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<NonIndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: NonIndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: NonIndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: NonIndexRouteObject["action"]; | ||
| hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: NonIndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index?: false; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface LayoutRouteProps extends PathRouteProps { | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface IndexRouteProps { | ||
| /** | ||
| * Whether the path should be case-sensitive. Defaults to `false`. | ||
| */ | ||
| caseSensitive?: IndexRouteObject["caseSensitive"]; | ||
| /** | ||
| * The path pattern to match. If unspecified or empty, then this becomes a | ||
| * layout route. | ||
| */ | ||
| path?: IndexRouteObject["path"]; | ||
| /** | ||
| * The unique identifier for this route (for use with {@link DataRouter}s) | ||
| */ | ||
| id?: IndexRouteObject["id"]; | ||
| /** | ||
| * A function that returns a promise that resolves to the route object. | ||
| * Used for code-splitting routes. | ||
| * See [`lazy`](../../start/data/route-object#lazy). | ||
| */ | ||
| lazy?: LazyRouteFunction<IndexRouteObject>; | ||
| /** | ||
| * The route middleware. | ||
| * See [`middleware`](../../start/data/route-object#middleware). | ||
| */ | ||
| middleware?: IndexRouteObject["middleware"]; | ||
| /** | ||
| * The route loader. | ||
| * See [`loader`](../../start/data/route-object#loader). | ||
| */ | ||
| loader?: IndexRouteObject["loader"]; | ||
| /** | ||
| * The route action. | ||
| * See [`action`](../../start/data/route-object#action). | ||
| */ | ||
| action?: IndexRouteObject["action"]; | ||
| hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"]; | ||
| /** | ||
| * The route shouldRevalidate function. | ||
| * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate). | ||
| */ | ||
| shouldRevalidate?: IndexRouteObject["shouldRevalidate"]; | ||
| /** | ||
| * The route handle. | ||
| */ | ||
| handle?: IndexRouteObject["handle"]; | ||
| /** | ||
| * Whether this is an index route. | ||
| */ | ||
| index: true; | ||
| /** | ||
| * Child Route components | ||
| */ | ||
| children?: undefined; | ||
| /** | ||
| * The React element to render when this Route matches. | ||
| * Mutually exclusive with `Component`. | ||
| */ | ||
| element?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render while this router is loading data. | ||
| * Mutually exclusive with `HydrateFallback`. | ||
| */ | ||
| hydrateFallbackElement?: React.ReactNode | null; | ||
| /** | ||
| * The React element to render at this route if an error occurs. | ||
| * Mutually exclusive with `ErrorBoundary`. | ||
| */ | ||
| errorElement?: React.ReactNode | null; | ||
| /** | ||
| * The React Component to render when this route matches. | ||
| * Mutually exclusive with `element`. | ||
| */ | ||
| Component?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render while this router is loading data. | ||
| * Mutually exclusive with `hydrateFallbackElement`. | ||
| */ | ||
| HydrateFallback?: React.ComponentType | null; | ||
| /** | ||
| * The React Component to render at this route if an error occurs. | ||
| * Mutually exclusive with `errorElement`. | ||
| */ | ||
| ErrorBoundary?: React.ComponentType | null; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps; | ||
| /** | ||
| * Configures an element to render when a pattern matches the current location. | ||
| * It must be rendered within a {@link Routes} element. Note that these routes | ||
| * do not participate in data loading, actions, code splitting, or any other | ||
| * route module features. | ||
| * | ||
| * @example | ||
| * // Usually used in a declarative router | ||
| * function App() { | ||
| * return ( | ||
| * <BrowserRouter> | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * </BrowserRouter> | ||
| * ); | ||
| * } | ||
| * | ||
| * // But can be used with a data router as well if you prefer the JSX notation | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {PathRouteProps.action} props.action n/a | ||
| * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a | ||
| * @param {PathRouteProps.Component} props.Component n/a | ||
| * @param {PathRouteProps.children} props.children n/a | ||
| * @param {PathRouteProps.element} props.element n/a | ||
| * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a | ||
| * @param {PathRouteProps.errorElement} props.errorElement n/a | ||
| * @param {PathRouteProps.handle} props.handle n/a | ||
| * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a | ||
| * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a | ||
| * @param {PathRouteProps.id} props.id n/a | ||
| * @param {PathRouteProps.index} props.index n/a | ||
| * @param {PathRouteProps.lazy} props.lazy n/a | ||
| * @param {PathRouteProps.loader} props.loader n/a | ||
| * @param {PathRouteProps.path} props.path n/a | ||
| * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a | ||
| * @returns {void} | ||
| */ | ||
| declare function Route(props: RouteProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RouterProps { | ||
| /** | ||
| * The base path for the application. This is prepended to all locations | ||
| */ | ||
| basename?: string; | ||
| /** | ||
| * Nested {@link Route} elements describing the route tree | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The location to match against. Defaults to the current location. | ||
| * This can be a string or a {@link Location} object. | ||
| */ | ||
| location: Partial<Location> | string; | ||
| /** | ||
| * The type of navigation that triggered this `location` change. | ||
| * Defaults to {@link NavigationType.Pop}. | ||
| */ | ||
| navigationType?: Action; | ||
| /** | ||
| * The navigator to use for navigation. This is usually a history object | ||
| * or a custom navigator that implements the {@link Navigator} interface. | ||
| */ | ||
| navigator: Navigator; | ||
| /** | ||
| * Whether this router is static or not (used for SSR). If `true`, the router | ||
| * will not be reactive to location changes. | ||
| */ | ||
| static?: boolean; | ||
| /** | ||
| * Control whether router state updates are internally wrapped in | ||
| * [`React.startTransition`](https://react.dev/reference/react/startTransition). | ||
| * | ||
| * - When left `undefined`, all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped | ||
| * in `React.startTransition` and all router state updates are wrapped in | ||
| * `React.startTransition` | ||
| * - When set to `false`, the router will not leverage `React.startTransition` | ||
| * on any navigations or state changes. | ||
| * | ||
| * For more information, please see the [docs](../../explanation/react-transitions). | ||
| */ | ||
| useTransitions?: boolean; | ||
| } | ||
| /** | ||
| * Provides location context for the rest of the app. | ||
| * | ||
| * Note: You usually won't render a `<Router>` directly. Instead, you'll render a | ||
| * router that is more specific to your environment such as a {@link BrowserRouter} | ||
| * in web browsers or a {@link ServerRouter} for server rendering. | ||
| * | ||
| * @public | ||
| * @category Declarative Routers | ||
| * @mode declarative | ||
| * @param props Props | ||
| * @param {RouterProps.basename} props.basename n/a | ||
| * @param {RouterProps.children} props.children n/a | ||
| * @param {RouterProps.location} props.location n/a | ||
| * @param {RouterProps.navigationType} props.navigationType n/a | ||
| * @param {RouterProps.navigator} props.navigator n/a | ||
| * @param {RouterProps.static} props.static n/a | ||
| * @param {RouterProps.useTransitions} props.useTransitions n/a | ||
| * @returns React element for the rendered router or `null` if the location does | ||
| * not match the {@link props.basename} | ||
| */ | ||
| declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, useTransitions, }: RouterProps): React.ReactElement | null; | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface RoutesProps { | ||
| /** | ||
| * Nested {@link Route} elements | ||
| */ | ||
| children?: React.ReactNode; | ||
| /** | ||
| * The {@link Location} to match against. Defaults to the current location. | ||
| */ | ||
| location?: Partial<Location> | string; | ||
| } | ||
| /** | ||
| * Renders a branch of {@link Route | `<Route>`s} that best matches the current | ||
| * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader), | ||
| * [`action`](../../start/framework/route-module#action), code splitting, or | ||
| * any other [route module](../../start/framework/route-module) features. | ||
| * | ||
| * @example | ||
| * import { Route, Routes } from "react-router"; | ||
| * | ||
| * <Routes> | ||
| * <Route index element={<StepOne />} /> | ||
| * <Route path="step-2" element={<StepTwo />} /> | ||
| * <Route path="step-3" element={<StepThree />} /> | ||
| * </Routes> | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @param props Props | ||
| * @param {RoutesProps.children} props.children n/a | ||
| * @param {RoutesProps.location} props.location n/a | ||
| * @returns React element for the rendered routes or `null` if no route matches | ||
| */ | ||
| declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; | ||
| interface AwaitResolveRenderFunction<Resolve = any> { | ||
| (data: Awaited<Resolve>): React.ReactNode; | ||
| } | ||
| /** | ||
| * @category Types | ||
| */ | ||
| interface AwaitProps<Resolve> { | ||
| /** | ||
| * When using a function, the resolved value is provided as the parameter. | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * {(resolvedReviews) => <Reviews items={resolvedReviews} />} | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * When using React elements, {@link useAsyncValue} will provide the | ||
| * resolved value: | ||
| * | ||
| * ```tsx [2] | ||
| * <Await resolve={reviewsPromise}> | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function Reviews() { | ||
| * const resolvedReviews = useAsyncValue(); | ||
| * return <div>...</div>; | ||
| * } | ||
| * ``` | ||
| */ | ||
| children: React.ReactNode | AwaitResolveRenderFunction<Resolve>; | ||
| /** | ||
| * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * rejects. | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<div>Oops</div>} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * ``` | ||
| * | ||
| * To provide a more contextual error, you can use the {@link useAsyncError} in a | ||
| * child component | ||
| * | ||
| * ```tsx | ||
| * <Await | ||
| * errorElement={<ReviewsError />} | ||
| * resolve={reviewsPromise} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * | ||
| * function ReviewsError() { | ||
| * const error = useAsyncError(); | ||
| * return <div>Error loading reviews: {error.message}</div>; | ||
| * } | ||
| * ``` | ||
| * | ||
| * If you do not provide an `errorElement`, the rejected value will bubble up | ||
| * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary) | ||
| * and be accessible via the {@link useRouteError} hook. | ||
| */ | ||
| errorElement?: React.ReactNode; | ||
| /** | ||
| * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | ||
| * returned from a [`loader`](../../start/framework/route-module#loader) to be | ||
| * resolved and rendered. | ||
| * | ||
| * ```tsx | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * let reviews = getReviews(); // not awaited | ||
| * let book = await getBook(); | ||
| * return { | ||
| * book, | ||
| * reviews, // this is a promise | ||
| * }; | ||
| * } | ||
| * | ||
| * export default function Book() { | ||
| * const { | ||
| * book, | ||
| * reviews, // this is the same promise | ||
| * } = useLoaderData(); | ||
| * | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * // and is the promise we pass to Await | ||
| * resolve={reviews} | ||
| * > | ||
| * <Reviews /> | ||
| * </Await> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| */ | ||
| resolve: Resolve; | ||
| } | ||
| /** | ||
| * Used to render promise values with automatic error handling. | ||
| * | ||
| * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense) | ||
| * | ||
| * @example | ||
| * import { Await, useLoaderData } from "react-router"; | ||
| * | ||
| * export async function loader() { | ||
| * // not awaited | ||
| * const reviews = getReviews(); | ||
| * // awaited (blocks the transition) | ||
| * const book = await fetch("/api/book").then((res) => res.json()); | ||
| * return { book, reviews }; | ||
| * } | ||
| * | ||
| * function Book() { | ||
| * const { book, reviews } = useLoaderData(); | ||
| * return ( | ||
| * <div> | ||
| * <h1>{book.title}</h1> | ||
| * <p>{book.description}</p> | ||
| * <React.Suspense fallback={<ReviewsSkeleton />}> | ||
| * <Await | ||
| * resolve={reviews} | ||
| * errorElement={ | ||
| * <div>Could not load reviews 😬</div> | ||
| * } | ||
| * children={(resolvedReviews) => ( | ||
| * <Reviews items={resolvedReviews} /> | ||
| * )} | ||
| * /> | ||
| * </React.Suspense> | ||
| * </div> | ||
| * ); | ||
| * } | ||
| * | ||
| * @public | ||
| * @category Components | ||
| * @mode framework | ||
| * @mode data | ||
| * @param props Props | ||
| * @param {AwaitProps.children} props.children n/a | ||
| * @param {AwaitProps.errorElement} props.errorElement n/a | ||
| * @param {AwaitProps.resolve} props.resolve n/a | ||
| * @returns React element for the rendered awaited value | ||
| */ | ||
| declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element; | ||
| /** | ||
| * Creates a route config from a React "children" object, which is usually | ||
| * either a `<Route>` element or an array of them. Used internally by | ||
| * `<Routes>` to create a route config from its children. | ||
| * | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; | ||
| /** | ||
| * Create route objects from JSX elements instead of arrays of objects. | ||
| * | ||
| * @example | ||
| * const routes = createRoutesFromElements( | ||
| * <> | ||
| * <Route index loader={step1Loader} Component={StepOne} /> | ||
| * <Route path="step-2" loader={step2Loader} Component={StepTwo} /> | ||
| * <Route path="step-3" loader={step3Loader} Component={StepThree} /> | ||
| * </> | ||
| * ); | ||
| * | ||
| * const router = createBrowserRouter(routes); | ||
| * | ||
| * function App() { | ||
| * return <RouterProvider router={router} />; | ||
| * } | ||
| * | ||
| * @name createRoutesFromElements | ||
| * @public | ||
| * @category Utils | ||
| * @mode data | ||
| * @param children The React children to convert into a route config | ||
| * @param parentPath The path of the parent route, used to generate unique IDs. | ||
| * This is used for internal recursion and is not intended to be used by the | ||
| * application developer. | ||
| * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter} | ||
| */ | ||
| declare const createRoutesFromElements: typeof createRoutesFromChildren; | ||
| /** | ||
| * Renders the result of {@link matchRoutes} into a React element. | ||
| * | ||
| * @public | ||
| * @category Utils | ||
| * @param matches The array of {@link RouteMatch | route matches} to render | ||
| * @returns A React element that renders the matched routes or `null` if no matches | ||
| */ | ||
| declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; | ||
| declare function useRouteComponentProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }; | ||
| type RouteComponentProps = ReturnType<typeof useRouteComponentProps>; | ||
| type RouteComponentType = React.ComponentType<RouteComponentProps>; | ||
| declare function WithComponentProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| matches: UIMatch<unknown, unknown>[]; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useHydrateFallbackProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }; | ||
| type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>; | ||
| type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>; | ||
| declare function WithHydrateFallbackProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| declare function useErrorBoundaryProps(): { | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }; | ||
| type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>; | ||
| type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>; | ||
| declare function WithErrorBoundaryProps({ children, }: { | ||
| children: React.ReactElement; | ||
| }): React.ReactElement<any, string | React.JSXElementConstructor<any>>; | ||
| declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{ | ||
| params: Readonly<Params<string>>; | ||
| loaderData: any; | ||
| actionData: any; | ||
| error: unknown; | ||
| }, string | React.JSXElementConstructor<any>>; | ||
| interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> { | ||
| router: Router$1; | ||
| staticContext?: StaticHandlerContext; | ||
| onError?: ClientOnErrorFunction; | ||
| } | ||
| declare const DataRouterContext: React.Context<DataRouterContextObject | null>; | ||
| declare const DataRouterStateContext: React.Context<RouterState | null>; | ||
| type ViewTransitionContextObject = { | ||
| isTransitioning: false; | ||
| } | { | ||
| isTransitioning: true; | ||
| flushSync: boolean; | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>; | ||
| type FetchersContextObject = Map<string, any>; | ||
| declare const FetchersContext: React.Context<FetchersContextObject>; | ||
| declare const AwaitContext: React.Context<TrackedPromise | null>; | ||
| declare const AwaitContextProvider: (props: React.ComponentProps<typeof AwaitContext.Provider>) => React.FunctionComponentElement<React.ProviderProps<TrackedPromise | null>>; | ||
| interface NavigateOptions { | ||
| /** Replace the current entry in the history stack instead of pushing a new one */ | ||
| replace?: boolean; | ||
| /** Masked URL */ | ||
| mask?: To; | ||
| /** Adds persistent client side routing state to the next location */ | ||
| state?: any; | ||
| /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */ | ||
| preventScrollReset?: boolean; | ||
| /** 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. */ | ||
| relative?: RelativeRoutingType; | ||
| /** 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} */ | ||
| flushSync?: boolean; | ||
| /** 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 useViewTransitionState `useViewTransitionState()`} hook. */ | ||
| viewTransition?: boolean; | ||
| /** Specifies the default revalidation behavior after this submission */ | ||
| defaultShouldRevalidate?: boolean; | ||
| } | ||
| /** | ||
| * A Navigator is a "location changer"; it's how you get to different locations. | ||
| * | ||
| * Every history instance conforms to the Navigator interface, but the | ||
| * distinction is useful primarily when it comes to the low-level `<Router>` API | ||
| * where both the location and a navigator must be provided separately in order | ||
| * to avoid "tearing" that may occur in a suspense-enabled app if the action | ||
| * and/or location were to be read directly from the history instance. | ||
| */ | ||
| interface Navigator { | ||
| createHref: History["createHref"]; | ||
| encodeLocation?: History["encodeLocation"]; | ||
| go: History["go"]; | ||
| push(to: To, state?: any, opts?: NavigateOptions): void; | ||
| replace(to: To, state?: any, opts?: NavigateOptions): void; | ||
| } | ||
| interface NavigationContextObject { | ||
| basename: string; | ||
| navigator: Navigator; | ||
| static: boolean; | ||
| useTransitions: boolean | undefined; | ||
| future: {}; | ||
| } | ||
| declare const NavigationContext: React.Context<NavigationContextObject>; | ||
| interface LocationContextObject { | ||
| location: Location; | ||
| navigationType: Action; | ||
| } | ||
| declare const LocationContext: React.Context<LocationContextObject>; | ||
| interface RouteContextObject { | ||
| outlet: React.ReactElement | null; | ||
| matches: RouteMatch[]; | ||
| isDataRoute: boolean; | ||
| } | ||
| declare const RouteContext: React.Context<RouteContextObject>; | ||
| export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type Navigation as g, type RouterState as h, type GetScrollRestorationKeyFunction as i, type StaticHandlerContext as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-BqZ2x964.js'; | ||
| /** | ||
| * A Router instance manages all navigation and data loading/mutations | ||
| */ | ||
| interface Router { | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the basename for the router | ||
| */ | ||
| get basename(): RouterInit["basename"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the future config for the router | ||
| */ | ||
| get future(): FutureConfig; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the current state of the router | ||
| */ | ||
| get state(): RouterState; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the routes for this router instance | ||
| */ | ||
| get routes(): DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the route branches for this router instance | ||
| */ | ||
| get branches(): RouteBranch<DataRouteObject>[] | undefined; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the manifest for this router instance | ||
| */ | ||
| get manifest(): RouteManifest; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Return the window associated with the router | ||
| */ | ||
| get window(): RouterInit["window"]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Initialize the router, including adding history listeners and kicking off | ||
| * initial data fetches. Returns a function to cleanup listeners and abort | ||
| * any in-progress loads | ||
| */ | ||
| initialize(): Router; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Subscribe to router.state updates | ||
| * | ||
| * @param fn function to call with the new state | ||
| */ | ||
| subscribe(fn: RouterSubscriber): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Enable scroll restoration behavior in the router | ||
| * | ||
| * @param savedScrollPositions Object that will manage positions, in case | ||
| * it's being restored from sessionStorage | ||
| * @param getScrollPosition Function to get the active Y scroll position | ||
| * @param getKey Function to get the key to use for restoration | ||
| */ | ||
| enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Navigate forward/backward in the history stack | ||
| * @param to Delta to move in the history stack | ||
| */ | ||
| navigate(to: number): Promise<void>; | ||
| /** | ||
| * Navigate to the given path | ||
| * @param to Path to navigate to | ||
| * @param opts Navigation options (method, submission, etc.) | ||
| */ | ||
| navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a fetcher load/submission | ||
| * | ||
| * @param key Fetcher key | ||
| * @param routeId Route that owns the fetcher | ||
| * @param href href to fetch | ||
| * @param opts Fetcher options, (method, submission, etc.) | ||
| */ | ||
| fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Trigger a revalidation of all current route loaders and fetcher loads | ||
| */ | ||
| revalidate(): Promise<void>; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to create an href for the given location | ||
| * @param location | ||
| */ | ||
| createHref(location: Location | URL): string; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Utility function to URL encode a destination path according to the internal | ||
| * history implementation | ||
| * @param to | ||
| */ | ||
| encodeLocation(to: To): Path; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get/create a fetcher for the given key | ||
| * @param key | ||
| */ | ||
| getFetcher<TData = any>(key: string): Fetcher<TData>; | ||
| /** | ||
| * @internal | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Reset the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| resetFetcher(key: string, opts?: { | ||
| reason?: unknown; | ||
| }): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete the fetcher for a given key | ||
| * @param key | ||
| */ | ||
| deleteFetcher(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cleanup listeners and abort any in-progress loads | ||
| */ | ||
| dispose(): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Get a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| * @param fn The blocker function implementation | ||
| */ | ||
| getBlocker(key: string, fn: BlockerFunction): Blocker; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Delete a navigation blocker | ||
| * @param key The identifier for the blocker | ||
| */ | ||
| deleteBlocker(key: string): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE DO NOT USE | ||
| * | ||
| * Patch additional children routes into an existing parent route | ||
| * @param routeId The parent route id or a callback function accepting `patch` | ||
| * to perform batch patching | ||
| * @param children The additional children routes | ||
| * @param unstable_allowElementMutations Allow mutation or route elements on | ||
| * existing routes. Intended for RSC-usage | ||
| * only. | ||
| */ | ||
| patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * HMR needs to pass in-flight route updates to React Router | ||
| * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute) | ||
| */ | ||
| _internalSetRoutes(routes: RouteObject[]): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Cause subscribers to re-render. This is used to force a re-render. | ||
| */ | ||
| _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * Internal fetch AbortControllers accessed by unit tests | ||
| */ | ||
| _internalFetchControllers: Map<string, AbortController>; | ||
| } | ||
| /** | ||
| * State maintained internally by the router. During a navigation, all states | ||
| * reflect the "old" location unless otherwise noted. | ||
| */ | ||
| interface RouterState { | ||
| /** | ||
| * The action of the most recent navigation | ||
| */ | ||
| historyAction: Action; | ||
| /** | ||
| * The current location reflected by the router | ||
| */ | ||
| location: Location; | ||
| /** | ||
| * The current set of route matches | ||
| */ | ||
| matches: DataRouteMatch[]; | ||
| /** | ||
| * Tracks whether we've completed our initial data load | ||
| */ | ||
| initialized: boolean; | ||
| /** | ||
| * Tracks whether we should be rendering a HydrateFallback during hydration | ||
| */ | ||
| renderFallback: boolean; | ||
| /** | ||
| * Current scroll position we should start at for a new view | ||
| * - number -> scroll position to restore to | ||
| * - false -> do not restore scroll at all (used during submissions/revalidations) | ||
| * - null -> don't have a saved position, scroll to hash or top of page | ||
| */ | ||
| restoreScrollPosition: number | false | null; | ||
| /** | ||
| * Indicate whether this navigation should skip resetting the scroll position | ||
| * if we are unable to restore the scroll position | ||
| */ | ||
| preventScrollReset: boolean; | ||
| /** | ||
| * Tracks the state of the current navigation | ||
| */ | ||
| navigation: Navigation; | ||
| /** | ||
| * Tracks any in-progress revalidations | ||
| */ | ||
| revalidation: RevalidationState; | ||
| /** | ||
| * Data from the loaders for the current matches | ||
| */ | ||
| loaderData: RouteData; | ||
| /** | ||
| * Data from the action for the current matches | ||
| */ | ||
| actionData: RouteData | null; | ||
| /** | ||
| * Errors caught from loaders for the current matches | ||
| */ | ||
| errors: RouteData | null; | ||
| /** | ||
| * Map of current fetchers | ||
| */ | ||
| fetchers: Map<string, Fetcher>; | ||
| /** | ||
| * Map of current blockers | ||
| */ | ||
| blockers: Map<string, Blocker>; | ||
| } | ||
| /** | ||
| * Data that can be passed into hydrate a Router from SSR | ||
| */ | ||
| type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>; | ||
| /** | ||
| * Future flags to toggle new feature behavior | ||
| */ | ||
| interface FutureConfig { | ||
| } | ||
| /** | ||
| * Initialization options for createRouter | ||
| */ | ||
| interface RouterInit { | ||
| routes: RouteObject[]; | ||
| history: History; | ||
| basename?: string; | ||
| getContext?: () => MaybePromise<RouterContextProvider>; | ||
| instrumentations?: ClientInstrumentation[]; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| future?: Partial<FutureConfig>; | ||
| hydrationRouteProperties?: string[]; | ||
| hydrationData?: HydrationState; | ||
| window?: Window; | ||
| dataStrategy?: DataStrategyFunction; | ||
| patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
| } | ||
| /** | ||
| * State returned from a server-side query() call | ||
| */ | ||
| interface StaticHandlerContext { | ||
| basename: Router["basename"]; | ||
| location: RouterState["location"]; | ||
| matches: RouterState["matches"]; | ||
| loaderData: RouterState["loaderData"]; | ||
| actionData: RouterState["actionData"]; | ||
| errors: RouterState["errors"]; | ||
| statusCode: number; | ||
| loaderHeaders: Record<string, Headers>; | ||
| actionHeaders: Record<string, Headers>; | ||
| _deepestRenderedBoundaryId?: string | null; | ||
| } | ||
| /** | ||
| * A StaticHandler instance manages a singular SSR navigation/fetch event | ||
| */ | ||
| interface StaticHandler { | ||
| /** | ||
| * The set of data routes managed by this handler | ||
| */ | ||
| dataRoutes: DataRouteObject[]; | ||
| /** | ||
| * @private | ||
| * PRIVATE - DO NOT USE | ||
| * | ||
| * The route branches derived from the data routes, used for internal route | ||
| * matching in Framework Mode | ||
| */ | ||
| _internalRouteBranches: RouteBranch<DataRouteObject>[]; | ||
| /** | ||
| * Perform a query for a given request - executing all matched route | ||
| * loaders/actions. Used for document requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional query options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.skipLoaderErrorBubbling Skip loader error bubbling | ||
| * @param opts.skipRevalidation Skip revalidation after action submission | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| query(request: Request, opts?: { | ||
| requestContext?: unknown; | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| skipLoaderErrorBubbling?: boolean; | ||
| skipRevalidation?: boolean; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (query: (r: Request, args?: { | ||
| filterMatchesToLoad?: (match: DataRouteMatch) => boolean; | ||
| }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<StaticHandlerContext | Response>; | ||
| /** | ||
| * Perform a query for a specific route. Used for resource requests. | ||
| * | ||
| * @param request The request to query | ||
| * @param opts Optional queryRoute options | ||
| * @param opts.dataStrategy Alternate dataStrategy implementation | ||
| * @param opts.generateMiddlewareResponse To enable middleware, provide a function | ||
| * to generate a response to bubble back up the middleware chain | ||
| * @param opts.requestContext Context object to pass to loaders/actions | ||
| * @param opts.routeId The ID of the route to query | ||
| * @param opts.normalizePath Normalize the request path | ||
| */ | ||
| queryRoute(request: Request, opts?: { | ||
| routeId?: string; | ||
| requestContext?: unknown; | ||
| dataStrategy?: DataStrategyFunction<unknown>; | ||
| generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>; | ||
| normalizePath?: (request: Request) => Path; | ||
| }): Promise<any>; | ||
| } | ||
| type ViewTransitionOpts = { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| }; | ||
| /** | ||
| * Subscriber function signature for changes to router state | ||
| */ | ||
| interface RouterSubscriber { | ||
| (state: RouterState, opts: { | ||
| deletedFetchers: string[]; | ||
| newErrors: RouteData | null; | ||
| viewTransitionOpts?: ViewTransitionOpts; | ||
| flushSync: boolean; | ||
| }): void; | ||
| } | ||
| /** | ||
| * Function signature for determining the key to be used in scroll restoration | ||
| * for a given location | ||
| */ | ||
| interface GetScrollRestorationKeyFunction { | ||
| (location: Location, matches: UIMatch[]): string | null; | ||
| } | ||
| /** | ||
| * Function signature for determining the current scroll position | ||
| */ | ||
| interface GetScrollPositionFunction { | ||
| (): number; | ||
| } | ||
| /** | ||
| * - "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. | ||
| * - "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. | ||
| */ | ||
| type RelativeRoutingType = "route" | "path"; | ||
| type BaseNavigateOrFetchOptions = { | ||
| preventScrollReset?: boolean; | ||
| relative?: RelativeRoutingType; | ||
| flushSync?: boolean; | ||
| defaultShouldRevalidate?: boolean; | ||
| }; | ||
| type BaseNavigateOptions = BaseNavigateOrFetchOptions & { | ||
| replace?: boolean; | ||
| state?: any; | ||
| fromRouteId?: string; | ||
| viewTransition?: boolean; | ||
| mask?: To; | ||
| }; | ||
| type BaseSubmissionOptions = { | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| } & ({ | ||
| formData: FormData; | ||
| body?: undefined; | ||
| } | { | ||
| formData?: undefined; | ||
| body: any; | ||
| }); | ||
| /** | ||
| * Options for a navigate() call for a normal (non-submission) navigation | ||
| */ | ||
| type LinkNavigateOptions = BaseNavigateOptions; | ||
| /** | ||
| * Options for a navigate() call for a submission navigation | ||
| */ | ||
| type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to navigate() for a navigation | ||
| */ | ||
| type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions; | ||
| /** | ||
| * Options for a fetch() load | ||
| */ | ||
| type LoadFetchOptions = BaseNavigateOrFetchOptions; | ||
| /** | ||
| * Options for a fetch() submission | ||
| */ | ||
| type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions; | ||
| /** | ||
| * Options to pass to fetch() | ||
| */ | ||
| type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions; | ||
| /** | ||
| * Potential states for state.navigation | ||
| */ | ||
| type NavigationStates = { | ||
| Idle: { | ||
| state: "idle"; | ||
| location: undefined; | ||
| matches: undefined; | ||
| historyAction: undefined; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| text: undefined; | ||
| }; | ||
| Loading: { | ||
| state: "loading"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| }; | ||
| Submitting: { | ||
| state: "submitting"; | ||
| location: Location; | ||
| matches: DataRouteMatch[]; | ||
| historyAction: Action; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| text: Submission["text"]; | ||
| }; | ||
| }; | ||
| type Navigation = NavigationStates[keyof NavigationStates]; | ||
| type RevalidationState = "idle" | "loading"; | ||
| /** | ||
| * Potential states for fetchers | ||
| */ | ||
| type FetcherStates<TData = any> = { | ||
| /** | ||
| * The fetcher is not calling a loader or action | ||
| * | ||
| * ```tsx | ||
| * fetcher.state === "idle" | ||
| * ``` | ||
| */ | ||
| Idle: { | ||
| state: "idle"; | ||
| formMethod: undefined; | ||
| formAction: undefined; | ||
| formEncType: undefined; | ||
| text: undefined; | ||
| formData: undefined; | ||
| json: undefined; | ||
| /** | ||
| * If the fetcher has never been called, this will be undefined. | ||
| */ | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| * The fetcher is loading data from a {@link LoaderFunction | loader} from a | ||
| * call to {@link FetcherWithComponents.load | `fetcher.load`}. | ||
| * | ||
| * ```tsx | ||
| * // somewhere | ||
| * <button onClick={() => fetcher.load("/some/route") }>Load</button> | ||
| * | ||
| * // the state will update | ||
| * fetcher.state === "loading" | ||
| * ``` | ||
| */ | ||
| Loading: { | ||
| state: "loading"; | ||
| formMethod: Submission["formMethod"] | undefined; | ||
| formAction: Submission["formAction"] | undefined; | ||
| formEncType: Submission["formEncType"] | undefined; | ||
| text: Submission["text"] | undefined; | ||
| formData: Submission["formData"] | undefined; | ||
| json: Submission["json"] | undefined; | ||
| data: TData | undefined; | ||
| }; | ||
| /** | ||
| 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`}. | ||
| ```tsx | ||
| // somewhere | ||
| <input | ||
| onChange={e => { | ||
| fetcher.submit(event.currentTarget.form, { method: "post" }); | ||
| }} | ||
| /> | ||
| // the state will update | ||
| fetcher.state === "submitting" | ||
| // and formData will be available | ||
| fetcher.formData | ||
| ``` | ||
| */ | ||
| Submitting: { | ||
| state: "submitting"; | ||
| formMethod: Submission["formMethod"]; | ||
| formAction: Submission["formAction"]; | ||
| formEncType: Submission["formEncType"]; | ||
| text: Submission["text"]; | ||
| formData: Submission["formData"]; | ||
| json: Submission["json"]; | ||
| data: TData | undefined; | ||
| }; | ||
| }; | ||
| type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>]; | ||
| interface BlockerBlocked { | ||
| state: "blocked"; | ||
| reset: () => void; | ||
| proceed: () => void; | ||
| location: Location; | ||
| } | ||
| interface BlockerUnblocked { | ||
| state: "unblocked"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: undefined; | ||
| } | ||
| interface BlockerProceeding { | ||
| state: "proceeding"; | ||
| reset: undefined; | ||
| proceed: undefined; | ||
| location: Location; | ||
| } | ||
| type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; | ||
| type BlockerFunction = (args: { | ||
| currentLocation: Location; | ||
| nextLocation: Location; | ||
| historyAction: Action; | ||
| }) => boolean; | ||
| declare const IDLE_NAVIGATION: NavigationStates["Idle"]; | ||
| declare const IDLE_FETCHER: FetcherStates["Idle"]; | ||
| declare const IDLE_BLOCKER: BlockerUnblocked; | ||
| /** | ||
| * Create a router and listen to history POP navigations | ||
| */ | ||
| declare function createRouter(init: RouterInit): Router; | ||
| interface CreateStaticHandlerOptions { | ||
| basename?: string; | ||
| mapRouteProperties?: MapRoutePropertiesFunction; | ||
| instrumentations?: Pick<ServerInstrumentation, "route">[]; | ||
| future?: Partial<FutureConfig>; | ||
| } | ||
| type ServerInstrumentation = { | ||
| handler?: InstrumentRequestHandlerFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type ClientInstrumentation = { | ||
| router?: InstrumentRouterFunction; | ||
| route?: InstrumentRouteFunction; | ||
| }; | ||
| type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void; | ||
| type InstrumentRouterFunction = (router: InstrumentableRouter) => void; | ||
| type InstrumentRouteFunction = (route: InstrumentableRoute) => void; | ||
| type InstrumentationHandlerResult = { | ||
| status: "success"; | ||
| error: undefined; | ||
| } | { | ||
| status: "error"; | ||
| error: Error; | ||
| }; | ||
| type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>; | ||
| type ReadonlyRequest = { | ||
| method: string; | ||
| url: string; | ||
| headers: Pick<Headers, "get">; | ||
| }; | ||
| type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>; | ||
| type InstrumentableRoute = { | ||
| id: string; | ||
| index: boolean | undefined; | ||
| path: string | undefined; | ||
| instrument(instrumentations: RouteInstrumentations): void; | ||
| }; | ||
| type RouteInstrumentations = { | ||
| lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>; | ||
| middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| action?: InstrumentFunction<RouteHandlerInstrumentationInfo>; | ||
| }; | ||
| type RouteLazyInstrumentationInfo = undefined; | ||
| type RouteHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| params: LoaderFunctionArgs["params"]; | ||
| pattern: string; | ||
| context: ReadonlyContext; | ||
| }>; | ||
| type InstrumentableRouter = { | ||
| instrument(instrumentations: RouterInstrumentations): void; | ||
| }; | ||
| type RouterInstrumentations = { | ||
| navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>; | ||
| fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>; | ||
| }; | ||
| type RouterNavigationInstrumentationInfo = Readonly<{ | ||
| to: string | number; | ||
| currentUrl: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type RouterFetchInstrumentationInfo = Readonly<{ | ||
| href: string; | ||
| currentUrl: string; | ||
| fetcherKey: string; | ||
| formMethod?: HTMLFormMethod; | ||
| formEncType?: FormEncType; | ||
| formData?: FormData; | ||
| body?: any; | ||
| }>; | ||
| type InstrumentableRequestHandler = { | ||
| instrument(instrumentations: RequestHandlerInstrumentations): void; | ||
| }; | ||
| type RequestHandlerInstrumentations = { | ||
| request?: InstrumentFunction<RequestHandlerInstrumentationInfo>; | ||
| }; | ||
| type RequestHandlerInstrumentationInfo = Readonly<{ | ||
| request: ReadonlyRequest; | ||
| context: ReadonlyContext | undefined; | ||
| }>; | ||
| export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type Navigation as d, type RouterState as e, type GetScrollRestorationKeyFunction as f, type StaticHandlerContext as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u }; |
| import { R as RouteModule } from './data-BqZ2x964.js'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
| import { R as RouteModule } from './data-BVUf681J.mjs'; | ||
| /** | ||
| * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation. | ||
| * React Router should handle this for you via type generation. | ||
| * | ||
| * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation . | ||
| */ | ||
| interface Register { | ||
| } | ||
| type AnyParams = Record<string, string | undefined>; | ||
| type AnyPages = Record<string, { | ||
| params: AnyParams; | ||
| }>; | ||
| type Pages = Register extends { | ||
| pages: infer Registered extends AnyPages; | ||
| } ? Registered : AnyPages; | ||
| type AnyRouteFiles = Record<string, { | ||
| id: string; | ||
| page: string; | ||
| }>; | ||
| type RouteFiles = Register extends { | ||
| routeFiles: infer Registered extends AnyRouteFiles; | ||
| } ? Registered : AnyRouteFiles; | ||
| type AnyRouteModules = Record<string, RouteModule>; | ||
| type RouteModules = Register extends { | ||
| routeModules: infer Registered extends AnyRouteModules; | ||
| } ? Registered : AnyRouteModules; | ||
| export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4316140
0.06%97842
0.02%