Adding login and registration base pages
This commit is contained in:
+11556
File diff suppressed because it is too large
Load Diff
+23
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterProviderProps$1 } from './lib-CCSAGgcP.mjs';
|
||||
import { R as RouterInit } from './route-data-C6QaL0wu.mjs';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
|
||||
interface HydratedRouterProps {
|
||||
/**
|
||||
* Context object to passed through to `createBrowserRouter` and made available
|
||||
* to `clientLoader`/`clientActon` functions
|
||||
*/
|
||||
unstable_getContext?: RouterInit["unstable_getContext"];
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used in `entry.client.tsx` to hydrate a
|
||||
* router from a `ServerRouter`
|
||||
*
|
||||
* @category Component Routers
|
||||
*/
|
||||
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { HydratedRouter, RouterProvider, type RouterProviderProps };
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
|
||||
interface HydratedRouterProps {
|
||||
/**
|
||||
* Context object to passed through to `createBrowserRouter` and made available
|
||||
* to `clientLoader`/`clientActon` functions
|
||||
*/
|
||||
unstable_getContext?: RouterInit["unstable_getContext"];
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used in `entry.client.tsx` to hydrate a
|
||||
* router from a `ServerRouter`
|
||||
*
|
||||
* @category Component Routers
|
||||
*/
|
||||
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { HydratedRouter, RouterProvider, type RouterProviderProps };
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* react-router v7.6.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
|
||||
*/
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// dom-export.ts
|
||||
var dom_export_exports = {};
|
||||
__export(dom_export_exports, {
|
||||
HydratedRouter: () => HydratedRouter,
|
||||
RouterProvider: () => RouterProvider
|
||||
});
|
||||
module.exports = __toCommonJS(dom_export_exports);
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
var React = __toESM(require("react"));
|
||||
var ReactDOM = __toESM(require("react-dom"));
|
||||
var import_react_router = require("react-router");
|
||||
function RouterProvider(props) {
|
||||
return /* @__PURE__ */ React.createElement(import_react_router.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
|
||||
}
|
||||
|
||||
// lib/dom-export/hydrated-router.tsx
|
||||
var React2 = __toESM(require("react"));
|
||||
var import_react_router2 = require("react-router");
|
||||
var ssrInfo = null;
|
||||
var router = null;
|
||||
function initSsrInfo() {
|
||||
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
|
||||
if (window.__reactRouterManifest.sri === true) {
|
||||
const importMap = document.querySelector("script[rr-importmap]");
|
||||
if (importMap?.textContent) {
|
||||
try {
|
||||
window.__reactRouterManifest.sri = JSON.parse(
|
||||
importMap.textContent
|
||||
).integrity;
|
||||
} catch (err) {
|
||||
console.error("Failed to parse import map", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
ssrInfo = {
|
||||
context: window.__reactRouterContext,
|
||||
manifest: window.__reactRouterManifest,
|
||||
routeModules: window.__reactRouterRouteModules,
|
||||
stateDecodingPromise: void 0,
|
||||
router: void 0,
|
||||
routerInitialized: false
|
||||
};
|
||||
}
|
||||
}
|
||||
function createHydratedRouter({
|
||||
unstable_getContext
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
throw new Error(
|
||||
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
|
||||
);
|
||||
}
|
||||
let localSsrInfo = ssrInfo;
|
||||
if (!ssrInfo.stateDecodingPromise) {
|
||||
let stream = ssrInfo.context.stream;
|
||||
(0, import_react_router2.UNSAFE_invariant)(stream, "No stream found for single fetch decoding");
|
||||
ssrInfo.context.stream = void 0;
|
||||
ssrInfo.stateDecodingPromise = (0, import_react_router2.UNSAFE_decodeViaTurboStream)(stream, window).then((value) => {
|
||||
ssrInfo.context.state = value.value;
|
||||
localSsrInfo.stateDecodingPromise.value = true;
|
||||
}).catch((e) => {
|
||||
localSsrInfo.stateDecodingPromise.error = e;
|
||||
});
|
||||
}
|
||||
if (ssrInfo.stateDecodingPromise.error) {
|
||||
throw ssrInfo.stateDecodingPromise.error;
|
||||
}
|
||||
if (!ssrInfo.stateDecodingPromise.value) {
|
||||
throw ssrInfo.stateDecodingPromise;
|
||||
}
|
||||
let routes = (0, import_react_router2.UNSAFE_createClientRoutes)(
|
||||
ssrInfo.manifest.routes,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.state,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
let hydrationData = void 0;
|
||||
if (ssrInfo.context.isSpaMode) {
|
||||
let { loaderData } = ssrInfo.context.state;
|
||||
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
|
||||
hydrationData = {
|
||||
loaderData: {
|
||||
root: loaderData.root
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
hydrationData = (0, import_react_router2.UNSAFE_getHydrationData)(
|
||||
ssrInfo.context.state,
|
||||
routes,
|
||||
(routeId) => ({
|
||||
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
|
||||
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
|
||||
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
|
||||
}),
|
||||
window.location,
|
||||
window.__reactRouterContext?.basename,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
if (hydrationData && hydrationData.errors) {
|
||||
hydrationData.errors = (0, import_react_router2.UNSAFE_deserializeErrors)(hydrationData.errors);
|
||||
}
|
||||
}
|
||||
let router2 = (0, import_react_router2.UNSAFE_createRouter)({
|
||||
routes,
|
||||
history: (0, import_react_router2.UNSAFE_createBrowserHistory)(),
|
||||
basename: ssrInfo.context.basename,
|
||||
unstable_getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties: import_react_router2.UNSAFE_hydrationRouteProperties,
|
||||
mapRouteProperties: import_react_router2.UNSAFE_mapRouteProperties,
|
||||
future: {
|
||||
unstable_middleware: ssrInfo.context.future.unstable_middleware
|
||||
},
|
||||
dataStrategy: (0, import_react_router2.UNSAFE_getTurboStreamSingleFetchDataStrategy)(
|
||||
() => router2,
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename
|
||||
),
|
||||
patchRoutesOnNavigation: (0, import_react_router2.UNSAFE_getPatchRoutesOnNavigationFunction)(
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.routeDiscovery,
|
||||
ssrInfo.context.isSpaMode,
|
||||
ssrInfo.context.basename
|
||||
)
|
||||
});
|
||||
ssrInfo.router = router2;
|
||||
if (router2.state.initialized) {
|
||||
ssrInfo.routerInitialized = true;
|
||||
router2.initialize();
|
||||
}
|
||||
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
|
||||
import_react_router2.UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
|
||||
window.__reactRouterDataRouter = router2;
|
||||
return router2;
|
||||
}
|
||||
function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
unstable_getContext: props.unstable_getContext
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
|
||||
);
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (ssrInfo) {
|
||||
window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
|
||||
}
|
||||
}
|
||||
let [location, setLocation] = React2.useState(router.state.location);
|
||||
React2.useLayoutEffect(() => {
|
||||
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
|
||||
ssrInfo.routerInitialized = true;
|
||||
ssrInfo.router.initialize();
|
||||
}
|
||||
}, []);
|
||||
React2.useLayoutEffect(() => {
|
||||
if (ssrInfo && ssrInfo.router) {
|
||||
return ssrInfo.router.subscribe((newState) => {
|
||||
if (newState.location !== location) {
|
||||
setLocation(newState.location);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [location]);
|
||||
(0, import_react_router2.UNSAFE_invariant)(ssrInfo, "ssrInfo unavailable for HydratedRouter");
|
||||
(0, import_react_router2.UNSAFE_useFogOFWarDiscovery)(
|
||||
router,
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.routeDiscovery,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
return (
|
||||
// This fragment is important to ensure we match the <ServerRouter> JSX
|
||||
// structure so that useId values hydrate correctly
|
||||
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
||||
import_react_router2.UNSAFE_FrameworkContext.Provider,
|
||||
{
|
||||
value: {
|
||||
manifest: ssrInfo.manifest,
|
||||
routeModules: ssrInfo.routeModules,
|
||||
future: ssrInfo.context.future,
|
||||
criticalCss,
|
||||
ssr: ssrInfo.context.ssr,
|
||||
isSpaMode: ssrInfo.context.isSpaMode,
|
||||
routeDiscovery: ssrInfo.context.routeDiscovery
|
||||
}
|
||||
},
|
||||
/* @__PURE__ */ React2.createElement(import_react_router2.UNSAFE_RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
|
||||
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
|
||||
);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
HydratedRouter,
|
||||
RouterProvider
|
||||
});
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* react-router v7.6.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
|
||||
*/
|
||||
import {
|
||||
FrameworkContext,
|
||||
RemixErrorBoundary,
|
||||
RouterProvider,
|
||||
createBrowserHistory,
|
||||
createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut,
|
||||
createRouter,
|
||||
decodeViaTurboStream,
|
||||
deserializeErrors,
|
||||
getHydrationData,
|
||||
getPatchRoutesOnNavigationFunction,
|
||||
getTurboStreamSingleFetchDataStrategy,
|
||||
hydrationRouteProperties,
|
||||
invariant,
|
||||
mapRouteProperties,
|
||||
useFogOFWarDiscovery
|
||||
} from "./chunk-D4RADZKF.mjs";
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
function RouterProvider2(props) {
|
||||
return /* @__PURE__ */ React.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
|
||||
}
|
||||
|
||||
// lib/dom-export/hydrated-router.tsx
|
||||
import * as React2 from "react";
|
||||
var ssrInfo = null;
|
||||
var router = null;
|
||||
function initSsrInfo() {
|
||||
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
|
||||
if (window.__reactRouterManifest.sri === true) {
|
||||
const importMap = document.querySelector("script[rr-importmap]");
|
||||
if (importMap?.textContent) {
|
||||
try {
|
||||
window.__reactRouterManifest.sri = JSON.parse(
|
||||
importMap.textContent
|
||||
).integrity;
|
||||
} catch (err) {
|
||||
console.error("Failed to parse import map", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
ssrInfo = {
|
||||
context: window.__reactRouterContext,
|
||||
manifest: window.__reactRouterManifest,
|
||||
routeModules: window.__reactRouterRouteModules,
|
||||
stateDecodingPromise: void 0,
|
||||
router: void 0,
|
||||
routerInitialized: false
|
||||
};
|
||||
}
|
||||
}
|
||||
function createHydratedRouter({
|
||||
unstable_getContext
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
throw new Error(
|
||||
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
|
||||
);
|
||||
}
|
||||
let localSsrInfo = ssrInfo;
|
||||
if (!ssrInfo.stateDecodingPromise) {
|
||||
let stream = ssrInfo.context.stream;
|
||||
invariant(stream, "No stream found for single fetch decoding");
|
||||
ssrInfo.context.stream = void 0;
|
||||
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
|
||||
ssrInfo.context.state = value.value;
|
||||
localSsrInfo.stateDecodingPromise.value = true;
|
||||
}).catch((e) => {
|
||||
localSsrInfo.stateDecodingPromise.error = e;
|
||||
});
|
||||
}
|
||||
if (ssrInfo.stateDecodingPromise.error) {
|
||||
throw ssrInfo.stateDecodingPromise.error;
|
||||
}
|
||||
if (!ssrInfo.stateDecodingPromise.value) {
|
||||
throw ssrInfo.stateDecodingPromise;
|
||||
}
|
||||
let routes = createClientRoutes(
|
||||
ssrInfo.manifest.routes,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.state,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
let hydrationData = void 0;
|
||||
if (ssrInfo.context.isSpaMode) {
|
||||
let { loaderData } = ssrInfo.context.state;
|
||||
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
|
||||
hydrationData = {
|
||||
loaderData: {
|
||||
root: loaderData.root
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
hydrationData = getHydrationData(
|
||||
ssrInfo.context.state,
|
||||
routes,
|
||||
(routeId) => ({
|
||||
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
|
||||
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
|
||||
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
|
||||
}),
|
||||
window.location,
|
||||
window.__reactRouterContext?.basename,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
if (hydrationData && hydrationData.errors) {
|
||||
hydrationData.errors = deserializeErrors(hydrationData.errors);
|
||||
}
|
||||
}
|
||||
let router2 = createRouter({
|
||||
routes,
|
||||
history: createBrowserHistory(),
|
||||
basename: ssrInfo.context.basename,
|
||||
unstable_getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties,
|
||||
mapRouteProperties,
|
||||
future: {
|
||||
unstable_middleware: ssrInfo.context.future.unstable_middleware
|
||||
},
|
||||
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
||||
() => router2,
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename
|
||||
),
|
||||
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.routeDiscovery,
|
||||
ssrInfo.context.isSpaMode,
|
||||
ssrInfo.context.basename
|
||||
)
|
||||
});
|
||||
ssrInfo.router = router2;
|
||||
if (router2.state.initialized) {
|
||||
ssrInfo.routerInitialized = true;
|
||||
router2.initialize();
|
||||
}
|
||||
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
|
||||
createClientRoutesWithHMRRevalidationOptOut;
|
||||
window.__reactRouterDataRouter = router2;
|
||||
return router2;
|
||||
}
|
||||
function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
unstable_getContext: props.unstable_getContext
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
|
||||
);
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (ssrInfo) {
|
||||
window.__reactRouterClearCriticalCss = () => setCriticalCss(void 0);
|
||||
}
|
||||
}
|
||||
let [location, setLocation] = React2.useState(router.state.location);
|
||||
React2.useLayoutEffect(() => {
|
||||
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
|
||||
ssrInfo.routerInitialized = true;
|
||||
ssrInfo.router.initialize();
|
||||
}
|
||||
}, []);
|
||||
React2.useLayoutEffect(() => {
|
||||
if (ssrInfo && ssrInfo.router) {
|
||||
return ssrInfo.router.subscribe((newState) => {
|
||||
if (newState.location !== location) {
|
||||
setLocation(newState.location);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [location]);
|
||||
invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
|
||||
useFogOFWarDiscovery(
|
||||
router,
|
||||
ssrInfo.manifest,
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.routeDiscovery,
|
||||
ssrInfo.context.isSpaMode
|
||||
);
|
||||
return (
|
||||
// This fragment is important to ensure we match the <ServerRouter> JSX
|
||||
// structure so that useId values hydrate correctly
|
||||
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
||||
FrameworkContext.Provider,
|
||||
{
|
||||
value: {
|
||||
manifest: ssrInfo.manifest,
|
||||
routeModules: ssrInfo.routeModules,
|
||||
future: ssrInfo.context.future,
|
||||
criticalCss,
|
||||
ssr: ssrInfo.context.ssr,
|
||||
isSpaMode: ssrInfo.context.isSpaMode,
|
||||
routeDiscovery: ssrInfo.context.routeDiscovery
|
||||
}
|
||||
},
|
||||
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider2, { router }))
|
||||
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
|
||||
);
|
||||
}
|
||||
export {
|
||||
HydratedRouter,
|
||||
RouterProvider2 as RouterProvider
|
||||
};
|
||||
+814
@@ -0,0 +1,814 @@
|
||||
import { a as Router, b as RouteModules, D as DataStrategyFunction, T as To, c as RelativeRoutingType, L as Location, A as Action, P as ParamParseKey, d as Path, e as PathPattern, f as PathMatch, N as NavigateOptions, g as Params$1, h as RouteObject, i as Navigation, U as UIMatch, S as SerializeFrom, B as BlockerFunction, j as Blocker, k as StaticHandlerContext, l as StaticHandler, F as FutureConfig, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, u as unstable_InitialContext, m as IndexRouteObject, n as NonIndexRouteObject, o as LoaderFunction, p as ActionFunction, M as MetaFunction, q as LinksFunction, r as MiddlewareEnabled, s as AppLoadContext, E as Equal, t as RouterState, v as PatchRoutesOnNavigationFunction, w as DataRouteObject, x as ClientLoaderFunction } from './route-data-C6QaL0wu.mjs';
|
||||
export { W as ActionFunctionArgs, av as ClientActionFunction, aw as ClientActionFunctionArgs, ax as ClientLoaderFunctionArgs, ar as DataRouteMatch, X as DataStrategyFunctionArgs, Y as DataStrategyMatch, Z as DataStrategyResult, $ as ErrorResponse, z as Fetcher, a0 as FormEncType, a1 as FormMethod, aF as Future, G as GetScrollPositionFunction, y as GetScrollRestorationKeyFunction, a2 as HTMLFormMethod, ay as HeadersArgs, az as HeadersFunction, aD as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a3 as LazyRouteFunction, aE as LinkDescriptor, a4 as LoaderFunctionArgs, aA as MetaArgs, aB as MetaDescriptor, J as NavigationStates, as as Navigator, aC as PageLinkDescriptor, at as PatchRoutesOnNavigationFunctionArgs, a6 as PathParam, a7 as RedirectFunction, V as RevalidationState, au as RouteMatch, Q as RouterFetchOptions, R as RouterInit, O as RouterNavigateOptions, K as RouterSubscriber, a9 as ShouldRevalidateFunction, aa as ShouldRevalidateFunctionArgs, aL as UNSAFE_DataRouterContext, aM as UNSAFE_DataRouterStateContext, _ as UNSAFE_DataWithResponseInit, aK as UNSAFE_ErrorResponseImpl, aN as UNSAFE_FetchersContext, aO as UNSAFE_LocationContext, aP as UNSAFE_NavigationContext, aQ as UNSAFE_RouteContext, aR as UNSAFE_ViewTransitionContext, aH as UNSAFE_createBrowserHistory, aJ as UNSAFE_createRouter, aI as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a5 as unstable_MiddlewareFunction, a8 as unstable_RouterContext, ac as unstable_RouterContextProvider, aG as unstable_SerializesTo, ab as unstable_createContext } from './route-data-C6QaL0wu.mjs';
|
||||
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, S as ServerBuild } from './lib-CCSAGgcP.mjs';
|
||||
export { f as Await, a as AwaitProps, Q as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, v as FetcherFormProps, C as FetcherSubmitFunction, a6 as FetcherSubmitOptions, G as FetcherWithComponents, X as Form, w as FormProps, ah as HandleDataRequestFunction, ai as HandleDocumentRequestFunction, aj as HandleErrorFunction, T as HashRouter, H as HashRouterProps, q as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, U as Link, s as LinkProps, ad as Links, g as MemoryRouter, M as MemoryRouterOpts, b as MemoryRouterProps, ac as Meta, W as NavLink, t as NavLinkProps, u as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a7 as ParamKeyValuePair, P as PathRouteProps, af as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ae as Scripts, ag as ScriptsProps, Y as ScrollRestoration, x as ScrollRestorationProps, ak as ServerEntryModule, y as SetURLSearchParams, z as SubmitFunction, a8 as SubmitOptions, aa as SubmitTarget, an as UNSAFE_FrameworkContext, ao as UNSAFE_createClientRoutes, ap as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_hydrationRouteProperties, am as UNSAFE_mapRouteProperties, aq as UNSAFE_shouldHydrateRouteLoader, ar as UNSAFE_useScrollRestoration, a9 as URLSearchParamsInit, J as createBrowserRouter, K as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, p as createRoutesFromElements, ab as createSearchParams, r as renderMatches, V as unstable_HistoryRouter, a4 as unstable_usePrompt, a3 as useBeforeUnload, a1 as useFetcher, a2 as useFetchers, a0 as useFormAction, Z as useLinkClickHandler, _ as useSearchParams, $ as useSubmit, a5 as useViewTransitionState } from './lib-CCSAGgcP.mjs';
|
||||
import * as React from 'react';
|
||||
import { ReactElement } from 'react';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction;
|
||||
declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
|
||||
done: Promise<undefined>;
|
||||
value: unknown;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* The mode to use when running the server.
|
||||
*/
|
||||
declare enum ServerMode {
|
||||
Development = "development",
|
||||
Production = "production",
|
||||
Test = "test"
|
||||
}
|
||||
|
||||
/**
|
||||
Resolves a URL against the current location.
|
||||
|
||||
```tsx
|
||||
import { useHref } from "react-router"
|
||||
|
||||
function SomeComponent() {
|
||||
let href = useHref("some/where");
|
||||
// "/resolved/some/where"
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useHref(to: To, { relative }?: {
|
||||
relative?: RelativeRoutingType;
|
||||
}): string;
|
||||
/**
|
||||
* Returns true if this component is a descendant of a Router, useful to ensure
|
||||
* a component is used within a Router.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useInRouterContext(): boolean;
|
||||
/**
|
||||
Returns the current {@link Location}. This can be useful if you'd like to perform some side effect whenever it changes.
|
||||
|
||||
```tsx
|
||||
import * as React from 'react'
|
||||
import { useLocation } from 'react-router'
|
||||
|
||||
function SomeComponent() {
|
||||
let location = useLocation()
|
||||
|
||||
React.useEffect(() => {
|
||||
// Google Analytics
|
||||
ga('send', 'pageview')
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
// ...
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useLocation(): Location;
|
||||
/**
|
||||
* Returns the current navigation action which describes how the router came to
|
||||
* the current location, either by a pop, push, or replace on the history stack.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useNavigationType(): Action;
|
||||
/**
|
||||
* Returns a PathMatch object if the given pattern matches the current URL.
|
||||
* This is useful for components that need to know "active" state, e.g.
|
||||
* `<NavLink>`.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
/**
|
||||
* The interface for the navigate() function returned from useNavigate().
|
||||
*/
|
||||
interface NavigateFunction {
|
||||
(to: To, options?: NavigateOptions): void | Promise<void>;
|
||||
(delta: number): void | Promise<void>;
|
||||
}
|
||||
/**
|
||||
Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
|
||||
|
||||
```tsx
|
||||
import { useNavigate } from "react-router";
|
||||
|
||||
function SomeComponent() {
|
||||
let navigate = useNavigate();
|
||||
return (
|
||||
<button
|
||||
onClick={() => {
|
||||
navigate(-1);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
It's often better to use {@link redirect} in {@link ActionFunction | actions} and {@link LoaderFunction | loaders} than this hook.
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useNavigate(): NavigateFunction;
|
||||
/**
|
||||
* Returns the parent route {@link OutletProps.context | `<Outlet context>`}.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useOutletContext<Context = unknown>(): Context;
|
||||
/**
|
||||
* Returns the element for the child route at this level of the route
|
||||
* hierarchy. Used internally by `<Outlet>` to render child routes.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useOutlet(context?: unknown): React.ReactElement | null;
|
||||
/**
|
||||
Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
|
||||
|
||||
```tsx
|
||||
import { useParams } from "react-router"
|
||||
|
||||
function SomeComponent() {
|
||||
let params = useParams()
|
||||
params.postId
|
||||
}
|
||||
```
|
||||
|
||||
Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
|
||||
ParamsOrKey
|
||||
] extends [string] ? Params$1<ParamsOrKey> : Partial<ParamsOrKey>>;
|
||||
/**
|
||||
Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
|
||||
|
||||
```tsx
|
||||
import { useResolvedPath } from "react-router"
|
||||
|
||||
function SomeComponent() {
|
||||
// if the user is at /dashboard/profile
|
||||
let path = useResolvedPath("../accounts")
|
||||
path.pathname // "/dashboard/accounts"
|
||||
path.search // ""
|
||||
path.hash // ""
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useResolvedPath(to: To, { relative }?: {
|
||||
relative?: RelativeRoutingType;
|
||||
}): Path;
|
||||
/**
|
||||
Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props.
|
||||
|
||||
The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
|
||||
|
||||
```tsx
|
||||
import * as React from "react";
|
||||
import { useRoutes } from "react-router";
|
||||
|
||||
function App() {
|
||||
let element = useRoutes([
|
||||
{
|
||||
path: "/",
|
||||
element: <Dashboard />,
|
||||
children: [
|
||||
{
|
||||
path: "messages",
|
||||
element: <DashboardMessages />,
|
||||
},
|
||||
{ path: "tasks", element: <DashboardTasks /> },
|
||||
],
|
||||
},
|
||||
{ path: "team", element: <AboutPage /> },
|
||||
]);
|
||||
|
||||
return element;
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
/**
|
||||
Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress. You can use this to render pending UI (like a global spinner) or read FormData from a form navigation.
|
||||
|
||||
```tsx
|
||||
import { useNavigation } from "react-router"
|
||||
|
||||
function SomeComponent() {
|
||||
let navigation = useNavigation();
|
||||
navigation.state
|
||||
navigation.formData
|
||||
// etc.
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
/**
|
||||
Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.
|
||||
|
||||
```tsx
|
||||
import { useRevalidator } from "react-router";
|
||||
|
||||
function WindowFocusRevalidator() {
|
||||
const revalidator = useRevalidator();
|
||||
|
||||
useFakeWindowFocus(() => {
|
||||
revalidator.revalidate();
|
||||
});
|
||||
|
||||
return (
|
||||
<div hidden={revalidator.state === "idle"}>
|
||||
Revalidating...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Note that page data is already revalidated automatically after actions. If you find yourself using this for normal CRUD operations on your data in response to user interactions, you're probably not taking advantage of the other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do this automatically.
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useRevalidator(): {
|
||||
revalidate: () => Promise<void>;
|
||||
state: Router["state"]["revalidation"];
|
||||
};
|
||||
/**
|
||||
* Returns the active route matches, useful for accessing loaderData for
|
||||
* parent/child routes or the route "handle" property
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useMatches(): UIMatch[];
|
||||
/**
|
||||
Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}.
|
||||
|
||||
```tsx
|
||||
import { useLoaderData } from "react-router"
|
||||
|
||||
export async function loader() {
|
||||
return await fakeDb.invoices.findAll();
|
||||
}
|
||||
|
||||
export default function Invoices() {
|
||||
let invoices = useLoaderData<typeof loader>();
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useLoaderData<T = any>(): SerializeFrom<T>;
|
||||
/**
|
||||
Returns the loader data for a given route by route ID.
|
||||
|
||||
```tsx
|
||||
import { useRouteLoaderData } from "react-router";
|
||||
|
||||
function SomeComponent() {
|
||||
const { user } = useRouteLoaderData("root");
|
||||
}
|
||||
```
|
||||
|
||||
Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension.
|
||||
|
||||
| Route Filename | Route ID |
|
||||
| -------------------------- | -------------------- |
|
||||
| `app/root.tsx` | `"root"` |
|
||||
| `app/routes/teams.tsx` | `"routes/teams"` |
|
||||
| `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` |
|
||||
|
||||
If you created an ID manually, you can use that instead:
|
||||
|
||||
```tsx
|
||||
route("/", "containers/app.tsx", { id: "app" }})
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useRouteLoaderData<T = any>(routeId: string): SerializeFrom<T> | undefined;
|
||||
/**
|
||||
Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one.
|
||||
|
||||
```tsx
|
||||
import { Form, useActionData } from "react-router"
|
||||
|
||||
export async function action({ request }) {
|
||||
const body = await request.formData()
|
||||
const name = body.get("visitorsName")
|
||||
return { message: `Hello, ${name}` }
|
||||
}
|
||||
|
||||
export default function Invoices() {
|
||||
const data = useActionData()
|
||||
return (
|
||||
<Form method="post">
|
||||
<input type="text" name="visitorsName" />
|
||||
{data ? data.message : "Waiting..."}
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useActionData<T = any>(): SerializeFrom<T> | undefined;
|
||||
/**
|
||||
Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary.
|
||||
|
||||
```tsx
|
||||
export function ErrorBoundary() {
|
||||
const error = useRouteError();
|
||||
return <div>{error.message}</div>;
|
||||
}
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useRouteError(): unknown;
|
||||
/**
|
||||
Returns the resolved promise value from the closest {@link Await | `<Await>`}.
|
||||
|
||||
```tsx
|
||||
function SomeDescendant() {
|
||||
const value = useAsyncValue();
|
||||
// ...
|
||||
}
|
||||
|
||||
// somewhere in your app
|
||||
<Await resolve={somePromise}>
|
||||
<SomeDescendant />
|
||||
</Await>
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useAsyncValue(): unknown;
|
||||
/**
|
||||
Returns the rejection value from the closest {@link Await | `<Await>`}.
|
||||
|
||||
```tsx
|
||||
import { Await, useAsyncError } from "react-router"
|
||||
|
||||
function ErrorElement() {
|
||||
const error = useAsyncError();
|
||||
return (
|
||||
<p>Uh Oh, something went wrong! {error.message}</p>
|
||||
);
|
||||
}
|
||||
|
||||
// somewhere in your app
|
||||
<Await
|
||||
resolve={promiseThatRejects}
|
||||
errorElement={<ErrorElement />}
|
||||
/>
|
||||
```
|
||||
|
||||
@category Hooks
|
||||
*/
|
||||
declare function useAsyncError(): unknown;
|
||||
/**
|
||||
* Allow the application to block navigations within the SPA and present the
|
||||
* user a confirmation dialog to confirm the navigation. Mostly used to avoid
|
||||
* using half-filled form data. This does not handle hard-reloads or
|
||||
* cross-origin navigations.
|
||||
*
|
||||
* @category Hooks
|
||||
*/
|
||||
declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
|
||||
|
||||
interface StaticRouterProps {
|
||||
basename?: string;
|
||||
children?: React.ReactNode;
|
||||
location: Partial<Location> | string;
|
||||
}
|
||||
/**
|
||||
* A `<Router>` that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*
|
||||
* @category Component Routers
|
||||
*/
|
||||
declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
|
||||
interface StaticRouterProviderProps {
|
||||
context: StaticHandlerContext;
|
||||
router: Router;
|
||||
hydrate?: boolean;
|
||||
nonce?: string;
|
||||
}
|
||||
/**
|
||||
* A Data Router that may not navigate to any other location. This is useful
|
||||
* on the server where there is no stateful UI.
|
||||
*
|
||||
* @category Component Routers
|
||||
*/
|
||||
declare function StaticRouterProvider({ context, router, hydrate, nonce, }: StaticRouterProviderProps): React.JSX.Element;
|
||||
type CreateStaticHandlerOptions = Omit<CreateStaticHandlerOptions$1, "mapRouteProperties">;
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
/**
|
||||
* @category Data Routers
|
||||
*/
|
||||
declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
|
||||
future?: Partial<FutureConfig>;
|
||||
}): Router;
|
||||
|
||||
interface ServerRouterProps {
|
||||
context: EntryContext;
|
||||
url: string | URL;
|
||||
nonce?: string;
|
||||
}
|
||||
/**
|
||||
* The entry point for a Remix app when it is rendered on the server (in
|
||||
* `app/entry.server.js`). This component is used to generate the HTML in the
|
||||
* response from the server.
|
||||
*
|
||||
* @category Components
|
||||
*/
|
||||
declare function ServerRouter({ context, url, nonce, }: ServerRouterProps): ReactElement;
|
||||
|
||||
interface StubRouteExtensions {
|
||||
Component?: React.ComponentType<{
|
||||
params: ReturnType<typeof useParams>;
|
||||
loaderData: ReturnType<typeof useLoaderData>;
|
||||
actionData: ReturnType<typeof useActionData>;
|
||||
matches: ReturnType<typeof useMatches>;
|
||||
}>;
|
||||
HydrateFallback?: React.ComponentType<{
|
||||
params: ReturnType<typeof useParams>;
|
||||
loaderData: ReturnType<typeof useLoaderData>;
|
||||
actionData: ReturnType<typeof useActionData>;
|
||||
}>;
|
||||
ErrorBoundary?: React.ComponentType<{
|
||||
params: ReturnType<typeof useParams>;
|
||||
loaderData: ReturnType<typeof useLoaderData>;
|
||||
actionData: ReturnType<typeof useActionData>;
|
||||
error: ReturnType<typeof useRouteError>;
|
||||
}>;
|
||||
loader?: LoaderFunction;
|
||||
action?: ActionFunction;
|
||||
children?: StubRouteObject[];
|
||||
meta?: MetaFunction;
|
||||
links?: LinksFunction;
|
||||
}
|
||||
interface StubIndexRouteObject extends Omit<IndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
||||
}
|
||||
interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
|
||||
}
|
||||
type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
|
||||
interface RoutesTestStubProps {
|
||||
/**
|
||||
* The initial entries in the history stack. This allows you to start a test with
|
||||
* multiple locations already in the history stack (for testing a back navigation, etc.)
|
||||
* The test will default to the last entry in initialEntries if no initialIndex is provided.
|
||||
* e.g. initialEntries={["/home", "/about", "/contact"]}
|
||||
*/
|
||||
initialEntries?: InitialEntry[];
|
||||
/**
|
||||
* The initial index in the history stack to render. This allows you to start a test at a specific entry.
|
||||
* It defaults to the last entry in initialEntries.
|
||||
* e.g.
|
||||
* initialEntries: ["/", "/events/123"]
|
||||
* initialIndex: 1 // start at "/events/123"
|
||||
*/
|
||||
initialIndex?: number;
|
||||
/**
|
||||
* Used to set the route's initial loader and action data.
|
||||
* e.g. hydrationData={{
|
||||
* loaderData: { "/contact": { locale: "en-US" } },
|
||||
* actionData: { "/login": { errors: { email: "invalid email" } }}
|
||||
* }}
|
||||
*/
|
||||
hydrationData?: HydrationState;
|
||||
/**
|
||||
* Future flags mimicking the settings in react-router.config.ts
|
||||
*/
|
||||
future?: Partial<FutureConfig$1>;
|
||||
}
|
||||
/**
|
||||
* @category Utils
|
||||
*/
|
||||
declare function createRoutesStub(routes: StubRouteObject[], unstable_getContext?: () => unstable_InitialContext): ({ initialEntries, initialIndex, hydrationData, future, }: RoutesTestStubProps) => React.JSX.Element;
|
||||
|
||||
interface CookieSignatureOptions {
|
||||
/**
|
||||
* An array of secrets that may be used to sign/unsign the value of a cookie.
|
||||
*
|
||||
* The array makes it easy to rotate secrets. New secrets should be added to
|
||||
* the beginning of the array. `cookie.serialize()` will always use the first
|
||||
* value in the array, but `cookie.parse()` may use any of them so that
|
||||
* cookies that were signed with older secrets still work.
|
||||
*/
|
||||
secrets?: string[];
|
||||
}
|
||||
type CookieOptions = ParseOptions & SerializeOptions & CookieSignatureOptions;
|
||||
/**
|
||||
* A HTTP cookie.
|
||||
*
|
||||
* A Cookie is a logical container for metadata about a HTTP cookie; its name
|
||||
* and options. But it doesn't contain a value. Instead, it has `parse()` and
|
||||
* `serialize()` methods that allow a single instance to be reused for
|
||||
* parsing/encoding multiple different values.
|
||||
*
|
||||
* @see https://remix.run/utils/cookies#cookie-api
|
||||
*/
|
||||
interface Cookie {
|
||||
/**
|
||||
* The name of the cookie, used in the `Cookie` and `Set-Cookie` headers.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* True if this cookie uses one or more secrets for verification.
|
||||
*/
|
||||
readonly isSigned: boolean;
|
||||
/**
|
||||
* The Date this cookie expires.
|
||||
*
|
||||
* Note: This is calculated at access time using `maxAge` when no `expires`
|
||||
* option is provided to `createCookie()`.
|
||||
*/
|
||||
readonly expires?: Date;
|
||||
/**
|
||||
* Parses a raw `Cookie` header and returns the value of this cookie or
|
||||
* `null` if it's not present.
|
||||
*/
|
||||
parse(cookieHeader: string | null, options?: ParseOptions): Promise<any>;
|
||||
/**
|
||||
* Serializes the given value to a string and returns the `Set-Cookie`
|
||||
* header.
|
||||
*/
|
||||
serialize(value: any, options?: SerializeOptions): Promise<string>;
|
||||
}
|
||||
/**
|
||||
* Creates a logical container for managing a browser cookie from the server.
|
||||
*/
|
||||
declare const createCookie: (name: string, cookieOptions?: CookieOptions) => Cookie;
|
||||
type IsCookieFunction = (object: any) => object is Cookie;
|
||||
/**
|
||||
* Returns true if an object is a Remix cookie container.
|
||||
*
|
||||
* @see https://remix.run/utils/cookies#iscookie
|
||||
*/
|
||||
declare const isCookie: IsCookieFunction;
|
||||
|
||||
type RequestHandler = (request: Request, loadContext?: MiddlewareEnabled extends true ? unstable_InitialContext : AppLoadContext) => Promise<Response>;
|
||||
type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
|
||||
declare const createRequestHandler: CreateRequestHandlerFunction;
|
||||
|
||||
/**
|
||||
* An object of name/value pairs to be used in the session.
|
||||
*/
|
||||
interface SessionData {
|
||||
[name: string]: any;
|
||||
}
|
||||
/**
|
||||
* Session persists data across HTTP requests.
|
||||
*
|
||||
* @see https://reactrouter.com/explanation/sessions-and-cookies#sessions
|
||||
*/
|
||||
interface Session<Data = SessionData, FlashData = Data> {
|
||||
/**
|
||||
* A unique identifier for this session.
|
||||
*
|
||||
* Note: This will be the empty string for newly created sessions and
|
||||
* sessions that are not backed by a database (i.e. cookie-based sessions).
|
||||
*/
|
||||
readonly id: string;
|
||||
/**
|
||||
* The raw data contained in this session.
|
||||
*
|
||||
* This is useful mostly for SessionStorage internally to access the raw
|
||||
* session data to persist.
|
||||
*/
|
||||
readonly data: FlashSessionData<Data, FlashData>;
|
||||
/**
|
||||
* Returns `true` if the session has a value for the given `name`, `false`
|
||||
* otherwise.
|
||||
*/
|
||||
has(name: (keyof Data | keyof FlashData) & string): boolean;
|
||||
/**
|
||||
* Returns the value for the given `name` in this session.
|
||||
*/
|
||||
get<Key extends (keyof Data | keyof FlashData) & string>(name: Key): (Key extends keyof Data ? Data[Key] : undefined) | (Key extends keyof FlashData ? FlashData[Key] : undefined) | undefined;
|
||||
/**
|
||||
* Sets a value in the session for the given `name`.
|
||||
*/
|
||||
set<Key extends keyof Data & string>(name: Key, value: Data[Key]): void;
|
||||
/**
|
||||
* Sets a value in the session that is only valid until the next `get()`.
|
||||
* This can be useful for temporary values, like error messages.
|
||||
*/
|
||||
flash<Key extends keyof FlashData & string>(name: Key, value: FlashData[Key]): void;
|
||||
/**
|
||||
* Removes a value from the session.
|
||||
*/
|
||||
unset(name: keyof Data & string): void;
|
||||
}
|
||||
type FlashSessionData<Data, FlashData> = Partial<Data & {
|
||||
[Key in keyof FlashData as FlashDataKey<Key & string>]: FlashData[Key];
|
||||
}>;
|
||||
type FlashDataKey<Key extends string> = `__flash_${Key}__`;
|
||||
type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?: Data, id?: string) => Session<Data, FlashData>;
|
||||
/**
|
||||
* Creates a new Session object.
|
||||
*
|
||||
* Note: This function is typically not invoked directly by application code.
|
||||
* Instead, use a `SessionStorage` object's `getSession` method.
|
||||
*/
|
||||
declare const createSession: CreateSessionFunction;
|
||||
type IsSessionFunction = (object: any) => object is Session;
|
||||
/**
|
||||
* Returns true if an object is a React Router session.
|
||||
*
|
||||
* @see https://reactrouter.com/api/utils/isSession
|
||||
*/
|
||||
declare const isSession: IsSessionFunction;
|
||||
/**
|
||||
* SessionStorage stores session data between HTTP requests and knows how to
|
||||
* parse and create cookies.
|
||||
*
|
||||
* A SessionStorage creates Session objects using a `Cookie` header as input.
|
||||
* Then, later it generates the `Set-Cookie` header to be used in the response.
|
||||
*/
|
||||
interface SessionStorage<Data = SessionData, FlashData = Data> {
|
||||
/**
|
||||
* Parses a Cookie header from a HTTP request and returns the associated
|
||||
* Session. If there is no session associated with the cookie, this will
|
||||
* return a new Session with no data.
|
||||
*/
|
||||
getSession: (cookieHeader?: string | null, options?: ParseOptions) => Promise<Session<Data, FlashData>>;
|
||||
/**
|
||||
* Stores all data in the Session and returns the Set-Cookie header to be
|
||||
* used in the HTTP response.
|
||||
*/
|
||||
commitSession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
|
||||
/**
|
||||
* Deletes all data associated with the Session and returns the Set-Cookie
|
||||
* header to be used in the HTTP response.
|
||||
*/
|
||||
destroySession: (session: Session<Data, FlashData>, options?: SerializeOptions) => Promise<string>;
|
||||
}
|
||||
/**
|
||||
* SessionIdStorageStrategy is designed to allow anyone to easily build their
|
||||
* own SessionStorage using `createSessionStorage(strategy)`.
|
||||
*
|
||||
* This strategy describes a common scenario where the session id is stored in
|
||||
* a cookie but the actual session data is stored elsewhere, usually in a
|
||||
* database or on disk. A set of create, read, update, and delete operations
|
||||
* are provided for managing the session data.
|
||||
*/
|
||||
interface SessionIdStorageStrategy<Data = SessionData, FlashData = Data> {
|
||||
/**
|
||||
* The Cookie used to store the session id, or options used to automatically
|
||||
* create one.
|
||||
*/
|
||||
cookie?: Cookie | (CookieOptions & {
|
||||
name?: string;
|
||||
});
|
||||
/**
|
||||
* Creates a new record with the given data and returns the session id.
|
||||
*/
|
||||
createData: (data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<string>;
|
||||
/**
|
||||
* Returns data for a given session id, or `null` if there isn't any.
|
||||
*/
|
||||
readData: (id: string) => Promise<FlashSessionData<Data, FlashData> | null>;
|
||||
/**
|
||||
* Updates data for the given session id.
|
||||
*/
|
||||
updateData: (id: string, data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<void>;
|
||||
/**
|
||||
* Deletes data for a given session id from the data store.
|
||||
*/
|
||||
deleteData: (id: string) => Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Creates a SessionStorage object using a SessionIdStorageStrategy.
|
||||
*
|
||||
* Note: This is a low-level API that should only be used if none of the
|
||||
* existing session storage options meet your requirements.
|
||||
*/
|
||||
declare function createSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg, createData, readData, updateData, deleteData, }: SessionIdStorageStrategy<Data, FlashData>): SessionStorage<Data, FlashData>;
|
||||
|
||||
interface CookieSessionStorageOptions {
|
||||
/**
|
||||
* The Cookie used to store the session data on the client, or options used
|
||||
* to automatically create one.
|
||||
*/
|
||||
cookie?: SessionIdStorageStrategy["cookie"];
|
||||
}
|
||||
/**
|
||||
* Creates and returns a SessionStorage object that stores all session data
|
||||
* directly in the session cookie itself.
|
||||
*
|
||||
* This has the advantage that no database or other backend services are
|
||||
* needed, and can help to simplify some load-balanced scenarios. However, it
|
||||
* also has the limitation that serialized session data may not exceed the
|
||||
* browser's maximum cookie size. Trade-offs!
|
||||
*/
|
||||
declare function createCookieSessionStorage<Data = SessionData, FlashData = Data>({ cookie: cookieArg }?: CookieSessionStorageOptions): SessionStorage<Data, FlashData>;
|
||||
|
||||
interface MemorySessionStorageOptions {
|
||||
/**
|
||||
* The Cookie used to store the session id on the client, or options used
|
||||
* to automatically create one.
|
||||
*/
|
||||
cookie?: SessionIdStorageStrategy["cookie"];
|
||||
}
|
||||
/**
|
||||
* Creates and returns a simple in-memory SessionStorage object, mostly useful
|
||||
* for testing and as a reference implementation.
|
||||
*
|
||||
* Note: This storage does not scale beyond a single process, so it is not
|
||||
* suitable for most production scenarios.
|
||||
*/
|
||||
declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({ cookie }?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
|
||||
|
||||
type DevServerHooks = {
|
||||
getCriticalCss?: (pathname: string) => Promise<string | undefined>;
|
||||
processRequestError?: (error: unknown) => void;
|
||||
};
|
||||
declare function setDevServerHooks(devServerHooks: DevServerHooks): void;
|
||||
|
||||
/**
|
||||
* 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, Record<string, string | undefined>>;
|
||||
type Params = Register extends {
|
||||
params: infer RegisteredParams extends AnyParams;
|
||||
} ? RegisteredParams : AnyParams;
|
||||
type Args = {
|
||||
[K in keyof Params]: ToArgs<Params[K]>;
|
||||
};
|
||||
type ToArgs<T> = Equal<T, {}> extends true ? [] : Partial<T> extends T ? [T] | [] : [
|
||||
T
|
||||
];
|
||||
/**
|
||||
Returns a resolved URL path for the specified route.
|
||||
|
||||
```tsx
|
||||
const h = href("/:lang?/about", { lang: "en" })
|
||||
// -> `/en/about`
|
||||
|
||||
<Link to={href("/products/:id", { id: "abc123" })} />
|
||||
```
|
||||
*/
|
||||
declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
|
||||
|
||||
declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];
|
||||
|
||||
type RemixErrorBoundaryProps = React.PropsWithChildren<{
|
||||
location: Location;
|
||||
isOutsideRemixApp?: boolean;
|
||||
error?: Error;
|
||||
}>;
|
||||
type RemixErrorBoundaryState = {
|
||||
error: null | Error;
|
||||
location: Location;
|
||||
};
|
||||
declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps, RemixErrorBoundaryState> {
|
||||
constructor(props: RemixErrorBoundaryProps);
|
||||
static getDerivedStateFromError(error: Error): {
|
||||
error: Error;
|
||||
};
|
||||
static getDerivedStateFromProps(props: RemixErrorBoundaryProps, state: RemixErrorBoundaryState): {
|
||||
error: Error | null;
|
||||
location: Location<any>;
|
||||
};
|
||||
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
||||
}
|
||||
|
||||
declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, routeDiscovery: ServerBuild["routeDiscovery"], isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
|
||||
declare function useFogOFWarDiscovery(router: Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, routeDiscovery: ServerBuild["routeDiscovery"], isSpaMode: boolean): void;
|
||||
|
||||
declare function getHydrationData(state: {
|
||||
loaderData?: Router["state"]["loaderData"];
|
||||
actionData?: Router["state"]["actionData"];
|
||||
errors?: Router["state"]["errors"];
|
||||
}, routes: DataRouteObject[], getRouteInfo: (routeId: string) => {
|
||||
clientLoader: ClientLoaderFunction | undefined;
|
||||
hasLoader: boolean;
|
||||
hasHydrateFallback: boolean;
|
||||
}, location: Path, basename: string | undefined, isSpaMode: boolean): HydrationState;
|
||||
|
||||
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, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params$1 as Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, type Register, RelativeRoutingType, type RequestHandler, RouteObject, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, 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, createStaticHandler, createStaticRouter, href, isCookie, isSession, unstable_InitialContext, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
+2544
File diff suppressed because it is too large
Load Diff
+11706
File diff suppressed because it is too large
Load Diff
+246
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* react-router v7.6.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
|
||||
*/
|
||||
import {
|
||||
Action,
|
||||
Await,
|
||||
BrowserRouter,
|
||||
DataRouterContext,
|
||||
DataRouterStateContext,
|
||||
ErrorResponseImpl,
|
||||
FetchersContext,
|
||||
Form,
|
||||
FrameworkContext,
|
||||
HashRouter,
|
||||
HistoryRouter,
|
||||
IDLE_BLOCKER,
|
||||
IDLE_FETCHER,
|
||||
IDLE_NAVIGATION,
|
||||
Link,
|
||||
Links,
|
||||
LocationContext,
|
||||
MemoryRouter,
|
||||
Meta,
|
||||
NavLink,
|
||||
Navigate,
|
||||
NavigationContext,
|
||||
Outlet,
|
||||
PrefetchPageLinks,
|
||||
RemixErrorBoundary,
|
||||
Route,
|
||||
RouteContext,
|
||||
Router,
|
||||
RouterProvider,
|
||||
Routes,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
ServerMode,
|
||||
ServerRouter,
|
||||
SingleFetchRedirectSymbol,
|
||||
StaticRouter,
|
||||
StaticRouterProvider,
|
||||
ViewTransitionContext,
|
||||
createBrowserHistory,
|
||||
createBrowserRouter,
|
||||
createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut,
|
||||
createCookie,
|
||||
createCookieSessionStorage,
|
||||
createHashRouter,
|
||||
createMemoryRouter,
|
||||
createMemorySessionStorage,
|
||||
createPath,
|
||||
createRequestHandler,
|
||||
createRouter,
|
||||
createRoutesFromChildren,
|
||||
createRoutesFromElements,
|
||||
createRoutesStub,
|
||||
createSearchParams,
|
||||
createSession,
|
||||
createSessionStorage,
|
||||
createStaticHandler,
|
||||
createStaticRouter,
|
||||
data,
|
||||
decodeViaTurboStream,
|
||||
deserializeErrors,
|
||||
generatePath,
|
||||
getHydrationData,
|
||||
getPatchRoutesOnNavigationFunction,
|
||||
getTurboStreamSingleFetchDataStrategy,
|
||||
href,
|
||||
hydrationRouteProperties,
|
||||
invariant,
|
||||
isCookie,
|
||||
isRouteErrorResponse,
|
||||
isSession,
|
||||
mapRouteProperties,
|
||||
matchPath,
|
||||
matchRoutes,
|
||||
parsePath,
|
||||
redirect,
|
||||
redirectDocument,
|
||||
renderMatches,
|
||||
replace,
|
||||
resolvePath,
|
||||
setDevServerHooks,
|
||||
shouldHydrateRouteLoader,
|
||||
unstable_RouterContextProvider,
|
||||
unstable_createContext,
|
||||
useActionData,
|
||||
useAsyncError,
|
||||
useAsyncValue,
|
||||
useBeforeUnload,
|
||||
useBlocker,
|
||||
useFetcher,
|
||||
useFetchers,
|
||||
useFogOFWarDiscovery,
|
||||
useFormAction,
|
||||
useHref,
|
||||
useInRouterContext,
|
||||
useLinkClickHandler,
|
||||
useLoaderData,
|
||||
useLocation,
|
||||
useMatch,
|
||||
useMatches,
|
||||
useNavigate,
|
||||
useNavigation,
|
||||
useNavigationType,
|
||||
useOutlet,
|
||||
useOutletContext,
|
||||
useParams,
|
||||
usePrompt,
|
||||
useResolvedPath,
|
||||
useRevalidator,
|
||||
useRouteError,
|
||||
useRouteLoaderData,
|
||||
useRoutes,
|
||||
useScrollRestoration,
|
||||
useSearchParams,
|
||||
useSubmit,
|
||||
useViewTransitionState
|
||||
} from "./chunk-D4RADZKF.mjs";
|
||||
export {
|
||||
Await,
|
||||
BrowserRouter,
|
||||
Form,
|
||||
HashRouter,
|
||||
IDLE_BLOCKER,
|
||||
IDLE_FETCHER,
|
||||
IDLE_NAVIGATION,
|
||||
Link,
|
||||
Links,
|
||||
MemoryRouter,
|
||||
Meta,
|
||||
NavLink,
|
||||
Navigate,
|
||||
Action as NavigationType,
|
||||
Outlet,
|
||||
PrefetchPageLinks,
|
||||
Route,
|
||||
Router,
|
||||
RouterProvider,
|
||||
Routes,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
ServerRouter,
|
||||
StaticRouter,
|
||||
StaticRouterProvider,
|
||||
DataRouterContext as UNSAFE_DataRouterContext,
|
||||
DataRouterStateContext as UNSAFE_DataRouterStateContext,
|
||||
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
|
||||
FetchersContext as UNSAFE_FetchersContext,
|
||||
FrameworkContext as UNSAFE_FrameworkContext,
|
||||
LocationContext as UNSAFE_LocationContext,
|
||||
NavigationContext as UNSAFE_NavigationContext,
|
||||
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
|
||||
RouteContext as UNSAFE_RouteContext,
|
||||
ServerMode as UNSAFE_ServerMode,
|
||||
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
|
||||
ViewTransitionContext as UNSAFE_ViewTransitionContext,
|
||||
createBrowserHistory as UNSAFE_createBrowserHistory,
|
||||
createClientRoutes as UNSAFE_createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
|
||||
createRouter as UNSAFE_createRouter,
|
||||
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
|
||||
deserializeErrors as UNSAFE_deserializeErrors,
|
||||
getHydrationData as UNSAFE_getHydrationData,
|
||||
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
|
||||
getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy,
|
||||
hydrationRouteProperties as UNSAFE_hydrationRouteProperties,
|
||||
invariant as UNSAFE_invariant,
|
||||
mapRouteProperties as UNSAFE_mapRouteProperties,
|
||||
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
|
||||
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
|
||||
useScrollRestoration as UNSAFE_useScrollRestoration,
|
||||
createBrowserRouter,
|
||||
createCookie,
|
||||
createCookieSessionStorage,
|
||||
createHashRouter,
|
||||
createMemoryRouter,
|
||||
createMemorySessionStorage,
|
||||
createPath,
|
||||
createRequestHandler,
|
||||
createRoutesFromChildren,
|
||||
createRoutesFromElements,
|
||||
createRoutesStub,
|
||||
createSearchParams,
|
||||
createSession,
|
||||
createSessionStorage,
|
||||
createStaticHandler,
|
||||
createStaticRouter,
|
||||
data,
|
||||
generatePath,
|
||||
href,
|
||||
isCookie,
|
||||
isRouteErrorResponse,
|
||||
isSession,
|
||||
matchPath,
|
||||
matchRoutes,
|
||||
parsePath,
|
||||
redirect,
|
||||
redirectDocument,
|
||||
renderMatches,
|
||||
replace,
|
||||
resolvePath,
|
||||
HistoryRouter as unstable_HistoryRouter,
|
||||
unstable_RouterContextProvider,
|
||||
unstable_createContext,
|
||||
setDevServerHooks as unstable_setDevServerHooks,
|
||||
usePrompt as unstable_usePrompt,
|
||||
useActionData,
|
||||
useAsyncError,
|
||||
useAsyncValue,
|
||||
useBeforeUnload,
|
||||
useBlocker,
|
||||
useFetcher,
|
||||
useFetchers,
|
||||
useFormAction,
|
||||
useHref,
|
||||
useInRouterContext,
|
||||
useLinkClickHandler,
|
||||
useLoaderData,
|
||||
useLocation,
|
||||
useMatch,
|
||||
useMatches,
|
||||
useNavigate,
|
||||
useNavigation,
|
||||
useNavigationType,
|
||||
useOutlet,
|
||||
useOutletContext,
|
||||
useParams,
|
||||
useResolvedPath,
|
||||
useRevalidator,
|
||||
useRouteError,
|
||||
useRouteLoaderData,
|
||||
useRoutes,
|
||||
useSearchParams,
|
||||
useSubmit,
|
||||
useViewTransitionState
|
||||
};
|
||||
+1736
File diff suppressed because it is too large
Load Diff
+208
@@ -0,0 +1,208 @@
|
||||
import { aE as LinkDescriptor, L as Location, aB as MetaDescriptor, aV as ServerDataFrom, aW as ClientDataFrom, aX as Func, aY as unstable_MiddlewareNextFunction, E as Equal, ac as unstable_RouterContextProvider, r as MiddlewareEnabled, s as AppLoadContext, aZ as Pretty } from '../../route-data-C6QaL0wu.mjs';
|
||||
import 'react';
|
||||
|
||||
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
type RouteModule = {
|
||||
meta?: Func;
|
||||
links?: Func;
|
||||
headers?: Func;
|
||||
loader?: Func;
|
||||
clientLoader?: Func;
|
||||
action?: Func;
|
||||
clientAction?: Func;
|
||||
HydrateFallback?: unknown;
|
||||
default?: unknown;
|
||||
ErrorBoundary?: unknown;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
type LinkDescriptors = LinkDescriptor[];
|
||||
type RouteInfo = {
|
||||
parents: RouteInfo[];
|
||||
module: RouteModule;
|
||||
id: unknown;
|
||||
file: string;
|
||||
path: string;
|
||||
params: unknown;
|
||||
loaderData: unknown;
|
||||
actionData: unknown;
|
||||
};
|
||||
type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
meta: MetaDescriptor[];
|
||||
data: T["loaderData"];
|
||||
handle?: unknown;
|
||||
error?: unknown;
|
||||
}>;
|
||||
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<RouteInfo> | undefined>;
|
||||
type CreateMetaArgs<T extends RouteInfo> = {
|
||||
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
|
||||
location: Location;
|
||||
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
||||
params: T["params"];
|
||||
/** The return value for this route's server loader function */
|
||||
data: T["loaderData"];
|
||||
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
||||
error?: unknown;
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: MetaMatches<[...T["parents"], T]>;
|
||||
};
|
||||
type MetaDescriptors = MetaDescriptor[];
|
||||
type HeadersArgs = {
|
||||
loaderHeaders: Headers;
|
||||
parentHeaders: Headers;
|
||||
actionHeaders: Headers;
|
||||
errorHeaders: Headers | undefined;
|
||||
};
|
||||
type IsHydrate<ClientLoader> = ClientLoader extends {
|
||||
hydrate: true;
|
||||
} ? true : ClientLoader extends {
|
||||
hydrate: false;
|
||||
} ? false : false;
|
||||
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
||||
HydrateFallback: Func;
|
||||
} ? true : false>;
|
||||
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
||||
HasHydrateFallback,
|
||||
ClientLoaderHydrate
|
||||
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
||||
IsDefined<ClientLoaderData>,
|
||||
IsDefined<ServerLoaderData>
|
||||
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
||||
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
||||
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
||||
IsDefined<ServerActionData>,
|
||||
IsDefined<ClientActionData>
|
||||
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
||||
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
||||
/**
|
||||
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
||||
*
|
||||
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function clientLoader({
|
||||
* params,
|
||||
* }: Route.ClientLoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* When `future.unstable_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
* When `future.unstable_middleware` is enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used to access context values
|
||||
* from your route middlewares. You may pass in initial context values in your
|
||||
* `<HydratedRouter unstable_getContext>` prop
|
||||
*/
|
||||
context: unstable_RouterContextProvider;
|
||||
};
|
||||
type ServerDataFunctionArgs<T extends RouteInfo> = {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function loader({
|
||||
* params,
|
||||
* }: Route.LoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* Without `future.unstable_middleware` enabled, this is the context passed in
|
||||
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
||||
* gap between the adapter's request/response API with your React Router app.
|
||||
* It is only applicable if you are using a custom server adapter.
|
||||
*
|
||||
* With `future.unstable_middleware` enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used for type-safe access to
|
||||
* context value set in your route middlewares. If you are using a custom
|
||||
* server adapter, you may provide an initial set of context values from your
|
||||
* `getLoadContext` function.
|
||||
*/
|
||||
context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
|
||||
};
|
||||
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
||||
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
|
||||
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
||||
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
||||
};
|
||||
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
||||
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
||||
};
|
||||
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
||||
params: T["params"];
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
data: T["loaderData"];
|
||||
handle: unknown;
|
||||
}>;
|
||||
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : Array<Match<RouteInfo> | undefined>;
|
||||
type CreateComponentProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export default function Component({
|
||||
* params,
|
||||
* }: Route.ComponentProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/** The data returned from the `loader` or `clientLoader` */
|
||||
loaderData: T["loaderData"];
|
||||
/** The data returned from the `action` or `clientAction` following an action submission. */
|
||||
actionData?: T["actionData"];
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: Matches<[...T["parents"], T]>;
|
||||
};
|
||||
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function ErrorBoundary({
|
||||
* params,
|
||||
* }: Route.ErrorBoundaryProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
error: unknown;
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
|
||||
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateClientMiddlewareFunction, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, CreateServerMiddlewareFunction, HeadersArgs, LinkDescriptors, MetaDescriptors };
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
import { aH as LinkDescriptor, e as Location, aF as MetaDescriptor, aV as ServerDataFrom, aW as ClientDataFrom, aX as Func, aY as unstable_MiddlewareNextFunction, _ as Equal, u as unstable_RouterContextProvider, M as MiddlewareEnabled, i as AppLoadContext, aZ as Pretty } from '../../route-data-B9_30zbP.js';
|
||||
import 'react';
|
||||
|
||||
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
type RouteModule = {
|
||||
meta?: Func;
|
||||
links?: Func;
|
||||
headers?: Func;
|
||||
loader?: Func;
|
||||
clientLoader?: Func;
|
||||
action?: Func;
|
||||
clientAction?: Func;
|
||||
HydrateFallback?: unknown;
|
||||
default?: unknown;
|
||||
ErrorBoundary?: unknown;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
type LinkDescriptors = LinkDescriptor[];
|
||||
type RouteInfo = {
|
||||
parents: RouteInfo[];
|
||||
module: RouteModule;
|
||||
id: unknown;
|
||||
file: string;
|
||||
path: string;
|
||||
params: unknown;
|
||||
loaderData: unknown;
|
||||
actionData: unknown;
|
||||
};
|
||||
type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
meta: MetaDescriptor[];
|
||||
data: T["loaderData"];
|
||||
handle?: unknown;
|
||||
error?: unknown;
|
||||
}>;
|
||||
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<RouteInfo> | undefined>;
|
||||
type CreateMetaArgs<T extends RouteInfo> = {
|
||||
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
|
||||
location: Location;
|
||||
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
||||
params: T["params"];
|
||||
/** The return value for this route's server loader function */
|
||||
data: T["loaderData"];
|
||||
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
||||
error?: unknown;
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: MetaMatches<[...T["parents"], T]>;
|
||||
};
|
||||
type MetaDescriptors = MetaDescriptor[];
|
||||
type HeadersArgs = {
|
||||
loaderHeaders: Headers;
|
||||
parentHeaders: Headers;
|
||||
actionHeaders: Headers;
|
||||
errorHeaders: Headers | undefined;
|
||||
};
|
||||
type IsHydrate<ClientLoader> = ClientLoader extends {
|
||||
hydrate: true;
|
||||
} ? true : ClientLoader extends {
|
||||
hydrate: false;
|
||||
} ? false : false;
|
||||
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
||||
HydrateFallback: Func;
|
||||
} ? true : false>;
|
||||
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
||||
HasHydrateFallback,
|
||||
ClientLoaderHydrate
|
||||
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
||||
IsDefined<ClientLoaderData>,
|
||||
IsDefined<ServerLoaderData>
|
||||
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
||||
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
||||
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
||||
IsDefined<ServerActionData>,
|
||||
IsDefined<ClientActionData>
|
||||
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
||||
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
||||
/**
|
||||
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
||||
*
|
||||
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function clientLoader({
|
||||
* params,
|
||||
* }: Route.ClientLoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* When `future.unstable_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
* When `future.unstable_middleware` is enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used to access context values
|
||||
* from your route middlewares. You may pass in initial context values in your
|
||||
* `<HydratedRouter unstable_getContext>` prop
|
||||
*/
|
||||
context: unstable_RouterContextProvider;
|
||||
};
|
||||
type ServerDataFunctionArgs<T extends RouteInfo> = {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function loader({
|
||||
* params,
|
||||
* }: Route.LoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* Without `future.unstable_middleware` enabled, this is the context passed in
|
||||
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
||||
* gap between the adapter's request/response API with your React Router app.
|
||||
* It is only applicable if you are using a custom server adapter.
|
||||
*
|
||||
* With `future.unstable_middleware` enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used for type-safe access to
|
||||
* context value set in your route middlewares. If you are using a custom
|
||||
* server adapter, you may provide an initial set of context values from your
|
||||
* `getLoadContext` function.
|
||||
*/
|
||||
context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
|
||||
};
|
||||
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
||||
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
|
||||
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
||||
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
||||
};
|
||||
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
||||
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
||||
};
|
||||
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
||||
params: T["params"];
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
data: T["loaderData"];
|
||||
handle: unknown;
|
||||
}>;
|
||||
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : Array<Match<RouteInfo> | undefined>;
|
||||
type CreateComponentProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export default function Component({
|
||||
* params,
|
||||
* }: Route.ComponentProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/** The data returned from the `loader` or `clientLoader` */
|
||||
loaderData: T["loaderData"];
|
||||
/** The data returned from the `action` or `clientAction` following an action submission. */
|
||||
actionData?: T["actionData"];
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: Matches<[...T["parents"], T]>;
|
||||
};
|
||||
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function ErrorBoundary({
|
||||
* params,
|
||||
* }: Route.ErrorBoundaryProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
error: unknown;
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
|
||||
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateClientMiddlewareFunction, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, CreateServerMiddlewareFunction, HeadersArgs, LinkDescriptors, MetaDescriptors };
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* react-router v7.6.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
|
||||
*/
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// lib/types/route-module.ts
|
||||
var route_module_exports = {};
|
||||
module.exports = __toCommonJS(route_module_exports);
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* react-router v7.6.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
|
||||
*/
|
||||
+1749
File diff suppressed because it is too large
Load Diff
+1749
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user