main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
/// <reference types="node" />
import type { AsyncLocalStorage } from 'async_hooks';
export interface ActionStore {
readonly isAction?: boolean;
readonly isAppRoute?: boolean;
}
export type ActionAsyncStorage = AsyncLocalStorage<ActionStore>;
export declare const actionAsyncStorage: ActionAsyncStorage;

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "actionAsyncStorage", {
enumerable: true,
get: function() {
return actionAsyncStorage;
}
});
const _asynclocalstorage = require("./async-local-storage");
const actionAsyncStorage = (0, _asynclocalstorage.createAsyncLocalStorage)();
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=action-async-storage.external.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/action-async-storage.external.ts"],"names":["actionAsyncStorage","createAsyncLocalStorage"],"mappings":";;;;+BAUaA;;;eAAAA;;;mCAT2B;AASjC,MAAMA,qBAAyCC,IAAAA,0CAAuB"}

View File

@@ -0,0 +1,5 @@
/// <reference types="react" />
import type { FlightRouterState } from '../../server/app-render/types';
export declare function AppRouterAnnouncer({ tree }: {
tree: FlightRouterState;
}): import("react").ReactPortal | null;

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AppRouterAnnouncer", {
enumerable: true,
get: function() {
return AppRouterAnnouncer;
}
});
const _react = require("react");
const _reactdom = require("react-dom");
const ANNOUNCER_TYPE = "next-route-announcer";
const ANNOUNCER_ID = "__next-route-announcer__";
function getAnnouncerNode() {
var _existingAnnouncer_shadowRoot;
const existingAnnouncer = document.getElementsByName(ANNOUNCER_TYPE)[0];
if (existingAnnouncer == null ? void 0 : (_existingAnnouncer_shadowRoot = existingAnnouncer.shadowRoot) == null ? void 0 : _existingAnnouncer_shadowRoot.childNodes[0]) {
return existingAnnouncer.shadowRoot.childNodes[0];
} else {
const container = document.createElement(ANNOUNCER_TYPE);
container.style.cssText = "position:absolute";
const announcer = document.createElement("div");
announcer.ariaLive = "assertive";
announcer.id = ANNOUNCER_ID;
announcer.role = "alert";
announcer.style.cssText = "position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal";
// Use shadow DOM here to avoid any potential CSS bleed
const shadow = container.attachShadow({
mode: "open"
});
shadow.appendChild(announcer);
document.body.appendChild(container);
return announcer;
}
}
function AppRouterAnnouncer(param) {
let { tree } = param;
const [portalNode, setPortalNode] = (0, _react.useState)(null);
(0, _react.useEffect)(()=>{
const announcer = getAnnouncerNode();
setPortalNode(announcer);
return ()=>{
const container = document.getElementsByTagName(ANNOUNCER_TYPE)[0];
if (container == null ? void 0 : container.isConnected) {
document.body.removeChild(container);
}
};
}, []);
const [routeAnnouncement, setRouteAnnouncement] = (0, _react.useState)("");
const previousTitle = (0, _react.useRef)();
(0, _react.useEffect)(()=>{
let currentTitle = "";
if (document.title) {
currentTitle = document.title;
} else {
const pageHeader = document.querySelector("h1");
if (pageHeader) {
currentTitle = pageHeader.innerText || pageHeader.textContent || "";
}
}
// Only announce the title change, but not for the first load because screen
// readers do that automatically.
if (previousTitle.current !== undefined && previousTitle.current !== currentTitle) {
setRouteAnnouncement(currentTitle);
}
previousTitle.current = currentTitle;
}, [
tree
]);
return portalNode ? /*#__PURE__*/ (0, _reactdom.createPortal)(routeAnnouncement, portalNode) : null;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=app-router-announcer.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-announcer.tsx"],"names":["AppRouterAnnouncer","ANNOUNCER_TYPE","ANNOUNCER_ID","getAnnouncerNode","existingAnnouncer","document","getElementsByName","shadowRoot","childNodes","container","createElement","style","cssText","announcer","ariaLive","id","role","shadow","attachShadow","mode","appendChild","body","tree","portalNode","setPortalNode","useState","useEffect","getElementsByTagName","isConnected","removeChild","routeAnnouncement","setRouteAnnouncement","previousTitle","useRef","currentTitle","title","pageHeader","querySelector","innerText","textContent","current","undefined","createPortal"],"mappings":";;;;+BA6BgBA;;;eAAAA;;;uBA7B4B;0BACf;AAG7B,MAAMC,iBAAiB;AACvB,MAAMC,eAAe;AAErB,SAASC;QAEHC;IADJ,MAAMA,oBAAoBC,SAASC,iBAAiB,CAACL,eAAe,CAAC,EAAE;IACvE,IAAIG,sCAAAA,gCAAAA,kBAAmBG,UAAU,qBAA7BH,8BAA+BI,UAAU,CAAC,EAAE,EAAE;QAChD,OAAOJ,kBAAkBG,UAAU,CAACC,UAAU,CAAC,EAAE;IACnD,OAAO;QACL,MAAMC,YAAYJ,SAASK,aAAa,CAACT;QACzCQ,UAAUE,KAAK,CAACC,OAAO,GAAG;QAC1B,MAAMC,YAAYR,SAASK,aAAa,CAAC;QACzCG,UAAUC,QAAQ,GAAG;QACrBD,UAAUE,EAAE,GAAGb;QACfW,UAAUG,IAAI,GAAG;QACjBH,UAAUF,KAAK,CAACC,OAAO,GACrB;QAEF,uDAAuD;QACvD,MAAMK,SAASR,UAAUS,YAAY,CAAC;YAAEC,MAAM;QAAO;QACrDF,OAAOG,WAAW,CAACP;QACnBR,SAASgB,IAAI,CAACD,WAAW,CAACX;QAC1B,OAAOI;IACT;AACF;AAEO,SAASb,mBAAmB,KAAqC;IAArC,IAAA,EAAEsB,IAAI,EAA+B,GAArC;IACjC,MAAM,CAACC,YAAYC,cAAc,GAAGC,IAAAA,eAAQ,EAAqB;IAEjEC,IAAAA,gBAAS,EAAC;QACR,MAAMb,YAAYV;QAClBqB,cAAcX;QACd,OAAO;YACL,MAAMJ,YAAYJ,SAASsB,oBAAoB,CAAC1B,eAAe,CAAC,EAAE;YAClE,IAAIQ,6BAAAA,UAAWmB,WAAW,EAAE;gBAC1BvB,SAASgB,IAAI,CAACQ,WAAW,CAACpB;YAC5B;QACF;IACF,GAAG,EAAE;IAEL,MAAM,CAACqB,mBAAmBC,qBAAqB,GAAGN,IAAAA,eAAQ,EAAC;IAC3D,MAAMO,gBAAgBC,IAAAA,aAAM;IAE5BP,IAAAA,gBAAS,EAAC;QACR,IAAIQ,eAAe;QACnB,IAAI7B,SAAS8B,KAAK,EAAE;YAClBD,eAAe7B,SAAS8B,KAAK;QAC/B,OAAO;YACL,MAAMC,aAAa/B,SAASgC,aAAa,CAAC;YAC1C,IAAID,YAAY;gBACdF,eAAeE,WAAWE,SAAS,IAAIF,WAAWG,WAAW,IAAI;YACnE;QACF;QAEA,4EAA4E;QAC5E,iCAAiC;QACjC,IACEP,cAAcQ,OAAO,KAAKC,aAC1BT,cAAcQ,OAAO,KAAKN,cAC1B;YACAH,qBAAqBG;QACvB;QACAF,cAAcQ,OAAO,GAAGN;IAC1B,GAAG;QAACZ;KAAK;IAET,OAAOC,2BAAamB,IAAAA,sBAAY,EAACZ,mBAAmBP,cAAc;AACpE"}

View File

@@ -0,0 +1,9 @@
export declare const RSC: "RSC";
export declare const ACTION: "Next-Action";
export declare const NEXT_ROUTER_STATE_TREE: "Next-Router-State-Tree";
export declare const NEXT_ROUTER_PREFETCH: "Next-Router-Prefetch";
export declare const NEXT_URL: "Next-Url";
export declare const RSC_CONTENT_TYPE_HEADER: "text/x-component";
export declare const RSC_VARY_HEADER: "RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Url";
export declare const FLIGHT_PARAMETERS: readonly [readonly ["RSC"], readonly ["Next-Router-State-Tree"], readonly ["Next-Router-Prefetch"]];
export declare const NEXT_RSC_UNION_QUERY: "_rsc";

View File

@@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
RSC: null,
ACTION: null,
NEXT_ROUTER_STATE_TREE: null,
NEXT_ROUTER_PREFETCH: null,
NEXT_URL: null,
RSC_CONTENT_TYPE_HEADER: null,
RSC_VARY_HEADER: null,
FLIGHT_PARAMETERS: null,
NEXT_RSC_UNION_QUERY: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
RSC: function() {
return RSC;
},
ACTION: function() {
return ACTION;
},
NEXT_ROUTER_STATE_TREE: function() {
return NEXT_ROUTER_STATE_TREE;
},
NEXT_ROUTER_PREFETCH: function() {
return NEXT_ROUTER_PREFETCH;
},
NEXT_URL: function() {
return NEXT_URL;
},
RSC_CONTENT_TYPE_HEADER: function() {
return RSC_CONTENT_TYPE_HEADER;
},
RSC_VARY_HEADER: function() {
return RSC_VARY_HEADER;
},
FLIGHT_PARAMETERS: function() {
return FLIGHT_PARAMETERS;
},
NEXT_RSC_UNION_QUERY: function() {
return NEXT_RSC_UNION_QUERY;
}
});
const RSC = "RSC";
const ACTION = "Next-Action";
const NEXT_ROUTER_STATE_TREE = "Next-Router-State-Tree";
const NEXT_ROUTER_PREFETCH = "Next-Router-Prefetch";
const NEXT_URL = "Next-Url";
const RSC_CONTENT_TYPE_HEADER = "text/x-component";
const RSC_VARY_HEADER = RSC + ", " + NEXT_ROUTER_STATE_TREE + ", " + NEXT_ROUTER_PREFETCH + ", " + NEXT_URL;
const FLIGHT_PARAMETERS = [
[
RSC
],
[
NEXT_ROUTER_STATE_TREE
],
[
NEXT_ROUTER_PREFETCH
]
];
const NEXT_RSC_UNION_QUERY = "_rsc";
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=app-router-headers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/app-router-headers.ts"],"names":["RSC","ACTION","NEXT_ROUTER_STATE_TREE","NEXT_ROUTER_PREFETCH","NEXT_URL","RSC_CONTENT_TYPE_HEADER","RSC_VARY_HEADER","FLIGHT_PARAMETERS","NEXT_RSC_UNION_QUERY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;IAAaA,GAAG;eAAHA;;IACAC,MAAM;eAANA;;IAEAC,sBAAsB;eAAtBA;;IACAC,oBAAoB;eAApBA;;IACAC,QAAQ;eAARA;;IACAC,uBAAuB;eAAvBA;;IACAC,eAAe;eAAfA;;IAGAC,iBAAiB;eAAjBA;;IAMAC,oBAAoB;eAApBA;;;AAhBN,MAAMR,MAAM;AACZ,MAAMC,SAAS;AAEf,MAAMC,yBAAyB;AAC/B,MAAMC,uBAAuB;AAC7B,MAAMC,WAAW;AACjB,MAAMC,0BAA0B;AAChC,MAAMC,kBACX,AAAGN,MAAI,OAAIE,yBAAuB,OAAIC,uBAAqB,OAAIC;AAE1D,MAAMG,oBAAoB;IAC/B;QAACP;KAAI;IACL;QAACE;KAAuB;IACxB;QAACC;KAAqB;CACvB;AAEM,MAAMK,uBAAuB"}

View File

@@ -0,0 +1,16 @@
import type { ReactNode } from 'react';
import React from 'react';
import type { ErrorComponent } from './error-boundary';
import { ServerActionDispatcher } from './router-reducer/router-reducer-types';
import { InitialRouterStateParameters } from './router-reducer/create-initial-router-state';
export declare function getServerActionDispatcher(): ServerActionDispatcher | null;
export declare function urlToUrlWithoutFlightMarker(url: string): URL;
type AppRouterProps = Omit<Omit<InitialRouterStateParameters, 'isServer' | 'location'>, 'initialParallelRoutes'> & {
buildId: string;
initialHead: ReactNode;
assetPrefix: string;
};
export default function AppRouter(props: AppRouterProps & {
globalErrorComponent: ErrorComponent;
}): React.JSX.Element;
export {};

456
node_modules/next/dist/client/components/app-router.js generated vendored Normal file
View File

