react-router 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -1
- package/dist/development/dom-export.d.ts +2 -1
- package/dist/development/dom-export.js +1 -1
- package/dist/development/index-react-server-client.js +2 -2
- package/dist/development/index-react-server.d.ts +583 -165
- package/dist/development/index-react-server.js +27 -19
- package/dist/development/index.d.ts +9 -8
- package/dist/development/index.js +5 -4
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/components.js +22 -3
- package/dist/development/lib/context.d.ts +6 -1
- package/dist/development/lib/context.js +1 -1
- package/dist/development/lib/dom/dom.d.ts +3 -0
- package/dist/development/lib/dom/dom.js +1 -1
- package/dist/development/lib/dom/global.d.ts +35 -0
- package/dist/development/lib/dom/lib.d.ts +34 -9
- package/dist/development/lib/dom/lib.js +17 -6
- package/dist/development/lib/dom/server.js +2 -2
- package/dist/development/lib/dom/ssr/components.js +12 -9
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/entry.d.ts +9 -2
- package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/development/lib/dom/ssr/fallback.js +1 -1
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/development/lib/dom/ssr/fog-of-war.js +14 -11
- package/dist/development/lib/dom/ssr/hydration.js +1 -1
- package/dist/development/lib/dom/ssr/invariant.js +1 -1
- package/dist/development/lib/dom/ssr/links.js +1 -1
- package/dist/development/lib/dom/ssr/markup.js +1 -1
- package/dist/development/lib/dom/ssr/route-discovery.d.ts +120 -0
- package/dist/development/lib/dom/ssr/route-discovery.js +415 -0
- package/dist/development/lib/dom/ssr/routeModules.js +1 -1
- package/dist/development/lib/dom/ssr/routes-test-stub.js +2 -2
- package/dist/development/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/development/lib/dom/ssr/routes.js +8 -8
- package/dist/development/lib/dom/ssr/server.js +3 -1
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/development/lib/dom/ssr/single-fetch.js +73 -55
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/development/lib/dom-export/hydrated-router.js +32 -12
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +3 -3
- package/dist/development/lib/hooks.js +4 -4
- package/dist/development/lib/href.js +1 -1
- package/dist/development/lib/router/history.js +1 -1
- package/dist/development/lib/router/instrumentation.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/development/lib/router/matcher.js +1 -1
- package/dist/development/lib/router/navigation.js +1 -1
- package/dist/development/lib/router/router.d.ts +6 -0
- package/dist/development/lib/router/router.js +157 -65
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +24 -4
- package/dist/development/lib/router/utils.js +4 -3
- package/dist/development/lib/rsc/browser.js +2 -2
- package/dist/development/lib/rsc/errorBoundaries.js +1 -1
- package/dist/development/lib/rsc/html-stream/browser.js +1 -1
- package/dist/development/lib/rsc/html-stream/server.js +24 -12
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/development/lib/rsc/server.ssr.js +1 -1
- package/dist/development/lib/server-runtime/build.d.ts +14 -0
- package/dist/development/lib/server-runtime/cookies.js +1 -1
- package/dist/development/lib/server-runtime/crypto.js +1 -1
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +1 -1
- package/dist/development/lib/server-runtime/entry.js +1 -1
- package/dist/development/lib/server-runtime/errors.js +1 -1
- package/dist/development/lib/server-runtime/headers.js +1 -1
- package/dist/development/lib/server-runtime/invariant.js +1 -1
- package/dist/development/lib/server-runtime/mode.js +1 -1
- package/dist/development/lib/server-runtime/routeMatching.js +1 -1
- package/dist/development/lib/server-runtime/routes.d.ts +1 -1
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +12 -4
- package/dist/development/lib/server-runtime/serverHandoff.d.ts +17 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions.js +1 -1
- package/dist/development/lib/server-runtime/single-fetch.js +1 -1
- package/dist/development/lib/server-runtime/urls.js +1 -1
- package/dist/development/lib/server-runtime/warnings.js +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/route-data.d.ts +2 -2
- package/dist/development/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/development/route-pattern.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
- package/dist/production/dom-export.d.ts +2 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/index-react-server-client.js +2 -2
- package/dist/production/index-react-server.d.ts +583 -165
- package/dist/production/index-react-server.js +27 -19
- package/dist/production/index.d.ts +9 -8
- package/dist/production/index.js +5 -4
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/components.js +22 -3
- package/dist/production/lib/context.d.ts +6 -1
- package/dist/production/lib/context.js +1 -1
- package/dist/production/lib/dom/dom.d.ts +3 -0
- package/dist/production/lib/dom/dom.js +1 -1
- package/dist/production/lib/dom/global.d.ts +35 -0
- package/dist/production/lib/dom/lib.d.ts +34 -9
- package/dist/production/lib/dom/lib.js +17 -6
- package/dist/production/lib/dom/server.js +2 -2
- package/dist/production/lib/dom/ssr/components.js +12 -9
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/entry.d.ts +9 -2
- package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/production/lib/dom/ssr/fallback.js +1 -1
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/production/lib/dom/ssr/fog-of-war.js +14 -11
- package/dist/production/lib/dom/ssr/hydration.js +1 -1
- package/dist/production/lib/dom/ssr/invariant.js +1 -1
- package/dist/production/lib/dom/ssr/links.js +1 -1
- package/dist/production/lib/dom/ssr/markup.js +1 -1
- package/dist/production/lib/dom/ssr/route-discovery.d.ts +120 -0
- package/dist/production/lib/dom/ssr/route-discovery.js +415 -0
- package/dist/production/lib/dom/ssr/routeModules.js +1 -1
- package/dist/production/lib/dom/ssr/routes-test-stub.js +2 -2
- package/dist/production/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/production/lib/dom/ssr/routes.js +8 -8
- package/dist/production/lib/dom/ssr/server.js +3 -1
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/production/lib/dom/ssr/single-fetch.js +73 -55
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/production/lib/dom-export/hydrated-router.js +32 -12
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +3 -3
- package/dist/production/lib/hooks.js +3 -3
- package/dist/production/lib/href.js +1 -1
- package/dist/production/lib/router/history.js +1 -1
- package/dist/production/lib/router/instrumentation.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/production/lib/router/matcher.js +1 -1
- package/dist/production/lib/router/navigation.js +1 -1
- package/dist/production/lib/router/router.d.ts +6 -0
- package/dist/production/lib/router/router.js +157 -65
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +24 -4
- package/dist/production/lib/router/utils.js +4 -3
- package/dist/production/lib/rsc/browser.js +2 -2
- package/dist/production/lib/rsc/errorBoundaries.js +1 -1
- package/dist/production/lib/rsc/html-stream/browser.js +1 -1
- package/dist/production/lib/rsc/html-stream/server.js +24 -12
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/production/lib/rsc/server.ssr.js +1 -1
- package/dist/production/lib/server-runtime/build.d.ts +14 -0
- package/dist/production/lib/server-runtime/cookies.js +1 -1
- package/dist/production/lib/server-runtime/crypto.js +1 -1
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +1 -1
- package/dist/production/lib/server-runtime/entry.js +1 -1
- package/dist/production/lib/server-runtime/errors.js +1 -1
- package/dist/production/lib/server-runtime/headers.js +1 -1
- package/dist/production/lib/server-runtime/invariant.js +1 -1
- package/dist/production/lib/server-runtime/mode.js +1 -1
- package/dist/production/lib/server-runtime/routeMatching.js +1 -1
- package/dist/production/lib/server-runtime/routes.d.ts +1 -1
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +12 -4
- package/dist/production/lib/server-runtime/serverHandoff.d.ts +17 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions.js +1 -1
- package/dist/production/lib/server-runtime/single-fetch.js +1 -1
- package/dist/production/lib/server-runtime/urls.js +1 -1
- package/dist/production/lib/server-runtime/warnings.js +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/route-data.d.ts +2 -2
- package/dist/production/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/production/route-pattern.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/explanation/lazy-route-discovery.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +108 -4
- package/docs/how-to/custom-fetch.md +218 -0
- package/docs/how-to/data-strategy.md +23 -1
- package/docs/how-to/middleware.md +1 -0
- package/docs/how-to/optimize-revalidation.md +2 -2
- package/docs/how-to/pre-rendering.md +23 -1
- package/docs/how-to/route-discovery.md +145 -0
- package/docs/how-to/spa.md +2 -0
- package/docs/how-to/view-transitions.md +80 -13
- package/docs/start/framework/navigating.md +5 -9
- package/docs/start/framework/rendering.md +37 -0
- package/package.json +9 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -549,7 +549,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
549
549
|
return "(?:/([^\\/]*))?";
|
|
550
550
|
}
|
|
551
551
|
return "/([^\\/]+)";
|
|
552
|
-
}).replace(/\/([\
|
|
552
|
+
}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g, "(?:/$1)?");
|
|
553
553
|
if (path.endsWith("*")) {
|
|
554
554
|
params.push({ paramName: "*" });
|
|
555
555
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -1459,7 +1459,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1459
1459
|
};
|
|
1460
1460
|
}
|
|
1461
1461
|
async function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {
|
|
1462
|
-
let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, requestContext, true);
|
|
1462
|
+
let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, "static", requestContext, true);
|
|
1463
1463
|
let dataResults = {};
|
|
1464
1464
|
await Promise.all(matches.map(async (match) => {
|
|
1465
1465
|
if (!(match.route.id in results)) return;
|
|
@@ -1822,7 +1822,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, p
|
|
|
1822
1822
|
return getDataStrategyMatch(mapRouteProperties, manifest, request, path, getRoutePattern(matches), match, lazyRoutePropertiesToSkip, scopedContext, true, shouldRevalidateArgs);
|
|
1823
1823
|
});
|
|
1824
1824
|
}
|
|
1825
|
-
async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
1825
|
+
async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, initiator, scopedContext, isStaticHandler, navigationType = null) {
|
|
1826
1826
|
if (matches.some((m) => m._lazyPromises?.middleware)) await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
|
|
1827
1827
|
let dataStrategyArgs = {
|
|
1828
1828
|
request,
|
|
@@ -1830,7 +1830,9 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
|
|
1830
1830
|
pattern: getRoutePattern(matches),
|
|
1831
1831
|
params: matches[0].params,
|
|
1832
1832
|
context: scopedContext,
|
|
1833
|
-
matches
|
|
1833
|
+
matches,
|
|
1834
|
+
unstable_initiator: initiator,
|
|
1835
|
+
unstable_navigationType: initiator === "navigation" ? navigationType : null
|
|
1834
1836
|
};
|
|
1835
1837
|
let runClientMiddleware = isStaticHandler ? () => {
|
|
1836
1838
|
throw new Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`");
|
|
@@ -2444,7 +2446,12 @@ const Await = (async ({ children, resolve, errorElement }) => {
|
|
|
2444
2446
|
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
|
2445
2447
|
* data for hydration.
|
|
2446
2448
|
*/
|
|
2447
|
-
async function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, clientVersion, onError, request, routes, generateResponse }) {
|
|
2449
|
+
async function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, clientVersion, onError, request, routes, generateResponse: encodeResponse }) {
|
|
2450
|
+
let generateResponse = (match, options) => {
|
|
2451
|
+
let response = encodeResponse(match, options);
|
|
2452
|
+
response.headers.set("Content-Type", "text/x-component");
|
|
2453
|
+
return response;
|
|
2454
|
+
};
|
|
2448
2455
|
let url = new URL(request.url);
|
|
2449
2456
|
basename = basename || "/";
|
|
2450
2457
|
let normalizedPath = url.pathname;
|
|
@@ -2591,18 +2598,18 @@ async function processServerAction(request, basename, decodeReply, loadServerAct
|
|
|
2591
2598
|
}
|
|
2592
2599
|
async function generateResourceResponse(request, staticHandler, routeId, requestContext, onError) {
|
|
2593
2600
|
try {
|
|
2594
|
-
return await staticHandler.queryRoute(request, {
|
|
2601
|
+
return tagResourceResponse(await staticHandler.queryRoute(request, {
|
|
2595
2602
|
routeId,
|
|
2596
2603
|
requestContext,
|
|
2597
2604
|
async generateMiddlewareResponse(queryRoute) {
|
|
2598
2605
|
try {
|
|
2599
|
-
return
|
|
2606
|
+
return tagResourceResponse(await queryRoute(request));
|
|
2600
2607
|
} catch (error) {
|
|
2601
2608
|
return generateErrorResponse(error);
|
|
2602
2609
|
}
|
|
2603
2610
|
},
|
|
2604
2611
|
normalizePath: (r) => getNormalizedPath(r)
|
|
2605
|
-
});
|
|
2612
|
+
}));
|
|
2606
2613
|
} catch (error) {
|
|
2607
2614
|
return generateErrorResponse(error);
|
|
2608
2615
|
}
|
|
@@ -2620,18 +2627,18 @@ async function generateResourceResponse(request, staticHandler, routeId, request
|
|
|
2620
2627
|
onError?.(error);
|
|
2621
2628
|
response = new Response("Internal Server Error", { status: 500 });
|
|
2622
2629
|
}
|
|
2623
|
-
return
|
|
2624
|
-
}
|
|
2625
|
-
function generateResourceResponse(response) {
|
|
2626
|
-
const headers = new Headers(response.headers);
|
|
2627
|
-
headers.set("React-Router-Resource", "true");
|
|
2628
|
-
return new Response(response.body, {
|
|
2629
|
-
status: response.status,
|
|
2630
|
-
statusText: response.statusText,
|
|
2631
|
-
headers
|
|
2632
|
-
});
|
|
2630
|
+
return tagResourceResponse(response);
|
|
2633
2631
|
}
|
|
2634
2632
|
}
|
|
2633
|
+
function tagResourceResponse(response) {
|
|
2634
|
+
const headers = new Headers(response.headers);
|
|
2635
|
+
headers.set("React-Router-Resource", "true");
|
|
2636
|
+
return new Response(response.body, {
|
|
2637
|
+
status: response.status,
|
|
2638
|
+
statusText: response.statusText,
|
|
2639
|
+
headers
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2635
2642
|
async function generateRenderResponse(request, staticHandler, basename, isDataRequest, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, generateResponse, temporaryReferences, allowedActionOrigins, routeDiscovery, clientVersion) {
|
|
2636
2643
|
let statusCode = 200;
|
|
2637
2644
|
let url = new URL(request.url);
|
|
@@ -2689,6 +2696,7 @@ async function generateRenderResponse(request, staticHandler, basename, isDataRe
|
|
|
2689
2696
|
}));
|
|
2690
2697
|
if (isRedirectResponse(result)) return generateRedirectResponse(result, actionResult, basename, isDataRequest, generateResponse, temporaryReferences, ctx.redirect?.headers);
|
|
2691
2698
|
invariant(isResponse(result), "Expected a response from query");
|
|
2699
|
+
if (result.headers.get("Content-Type")?.split(";")[0].trim().toLowerCase() !== "text/x-component") return tagResourceResponse(result);
|
|
2692
2700
|
return result;
|
|
2693
2701
|
}
|
|
2694
2702
|
function generateRedirectResponse(response, actionResult, basename, isDataRequest, generateResponse, temporaryReferences, sideEffectRedirectHeaders) {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import { Action, InitialEntry, Location, Path, To, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, invariant, parsePath } from "./lib/router/history.js";
|
|
3
|
-
import { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MiddlewareFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
|
|
3
|
+
import { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyInitiator, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MiddlewareFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
|
|
4
4
|
import { Blocker, BlockerFunction, Fetcher, GetScrollPositionFunction, GetScrollRestorationKeyFunction, HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Navigation, NavigationStates, RelativeRoutingType, RevalidationState, Router, RouterFetchOptions, RouterInit, RouterNavigateOptions, RouterState, RouterSubscriber, StaticHandler, StaticHandlerContext, createRouter, createStaticHandler } from "./lib/router/router.js";
|
|
5
|
-
import { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "./lib/router/links.js";
|
|
6
5
|
import { Await, AwaitProps, ClientOnErrorFunction, IndexRouteProps, LayoutRouteProps, MemoryRouter, MemoryRouterOpts, MemoryRouterProps, Navigate, NavigateProps, Outlet, OutletProps, PathRouteProps, Route, RouteProps, Router as Router$1, RouterProps, RouterProvider, RouterProviderProps, Routes, RoutesProps, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
|
|
7
6
|
import { AwaitContextProvider, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, LocationContext, NavigateOptions, NavigationContext, Navigator, RouteContext, ViewTransitionContext } from "./lib/context.js";
|
|
7
|
+
import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader } from "./lib/dom/ssr/routes.js";
|
|
8
|
+
import { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "./lib/router/links.js";
|
|
9
|
+
import { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, MetaArgs, MetaDescriptor, MetaFunction, RouteModules } from "./lib/dom/ssr/routeModules.js";
|
|
10
|
+
import { SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch.js";
|
|
11
|
+
import { ServerMode } from "./lib/server-runtime/mode.js";
|
|
12
|
+
import { unstable_SerializesTo } from "./lib/types/serializes-to.js";
|
|
8
13
|
import { Register } from "./lib/types/register.js";
|
|
9
14
|
import { NavigateFunction, unstable_RouterState, unstable_RouterStateActiveVariant, unstable_RouterStatePendingVariant, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes } from "./lib/hooks.js";
|
|
10
15
|
import { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, SubmitTarget, URLSearchParamsInit, createSearchParams } from "./lib/dom/dom.js";
|
|
@@ -19,7 +24,6 @@ import { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookie
|
|
|
19
24
|
import { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage.js";
|
|
20
25
|
import { setDevServerHooks } from "./lib/server-runtime/dev.js";
|
|
21
26
|
import { Future } from "./lib/types/future.js";
|
|
22
|
-
import { unstable_SerializesTo } from "./lib/types/serializes-to.js";
|
|
23
27
|
import { href } from "./lib/href.js";
|
|
24
28
|
import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, LoadServerActionFunction, RSCManifestPayload, RSCMatch, RSCPayload, RSCRenderPayload, RSCRouteConfig, RSCRouteConfigEntry, RSCRouteManifest, RSCRouteMatch, getRequest, matchRSCServerRequest } from "./lib/rsc/server.rsc.js";
|
|
25
29
|
import { BrowserCreateFromReadableStreamFunction, EncodeReplyFunction, RSCHydratedRouterProps } from "./lib/rsc/browser.js";
|
|
@@ -28,10 +32,7 @@ import { RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries.js";
|
|
|
28
32
|
import { RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries.js";
|
|
29
33
|
import { getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery } from "./lib/dom/ssr/fog-of-war.js";
|
|
30
34
|
import { getHydrationData } from "./lib/dom/ssr/hydration.js";
|
|
31
|
-
import {
|
|
32
|
-
import { ServerMode } from "./lib/server-runtime/mode.js";
|
|
33
|
-
import { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, MetaArgs, MetaDescriptor, MetaFunction, RouteModules } from "./lib/dom/ssr/routeModules.js";
|
|
34
|
-
import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader } from "./lib/dom/ssr/routes.js";
|
|
35
|
+
import { DiscoveryResult, ManifestMismatchEvent, RouteDiscoveryOptions, RouteDiscoveryRuntime, getCustomPatchRoutesOnNavigationFunction, useCustomRouteDiscovery, useRouteDiscovery } from "./lib/dom/ssr/route-discovery.js";
|
|
35
36
|
import { AssetsManifest, EntryContext } from "./lib/dom/ssr/entry.js";
|
|
36
37
|
import { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule } from "./lib/server-runtime/build.js";
|
|
37
38
|
import { CreateRequestHandlerFunction, RequestHandler, createRequestHandler } from "./lib/server-runtime/server.js";
|
|
@@ -41,4 +42,4 @@ import { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRout
|
|
|
41
42
|
declare const unstable_getRequest: typeof getRequest;
|
|
42
43
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
43
44
|
//#endregion
|
|
44
|
-
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationClientRouterResult, type InstrumentationHandlerResult, type InstrumentationServerHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, 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, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, 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 };
|
|
45
|
+
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationClientRouterResult, type InstrumentationHandlerResult, type InstrumentationServerHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, RouteDiscoveryRuntime as UNSAFE_RouteDiscoveryRuntime, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getCustomPatchRoutesOnNavigationFunction as UNSAFE_getCustomPatchRoutesOnNavigationFunction, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useCustomRouteDiscovery as UNSAFE_useCustomRouteDiscovery, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, 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, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DataStrategyInitiator as unstable_DataStrategyInitiator, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type DiscoveryResult as unstable_DiscoveryResult, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type ManifestMismatchEvent as unstable_ManifestMismatchEvent, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type RouteDiscoveryOptions as unstable_RouteDiscoveryOptions, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouteDiscovery as unstable_useRouteDiscovery, useRouterState as unstable_useRouterState, 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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,13 +14,13 @@ import { ErrorResponseImpl, RouterContextProvider, createContext, data, defaultM
|
|
|
14
14
|
import { IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, createRouter, createStaticHandler } from "./lib/router/router.js";
|
|
15
15
|
import { AwaitContextProvider, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, LocationContext, NavigationContext, RouteContext, ViewTransitionContext } from "./lib/context.js";
|
|
16
16
|
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes } from "./lib/hooks.js";
|
|
17
|
-
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
|
|
18
|
-
import { createSearchParams } from "./lib/dom/dom.js";
|
|
19
17
|
import { SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch.js";
|
|
20
18
|
import { RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries.js";
|
|
21
19
|
import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader } from "./lib/dom/ssr/routes.js";
|
|
22
20
|
import { getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery } from "./lib/dom/ssr/fog-of-war.js";
|
|
23
21
|
import { FrameworkContext, Links, Meta, PrefetchPageLinks, Scripts } from "./lib/dom/ssr/components.js";
|
|
22
|
+
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
|
|
23
|
+
import { createSearchParams } from "./lib/dom/dom.js";
|
|
24
24
|
import { BrowserRouter, Form, HashRouter, HistoryRouter, Link, NavLink, ScrollRestoration, createBrowserRouter, createHashRouter, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, usePrompt, useScrollRestoration, useSearchParams, useSubmit, useViewTransitionState } from "./lib/dom/lib.js";
|
|
25
25
|
import { StaticRouter, StaticRouterProvider, createStaticRouter } from "./lib/dom/server.js";
|
|
26
26
|
import { ServerRouter } from "./lib/dom/ssr/server.js";
|
|
@@ -36,10 +36,11 @@ import { href } from "./lib/href.js";
|
|
|
36
36
|
import { RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries.js";
|
|
37
37
|
import { RSCStaticRouter, routeRSCServerRequest } from "./lib/rsc/server.ssr.js";
|
|
38
38
|
import { getHydrationData } from "./lib/dom/ssr/hydration.js";
|
|
39
|
+
import { RouteDiscoveryRuntime, getCustomPatchRoutesOnNavigationFunction, useCustomRouteDiscovery, useRouteDiscovery } from "./lib/dom/ssr/route-discovery.js";
|
|
39
40
|
//#region index.ts
|
|
40
41
|
/**
|
|
41
42
|
* @module index
|
|
42
43
|
* @mergeModuleWith react-router
|
|
43
44
|
*/
|
|
44
45
|
//#endregion
|
|
45
|
-
export { Await, BrowserRouter, Form, HashRouter, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Action as NavigationType, Outlet, PrefetchPageLinks, Route, Router, RouterContextProvider, RouterProvider, Routes, Scripts, ScrollRestoration, ServerRouter, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, createBrowserRouter, createContext, 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, RSCStaticRouter as unstable_RSCStaticRouter, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, 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 };
|
|
46
|
+
export { Await, BrowserRouter, Form, HashRouter, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Action as NavigationType, Outlet, PrefetchPageLinks, Route, Router, RouterContextProvider, RouterProvider, Routes, Scripts, ScrollRestoration, ServerRouter, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, RouteDiscoveryRuntime as UNSAFE_RouteDiscoveryRuntime, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getCustomPatchRoutesOnNavigationFunction as UNSAFE_getCustomPatchRoutesOnNavigationFunction, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useCustomRouteDiscovery as UNSAFE_useCustomRouteDiscovery, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, createBrowserRouter, createContext, 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, RSCStaticRouter as unstable_RSCStaticRouter, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouteDiscovery as unstable_useRouteDiscovery, useRouterState as unstable_useRouterState, 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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
import { createMemoryHistory, createPath, invariant, parsePath, warning } from "./router/history.js";
|
|
12
12
|
import { defaultMapRouteProperties, getResolveToMatches, getRoutePattern, resolveTo, stripBasename } from "./router/utils.js";
|
|
13
13
|
import { getNavigatorCurrentUrl, validateNavigationTarget } from "./router/navigation.js";
|
|
14
|
-
import { createRouter } from "./router/router.js";
|
|
14
|
+
import { clientErrors, createRouter } from "./router/router.js";
|
|
15
15
|
import { AwaitContext, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, LocationContext, NavigationContext, RouteContext, ViewTransitionContext, useIsRSCRouterContext } from "./context.js";
|
|
16
16
|
import { _renderMatches, useActionData, useAsyncValue, useInRouterContext, useLoaderData, useLocation, useMatches, useNavigate, useOutlet, useParams, useRouteError, useRoutes, useRoutesImpl } from "./hooks.js";
|
|
17
17
|
import { warnOnce } from "./server-runtime/warnings.js";
|
|
18
|
+
import { FrameworkContext } from "./dom/ssr/components.js";
|
|
18
19
|
import * as React$1 from "react";
|
|
19
20
|
import { useOptimistic } from "react";
|
|
20
21
|
//#region lib/components.tsx
|
|
@@ -122,13 +123,18 @@ function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, use
|
|
|
122
123
|
useTransitions = useIsRSCRouterContext() || useTransitions;
|
|
123
124
|
let [_state, setStateImpl] = React$1.useState(router.state);
|
|
124
125
|
let [state, setOptimisticState] = useOptimistic(_state);
|
|
126
|
+
let lastState = React$1.useRef(state);
|
|
125
127
|
let [pendingState, setPendingState] = React$1.useState();
|
|
126
128
|
let [vtContext, setVtContext] = React$1.useState({ isTransitioning: false });
|
|
127
129
|
let [renderDfd, setRenderDfd] = React$1.useState();
|
|
128
130
|
let [transition, setTransition] = React$1.useState();
|
|
129
131
|
let [interruption, setInterruption] = React$1.useState();
|
|
130
132
|
let fetcherData = React$1.useRef(/* @__PURE__ */ new Map());
|
|
133
|
+
let handledErrors = React$1.useRef(/* @__PURE__ */ new WeakSet());
|
|
131
134
|
let setState = React$1.useCallback((newState, { deletedFetchers, newErrors, flushSync, viewTransitionOpts }) => {
|
|
135
|
+
lastState.current = newState;
|
|
136
|
+
if (newErrors && newState.errors && clientErrors.has(newState.errors)) if (handledErrors.current.has(newState.errors)) newErrors = null;
|
|
137
|
+
else handledErrors.current.add(newState.errors);
|
|
132
138
|
if (newErrors && onError) Object.values(newErrors).forEach((error) => onError(error, {
|
|
133
139
|
location: newState.location,
|
|
134
140
|
params: newState.matches[0]?.params ?? {},
|
|
@@ -204,6 +210,15 @@ function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, use
|
|
|
204
210
|
onError
|
|
205
211
|
]);
|
|
206
212
|
React$1.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
213
|
+
React$1.useLayoutEffect(() => {
|
|
214
|
+
let errors = router.state.errors;
|
|
215
|
+
let newErrors = errors ? clientErrors.get(errors) : null;
|
|
216
|
+
if (lastState.current !== router.state || errors && newErrors && !handledErrors.current.has(errors)) setState(router.state, {
|
|
217
|
+
deletedFetchers: [],
|
|
218
|
+
flushSync: false,
|
|
219
|
+
newErrors: newErrors ?? null
|
|
220
|
+
});
|
|
221
|
+
}, [router, setState]);
|
|
207
222
|
React$1.useEffect(() => {
|
|
208
223
|
if (vtContext.isTransitioning && !vtContext.flushSync) setRenderDfd(new Deferred());
|
|
209
224
|
}, [vtContext]);
|
|
@@ -347,6 +362,10 @@ const MemoizedDataRoutes = React$1.memo(DataRoutes);
|
|
|
347
362
|
function DataRoutes({ routes, manifest, state, isStatic, onError }) {
|
|
348
363
|
let dataRouterContext = React$1.useContext(DataRouterContext);
|
|
349
364
|
invariant(dataRouterContext, "You must render this element inside a <DataRouterContext.Provider> element");
|
|
365
|
+
let discoveryRuntime = React$1.useContext(FrameworkContext)?.routeDiscoveryRuntime;
|
|
366
|
+
React$1.useEffect(() => {
|
|
367
|
+
if (state.initialized) discoveryRuntime?.markReady();
|
|
368
|
+
}, [state.initialized, discoveryRuntime]);
|
|
350
369
|
return useRoutesImpl(routes, void 0, {
|
|
351
370
|
router: dataRouterContext.router,
|
|
352
371
|
manifest,
|
|
@@ -716,7 +735,7 @@ var AwaitErrorBoundary = class extends React$1.Component {
|
|
|
716
735
|
} else {
|
|
717
736
|
status = 0;
|
|
718
737
|
Object.defineProperty(resolve, "_tracked", { get: () => true });
|
|
719
|
-
promise = resolve.then((data) => Object.defineProperty(resolve, "_data", { get: () => data }), (error) => {
|
|
738
|
+
promise = Promise.resolve(resolve).then((data) => Object.defineProperty(resolve, "_data", { get: () => data }), (error) => {
|
|
720
739
|
this.props.onError?.(error);
|
|
721
740
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
722
741
|
});
|
|
@@ -47,7 +47,12 @@ interface NavigateOptions {
|
|
|
47
47
|
relative?: RelativeRoutingType;
|
|
48
48
|
/** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
|
|
49
49
|
flushSync?: boolean;
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Enables a view transition for this navigation.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated Use React's `<ViewTransition>` component instead. See the
|
|
54
|
+
* [migration guide](https://reactrouter.com/how-to/view-transitions).
|
|
55
|
+
*/
|
|
51
56
|
viewTransition?: boolean;
|
|
52
57
|
/** Specifies the default revalidation behavior after this submission */
|
|
53
58
|
defaultShouldRevalidate?: boolean;
|
|
@@ -112,6 +112,9 @@ interface SubmitOptions extends FetcherSubmitOptions {
|
|
|
112
112
|
navigate?: boolean;
|
|
113
113
|
/**
|
|
114
114
|
* Enable view transitions on this submission navigation
|
|
115
|
+
*
|
|
116
|
+
* @deprecated Use React's `<ViewTransition>` component instead. See the
|
|
117
|
+
* [migration guide](https://reactrouter.com/how-to/view-transitions).
|
|
115
118
|
*/
|
|
116
119
|
viewTransition?: boolean;
|
|
117
120
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { HydrationState, Router } from "../router/router.js";
|
|
3
|
+
import { RouteModules } from "./ssr/routeModules.js";
|
|
4
|
+
import { ServerHandoff } from "../server-runtime/serverHandoff.js";
|
|
5
|
+
import { AssetsManifest } from "./ssr/entry.js";
|
|
6
|
+
|
|
7
|
+
//#region lib/dom/global.d.ts
|
|
8
|
+
type WindowReactRouterContext = ServerHandoff & {
|
|
9
|
+
state: HydrationState;
|
|
10
|
+
stream: ReadableStream<Uint8Array> | undefined;
|
|
11
|
+
streamController: ReadableStreamDefaultController<Uint8Array>;
|
|
12
|
+
};
|
|
13
|
+
interface ViewTransition {
|
|
14
|
+
finished: Promise<void>;
|
|
15
|
+
ready: Promise<void>;
|
|
16
|
+
updateCallbackDone: Promise<void>;
|
|
17
|
+
skipTransition(): void;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
var __staticRouterHydrationData: HydrationState | undefined;
|
|
21
|
+
var __reactRouterVersion: string;
|
|
22
|
+
interface Document {
|
|
23
|
+
startViewTransition(cb: () => Promise<void> | void): ViewTransition;
|
|
24
|
+
}
|
|
25
|
+
var __reactRouterContext: WindowReactRouterContext | undefined;
|
|
26
|
+
var __reactRouterManifest: AssetsManifest | undefined;
|
|
27
|
+
var __reactRouterRouteModules: RouteModules | undefined;
|
|
28
|
+
var __reactRouterDataRouter: Router | undefined;
|
|
29
|
+
var __reactRouterHdrActive: boolean;
|
|
30
|
+
var $RefreshRuntime$: {
|
|
31
|
+
performReactRefresh: () => void;
|
|
32
|
+
} | undefined;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { WindowReactRouterContext };
|
|
@@ -3,9 +3,9 @@ import { History, To } from "../router/history.js";
|
|
|
3
3
|
import { DataStrategyFunction, HTMLFormMethod, PatchRoutesOnNavigationFunction, RouteObject } from "../router/utils.js";
|
|
4
4
|
import { BlockerFunction, Fetcher, FutureConfig, GetScrollRestorationKeyFunction, HydrationState, RelativeRoutingType, Router, RouterInit } from "../router/router.js";
|
|
5
5
|
import { NavigateOptions } from "../context.js";
|
|
6
|
+
import { SerializeFrom } from "../types/route-data.js";
|
|
6
7
|
import { FetcherSubmitOptions, SubmitOptions, SubmitTarget, URLSearchParamsInit } from "./dom.js";
|
|
7
8
|
import { DiscoverBehavior, PrefetchBehavior, ScriptsProps } from "./ssr/components.js";
|
|
8
|
-
import { SerializeFrom } from "../types/route-data.js";
|
|
9
9
|
import { ClientInstrumentation } from "../router/instrumentation.js";
|
|
10
10
|
import * as React$1 from "react";
|
|
11
11
|
|
|
@@ -863,6 +863,9 @@ interface LinkProps extends Omit<React$1.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
863
863
|
*/
|
|
864
864
|
to: To;
|
|
865
865
|
/**
|
|
866
|
+
* **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
|
|
867
|
+
* component instead. See the [migration guide](../../how-to/view-transitions).
|
|
868
|
+
*
|
|
866
869
|
* Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
867
870
|
* for this navigation.
|
|
868
871
|
*
|
|
@@ -873,6 +876,8 @@ interface LinkProps extends Omit<React$1.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
873
876
|
* ```
|
|
874
877
|
*
|
|
875
878
|
* To apply specific styles for the transition, see {@link useViewTransitionState}
|
|
879
|
+
*
|
|
880
|
+
* @deprecated Use React's `<ViewTransition>` component instead.
|
|
876
881
|
*/
|
|
877
882
|
viewTransition?: boolean;
|
|
878
883
|
/**
|
|
@@ -1020,6 +1025,10 @@ type NavLinkRenderProps = {
|
|
|
1020
1025
|
/**
|
|
1021
1026
|
* Indicates if a view transition to the link's URL is in progress.
|
|
1022
1027
|
* See {@link useViewTransitionState}
|
|
1028
|
+
*
|
|
1029
|
+
* @deprecated Only tracks React Router's deprecated view transitions. Use
|
|
1030
|
+
* React's `<ViewTransition>` component to style transitions instead. See the
|
|
1031
|
+
* [migration guide](https://reactrouter.com/how-to/view-transitions).
|
|
1023
1032
|
*/
|
|
1024
1033
|
isTransitioning: boolean;
|
|
1025
1034
|
};
|
|
@@ -1059,9 +1068,6 @@ interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "children
|
|
|
1059
1068
|
* a.pending {
|
|
1060
1069
|
* color: blue;
|
|
1061
1070
|
* }
|
|
1062
|
-
* a.transitioning {
|
|
1063
|
-
* view-transition-name: my-transition;
|
|
1064
|
-
* }
|
|
1065
1071
|
* ```
|
|
1066
1072
|
*
|
|
1067
1073
|
* Or you can specify a function that receives {@link NavLinkRenderProps} and
|
|
@@ -1074,6 +1080,10 @@ interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "children
|
|
|
1074
1080
|
* ""
|
|
1075
1081
|
* )} />
|
|
1076
1082
|
* ```
|
|
1083
|
+
*
|
|
1084
|
+
* The `transitioning` class is deprecated and only tracks React Router's
|
|
1085
|
+
* legacy view transitions. Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
|
|
1086
|
+
* component instead. See the [migration guide](../../how-to/view-transitions).
|
|
1077
1087
|
*/
|
|
1078
1088
|
className?: string | ((props: NavLinkRenderProps) => string | undefined);
|
|
1079
1089
|
/**
|
|
@@ -1257,9 +1267,14 @@ interface FormProps extends SharedFormProps {
|
|
|
1257
1267
|
*/
|
|
1258
1268
|
state?: any;
|
|
1259
1269
|
/**
|
|
1270
|
+
* **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
|
|
1271
|
+
* component instead. See the [migration guide](../../how-to/view-transitions).
|
|
1272
|
+
*
|
|
1260
1273
|
* Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
1261
1274
|
* for this navigation. To apply specific styles during the transition, see
|
|
1262
1275
|
* {@link useViewTransitionState}.
|
|
1276
|
+
*
|
|
1277
|
+
* @deprecated Use React's `<ViewTransition>` component instead.
|
|
1263
1278
|
*/
|
|
1264
1279
|
viewTransition?: boolean;
|
|
1265
1280
|
}
|
|
@@ -1405,9 +1420,9 @@ declare namespace ScrollRestoration {
|
|
|
1405
1420
|
* @param options.state The state to add to the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
|
|
1406
1421
|
* entry for this navigation. Defaults to `undefined`.
|
|
1407
1422
|
* @param options.target The target attribute for the link. Defaults to `undefined`.
|
|
1408
|
-
* @param options.viewTransition
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1423
|
+
* @param options.viewTransition **Deprecated.** Use React's
|
|
1424
|
+
* [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
|
|
1425
|
+
* instead. See the [migration guide](../../how-to/view-transitions).
|
|
1411
1426
|
* @param options.defaultShouldRevalidate Specify the default revalidation
|
|
1412
1427
|
* behavior for the navigation. When not specified, loaders revalidate
|
|
1413
1428
|
* according to the router's standard revalidation behavior.
|
|
@@ -1435,10 +1450,9 @@ declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to:
|
|
|
1435
1450
|
state?: any;
|
|
1436
1451
|
preventScrollReset?: boolean;
|
|
1437
1452
|
relative?: RelativeRoutingType;
|
|
1438
|
-
viewTransition?: boolean;
|
|
1439
1453
|
defaultShouldRevalidate?: boolean;
|
|
1440
1454
|
useTransitions?: boolean;
|
|
1441
|
-
}): (event: React$1.MouseEvent<E, MouseEvent>) => void;
|
|
1455
|
+
} & Pick<NavigateOptions, "viewTransition">): (event: React$1.MouseEvent<E, MouseEvent>) => void;
|
|
1442
1456
|
/**
|
|
1443
1457
|
* Returns a tuple of the current URL's [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
|
|
1444
1458
|
* and a function to update them. Setting the search params causes a navigation.
|
|
@@ -1662,6 +1676,10 @@ interface FetcherSubmitFunction {
|
|
|
1662
1676
|
* The imperative version of {@link Form | `<Form>`} that lets you submit a form
|
|
1663
1677
|
* from code instead of a user interaction.
|
|
1664
1678
|
*
|
|
1679
|
+
* The `viewTransition` submission option is deprecated. Use React's
|
|
1680
|
+
* [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
|
|
1681
|
+
* instead. See the [migration guide](../../how-to/view-transitions).
|
|
1682
|
+
*
|
|
1665
1683
|
* @example
|
|
1666
1684
|
* import { useSubmit } from "react-router";
|
|
1667
1685
|
*
|
|
@@ -2025,6 +2043,11 @@ declare function usePrompt({
|
|
|
2025
2043
|
message: string;
|
|
2026
2044
|
}): void;
|
|
2027
2045
|
/**
|
|
2046
|
+
* **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
|
|
2047
|
+
* component to style transitions instead. This hook only tracks React Router's
|
|
2048
|
+
* legacy view transitions, not transitions started by React. See the
|
|
2049
|
+
* [migration guide](../../how-to/view-transitions).
|
|
2050
|
+
*
|
|
2028
2051
|
* This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
2029
2052
|
* and the specified location matches either side of the navigation (the URL you are
|
|
2030
2053
|
* navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to
|
|
@@ -2044,6 +2067,8 @@ declare function usePrompt({
|
|
|
2044
2067
|
* more details.
|
|
2045
2068
|
* @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
2046
2069
|
* and the resolved path matches the transition's destination or source pathname, otherwise `false`.
|
|
2070
|
+
*
|
|
2071
|
+
* @deprecated Use React's `<ViewTransition>` component instead.
|
|
2047
2072
|
*/
|
|
2048
2073
|
declare function useViewTransitionState(to: To, {
|
|
2049
2074
|
relative
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,10 +14,10 @@ import { ErrorResponseImpl, SUPPORTED_ERROR_TYPES, defaultMapRouteProperties, jo
|
|
|
14
14
|
import { IDLE_FETCHER, createRouter } from "../router/router.js";
|
|
15
15
|
import { DataRouterNavigationContext, NavigationContext, RouteContext, ViewTransitionContext } from "../context.js";
|
|
16
16
|
import { useBlocker, useCurrentRouteId, useDataRouterContext, useDataRouterFetchers, useDataRouterState, useHref, useLocation, useMatches, useNavigate, useNavigation, useResolvedPath } from "../hooks.js";
|
|
17
|
-
import { Router, hydrationRouteProperties } from "../components.js";
|
|
18
|
-
import { createSearchParams, getFormSubmissionInfo, getSearchParamsForLocation, shouldProcessLinkClick } from "./dom.js";
|
|
19
17
|
import { escapeHtml } from "./ssr/markup.js";
|
|
20
18
|
import { FrameworkContext, PrefetchPageLinks, mergeRefs, usePrefetchBehavior } from "./ssr/components.js";
|
|
19
|
+
import { Router, hydrationRouteProperties } from "../components.js";
|
|
20
|
+
import { createSearchParams, getFormSubmissionInfo, getSearchParamsForLocation, shouldProcessLinkClick } from "./dom.js";
|
|
21
21
|
import * as React$1 from "react";
|
|
22
22
|
//#region lib/dom/lib.tsx
|
|
23
23
|
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
@@ -592,9 +592,9 @@ ScrollRestoration.displayName = "ScrollRestoration";
|
|
|
592
592
|
* @param options.state The state to add to the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
|
|
593
593
|
* entry for this navigation. Defaults to `undefined`.
|
|
594
594
|
* @param options.target The target attribute for the link. Defaults to `undefined`.
|
|
595
|
-
* @param options.viewTransition
|
|
596
|
-
*
|
|
597
|
-
*
|
|
595
|
+
* @param options.viewTransition **Deprecated.** Use React's
|
|
596
|
+
* [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
|
|
597
|
+
* instead. See the [migration guide](../../how-to/view-transitions).
|
|
598
598
|
* @param options.defaultShouldRevalidate Specify the default revalidation
|
|
599
599
|
* behavior for the navigation. When not specified, loaders revalidate
|
|
600
600
|
* according to the router's standard revalidation behavior.
|
|
@@ -756,6 +756,10 @@ let getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
|
756
756
|
* The imperative version of {@link Form | `<Form>`} that lets you submit a form
|
|
757
757
|
* from code instead of a user interaction.
|
|
758
758
|
*
|
|
759
|
+
* The `viewTransition` submission option is deprecated. Use React's
|
|
760
|
+
* [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition) component
|
|
761
|
+
* instead. See the [migration guide](../../how-to/view-transitions).
|
|
762
|
+
*
|
|
759
763
|
* @example
|
|
760
764
|
* import { useSubmit } from "react-router";
|
|
761
765
|
*
|
|
@@ -1235,6 +1239,11 @@ function usePrompt({ when, message }) {
|
|
|
1235
1239
|
}, [blocker, when]);
|
|
1236
1240
|
}
|
|
1237
1241
|
/**
|
|
1242
|
+
* **Deprecated.** Use React's [`<ViewTransition>`](https://react.dev/reference/react/ViewTransition)
|
|
1243
|
+
* component to style transitions instead. This hook only tracks React Router's
|
|
1244
|
+
* legacy view transitions, not transitions started by React. See the
|
|
1245
|
+
* [migration guide](../../how-to/view-transitions).
|
|
1246
|
+
*
|
|
1238
1247
|
* This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
1239
1248
|
* and the specified location matches either side of the navigation (the URL you are
|
|
1240
1249
|
* navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to
|
|
@@ -1254,6 +1263,8 @@ function usePrompt({ when, message }) {
|
|
|
1254
1263
|
* more details.
|
|
1255
1264
|
* @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
|
|
1256
1265
|
* and the resolved path matches the transition's destination or source pathname, otherwise `false`.
|
|
1266
|
+
*
|
|
1267
|
+
* @deprecated Use React's `<ViewTransition>` component instead.
|
|
1257
1268
|
*/
|
|
1258
1269
|
function useViewTransitionState(to, { relative } = {}) {
|
|
1259
1270
|
let vtContext = React$1.useContext(ViewTransitionContext);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,8 +13,8 @@ import { createPath, invariant, parsePath, warning } from "../router/history.js"
|
|
|
13
13
|
import { convertRoutesToDataRoutes, isRouteErrorResponse } from "../router/utils.js";
|
|
14
14
|
import { IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION } from "../router/router.js";
|
|
15
15
|
import { DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, ViewTransitionContext } from "../context.js";
|
|
16
|
-
import { DataRoutes, Router } from "../components.js";
|
|
17
16
|
import { escapeHtml } from "./ssr/markup.js";
|
|
17
|
+
import { DataRoutes, Router } from "../components.js";
|
|
18
18
|
import * as React$1 from "react";
|
|
19
19
|
//#region lib/dom/server.tsx
|
|
20
20
|
/**
|