next 15.2.0-canary.15 → 15.2.0-canary.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +17 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.d.ts +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +160 -375
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/use-delayed-render.d.ts +11 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/use-delayed-render.js +76 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/use-delayed-render.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +17 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +162 -377
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/use-delayed-render.js +60 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/use-delayed-render.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/export/index.js +17 -3
- package/dist/esm/export/index.js.map +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/dev/next-dev-server.js +4 -0
- package/dist/esm/server/dev/next-dev-server.js.map +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/export/index.js +16 -2
- package/dist/export/index.js.map +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/dev/next-dev-server.js +4 -0
- package/dist/server/dev/next-dev-server.js.map +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
package/dist/esm/build/index.js
CHANGED
|
@@ -293,7 +293,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
293
293
|
const nextBuildSpan = trace('next-build', undefined, {
|
|
294
294
|
buildMode: experimentalBuildMode,
|
|
295
295
|
isTurboBuild: String(turboNextBuild),
|
|
296
|
-
version: "15.2.0-canary.
|
|
296
|
+
version: "15.2.0-canary.16"
|
|
297
297
|
});
|
|
298
298
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
299
299
|
NextBuildContext.dir = dir;
|
|
@@ -653,7 +653,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
653
653
|
// Files outside of the distDir can be "type": "module"
|
|
654
654
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
655
655
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
656
|
-
await recordFrameworkVersion("15.2.0-canary.
|
|
656
|
+
await recordFrameworkVersion("15.2.0-canary.16");
|
|
657
657
|
await updateBuildDiagnostics({
|
|
658
658
|
buildStage: 'start'
|
|
659
659
|
});
|
|
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
|
|
|
11
11
|
import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
|
|
12
12
|
import { getReactCompilerLoader } from '../get-babel-loader-config';
|
|
13
13
|
import { TurbopackInternalError } from '../../server/dev/turbopack-utils';
|
|
14
|
-
const nextVersion = "15.2.0-canary.
|
|
14
|
+
const nextVersion = "15.2.0-canary.16";
|
|
15
15
|
const ArchName = arch();
|
|
16
16
|
const PlatformName = platform();
|
|
17
17
|
function infoLog(...args) {
|
|
@@ -1400,7 +1400,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1400
1400
|
isClient && new CopyFilePlugin({
|
|
1401
1401
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1402
1402
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1403
|
-
cacheKey: "15.2.0-canary.
|
|
1403
|
+
cacheKey: "15.2.0-canary.16",
|
|
1404
1404
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1405
1405
|
minimize: false,
|
|
1406
1406
|
info: {
|
|
@@ -1628,7 +1628,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1628
1628
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1629
1629
|
// - Next.js version
|
|
1630
1630
|
// - next.config.js keys that affect compilation
|
|
1631
|
-
version: `${__dirname}|${"15.2.0-canary.
|
|
1631
|
+
version: `${__dirname}|${"15.2.0-canary.16"}|${configVars}`,
|
|
1632
1632
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1633
1633
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1634
1634
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -4,6 +4,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
4
4
|
import { NextLogo } from './internal/next-logo';
|
|
5
5
|
import { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize-for-new-overlay';
|
|
6
6
|
import { useIsDevRendering } from './internal/dev-render-indicator';
|
|
7
|
+
import { useDelayedRender } from './internal/use-delayed-render';
|
|
7
8
|
// TODO: test a11y
|
|
8
9
|
// TODO: add E2E tests to cover different scenarios
|
|
9
10
|
export function DevToolsIndicator(param) {
|
|
@@ -17,11 +18,19 @@ export function DevToolsIndicator(param) {
|
|
|
17
18
|
isTurbopack: isTurbopack
|
|
18
19
|
});
|
|
19
20
|
}
|
|
21
|
+
const ANIMATE_OUT_DURATION_MS = 200;
|
|
22
|
+
const ANIMATE_OUT_TIMING_FUNCTION = 'cubic-bezier(0.175, 0.885, 0.32, 1.1)';
|
|
20
23
|
const DevToolsPopover = (param)=>{
|
|
21
24
|
let { onIssuesClick, issueCount, isStaticRoute, hide, semver, isTurbopack } = param;
|
|
22
25
|
const popoverRef = useRef(null);
|
|
23
26
|
const buttonRef = useRef(null);
|
|
24
27
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
28
|
+
const { mounted, rendered } = useDelayedRender(isPopoverOpen, {
|
|
29
|
+
// Intentionally no fade in, makes the UI feel more immediate
|
|
30
|
+
enterDelay: 0,
|
|
31
|
+
// Graceful fade out to confirm that the UI did not break
|
|
32
|
+
exitDelay: ANIMATE_OUT_DURATION_MS
|
|
33
|
+
});
|
|
25
34
|
useEffect(()=>{
|
|
26
35
|
// Close popover when clicking outside of it or its button
|
|
27
36
|
const handleClickOutside = (event)=>{
|
|
@@ -55,20 +64,26 @@ const DevToolsPopover = (param)=>{
|
|
|
55
64
|
children: /*#__PURE__*/ _jsx(NextLogo, {
|
|
56
65
|
issueCount: issueCount,
|
|
57
66
|
onClick: togglePopover,
|
|
67
|
+
onIssuesClick: onIssuesClick,
|
|
58
68
|
isDevBuilding: useIsDevBuilding(),
|
|
59
69
|
isDevRendering: useIsDevRendering(),
|
|
60
70
|
"aria-haspopup": "true",
|
|
61
71
|
"aria-expanded": isPopoverOpen,
|
|
62
72
|
"aria-controls": "dev-tools-popover",
|
|
63
73
|
"data-nextjs-dev-tools-button": true
|
|
64
|
-
})
|
|
74
|
+
}, issueCount)
|
|
65
75
|
}),
|
|
66
|
-
|
|
76
|
+
mounted && /*#__PURE__*/ _jsxs("div", {
|
|
67
77
|
ref: popoverRef,
|
|
68
78
|
id: "dev-tools-popover",
|
|
69
79
|
role: "dialog",
|
|
70
80
|
"aria-labelledby": "dev-tools-title",
|
|
71
81
|
"data-nextjs-dev-tools-popover": true,
|
|
82
|
+
"data-rendered": rendered,
|
|
83
|
+
style: {
|
|
84
|
+
'--animate-out-duration-ms': "" + ANIMATE_OUT_DURATION_MS + "ms",
|
|
85
|
+
'--animate-out-timing-function': ANIMATE_OUT_TIMING_FUNCTION
|
|
86
|
+
},
|
|
72
87
|
tabIndex: -1,
|
|
73
88
|
children: [
|
|
74
89
|
/*#__PURE__*/ _jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../src/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.tsx"],"sourcesContent":["import type { VersionInfo } from '../../../../../../../../server/dev/parse-version-info'\nimport type { ReadyRuntimeError } from '../../../helpers/get-error-by-type'\nimport { Toast } from '../../toast'\nimport React, { useState, useEffect, useRef } from 'react'\nimport { NextLogo } from './internal/next-logo'\nimport { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize-for-new-overlay'\nimport { useIsDevRendering } from './internal/dev-render-indicator'\n\n// TODO: test a11y\n// TODO: add E2E tests to cover different scenarios\n\nexport function DevToolsIndicator({\n versionInfo,\n hasStaticIndicator,\n readyErrors,\n fullscreen,\n hide,\n isTurbopack,\n}: {\n versionInfo: VersionInfo | undefined\n readyErrors: ReadyRuntimeError[]\n fullscreen: () => void\n hide: () => void\n hasStaticIndicator?: boolean\n isTurbopack: boolean\n}) {\n return (\n <DevToolsPopover\n semver={versionInfo?.installed}\n onIssuesClick={fullscreen}\n issueCount={readyErrors.length}\n isStaticRoute={hasStaticIndicator === true}\n hide={hide}\n isTurbopack={isTurbopack}\n />\n )\n}\n\nconst DevToolsPopover = ({\n onIssuesClick,\n issueCount,\n isStaticRoute,\n hide,\n semver,\n isTurbopack,\n}: {\n onIssuesClick: () => void\n issueCount: number\n isStaticRoute: boolean\n hide: () => void\n semver: string | undefined\n isTurbopack: boolean\n}) => {\n const popoverRef = useRef<HTMLDivElement>(null)\n const buttonRef = useRef<HTMLDivElement>(null)\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\n\n useEffect(() => {\n // Close popover when clicking outside of it or its button\n const handleClickOutside = (event: MouseEvent) => {\n if (\n !(popoverRef.current?.getBoundingClientRect()\n ? event.clientX >= popoverRef.current.getBoundingClientRect()!.left &&\n event.clientX <=\n popoverRef.current.getBoundingClientRect()!.right &&\n event.clientY >= popoverRef.current.getBoundingClientRect()!.top &&\n event.clientY <= popoverRef.current.getBoundingClientRect()!.bottom\n : false) &&\n !(buttonRef.current?.getBoundingClientRect()\n ? event.clientX >= buttonRef.current.getBoundingClientRect()!.left &&\n event.clientX <= buttonRef.current.getBoundingClientRect()!.right &&\n event.clientY >= buttonRef.current.getBoundingClientRect()!.top &&\n event.clientY <= buttonRef.current.getBoundingClientRect()!.bottom\n : false)\n ) {\n setIsPopoverOpen(false)\n }\n }\n\n // Close popover when pressing escape\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsPopoverOpen(false)\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [])\n\n const togglePopover = () => setIsPopoverOpen((prev) => !prev)\n\n return (\n <Toast\n style={{\n boxShadow: 'none',\n zIndex: 2147483647,\n }}\n >\n <div ref={buttonRef}>\n <NextLogo\n issueCount={issueCount}\n onClick={togglePopover}\n isDevBuilding={useIsDevBuilding()}\n isDevRendering={useIsDevRendering()}\n aria-haspopup=\"true\"\n aria-expanded={isPopoverOpen}\n aria-controls=\"dev-tools-popover\"\n data-nextjs-dev-tools-button\n />\n </div>\n\n {isPopoverOpen && (\n <div\n ref={popoverRef}\n id=\"dev-tools-popover\"\n role=\"dialog\"\n aria-labelledby=\"dev-tools-title\"\n data-nextjs-dev-tools-popover\n tabIndex={-1}\n >\n <div data-nextjs-dev-tools-content>\n <div data-nextjs-dev-tools-container>\n <h2 id=\"dev-tools-title\" style={{ display: 'none' }}>\n Dev Tools Options\n </h2>\n\n <IndicatorRow\n label=\"Hide Dev Tools\"\n value={<DevToolsShortcutGroup />}\n onClick={hide}\n />\n <IndicatorRow\n label=\"Route\"\n value={isStaticRoute ? 'Static' : 'Dynamic'}\n />\n <IndicatorRow\n label=\"Issues\"\n value={<IssueCount count={issueCount} />}\n onClick={issueCount > 0 ? onIssuesClick : undefined}\n />\n </div>\n </div>\n <div data-nextjs-dev-tools-footer>\n <div data-nextjs-dev-tools-footer-text>\n {semver ? (\n <p data-nextjs-dev-tools-version>Next.js {semver}</p>\n ) : null}\n\n <p data-nextjs-dev-tools-version>\n Turbopack {isTurbopack ? 'enabled' : 'not enabled'}\n </p>\n </div>\n </div>\n </div>\n )}\n </Toast>\n )\n}\n\nconst IndicatorRow = ({\n label,\n value,\n onClick,\n}: {\n label: string\n value: React.ReactNode\n onClick?: () => void\n}) => {\n const Wrapper = onClick ? 'button' : 'div'\n return (\n <Wrapper data-nextjs-dev-tools-row onClick={onClick}>\n <span data-nextjs-dev-tools-row-label>{label}</span>\n <span data-nextjs-dev-tools-row-value>{value}</span>\n </Wrapper>\n )\n}\n\nconst IssueCount = ({ count }: { count: number }) => {\n return (\n <span data-nextjs-dev-tools-issue-count data-has-issues={count > 0}>\n <span data-nextjs-dev-tools-issue-text data-has-issues={count > 0}>\n {count}\n </span>\n </span>\n )\n}\n\nfunction DevToolsShortcutGroup() {\n const isMac =\n // Feature detect for `navigator.userAgentData` which is experimental:\n // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform\n 'userAgentData' in navigator\n ? (navigator.userAgentData as any).platform === 'macOS'\n : // This is the least-bad option to detect the modifier key when using `navigator.platform`:\n // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples\n navigator.platform.indexOf('Mac') === 0 ||\n navigator.platform === 'iPhone'\n\n return (\n <span data-nextjs-dev-tools-shortcut-group>\n {isMac ? <CmdIcon /> : <CtrlIcon />}\n <DotIcon />\n </span>\n )\n}\n\nfunction CmdIcon() {\n return <span data-nextjs-dev-tools-icon>⌘</span>\n}\n\nfunction CtrlIcon() {\n return (\n <span data-nextjs-dev-tools-icon data-nextjs-dev-tools-ctrl-icon>\n ctrl\n </span>\n )\n}\n\nfunction DotIcon() {\n return <span data-nextjs-dev-tools-icon>.</span>\n}\n"],"names":["Toast","React","useState","useEffect","useRef","NextLogo","useIsDevBuilding","useIsDevRendering","DevToolsIndicator","versionInfo","hasStaticIndicator","readyErrors","fullscreen","hide","isTurbopack","DevToolsPopover","semver","installed","onIssuesClick","issueCount","length","isStaticRoute","popoverRef","buttonRef","isPopoverOpen","setIsPopoverOpen","handleClickOutside","event","current","getBoundingClientRect","clientX","left","right","clientY","top","bottom","handleKeyDown","key","document","addEventListener","removeEventListener","togglePopover","prev","style","boxShadow","zIndex","div","ref","onClick","isDevBuilding","isDevRendering","aria-haspopup","aria-expanded","aria-controls","data-nextjs-dev-tools-button","id","role","aria-labelledby","data-nextjs-dev-tools-popover","tabIndex","data-nextjs-dev-tools-content","data-nextjs-dev-tools-container","h2","display","IndicatorRow","label","value","DevToolsShortcutGroup","IssueCount","count","undefined","data-nextjs-dev-tools-footer","data-nextjs-dev-tools-footer-text","p","data-nextjs-dev-tools-version","Wrapper","data-nextjs-dev-tools-row","span","data-nextjs-dev-tools-row-label","data-nextjs-dev-tools-row-value","data-nextjs-dev-tools-issue-count","data-has-issues","data-nextjs-dev-tools-issue-text","isMac","navigator","userAgentData","platform","indexOf","data-nextjs-dev-tools-shortcut-group","CmdIcon","CtrlIcon","DotIcon","data-nextjs-dev-tools-icon","data-nextjs-dev-tools-ctrl-icon"],"mappings":";AAEA,SAASA,KAAK,QAAQ,cAAa;AACnC,OAAOC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,QAAO;AAC1D,SAASC,QAAQ,QAAQ,uBAAsB;AAC/C,SAASC,gBAAgB,QAAQ,mFAAkF;AACnH,SAASC,iBA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/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.tsx"],"sourcesContent":["import type { VersionInfo } from '../../../../../../../../server/dev/parse-version-info'\nimport type { ReadyRuntimeError } from '../../../helpers/get-error-by-type'\nimport { Toast } from '../../toast'\nimport React, { useState, useEffect, useRef } from 'react'\nimport { NextLogo } from './internal/next-logo'\nimport { useIsDevBuilding } from '../../../../../../../dev/dev-build-indicator/internal/initialize-for-new-overlay'\nimport { useIsDevRendering } from './internal/dev-render-indicator'\nimport { useDelayedRender } from './internal/use-delayed-render'\n\n// TODO: test a11y\n// TODO: add E2E tests to cover different scenarios\n\nexport function DevToolsIndicator({\n versionInfo,\n hasStaticIndicator,\n readyErrors,\n fullscreen,\n hide,\n isTurbopack,\n}: {\n versionInfo: VersionInfo | undefined\n readyErrors: ReadyRuntimeError[]\n fullscreen: () => void\n hide: () => void\n hasStaticIndicator?: boolean\n isTurbopack: boolean\n}) {\n return (\n <DevToolsPopover\n semver={versionInfo?.installed}\n onIssuesClick={fullscreen}\n issueCount={readyErrors.length}\n isStaticRoute={hasStaticIndicator === true}\n hide={hide}\n isTurbopack={isTurbopack}\n />\n )\n}\n\nconst ANIMATE_OUT_DURATION_MS = 200\nconst ANIMATE_OUT_TIMING_FUNCTION = 'cubic-bezier(0.175, 0.885, 0.32, 1.1)'\n\nconst DevToolsPopover = ({\n onIssuesClick,\n issueCount,\n isStaticRoute,\n hide,\n semver,\n isTurbopack,\n}: {\n onIssuesClick: () => void\n issueCount: number\n isStaticRoute: boolean\n hide: () => void\n semver: string | undefined\n isTurbopack: boolean\n}) => {\n const popoverRef = useRef<HTMLDivElement>(null)\n const buttonRef = useRef<HTMLDivElement>(null)\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\n\n const { mounted, rendered } = useDelayedRender(isPopoverOpen, {\n // Intentionally no fade in, makes the UI feel more immediate\n enterDelay: 0,\n // Graceful fade out to confirm that the UI did not break\n exitDelay: ANIMATE_OUT_DURATION_MS,\n })\n\n useEffect(() => {\n // Close popover when clicking outside of it or its button\n const handleClickOutside = (event: MouseEvent) => {\n if (\n !(popoverRef.current?.getBoundingClientRect()\n ? event.clientX >= popoverRef.current.getBoundingClientRect()!.left &&\n event.clientX <=\n popoverRef.current.getBoundingClientRect()!.right &&\n event.clientY >= popoverRef.current.getBoundingClientRect()!.top &&\n event.clientY <= popoverRef.current.getBoundingClientRect()!.bottom\n : false) &&\n !(buttonRef.current?.getBoundingClientRect()\n ? event.clientX >= buttonRef.current.getBoundingClientRect()!.left &&\n event.clientX <= buttonRef.current.getBoundingClientRect()!.right &&\n event.clientY >= buttonRef.current.getBoundingClientRect()!.top &&\n event.clientY <= buttonRef.current.getBoundingClientRect()!.bottom\n : false)\n ) {\n setIsPopoverOpen(false)\n }\n }\n\n // Close popover when pressing escape\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsPopoverOpen(false)\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [])\n\n const togglePopover = () => setIsPopoverOpen((prev) => !prev)\n\n return (\n <Toast\n style={{\n boxShadow: 'none',\n zIndex: 2147483647,\n }}\n >\n <div ref={buttonRef}>\n <NextLogo\n key={issueCount}\n issueCount={issueCount}\n onClick={togglePopover}\n onIssuesClick={onIssuesClick}\n isDevBuilding={useIsDevBuilding()}\n isDevRendering={useIsDevRendering()}\n aria-haspopup=\"true\"\n aria-expanded={isPopoverOpen}\n aria-controls=\"dev-tools-popover\"\n data-nextjs-dev-tools-button\n />\n </div>\n\n {mounted && (\n <div\n ref={popoverRef}\n id=\"dev-tools-popover\"\n role=\"dialog\"\n aria-labelledby=\"dev-tools-title\"\n data-nextjs-dev-tools-popover\n data-rendered={rendered}\n style={\n {\n '--animate-out-duration-ms': `${ANIMATE_OUT_DURATION_MS}ms`,\n '--animate-out-timing-function': ANIMATE_OUT_TIMING_FUNCTION,\n } as React.CSSProperties\n }\n tabIndex={-1}\n >\n <div data-nextjs-dev-tools-content>\n <div data-nextjs-dev-tools-container>\n <h2 id=\"dev-tools-title\" style={{ display: 'none' }}>\n Dev Tools Options\n </h2>\n\n <IndicatorRow\n label=\"Hide Dev Tools\"\n value={<DevToolsShortcutGroup />}\n onClick={hide}\n />\n <IndicatorRow\n label=\"Route\"\n value={isStaticRoute ? 'Static' : 'Dynamic'}\n />\n <IndicatorRow\n label=\"Issues\"\n value={<IssueCount count={issueCount} />}\n onClick={issueCount > 0 ? onIssuesClick : undefined}\n />\n </div>\n </div>\n <div data-nextjs-dev-tools-footer>\n <div data-nextjs-dev-tools-footer-text>\n {semver ? (\n <p data-nextjs-dev-tools-version>Next.js {semver}</p>\n ) : null}\n\n <p data-nextjs-dev-tools-version>\n Turbopack {isTurbopack ? 'enabled' : 'not enabled'}\n </p>\n </div>\n </div>\n </div>\n )}\n </Toast>\n )\n}\n\nconst IndicatorRow = ({\n label,\n value,\n onClick,\n}: {\n label: string\n value: React.ReactNode\n onClick?: () => void\n}) => {\n const Wrapper = onClick ? 'button' : 'div'\n return (\n <Wrapper data-nextjs-dev-tools-row onClick={onClick}>\n <span data-nextjs-dev-tools-row-label>{label}</span>\n <span data-nextjs-dev-tools-row-value>{value}</span>\n </Wrapper>\n )\n}\n\nconst IssueCount = ({ count }: { count: number }) => {\n return (\n <span data-nextjs-dev-tools-issue-count data-has-issues={count > 0}>\n <span data-nextjs-dev-tools-issue-text data-has-issues={count > 0}>\n {count}\n </span>\n </span>\n )\n}\n\nfunction DevToolsShortcutGroup() {\n const isMac =\n // Feature detect for `navigator.userAgentData` which is experimental:\n // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/platform\n 'userAgentData' in navigator\n ? (navigator.userAgentData as any).platform === 'macOS'\n : // This is the least-bad option to detect the modifier key when using `navigator.platform`:\n // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform#examples\n navigator.platform.indexOf('Mac') === 0 ||\n navigator.platform === 'iPhone'\n\n return (\n <span data-nextjs-dev-tools-shortcut-group>\n {isMac ? <CmdIcon /> : <CtrlIcon />}\n <DotIcon />\n </span>\n )\n}\n\nfunction CmdIcon() {\n return <span data-nextjs-dev-tools-icon>⌘</span>\n}\n\nfunction CtrlIcon() {\n return (\n <span data-nextjs-dev-tools-icon data-nextjs-dev-tools-ctrl-icon>\n ctrl\n </span>\n )\n}\n\nfunction DotIcon() {\n return <span data-nextjs-dev-tools-icon>.</span>\n}\n"],"names":["Toast","React","useState","useEffect","useRef","NextLogo","useIsDevBuilding","useIsDevRendering","useDelayedRender","DevToolsIndicator","versionInfo","hasStaticIndicator","readyErrors","fullscreen","hide","isTurbopack","DevToolsPopover","semver","installed","onIssuesClick","issueCount","length","isStaticRoute","ANIMATE_OUT_DURATION_MS","ANIMATE_OUT_TIMING_FUNCTION","popoverRef","buttonRef","isPopoverOpen","setIsPopoverOpen","mounted","rendered","enterDelay","exitDelay","handleClickOutside","event","current","getBoundingClientRect","clientX","left","right","clientY","top","bottom","handleKeyDown","key","document","addEventListener","removeEventListener","togglePopover","prev","style","boxShadow","zIndex","div","ref","onClick","isDevBuilding","isDevRendering","aria-haspopup","aria-expanded","aria-controls","data-nextjs-dev-tools-button","id","role","aria-labelledby","data-nextjs-dev-tools-popover","data-rendered","tabIndex","data-nextjs-dev-tools-content","data-nextjs-dev-tools-container","h2","display","IndicatorRow","label","value","DevToolsShortcutGroup","IssueCount","count","undefined","data-nextjs-dev-tools-footer","data-nextjs-dev-tools-footer-text","p","data-nextjs-dev-tools-version","Wrapper","data-nextjs-dev-tools-row","span","data-nextjs-dev-tools-row-label","data-nextjs-dev-tools-row-value","data-nextjs-dev-tools-issue-count","data-has-issues","data-nextjs-dev-tools-issue-text","isMac","navigator","userAgentData","platform","indexOf","data-nextjs-dev-tools-shortcut-group","CmdIcon","CtrlIcon","DotIcon","data-nextjs-dev-tools-icon","data-nextjs-dev-tools-ctrl-icon"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