import * as React from 'react'; import { n as RouteObject, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, am as PatchRoutesOnNavigationFunction, a as Router$1, T as To, g as RelativeRoutingType, v as NonIndexRouteObject, a0 as LazyRouteFunction, u as IndexRouteObject, h as Location, i as Action, al as Navigator, ao as RouteMatch, r as StaticHandlerContext, d as RouteManifest, R as RouteModules, ak as DataRouteObject, aH as RouteModule, $ as HTMLFormMethod, Z as FormEncType, at as PageLinkDescriptor, aI as History, x as GetScrollRestorationKeyFunction, N as NavigateOptions, y as Fetcher, S as SerializeFrom, B as BlockerFunction } from './route-data-DuV3tXo2.js'; /** * @private */ declare function mapRouteProperties(route: RouteObject): Partial & { hasErrorBoundary: boolean; }; /** * @category Routers */ declare function createMemoryRouter(routes: RouteObject[], opts?: { basename?: string; future?: Partial; hydrationData?: HydrationState; initialEntries?: InitialEntry[]; initialIndex?: number; dataStrategy?: DataStrategyFunction; patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; }): Router$1; interface RouterProviderProps { router: Router$1; flushSync?: (fn: () => unknown) => undefined; } /** * Given a Remix Router instance, render the appropriate UI */ declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement; /** * @category Types */ interface MemoryRouterProps { basename?: string; children?: React.ReactNode; initialEntries?: InitialEntry[]; initialIndex?: number; } /** * A `` that stores all entries in memory. * * @category Router Components */ declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement; /** * @category Types */ interface NavigateProps { to: To; replace?: boolean; state?: any; relative?: RelativeRoutingType; } /** * A component-based version of {@link useNavigate} to use in a [`React.Component * Class`](https://reactjs.org/docs/react-component.html) where hooks are not * able to be used. * * It's recommended to avoid using this component in favor of {@link useNavigate} * * @category Components */ 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 ``` Access the context with {@link useOutletContext}. */ context?: unknown; } /** Renders the matching child route of a parent route or nothing if no child route matches. ```tsx import { Outlet } from "react-router" export default function SomeParent() { return (

Parent Content

); } ``` @category Components */ declare function Outlet(props: OutletProps): React.ReactElement | null; /** * @category Types */ interface PathRouteProps { caseSensitive?: NonIndexRouteObject["caseSensitive"]; path?: NonIndexRouteObject["path"]; id?: NonIndexRouteObject["id"]; lazy?: LazyRouteFunction; loader?: NonIndexRouteObject["loader"]; action?: NonIndexRouteObject["action"]; hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"]; shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"]; handle?: NonIndexRouteObject["handle"]; index?: false; children?: React.ReactNode; element?: React.ReactNode | null; hydrateFallbackElement?: React.ReactNode | null; errorElement?: React.ReactNode | null; Component?: React.ComponentType | null; HydrateFallback?: React.ComponentType | null; ErrorBoundary?: React.ComponentType | null; } /** * @category Types */ interface LayoutRouteProps extends PathRouteProps { } /** * @category Types */ interface IndexRouteProps { caseSensitive?: IndexRouteObject["caseSensitive"]; path?: IndexRouteObject["path"]; id?: IndexRouteObject["id"]; lazy?: LazyRouteFunction; loader?: IndexRouteObject["loader"]; action?: IndexRouteObject["action"]; hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"]; shouldRevalidate?: IndexRouteObject["shouldRevalidate"]; handle?: IndexRouteObject["handle"]; index: true; children?: undefined; element?: React.ReactNode | null; hydrateFallbackElement?: React.ReactNode | null; errorElement?: React.ReactNode | null; Component?: React.ComponentType | null; HydrateFallback?: React.ComponentType | null; ErrorBoundary?: React.ComponentType | null; } 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. * * @category Components */ declare function Route$1(_props: RouteProps): React.ReactElement | null; /** * @category Types */ interface RouterProps { basename?: string; children?: React.ReactNode; location: Partial | string; navigationType?: Action; navigator: Navigator; static?: boolean; } /** * Provides location context for the rest of the app. * * Note: You usually won't render a `` directly. Instead, you'll render a * router that is more specific to your environment such as a `` * in web browsers or a `` for server rendering. * * @category Components */ declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null; /** * @category Types */ interface RoutesProps { /** * Nested {@link Route} elements */ children?: React.ReactNode; /** * The location to match against. Defaults to the current location. */ location?: Partial | string; } /** Renders a branch of {@link Route | ``} that best matches the current location. Note that these routes do not participate in data loading, actions, code splitting, or any other route module features. ```tsx import { Routes, Route } from "react-router" } /> } /> }> ``` @category Components */ declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; interface AwaitResolveRenderFunction { (data: Awaited): React.ReactNode; } /** * @category Types */ interface AwaitProps { /** When using a function, the resolved value is provided as the parameter. ```tsx [2] {(resolvedReviews) => } ``` When using React elements, {@link useAsyncValue} will provide the resolved value: ```tsx [2] function Reviews() { const resolvedReviews = useAsyncValue() return
...
} ``` */ children: React.ReactNode | AwaitResolveRenderFunction; /** The error element renders instead of the children when the promise rejects. ```tsx Oops} resolve={reviewsPromise} > ``` To provide a more contextual error, you can use the {@link useAsyncError} in a child component ```tsx } resolve={reviewsPromise} > function ReviewsError() { const error = useAsyncError() return
Error loading reviews: {error.message}
} ``` If you do not provide an errorElement, the rejected value will bubble up to the nearest route-level {@link NonIndexRouteObject#ErrorBoundary | ErrorBoundary} and be accessible via {@link useRouteError} hook. */ errorElement?: React.ReactNode; /** Takes a promise returned from a {@link LoaderFunction | loader} value to be resolved and rendered. ```jsx import { useLoaderData, Await } 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 (

{book.title}

{book.description}

}>
); } ``` */ resolve: Resolve; } /** Used to render promise values with automatic error handling. ```tsx import { Await, useLoaderData } from "react-router"; export 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 (

{book.title}

{book.description}

}> Could not load reviews 😬
} children={(resolvedReviews) => ( )} /> ); } ``` **Note:** `` expects to be rendered inside of a `` @category Components */ declare function Await({ children, errorElement, resolve, }: AwaitProps): React.JSX.Element; /** * Creates a route config from a React "children" object, which is usually * either a `` element or an array of them. Used internally by * `` to create a route config from its children. * * @category Utils */ declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; /** * Create route objects from JSX elements instead of arrays of objects */ declare let createRoutesFromElements: typeof createRoutesFromChildren; /** * Renders the result of `matchRoutes()` into a React element. * * @category Utils */ declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; type SerializedError = { message: string; stack?: string; }; interface FrameworkContextObject { manifest: AssetsManifest; routeModules: RouteModules; criticalCss?: string; serverHandoffString?: string; future: FutureConfig; isSpaMode: boolean; abortDelay?: number; serializeError?(error: Error): SerializedError; renderMeta?: { didRenderScripts?: boolean; streamCache?: Record & { result?: { done: boolean; value: string; }; error?: unknown; }>; }; } interface EntryContext extends FrameworkContextObject { staticHandlerContext: StaticHandlerContext; serverHandoffStream?: ReadableStream; } interface FutureConfig { } interface AssetsManifest { entry: { imports: string[]; module: string; }; routes: RouteManifest; url: string; version: string; hmr?: { timestamp?: number; runtime: string; }; } interface Route { index?: boolean; caseSensitive?: boolean; id: string; parentId?: string; path?: string; } interface EntryRoute extends Route { hasAction: boolean; hasLoader: boolean; hasClientAction: boolean; hasClientLoader: boolean; hasErrorBoundary: boolean; imports?: string[]; css?: string[]; module: string; parentId?: string; } declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set, manifest: RouteManifest, routeModulesCache: RouteModules, initialState: HydrationState, future: FutureConfig, isSpaMode: boolean): DataRouteObject[]; declare function createClientRoutes(manifest: RouteManifest, routeModulesCache: RouteModules, initialState: HydrationState | null, isSpaMode: boolean, parentId?: string, routesByParentId?: Record[]>, needsRevalidation?: Set): DataRouteObject[]; declare function shouldHydrateRouteLoader(route: EntryRoute, routeModule: RouteModule, isSpaMode: boolean): boolean; type ParamKeyValuePair = [string, string]; type URLSearchParamsInit = string | ParamKeyValuePair[] | Record | URLSearchParams; /** Creates a URLSearchParams object using the given initializer. This is identical to `new URLSearchParams(init)` except it also supports arrays as values in the object form of the initializer instead of just strings. This is convenient when you need multiple values for a given key, but don't want to use an array initializer. For example, instead of: ```tsx let searchParams = new URLSearchParams([ ['sort', 'name'], ['sort', 'price'] ]); ``` you can do: ``` let searchParams = createSearchParams({ sort: ['name', 'price'] }); ``` @category Utils */ declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams; type JsonObject = { [Key in string]: JsonValue; } & { [Key in string]?: JsonValue | undefined; }; type JsonArray = JsonValue[] | readonly JsonValue[]; type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | JsonObject | JsonArray; type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null; /** * Submit options shared by both navigations and fetchers */ interface SharedSubmitOptions { /** * The HTTP method used to submit the form. Overrides `
`. * Defaults to "GET". */ method?: HTMLFormMethod; /** * The action URL path used to submit the form. Overrides ``. * Defaults to the path of the current route. */ action?: string; /** * The encoding used to submit the form. Overrides ``. * Defaults to "application/x-www-form-urlencoded". */ encType?: FormEncType; /** * Determines whether the form action is relative to the route hierarchy or * the pathname. Use this if you want to opt out of navigating the route * hierarchy and want to instead route based on /-delimited URL segments */ relative?: RelativeRoutingType; /** * In browser-based environments, prevent resetting scroll after this * navigation when using the component */ preventScrollReset?: boolean; /** * Enable flushSync for this submission's state updates */ flushSync?: boolean; } /** * Submit options available to fetchers */ interface FetcherSubmitOptions extends SharedSubmitOptions { } /** * Submit options available to navigations */ interface SubmitOptions extends FetcherSubmitOptions { /** * Set `true` to replace the current entry in the browser's history stack * instead of creating a new one (i.e. stay on "the same page"). Defaults * to `false`. */ replace?: boolean; /** * State object to add to the history stack entry for this navigation */ state?: any; /** * Indicate a specific fetcherKey to use when using navigate=false */ fetcherKey?: string; /** * navigate=false will use a fetcher instead of a navigation */ navigate?: boolean; /** * Enable view transitions on this submission navigation */ viewTransition?: boolean; } declare const FrameworkContext: React.Context; /** * Defines the discovery behavior of the link: * * - "render" - default, discover the route when the link renders * - "none" - don't eagerly discover, only discover if the link is clicked */ type DiscoverBehavior = "render" | "none"; /** * Defines the prefetching behavior of the link: * * - "none": Never fetched * - "intent": Fetched when the user focuses or hovers the link * - "render": Fetched when the link is rendered * - "viewport": Fetched when the link is in the viewport */ type PrefetchBehavior = "intent" | "render" | "none" | "viewport"; /** Renders all of the `` tags created by route module {@link LinksFunction} export. You should render it inside the `` of your document. ```tsx import { Links } from "react-router"; export default function Root() { return ( ); } ``` @category Components */ declare function Links(): React.JSX.Element; /** Renders `` tags for modules and data of another page to enable an instant navigation to that page. {@link LinkProps.prefetch | ``} uses this internally, but you can render it to prefetch a page for any other reason. ```tsx import { PrefetchPageLinks } from "react-router" ``` For example, you may render one of this as the user types into a search field to prefetch search results before they click through to their selection. @category Components */ declare function PrefetchPageLinks({ page, ...dataLinkProps }: PageLinkDescriptor): React.JSX.Element | null; /** Renders all the `` tags created by route module {@link MetaFunction} exports. You should render it inside the `` of your HTML. ```tsx import { Meta } from "react-router"; export default function Root() { return ( ); } ``` @category Components */ declare function Meta(): React.JSX.Element; /** A couple common attributes: - `` for hosting your static assets on a different server than your app. - `` to support a [content security policy for scripts](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src) with [nonce-sources](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources) for your `