@@ -0,0 +1,456 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getServerActionDispatcher: null,
urlToUrlWithoutFlightMarker: null,
default: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getServerActionDispatcher: function() {
return getServerActionDispatcher;
},
urlToUrlWithoutFlightMarker: function() {
return urlToUrlWithoutFlightMarker;
},
default: function() {
return AppRouter;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
const _routerreducer = require("./router-reducer/router-reducer");
const _routerreducertypes = require("./router-reducer/router-reducer-types");
const _createhreffromurl = require("./router-reducer/create-href-from-url");
const _hooksclientcontextsharedruntime = require("../../shared/lib/hooks-client-context.shared-runtime");
const _usereducerwithdevtools = require("./use-reducer-with-devtools");
const _errorboundary = require("./error-boundary");
const _createinitialrouterstate = require("./router-reducer/create-initial-router-state");
const _isbot = require("../../shared/lib/router/utils/is-bot");
const _addbasepath = require("../add-base-path");
const _approuterannouncer = require("./app-router-announcer");
const _redirectboundary = require("./redirect-boundary");
const _findheadincache = require("./router-reducer/reducers/find-head-in-cache");
const _infinitepromise = require("./infinite-promise");
const _approuterheaders = require("./app-router-headers");
const _removebasepath = require("../remove-base-path");
const _hasbasepath = require("../has-base-path");
const isServer = typeof window === "undefined";
// Ensure the initialParallelRoutes are not combined because of double-rendering in the browser with Strict Mode.
let initialParallelRoutes = isServer ? null : new Map();
let globalServerActionDispatcher = null;
function getServerActionDispatcher() {
return globalServerActionDispatcher;
}
let globalMutable = {
refresh: ()=>{}
};
function urlToUrlWithoutFlightMarker(url) {
const urlWithoutFlightParameters = new URL(url, location.origin);
urlWithoutFlightParameters.searchParams.delete(_approuterheaders.NEXT_RSC_UNION_QUERY);
if (process.env.NODE_ENV === "production") {
if (process.env.__NEXT_CONFIG_OUTPUT === "export" && urlWithoutFlightParameters.pathname.endsWith(".txt")) {
const { pathname } = urlWithoutFlightParameters;
const length = pathname.endsWith("/index.txt") ? 10 : 4;
// Slice off `/index.txt` or `.txt` from the end of the pathname
urlWithoutFlightParameters.pathname = pathname.slice(0, -length);
}
}
return urlWithoutFlightParameters;
}
function isExternalURL(url) {
return url.origin !== window.location.origin;
}
function HistoryUpdater(param) {
let { tree, pushRef, canonicalUrl, sync } = param;
(0, _react.useInsertionEffect)(()=>{
// Identifier is shortened intentionally.
// __NA is used to identify if the history entry can be handled by the app-router.
// __N is used to identify if the history entry can be handled by the old router.
const historyState = {
__NA: true,
tree
};
if (pushRef.pendingPush && (0, _createhreffromurl.createHrefFromUrl)(new URL(window.location.href)) !== canonicalUrl) {
// This intentionally mutates React state, pushRef is overwritten to ensure additional push/replace calls do not trigger an additional history entry.
pushRef.pendingPush = false;
window.history.pushState(historyState, "", canonicalUrl);
} else {
window.history.replaceState(historyState, "", canonicalUrl);
}
sync();
}, [
tree,
pushRef,
canonicalUrl,
sync
]);
return null;
}
const createEmptyCacheNode = ()=>({
status: _approutercontextsharedruntime.CacheStates.LAZY_INITIALIZED,
data: null,
subTreeData: null,
parallelRoutes: new Map()
});
function useServerActionDispatcher(dispatch) {
const serverActionDispatcher = (0, _react.useCallback)((actionPayload)=>{
(0, _react.startTransition)(()=>{
dispatch({
...actionPayload,
type: _routerreducertypes.ACTION_SERVER_ACTION,
mutable: {
globalMutable
},
cache: createEmptyCacheNode()
});
});
}, [
dispatch
]);
globalServerActionDispatcher = serverActionDispatcher;
}
/**
* Server response that only patches the cache and tree.
*/ function useChangeByServerResponse(dispatch) {
return (0, _react.useCallback)((previousTree, flightData, overrideCanonicalUrl)=>{
(0, _react.startTransition)(()=>{
dispatch({
type: _routerreducertypes.ACTION_SERVER_PATCH,
flightData,
previousTree,
overrideCanonicalUrl,
cache: createEmptyCacheNode(),
mutable: {
globalMutable
}
});
});
}, [
dispatch
]);
}
function useNavigate(dispatch) {
return (0, _react.useCallback)((href, navigateType, forceOptimisticNavigation, shouldScroll)=>{
const url = new URL((0, _addbasepath.addBasePath)(href), location.href);
globalMutable.pendingNavigatePath = href;
return dispatch({
type: _routerreducertypes.ACTION_NAVIGATE,
url,
isExternalUrl: isExternalURL(url),
locationSearch: location.search,
forceOptimisticNavigation,
shouldScroll: shouldScroll != null ? shouldScroll : true,
navigateType,
cache: createEmptyCacheNode(),
mutable: {
globalMutable
}
});
}, [
dispatch
]);
}
/**
* The global router that wraps the application components.
*/ function Router(param) {
let { buildId, initialHead, initialTree, initialCanonicalUrl, children, assetPrefix } = param;
const initialState = (0, _react.useMemo)(()=>(0, _createinitialrouterstate.createInitialRouterState)({
buildId,
children,
initialCanonicalUrl,
initialTree,
initialParallelRoutes,
isServer,
location: !isServer ? window.location : null,
initialHead
}), [
buildId,
children,
initialCanonicalUrl,
initialTree,
initialHead
]);
const [{ tree, cache, prefetchCache, pushRef, focusAndScrollRef, canonicalUrl, nextUrl }, dispatch, sync] = (0, _usereducerwithdevtools.useReducerWithReduxDevtools)(_routerreducer.reducer, initialState);
(0, _react.useEffect)(()=>{
// Ensure initialParallelRoutes is cleaned up from memory once it's used.
initialParallelRoutes = null;
}, []);
// Add memoized pathname/query for useSearchParams and usePathname.
const { searchParams, pathname } = (0, _react.useMemo)(()=>{
const url = new URL(canonicalUrl, typeof window === "undefined" ? "http://n" : window.location.href);
return {
// This is turned into a readonly class in `useSearchParams`
searchParams: url.searchParams,
pathname: (0, _hasbasepath.hasBasePath)(url.pathname) ? (0, _removebasepath.removeBasePath)(url.pathname) : url.pathname
};
}, [
canonicalUrl
]);
const changeByServerResponse = useChangeByServerResponse(dispatch);
const navigate = useNavigate(dispatch);
useServerActionDispatcher(dispatch);
/**
* The app router that is exposed through `useRouter`. It's only concerned with dispatching actions to the reducer, does not hold state.
*/ const appRouter = (0, _react.useMemo)(()=>{
const routerInstance = {
back: ()=>window.history.back(),
forward: ()=>window.history.forward(),
prefetch: (href, options)=>{
// Don't prefetch for bots as they don't navigate.
// Don't prefetch during development (improves compilation performance)
if ((0, _isbot.isBot)(window.navigator.userAgent) || process.env.NODE_ENV === "development") {
return;
}
const url = new URL((0, _addbasepath.addBasePath)(href), location.href);
// External urls can't be prefetched in the same way.
if (isExternalURL(url)) {
return;
}
(0, _react.startTransition)(()=>{
var _options_kind;
dispatch({
type: _routerreducertypes.ACTION_PREFETCH,
url,
kind: (_options_kind = options == null ? void 0 : options.kind) != null ? _options_kind : _routerreducertypes.PrefetchKind.FULL
});
});
},
replace: (href, options)=>{
if (options === void 0) options = {};
(0, _react.startTransition)(()=>{
var _options_scroll;
navigate(href, "replace", Boolean(options.forceOptimisticNavigation), (_options_scroll = options.scroll) != null ? _options_scroll : true);
});
},
push: (href, options)=>{
if (options === void 0) options = {};
(0, _react.startTransition)(()=>{
var _options_scroll;
navigate(href, "push", Boolean(options.forceOptimisticNavigation), (_options_scroll = options.scroll) != null ? _options_scroll : true);
});
},
refresh: ()=>{
(0, _react.startTransition)(()=>{
dispatch({
type: _routerreducertypes.ACTION_REFRESH,
cache: createEmptyCacheNode(),
mutable: {
globalMutable
},
origin: window.location.origin
});
});
},
// @ts-ignore we don't want to expose this method at all
fastRefresh: ()=>{
if (process.env.NODE_ENV !== "development") {
throw new Error("fastRefresh can only be used in development mode. Please use refresh instead.");
} else {
(0, _react.startTransition)(()=>{
dispatch({
type: _routerreducertypes.ACTION_FAST_REFRESH,
cache: createEmptyCacheNode(),
mutable: {
globalMutable
},
origin: window.location.origin
});
});
}
}
};
return routerInstance;
}, [
dispatch,
navigate
]);
(0, _react.useEffect)(()=>{
// Exists for debugging purposes. Don't use in application code.
if (window.next) {
window.next.router = appRouter;
}
}, [
appRouter
]);
(0, _react.useEffect)(()=>{
globalMutable.refresh = appRouter.refresh;
}, [
appRouter.refresh
]);
if (process.env.NODE_ENV !== "production") {
// This hook is in a conditional but that is ok because `process.env.NODE_ENV` never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
(0, _react.useEffect)(()=>{
// Add `window.nd` for debugging purposes.
// This is not meant for use in applications as concurrent rendering will affect the cache/tree/router.
// @ts-ignore this is for debugging
window.nd = {
router: appRouter,
cache,
prefetchCache,
tree
};
}, [
appRouter,
cache,
prefetchCache,
tree
]);
}
(0, _react.useEffect)(()=>{
// If the app is restored from bfcache, it's possible that
// pushRef.mpaNavigation is true, which would mean that any re-render of this component
// would trigger the mpa navigation logic again from the lines below.
// This will restore the router to the initial state in the event that the app is restored from bfcache.
function handlePageShow(event) {
var _window_history_state;
if (!event.persisted || !((_window_history_state = window.history.state) == null ? void 0 : _window_history_state.tree)) return;
dispatch({
type: _routerreducertypes.ACTION_RESTORE,
url: new URL(window.location.href),
tree: window.history.state.tree
});
}
window.addEventListener("pageshow", handlePageShow);
return ()=>{
window.removeEventListener("pageshow", handlePageShow);
};
}, [
dispatch
]);
// When mpaNavigation flag is set do a hard navigation to the new url.
// Infinitely suspend because we don't actually want to rerender any child
// components with the new URL and any entangled state updates shouldn't
// commit either (eg: useTransition isPending should stay true until the page
// unloads).
//
// This is a side effect in render. Don't try this at home, kids. It's
// probably safe because we know this is a singleton component and it's never
// in <Offscreen>. At least I hope so. (It will run twice in dev strict mode,
// but that's... fine?)
if (pushRef.mpaNavigation) {
// if there's a re-render, we don't want to trigger another redirect if one is already in flight to the same URL
if (globalMutable.pendingMpaPath !== canonicalUrl) {
const location1 = window.location;
if (pushRef.pendingPush) {
location1.assign(canonicalUrl);
} else {
location1.replace(canonicalUrl);
}
globalMutable.pendingMpaPath = canonicalUrl;
}
// TODO-APP: Should we listen to navigateerror here to catch failed
// navigations somehow? And should we call window.stop() if a SPA navigation
// should interrupt an MPA one?
(0, _react.use)((0, _infinitepromise.createInfinitePromise)());
}
/**
* Handle popstate event, this is used to handle back/forward in the browser.
* By default dispatches ACTION_RESTORE, however if the history entry was not pushed/replaced by app-router it will reload the page.
* That case can happen when the old router injected the history entry.
*/ const onPopState = (0, _react.useCallback)((param)=>{
let { state } = param;
if (!state) {
// TODO-APP: this case only happens when pushState/replaceState was called outside of Next.js. It should probably reload the page in this case.
return;
}
// This case happens when the history entry was pushed by the `pages` router.
if (!state.__NA) {
window.location.reload();
return;
}
// @ts-ignore useTransition exists
// TODO-APP: Ideally the back button should not use startTransition as it should apply the updates synchronously
// Without startTransition works if the cache is there for this path
(0, _react.startTransition)(()=>{
dispatch({
type: _routerreducertypes.ACTION_RESTORE,
url: new URL(window.location.href),
tree: state.tree
});
});
}, [
dispatch
]);
// Register popstate event to call onPopstate.
(0, _react.useEffect)(()=>{
window.addEventListener("popstate", onPopState);
return ()=>{
window.removeEventListener("popstate", onPopState);
};
}, [
onPopState
]);
const head = (0, _react.useMemo)(()=>{
return (0, _findheadincache.findHeadInCache)(cache, tree[1]);
}, [
cache,
tree
]);
let content = /*#__PURE__*/ _react.default.createElement(_redirectboundary.RedirectBoundary, null, head, cache.subTreeData, /*#__PURE__*/ _react.default.createElement(_approuterannouncer.AppRouterAnnouncer, {
tree: tree
}));
if (process.env.NODE_ENV !== "production") {
if (typeof window !== "undefined") {
const DevRootNotFoundBoundary = require("./dev-root-not-found-boundary").DevRootNotFoundBoundary;
content = /*#__PURE__*/ _react.default.createElement(DevRootNotFoundBoundary, null, content);
}
const HotReloader = require("./react-dev-overlay/hot-reloader-client").default;
content = /*#__PURE__*/ _react.default.createElement(HotReloader, {
assetPrefix: assetPrefix
}, content);
}
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(HistoryUpdater, {
tree: tree,
pushRef: pushRef,
canonicalUrl: canonicalUrl,
sync: sync
}), /*#__PURE__*/ _react.default.createElement(_hooksclientcontextsharedruntime.PathnameContext.Provider, {
value: pathname
}, /*#__PURE__*/ _react.default.createElement(_hooksclientcontextsharedruntime.SearchParamsContext.Provider, {
value: searchParams
}, /*#__PURE__*/ _react.default.createElement(_approutercontextsharedruntime.GlobalLayoutRouterContext.Provider, {
value: {
buildId,
changeByServerResponse,
tree,
focusAndScrollRef,
nextUrl
}
}, /*#__PURE__*/ _react.default.createElement(_approutercontextsharedruntime.AppRouterContext.Provider, {
value: appRouter
}, /*#__PURE__*/ _react.default.createElement(_approutercontextsharedruntime.LayoutRouterContext.Provider, {
value: {
childNodes: cache.parallelRoutes,
tree: tree,
// Root node always has `url`
// Provided in AppTreeContext to ensure it can be overwritten in layout-router
url: canonicalUrl
}
}, content))))));
}
function AppRouter(props) {
const { globalErrorComponent, ...rest } = props;
return /*#__PURE__*/ _react.default.createElement(_errorboundary.ErrorBoundary, {
errorComponent: globalErrorComponent
}, /*#__PURE__*/ _react.default.createElement(Router, rest));
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=app-router.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
/// <reference types="node" />
import type { AsyncLocalStorage } from 'async_hooks';
export declare function createAsyncLocalStorage<Store extends {}>(): AsyncLocalStorage<Store>;

View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createAsyncLocalStorage", {
enumerable: true,
get: function() {
return createAsyncLocalStorage;
}
});
const sharedAsyncLocalStorageNotAvailableError = new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");
class FakeAsyncLocalStorage {
disable() {
throw sharedAsyncLocalStorageNotAvailableError;
}
getStore() {
// This fake implementation of AsyncLocalStorage always returns `undefined`.
return undefined;
}
run() {
throw sharedAsyncLocalStorageNotAvailableError;
}
exit() {
throw sharedAsyncLocalStorageNotAvailableError;
}
enterWith() {
throw sharedAsyncLocalStorageNotAvailableError;
}
}
const maybeGlobalAsyncLocalStorage = globalThis.AsyncLocalStorage;
function createAsyncLocalStorage() {
if (maybeGlobalAsyncLocalStorage) {
return new maybeGlobalAsyncLocalStorage();
}
return new FakeAsyncLocalStorage();
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=async-local-storage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/async-local-storage.ts"],"names":["createAsyncLocalStorage","sharedAsyncLocalStorageNotAvailableError","Error","FakeAsyncLocalStorage","disable","getStore","undefined","run","exit","enterWith","maybeGlobalAsyncLocalStorage","globalThis","AsyncLocalStorage"],"mappings":";;;;+BAiCgBA;;;eAAAA;;;AA/BhB,MAAMC,2CAA2C,IAAIC,MACnD;AAGF,MAAMC;IAGJC,UAAgB;QACd,MAAMH;IACR;IAEAI,WAA8B;QAC5B,4EAA4E;QAC5E,OAAOC;IACT;IAEAC,MAAY;QACV,MAAMN;IACR;IAEAO,OAAa;QACX,MAAMP;IACR;IAEAQ,YAAkB;QAChB,MAAMR;IACR;AACF;AAEA,MAAMS,+BAA+B,AAACC,WAAmBC,iBAAiB;AAEnE,SAASZ;IAGd,IAAIU,8BAA8B;QAChC,OAAO,IAAIA;IACb;IACA,OAAO,IAAIP;AACb"}

View File

@@ -0,0 +1 @@
export declare function bailoutToClientRendering(): boolean | never;

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "bailoutToClientRendering", {
enumerable: true,
get: function() {
return bailoutToClientRendering;
}
});
const _dynamicnossr = require("../../shared/lib/lazy-dynamic/dynamic-no-ssr");
const _staticgenerationasyncstorageexternal = require("./static-generation-async-storage.external");
function bailoutToClientRendering() {
const staticGenerationStore = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
if (staticGenerationStore == null ? void 0 : staticGenerationStore.forceStatic) {
return true;
}
if (staticGenerationStore == null ? void 0 : staticGenerationStore.isStaticGeneration) {
(0, _dynamicnossr.suspense)();
}
return false;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=bailout-to-client-rendering.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/bailout-to-client-rendering.ts"],"names":["bailoutToClientRendering","staticGenerationStore","staticGenerationAsyncStorage","getStore","forceStatic","isStaticGeneration","suspense"],"mappings":";;;;+BAGgBA;;;eAAAA;;;8BAHS;sDACoB;AAEtC,SAASA;IACd,MAAMC,wBAAwBC,kEAA4B,CAACC,QAAQ;IAEnE,IAAIF,yCAAAA,sBAAuBG,WAAW,EAAE;QACtC,OAAO;IACT;IAEA,IAAIH,yCAAAA,sBAAuBI,kBAAkB,EAAE;QAC7CC,IAAAA,sBAAQ;IACV;IAEA,OAAO;AACT"}

View File

@@ -0,0 +1 @@
export declare function clientHookInServerComponentError(hookName: string): void | never;

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "clientHookInServerComponentError", {
enumerable: true,
get: function() {
return clientHookInServerComponentError;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
function clientHookInServerComponentError(hookName) {
if (process.env.NODE_ENV !== "production") {
// If useState is undefined we're in a server component
if (!_react.default.useState) {
throw new Error("" + hookName + ' only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component');
}
}
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=client-hook-in-server-component-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/client-hook-in-server-component-error.ts"],"names":["clientHookInServerComponentError","hookName","process","env","NODE_ENV","React","useState","Error"],"mappings":";;;;+BAEgBA;;;eAAAA;;;;gEAFE;AAEX,SAASA,iCACdC,QAAgB;IAEhB,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,uDAAuD;QACvD,IAAI,CAACC,cAAK,CAACC,QAAQ,EAAE;YACnB,MAAM,IAAIC,MACR,AAAC,KAAEN,WAAS;QAEhB;IACF;AACF"}

View File

@@ -0,0 +1,4 @@
import React from 'react';
export default function DefaultLayout({ children, }: {
children: React.ReactNode;
}): React.JSX.Element;

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return DefaultLayout;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
function DefaultLayout(param) {
let { children } = param;
return /*#__PURE__*/ _react.default.createElement("html", null, /*#__PURE__*/ _react.default.createElement("body", null, children));
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=default-layout.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/default-layout.tsx"],"names":["DefaultLayout","children","html","body"],"mappings":";;;;+BAEA;;;eAAwBA;;;;gEAFN;AAEH,SAASA,cAAc,KAIrC;IAJqC,IAAA,EACpCC,QAAQ,EAGT,GAJqC;IAKpC,qBACE,6BAACC,4BACC,6BAACC,cAAMF;AAGb"}

View File

@@ -0,0 +1,5 @@
import React from 'react';
export declare function bailOnNotFound(): void;
export declare function DevRootNotFoundBoundary({ children, }: {
children: React.ReactNode;
}): React.JSX.Element;

View File

@@ -0,0 +1,48 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
bailOnNotFound: null,
DevRootNotFoundBoundary: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
bailOnNotFound: function() {
return bailOnNotFound;
},
DevRootNotFoundBoundary: function() {
return DevRootNotFoundBoundary;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const _notfoundboundary = require("./not-found-boundary");
function bailOnNotFound() {
throw new Error("notFound() is not allowed to use in root layout");
}
function NotAllowedRootNotFoundError() {
bailOnNotFound();
return null;
}
function DevRootNotFoundBoundary(param) {
let { children } = param;
return /*#__PURE__*/ _react.default.createElement(_notfoundboundary.NotFoundBoundary, {
notFound: /*#__PURE__*/ _react.default.createElement(NotAllowedRootNotFoundError, null)
}, children);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=dev-root-not-found-boundary.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/dev-root-not-found-boundary.tsx"],"names":["bailOnNotFound","DevRootNotFoundBoundary","Error","NotAllowedRootNotFoundError","children","NotFoundBoundary","notFound"],"mappings":"AAAA;;;;;;;;;;;;;;;;IAKgBA,cAAc;eAAdA;;IASAC,uBAAuB;eAAvBA;;;;gEAZE;kCACe;AAE1B,SAASD;IACd,MAAM,IAAIE,MAAM;AAClB;AAEA,SAASC;IACPH;IACA,OAAO;AACT;AAEO,SAASC,wBAAwB,KAIvC;IAJuC,IAAA,EACtCG,QAAQ,EAGT,GAJuC;IAKtC,qBACE,6BAACC,kCAAgB;QAACC,wBAAU,6BAACH;OAC1BC;AAGP"}

View File

@@ -0,0 +1,7 @@
import type { DraftModeProvider } from '../../server/async-storage/draft-mode-provider';
export declare class DraftMode {
constructor(provider: DraftModeProvider);
get isEnabled(): boolean;
enable(): void;
disable(): void;
}

39
node_modules/next/dist/client/components/draft-mode.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DraftMode", {
enumerable: true,
get: function() {
return DraftMode;
}
});
const _staticgenerationbailout = require("./static-generation-bailout");
class DraftMode {
get isEnabled() {
return this._provider.isEnabled;
}
enable() {
if ((0, _staticgenerationbailout.staticGenerationBailout)("draftMode().enable()")) {
return;
}
return this._provider.enable();
}
disable() {
if ((0, _staticgenerationbailout.staticGenerationBailout)("draftMode().disable()")) {
return;
}
return this._provider.disable();
}
constructor(provider){
this._provider = provider;
}
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=draft-mode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/draft-mode.ts"],"names":["DraftMode","isEnabled","_provider","enable","staticGenerationBailout","disable","constructor","provider"],"mappings":";;;;+BAIaA;;;eAAAA;;;yCAF2B;AAEjC,MAAMA;IASX,IAAIC,YAAY;QACd,OAAO,IAAI,CAACC,SAAS,CAACD,SAAS;IACjC;IACOE,SAAS;QACd,IAAIC,IAAAA,gDAAuB,EAAC,yBAAyB;YACnD;QACF;QACA,OAAO,IAAI,CAACF,SAAS,CAACC,MAAM;IAC9B;IACOE,UAAU;QACf,IAAID,IAAAA,gDAAuB,EAAC,0BAA0B;YACpD;QACF;QACA,OAAO,IAAI,CAACF,SAAS,CAACG,OAAO;IAC/B;IAjBAC,YAAYC,QAA2B,CAAE;QACvC,IAAI,CAACL,SAAS,GAAGK;IACnB;AAgBF"}

View File

@@ -0,0 +1,42 @@
/// <reference types="react/experimental" />
import React from 'react';
export type ErrorComponent = React.ComponentType<{
error: Error;
reset: () => void;
}>;
export interface ErrorBoundaryProps {
children?: React.ReactNode;
errorComponent: ErrorComponent;
errorStyles?: React.ReactNode | undefined;
}
interface ErrorBoundaryHandlerProps extends ErrorBoundaryProps {
pathname: string;
}
interface ErrorBoundaryHandlerState {
error: Error | null;
previousPathname: string;
}
export declare class ErrorBoundaryHandler extends React.Component<ErrorBoundaryHandlerProps, ErrorBoundaryHandlerState> {
constructor(props: ErrorBoundaryHandlerProps);
static getDerivedStateFromError(error: Error): {
error: Error;
};
static getDerivedStateFromProps(props: ErrorBoundaryHandlerProps, state: ErrorBoundaryHandlerState): ErrorBoundaryHandlerState | null;
reset: () => void;
render(): string | number | boolean | React.ReactFragment | React.PromiseLikeOfReactNode | React.JSX.Element | null | undefined;
}
export declare function GlobalError({ error }: {
error: any;
}): React.JSX.Element;
export default GlobalError;
/**
* Handles errors through `getDerivedStateFromError`.
* Renders the provided error component and provides a way to `reset` the error boundary state.
*/
/**
* Renders error boundary with the provided "errorComponent" property as the fallback.
* If no "errorComponent" property is provided it renders the children without an error boundary.
*/
export declare function ErrorBoundary({ errorComponent, errorStyles, children, }: ErrorBoundaryProps & {
children: React.ReactNode;
}): JSX.Element;

View File

@@ -0,0 +1,134 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ErrorBoundaryHandler: null,
GlobalError: null,
default: null,
ErrorBoundary: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ErrorBoundaryHandler: function() {
return ErrorBoundaryHandler;
},
GlobalError: function() {
return GlobalError;
},
// Exported so that the import signature in the loaders can be identical to user
// supplied custom global error signatures.
default: function() {
return _default;
},
ErrorBoundary: function() {
return ErrorBoundary;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const _navigation = require("./navigation");
const styles = {
error: {
// https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52
fontFamily: 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
height: "100vh",
textAlign: "center",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
},
text: {
fontSize: "14px",
fontWeight: 400,
lineHeight: "28px",
margin: "0 8px"
}
};
class ErrorBoundaryHandler extends _react.default.Component {
static getDerivedStateFromError(error) {
return {
error
};
}
static getDerivedStateFromProps(props, state) {
/**
* Handles reset of the error boundary when a navigation happens.
* Ensures the error boundary does not stay enabled when navigating to a new page.
* Approach of setState in render is safe as it checks the previous pathname and then overrides
* it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders
*/ if (props.pathname !== state.previousPathname && state.error) {
return {
error: null,
previousPathname: props.pathname
};
}
return {
error: state.error,
previousPathname: props.pathname
};
}
render() {
if (this.state.error) {
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, this.props.errorStyles, /*#__PURE__*/ _react.default.createElement(this.props.errorComponent, {
error: this.state.error,
reset: this.reset
}));
}
return this.props.children;
}
constructor(props){
super(props);
this.reset = ()=>{
this.setState({
error: null
});
};
this.state = {
error: null,
previousPathname: this.props.pathname
};
}
}
function GlobalError(param) {
let { error } = param;
const digest = error == null ? void 0 : error.digest;
return /*#__PURE__*/ _react.default.createElement("html", {
id: "__next_error__"
}, /*#__PURE__*/ _react.default.createElement("head", null), /*#__PURE__*/ _react.default.createElement("body", null, /*#__PURE__*/ _react.default.createElement("div", {
style: styles.error
}, /*#__PURE__*/ _react.default.createElement("div", null, /*#__PURE__*/ _react.default.createElement("h2", {
style: styles.text
}, "Application error: a " + (digest ? "server" : "client") + "-side exception has occurred (see the " + (digest ? "server logs" : "browser console") + " for more information)."), digest ? /*#__PURE__*/ _react.default.createElement("p", {
style: styles.text
}, "Digest: " + digest) : null))));
}
const _default = GlobalError;
function ErrorBoundary(param) {
let { errorComponent, errorStyles, children } = param;
const pathname = (0, _navigation.usePathname)();
if (errorComponent) {
return /*#__PURE__*/ _react.default.createElement(ErrorBoundaryHandler, {
pathname: pathname,
errorComponent: errorComponent,
errorStyles: errorStyles
}, children);
}
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, children);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=error-boundary.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/error-boundary.tsx"],"names":["ErrorBoundaryHandler","GlobalError","ErrorBoundary","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","text","fontSize","fontWeight","lineHeight","margin","React","Component","getDerivedStateFromError","getDerivedStateFromProps","props","state","pathname","previousPathname","render","errorStyles","this","errorComponent","reset","children","constructor","setState","digest","html","id","head","body","div","style","h2","p","usePathname"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;IA6CaA,oBAAoB;eAApBA;;IAwDGC,WAAW;eAAXA;;IAuBhB,gFAAgF;IAChF,2CAA2C;IAC3C,OAA0B;eAA1B;;IAWgBC,aAAa;eAAbA;;;;gEAvIE;4BACU;AAE5B,MAAMC,SAAS;IACbC,OAAO;QACL,0FAA0F;QAC1FC,YACE;QACFC,QAAQ;QACRC,WAAW;QACXC,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,gBAAgB;IAClB;IACAC,MAAM;QACJC,UAAU;QACVC,YAAY;QACZC,YAAY;QACZC,QAAQ;IACV;AACF;AAsBO,MAAMhB,6BAA6BiB,cAAK,CAACC,SAAS;IASvD,OAAOC,yBAAyBf,KAAY,EAAE;QAC5C,OAAO;YAAEA;QAAM;IACjB;IAEA,OAAOgB,yBACLC,KAAgC,EAChCC,KAAgC,EACE;QAClC;;;;;KAKC,GACD,IAAID,MAAME,QAAQ,KAAKD,MAAME,gBAAgB,IAAIF,MAAMlB,KAAK,EAAE;YAC5D,OAAO;gBACLA,OAAO;gBACPoB,kBAAkBH,MAAME,QAAQ;YAClC;QACF;QACA,OAAO;YACLnB,OAAOkB,MAAMlB,KAAK;YAClBoB,kBAAkBH,MAAME,QAAQ;QAClC;IACF;IAMAE,SAAS;QACP,IAAI,IAAI,CAACH,KAAK,CAAClB,KAAK,EAAE;YACpB,qBACE,4DACG,IAAI,CAACiB,KAAK,CAACK,WAAW,gBACvB,6BAACC,IAAI,CAACN,KAAK,CAACO,cAAc;gBACxBxB,OAAO,IAAI,CAACkB,KAAK,CAAClB,KAAK;gBACvByB,OAAO,IAAI,CAACA,KAAK;;QAIzB;QAEA,OAAO,IAAI,CAACR,KAAK,CAACS,QAAQ;IAC5B;IAjDAC,YAAYV,KAAgC,CAAE;QAC5C,KAAK,CAACA;aA8BRQ,QAAQ;YACN,IAAI,CAACG,QAAQ,CAAC;gBAAE5B,OAAO;YAAK;QAC9B;QA/BE,IAAI,CAACkB,KAAK,GAAG;YAAElB,OAAO;YAAMoB,kBAAkB,IAAI,CAACH,KAAK,CAACE,QAAQ;QAAC;IACpE;AA+CF;AAEO,SAAStB,YAAY,KAAyB;IAAzB,IAAA,EAAEG,KAAK,EAAkB,GAAzB;IAC1B,MAAM6B,SAA6B7B,yBAAAA,MAAO6B,MAAM;IAChD,qBACE,6BAACC;QAAKC,IAAG;qBACP,6BAACC,6BACD,6BAACC,4BACC,6BAACC;QAAIC,OAAOpC,OAAOC,KAAK;qBACtB,6BAACkC,2BACC,6BAACE;QAAGD,OAAOpC,OAAOS,IAAI;OACnB,AAAC,0BACAqB,CAAAA,SAAS,WAAW,QAAO,IAC5B,2CACCA,CAAAA,SAAS,gBAAgB,iBAAgB,IAC1C,4BAEFA,uBAAS,6BAACQ;QAAEF,OAAOpC,OAAOS,IAAI;OAAG,AAAC,aAAUqB,UAAgB;AAMzE;MAIA,WAAehC;AAWR,SAASC,cAAc,KAIuB;IAJvB,IAAA,EAC5B0B,cAAc,EACdF,WAAW,EACXI,QAAQ,EAC2C,GAJvB;IAK5B,MAAMP,WAAWmB,IAAAA,uBAAW;IAC5B,IAAId,gBAAgB;QAClB,qBACE,6BAAC5B;YACCuB,UAAUA;YACVK,gBAAgBA;YAChBF,aAAaA;WAEZI;IAGP;IAEA,qBAAO,4DAAGA;AACZ"}

View File

@@ -0,0 +1,2 @@
import { type RedirectError } from './redirect';
export declare function getRedirectStatusCodeFromError<U extends string>(error: RedirectError<U>): number;

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getRedirectStatusCodeFromError", {
enumerable: true,
get: function() {
return getRedirectStatusCodeFromError;
}
});
const _redirect = require("./redirect");
function getRedirectStatusCodeFromError(error) {
if (!(0, _redirect.isRedirectError)(error)) {
throw new Error("Not a redirect error");
}
return error.digest.split(";", 4)[3] === "true" ? 308 : 307;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=get-redirect-status-code-from-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/get-redirect-status-code-from-error.ts"],"names":["getRedirectStatusCodeFromError","error","isRedirectError","Error","digest","split"],"mappings":";;;;+BAEgBA;;;eAAAA;;;0BAFoC;AAE7C,SAASA,+BACdC,KAAuB;IAEvB,IAAI,CAACC,IAAAA,yBAAe,EAACD,QAAQ;QAC3B,MAAM,IAAIE,MAAM;IAClB;IAEA,OAAOF,MAAMG,MAAM,CAACC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,SAAS,MAAM;AAC1D"}

View File

@@ -0,0 +1,5 @@
import { type ReadonlyRequestCookies } from '../../server/web/spec-extension/adapters/request-cookies';
import { DraftMode } from './draft-mode';
export declare function headers(): import("../../server/web/spec-extension/adapters/headers").ReadonlyHeaders;
export declare function cookies(): ReadonlyRequestCookies;
export declare function draftMode(): DraftMode;

78
node_modules/next/dist/client/components/headers.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
headers: null,
cookies: null,
draftMode: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
headers: function() {
return headers;
},
cookies: function() {
return cookies;
},
draftMode: function() {
return draftMode;
}
});
const _requestcookies = require("../../server/web/spec-extension/adapters/request-cookies");
const _headers = require("../../server/web/spec-extension/adapters/headers");
const _cookies = require("../../server/web/spec-extension/cookies");
const _requestasyncstorageexternal = require("./request-async-storage.external");
const _actionasyncstorageexternal = require("./action-async-storage.external");
const _staticgenerationbailout = require("./static-generation-bailout");
const _draftmode = require("./draft-mode");
function headers() {
if ((0, _staticgenerationbailout.staticGenerationBailout)("headers", {
link: "https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"
})) {
return _headers.HeadersAdapter.seal(new Headers({}));
}
const requestStore = _requestasyncstorageexternal.requestAsyncStorage.getStore();
if (!requestStore) {
throw new Error("Invariant: headers() expects to have requestAsyncStorage, none available.");
}
return requestStore.headers;
}
function cookies() {
if ((0, _staticgenerationbailout.staticGenerationBailout)("cookies", {
link: "https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering"
})) {
return _requestcookies.RequestCookiesAdapter.seal(new _cookies.RequestCookies(new Headers({})));
}
const requestStore = _requestasyncstorageexternal.requestAsyncStorage.getStore();
if (!requestStore) {
throw new Error("Invariant: cookies() expects to have requestAsyncStorage, none available.");
}
const asyncActionStore = _actionasyncstorageexternal.actionAsyncStorage.getStore();
if (asyncActionStore && (asyncActionStore.isAction || asyncActionStore.isAppRoute)) {
// We can't conditionally return different types here based on the context.
// To avoid confusion, we always return the readonly type here.
return requestStore.mutableCookies;
}
return requestStore.cookies;
}
function draftMode() {
const requestStore = _requestasyncstorageexternal.requestAsyncStorage.getStore();
if (!requestStore) {
throw new Error("Invariant: draftMode() expects to have requestAsyncStorage, none available.");
}
return new _draftmode.DraftMode(requestStore.draftMode);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=headers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/headers.ts"],"names":["headers","cookies","draftMode","staticGenerationBailout","link","HeadersAdapter","seal","Headers","requestStore","requestAsyncStorage","getStore","Error","RequestCookiesAdapter","RequestCookies","asyncActionStore","actionAsyncStorage","isAction","isAppRoute","mutableCookies","DraftMode"],"mappings":";;;;;;;;;;;;;;;;IAWgBA,OAAO;eAAPA;;IAkBAC,OAAO;eAAPA;;IA6BAC,SAAS;eAATA;;;gCAvDT;yBACwB;yBACA;6CACK;4CACD;yCACK;2BACd;AAEnB,SAASF;IACd,IACEG,IAAAA,gDAAuB,EAAC,WAAW;QACjCC,MAAM;IACR,IACA;QACA,OAAOC,uBAAc,CAACC,IAAI,CAAC,IAAIC,QAAQ,CAAC;IAC1C;IACA,MAAMC,eAAeC,gDAAmB,CAACC,QAAQ;IACjD,IAAI,CAACF,cAAc;QACjB,MAAM,IAAIG,MACP;IAEL;IAEA,OAAOH,aAAaR,OAAO;AAC7B;AAEO,SAASC;IACd,IACEE,IAAAA,gDAAuB,EAAC,WAAW;QACjCC,MAAM;IACR,IACA;QACA,OAAOQ,qCAAqB,CAACN,IAAI,CAAC,IAAIO,uBAAc,CAAC,IAAIN,QAAQ,CAAC;IACpE;IAEA,MAAMC,eAAeC,gDAAmB,CAACC,QAAQ;IACjD,IAAI,CAACF,cAAc;QACjB,MAAM,IAAIG,MACP;IAEL;IAEA,MAAMG,mBAAmBC,8CAAkB,CAACL,QAAQ;IACpD,IACEI,oBACCA,CAAAA,iBAAiBE,QAAQ,IAAIF,iBAAiBG,UAAU,AAAD,GACxD;QACA,2EAA2E;QAC3E,+DAA+D;QAC/D,OAAOT,aAAaU,cAAc;IACpC;IAEA,OAAOV,aAAaP,OAAO;AAC7B;AAEO,SAASC;IACd,MAAMM,eAAeC,gDAAmB,CAACC,QAAQ;IACjD,IAAI,CAACF,cAAc;QACjB,MAAM,IAAIG,MACP;IAEL;IACA,OAAO,IAAIQ,oBAAS,CAACX,aAAaN,SAAS;AAC7C"}

View File

@@ -0,0 +1,5 @@
export declare const DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
export declare class DynamicServerError extends Error {
digest: typeof DYNAMIC_ERROR_CODE;
constructor(type: string);
}

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
DYNAMIC_ERROR_CODE: null,
DynamicServerError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
DYNAMIC_ERROR_CODE: function() {
return DYNAMIC_ERROR_CODE;
},
DynamicServerError: function() {
return DynamicServerError;
}
});
const DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
class DynamicServerError extends Error {
constructor(type){
super("Dynamic server usage: " + type);
this.digest = DYNAMIC_ERROR_CODE;
}
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=hooks-server-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/hooks-server-context.ts"],"names":["DYNAMIC_ERROR_CODE","DynamicServerError","Error","constructor","type","digest"],"mappings":";;;;;;;;;;;;;;;IAAaA,kBAAkB;eAAlBA;;IAEAC,kBAAkB;eAAlBA;;;AAFN,MAAMD,qBAAqB;AAE3B,MAAMC,2BAA2BC;IAGtCC,YAAYC,IAAY,CAAE;QACxB,KAAK,CAAC,AAAC,2BAAwBA;aAHjCC,SAAoCL;IAIpC;AACF"}

View File

@@ -0,0 +1,4 @@
/**
* Create a Promise that does not resolve. This is used to suspend when data is not available yet.
*/
export declare function createInfinitePromise(): Promise<void>;

View File

@@ -0,0 +1,34 @@
/**
* Used to cache in createInfinitePromise
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createInfinitePromise", {
enumerable: true,
get: function() {
return createInfinitePromise;
}
});
let infinitePromise;
function createInfinitePromise() {
if (!infinitePromise) {
// Only create the Promise once
infinitePromise = new Promise(()=>{
// This is used to debug when the rendering is never updated.
// setTimeout(() => {
// infinitePromise = new Error('Infinite promise')
// resolve()
// }, 5000)
});
}
return infinitePromise;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=infinite-promise.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/infinite-promise.ts"],"names":["createInfinitePromise","infinitePromise","Promise"],"mappings":"AAAA;;CAEC;;;;+BAMeA;;;eAAAA;;;AALhB,IAAIC;AAKG,SAASD;IACd,IAAI,CAACC,iBAAiB;QACpB,+BAA+B;QAC/BA,kBAAkB,IAAIC,QAAQ;QAC5B,6DAA6D;QAC7D,qBAAqB;QACrB,oDAAoD;QACpD,cAAc;QACd,WAAW;QACb;IACF;IAEA,OAAOD;AACT"}

View File

@@ -0,0 +1 @@
export declare function isNextRouterError(error: any): boolean;

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isNextRouterError", {
enumerable: true,
get: function() {
return isNextRouterError;
}
});
const _notfound = require("./not-found");
const _redirect = require("./redirect");
function isNextRouterError(error) {
return error && error.digest && ((0, _redirect.isRedirectError)(error) || (0, _notfound.isNotFoundError)(error));
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=is-next-router-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/is-next-router-error.ts"],"names":["isNextRouterError","error","digest","isRedirectError","isNotFoundError"],"mappings":";;;;+BAGgBA;;;eAAAA;;;0BAHgB;0BACA;AAEzB,SAASA,kBAAkBC,KAAU;IAC1C,OACEA,SAASA,MAAMC,MAAM,IAAKC,CAAAA,IAAAA,yBAAe,EAACF,UAAUG,IAAAA,yBAAe,EAACH,MAAK;AAE7E"}

View File

@@ -0,0 +1,22 @@
import type { FlightSegmentPath, ChildProp } from '../../server/app-render/types';
import type { ErrorComponent } from './error-boundary';
import React from 'react';
/**
* OuterLayoutRouter handles the current segment as well as <Offscreen> rendering of other segments.
* It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes.
*/
export default function OuterLayoutRouter({ parallelRouterKey, segmentPath, childProp, error, errorStyles, templateStyles, loading, loadingStyles, hasLoading, template, notFound, notFoundStyles, styles, }: {
parallelRouterKey: string;
segmentPath: FlightSegmentPath;
childProp: ChildProp;
error: ErrorComponent;
errorStyles: React.ReactNode | undefined;
templateStyles: React.ReactNode | undefined;
template: React.ReactNode;
loading: React.ReactNode | undefined;
loadingStyles: React.ReactNode | undefined;
hasLoading: boolean;
notFound: React.ReactNode | undefined;
notFoundStyles: React.ReactNode | undefined;
styles?: React.ReactNode;
}): React.JSX.Element;

View File

@@ -0,0 +1,424 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, /**
* OuterLayoutRouter handles the current segment as well as <Offscreen> rendering of other segments.
* It can be rendered next to each other with a different `parallelRouterKey`, allowing for Parallel routes.
*/ "default", {
enumerable: true,
get: function() {
return OuterLayoutRouter;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactdom = /*#__PURE__*/ _interop_require_default._(require("react-dom"));
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
const _fetchserverresponse = require("./router-reducer/fetch-server-response");
const _infinitepromise = require("./infinite-promise");
const _errorboundary = require("./error-boundary");
const _matchsegments = require("./match-segments");
const _handlesmoothscroll = require("../../shared/lib/router/utils/handle-smooth-scroll");
const _redirectboundary = require("./redirect-boundary");
const _notfoundboundary = require("./not-found-boundary");
const _getsegmentvalue = require("./router-reducer/reducers/get-segment-value");
const _createroutercachekey = require("./router-reducer/create-router-cache-key");
/**
* Add refetch marker to router state at the point of the current layout segment.
* This ensures the response returned is not further down than the current layout segment.
*/ function walkAddRefetch(segmentPathToWalk, treeToRecreate) {
if (segmentPathToWalk) {
const [segment, parallelRouteKey] = segmentPathToWalk;
const isLast = segmentPathToWalk.length === 2;
if ((0, _matchsegments.matchSegment)(treeToRecreate[0], segment)) {
if (treeToRecreate[1].hasOwnProperty(parallelRouteKey)) {
if (isLast) {
const subTree = walkAddRefetch(undefined, treeToRecreate[1][parallelRouteKey]);
return [
treeToRecreate[0],
{
...treeToRecreate[1],
[parallelRouteKey]: [
subTree[0],
subTree[1],
subTree[2],
"refetch"
]
}
];
}
return [
treeToRecreate[0],
{
...treeToRecreate[1],
[parallelRouteKey]: walkAddRefetch(segmentPathToWalk.slice(2), treeToRecreate[1][parallelRouteKey])
}
];
}
}
}
return treeToRecreate;
}
// TODO-APP: Replace with new React API for finding dom nodes without a `ref` when available
/**
* Wraps ReactDOM.findDOMNode with additional logic to hide React Strict Mode warning
*/ function findDOMNode(instance) {
// Tree-shake for server bundle
if (typeof window === "undefined") return null;
// Only apply strict mode warning when not in production
if (process.env.NODE_ENV !== "production") {
const originalConsoleError = console.error;
try {
console.error = function() {
for(var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++){
messages[_key] = arguments[_key];
}
// Ignore strict mode warning for the findDomNode call below
if (!messages[0].includes("Warning: %s is deprecated in StrictMode.")) {
originalConsoleError(...messages);
}
};
return _reactdom.default.findDOMNode(instance);
} finally{
console.error = originalConsoleError;
}
}
return _reactdom.default.findDOMNode(instance);
}
const rectProperties = [
"bottom",
"height",
"left",
"right",
"top",
"width",
"x",
"y"
];
/**
* Check if a HTMLElement is hidden or fixed/sticky position
*/ function shouldSkipElement(element) {
// we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check
// and will result in a situation we bail on scroll because of something like a fixed nav,
// even though the actual page content is offscreen
if ([
"sticky",
"fixed"
].includes(getComputedStyle(element).position)) {
if (process.env.NODE_ENV === "development") {
console.warn("Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element:", element);
}
return true;
}
// Uses `getBoundingClientRect` to check if the element is hidden instead of `offsetParent`
// because `offsetParent` doesn't consider document/body
const rect = element.getBoundingClientRect();
return rectProperties.every((item)=>rect[item] === 0);
}
/**
* Check if the top corner of the HTMLElement is in the viewport.
*/ function topOfElementInViewport(element, viewportHeight) {
const rect = element.getBoundingClientRect();
return rect.top >= 0 && rect.top <= viewportHeight;
}
/**
* Find the DOM node for a hash fragment.
* If `top` the page has to scroll to the top of the page. This mirrors the browser's behavior.
* If the hash fragment is an id, the page has to scroll to the element with that id.
* If the hash fragment is a name, the page has to scroll to the first element with that name.
*/ function getHashFragmentDomNode(hashFragment) {
// If the hash fragment is `top` the page has to scroll to the top of the page.
if (hashFragment === "top") {
return document.body;
}
var _document_getElementById;
// If the hash fragment is an id, the page has to scroll to the element with that id.
return (_document_getElementById = document.getElementById(hashFragment)) != null ? _document_getElementById : // If the hash fragment is a name, the page has to scroll to the first element with that name.
document.getElementsByName(hashFragment)[0];
}
class InnerScrollAndFocusHandler extends _react.default.Component {
componentDidMount() {
this.handlePotentialScroll();
}
componentDidUpdate() {
// Because this property is overwritten in handlePotentialScroll it's fine to always run it when true as it'll be set to false for subsequent renders.
if (this.props.focusAndScrollRef.apply) {
this.handlePotentialScroll();
}
}
render() {
return this.props.children;
}
constructor(...args){
super(...args);
this.handlePotentialScroll = ()=>{
// Handle scroll and focus, it's only applied once in the first useEffect that triggers that changed.
const { focusAndScrollRef, segmentPath } = this.props;
if (focusAndScrollRef.apply) {
// segmentPaths is an array of segment paths that should be scrolled to
// if the current segment path is not in the array, the scroll is not applied
// unless the array is empty, in which case the scroll is always applied
if (focusAndScrollRef.segmentPaths.length !== 0 && !focusAndScrollRef.segmentPaths.some((scrollRefSegmentPath)=>segmentPath.every((segment, index)=>(0, _matchsegments.matchSegment)(segment, scrollRefSegmentPath[index])))) {
return;
}
let domNode = null;
const hashFragment = focusAndScrollRef.hashFragment;
if (hashFragment) {
domNode = getHashFragmentDomNode(hashFragment);
}
// `findDOMNode` is tricky because it returns just the first child if the component is a fragment.
// This already caused a bug where the first child was a <link/> in head.
if (!domNode) {
domNode = findDOMNode(this);
}
// If there is no DOM node this layout-router level is skipped. It'll be handled higher-up in the tree.
if (!(domNode instanceof Element)) {
return;
}
// Verify if the element is a HTMLElement and if we want to consider it for scroll behavior.
// If the element is skipped, try to select the next sibling and try again.
while(!(domNode instanceof HTMLElement) || shouldSkipElement(domNode)){
// No siblings found that match the criteria are found, so handle scroll higher up in the tree instead.
if (domNode.nextElementSibling === null) {
return;
}
domNode = domNode.nextElementSibling;
}
// State is mutated to ensure that the focus and scroll is applied only once.
focusAndScrollRef.apply = false;
focusAndScrollRef.hashFragment = null;
focusAndScrollRef.segmentPaths = [];
(0, _handlesmoothscroll.handleSmoothScroll)(()=>{
// In case of hash scroll, we only need to scroll the element into view
if (hashFragment) {
domNode.scrollIntoView();
return;
}
// Store the current viewport height because reading `clientHeight` causes a reflow,
// and it won't change during this function.
const htmlElement = document.documentElement;
const viewportHeight = htmlElement.clientHeight;
// If the element's top edge is already in the viewport, exit early.
if (topOfElementInViewport(domNode, viewportHeight)) {
return;
}
// Otherwise, try scrolling go the top of the document to be backward compatible with pages
// scrollIntoView() called on `<html/>` element scrolls horizontally on chrome and firefox (that shouldn't happen)
// We could use it to scroll horizontally following RTL but that also seems to be broken - it will always scroll left
// scrollLeft = 0 also seems to ignore RTL and manually checking for RTL is too much hassle so we will scroll just vertically
htmlElement.scrollTop = 0;
// Scroll to domNode if domNode is not in viewport when scrolled to top of document
if (!topOfElementInViewport(domNode, viewportHeight)) {
domNode.scrollIntoView();
}
}, {
// We will force layout by querying domNode position
dontForceLayout: true,
onlyHashChange: focusAndScrollRef.onlyHashChange
});
// Mutate after scrolling so that it can be read by `handleSmoothScroll`
focusAndScrollRef.onlyHashChange = false;
// Set focus on the element
domNode.focus();
}
};
}
}
function ScrollAndFocusHandler(param) {
let { segmentPath, children } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
if (!context) {
throw new Error("invariant global layout router not mounted");
}
return /*#__PURE__*/ _react.default.createElement(InnerScrollAndFocusHandler, {
segmentPath: segmentPath,
focusAndScrollRef: context.focusAndScrollRef
}, children);
}
/**
* InnerLayoutRouter handles rendering the provided segment based on the cache.
*/ function InnerLayoutRouter(param) {
let { parallelRouterKey, url, childNodes, childProp, segmentPath, tree, // TODO-APP: implement `<Offscreen>` when available.
// isActive,
cacheKey } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
if (!context) {
throw new Error("invariant global layout router not mounted");
}
const { buildId, changeByServerResponse, tree: fullTree } = context;
// Read segment path from the parallel router cache node.
let childNode = childNodes.get(cacheKey);
// If childProp is available this means it's the Flight / SSR case.
if (childProp && // TODO-APP: verify if this can be null based on user code
childProp.current !== null) {
if (!childNode) {
// Add the segment's subTreeData to the cache.
// This writes to the cache when there is no item in the cache yet. It never *overwrites* existing cache items which is why it's safe in concurrent mode.
childNode = {
status: _approutercontextsharedruntime.CacheStates.READY,
data: null,
subTreeData: childProp.current,
parallelRoutes: new Map()
};
childNodes.set(cacheKey, childNode);
} else {
if (childNode.status === _approutercontextsharedruntime.CacheStates.LAZY_INITIALIZED) {
// @ts-expect-error we're changing it's type!
childNode.status = _approutercontextsharedruntime.CacheStates.READY;
// @ts-expect-error
childNode.subTreeData = childProp.current;
}
}
}
// When childNode is not available during rendering client-side we need to fetch it from the server.
if (!childNode || childNode.status === _approutercontextsharedruntime.CacheStates.LAZY_INITIALIZED) {
/**
* Router state with refetch marker added
*/ // TODO-APP: remove ''
const refetchTree = walkAddRefetch([
"",
...segmentPath
], fullTree);
childNode = {
status: _approutercontextsharedruntime.CacheStates.DATA_FETCH,
data: (0, _fetchserverresponse.fetchServerResponse)(new URL(url, location.origin), refetchTree, context.nextUrl, buildId),
subTreeData: null,
head: childNode && childNode.status === _approutercontextsharedruntime.CacheStates.LAZY_INITIALIZED ? childNode.head : undefined,
parallelRoutes: childNode && childNode.status === _approutercontextsharedruntime.CacheStates.LAZY_INITIALIZED ? childNode.parallelRoutes : new Map()
};
/**
* Flight data fetch kicked off during render and put into the cache.
*/ childNodes.set(cacheKey, childNode);
}
// This case should never happen so it throws an error. It indicates there's a bug in the Next.js.
if (!childNode) {
throw new Error("Child node should always exist");
}
// This case should never happen so it throws an error. It indicates there's a bug in the Next.js.
if (childNode.subTreeData && childNode.data) {
throw new Error("Child node should not have both subTreeData and data");
}
// If cache node has a data request we have to unwrap response by `use` and update the cache.
if (childNode.data) {
/**
* Flight response data
*/ // When the data has not resolved yet `use` will suspend here.
const [flightData, overrideCanonicalUrl] = (0, _react.use)(childNode.data);
// segmentPath from the server does not match the layout's segmentPath
childNode.data = null;
// setTimeout is used to start a new transition during render, this is an intentional hack around React.
setTimeout(()=>{
(0, _react.startTransition)(()=>{
changeByServerResponse(fullTree, flightData, overrideCanonicalUrl);
});
});
// Suspend infinitely as `changeByServerResponse` will cause a different part of the tree to be rendered.
(0, _react.use)((0, _infinitepromise.createInfinitePromise)());
}
// If cache node has no subTreeData and no data request we have to infinitely suspend as the data will likely flow in from another place.
// TODO-APP: double check users can't return null in a component that will kick in here.
if (!childNode.subTreeData) {
(0, _react.use)((0, _infinitepromise.createInfinitePromise)());
}
const subtree = // The layout router context narrows down tree and childNodes at each level.
/*#__PURE__*/ _react.default.createElement(_approutercontextsharedruntime.LayoutRouterContext.Provider, {
value: {
tree: tree[1][parallelRouterKey],
childNodes: childNode.parallelRoutes,
// TODO-APP: overriding of url for parallel routes
url: url
}
}, childNode.subTreeData);
// Ensure root layout is not wrapped in a div as the root layout renders `<html>`
return subtree;
}
/**
* Renders suspense boundary with the provided "loading" property as the fallback.
* If no loading property is provided it renders the children without a suspense boundary.
*/ function LoadingBoundary(param) {
let { children, loading, loadingStyles, hasLoading } = param;
if (hasLoading) {
return /*#__PURE__*/ _react.default.createElement(_react.Suspense, {
fallback: /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, loadingStyles, loading)
}, children);
}
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, children);
}
function OuterLayoutRouter(param) {
let { parallelRouterKey, segmentPath, childProp, error, errorStyles, templateStyles, loading, loadingStyles, hasLoading, template, notFound, notFoundStyles, styles } = param;
const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
if (!context) {
throw new Error("invariant expected layout router to be mounted");
}
const { childNodes, tree, url } = context;
// Get the current parallelRouter cache node
let childNodesForParallelRouter = childNodes.get(parallelRouterKey);
// If the parallel router cache node does not exist yet, create it.
// This writes to the cache when there is no item in the cache yet. It never *overwrites* existing cache items which is why it's safe in concurrent mode.
if (!childNodesForParallelRouter) {
childNodesForParallelRouter = new Map();
childNodes.set(parallelRouterKey, childNodesForParallelRouter);
}
// Get the active segment in the tree
// The reason arrays are used in the data format is that these are transferred from the server to the browser so it's optimized to save bytes.
const treeSegment = tree[1][parallelRouterKey][0];
const childPropSegment = childProp.segment;
// If segment is an array it's a dynamic route and we want to read the dynamic route value as the segment to get from the cache.
const currentChildSegmentValue = (0, _getsegmentvalue.getSegmentValue)(treeSegment);
/**
* Decides which segments to keep rendering, all segments that are not active will be wrapped in `<Offscreen>`.
*/ // TODO-APP: Add handling of `<Offscreen>` when it's available.
const preservedSegments = [
treeSegment
];
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, styles, preservedSegments.map((preservedSegment)=>{
const isChildPropSegment = (0, _matchsegments.matchSegment)(preservedSegment, childPropSegment);
const preservedSegmentValue = (0, _getsegmentvalue.getSegmentValue)(preservedSegment);
const cacheKey = (0, _createroutercachekey.createRouterCacheKey)(preservedSegment);
return(/*
- Error boundary
- Only renders error boundary if error component is provided.
- Rendered for each segment to ensure they have their own error state.
- Loading boundary
- Only renders suspense boundary if loading components is provided.
- Rendered for each segment to ensure they have their own loading state.
- Passed to the router during rendering to ensure it can be immediately rendered when suspending on a Flight fetch.
*/ /*#__PURE__*/ _react.default.createElement(_approutercontextsharedruntime.TemplateContext.Provider, {
key: (0, _createroutercachekey.createRouterCacheKey)(preservedSegment, true),
value: /*#__PURE__*/ _react.default.createElement(ScrollAndFocusHandler, {
segmentPath: segmentPath
}, /*#__PURE__*/ _react.default.createElement(_errorboundary.ErrorBoundary, {
errorComponent: error,
errorStyles: errorStyles
}, /*#__PURE__*/ _react.default.createElement(LoadingBoundary, {
hasLoading: hasLoading,
loading: loading,
loadingStyles: loadingStyles
}, /*#__PURE__*/ _react.default.createElement(_notfoundboundary.NotFoundBoundary, {
notFound: notFound,
notFoundStyles: notFoundStyles
}, /*#__PURE__*/ _react.default.createElement(_redirectboundary.RedirectBoundary, null, /*#__PURE__*/ _react.default.createElement(InnerLayoutRouter, {
parallelRouterKey: parallelRouterKey,
url: url,
tree: tree,
childNodes: childNodesForParallelRouter,
childProp: isChildPropSegment ? childProp : null,
segmentPath: segmentPath,
cacheKey: cacheKey,
isActive: currentChildSegmentValue === preservedSegmentValue
}))))))
}, templateStyles, template));
}));
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=layout-router.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import type { Segment } from '../../server/app-render/types';
export declare const matchSegment: (existingSegment: Segment, segment: Segment) => boolean;
export declare const canSegmentBeOverridden: (existingSegment: Segment, segment: Segment) => boolean;

View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
matchSegment: null,
canSegmentBeOverridden: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
matchSegment: function() {
return matchSegment;
},
canSegmentBeOverridden: function() {
return canSegmentBeOverridden;
}
});
const _getsegmentparam = require("../../server/app-render/get-segment-param");
const matchSegment = (existingSegment, segment)=>{
// segment is either Array or string
if (typeof existingSegment === "string") {
if (typeof segment === "string") {
// Common case: segment is just a string
return existingSegment === segment;
}
return false;
}
if (typeof segment === "string") {
return false;
}
return existingSegment[0] === segment[0] && existingSegment[1] === segment[1];
};
const canSegmentBeOverridden = (existingSegment, segment)=>{
var _getSegmentParam;
if (Array.isArray(existingSegment) || !Array.isArray(segment)) {
return false;
}
return ((_getSegmentParam = (0, _getsegmentparam.getSegmentParam)(existingSegment)) == null ? void 0 : _getSegmentParam.param) === segment[0];
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=match-segments.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/match-segments.ts"],"names":["matchSegment","canSegmentBeOverridden","existingSegment","segment","getSegmentParam","Array","isArray","param"],"mappings":";;;;;;;;;;;;;;;IAGaA,YAAY;eAAZA;;IAsBAC,sBAAsB;eAAtBA;;;iCAzBmB;AAGzB,MAAMD,eAAe,CAC1BE,iBACAC;IAEA,oCAAoC;IACpC,IAAI,OAAOD,oBAAoB,UAAU;QACvC,IAAI,OAAOC,YAAY,UAAU;YAC/B,wCAAwC;YACxC,OAAOD,oBAAoBC;QAC7B;QACA,OAAO;IACT;IAEA,IAAI,OAAOA,YAAY,UAAU;QAC/B,OAAO;IACT;IACA,OAAOD,eAAe,CAAC,EAAE,KAAKC,OAAO,CAAC,EAAE,IAAID,eAAe,CAAC,EAAE,KAAKC,OAAO,CAAC,EAAE;AAC/E;AAKO,MAAMF,yBAAyB,CACpCC,iBACAC;QAMOC;IAJP,IAAIC,MAAMC,OAAO,CAACJ,oBAAoB,CAACG,MAAMC,OAAO,CAACH,UAAU;QAC7D,OAAO;IACT;IAEA,OAAOC,EAAAA,mBAAAA,IAAAA,gCAAe,EAACF,qCAAhBE,iBAAkCG,KAAK,MAAKJ,OAAO,CAAC,EAAE;AAC/D"}

View File

@@ -0,0 +1,51 @@
declare const INTERNAL_URLSEARCHPARAMS_INSTANCE: unique symbol;
export declare class ReadonlyURLSearchParams {
[INTERNAL_URLSEARCHPARAMS_INSTANCE]: URLSearchParams;
entries: URLSearchParams['entries'];
forEach: URLSearchParams['forEach'];
get: URLSearchParams['get'];
getAll: URLSearchParams['getAll'];
has: URLSearchParams['has'];
keys: URLSearchParams['keys'];
values: URLSearchParams['values'];
toString: URLSearchParams['toString'];
size: any | URLSearchParams['size'];
constructor(urlSearchParams: URLSearchParams);
[Symbol.iterator](): IterableIterator<[string, string]>;
append(): void;
delete(): void;
set(): void;
sort(): void;
}
/**
* Get a read-only URLSearchParams object. For example searchParams.get('foo') would return 'bar' when ?foo=bar
* Learn more about URLSearchParams here: https://developer.mozilla.org/docs/Web/API/URLSearchParams
*/
export declare function useSearchParams(): ReadonlyURLSearchParams;
/**
* Get the current pathname. For example usePathname() on /dashboard?foo=bar would return "/dashboard"
*/
export declare function usePathname(): string;
export { ServerInsertedHTMLContext, useServerInsertedHTML, } from '../../shared/lib/server-inserted-html.shared-runtime';
/**
* Get the router methods. For example router.push('/dashboard')
*/
export declare function useRouter(): import('../../shared/lib/app-router-context.shared-runtime').AppRouterInstance;
interface Params {
[key: string]: string | string[];
}
/**
* Get the current parameters. For example useParams() on /dashboard/[team]
* where pathname is /dashboard/nextjs would return { team: 'nextjs' }
*/
export declare function useParams<T extends Params = Params>(): T;
/**
* Get the canonical segment path from the current level to the leaf node.
*/
export declare function useSelectedLayoutSegments(parallelRouteKey?: string): string[];
/**
* Get the segment below the current level
*/
export declare function useSelectedLayoutSegment(parallelRouteKey?: string): string | null;
export { redirect, permanentRedirect, RedirectType } from './redirect';
export { notFound } from './not-found';

225
node_modules/next/dist/client/components/navigation.js generated vendored Normal file
View File

@@ -0,0 +1,225 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
ReadonlyURLSearchParams: null,
useSearchParams: null,
usePathname: null,
ServerInsertedHTMLContext: null,
useServerInsertedHTML: null,
useRouter: null,
useParams: null,
useSelectedLayoutSegments: null,
useSelectedLayoutSegment: null,
redirect: null,
permanentRedirect: null,
RedirectType: null,
notFound: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ReadonlyURLSearchParams: function() {
return ReadonlyURLSearchParams;
},
useSearchParams: function() {
return useSearchParams;
},
usePathname: function() {
return usePathname;
},
ServerInsertedHTMLContext: function() {
return _serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext;
},
useServerInsertedHTML: function() {
return _serverinsertedhtmlsharedruntime.useServerInsertedHTML;
},
useRouter: function() {
return useRouter;
},
useParams: function() {
return useParams;
},
useSelectedLayoutSegments: function() {
return useSelectedLayoutSegments;
},
useSelectedLayoutSegment: function() {
return useSelectedLayoutSegment;
},
redirect: function() {
return _redirect.redirect;
},
permanentRedirect: function() {
return _redirect.permanentRedirect;
},
RedirectType: function() {
return _redirect.RedirectType;
},
notFound: function() {
return _notfound.notFound;
}
});
const _react = require("react");
const _approutercontextsharedruntime = require("../../shared/lib/app-router-context.shared-runtime");
const _hooksclientcontextsharedruntime = require("../../shared/lib/hooks-client-context.shared-runtime");
const _clienthookinservercomponenterror = require("./client-hook-in-server-component-error");
const _getsegmentvalue = require("./router-reducer/reducers/get-segment-value");
const _serverinsertedhtmlsharedruntime = require("../../shared/lib/server-inserted-html.shared-runtime");
const _redirect = require("./redirect");
const _notfound = require("./not-found");
const INTERNAL_URLSEARCHPARAMS_INSTANCE = Symbol("internal for urlsearchparams readonly");
function readonlyURLSearchParamsError() {
return new Error("ReadonlyURLSearchParams cannot be modified");
}
class ReadonlyURLSearchParams {
[Symbol.iterator]() {
return this[INTERNAL_URLSEARCHPARAMS_INSTANCE][Symbol.iterator]();
}
append() {
throw readonlyURLSearchParamsError();
}
delete() {
throw readonlyURLSearchParamsError();
}
set() {
throw readonlyURLSearchParamsError();
}
sort() {
throw readonlyURLSearchParamsError();
}
constructor(urlSearchParams){
this[INTERNAL_URLSEARCHPARAMS_INSTANCE] = urlSearchParams;
this.entries = urlSearchParams.entries.bind(urlSearchParams);
this.forEach = urlSearchParams.forEach.bind(urlSearchParams);
this.get = urlSearchParams.get.bind(urlSearchParams);
this.getAll = urlSearchParams.getAll.bind(urlSearchParams);
this.has = urlSearchParams.has.bind(urlSearchParams);
this.keys = urlSearchParams.keys.bind(urlSearchParams);
this.values = urlSearchParams.values.bind(urlSearchParams);
this.toString = urlSearchParams.toString.bind(urlSearchParams);
this.size = urlSearchParams.size;
}
}
function useSearchParams() {
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSearchParams");
const searchParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.SearchParamsContext);
// In the case where this is `null`, the compat types added in
// `next-env.d.ts` will add a new overload that changes the return type to
// include `null`.
const readonlySearchParams = (0, _react.useMemo)(()=>{
if (!searchParams) {
// When the router is not ready in pages, we won't have the search params
// available.
return null;
}
return new ReadonlyURLSearchParams(searchParams);
}, [
searchParams
]);
if (typeof window === "undefined") {
// AsyncLocalStorage should not be included in the client bundle.
const { bailoutToClientRendering } = require("./bailout-to-client-rendering");
if (bailoutToClientRendering()) {
// TODO-APP: handle dynamic = 'force-static' here and on the client
return readonlySearchParams;
}
}
return readonlySearchParams;
}
function usePathname() {
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("usePathname");
// In the case where this is `null`, the compat types added in `next-env.d.ts`
// will add a new overload that changes the return type to include `null`.
return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
}
function useRouter() {
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useRouter");
const router = (0, _react.useContext)(_approutercontextsharedruntime.AppRouterContext);
if (router === null) {
throw new Error("invariant expected app router to be mounted");
}
return router;
}
// this function performs a depth-first search of the tree to find the selected
// params
function getSelectedParams(tree, params) {
if (params === void 0) params = {};
const parallelRoutes = tree[1];
for (const parallelRoute of Object.values(parallelRoutes)){
const segment = parallelRoute[0];
const isDynamicParameter = Array.isArray(segment);
const segmentValue = isDynamicParameter ? segment[1] : segment;
if (!segmentValue || segmentValue.startsWith("__PAGE__")) continue;
// Ensure catchAll and optional catchall are turned into an array
const isCatchAll = isDynamicParameter && (segment[2] === "c" || segment[2] === "oc");
if (isCatchAll) {
params[segment[0]] = segment[1].split("/");
} else if (isDynamicParameter) {
params[segment[0]] = segment[1];
}
params = getSelectedParams(parallelRoute, params);
}
return params;
}
function useParams() {
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useParams");
const globalLayoutRouter = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
const pathParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.PathParamsContext);
// When it's under app router
if (globalLayoutRouter) {
return getSelectedParams(globalLayoutRouter.tree);
}
// When it's under client side pages router
return pathParams;
}
// TODO-APP: handle parallel routes
/**
* Get the canonical parameters from the current level to the leaf node.
*/ function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first, segmentPath) {
if (first === void 0) first = true;
if (segmentPath === void 0) segmentPath = [];
let node;
if (first) {
// Use the provided parallel route key on the first parallel route
node = tree[1][parallelRouteKey];
} else {
// After first parallel route prefer children, if there's no children pick the first parallel route.
const parallelRoutes = tree[1];
var _parallelRoutes_children;
node = (_parallelRoutes_children = parallelRoutes.children) != null ? _parallelRoutes_children : Object.values(parallelRoutes)[0];
}
if (!node) return segmentPath;
const segment = node[0];
const segmentValue = (0, _getsegmentvalue.getSegmentValue)(segment);
if (!segmentValue || segmentValue.startsWith("__PAGE__")) return segmentPath;
segmentPath.push(segmentValue);
return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath);
}
function useSelectedLayoutSegments(parallelRouteKey) {
if (parallelRouteKey === void 0) parallelRouteKey = "children";
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSelectedLayoutSegments");
const { tree } = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
return getSelectedLayoutSegmentPath(tree, parallelRouteKey);
}
function useSelectedLayoutSegment(parallelRouteKey) {
if (parallelRouteKey === void 0) parallelRouteKey = "children";
(0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSelectedLayoutSegment");
const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey);
if (selectedLayoutSegments.length === 0) {
return null;
}
return selectedLayoutSegments[0];
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=navigation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/navigation.ts"],"names":["ReadonlyURLSearchParams","useSearchParams","usePathname","ServerInsertedHTMLContext","useServerInsertedHTML","useRouter","useParams","useSelectedLayoutSegments","useSelectedLayoutSegment","redirect","permanentRedirect","RedirectType","notFound","INTERNAL_URLSEARCHPARAMS_INSTANCE","Symbol","readonlyURLSearchParamsError","Error","iterator","append","delete","set","sort","constructor","urlSearchParams","entries","bind","forEach","get","getAll","has","keys","values","toString","size","clientHookInServerComponentError","searchParams","useContext","SearchParamsContext","readonlySearchParams","useMemo","window","bailoutToClientRendering","require","PathnameContext","router","AppRouterContext","getSelectedParams","tree","params","parallelRoutes","parallelRoute","Object","segment","isDynamicParameter","Array","isArray","segmentValue","startsWith","isCatchAll","split","globalLayoutRouter","GlobalLayoutRouterContext","pathParams","PathParamsContext","getSelectedLayoutSegmentPath","parallelRouteKey","first","segmentPath","node","children","getSegmentValue","push","LayoutRouterContext","selectedLayoutSegments","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAuBaA,uBAAuB;eAAvBA;;IAgDGC,eAAe;eAAfA;;IAiCAC,WAAW;eAAXA;;IAQdC,yBAAyB;eAAzBA,0DAAyB;;IACzBC,qBAAqB;eAArBA,sDAAqB;;IAMPC,SAAS;eAATA;;IAgDAC,SAAS;eAATA;;IAsDAC,yBAAyB;eAAzBA;;IAYAC,wBAAwB;eAAxBA;;IAYPC,QAAQ;eAARA,kBAAQ;;IAAEC,iBAAiB;eAAjBA,2BAAiB;;IAAEC,YAAY;eAAZA,sBAAY;;IACzCC,QAAQ;eAARA,kBAAQ;;;uBAtPmB;+CAM7B;iDAKA;kDAC0C;iCACjB;iDAqGzB;0BAmImD;0BACjC;AAvOzB,MAAMC,oCAAoCC,OACxC;AAGF,SAASC;IACP,OAAO,IAAIC,MAAM;AACnB;AAEO,MAAMhB;IA0BX,CAACc,OAAOG,QAAQ,CAAC,GAAG;QAClB,OAAO,IAAI,CAACJ,kCAAkC,CAACC,OAAOG,QAAQ,CAAC;IACjE;IAEAC,SAAS;QACP,MAAMH;IACR;IACAI,SAAS;QACP,MAAMJ;IACR;IACAK,MAAM;QACJ,MAAML;IACR;IACAM,OAAO;QACL,MAAMN;IACR;IA5BAO,YAAYC,eAAgC,CAAE;QAC5C,IAAI,CAACV,kCAAkC,GAAGU;QAE1C,IAAI,CAACC,OAAO,GAAGD,gBAAgBC,OAAO,CAACC,IAAI,CAACF;QAC5C,IAAI,CAACG,OAAO,GAAGH,gBAAgBG,OAAO,CAACD,IAAI,CAACF;QAC5C,IAAI,CAACI,GAAG,GAAGJ,gBAAgBI,GAAG,CAACF,IAAI,CAACF;QACpC,IAAI,CAACK,MAAM,GAAGL,gBAAgBK,MAAM,CAACH,IAAI,CAACF;QAC1C,IAAI,CAACM,GAAG,GAAGN,gBAAgBM,GAAG,CAACJ,IAAI,CAACF;QACpC,IAAI,CAACO,IAAI,GAAGP,gBAAgBO,IAAI,CAACL,IAAI,CAACF;QACtC,IAAI,CAACQ,MAAM,GAAGR,gBAAgBQ,MAAM,CAACN,IAAI,CAACF;QAC1C,IAAI,CAACS,QAAQ,GAAGT,gBAAgBS,QAAQ,CAACP,IAAI,CAACF;QAC9C,IAAI,CAACU,IAAI,GAAGV,gBAAgBU,IAAI;IAClC;AAiBF;AAMO,SAAShC;IACdiC,IAAAA,kEAAgC,EAAC;IACjC,MAAMC,eAAeC,IAAAA,iBAAU,EAACC,oDAAmB;IAEnD,8DAA8D;IAC9D,0EAA0E;IAC1E,kBAAkB;IAClB,MAAMC,uBAAuBC,IAAAA,cAAO,EAAC;QACnC,IAAI,CAACJ,cAAc;YACjB,yEAAyE;YACzE,aAAa;YACb,OAAO;QACT;QAEA,OAAO,IAAInC,wBAAwBmC;IACrC,GAAG;QAACA;KAAa;IAEjB,IAAI,OAAOK,WAAW,aAAa;QACjC,iEAAiE;QACjE,MAAM,EAAEC,wBAAwB,EAAE,GAChCC,QAAQ;QACV,IAAID,4BAA4B;YAC9B,mEAAmE;YACnE,OAAOH;QACT;IACF;IAEA,OAAOA;AACT;AAKO,SAASpC;IACdgC,IAAAA,kEAAgC,EAAC;IACjC,8EAA8E;IAC9E,0EAA0E;IAC1E,OAAOE,IAAAA,iBAAU,EAACO,gDAAe;AACnC;AAUO,SAAStC;IACd6B,IAAAA,kEAAgC,EAAC;IACjC,MAAMU,SAASR,IAAAA,iBAAU,EAACS,+CAAgB;IAC1C,IAAID,WAAW,MAAM;QACnB,MAAM,IAAI5B,MAAM;IAClB;IAEA,OAAO4B;AACT;AAMA,+EAA+E;AAC/E,SAAS;AACT,SAASE,kBACPC,IAAuB,EACvBC,MAAmB;IAAnBA,IAAAA,mBAAAA,SAAiB,CAAC;IAElB,MAAMC,iBAAiBF,IAAI,CAAC,EAAE;IAE9B,KAAK,MAAMG,iBAAiBC,OAAOpB,MAAM,CAACkB,gBAAiB;QACzD,MAAMG,UAAUF,aAAa,CAAC,EAAE;QAChC,MAAMG,qBAAqBC,MAAMC,OAAO,CAACH;QACzC,MAAMI,eAAeH,qBAAqBD,OAAO,CAAC,EAAE,GAAGA;QACvD,IAAI,CAACI,gBAAgBA,aAAaC,UAAU,CAAC,aAAa;QAE1D,iEAAiE;QACjE,MAAMC,aACJL,sBAAuBD,CAAAA,OAAO,CAAC,EAAE,KAAK,OAAOA,OAAO,CAAC,EAAE,KAAK,IAAG;QAEjE,IAAIM,YAAY;YACdV,MAAM,CAACI,OAAO,CAAC,EAAE,CAAC,GAAGA,OAAO,CAAC,EAAE,CAACO,KAAK,CAAC;QACxC,OAAO,IAAIN,oBAAoB;YAC7BL,MAAM,CAACI,OAAO,CAAC,EAAE,CAAC,GAAGA,OAAO,CAAC,EAAE;QACjC;QAEAJ,SAASF,kBAAkBI,eAAeF;IAC5C;IAEA,OAAOA;AACT;AAMO,SAAS1C;IACd4B,IAAAA,kEAAgC,EAAC;IACjC,MAAM0B,qBAAqBxB,IAAAA,iBAAU,EAACyB,wDAAyB;IAC/D,MAAMC,aAAa1B,IAAAA,iBAAU,EAAC2B,kDAAiB;IAE/C,6BAA6B;IAC7B,IAAIH,oBAAoB;QACtB,OAAOd,kBAAkBc,mBAAmBb,IAAI;IAClD;IAEA,2CAA2C;IAC3C,OAAOe;AACT;AAEA,mCAAmC;AACnC;;CAEC,GACD,SAASE,6BACPjB,IAAuB,EACvBkB,gBAAwB,EACxBC,KAAY,EACZC,WAA0B;IAD1BD,IAAAA,kBAAAA,QAAQ;IACRC,IAAAA,wBAAAA,cAAwB,EAAE;IAE1B,IAAIC;IACJ,IAAIF,OAAO;QACT,kEAAkE;QAClEE,OAAOrB,IAAI,CAAC,EAAE,CAACkB,iBAAiB;IAClC,OAAO;QACL,oGAAoG;QACpG,MAAMhB,iBAAiBF,IAAI,CAAC,EAAE;YACvBE;QAAPmB,OAAOnB,CAAAA,2BAAAA,eAAeoB,QAAQ,YAAvBpB,2BAA2BE,OAAOpB,MAAM,CAACkB,eAAe,CAAC,EAAE;IACpE;IAEA,IAAI,CAACmB,MAAM,OAAOD;IAClB,MAAMf,UAAUgB,IAAI,CAAC,EAAE;IAEvB,MAAMZ,eAAec,IAAAA,gCAAe,EAAClB;IACrC,IAAI,CAACI,gBAAgBA,aAAaC,UAAU,CAAC,aAAa,OAAOU;IAEjEA,YAAYI,IAAI,CAACf;IAEjB,OAAOQ,6BACLI,MACAH,kBACA,OACAE;AAEJ;AAMO,SAAS5D,0BACd0D,gBAAqC;IAArCA,IAAAA,6BAAAA,mBAA2B;IAE3B/B,IAAAA,kEAAgC,EAAC;IACjC,MAAM,EAAEa,IAAI,EAAE,GAAGX,IAAAA,iBAAU,EAACoC,kDAAmB;IAC/C,OAAOR,6BAA6BjB,MAAMkB;AAC5C;AAMO,SAASzD,yBACdyD,gBAAqC;IAArCA,IAAAA,6BAAAA,mBAA2B;IAE3B/B,IAAAA,kEAAgC,EAAC;IACjC,MAAMuC,yBAAyBlE,0BAA0B0D;IACzD,IAAIQ,uBAAuBC,MAAM,KAAK,GAAG;QACvC,OAAO;IACT;IAEA,OAAOD,sBAAsB,CAAC,EAAE;AAClC"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
export default function NoopHead(): null;

21
node_modules/next/dist/client/components/noop-head.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NoopHead;
}
});
function NoopHead() {
return null;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=noop-head.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/noop-head.tsx"],"names":["NoopHead"],"mappings":";;;;+BAAA;;;eAAwBA;;;AAAT,SAASA;IACtB,OAAO;AACT"}

View File

@@ -0,0 +1,9 @@
import React from 'react';
interface NotFoundBoundaryProps {
notFound?: React.ReactNode;
notFoundStyles?: React.ReactNode;
asNotFound?: boolean;
children: React.ReactNode;
}
export declare function NotFoundBoundary({ notFound, notFoundStyles, asNotFound, children, }: NotFoundBoundaryProps): React.JSX.Element;
export {};

View File

@@ -0,0 +1,80 @@
"use client";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NotFoundBoundary", {
enumerable: true,
get: function() {
return NotFoundBoundary;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const _navigation = require("./navigation");
class NotFoundErrorBoundary extends _react.default.Component {
static getDerivedStateFromError(error) {
if ((error == null ? void 0 : error.digest) === "NEXT_NOT_FOUND") {
return {
notFoundTriggered: true
};
}
// Re-throw if error is not for 404
throw error;
}
static getDerivedStateFromProps(props, state) {
/**
* Handles reset of the error boundary when a navigation happens.
* Ensures the error boundary does not stay enabled when navigating to a new page.
* Approach of setState in render is safe as it checks the previous pathname and then overrides
* it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders
*/ if (props.pathname !== state.previousPathname && state.notFoundTriggered) {
return {
notFoundTriggered: false,
previousPathname: props.pathname
};
}
return {
notFoundTriggered: state.notFoundTriggered,
previousPathname: props.pathname
};
}
render() {
if (this.state.notFoundTriggered) {
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement("meta", {
name: "robots",
content: "noindex"
}), process.env.NODE_ENV === "development" && /*#__PURE__*/ _react.default.createElement("meta", {
name: "next-error",
content: "not-found"
}), this.props.notFoundStyles, this.props.notFound);
}
return this.props.children;
}
constructor(props){
super(props);
this.state = {
notFoundTriggered: !!props.asNotFound,
previousPathname: props.pathname
};
}
}
function NotFoundBoundary(param) {
let { notFound, notFoundStyles, asNotFound, children } = param;
const pathname = (0, _navigation.usePathname)();
return notFound ? /*#__PURE__*/ _react.default.createElement(NotFoundErrorBoundary, {
pathname: pathname,
notFound: notFound,
notFoundStyles: notFoundStyles,
asNotFound: asNotFound
}, children) : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, children);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=not-found-boundary.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-boundary.tsx"],"names":["NotFoundBoundary","NotFoundErrorBoundary","React","Component","getDerivedStateFromError","error","digest","notFoundTriggered","getDerivedStateFromProps","props","state","pathname","previousPathname","render","meta","name","content","process","env","NODE_ENV","notFoundStyles","notFound","children","constructor","asNotFound","usePathname"],"mappings":"AAAA;;;;;+BAiFgBA;;;eAAAA;;;;gEA/EE;4BACU;AAkB5B,MAAMC,8BAA8BC,cAAK,CAACC,SAAS;IAYjD,OAAOC,yBAAyBC,KAAU,EAAE;QAC1C,IAAIA,CAAAA,yBAAAA,MAAOC,MAAM,MAAK,kBAAkB;YACtC,OAAO;gBAAEC,mBAAmB;YAAK;QACnC;QACA,mCAAmC;QACnC,MAAMF;IACR;IAEA,OAAOG,yBACLC,KAAiC,EACjCC,KAAiC,EACE;QACnC;;;;;KAKC,GACD,IAAID,MAAME,QAAQ,KAAKD,MAAME,gBAAgB,IAAIF,MAAMH,iBAAiB,EAAE;YACxE,OAAO;gBACLA,mBAAmB;gBACnBK,kBAAkBH,MAAME,QAAQ;YAClC;QACF;QACA,OAAO;YACLJ,mBAAmBG,MAAMH,iBAAiB;YAC1CK,kBAAkBH,MAAME,QAAQ;QAClC;IACF;IAEAE,SAAS;QACP,IAAI,IAAI,CAACH,KAAK,CAACH,iBAAiB,EAAE;YAChC,qBACE,0EACE,6BAACO;gBAAKC,MAAK;gBAASC,SAAQ;gBAC3BC,QAAQC,GAAG,CAACC,QAAQ,KAAK,+BACxB,6BAACL;gBAAKC,MAAK;gBAAaC,SAAQ;gBAEjC,IAAI,CAACP,KAAK,CAACW,cAAc,EACzB,IAAI,CAACX,KAAK,CAACY,QAAQ;QAG1B;QAEA,OAAO,IAAI,CAACZ,KAAK,CAACa,QAAQ;IAC5B;IArDAC,YAAYd,KAAiC,CAAE;QAC7C,KAAK,CAACA;QACN,IAAI,CAACC,KAAK,GAAG;YACXH,mBAAmB,CAAC,CAACE,MAAMe,UAAU;YACrCZ,kBAAkBH,MAAME,QAAQ;QAClC;IACF;AAgDF;AAEO,SAASX,iBAAiB,KAKT;IALS,IAAA,EAC/BqB,QAAQ,EACRD,cAAc,EACdI,UAAU,EACVF,QAAQ,EACc,GALS;IAM/B,MAAMX,WAAWc,IAAAA,uBAAW;IAC5B,OAAOJ,yBACL,6BAACpB;QACCU,UAAUA;QACVU,UAAUA;QACVD,gBAAgBA;QAChBI,YAAYA;OAEXF,0BAGH,4DAAGA;AAEP"}

View File

@@ -0,0 +1,2 @@
import React from 'react';
export default function NotFound(): React.JSX.Element;

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NotFound;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
const styles = {
error: {
// https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52
fontFamily: 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
height: "100vh",
textAlign: "center",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
},
desc: {
display: "inline-block"
},
h1: {
display: "inline-block",
margin: "0 20px 0 0",
padding: "0 23px 0 0",
fontSize: 24,
fontWeight: 500,
verticalAlign: "top",
lineHeight: "49px"
},
h2: {
fontSize: 14,
fontWeight: 400,
lineHeight: "49px",
margin: 0
}
};
function NotFound() {
return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement("title", null, "404: This page could not be found."), /*#__PURE__*/ _react.default.createElement("div", {
style: styles.error
}, /*#__PURE__*/ _react.default.createElement("div", null, /*#__PURE__*/ _react.default.createElement("style", {
dangerouslySetInnerHTML: {
/* Minified CSS from
body { margin: 0; color: #000; background: #fff; }
.next-error-h1 {
border-right: 1px solid rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
body { color: #fff; background: #000; }
.next-error-h1 {
border-right: 1px solid rgba(255, 255, 255, .3);
}
}
*/ __html: "body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"
}
}), /*#__PURE__*/ _react.default.createElement("h1", {
className: "next-error-h1",
style: styles.h1
}, "404"), /*#__PURE__*/ _react.default.createElement("div", {
style: styles.desc
}, /*#__PURE__*/ _react.default.createElement("h2", {
style: styles.h2
}, "This page could not be found.")))));
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=not-found-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found-error.tsx"],"names":["NotFound","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","desc","h1","margin","padding","fontSize","fontWeight","verticalAlign","lineHeight","h2","title","div","style","dangerouslySetInnerHTML","__html","className"],"mappings":";;;;+BAqCA;;;eAAwBA;;;;gEArCN;AAElB,MAAMC,SAA8C;IAClDC,OAAO;QACL,0FAA0F;QAC1FC,YACE;QACFC,QAAQ;QACRC,WAAW;QACXC,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,gBAAgB;IAClB;IAEAC,MAAM;QACJJ,SAAS;IACX;IAEAK,IAAI;QACFL,SAAS;QACTM,QAAQ;QACRC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZC,eAAe;QACfC,YAAY;IACd;IAEAC,IAAI;QACFJ,UAAU;QACVC,YAAY;QACZE,YAAY;QACZL,QAAQ;IACV;AACF;AAEe,SAASZ;IACtB,qBACE,0EAEE,6BAACmB,eAAM,qDAEP,6BAACC;QAAIC,OAAOpB,OAAOC,KAAK;qBACtB,6BAACkB,2BACC,6BAACC;QACCC,yBAAyB;YACvB;;;;;;;;;;;;cAYA,GACAC,QAAS;QACX;sBAEF,6BAACZ;QAAGa,WAAU;QAAgBH,OAAOpB,OAAOU,EAAE;OAAE,sBAGhD,6BAACS;QAAIC,OAAOpB,OAAOS,IAAI;qBACrB,6BAACQ;QAAGG,OAAOpB,OAAOiB,EAAE;OAAE;AAMlC"}

View File

@@ -0,0 +1,18 @@
declare const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
type NotFoundError = Error & {
digest: typeof NOT_FOUND_ERROR_CODE;
};
/**
* When used in a React server component, this will set the status code to 404.
* When used in a custom app route it will just send a 404 status.
*/
export declare function notFound(): never;
/**
* Checks an error to determine if it's an error generated by the `notFound()`
* helper.
*
* @param error the error that may reference a not found error
* @returns true if the error is a not found error
*/
export declare function isNotFoundError(error: any): error is NotFoundError;
export {};

40
node_modules/next/dist/client/components/not-found.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
notFound: null,
isNotFoundError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
notFound: function() {
return notFound;
},
isNotFoundError: function() {
return isNotFoundError;
}
});
const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
function notFound() {
// eslint-disable-next-line no-throw-literal
const error = new Error(NOT_FOUND_ERROR_CODE);
error.digest = NOT_FOUND_ERROR_CODE;
throw error;
}
function isNotFoundError(error) {
return (error == null ? void 0 : error.digest) === NOT_FOUND_ERROR_CODE;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=not-found.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/not-found.ts"],"names":["notFound","isNotFoundError","NOT_FOUND_ERROR_CODE","error","Error","digest"],"mappings":";;;;;;;;;;;;;;;IAQgBA,QAAQ;eAARA;;IAcAC,eAAe;eAAfA;;;AAtBhB,MAAMC,uBAAuB;AAQtB,SAASF;IACd,4CAA4C;IAC5C,MAAMG,QAAQ,IAAIC,MAAMF;IACtBC,MAAwBE,MAAM,GAAGH;IACnC,MAAMC;AACR;AASO,SAASF,gBAAgBE,KAAU;IACxC,OAAOA,CAAAA,yBAAAA,MAAOE,MAAM,MAAKH;AAC3B"}

View File

@@ -0,0 +1 @@
export default function NoopParallelRouteDefault(): void;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NoopParallelRouteDefault;
}
});
const _notfound = require("./not-found");
function NoopParallelRouteDefault() {
(0, _notfound.notFound)();
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=parallel-route-default.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/parallel-route-default.tsx"],"names":["NoopParallelRouteDefault","notFound"],"mappings":";;;;+BAEA;;;eAAwBA;;;0BAFC;AAEV,SAASA;IACtBC,IAAAA,kBAAQ;AACV"}

View File

@@ -0,0 +1,6 @@
export declare class PromiseQueue {
#private;
constructor(maxConcurrency?: number);
enqueue<T>(promiseFn: () => Promise<T>): Promise<T>;
bump(promiseFn: Promise<any>): void;
}

View File

@@ -0,0 +1,91 @@
/*
This is a simple promise queue that allows you to limit the number of concurrent promises
that are running at any given time. It's used to limit the number of concurrent
prefetch requests that are being made to the server but could be used for other
things as well.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "PromiseQueue", {
enumerable: true,
get: function() {
return PromiseQueue;
}
});
const _class_private_field_loose_base = require("@swc/helpers/_/_class_private_field_loose_base");
const _class_private_field_loose_key = require("@swc/helpers/_/_class_private_field_loose_key");
var _maxConcurrency = /*#__PURE__*/ _class_private_field_loose_key._("_maxConcurrency"), _runningCount = /*#__PURE__*/ _class_private_field_loose_key._("_runningCount"), _queue = /*#__PURE__*/ _class_private_field_loose_key._("_queue"), _processNext = /*#__PURE__*/ _class_private_field_loose_key._("_processNext");
class PromiseQueue {
enqueue(promiseFn) {
let taskResolve;
let taskReject;
const taskPromise = new Promise((resolve, reject)=>{
taskResolve = resolve;
taskReject = reject;
});
const task = async ()=>{
try {
_class_private_field_loose_base._(this, _runningCount)[_runningCount]++;
const result = await promiseFn();
taskResolve(result);
} catch (error) {
taskReject(error);
} finally{
_class_private_field_loose_base._(this, _runningCount)[_runningCount]--;
_class_private_field_loose_base._(this, _processNext)[_processNext]();
}
};
const enqueueResult = {
promiseFn: taskPromise,
task
};
// wonder if we should take a LIFO approach here
_class_private_field_loose_base._(this, _queue)[_queue].push(enqueueResult);
_class_private_field_loose_base._(this, _processNext)[_processNext]();
return taskPromise;
}
bump(promiseFn) {
const index = _class_private_field_loose_base._(this, _queue)[_queue].findIndex((item)=>item.promiseFn === promiseFn);
if (index > -1) {
const bumpedItem = _class_private_field_loose_base._(this, _queue)[_queue].splice(index, 1)[0];
_class_private_field_loose_base._(this, _queue)[_queue].unshift(bumpedItem);
_class_private_field_loose_base._(this, _processNext)[_processNext](true);
}
}
constructor(maxConcurrency = 5){
Object.defineProperty(this, _processNext, {
value: processNext
});
Object.defineProperty(this, _maxConcurrency, {
writable: true,
value: void 0
});
Object.defineProperty(this, _runningCount, {
writable: true,
value: void 0
});
Object.defineProperty(this, _queue, {
writable: true,
value: void 0
});
_class_private_field_loose_base._(this, _maxConcurrency)[_maxConcurrency] = maxConcurrency;
_class_private_field_loose_base._(this, _runningCount)[_runningCount] = 0;
_class_private_field_loose_base._(this, _queue)[_queue] = [];
}
}
function processNext(forced) {
if (forced === void 0) forced = false;
if ((_class_private_field_loose_base._(this, _runningCount)[_runningCount] < _class_private_field_loose_base._(this, _maxConcurrency)[_maxConcurrency] || forced) && _class_private_field_loose_base._(this, _queue)[_queue].length > 0) {
var _class_private_field_loose_base__queue_shift;
(_class_private_field_loose_base__queue_shift = _class_private_field_loose_base._(this, _queue)[_queue].shift()) == null ? void 0 : _class_private_field_loose_base__queue_shift.task();
}
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=promise-queue.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/components/promise-queue.ts"],"names":["PromiseQueue","enqueue","promiseFn","taskResolve","taskReject","taskPromise","Promise","resolve","reject","task","runningCount","result","error","processNext","enqueueResult","queue","push","bump","index","findIndex","item","bumpedItem","splice","unshift","constructor","maxConcurrency","forced","length","shift"],"mappings":"AAAA;;;;;AAKA;;;;+BACaA;;;eAAAA;;;;;IACX,qFACA,iFACA,mEAgDA;AAnDK,MAAMA;IAWXC,QAAWC,SAA2B,EAAc;QAClD,IAAIC;QACJ,IAAIC;QAEJ,MAAMC,cAAc,IAAIC,QAAQ,CAACC,SAASC;YACxCL,cAAcI;YACdH,aAAaI;QACf;QAEA,MAAMC,OAAO;YACX,IAAI;gBACF,kCAAA,IAAI,EAAEC,eAAAA;gBACN,MAAMC,SAAS,MAAMT;gBACrBC,YAAYQ;YACd,EAAE,OAAOC,OAAO;gBACdR,WAAWQ;YACb,SAAU;gBACR,kCAAA,IAAI,EAAEF,eAAAA;gBACN,kCAAA,IAAI,EAAEG,cAAAA;YACR;QACF;QAEA,MAAMC,gBAAgB;YAAEZ,WAAWG;YAAaI;QAAK;QACrD,gDAAgD;QAChD,kCAAA,IAAI,EAAEM,QAAAA,QAAMC,IAAI,CAACF;QACjB,kCAAA,IAAI,EAAED,cAAAA;QAEN,OAAOR;IACT;IAEAY,KAAKf,SAAuB,EAAE;QAC5B,MAAMgB,QAAQ,kCAAA,IAAI,EAAEH,QAAAA,QAAMI,SAAS,CAAC,CAACC,OAASA,KAAKlB,SAAS,KAAKA;QAEjE,IAAIgB,QAAQ,CAAC,GAAG;YACd,MAAMG,aAAa,kCAAA,IAAI,EAAEN,QAAAA,QAAMO,MAAM,CAACJ,OAAO,EAAE,CAAC,EAAE;YAClD,kCAAA,IAAI,EAAEH,QAAAA,QAAMQ,OAAO,CAACF;YACpB,kCAAA,IAAI,EAAER,cAAAA,cAAY;QACpB;IACF;IA5CAW,YAAYC,iBAAiB,CAAC,CAAE;QA8ChC,4BAAA;mBAAA;;QAlDA,4BAAA;;mBAAA,KAAA;;QACA,4BAAA;;mBAAA,KAAA;;QACA,4BAAA;;mBAAA,KAAA;;QAGE,kCAAA,IAAI,EAAEA,iBAAAA,mBAAiBA;QACvB,kCAAA,IAAI,EAAEf,eAAAA,iBAAe;QACrB,kCAAA,IAAI,EAAEK,QAAAA,UAAQ,EAAE;IAClB;AAkDF;AARE,SAAA,YAAaW,MAAc;IAAdA,IAAAA,mBAAAA,SAAS;IACpB,IACE,AAAC,CAAA,kCAAA,IAAI,EAAEhB,eAAAA,iBAAe,kCAAA,IAAI,EAAEe,iBAAAA,oBAAkBC,MAAK,KACnD,kCAAA,IAAI,EAAEX,QAAAA,QAAMY,MAAM,GAAG,GACrB;YACA;SAAA,+CAAA,kCAAA,IAAI,EAAEZ,QAAAA,QAAMa,KAAK,uBAAjB,6CAAqBnB,IAAI;IAC3B;AACF"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,6 @@
import { ReactNode } from 'react';
import React from 'react';
export default function HotReload({ assetPrefix, children, }: {
assetPrefix: string;
children?: ReactNode;
}): React.JSX.Element;

View File

@@ -0,0 +1,402 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return HotReload;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
const _formatwebpackmessages = /*#__PURE__*/ _interop_require_default._(require("../../dev/error-overlay/format-webpack-messages"));
const _navigation = require("../navigation");
const _erroroverlayreducer = require("./internal/error-overlay-reducer");
const _parseStack = require("./internal/helpers/parseStack");
const _ReactDevOverlay = /*#__PURE__*/ _interop_require_default._(require("./internal/ReactDevOverlay"));
const _useerrorhandler = require("./internal/helpers/use-error-handler");
const _usewebsocket = require("./internal/helpers/use-websocket");
const _parsecomponentstack = require("./internal/helpers/parse-component-stack");
const _hotreloadertypes = require("../../../server/dev/hot-reloader-types");
let mostRecentCompilationHash = null;
let __nextDevClientId = Math.round(Math.random() * 100 + Date.now());
function onBeforeFastRefresh(dispatcher, hasUpdates) {
if (hasUpdates) {
dispatcher.onBeforeRefresh();
}
}
function onFastRefresh(dispatcher, hasUpdates) {
dispatcher.onBuildOk();
if (hasUpdates) {
dispatcher.onRefresh();
}
}
// There is a newer version of the code available.
function handleAvailableHash(hash) {
// Update last known compilation hash.
mostRecentCompilationHash = hash;
}
// Is there a newer version of this code available?
function isUpdateAvailable() {
/* globals __webpack_hash__ */ // __webpack_hash__ is the hash of the current compilation.
// It's a global variable injected by Webpack.
return mostRecentCompilationHash !== __webpack_hash__;
}
// Webpack disallows updates in other states.
function canApplyUpdates() {
// @ts-expect-error module.hot exists
return module.hot.status() === "idle";
}
function afterApplyUpdates(fn) {
if (canApplyUpdates()) {
fn();
} else {
function handler(status) {
if (status === "idle") {
// @ts-expect-error module.hot exists
module.hot.removeStatusHandler(handler);
fn();
}
}
// @ts-expect-error module.hot exists
module.hot.addStatusHandler(handler);
}
}
function performFullReload(err, sendMessage) {
const stackTrace = err && (err.stack && err.stack.split("\n").slice(0, 5).join("\n") || err.message || err + "");
sendMessage(JSON.stringify({
event: "client-full-reload",
stackTrace,
hadRuntimeError: !!_useerrorhandler.RuntimeErrorHandler.hadRuntimeError
}));
window.location.reload();
}
// Attempt to update code on the fly, fall back to a hard reload.
function tryApplyUpdates(onBeforeUpdate, onHotUpdateSuccess, sendMessage, dispatcher) {
if (!isUpdateAvailable() || !canApplyUpdates()) {
dispatcher.onBuildOk();
return;
}
function handleApplyUpdates(err, updatedModules) {
if (err || _useerrorhandler.RuntimeErrorHandler.hadRuntimeError || !updatedModules) {
if (err) {
console.warn("[Fast Refresh] performing full reload\n\n" + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + "You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n" + "Consider migrating the non-React component export to a separate file and importing it into both files.\n\n" + "It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n" + "Fast Refresh requires at least one parent function component in your React tree.");
} else if (_useerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
console.warn("[Fast Refresh] performing full reload because your application had an unrecoverable error");
}
performFullReload(err, sendMessage);
return;
}
const hasUpdates = Boolean(updatedModules.length);
if (typeof onHotUpdateSuccess === "function") {
// Maybe we want to do something.
onHotUpdateSuccess(hasUpdates);
}
if (isUpdateAvailable()) {
// While we were updating, there was a new update! Do it again.
tryApplyUpdates(hasUpdates ? ()=>{} : onBeforeUpdate, hasUpdates ? ()=>dispatcher.onBuildOk() : onHotUpdateSuccess, sendMessage, dispatcher);
} else {
dispatcher.onBuildOk();
if (process.env.__NEXT_TEST_MODE) {
afterApplyUpdates(()=>{
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB();
self.__NEXT_HMR_CB = null;
}
});
}
}
}
// https://webpack.js.org/api/hot-module-replacement/#check
// @ts-expect-error module.hot exists
module.hot.check(/* autoApply */ false).then((updatedModules)=>{
if (!updatedModules) {
return null;
}
if (typeof onBeforeUpdate === "function") {
const hasUpdates = Boolean(updatedModules.length);
onBeforeUpdate(hasUpdates);
}
// https://webpack.js.org/api/hot-module-replacement/#apply
// @ts-expect-error module.hot exists
return module.hot.apply();
}).then((updatedModules)=>{
handleApplyUpdates(null, updatedModules);
}, (err)=>{
handleApplyUpdates(err, null);
});
}
function processMessage(obj, sendMessage, router, dispatcher) {
if (!("action" in obj)) {
return;
}
function handleErrors(errors) {
// "Massage" webpack messages.
const formatted = (0, _formatwebpackmessages.default)({
errors: errors,
warnings: []
});
// Only show the first error.
dispatcher.onBuildError(formatted.errors[0]);
// Also log them to the console.
for(let i = 0; i < formatted.errors.length; i++){
console.error((0, _stripansi.default)(formatted.errors[i]));
}
// Do not attempt to reload now.
// We will reload on next success instead.
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB(formatted.errors[0]);
self.__NEXT_HMR_CB = null;
}
}
}
switch(obj.action){
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
{
console.log("[Fast Refresh] rebuilding");
break;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SYNC:
{
if (obj.hash) {
handleAvailableHash(obj.hash);
}
const { errors, warnings } = obj;
// Is undefined when it's a 'built' event
if ("versionInfo" in obj) {
dispatcher.onVersionInfo(obj.versionInfo);
}
const hasErrors = Boolean(errors && errors.length);
// Compilation with errors (e.g. syntax error or missing modules).
if (hasErrors) {
sendMessage(JSON.stringify({
event: "client-error",
errorCount: errors.length,
clientId: __nextDevClientId
}));
handleErrors(errors);
return;
}
const hasWarnings = Boolean(warnings && warnings.length);
if (hasWarnings) {
sendMessage(JSON.stringify({
event: "client-warning",
warningCount: warnings.length,
clientId: __nextDevClientId
}));
// Compilation with warnings (e.g. ESLint).
const isHotUpdate = obj.action !== _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SYNC;
// Print warnings to the console.
const formattedMessages = (0, _formatwebpackmessages.default)({
warnings: warnings,
errors: []
});
for(let i = 0; i < formattedMessages.warnings.length; i++){
if (i === 5) {
console.warn("There were more warnings in other files.\n" + "You can find a complete log in the terminal.");
break;
}
console.warn((0, _stripansi.default)(formattedMessages.warnings[i]));
}
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
onBeforeFastRefresh(dispatcher, hasUpdates);
}, function onSuccessfulHotUpdate(hasUpdates) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
onFastRefresh(dispatcher, hasUpdates);
}, sendMessage, dispatcher);
}
return;
}
sendMessage(JSON.stringify({
event: "client-success",
clientId: __nextDevClientId
}));
const isHotUpdate = obj.action !== _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SYNC && (!window.__NEXT_DATA__ || window.__NEXT_DATA__.page !== "/_error") && isUpdateAvailable();
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(function onBeforeHotUpdate(hasUpdates) {
onBeforeFastRefresh(dispatcher, hasUpdates);
}, function onSuccessfulHotUpdate(hasUpdates) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
onFastRefresh(dispatcher, hasUpdates);
}, sendMessage, dispatcher);
}
return;
}
// TODO-APP: make server component change more granular
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES:
{
sendMessage(JSON.stringify({
event: "server-component-reload-page",
clientId: __nextDevClientId
}));
if (_useerrorhandler.RuntimeErrorHandler.hadRuntimeError) {
return window.location.reload();
}
(0, _react.startTransition)(()=>{
// @ts-ignore it exists, it's just hidden
router.fastRefresh();
dispatcher.onRefresh();
});
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB();
self.__NEXT_HMR_CB = null;
}
}
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE:
{
sendMessage(JSON.stringify({
event: "client-reload-page",
clientId: __nextDevClientId
}));
return window.location.reload();
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was removed.
// @ts-ignore it exists, it's just hidden
router.fastRefresh();
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE:
{
// TODO-APP: potentially only refresh if the currently viewed page was added.
// @ts-ignore it exists, it's just hidden
router.fastRefresh();
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR:
{
const { errorJSON } = obj;
if (errorJSON) {
const { message, stack } = JSON.parse(errorJSON);
const error = new Error(message);
error.stack = stack;
handleErrors([
error
]);
}
return;
}
case _hotreloadertypes.HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE:
{
return;
}
default:
{
throw new Error("Unexpected action " + JSON.stringify(obj));
}
}
}
function HotReload(param) {
let { assetPrefix, children } = param;
const [state, dispatch] = (0, _react.useReducer)(_erroroverlayreducer.errorOverlayReducer, _erroroverlayreducer.INITIAL_OVERLAY_STATE);
const dispatcher = (0, _react.useMemo)(()=>{
return {
onBuildOk () {
dispatch({
type: _erroroverlayreducer.ACTION_BUILD_OK
});
},
onBuildError (message) {
dispatch({
type: _erroroverlayreducer.ACTION_BUILD_ERROR,
message
});
},
onBeforeRefresh () {
dispatch({
type: _erroroverlayreducer.ACTION_BEFORE_REFRESH
});
},
onRefresh () {
dispatch({
type: _erroroverlayreducer.ACTION_REFRESH
});
},
onVersionInfo (versionInfo) {
dispatch({
type: _erroroverlayreducer.ACTION_VERSION_INFO,
versionInfo
});
}
};
}, [
dispatch
]);
const handleOnUnhandledError = (0, _react.useCallback)((error)=>{
// Component stack is added to the error in use-error-handler in case there was a hydration errror
const componentStack = error._componentStack;
dispatch({
type: _erroroverlayreducer.ACTION_UNHANDLED_ERROR,
reason: error,
frames: (0, _parseStack.parseStack)(error.stack),
componentStackFrames: componentStack && (0, _parsecomponentstack.parseComponentStack)(componentStack)
});
}, []);
const handleOnUnhandledRejection = (0, _react.useCallback)((reason)=>{
dispatch({
type: _erroroverlayreducer.ACTION_UNHANDLED_REJECTION,
reason: reason,
frames: (0, _parseStack.parseStack)(reason.stack)
});
}, []);
const handleOnReactError = (0, _react.useCallback)(()=>{
_useerrorhandler.RuntimeErrorHandler.hadRuntimeError = true;
}, []);
(0, _useerrorhandler.useErrorHandler)(handleOnUnhandledError, handleOnUnhandledRejection);
const webSocketRef = (0, _usewebsocket.useWebsocket)(assetPrefix);
(0, _usewebsocket.useWebsocketPing)(webSocketRef);
const sendMessage = (0, _usewebsocket.useSendMessage)(webSocketRef);
const processTurbopackMessage = (0, _usewebsocket.useTurbopack)(sendMessage);
const router = (0, _navigation.useRouter)();
(0, _react.useEffect)(()=>{
const handler = (event)=>{
try {
const obj = JSON.parse(event.data);
const handledByTurbopack = processTurbopackMessage == null ? void 0 : processTurbopackMessage(obj);
if (!handledByTurbopack) {
processMessage(obj, sendMessage, router, dispatcher);
}
} catch (err) {
var _err_stack;
console.warn("[HMR] Invalid message: " + event.data + "\n" + ((_err_stack = err == null ? void 0 : err.stack) != null ? _err_stack : ""));
}
};
const websocket = webSocketRef.current;
if (websocket) {
websocket.addEventListener("message", handler);
}
return ()=>websocket && websocket.removeEventListener("message", handler);
}, [
sendMessage,
router,
webSocketRef,
dispatcher,
processTurbopackMessage
]);
return /*#__PURE__*/ _react.default.createElement(_ReactDevOverlay.default, {
onReactError: handleOnReactError,
state: state
}, children);
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=hot-reloader-client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import { OverlayState } from './error-overlay-reducer';
import { SupportedErrorEvent } from './container/Errors';
interface ReactDevOverlayState {
reactError: SupportedErrorEvent | null;
}
declare class ReactDevOverlay extends React.PureComponent<{
state: OverlayState;
children: React.ReactNode;
onReactError: (error: Error) => void;
}, ReactDevOverlayState> {
state: {
reactError: null;
};
static getDerivedStateFromError(error: Error): ReactDevOverlayState;
componentDidCatch(componentErr: Error): void;
render(): React.JSX.Element;
}
export default ReactDevOverlay;

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _erroroverlayreducer = require("./error-overlay-reducer");
const _ShadowPortal = require("./components/ShadowPortal");
const _BuildError = require("./container/BuildError");
const _Errors = require("./container/Errors");
const _RootLayoutError = require("./container/RootLayoutError");
const _parseStack = require("./helpers/parseStack");
const _Base = require("./styles/Base");
const _ComponentStyles = require("./styles/ComponentStyles");
const _CssReset = require("./styles/CssReset");
class ReactDevOverlay extends _react.PureComponent {
static getDerivedStateFromError(error) {
const e = error;
const event = {
type: _erroroverlayreducer.ACTION_UNHANDLED_ERROR,
reason: error,
frames: (0, _parseStack.parseStack)(e.stack)
};
const errorEvent = {
id: 0,
event
};
return {
reactError: errorEvent
};
}
componentDidCatch(componentErr) {
this.props.onReactError(componentErr);
}
render() {
const { state, children } = this.props;
const { reactError } = this.state;
const hasBuildError = state.buildError != null;
const hasRuntimeErrors = Boolean(state.errors.length);
const rootLayoutMissingTagsError = state.rootLayoutMissingTagsError;
const isMounted = hasBuildError || hasRuntimeErrors || reactError || rootLayoutMissingTagsError;
return /*#__PURE__*/ _react.createElement(_react.Fragment, null, reactError ? /*#__PURE__*/ _react.createElement("html", null, /*#__PURE__*/ _react.createElement("head", null), /*#__PURE__*/ _react.createElement("body", null)) : children, isMounted ? /*#__PURE__*/ _react.createElement(_ShadowPortal.ShadowPortal, null, /*#__PURE__*/ _react.createElement(_CssReset.CssReset, null), /*#__PURE__*/ _react.createElement(_Base.Base, null), /*#__PURE__*/ _react.createElement(_ComponentStyles.ComponentStyles, null), rootLayoutMissingTagsError ? /*#__PURE__*/ _react.createElement(_RootLayoutError.RootLayoutError, {
missingTags: rootLayoutMissingTagsError.missingTags
}) : hasBuildError ? /*#__PURE__*/ _react.createElement(_BuildError.BuildError, {
message: state.buildError,
versionInfo: state.versionInfo
}) : reactError ? /*#__PURE__*/ _react.createElement(_Errors.Errors, {
versionInfo: state.versionInfo,
initialDisplayState: "fullscreen",
errors: [
reactError
]
}) : hasRuntimeErrors ? /*#__PURE__*/ _react.createElement(_Errors.Errors, {
initialDisplayState: "minimized",
errors: state.errors,
versionInfo: state.versionInfo
}) : undefined) : undefined);
}
constructor(...args){
super(...args);
this.state = {
reactError: null
};
}
}
const _default = ReactDevOverlay;
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=ReactDevOverlay.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/components/react-dev-overlay/internal/ReactDevOverlay.tsx"],"names":["ReactDevOverlay","React","PureComponent","getDerivedStateFromError","error","e","event","type","ACTION_UNHANDLED_ERROR","reason","frames","parseStack","stack","errorEvent","id","reactError","componentDidCatch","componentErr","props","onReactError","render","state","children","hasBuildError","buildError","hasRuntimeErrors","Boolean","errors","length","rootLayoutMissingTagsError","isMounted","html","head","body","ShadowPortal","CssReset","Base","ComponentStyles","RootLayoutError","missingTags","BuildError","message","versionInfo","Errors","initialDisplayState","undefined"],"mappings":";;;;+BAyGA;;;eAAA;;;;iEAzGuB;qCAKhB;8BAEsB;4BACF;wBACiB;iCACZ;4BACL;sBACN;iCACW;0BACP;AAKzB,MAAMA,wBAAwBC,OAAMC,aAAa;IAU/C,OAAOC,yBAAyBC,KAAY,EAAwB;QAClE,MAAMC,IAAID;QACV,MAAME,QAA8B;YAClCC,MAAMC,2CAAsB;YAC5BC,QAAQL;YACRM,QAAQC,IAAAA,sBAAU,EAACN,EAAEO,KAAK;QAC5B;QACA,MAAMC,aAAkC;YACtCC,IAAI;YACJR;QACF;QACA,OAAO;YAAES,YAAYF;QAAW;IAClC;IAEAG,kBAAkBC,YAAmB,EAAE;QACrC,IAAI,CAACC,KAAK,CAACC,YAAY,CAACF;IAC1B;IAEAG,SAAS;QACP,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAG,IAAI,CAACJ,KAAK;QACtC,MAAM,EAAEH,UAAU,EAAE,GAAG,IAAI,CAACM,KAAK;QAEjC,MAAME,gBAAgBF,MAAMG,UAAU,IAAI;QAC1C,MAAMC,mBAAmBC,QAAQL,MAAMM,MAAM,CAACC,MAAM;QACpD,MAAMC,6BAA6BR,MAAMQ,0BAA0B;QACnE,MAAMC,YACJP,iBACAE,oBACAV,cACAc;QAEF,qBACE,4CACGd,2BACC,qBAACgB,4BACC,qBAACC,6BACD,qBAACC,iBAGHX,UAEDQ,0BACC,qBAACI,0BAAY,sBACX,qBAACC,kBAAQ,uBACT,qBAACC,UAAI,uBACL,qBAACC,gCAAe,SAEfR,2CACC,qBAACS,gCAAe;YACdC,aAAaV,2BAA2BU,WAAW;aAEnDhB,8BACF,qBAACiB,sBAAU;YACTC,SAASpB,MAAMG,UAAU;YACzBkB,aAAarB,MAAMqB,WAAW;aAE9B3B,2BACF,qBAAC4B,cAAM;YACLD,aAAarB,MAAMqB,WAAW;YAC9BE,qBAAoB;YACpBjB,QAAQ;gBAACZ;aAAW;aAEpBU,iCACF,qBAACkB,cAAM;YACLC,qBAAoB;YACpBjB,QAAQN,MAAMM,MAAM;YACpBe,aAAarB,MAAMqB,WAAW;aAE9BG,aAEJA;IAGV;;;aA3EAxB,QAAQ;YAAEN,YAAY;QAAK;;AA4E7B;MAEA,WAAef"}

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
import { StackFrame } from 'next/dist/compiled/stacktrace-parser';
export type CodeFrameProps = {
stackFrame: StackFrame;
codeFrame: string;
};
export declare const CodeFrame: React.FC<CodeFrameProps>;

View File

@@ -0,0 +1,90 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CodeFrame", {
enumerable: true,
get: function() {
return CodeFrame;
}
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _anser = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/anser"));
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _stripansi = /*#__PURE__*/ _interop_require_default._(require("next/dist/compiled/strip-ansi"));
const _stackframe = require("../../helpers/stack-frame");
const _useopenineditor = require("../../helpers/use-open-in-editor");
const CodeFrame = function CodeFrame(param) {
let { stackFrame, codeFrame } = param;
// Strip leading spaces out of the code frame:
const formattedFrame = _react.useMemo(()=>{
const lines = codeFrame.split(/\r?\n/g);
const prefixLength = lines.map((line)=>/^>? +\d+ +\| [ ]+/.exec((0, _stripansi.default)(line)) === null ? null : /^>? +\d+ +\| ( *)/.exec((0, _stripansi.default)(line))).filter(Boolean).map((v)=>v.pop()).reduce((c, n)=>isNaN(c) ? n.length : Math.min(c, n.length), NaN);
if (prefixLength > 1) {
const p = " ".repeat(prefixLength);
return lines.map((line, a)=>~(a = line.indexOf("|")) ? line.substring(0, a) + line.substring(a).replace(p, "") : line).join("\n");
}
return lines.join("\n");
}, [
codeFrame
]);
const decoded = _react.useMemo(()=>{
return _anser.default.ansiToJson(formattedFrame, {
json: true,
use_classes: true,
remove_empty: true
});
}, [
formattedFrame
]);
const open = (0, _useopenineditor.useOpenInEditor)({
file: stackFrame.file,
lineNumber: stackFrame.lineNumber,
column: stackFrame.column
});
// TODO: make the caret absolute
return /*#__PURE__*/ _react.createElement("div", {
"data-nextjs-codeframe": true
}, /*#__PURE__*/ _react.createElement("div", null, /*#__PURE__*/ _react.createElement("p", {
role: "link",
onClick: open,
tabIndex: 1,
title: "Click to open in your editor"
}, /*#__PURE__*/ _react.createElement("span", null, (0, _stackframe.getFrameSource)(stackFrame), " @ ", stackFrame.methodName), /*#__PURE__*/ _react.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}, /*#__PURE__*/ _react.createElement("path", {
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
}), /*#__PURE__*/ _react.createElement("polyline", {
points: "15 3 21 3 21 9"
}), /*#__PURE__*/ _react.createElement("line", {
x1: "10",
y1: "14",
x2: "21",
y2: "3"
})))), /*#__PURE__*/ _react.createElement("pre", null, decoded.map((entry, index)=>/*#__PURE__*/ _react.createElement("span", {
key: "frame-" + index,
style: {
color: entry.fg ? "var(--color-" + entry.fg + ")" : undefined,
...entry.decoration === "bold" ? {
fontWeight: 800
} : entry.decoration === "italic" ? {
fontStyle: "italic"
} : undefined
}
}, entry.content))));
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=CodeFrame.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/CodeFrame.tsx"],"names":["CodeFrame","stackFrame","codeFrame","formattedFrame","React","useMemo","lines","split","prefixLength","map","line","exec","stripAnsi","filter","Boolean","v","pop","reduce","c","n","isNaN","length","Math","min","NaN","p","repeat","a","indexOf","substring","replace","join","decoded","Anser","ansiToJson","json","use_classes","remove_empty","open","useOpenInEditor","file","lineNumber","column","div","data-nextjs-codeframe","role","onClick","tabIndex","title","span","getFrameSource","methodName","svg","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","path","d","polyline","points","x1","y1","x2","y2","pre","entry","index","key","style","color","fg","undefined","decoration","fontWeight","fontStyle","content"],"mappings":";;;;+BASaA;;;eAAAA;;;;;gEATK;iEACK;oEAED;4BACS;iCACC;AAIzB,MAAMA,YAAsC,SAASA,UAAU,KAGrE;IAHqE,IAAA,EACpEC,UAAU,EACVC,SAAS,EACV,GAHqE;IAIpE,8CAA8C;IAC9C,MAAMC,iBAAiBC,OAAMC,OAAO,CAAS;QAC3C,MAAMC,QAAQJ,UAAUK,KAAK,CAAC;QAC9B,MAAMC,eAAeF,MAClBG,GAAG,CAAC,CAACC,OACJ,oBAAoBC,IAAI,CAACC,IAAAA,kBAAS,EAACF,WAAW,OAC1C,OACA,oBAAoBC,IAAI,CAACC,IAAAA,kBAAS,EAACF,QAExCG,MAAM,CAACC,SACPL,GAAG,CAAC,CAACM,IAAMA,EAAGC,GAAG,IACjBC,MAAM,CAAC,CAACC,GAAGC,IAAOC,MAAMF,KAAKC,EAAEE,MAAM,GAAGC,KAAKC,GAAG,CAACL,GAAGC,EAAEE,MAAM,GAAIG;QAEnE,IAAIhB,eAAe,GAAG;YACpB,MAAMiB,IAAI,IAAIC,MAAM,CAAClB;YACrB,OAAOF,MACJG,GAAG,CAAC,CAACC,MAAMiB,IACV,CAAEA,CAAAA,IAAIjB,KAAKkB,OAAO,CAAC,IAAG,IAClBlB,KAAKmB,SAAS,CAAC,GAAGF,KAAKjB,KAAKmB,SAAS,CAACF,GAAGG,OAAO,CAACL,GAAG,MACpDf,MAELqB,IAAI,CAAC;QACV;QACA,OAAOzB,MAAMyB,IAAI,CAAC;IACpB,GAAG;QAAC7B;KAAU;IAEd,MAAM8B,UAAU5B,OAAMC,OAAO,CAAC;QAC5B,OAAO4B,cAAK,CAACC,UAAU,CAAC/B,gBAAgB;YACtCgC,MAAM;YACNC,aAAa;YACbC,cAAc;QAChB;IACF,GAAG;QAAClC;KAAe;IAEnB,MAAMmC,OAAOC,IAAAA,gCAAe,EAAC;QAC3BC,MAAMvC,WAAWuC,IAAI;QACrBC,YAAYxC,WAAWwC,UAAU;QACjCC,QAAQzC,WAAWyC,MAAM;IAC3B;IAEA,gCAAgC;IAChC,qBACE,qBAACC;QAAIC,yBAAAA;qBACH,qBAACD,2BACC,qBAAClB;QACCoB,MAAK;QACLC,SAASR;QACTS,UAAU;QACVC,OAAM;qBAEN,qBAACC,cACEC,IAAAA,0BAAc,EAACjD,aAAY,OAAIA,WAAWkD,UAAU,iBAEvD,qBAACC;QACCC,OAAM;QACNC,SAAQ;QACRC,MAAK;QACLC,QAAO;QACPC,aAAY;QACZC,eAAc;QACdC,gBAAe;qBAEf,qBAACC;QAAKC,GAAE;sBACR,qBAACC;QAASC,QAAO;sBACjB,qBAACrD;QAAKsD,IAAG;QAAKC,IAAG;QAAKC,IAAG;QAAKC,IAAG;yBAIvC,qBAACC,aACEpC,QAAQvB,GAAG,CAAC,CAAC4D,OAAOC,sBACnB,qBAACrB;YACCsB,KAAK,AAAC,WAAQD;YACdE,OAAO;gBACLC,OAAOJ,MAAMK,EAAE,GAAG,AAAC,iBAAcL,MAAMK,EAAE,GAAC,MAAKC;gBAC/C,GAAIN,MAAMO,UAAU,KAAK,SACrB;oBAAEC,YAAY;gBAAI,IAClBR,MAAMO,UAAU,KAAK,WACrB;oBAAEE,WAAW;gBAAS,IACtBH,SAAS;YACf;WAECN,MAAMU,OAAO;AAM1B"}

View File

@@ -0,0 +1 @@
export { CodeFrame } from './CodeFrame';

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "CodeFrame", {
enumerable: true,
get: function() {
return _CodeFrame.CodeFrame;
}
});
const _CodeFrame = require("./CodeFrame");
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/index.tsx"],"names":["CodeFrame"],"mappings":";;;;+BAASA;;;eAAAA,oBAAS;;;2BAAQ"}

View File

@@ -0,0 +1,2 @@
declare const styles: string;
export { styles };

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "styles", {
enumerable: true,
get: function() {
return styles;
}
});
const _tagged_template_literal_loose = require("@swc/helpers/_/_tagged_template_literal_loose");
const _nooptemplate = require("../../helpers/noop-template");
function _templateObject() {
const data = _tagged_template_literal_loose._([
"\n [data-nextjs-codeframe] {\n overflow: auto;\n border-radius: var(--size-gap-half);\n background-color: var(--color-ansi-bg);\n color: var(--color-ansi-fg);\n }\n [data-nextjs-codeframe]::selection,\n [data-nextjs-codeframe] *::selection {\n background-color: var(--color-ansi-selection);\n }\n [data-nextjs-codeframe] * {\n color: inherit;\n background-color: transparent;\n font-family: var(--font-stack-monospace);\n }\n\n [data-nextjs-codeframe] > * {\n margin: 0;\n padding: calc(var(--size-gap) + var(--size-gap-half))\n calc(var(--size-gap-double) + var(--size-gap-half));\n }\n [data-nextjs-codeframe] > div {\n display: inline-block;\n width: auto;\n min-width: 100%;\n border-bottom: 1px solid var(--color-ansi-bright-black);\n }\n [data-nextjs-codeframe] > div > p {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n margin: 0;\n }\n [data-nextjs-codeframe] > div > p:hover {\n text-decoration: underline dotted;\n }\n [data-nextjs-codeframe] div > p > svg {\n width: auto;\n height: 1em;\n margin-left: 8px;\n }\n [data-nextjs-codeframe] div > pre {\n overflow: hidden;\n display: inline-block;\n }\n"
]);
_templateObject = function() {
return data;
};
return data;
}
const styles = (0, _nooptemplate.noop)(_templateObject());
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=styles.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/CodeFrame/styles.tsx"],"names":["styles","css"],"mappings":";;;;+BAmDSA;;;eAAAA;;;;8BAnDmB;;;;;;;;;;AAE5B,MAAMA,aAASC,kBAAG"}

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
export type DialogProps = {
children?: React.ReactNode;
type: 'error' | 'warning';
'aria-labelledby': string;
'aria-describedby': string;
onClose?: (e: MouseEvent | TouchEvent) => void;
};
declare const Dialog: React.FC<DialogProps>;
export { Dialog };

View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Dialog", {
enumerable: true,
get: function() {
return Dialog;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useonclickoutside = require("../../hooks/use-on-click-outside");
const Dialog = function Dialog(param) {
let { children, type, onClose, ...props } = param;
const [dialog, setDialog] = _react.useState(null);
const [role, setRole] = _react.useState(typeof document !== "undefined" && document.hasFocus() ? "dialog" : undefined);
const onDialog = _react.useCallback((node)=>{
setDialog(node);
}, []);
(0, _useonclickoutside.useOnClickOutside)(dialog, onClose);
// Make HTMLElements with `role=link` accessible to be triggered by the
// keyboard, i.e. [Enter].
_react.useEffect(()=>{
if (dialog == null) {
return;
}
const root = dialog.getRootNode();
// Always true, but we do this for TypeScript:
if (!(root instanceof ShadowRoot)) {
return;
}
const shadowRoot = root;
function handler(e) {
const el = shadowRoot.activeElement;
if (e.key === "Enter" && el instanceof HTMLElement && el.getAttribute("role") === "link") {
e.preventDefault();
e.stopPropagation();
el.click();
}
}
function handleFocus() {
// safari will force itself as the active application when a background page triggers any sort of autofocus
// this is a workaround to only set the dialog role if the document has focus
setRole(document.hasFocus() ? "dialog" : undefined);
}
shadowRoot.addEventListener("keydown", handler);
window.addEventListener("focus", handleFocus);
window.addEventListener("blur", handleFocus);
return ()=>{
shadowRoot.removeEventListener("keydown", handler);
window.removeEventListener("focus", handleFocus);
window.removeEventListener("blur", handleFocus);
};
}, [
dialog
]);
return /*#__PURE__*/ _react.createElement("div", {
ref: onDialog,
"data-nextjs-dialog": true,
tabIndex: -1,
role: role,
"aria-labelledby": props["aria-labelledby"],
"aria-describedby": props["aria-describedby"],
"aria-modal": "true"
}, /*#__PURE__*/ _react.createElement("div", {
"data-nextjs-dialog-banner": true,
className: "banner-" + type
}), children);
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=Dialog.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/Dialog.tsx"],"names":["Dialog","children","type","onClose","props","dialog","setDialog","React","useState","role","setRole","document","hasFocus","undefined","onDialog","useCallback","node","useOnClickOutside","useEffect","root","getRootNode","ShadowRoot","shadowRoot","handler","e","el","activeElement","key","HTMLElement","getAttribute","preventDefault","stopPropagation","click","handleFocus","addEventListener","window","removeEventListener","div","ref","data-nextjs-dialog","tabIndex","aria-labelledby","aria-describedby","aria-modal","data-nextjs-dialog-banner","className"],"mappings":";;;;+BAuFSA;;;eAAAA;;;;iEAvFc;mCACW;AAUlC,MAAMA,SAAgC,SAASA,OAAO,KAKrD;IALqD,IAAA,EACpDC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACP,GAAGC,OACJ,GALqD;IAMpD,MAAM,CAACC,QAAQC,UAAU,GAAGC,OAAMC,QAAQ,CAAwB;IAClE,MAAM,CAACC,MAAMC,QAAQ,GAAGH,OAAMC,QAAQ,CACpC,OAAOG,aAAa,eAAeA,SAASC,QAAQ,KAChD,WACAC;IAEN,MAAMC,WAAWP,OAAMQ,WAAW,CAAC,CAACC;QAClCV,UAAUU;IACZ,GAAG,EAAE;IACLC,IAAAA,oCAAiB,EAACZ,QAAQF;IAE1B,uEAAuE;IACvE,0BAA0B;IAC1BI,OAAMW,SAAS,CAAC;QACd,IAAIb,UAAU,MAAM;YAClB;QACF;QAEA,MAAMc,OAAOd,OAAOe,WAAW;QAC/B,8CAA8C;QAC9C,IAAI,CAAED,CAAAA,gBAAgBE,UAAS,GAAI;YACjC;QACF;QACA,MAAMC,aAAaH;QACnB,SAASI,QAAQC,CAAgB;YAC/B,MAAMC,KAAKH,WAAWI,aAAa;YACnC,IACEF,EAAEG,GAAG,KAAK,WACVF,cAAcG,eACdH,GAAGI,YAAY,CAAC,YAAY,QAC5B;gBACAL,EAAEM,cAAc;gBAChBN,EAAEO,eAAe;gBAEjBN,GAAGO,KAAK;YACV;QACF;QAEA,SAASC;YACP,2GAA2G;YAC3G,6EAA6E;YAC7EvB,QAAQC,SAASC,QAAQ,KAAK,WAAWC;QAC3C;QAEAS,WAAWY,gBAAgB,CAAC,WAAWX;QACvCY,OAAOD,gBAAgB,CAAC,SAASD;QACjCE,OAAOD,gBAAgB,CAAC,QAAQD;QAChC,OAAO;YACLX,WAAWc,mBAAmB,CAAC,WAAWb;YAC1CY,OAAOC,mBAAmB,CAAC,SAASH;YACpCE,OAAOC,mBAAmB,CAAC,QAAQH;QACrC;IACF,GAAG;QAAC5B;KAAO;IAEX,qBACE,qBAACgC;QACCC,KAAKxB;QACLyB,sBAAAA;QACAC,UAAU,CAAC;QACX/B,MAAMA;QACNgC,mBAAiBrC,KAAK,CAAC,kBAAkB;QACzCsC,oBAAkBtC,KAAK,CAAC,mBAAmB;QAC3CuC,cAAW;qBAEX,qBAACN;QAAIO,6BAAAA;QAA0BC,WAAW,AAAC,YAAS3C;QACnDD;AAGP"}

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
export type DialogBodyProps = {
children?: React.ReactNode;
className?: string;
};
declare const DialogBody: React.FC<DialogBodyProps>;
export { DialogBody };

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DialogBody", {
enumerable: true,
get: function() {
return DialogBody;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const DialogBody = function DialogBody(param) {
let { children, className } = param;
return /*#__PURE__*/ _react.createElement("div", {
"data-nextjs-dialog-body": true,
className: className
}, children);
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=DialogBody.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/client/components/react-dev-overlay/internal/components/Dialog/DialogBody.tsx"],"names":["DialogBody","children","className","div","data-nextjs-dialog-body"],"mappings":";;;;+BAkBSA;;;eAAAA;;;;iEAlBc;AAOvB,MAAMA,aAAwC,SAASA,WAAW,KAGjE;IAHiE,IAAA,EAChEC,QAAQ,EACRC,SAAS,EACV,GAHiE;IAIhE,qBACE,qBAACC;QAAIC,2BAAAA;QAAwBF,WAAWA;OACrCD;AAGP"}

View File

@@ -0,0 +1,7 @@
import * as React from 'react';
export type DialogContentProps = {
children?: React.ReactNode;
className?: string;
};
declare const DialogContent: React.FC<DialogContentProps>;
export { DialogContent };

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "DialogContent", {
enumerable: true,
get: function() {
return DialogContent;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const DialogContent = function DialogContent(param) {
let { children, className } = param;
return /*#__PURE__*/ _react.createElement("div", {
"data-nextjs-dialog-content": true,
className: className
}, children);
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=DialogContent.js.map

Some files were not shown because too many files have changed in this diff Show More