Unverified Commit f8599631 authored by rauno's avatar rauno Committed by GitHub

[Error Overlay] New design (#75679)

This PR implements a new design for the experimental Next.js Error
Overlay:

- Border-less body design
- Notch cut-out for the navigation and version info

<img width="1088" alt="image"
src="https://github.com/user-attachments/assets/31385793-82c4-41ab-a34d-6b49955f5823"
/>



---

- Closes
[NDX-782](https://linear.app/vercel/issue/NDX-782/re-redesign-contents-in-a-single-body-with-padding)
- Closes
[NDX-781](https://linear.app/vercel/issue/NDX-781/re-redesign-navigation-header)

---------
Co-authored-by: 's avatardevjiwonchoi <devjiwonchoi@gmail.com>
parent a32f14e8
...@@ -52,7 +52,6 @@ export const CallStackFrame: React.FC<{ ...@@ -52,7 +52,6 @@ export const CallStackFrame: React.FC<{
<div <div
data-nextjs-call-stack-frame data-nextjs-call-stack-frame
data-nextjs-call-stack-frame-ignored={!hasSource} data-nextjs-call-stack-frame-ignored={!hasSource}
data-animate={frame.ignored}
{...props} {...props}
style={ style={
{ {
...@@ -89,25 +88,17 @@ export const CALL_STACK_FRAME_STYLES = css` ...@@ -89,25 +88,17 @@ export const CALL_STACK_FRAME_STYLES = css`
user-select: text; user-select: text;
display: block; display: block;
box-sizing: border-box; box-sizing: border-box;
width: 100%;
user-select: text; user-select: text;
-webkit-user-select: text; -webkit-user-select: text;
-moz-user-select: text; -moz-user-select: text;
-ms-user-select: text; -ms-user-select: text;
padding: var(--size-1_5) var(--size-2); padding: 6px 8px;
margin-bottom: var(--size-1);
border-radius: var(--rounded-lg); border-radius: var(--rounded-lg);
transition: background 100ms ease-out; transition: background 100ms ease-out;
&[data-animate='true'] {
filter: blur(4px);
animation: fadeIn 250ms var(--timing-swift) forwards
calc(var(--index) * 25ms);
}
&:not(:disabled)[role='button']:hover { &:not(:disabled)[role='button']:hover {
background: var(--color-gray-alpha-100); background: var(--color-gray-alpha-100);
cursor: pointer; cursor: pointer;
...@@ -141,10 +132,4 @@ export const CALL_STACK_FRAME_STYLES = css` ...@@ -141,10 +132,4 @@ export const CALL_STACK_FRAME_STYLES = css`
font-size: var(--size-font-small); font-size: var(--size-font-small);
line-height: var(--size-5); line-height: var(--size-5);
} }
@keyframes fadeIn {
to {
filter: blur(0px);
}
}
` `
...@@ -104,12 +104,16 @@ export const CODE_FRAME_STYLES = css` ...@@ -104,12 +104,16 @@ export const CODE_FRAME_STYLES = css`
overflow: hidden; overflow: hidden;
color: var(--color-gray-1000); color: var(--color-gray-1000);
text-overflow: ellipsis; text-overflow: ellipsis;
border: 1px solid var(--color-gray-400);
border-radius: 8px;
font-family: var(--font-stack-monospace); font-family: var(--font-stack-monospace);
font-size: 12px; font-size: 12px;
line-height: 16px; line-height: 16px;
margin: var(--size-4) var(--size-4) var(--size-2); margin: var(--next-dialog-row-padding);
border: 1px solid var(--color-gray-400);
border-radius: var(--size-2); &:has(~ [data-nextjs-call-stack]) {
margin-bottom: 0;
}
} }
.code-frame-link, .code-frame-link,
...@@ -117,15 +121,12 @@ export const CODE_FRAME_STYLES = css` ...@@ -117,15 +121,12 @@ export const CODE_FRAME_STYLES = css`
padding: 12px; padding: 12px;
} }
.code-frame-pre {
white-space: pre-wrap;
}
.code-frame-header { .code-frame-header {
width: 100%; width: 100%;
cursor: pointer; cursor: pointer;
border-bottom: 1px solid var(--color-gray-400);
transition: background 100ms ease-out; transition: background 100ms ease-out;
border-radius: 8px 8px 0 0;
border-bottom: 1px solid var(--color-gray-400);
&:focus-visible { &:focus-visible {
outline: var(--focus-ring); outline: var(--focus-ring);
......
...@@ -5,9 +5,10 @@ const styles = css` ...@@ -5,9 +5,10 @@ const styles = css`
--next-dialog-radius: var(--rounded-xl); --next-dialog-radius: var(--rounded-xl);
--next-dialog-footer-height: 48px; --next-dialog-footer-height: 48px;
--next-dialog-max-width: 960px; --next-dialog-max-width: 960px;
--next-dialog-row-padding: 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column-reverse;
width: 100%; width: 100%;
max-height: calc(100% - 56px); max-height: calc(100% - 56px);
max-width: var(--next-dialog-max-width); max-width: var(--next-dialog-max-width);
...@@ -48,6 +49,7 @@ const styles = css` ...@@ -48,6 +49,7 @@ const styles = css`
} }
[data-nextjs-dialog-content] { [data-nextjs-dialog-content] {
overflow-y: auto;
border: none; border: none;
margin: 0; margin: 0;
display: flex; display: flex;
...@@ -62,7 +64,8 @@ const styles = css` ...@@ -62,7 +64,8 @@ const styles = css`
[data-nextjs-dialog-content] > [data-nextjs-dialog-header] { [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {
flex-shrink: 0; flex-shrink: 0;
padding: var(--size-4); padding: var(--next-dialog-row-padding);
padding-bottom: 0;
} }
[data-nextjs-dialog-content] > [data-nextjs-dialog-body] { [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {
......
...@@ -2,7 +2,6 @@ import type { OriginalStackFrame } from '../../../../../internal/helpers/stack-f ...@@ -2,7 +2,6 @@ import type { OriginalStackFrame } from '../../../../../internal/helpers/stack-f
import { useMemo, useState, useRef } from 'react' import { useMemo, useState, useRef } from 'react'
import { CallStackFrame } from '../../call-stack-frame/call-stack-frame' import { CallStackFrame } from '../../call-stack-frame/call-stack-frame'
import { noop as css } from '../../../helpers/noop-template' import { noop as css } from '../../../helpers/noop-template'
import { useMeasureHeight } from '../../../hooks/use-measure-height'
interface CallStackProps { interface CallStackProps {
frames: OriginalStackFrame[] frames: OriginalStackFrame[]
...@@ -10,10 +9,8 @@ interface CallStackProps { ...@@ -10,10 +9,8 @@ interface CallStackProps {
} }
export function CallStack({ frames, dialogResizerRef }: CallStackProps) { export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
const ignoreListRef = useRef<HTMLDivElement | null>(null)
const initialDialogHeight = useRef<number>(NaN) const initialDialogHeight = useRef<number>(NaN)
const [isIgnoreListOpen, setIsIgnoreListOpen] = useState(false) const [isIgnoreListOpen, setIsIgnoreListOpen] = useState(false)
const [ignoreListHeight] = useMeasureHeight(ignoreListRef)
const { visibleFrames, ignoredFrames, ignoreListLength } = useMemo(() => { const { visibleFrames, ignoredFrames, ignoreListLength } = useMemo(() => {
const visible: OriginalStackFrame[] = [] const visible: OriginalStackFrame[] = []
...@@ -50,14 +47,13 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) { ...@@ -50,14 +47,13 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
if (isIgnoreListOpen) { if (isIgnoreListOpen) {
function onTransitionEnd() { function onTransitionEnd() {
setIsIgnoreListOpen(false)
dialog.removeEventListener('transitionend', onTransitionEnd) dialog.removeEventListener('transitionend', onTransitionEnd)
setIsIgnoreListOpen(false)
} }
dialog.style.height = `${initialDialogHeight.current}px` dialog.style.height = `${initialDialogHeight.current}px`
dialog.addEventListener('transitionend', onTransitionEnd) dialog.addEventListener('transitionend', onTransitionEnd)
} else { } else {
dialog.style.height = `${initialDialogHeight.current + ignoreListHeight}px` setIsIgnoreListOpen(true)
setIsIgnoreListOpen(!isIgnoreListOpen)
} }
} }
...@@ -81,27 +77,25 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) { ...@@ -81,27 +77,25 @@ export function CallStack({ frames, dialogResizerRef }: CallStackProps) {
</button> </button>
)} )}
</div> </div>
<div className="error-overlay-call-stack-body"> {visibleFrames.map((frame, frameIndex) => (
{visibleFrames.map((frame, frameIndex) => ( <CallStackFrame
<CallStackFrame key={`call-stack-leading-${frameIndex}`}
key={`call-stack-leading-${frameIndex}`} frame={frame}
frame={frame} index={frameIndex}
index={frameIndex} />
/> ))}
))}
{isIgnoreListOpen && (
{isIgnoreListOpen && ( <>
<div ref={ignoreListRef}> {ignoredFrames.map((frame, frameIndex) => (
{ignoredFrames.map((frame, frameIndex) => ( <CallStackFrame
<CallStackFrame key={`call-stack-ignored-${frameIndex}`}
key={`call-stack-ignored-${frameIndex}`} frame={frame}
frame={frame} index={frameIndex}
index={frameIndex} />
/> ))}
))} </>
</div> )}
)}
</div>
</div> </div>
) )
} }
...@@ -128,13 +122,10 @@ function ChevronUpDown() { ...@@ -128,13 +122,10 @@ function ChevronUpDown() {
export const CALL_STACK_STYLES = css` export const CALL_STACK_STYLES = css`
.error-overlay-call-stack-container { .error-overlay-call-stack-container {
position: relative; position: relative;
}
.error-overlay-call-stack-body {
padding: var(--size-4) var(--size-3); padding: var(--size-4) var(--size-3);
padding-top: 0;
/* To optically align last item */ /* To optically align last item */
padding-bottom: 8px; padding-bottom: 8px;
position: relative;
} }
.error-overlay-call-stack-header { .error-overlay-call-stack-header {
...@@ -142,19 +133,9 @@ export const CALL_STACK_STYLES = css` ...@@ -142,19 +133,9 @@ export const CALL_STACK_STYLES = css`
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
min-height: 28px; min-height: 28px;
padding: var(--size-4) var(--size-5) var(--size-3) var(--size-4); margin-bottom: var(--size-3);
background: rgba(255, 255, 255, 0.7); padding: 0 var(--size-2);
mask-image: linear-gradient(to top, transparent, #000 12%);
backdrop-filter: blur(8px);
width: 100%; width: 100%;
position: fixed;
position: sticky;
top: 0;
z-index: 2;
@media (prefers-color-scheme: dark) {
background: #0a0a0a70;
}
} }
.error-overlay-call-stack-title { .error-overlay-call-stack-title {
......
...@@ -2,14 +2,12 @@ import { Dialog } from '../../dialog/dialog' ...@@ -2,14 +2,12 @@ import { Dialog } from '../../dialog/dialog'
import { noop as css } from '../../../helpers/noop-template' import { noop as css } from '../../../helpers/noop-template'
type ErrorOverlayDialogProps = { type ErrorOverlayDialogProps = {
isTurbopack?: boolean
children?: React.ReactNode children?: React.ReactNode
onClose?: () => void onClose?: () => void
dialogResizerRef?: React.RefObject<HTMLDivElement | null> dialogResizerRef?: React.RefObject<HTMLDivElement | null>
} }
export function ErrorOverlayDialog({ export function ErrorOverlayDialog({
isTurbopack,
children, children,
onClose, onClose,
...props ...props
...@@ -21,7 +19,6 @@ export function ErrorOverlayDialog({ ...@@ -21,7 +19,6 @@ export function ErrorOverlayDialog({
aria-describedby="nextjs__container_errors_desc" aria-describedby="nextjs__container_errors_desc"
onClose={onClose} onClose={onClose}
className="error-overlay-dialog" className="error-overlay-dialog"
data-turbo={isTurbopack}
{...props} {...props}
> >
{children} {children}
...@@ -44,26 +41,12 @@ export const DIALOG_STYLES = css` ...@@ -44,26 +41,12 @@ export const DIALOG_STYLES = css`
border-color: var(--color-gray-400); border-color: var(--color-gray-400);
} }
&[data-turbo='true']::after { &:has(~ .error-overlay-nav .error-overlay-notch[data-side='left']) {
content: ''; border-top-left-radius: 0;
--size: 1px; }
--gradient: linear-gradient(
to right top, &:has(~ .error-overlay-nav .error-overlay-notch[data-side='right']) {
transparent 75%, border-top-right-radius: 0;
var(--color-turbopack-border-blue) 87.5%,
var(--color-turbopack-border-red) 100%
);
position: absolute;
inset: -1px;
pointer-events: none;
border-radius: var(--next-dialog-radius);
padding: var(--size);
background: var(--gradient);
mask:
linear-gradient(black, black) content-box,
linear-gradient(black, black);
-webkit-mask-composite: xor;
mask-composite: exclude;
} }
} }
` `
import { DialogHeader } from '../../dialog/dialog-header' import { DialogHeader } from '../../dialog/dialog-header'
import { noop as css } from '../../../helpers/noop-template' import { noop as css } from '../../../helpers/noop-template'
import { cx } from '../../../helpers/cx'
type ErrorOverlayDialogHeaderProps = { type ErrorOverlayDialogHeaderProps = {
children?: React.ReactNode children?: React.ReactNode
isTurbopack?: boolean
} }
export function ErrorOverlayDialogHeader({ export function ErrorOverlayDialogHeader({
children, children,
isTurbopack,
}: ErrorOverlayDialogHeaderProps) { }: ErrorOverlayDialogHeaderProps) {
return ( return (
<DialogHeader <DialogHeader className="nextjs-container-errors-header">
className={cx(
'nextjs-container-errors-header',
isTurbopack && 'nextjs-error-overlay-dialog-header-turbopack-background'
)}
>
{children} {children}
</DialogHeader> </DialogHeader>
) )
...@@ -56,13 +48,4 @@ export const DIALOG_HEADER_STYLES = css` ...@@ -56,13 +48,4 @@ export const DIALOG_HEADER_STYLES = css`
top: var(--size-4); top: var(--size-4);
right: var(--size-4); right: var(--size-4);
} }
.nextjs-error-overlay-dialog-header-turbopack-background {
background-image: linear-gradient(
10deg,
var(--color-background-100) 60%,
var(--color-turbopack-background-red) 75%,
var(--color-turbopack-background-blue) 100%
);
}
` `
import type { VersionInfo } from '../../../../../../../../server/dev/parse-version-info'
import { ErrorOverlayPagination } from '../error-overlay-pagination/error-overlay-pagination'
import { VersionStalenessInfo } from '../../version-staleness-info/version-staleness-info'
import { noop as css } from '../../../helpers/noop-template'
import type { ReadyRuntimeError } from '../../../../../internal/helpers/get-error-by-type'
type ErrorOverlayFloatingHeaderProps = {
readyErrors?: ReadyRuntimeError[]
activeIdx?: number
setActiveIndex?: (index: number) => void
versionInfo?: VersionInfo
isTurbopack?: boolean
}
export function ErrorOverlayFloatingHeader({
readyErrors,
activeIdx,
setActiveIndex,
versionInfo,
isTurbopack,
}: ErrorOverlayFloatingHeaderProps) {
return (
<div className="error-overlay-floating-header">
{/* TODO: better passing data instead of nullish coalescing */}
<ErrorOverlayPagination
readyErrors={readyErrors ?? []}
activeIdx={activeIdx ?? 0}
onActiveIndexChange={setActiveIndex ?? (() => {})}
/>
<VersionStalenessInfo
versionInfo={versionInfo}
isTurbopack={isTurbopack}
/>
</div>
)
}
export const styles = css`
.error-overlay-floating-header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
position: fixed;
transform: translateY(calc(-1 * var(--size-10_5)));
outline: none;
max-width: var(--next-dialog-max-width);
}
`
...@@ -18,9 +18,9 @@ import { ...@@ -18,9 +18,9 @@ import {
styles as errorTypeLabelStyles, styles as errorTypeLabelStyles,
} from '../error-type-label/error-type-label' } from '../error-type-label/error-type-label'
import { import {
ErrorOverlayFloatingHeader, ErrorOverlayNav,
styles as floatingHeaderStyles, styles as floatingHeaderStyles,
} from '../error-overlay-floating-header/error-overlay-floating-header' } from '../error-overlay-nav/error-overlay-nav'
import { ErrorOverlayDialog, DIALOG_STYLES } from '../dialog/dialog' import { ErrorOverlayDialog, DIALOG_STYLES } from '../dialog/dialog'
import { import {
...@@ -87,20 +87,11 @@ export function ErrorOverlayLayout({ ...@@ -87,20 +87,11 @@ export function ErrorOverlayLayout({
<div data-nextjs-dialog-root {...animationProps}> <div data-nextjs-dialog-root {...animationProps}>
<ErrorOverlayDialog <ErrorOverlayDialog
onClose={onClose} onClose={onClose}
isTurbopack={isTurbopack}
dialogResizerRef={dialogResizerRef} dialogResizerRef={dialogResizerRef}
data-has-footer={hasFooter} data-has-footer={hasFooter}
> >
<DialogContent> <DialogContent>
<ErrorOverlayFloatingHeader <ErrorOverlayDialogHeader>
readyErrors={readyErrors}
activeIdx={activeIdx}
setActiveIndex={setActiveIndex}
versionInfo={versionInfo}
isTurbopack={isTurbopack}
/>
<ErrorOverlayDialogHeader isTurbopack={isTurbopack}>
<div <div
className="nextjs__container_errors__error_title" className="nextjs__container_errors__error_title"
// allow assertion in tests before error rating is implemented // allow assertion in tests before error rating is implemented
...@@ -127,6 +118,13 @@ export function ErrorOverlayLayout({ ...@@ -127,6 +118,13 @@ export function ErrorOverlayLayout({
activeIdx={activeIdx ?? 0} activeIdx={activeIdx ?? 0}
/> />
</ErrorOverlayDialog> </ErrorOverlayDialog>
<ErrorOverlayNav
readyErrors={readyErrors}
activeIdx={activeIdx}
setActiveIndex={setActiveIndex}
versionInfo={versionInfo}
isTurbopack={isTurbopack}
/>
</div> </div>
</ErrorOverlayOverlay> </ErrorOverlayOverlay>
) )
......
import type { Meta, StoryObj } from '@storybook/react' import type { Meta, StoryObj } from '@storybook/react'
import { ErrorOverlayFloatingHeader } from './error-overlay-floating-header' import { ErrorOverlayNav } from './error-overlay-nav'
import { withShadowPortal } from '../../../storybook/with-shadow-portal' import { withShadowPortal } from '../../../storybook/with-shadow-portal'
const meta: Meta<typeof ErrorOverlayFloatingHeader> = { const meta: Meta<typeof ErrorOverlayNav> = {
component: ErrorOverlayFloatingHeader, component: ErrorOverlayNav,
parameters: { parameters: {
layout: 'fullscreen', layout: 'fullscreen',
}, },
...@@ -11,7 +11,7 @@ const meta: Meta<typeof ErrorOverlayFloatingHeader> = { ...@@ -11,7 +11,7 @@ const meta: Meta<typeof ErrorOverlayFloatingHeader> = {
} }
export default meta export default meta
type Story = StoryObj<typeof ErrorOverlayFloatingHeader> type Story = StoryObj<typeof ErrorOverlayNav>
export const Default: Story = { export const Default: Story = {
args: { args: {
......
import type { VersionInfo } from '../../../../../../../../server/dev/parse-version-info'
import { ErrorOverlayPagination } from '../error-overlay-pagination/error-overlay-pagination'
import { VersionStalenessInfo } from '../../version-staleness-info/version-staleness-info'
import { noop as css } from '../../../helpers/noop-template'
import type { ReadyRuntimeError } from '../../../../../internal/helpers/get-error-by-type'
type ErrorOverlayNavProps = {
readyErrors?: ReadyRuntimeError[]
activeIdx?: number
setActiveIndex?: (index: number) => void
versionInfo?: VersionInfo
isTurbopack?: boolean
}
export function ErrorOverlayNav({
readyErrors,
activeIdx,
setActiveIndex,
versionInfo,
isTurbopack,
}: ErrorOverlayNavProps) {
return (
<div className="error-overlay-nav">
<Notch side="left">
{/* TODO: better passing data instead of nullish coalescing */}
<ErrorOverlayPagination
readyErrors={readyErrors ?? []}
activeIdx={activeIdx ?? 0}
onActiveIndexChange={setActiveIndex ?? (() => {})}
/>
</Notch>
{versionInfo && (
<Notch side="right">
<VersionStalenessInfo
versionInfo={versionInfo}
isTurbopack={isTurbopack}
/>
</Notch>
)}
</div>
)
}
export const styles = css`
.error-overlay-nav {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
outline: none;
translate: 1px 1px;
max-width: var(--next-dialog-max-width);
.error-overlay-notch {
--stroke-color: var(--color-gray-400);
--background-color: var(--color-background-100);
translate: -1px 0;
width: auto;
height: 42px;
padding: 12px;
background: var(--background-color);
border: 1px solid var(--stroke-color);
border-bottom: none;
position: relative;
&[data-side='left'] {
padding-right: 0;
border-radius: var(--next-dialog-radius) 0 0 0;
.error-overlay-notch-tail {
right: -54px;
}
> *:not(.error-overlay-notch-tail) {
margin-right: -10px;
}
}
&[data-side='right'] {
padding-left: 0;
border-radius: 0 var(--next-dialog-radius) 0 0;
.error-overlay-notch-tail {
left: -54px;
transform: rotateY(180deg);
}
> *:not(.error-overlay-notch-tail) {
margin-left: -12px;
}
}
.error-overlay-notch-tail {
position: absolute;
top: -1px;
pointer-events: none;
z-index: -1;
}
}
}
`
function Notch({
children,
side = 'left',
}: {
children: React.ReactNode
side?: 'left' | 'right'
}) {
return (
<div className="error-overlay-notch" data-side={side}>
{children}
<Tail />
</div>
)
}
function Tail() {
return (
<svg
width="60"
height="42"
viewBox="0 0 60 42"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="error-overlay-notch-tail"
>
<mask
id="mask0_2667_14687"
style={{
maskType: 'alpha',
}}
maskUnits="userSpaceOnUse"
x="0"
y="-1"
width="60"
height="43"
>
<mask
id="path-1-outside-1_2667_14687"
maskUnits="userSpaceOnUse"
x="0"
y="-1"
width="60"
height="43"
fill="black"
>
<rect fill="white" y="-1" width="60" height="43" />
<path d="M1 0L8.0783 0C15.772 0 22.7836 4.41324 26.111 11.3501L34.8889 29.6498C38.2164 36.5868 45.228 41 52.9217 41H60H1L1 0Z" />
</mask>
<path
d="M1 0L8.0783 0C15.772 0 22.7836 4.41324 26.111 11.3501L34.8889 29.6498C38.2164 36.5868 45.228 41 52.9217 41H60H1L1 0Z"
fill="white"
/>
<path
d="M1 0V-1H0V0L1 0ZM1 41H0V42H1V41ZM34.8889 29.6498L33.9873 30.0823L34.8889 29.6498ZM26.111 11.3501L27.0127 10.9177L26.111 11.3501ZM1 1H8.0783V-1H1V1ZM60 40H1V42H60V40ZM2 41V0L0 0L0 41H2ZM25.2094 11.7826L33.9873 30.0823L35.7906 29.2174L27.0127 10.9177L25.2094 11.7826ZM52.9217 42H60V40H52.9217V42ZM33.9873 30.0823C37.4811 37.3661 44.8433 42 52.9217 42V40C45.6127 40 38.9517 35.8074 35.7906 29.2174L33.9873 30.0823ZM8.0783 1C15.3873 1 22.0483 5.19257 25.2094 11.7826L27.0127 10.9177C23.5188 3.6339 16.1567 -1 8.0783 -1V1Z"
fill="black"
mask="url(#path-1-outside-1_2667_14687)"
/>
</mask>
<g mask="url(#mask0_2667_14687)">
<mask
id="path-3-outside-2_2667_14687"
maskUnits="userSpaceOnUse"
x="-1"
y="0.0244141"
width="60"
height="43"
fill="black"
>
<rect fill="white" x="-1" y="0.0244141" width="60" height="43" />
<path d="M0 1.02441H7.0783C14.772 1.02441 21.7836 5.43765 25.111 12.3746L33.8889 30.6743C37.2164 37.6112 44.228 42.0244 51.9217 42.0244H59H0L0 1.02441Z" />
</mask>
<path
d="M0 1.02441H7.0783C14.772 1.02441 21.7836 5.43765 25.111 12.3746L33.8889 30.6743C37.2164 37.6112 44.228 42.0244 51.9217 42.0244H59H0L0 1.02441Z"
fill="var(--background-color)"
/>
<path
d="M0 1.02441L0 0.0244141H-1V1.02441H0ZM0 42.0244H-1V43.0244H0L0 42.0244ZM33.8889 30.6743L32.9873 31.1068L33.8889 30.6743ZM25.111 12.3746L26.0127 11.9421L25.111 12.3746ZM0 2.02441H7.0783V0.0244141H0L0 2.02441ZM59 41.0244H0L0 43.0244H59V41.0244ZM1 42.0244L1 1.02441H-1L-1 42.0244H1ZM24.2094 12.8071L32.9873 31.1068L34.7906 30.2418L26.0127 11.9421L24.2094 12.8071ZM51.9217 43.0244H59V41.0244H51.9217V43.0244ZM32.9873 31.1068C36.4811 38.3905 43.8433 43.0244 51.9217 43.0244V41.0244C44.6127 41.0244 37.9517 36.8318 34.7906 30.2418L32.9873 31.1068ZM7.0783 2.02441C14.3873 2.02441 21.0483 6.21699 24.2094 12.8071L26.0127 11.9421C22.5188 4.65831 15.1567 0.0244141 7.0783 0.0244141V2.02441Z"
fill="var(--stroke-color)"
mask="url(#path-3-outside-2_2667_14687)"
/>
</g>
</svg>
)
}
...@@ -51,16 +51,10 @@ export function ErrorOverlayPagination({ ...@@ -51,16 +51,10 @@ export function ErrorOverlayPagination({
if (e.key === 'ArrowLeft') { if (e.key === 'ArrowLeft') {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
if (buttonLeft.current) {
buttonLeft.current.focus()
}
handlePrevious && handlePrevious() handlePrevious && handlePrevious()
} else if (e.key === 'ArrowRight') { } else if (e.key === 'ArrowRight') {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
if (buttonRight.current) {
buttonRight.current.focus()
}
handleNext && handleNext() handleNext && handleNext()
} }
} }
...@@ -150,14 +144,8 @@ export const styles = css` ...@@ -150,14 +144,8 @@ export const styles = css`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 4px;
gap: 8px; gap: 8px;
background: var(--color-background-100); width: fit-content;
background-clip: padding-box;
box-shadow: var(--shadow-small);
border: 1px solid var(--color-gray-alpha-400);
border-radius: var(--rounded-full);
} }
.error-overlay-pagination-count { .error-overlay-pagination-count {
...@@ -174,12 +162,18 @@ export const styles = css` ...@@ -174,12 +162,18 @@ export const styles = css`
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 4px; width: 24px;
height: 24px;
background: var(--color-gray-300); background: var(--color-gray-300);
flex-shrink: 0;
border: none; border: none;
border-radius: var(--rounded-full); border-radius: var(--rounded-full);
&:focus-visible {
outline: var(--focus-ring);
}
&:not(:disabled):active { &:not(:disabled):active {
background: var(--color-gray-500); background: var(--color-gray-500);
} }
......
...@@ -92,7 +92,7 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({ ...@@ -92,7 +92,7 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
const fileExtension = stackFrame?.file?.split('.').pop() const fileExtension = stackFrame?.file?.split('.').pop()
return ( return (
<div data-nextjs-terminal> <div data-nextjs-codeframe>
<button <button
aria-label="Open in editor" aria-label="Open in editor"
className="code-frame-header" className="code-frame-header"
...@@ -136,20 +136,6 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({ ...@@ -136,20 +136,6 @@ export const Terminal: React.FC<TerminalProps> = function Terminal({
} }
export const TERMINAL_STYLES = css` export const TERMINAL_STYLES = css`
[data-nextjs-terminal] {
background-color: var(--color-background-200);
overflow: hidden;
color: var(--color-gray-1000);
text-overflow: ellipsis;
font-family: var(--font-stack-monospace);
font-size: 12px;
line-height: 16px;
}
.code-frame-link {
padding: 12px;
}
.terminal-source { .terminal-source {
display: flex; display: flex;
align-items: center; align-items: center;
......
import type { VersionInfo } from '../../../../../../../server/dev/parse-version-info' import type { VersionInfo } from '../../../../../../../server/dev/parse-version-info'
import { cx } from '../../helpers/cx'
import { noop as css } from '../../helpers/noop-template' import { noop as css } from '../../helpers/noop-template'
export function VersionStalenessInfo({ export function VersionStalenessInfo({
versionInfo, versionInfo,
isTurbopack, isTurbopack,
}: { }: {
versionInfo: VersionInfo | undefined versionInfo: VersionInfo
isTurbopack?: boolean isTurbopack?: boolean
}) { }) {
if (!versionInfo) return null
const { staleness } = versionInfo const { staleness } = versionInfo
let { text, indicatorClass, title } = getStaleness(versionInfo) let { text, indicatorClass, title } = getStaleness(versionInfo)
if (!text) return null
return ( return (
<span <span className="nextjs-container-build-error-version-status dialog-exclude-closing-from-outside-click">
className={cx( <Eclipse className={`version-staleness-indicator ${indicatorClass}`} />
'nextjs-container-build-error-version-status',
'dialog-exclude-closing-from-outside-click',
isTurbopack && 'turbopack-border'
)}
>
<Eclipse className={cx('version-staleness-indicator', indicatorClass)} />
<span data-nextjs-version-checker title={title}> <span data-nextjs-version-checker title={title}>
{text} {text}
</span>{' '} </span>{' '}
...@@ -74,6 +64,7 @@ export function getStaleness({ installed, staleness, expected }: VersionInfo) { ...@@ -74,6 +64,7 @@ export function getStaleness({ installed, staleness, expected }: VersionInfo) {
break break
} }
case 'unknown': case 'unknown':
text = 'No version data'
break break
default: default:
break break
...@@ -89,12 +80,12 @@ export const styles = css` ...@@ -89,12 +80,12 @@ export const styles = css`
align-items: center; align-items: center;
gap: var(--size-1); gap: var(--size-1);
height: 28px; height: 26px;
padding: 6px 8px 6px 6px; padding: 6px 8px 6px 6px;
background: var(--color-background-100); background: var(--color-background-100);
background-clip: padding-box; background-clip: padding-box;
box-shadow: var(--shadow-small);
border: 1px solid var(--color-gray-alpha-400); border: 1px solid var(--color-gray-alpha-400);
box-shadow: var(--shadow-small);
border-radius: var(--rounded-full); border-radius: var(--rounded-full);
color: var(--color-gray-900); color: var(--color-gray-900);
...@@ -116,20 +107,6 @@ export const styles = css` ...@@ -116,20 +107,6 @@ export const styles = css`
stroke: var(--color-red-300); stroke: var(--color-red-300);
} }
.nextjs-container-build-error-version-status.turbopack-border {
border: 1px solid transparent;
background:
linear-gradient(var(--color-background-100), var(--color-background-100))
padding-box,
linear-gradient(
to right,
var(--color-turbopack-border-red) 0%,
var(--color-turbopack-border-blue) 100%
)
border-box;
border-radius: var(--rounded-full);
}
.nextjs-container-build-error-version-status > .turbopack-text { .nextjs-container-build-error-version-status > .turbopack-text {
background: linear-gradient( background: linear-gradient(
to right, to right,
......
...@@ -7,18 +7,18 @@ export function LeftArrow({ ...@@ -7,18 +7,18 @@ export function LeftArrow({
}) { }) {
return ( return (
<svg <svg
className={className}
width="16" width="16"
height="16" height="16"
viewBox="0 0 16 16" viewBox="0 0 16 16"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
aria-label={title}
className={className}
> >
<title>{title}</title>
<path <path
fillRule="evenodd" fillRule="evenodd"
clipRule="evenodd" clipRule="evenodd"
d="M6.46963 13.7804L6.99996 14.3108L8.06062 13.2501L7.53029 12.7198L3.56062 8.75011H14.25H15V7.25011H14.25H3.56062L7.53029 3.28044L8.06062 2.75011L6.99996 1.68945L6.46963 2.21978L1.39641 7.29301C1.00588 7.68353 1.00588 8.3167 1.39641 8.70722L6.46963 13.7804Z" d="M9.24996 12.0608L8.71963 11.5304L5.89641 8.70722C5.50588 8.3167 5.50588 7.68353 5.89641 7.29301L8.71963 4.46978L9.24996 3.93945L10.3106 5.00011L9.78029 5.53044L7.31062 8.00011L9.78029 10.4698L10.3106 11.0001L9.24996 12.0608Z"
fill="currentColor" fill="currentColor"
/> />
</svg> </svg>
......
...@@ -7,18 +7,18 @@ export function RightArrow({ ...@@ -7,18 +7,18 @@ export function RightArrow({
}) { }) {
return ( return (
<svg <svg
className={className}
width="16" width="16"
height="16" height="16"
viewBox="0 0 16 16" viewBox="0 0 16 16"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
className={className}
aria-label={title}
> >
<title>{title}</title>
<path <path
fillRule="evenodd" fillRule="evenodd"
clipRule="evenodd" clipRule="evenodd"
d="M9.53033 2.21978L9 1.68945L7.93934 2.75011L8.46967 3.28044L12.4393 7.25011H1.75H1V8.75011H1.75H12.4393L8.46967 12.7198L7.93934 13.2501L9 14.3108L9.53033 13.7804L14.6036 8.70722C14.9941 8.3167 14.9941 7.68353 14.6036 7.29301L9.53033 2.21978Z" d="M6.75011 3.93945L7.28044 4.46978L10.1037 7.29301C10.4942 7.68353 10.4942 8.3167 10.1037 8.70722L7.28044 11.5304L6.75011 12.0608L5.68945 11.0001L6.21978 10.4698L8.68945 8.00011L6.21978 5.53044L5.68945 5.00011L6.75011 3.93945Z"
fill="currentColor" fill="currentColor"
/> />
</svg> </svg>
......
...@@ -990,15 +990,13 @@ export function getRedboxHeader(browser: BrowserInterface) { ...@@ -990,15 +990,13 @@ export function getRedboxHeader(browser: BrowserInterface) {
}) })
} }
export function getRedboxFloatingHeaderText( export function getRedboxNavText(browser: BrowserInterface): Promise<string> {
browser: BrowserInterface
): Promise<string> {
return browser.eval(() => { return browser.eval(() => {
const portal = [].slice const portal = [].slice
.call(document.querySelectorAll('nextjs-portal')) .call(document.querySelectorAll('nextjs-portal'))
.find((p) => p.shadowRoot.querySelector('.error-overlay-floating-header')) .find((p) => p.shadowRoot.querySelector('.error-overlay-nav'))
const root = portal.shadowRoot const root = portal.shadowRoot
return root.querySelector('.error-overlay-floating-header')?.innerText return root.querySelector('.error-overlay-nav')?.innerText
}) })
} }
...@@ -1006,7 +1004,7 @@ export async function getRedboxTotalErrorCount(browser: BrowserInterface) { ...@@ -1006,7 +1004,7 @@ export async function getRedboxTotalErrorCount(browser: BrowserInterface) {
// TODO(jiwon): Remove this once we have a new dev overlay at stable. // TODO(jiwon): Remove this once we have a new dev overlay at stable.
if (isNewDevOverlay) { if (isNewDevOverlay) {
// N/M\nNext.js X.Y.Z -> M // N/M\nNext.js X.Y.Z -> M
const text = (await getRedboxFloatingHeaderText(browser)) || '' const text = (await getRedboxNavText(browser)) || ''
return parseInt(text.match(/\/(\d+)/)?.[1]) return parseInt(text.match(/\/(\d+)/)?.[1])
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment