Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
13f413bb
Unverified
Commit
13f413bb
authored
Aug 19, 2025
by
Jiachi Liu
Committed by
GitHub
Aug 19, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[devtool] migrate global inline style tag to css (#82778)
parent
49371dc3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
502 additions
and
307 deletions
+502
-307
dev-overlay.tsx
packages/next/src/next-devtools/dev-overlay/dev-overlay.tsx
+2
-6
global.css
packages/next/src/next-devtools/dev-overlay/global.css
+3
-0
with-shadow-portal.tsx
...ext-devtools/dev-overlay/storybook/with-shadow-portal.tsx
+0
-6
base.tsx
packages/next/src/next-devtools/dev-overlay/styles/base.tsx
+0
-151
colors.css
...ages/next/src/next-devtools/dev-overlay/styles/colors.css
+134
-0
colors.tsx
...ages/next/src/next-devtools/dev-overlay/styles/colors.tsx
+0
-144
dark-theme.css
.../next/src/next-devtools/dev-overlay/styles/dark-theme.css
+209
-0
default-theme.css
...xt/src/next-devtools/dev-overlay/styles/default-theme.css
+136
-0
scale-updater.tsx
...xt/src/next-devtools/dev-overlay/styles/scale-updater.tsx
+18
-0
No files found.
packages/next/src/next-devtools/dev-overlay/dev-overlay.tsx
View file @
13f413bb
import
{
createContext
,
useContext
,
useRef
,
useState
}
from
'react'
import
{
createContext
,
useContext
,
useRef
,
useState
}
from
'react'
import
{
ShadowPortal
}
from
'./components/shadow-portal'
import
{
ShadowPortal
}
from
'./components/shadow-portal'
import
{
Base
}
from
'./styles/base'
import
{
ComponentStyles
}
from
'./styles/component-styles'
import
{
ComponentStyles
}
from
'./styles/component-styles'
import
{
Colors
}
from
'./styles/colors'
import
{
ErrorOverlay
}
from
'./components/errors/error-overlay/error-overlay'
import
{
ErrorOverlay
}
from
'./components/errors/error-overlay/error-overlay'
import
{
RenderError
}
from
'./container/runtime-error/render-error'
import
{
RenderError
}
from
'./container/runtime-error/render-error'
import
{
DarkTheme
}
from
'./styles/dark-theme
'
import
{
ScaleUpdater
}
from
'./styles/scale-updater
'
import
type
{
ReadyRuntimeError
}
from
'./utils/get-error-by-type'
import
type
{
ReadyRuntimeError
}
from
'./utils/get-error-by-type'
import
{
DevToolsIndicator
}
from
'./components/devtools-indicator/devtools-indicator'
import
{
DevToolsIndicator
}
from
'./components/devtools-indicator/devtools-indicator'
import
{
PanelRouter
}
from
'./menu/panel-router'
import
{
PanelRouter
}
from
'./menu/panel-router'
...
@@ -28,10 +26,8 @@ export function DevOverlay() {
...
@@ -28,10 +26,8 @@ export function DevOverlay() {
const
triggerRef
=
useRef
<
HTMLButtonElement
>
(
null
)
const
triggerRef
=
useRef
<
HTMLButtonElement
>
(
null
)
return
(
return
(
<
ShadowPortal
>
<
ShadowPortal
>
<
Base
scale=
{
state
.
scale
}
/>
<
ScaleUpdater
/>
<
Colors
/>
<
ComponentStyles
/>
<
ComponentStyles
/>
<
DarkTheme
/>
<
RenderError
state=
{
state
}
isAppDir=
{
true
}
>
<
RenderError
state=
{
state
}
isAppDir=
{
true
}
>
{
({
runtimeErrors
,
totalErrorCount
})
=>
{
{
({
runtimeErrors
,
totalErrorCount
})
=>
{
...
...
packages/next/src/next-devtools/dev-overlay/global.css
View file @
13f413bb
@import
'./normalize.css'
;
@import
'./normalize.css'
;
@import
'./styles/default-theme.css'
;
@import
'./styles/dark-theme.css'
;
@import
'./styles/colors.css'
;
/* devtool global css variables */
/* devtool global css variables */
:host
{
:host
{
...
...
packages/next/src/next-devtools/dev-overlay/storybook/with-shadow-portal.tsx
View file @
13f413bb
import
'../global.css'
import
'../global.css'
import
{
Base
}
from
'../styles/base'
import
{
Colors
}
from
'../styles/colors'
import
{
ComponentStyles
}
from
'../styles/component-styles'
import
{
ComponentStyles
}
from
'../styles/component-styles'
import
{
ShadowPortal
}
from
'../components/shadow-portal'
import
{
ShadowPortal
}
from
'../components/shadow-portal'
import
{
DarkTheme
}
from
'../styles/dark-theme'
export
const
withShadowPortal
=
(
Story
:
any
)
=>
(
export
const
withShadowPortal
=
(
Story
:
any
)
=>
(
<
ShadowPortal
>
<
ShadowPortal
>
<
Base
/>
<
Colors
/>
<
ComponentStyles
/>
<
ComponentStyles
/>
<
DarkTheme
/>
<
Story
/>
<
Story
/>
</
ShadowPortal
>
</
ShadowPortal
>
)
)
packages/next/src/next-devtools/dev-overlay/styles/base.tsx
deleted
100644 → 0
View file @
49371dc3
import
{
css
}
from
'../utils/css'
import
type
{
DevToolsScale
}
from
'../shared'
export
function
Base
({
scale
=
1
}:
{
scale
?:
DevToolsScale
})
{
return
(
<
style
>
{
css
`
:host {
/*
* Although the style applied to the shadow host is isolated,
* the element that attached the shadow host (i.e. "nextjs-portal")
* is still affected by the parent's style (e.g. "body"). This may
* occur style conflicts like "display: flex", with other children
* elements therefore give the shadow host an absolute position.
*/
position: absolute;
--color-font: #757575;
--color-backdrop: rgba(250, 250, 250, 0.8);
--color-border-shadow: rgba(0, 0, 0, 0.145);
--color-title-color: #1f1f1f;
--color-stack-notes: #777;
--color-accents-1: #808080;
--color-accents-2: #222222;
--color-accents-3: #404040;
--font-stack-monospace: '__nextjs-Geist Mono', 'Geist Mono',
'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier,
monospace;
--font-stack-sans: '__nextjs-Geist', 'Geist', -apple-system,
'Source Sans Pro', sans-serif;
font-family: var(--font-stack-sans);
font-variant-ligatures: none;
/* TODO: Remove replaced ones. */
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),
0 1px 2px -1px rgb(0 0 0 / 0.1);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
0 4px 6px -4px rgb(0 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
0 8px 10px -6px rgb(0 0 0 / 0.1);
--shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
--shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
--shadow-none: 0 0 #0000;
--shadow-small: 0px 2px 2px rgba(0, 0, 0, 0.04);
--shadow-menu: 0px 1px 1px rgba(0, 0, 0, 0.02),
0px 4px 8px -4px rgba(0, 0, 0, 0.04),
0px 16px 24px -8px rgba(0, 0, 0, 0.06);
--focus-color: var(--color-blue-800);
--focus-ring: 2px solid var(--focus-color);
--timing-swift: cubic-bezier(0.23, 0.88, 0.26, 0.92);
--timing-overlay: cubic-bezier(0.175, 0.885, 0.32, 1.1);
/* prettier-ignore */
--timing-bounce: linear(0 0%, 0.005871 1%, 0.022058 2%, 0.046612 3%, 0.077823 4%, 0.114199 5%, 0.154441 6%, 0.197431 7.000000000000001%, 0.242208 8%, 0.287959 9%, 0.333995 10%, 0.379743 11%, 0.424732 12%, 0.46858 13%, 0.510982 14.000000000000002%, 0.551702 15%, 0.590564 16%, 0.627445 17%, 0.662261 18%, 0.694971 19%, 0.725561 20%, 0.754047 21%, 0.780462 22%, 0.804861 23%, 0.82731 24%, 0.847888 25%, 0.866679 26%, 0.883775 27%, 0.899272 28.000000000000004%, 0.913267 28.999999999999996%, 0.925856 30%, 0.937137 31%, 0.947205 32%, 0.956153 33%, 0.96407 34%, 0.971043 35%, 0.977153 36%, 0.982479 37%, 0.987094 38%, 0.991066 39%, 0.994462 40%, 0.997339 41%, 0.999755 42%, 1.001761 43%, 1.003404 44%, 1.004727 45%, 1.00577 46%, 1.006569 47%, 1.007157 48%, 1.007563 49%, 1.007813 50%, 1.007931 51%, 1.007939 52%, 1.007855 53%, 1.007697 54%, 1.007477 55.00000000000001%, 1.00721 56.00000000000001%, 1.006907 56.99999999999999%, 1.006576 57.99999999999999%, 1.006228 59%, 1.005868 60%, 1.005503 61%, 1.005137 62%, 1.004776 63%, 1.004422 64%, 1.004078 65%, 1.003746 66%, 1.003429 67%, 1.003127 68%, 1.00284 69%, 1.002571 70%, 1.002318 71%, 1.002082 72%, 1.001863 73%, 1.00166 74%, 1.001473 75%, 1.001301 76%, 1.001143 77%, 1.001 78%, 1.000869 79%, 1.000752 80%, 1.000645 81%, 1.00055 82%, 1.000464 83%, 1.000388 84%, 1.000321 85%, 1.000261 86%, 1.000209 87%, 1.000163 88%, 1.000123 89%, 1.000088 90%);
--rounded-none: 0px;
--rounded-sm: 2px;
--rounded-md: 4px;
--rounded-md-2: 6px;
--rounded-lg: 8px;
--rounded-xl: 12px;
--rounded-2xl: 16px;
--rounded-3xl: 24px;
--rounded-4xl: 32px;
--rounded-full: 9999px;
/*
This value gets set from the Dev Tools preferences,
and we use the following --size-* variables to
scale the relevant elements.
The reason why we don't rely on rem values is because
if an app sets their root font size to something tiny,
it feels unexpected to have the app root size leak
into a Next.js surface.
https://github.com/vercel/next.js/discussions/76812
*/
--nextjs-dev-tools-scale: ${String(scale)};
--size-1: calc(1px / var(--nextjs-dev-tools-scale));
--size-2: calc(2px / var(--nextjs-dev-tools-scale));
--size-3: calc(3px / var(--nextjs-dev-tools-scale));
--size-4: calc(4px / var(--nextjs-dev-tools-scale));
--size-5: calc(5px / var(--nextjs-dev-tools-scale));
--size-6: calc(6px / var(--nextjs-dev-tools-scale));
--size-7: calc(7px / var(--nextjs-dev-tools-scale));
--size-8: calc(8px / var(--nextjs-dev-tools-scale));
--size-9: calc(9px / var(--nextjs-dev-tools-scale));
--size-10: calc(10px / var(--nextjs-dev-tools-scale));
--size-11: calc(11px / var(--nextjs-dev-tools-scale));
--size-12: calc(12px / var(--nextjs-dev-tools-scale));
--size-13: calc(13px / var(--nextjs-dev-tools-scale));
--size-14: calc(14px / var(--nextjs-dev-tools-scale));
--size-15: calc(15px / var(--nextjs-dev-tools-scale));
--size-16: calc(16px / var(--nextjs-dev-tools-scale));
--size-17: calc(17px / var(--nextjs-dev-tools-scale));
--size-18: calc(18px / var(--nextjs-dev-tools-scale));
--size-20: calc(20px / var(--nextjs-dev-tools-scale));
--size-22: calc(22px / var(--nextjs-dev-tools-scale));
--size-24: calc(24px / var(--nextjs-dev-tools-scale));
--size-26: calc(26px / var(--nextjs-dev-tools-scale));
--size-28: calc(28px / var(--nextjs-dev-tools-scale));
--size-30: calc(30px / var(--nextjs-dev-tools-scale));
--size-32: calc(32px / var(--nextjs-dev-tools-scale));
--size-34: calc(34px / var(--nextjs-dev-tools-scale));
--size-36: calc(36px / var(--nextjs-dev-tools-scale));
--size-38: calc(38px / var(--nextjs-dev-tools-scale));
--size-40: calc(40px / var(--nextjs-dev-tools-scale));
--size-42: calc(42px / var(--nextjs-dev-tools-scale));
--size-44: calc(44px / var(--nextjs-dev-tools-scale));
--size-46: calc(46px / var(--nextjs-dev-tools-scale));
--size-48: calc(48px / var(--nextjs-dev-tools-scale));
@media print {
display: none;
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-bottom: 8px;
font-weight: 500;
line-height: 1.5;
}
a {
color: var(--color-blue-900);
&:hover {
color: var(--color-blue-900);
}
&:focus-visible {
outline: var(--focus-ring);
}
}
`
}
</
style
>
)
}
packages/next/src/next-devtools/dev-overlay/styles/colors.css
0 → 100644
View file @
13f413bb
:host
{
/*
* CAUTION: THIS IS A WORKAROUND!
* For now, we use @babel/code-frame to parse the code frame which does not support option to change the color.
* x-ref: https://github.com/babel/babel/blob/efa52324ff835b794c48080f14877b6caf32cd15/packages/babel-code-frame/src/defs.ts#L40-L54
* So, we do a workaround mapping to change the color matching the theme.
*
* For example, in @babel/code-frame, the "keyword" is mapped to ANSI "cyan".
* We want the "keyword" to use the "syntax-keyword" color in the theme.
* So, we map the "cyan" to the "syntax-keyword" in the theme.
*/
/* cyan: keyword */
--color-ansi-cyan
:
var
(
--color-syntax-keyword
);
/* yellow: capitalized, jsxIdentifier, punctuation */
--color-ansi-yellow
:
var
(
--color-syntax-function
);
/* magenta: number, regex */
--color-ansi-magenta
:
var
(
--color-syntax-keyword
);
/* green: string */
--color-ansi-green
:
var
(
--color-syntax-string
);
/* gray (bright black): comment, gutter */
--color-ansi-bright-black
:
var
(
--color-syntax-comment
);
/* Ansi - Temporary */
--color-ansi-selection
:
var
(
--color-gray-alpha-300
);
--color-ansi-bg
:
var
(
--color-background-200
);
--color-ansi-fg
:
var
(
--color-gray-1000
);
--color-ansi-white
:
var
(
--color-gray-700
);
--color-ansi-black
:
var
(
--color-gray-200
);
--color-ansi-blue
:
var
(
--color-blue-700
);
--color-ansi-red
:
var
(
--color-red-700
);
--color-ansi-bright-white
:
var
(
--color-gray-1000
);
--color-ansi-bright-blue
:
var
(
--color-blue-800
);
--color-ansi-bright-cyan
:
var
(
--color-blue-800
);
--color-ansi-bright-green
:
var
(
--color-green-800
);
--color-ansi-bright-magenta
:
var
(
--color-blue-800
);
--color-ansi-bright-red
:
var
(
--color-red-800
);
--color-ansi-bright-yellow
:
var
(
--color-amber-900
);
/* Background Light */
--color-background-100
:
#ffffff
;
--color-background-200
:
#fafafa
;
/* Syntax Light */
--color-syntax-comment
:
#545454
;
--color-syntax-constant
:
#171717
;
--color-syntax-function
:
#0054ad
;
--color-syntax-keyword
:
#a51850
;
--color-syntax-link
:
#066056
;
--color-syntax-parameter
:
#8f3e00
;
--color-syntax-punctuation
:
#171717
;
--color-syntax-string
:
#036157
;
--color-syntax-string-expression
:
#066056
;
/* Gray Scale Light */
--color-gray-100
:
#f2f2f2
;
--color-gray-200
:
#ebebeb
;
--color-gray-300
:
#e6e6e6
;
--color-gray-400
:
#eaeaea
;
--color-gray-500
:
#c9c9c9
;
--color-gray-600
:
#a8a8a8
;
--color-gray-700
:
#8f8f8f
;
--color-gray-800
:
#7d7d7d
;
--color-gray-900
:
#666666
;
--color-gray-1000
:
#171717
;
/* Gray Alpha Scale Light */
--color-gray-alpha-100
:
rgba
(
0
,
0
,
0
,
0.05
);
--color-gray-alpha-200
:
rgba
(
0
,
0
,
0
,
0.081
);
--color-gray-alpha-300
:
rgba
(
0
,
0
,
0
,
0.1
);
--color-gray-alpha-400
:
rgba
(
0
,
0
,
0
,
0.08
);
--color-gray-alpha-500
:
rgba
(
0
,
0
,
0
,
0.21
);
--color-gray-alpha-600
:
rgba
(
0
,
0
,
0
,
0.34
);
--color-gray-alpha-700
:
rgba
(
0
,
0
,
0
,
0.44
);
--color-gray-alpha-800
:
rgba
(
0
,
0
,
0
,
0.51
);
--color-gray-alpha-900
:
rgba
(
0
,
0
,
0
,
0.605
);
--color-gray-alpha-1000
:
rgba
(
0
,
0
,
0
,
0.91
);
/* Blue Scale Light */
--color-blue-100
:
#f0f7ff
;
--color-blue-200
:
#edf6ff
;
--color-blue-300
:
#e1f0ff
;
--color-blue-400
:
#cde7ff
;
--color-blue-500
:
#99ceff
;
--color-blue-600
:
#52aeff
;
--color-blue-700
:
#0070f3
;
--color-blue-800
:
#0060d1
;
--color-blue-900
:
#0067d6
;
--color-blue-1000
:
#0025ad
;
/* Red Scale Light */
--color-red-100
:
#fff0f0
;
--color-red-200
:
#ffebeb
;
--color-red-300
:
#ffe5e5
;
--color-red-400
:
#fdd8d8
;
--color-red-500
:
#f8baba
;
--color-red-600
:
#f87274
;
--color-red-700
:
#e5484d
;
--color-red-800
:
#da3036
;
--color-red-900
:
#ca2a30
;
--color-red-1000
:
#381316
;
/* Amber Scale Light */
--color-amber-100
:
#fff6e5
;
--color-amber-200
:
#fff4d5
;
--color-amber-300
:
#fef0cd
;
--color-amber-400
:
#ffddbf
;
--color-amber-500
:
#ffc96b
;
--color-amber-600
:
#f5b047
;
--color-amber-700
:
#ffb224
;
--color-amber-800
:
#ff990a
;
--color-amber-900
:
#a35200
;
--color-amber-1000
:
#4e2009
;
/* Green Scale Light */
--color-green-100
:
#effbef
;
--color-green-200
:
#eafaea
;
--color-green-300
:
#dcf6dc
;
--color-green-400
:
#c8f1c9
;
--color-green-500
:
#99e59f
;
--color-green-600
:
#6cda76
;
--color-green-700
:
#46a758
;
--color-green-800
:
#388e4a
;
--color-green-900
:
#297c3b
;
--color-green-1000
:
#18311e
;
/* Turbopack Light - Temporary */
--color-turbopack-text-red
:
#ff1e56
;
--color-turbopack-text-blue
:
#0096ff
;
--color-turbopack-border-red
:
#f0adbe
;
--color-turbopack-border-blue
:
#adccea
;
--color-turbopack-background-red
:
#fff7f9
;
--color-turbopack-background-blue
:
#f6fbff
;
}
packages/next/src/next-devtools/dev-overlay/styles/colors.tsx
deleted
100644 → 0
View file @
49371dc3
import
{
css
}
from
'../utils/css'
export
function
Colors
()
{
return
(
<
style
>
{
css
`
:host {
/*
* CAUTION: THIS IS A WORKAROUND!
* For now, we use @babel/code-frame to parse the code frame which does not support option to change the color.
* x-ref: https://github.com/babel/babel/blob/efa52324ff835b794c48080f14877b6caf32cd15/packages/babel-code-frame/src/defs.ts#L40-L54
* So, we do a workaround mapping to change the color matching the theme.
*
* For example, in @babel/code-frame, the "keyword" is mapped to ANSI "cyan".
* We want the "keyword" to use the "syntax-keyword" color in the theme.
* So, we map the "cyan" to the "syntax-keyword" in the theme.
*/
/* cyan: keyword */
--color-ansi-cyan: var(--color-syntax-keyword);
/* yellow: capitalized, jsxIdentifier, punctuation */
--color-ansi-yellow: var(--color-syntax-function);
/* magenta: number, regex */
--color-ansi-magenta: var(--color-syntax-keyword);
/* green: string */
--color-ansi-green: var(--color-syntax-string);
/* gray (bright black): comment, gutter */
--color-ansi-bright-black: var(--color-syntax-comment);
/* Ansi - Temporary */
--color-ansi-selection: var(--color-gray-alpha-300);
--color-ansi-bg: var(--color-background-200);
--color-ansi-fg: var(--color-gray-1000);
--color-ansi-white: var(--color-gray-700);
--color-ansi-black: var(--color-gray-200);
--color-ansi-blue: var(--color-blue-700);
--color-ansi-red: var(--color-red-700);
--color-ansi-bright-white: var(--color-gray-1000);
--color-ansi-bright-blue: var(--color-blue-800);
--color-ansi-bright-cyan: var(--color-blue-800);
--color-ansi-bright-green: var(--color-green-800);
--color-ansi-bright-magenta: var(--color-blue-800);
--color-ansi-bright-red: var(--color-red-800);
--color-ansi-bright-yellow: var(--color-amber-900);
/* Background Light */
--color-background-100: #ffffff;
--color-background-200: #fafafa;
/* Syntax Light */
--color-syntax-comment: #545454;
--color-syntax-constant: #171717;
--color-syntax-function: #0054ad;
--color-syntax-keyword: #a51850;
--color-syntax-link: #066056;
--color-syntax-parameter: #8f3e00;
--color-syntax-punctuation: #171717;
--color-syntax-string: #036157;
--color-syntax-string-expression: #066056;
/* Gray Scale Light */
--color-gray-100: #f2f2f2;
--color-gray-200: #ebebeb;
--color-gray-300: #e6e6e6;
--color-gray-400: #eaeaea;
--color-gray-500: #c9c9c9;
--color-gray-600: #a8a8a8;
--color-gray-700: #8f8f8f;
--color-gray-800: #7d7d7d;
--color-gray-900: #666666;
--color-gray-1000: #171717;
/* Gray Alpha Scale Light */
--color-gray-alpha-100: rgba(0, 0, 0, 0.05);
--color-gray-alpha-200: rgba(0, 0, 0, 0.081);
--color-gray-alpha-300: rgba(0, 0, 0, 0.1);
--color-gray-alpha-400: rgba(0, 0, 0, 0.08);
--color-gray-alpha-500: rgba(0, 0, 0, 0.21);
--color-gray-alpha-600: rgba(0, 0, 0, 0.34);
--color-gray-alpha-700: rgba(0, 0, 0, 0.44);
--color-gray-alpha-800: rgba(0, 0, 0, 0.51);
--color-gray-alpha-900: rgba(0, 0, 0, 0.605);
--color-gray-alpha-1000: rgba(0, 0, 0, 0.91);
/* Blue Scale Light */
--color-blue-100: #f0f7ff;
--color-blue-200: #edf6ff;
--color-blue-300: #e1f0ff;
--color-blue-400: #cde7ff;
--color-blue-500: #99ceff;
--color-blue-600: #52aeff;
--color-blue-700: #0070f3;
--color-blue-800: #0060d1;
--color-blue-900: #0067d6;
--color-blue-1000: #0025ad;
/* Red Scale Light */
--color-red-100: #fff0f0;
--color-red-200: #ffebeb;
--color-red-300: #ffe5e5;
--color-red-400: #fdd8d8;
--color-red-500: #f8baba;
--color-red-600: #f87274;
--color-red-700: #e5484d;
--color-red-800: #da3036;
--color-red-900: #ca2a30;
--color-red-1000: #381316;
/* Amber Scale Light */
--color-amber-100: #fff6e5;
--color-amber-200: #fff4d5;
--color-amber-300: #fef0cd;
--color-amber-400: #ffddbf;
--color-amber-500: #ffc96b;
--color-amber-600: #f5b047;
--color-amber-700: #ffb224;
--color-amber-800: #ff990a;
--color-amber-900: #a35200;
--color-amber-1000: #4e2009;
/* Green Scale Light */
--color-green-100: #effbef;
--color-green-200: #eafaea;
--color-green-300: #dcf6dc;
--color-green-400: #c8f1c9;
--color-green-500: #99e59f;
--color-green-600: #6cda76;
--color-green-700: #46a758;
--color-green-800: #388e4a;
--color-green-900: #297c3b;
--color-green-1000: #18311e;
/* Turbopack Light - Temporary */
--color-turbopack-text-red: #ff1e56;
--color-turbopack-text-blue: #0096ff;
--color-turbopack-border-red: #f0adbe;
--color-turbopack-border-blue: #adccea;
--color-turbopack-background-red: #fff7f9;
--color-turbopack-background-blue: #f6fbff;
}
`
}
</
style
>
)
}
packages/next/src/next-devtools/dev-overlay/styles/dark-theme.
tsx
→
packages/next/src/next-devtools/dev-overlay/styles/dark-theme.
css
View file @
13f413bb
import
{
css
}
from
'../utils/css'
:host
(
.dark
)
{
--color-font
:
white
;
--color-backdrop
:
rgba
(
0
,
0
,
0
,
0.8
);
--color-border-shadow
:
rgba
(
255
,
255
,
255
,
0.145
);
--color-title-color
:
#fafafa
;
--color-stack-notes
:
#a9a9a9
;
const
colors
=
`
/* Background Dark */
/* Background Dark */
--color-background-100
:
#0a0a0a
;
--color-background-100
:
#0a0a0a
;
--color-background-200
:
#000000
;
--color-background-200
:
#000000
;
...
@@ -95,31 +100,110 @@ const colors = `
...
@@ -95,31 +100,110 @@ const colors = `
--color-turbopack-border-blue
:
#284f80
;
--color-turbopack-border-blue
:
#284f80
;
--color-turbopack-background-red
:
#250d12
;
--color-turbopack-background-red
:
#250d12
;
--color-turbopack-background-blue
:
#0a1723
;
--color-turbopack-background-blue
:
#0a1723
;
`
}
const
base
=
`
@media
(
prefers-color-scheme
:
dark
)
{
--color-font: white;
:host
(
:not
(
.light
))
{
--color-backdrop: rgba(0, 0, 0, 0.8);
--color-font
:
white
;
--color-border-shadow: rgba(255, 255, 255, 0.145);
--color-backdrop
:
rgba
(
0
,
0
,
0
,
0.8
);
--color-border-shadow
:
rgba
(
255
,
255
,
255
,
0.145
);
--color-title-color: #fafafa;
--color-title-color
:
#fafafa
;
--color-stack-notes: #a9a9a9;
--color-stack-notes
:
#a9a9a9
;
`
/* Background Dark */
export
function
DarkTheme
()
{
--color-background-100
:
#0a0a0a
;
return
(
--color-background-200
:
#000000
;
<
style
>
{
css
`
:host(.dark) {
/* Syntax Dark */
${base}
--color-syntax-comment
:
#a0a0a0
;
${colors}
--color-syntax-constant
:
#ededed
;
}
--color-syntax-function
:
#52a9ff
;
--color-syntax-keyword
:
#f76e99
;
@media (prefers-color-scheme: dark) {
--color-syntax-link
:
#0ac5b2
;
:host(:not(.light)) {
--color-syntax-parameter
:
#f1a10d
;
${base}
--color-syntax-punctuation
:
#ededed
;
${colors}
--color-syntax-string
:
#0ac5b2
;
}
--color-syntax-string-expression
:
#0ac5b2
;
}
`
}
</
style
>
/* Gray Scale Dark */
)
--color-gray-100
:
#1a1a1a
;
--color-gray-200
:
#1f1f1f
;
--color-gray-300
:
#292929
;
--color-gray-400
:
#2e2e2e
;
--color-gray-500
:
#454545
;
--color-gray-600
:
#878787
;
--color-gray-700
:
#8f8f8f
;
--color-gray-800
:
#7d7d7d
;
--color-gray-900
:
#a0a0a0
;
--color-gray-1000
:
#ededed
;
/* Gray Alpha Scale Dark */
--color-gray-alpha-100
:
rgba
(
255
,
255
,
255
,
0.066
);
--color-gray-alpha-200
:
rgba
(
255
,
255
,
255
,
0.087
);
--color-gray-alpha-300
:
rgba
(
255
,
255
,
255
,
0.125
);
--color-gray-alpha-400
:
rgba
(
255
,
255
,
255
,
0.145
);
--color-gray-alpha-500
:
rgba
(
255
,
255
,
255
,
0.239
);
--color-gray-alpha-600
:
rgba
(
255
,
255
,
255
,
0.506
);
--color-gray-alpha-700
:
rgba
(
255
,
255
,
255
,
0.54
);
--color-gray-alpha-800
:
rgba
(
255
,
255
,
255
,
0.47
);
--color-gray-alpha-900
:
rgba
(
255
,
255
,
255
,
0.61
);
--color-gray-alpha-1000
:
rgba
(
255
,
255
,
255
,
0.923
);
/* Blue Scale Dark */
--color-blue-100
:
#0f1b2d
;
--color-blue-200
:
#10243e
;
--color-blue-300
:
#0f3058
;
--color-blue-400
:
#0d3868
;
--color-blue-500
:
#0a4481
;
--color-blue-600
:
#0091ff
;
--color-blue-700
:
#0070f3
;
--color-blue-800
:
#0060d1
;
--color-blue-900
:
#52a9ff
;
--color-blue-1000
:
#eaf6ff
;
/* Red Scale Dark */
--color-red-100
:
#2a1314
;
--color-red-200
:
#3d1719
;
--color-red-300
:
#551a1e
;
--color-red-400
:
#671e22
;
--color-red-500
:
#822025
;
--color-red-600
:
#e5484d
;
--color-red-700
:
#e5484d
;
--color-red-800
:
#da3036
;
--color-red-900
:
#ff6369
;
--color-red-1000
:
#ffecee
;
/* Amber Scale Dark */
--color-amber-100
:
#271700
;
--color-amber-200
:
#341c00
;
--color-amber-300
:
#4a2900
;
--color-amber-400
:
#573300
;
--color-amber-500
:
#693f05
;
--color-amber-600
:
#e79c13
;
--color-amber-700
:
#ffb224
;
--color-amber-800
:
#ff990a
;
--color-amber-900
:
#f1a10d
;
--color-amber-1000
:
#fef3dd
;
/* Green Scale Dark */
--color-green-100
:
#0b2211
;
--color-green-200
:
#0f2c17
;
--color-green-300
:
#11351b
;
--color-green-400
:
#0c461b
;
--color-green-500
:
#126427
;
--color-green-600
:
#1a9338
;
--color-green-700
:
#46a758
;
--color-green-800
:
#388e4a
;
--color-green-900
:
#63c174
;
--color-green-1000
:
#e5fbeb
;
/* Turbopack Dark - Temporary */
--color-turbopack-text-red
:
#ff6d92
;
--color-turbopack-text-blue
:
#45b2ff
;
--color-turbopack-border-red
:
#6e293b
;
--color-turbopack-border-blue
:
#284f80
;
--color-turbopack-background-red
:
#250d12
;
--color-turbopack-background-blue
:
#0a1723
;
}
}
}
packages/next/src/next-devtools/dev-overlay/styles/default-theme.css
0 → 100644
View file @
13f413bb
:host
{
/*
* Although the style applied to the shadow host is isolated,
* the element that attached the shadow host (i.e. "nextjs-portal")
* is still affected by the parent's style (e.g. "body"). This may
* occur style conflicts like "display: flex", with other children
* elements therefore give the shadow host an absolute position.
*/
position
:
absolute
;
--color-font
:
#757575
;
--color-backdrop
:
rgba
(
250
,
250
,
250
,
0.8
);
--color-border-shadow
:
rgba
(
0
,
0
,
0
,
0.145
);
--color-title-color
:
#1f1f1f
;
--color-stack-notes
:
#777
;
--color-accents-1
:
#808080
;
--color-accents-2
:
#222222
;
--color-accents-3
:
#404040
;
--font-stack-monospace
:
'__nextjs-Geist Mono'
,
'Geist Mono'
,
'SFMono-Regular'
,
Consolas
,
'Liberation Mono'
,
Menlo
,
Courier
,
monospace
;
--font-stack-sans
:
'__nextjs-Geist'
,
'Geist'
,
-apple-system
,
'Source Sans Pro'
,
sans-serif
;
font-family
:
var
(
--font-stack-sans
);
font-variant-ligatures
:
none
;
/* TODO: Remove replaced ones. */
--shadow-sm
:
0
1px
2px
0
rgb
(
0
0
0
/
0.05
);
--shadow
:
0
1px
3px
0
rgb
(
0
0
0
/
0.1
),
0
1px
2px
-1px
rgb
(
0
0
0
/
0.1
);
--shadow-md
:
0
4px
6px
-1px
rgb
(
0
0
0
/
0.1
),
0
2px
4px
-2px
rgb
(
0
0
0
/
0.1
);
--shadow-lg
:
0
10px
15px
-3px
rgb
(
0
0
0
/
0.1
),
0
4px
6px
-4px
rgb
(
0
0
0
/
0.1
);
--shadow-xl
:
0
20px
25px
-5px
rgb
(
0
0
0
/
0.1
),
0
8px
10px
-6px
rgb
(
0
0
0
/
0.1
);
--shadow-2xl
:
0
25px
50px
-12px
rgb
(
0
0
0
/
0.25
);
--shadow-inner
:
inset
0
2px
4px
0
rgb
(
0
0
0
/
0.05
);
--shadow-none
:
0
0
#0000
;
--shadow-small
:
0px
2px
2px
rgba
(
0
,
0
,
0
,
0.04
);
--shadow-menu
:
0px
1px
1px
rgba
(
0
,
0
,
0
,
0.02
),
0px
4px
8px
-4px
rgba
(
0
,
0
,
0
,
0.04
),
0px
16px
24px
-8px
rgba
(
0
,
0
,
0
,
0.06
);
--focus-color
:
var
(
--color-blue-800
);
--focus-ring
:
2px
solid
var
(
--focus-color
);
--timing-swift
:
cubic-bezier
(
0.23
,
0.88
,
0.26
,
0.92
);
--timing-overlay
:
cubic-bezier
(
0.175
,
0.885
,
0.32
,
1.1
);
/* prettier-ignore */
--timing-bounce
:
linear
(
0
0%
,
0.005871
1%
,
0.022058
2%
,
0.046612
3%
,
0.077823
4%
,
0.114199
5%
,
0.154441
6%
,
0.197431
7.000000000000001%
,
0.242208
8%
,
0.287959
9%
,
0.333995
10%
,
0.379743
11%
,
0.424732
12%
,
0.46858
13%
,
0.510982
14.000000000000002%
,
0.551702
15%
,
0.590564
16%
,
0.627445
17%
,
0.662261
18%
,
0.694971
19%
,
0.725561
20%
,
0.754047
21%
,
0.780462
22%
,
0.804861
23%
,
0.82731
24%
,
0.847888
25%
,
0.866679
26%
,
0.883775
27%
,
0.899272
28.000000000000004%
,
0.913267
28.999999999999996%
,
0.925856
30%
,
0.937137
31%
,
0.947205
32%
,
0.956153
33%
,
0.96407
34%
,
0.971043
35%
,
0.977153
36%
,
0.982479
37%
,
0.987094
38%
,
0.991066
39%
,
0.994462
40%
,
0.997339
41%
,
0.999755
42%
,
1.001761
43%
,
1.003404
44%
,
1.004727
45%
,
1.00577
46%
,
1.006569
47%
,
1.007157
48%
,
1.007563
49%
,
1.007813
50%
,
1.007931
51%
,
1.007939
52%
,
1.007855
53%
,
1.007697
54%
,
1.007477
55.00000000000001%
,
1.00721
56.00000000000001%
,
1.006907
56.99999999999999%
,
1.006576
57.99999999999999%
,
1.006228
59%
,
1.005868
60%
,
1.005503
61%
,
1.005137
62%
,
1.004776
63%
,
1.004422
64%
,
1.004078
65%
,
1.003746
66%
,
1.003429
67%
,
1.003127
68%
,
1.00284
69%
,
1.002571
70%
,
1.002318
71%
,
1.002082
72%
,
1.001863
73%
,
1.00166
74%
,
1.001473
75%
,
1.001301
76%
,
1.001143
77%
,
1.001
78%
,
1.000869
79%
,
1.000752
80%
,
1.000645
81%
,
1.00055
82%
,
1.000464
83%
,
1.000388
84%
,
1.000321
85%
,
1.000261
86%
,
1.000209
87%
,
1.000163
88%
,
1.000123
89%
,
1.000088
90%
);
--rounded-none
:
0px
;
--rounded-sm
:
2px
;
--rounded-md
:
4px
;
--rounded-md-2
:
6px
;
--rounded-lg
:
8px
;
--rounded-xl
:
12px
;
--rounded-2xl
:
16px
;
--rounded-3xl
:
24px
;
--rounded-4xl
:
32px
;
--rounded-full
:
9999px
;
/*
This value gets set from the Dev Tools preferences,
and we use the following --size-* variables to
scale the relevant elements.
The reason why we don't rely on rem values is because
if an app sets their root font size to something tiny,
it feels unexpected to have the app root size leak
into a Next.js surface.
https://github.com/vercel/next.js/discussions/76812
*/
--nextjs-dev-tools-scale
:
1
;
--size-1
:
calc
(
1px
/
var
(
--nextjs-dev-tools-scale
));
--size-2
:
calc
(
2px
/
var
(
--nextjs-dev-tools-scale
));
--size-3
:
calc
(
3px
/
var
(
--nextjs-dev-tools-scale
));
--size-4
:
calc
(
4px
/
var
(
--nextjs-dev-tools-scale
));
--size-5
:
calc
(
5px
/
var
(
--nextjs-dev-tools-scale
));
--size-6
:
calc
(
6px
/
var
(
--nextjs-dev-tools-scale
));
--size-7
:
calc
(
7px
/
var
(
--nextjs-dev-tools-scale
));
--size-8
:
calc
(
8px
/
var
(
--nextjs-dev-tools-scale
));
--size-9
:
calc
(
9px
/
var
(
--nextjs-dev-tools-scale
));
--size-10
:
calc
(
10px
/
var
(
--nextjs-dev-tools-scale
));
--size-11
:
calc
(
11px
/
var
(
--nextjs-dev-tools-scale
));
--size-12
:
calc
(
12px
/
var
(
--nextjs-dev-tools-scale
));
--size-13
:
calc
(
13px
/
var
(
--nextjs-dev-tools-scale
));
--size-14
:
calc
(
14px
/
var
(
--nextjs-dev-tools-scale
));
--size-15
:
calc
(
15px
/
var
(
--nextjs-dev-tools-scale
));
--size-16
:
calc
(
16px
/
var
(
--nextjs-dev-tools-scale
));
--size-17
:
calc
(
17px
/
var
(
--nextjs-dev-tools-scale
));
--size-18
:
calc
(
18px
/
var
(
--nextjs-dev-tools-scale
));
--size-20
:
calc
(
20px
/
var
(
--nextjs-dev-tools-scale
));
--size-22
:
calc
(
22px
/
var
(
--nextjs-dev-tools-scale
));
--size-24
:
calc
(
24px
/
var
(
--nextjs-dev-tools-scale
));
--size-26
:
calc
(
26px
/
var
(
--nextjs-dev-tools-scale
));
--size-28
:
calc
(
28px
/
var
(
--nextjs-dev-tools-scale
));
--size-30
:
calc
(
30px
/
var
(
--nextjs-dev-tools-scale
));
--size-32
:
calc
(
32px
/
var
(
--nextjs-dev-tools-scale
));
--size-34
:
calc
(
34px
/
var
(
--nextjs-dev-tools-scale
));
--size-36
:
calc
(
36px
/
var
(
--nextjs-dev-tools-scale
));
--size-38
:
calc
(
38px
/
var
(
--nextjs-dev-tools-scale
));
--size-40
:
calc
(
40px
/
var
(
--nextjs-dev-tools-scale
));
--size-42
:
calc
(
42px
/
var
(
--nextjs-dev-tools-scale
));
--size-44
:
calc
(
44px
/
var
(
--nextjs-dev-tools-scale
));
--size-46
:
calc
(
46px
/
var
(
--nextjs-dev-tools-scale
));
--size-48
:
calc
(
48px
/
var
(
--nextjs-dev-tools-scale
));
@media
print
{
display
:
none
;
}
}
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
margin-bottom
:
8px
;
font-weight
:
500
;
line-height
:
1.5
;
}
a
{
color
:
var
(
--color-blue-900
);
&:hover
{
color
:
var
(
--color-blue-900
);
}
&
:focus-visible
{
outline
:
var
(
--focus-ring
);
}
}
packages/next/src/next-devtools/dev-overlay/styles/scale-updater.tsx
0 → 100644
View file @
13f413bb
import
{
useLayoutEffect
}
from
'react'
import
{
useDevOverlayContext
}
from
'../../dev-overlay.browser'
export
function
ScaleUpdater
()
{
const
{
shadowRoot
,
state
}
=
useDevOverlayContext
()
useLayoutEffect
(()
=>
{
// Update the CSS custom property for scale
if
(
shadowRoot
?.
host
)
{
;(
shadowRoot
.
host
as
HTMLElement
).
style
.
setProperty
(
'--nextjs-dev-tools-scale'
,
String
(
state
.
scale
||
1
)
)
}
},
[
shadowRoot
,
state
.
scale
])
return
null
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment