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
ed14cd2f
Commit
ed14cd2f
authored
Jul 11, 2025
by
RobPruzan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove panel tab UI
parent
5e65f807
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
28 additions
and
1833 deletions
+28
-1833
main.ts
packages/next/.storybook/main.ts
+2
-0
devtools-panel-footer.tsx
...erlay/components/devtools-panel/devtools-panel-footer.tsx
+0
-86
devtools-panel-tab.tsx
.../devtools-panel/devtools-panel-tab/devtools-panel-tab.tsx
+0
-60
issues-tab-content-layout.tsx
...vtools-panel-tab/issues-tab/issues-tab-content-layout.tsx
+0
-70
issues-tab-content.tsx
...anel/devtools-panel-tab/issues-tab/issues-tab-content.tsx
+0
-197
issues-tab-empty-content.tsx
...evtools-panel-tab/issues-tab/issues-tab-empty-content.tsx
+0
-64
issues-tab-sidebar-frame-skeleton.tsx
...anel-tab/issues-tab/issues-tab-sidebar-frame-skeleton.tsx
+0
-52
issues-tab-sidebar.stories.tsx
...tools-panel-tab/issues-tab/issues-tab-sidebar.stories.tsx
+0
-41
issues-tab-sidebar.tsx
...anel/devtools-panel-tab/issues-tab/issues-tab-sidebar.tsx
+0
-179
issues-tab.tsx
...vtools-panel/devtools-panel-tab/issues-tab/issues-tab.tsx
+0
-64
segments-explorer-tab.tsx
...vtools-panel/devtools-panel-tab/segments-explorer-tab.tsx
+0
-26
settings-tab.tsx
...onents/devtools-panel/devtools-panel-tab/settings-tab.tsx
+0
-312
devtools-panel-version-info.stories.tsx
...ts/devtools-panel/devtools-panel-version-info.stories.tsx
+0
-95
devtools-panel-version-info.tsx
...components/devtools-panel/devtools-panel-version-info.tsx
+0
-57
devtools-panel.stories.tsx
...rlay/components/devtools-panel/devtools-panel.stories.tsx
+0
-87
devtools-panel.tsx
.../dev-overlay/components/devtools-panel/devtools-panel.tsx
+0
-422
use-session-state.ts
...rlay/components/devtools-panel/hooks/use-session-state.ts
+26
-0
component-styles.tsx
...src/next-devtools/dev-overlay/styles/component-styles.tsx
+0
-21
No files found.
packages/next/.storybook/main.ts
View file @
ed14cd2f
...
@@ -9,6 +9,8 @@ import { fileURLToPath } from 'url'
...
@@ -9,6 +9,8 @@ import { fileURLToPath } from 'url'
function
getAbsolutePath
(
value
:
string
):
any
{
function
getAbsolutePath
(
value
:
string
):
any
{
return
dirname
(
require
.
resolve
(
join
(
value
,
'package.json'
)))
return
dirname
(
require
.
resolve
(
join
(
value
,
'package.json'
)))
}
}
import
{
createRequire
}
from
'module'
const
require
=
createRequire
(
import
.
meta
.
url
)
const
config
:
StorybookConfig
=
{
const
config
:
StorybookConfig
=
{
stories
:
[
'../src/next-devtools/**/*.stories.tsx'
],
stories
:
[
'../src/next-devtools/**/*.stories.tsx'
],
...
...
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-footer.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
OverlayState
}
from
'../../shared'
import
{
DevToolsPanelVersionInfo
}
from
'./devtools-panel-version-info'
import
{
css
}
from
'../../utils/css'
import
{
RestartServerButton
}
from
'../errors/error-overlay-toolbar/restart-server-button'
export
function
DevToolsPanelFooter
({
versionInfo
,
isDraggable
,
showRestartServerButton
,
}:
{
versionInfo
:
OverlayState
[
'versionInfo'
]
isDraggable
:
boolean
showRestartServerButton
:
boolean
})
{
const
bundlerName
=
(
process
.
env
.
__NEXT_BUNDLER
||
'WEBPACK'
).
toUpperCase
()
as
'WEBPACK'
|
'TURBOPACK'
|
'RSPACK'
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
footer
data
-
nextjs
-
devtools
-
panel
-
draggable=
{
isDraggable
}
>
<
div
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
-
group
>
<
DevToolsPanelVersionInfo
versionInfo=
{
versionInfo
}
/>
<
div
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
>
{
/* TODO: The details may change, follow up. */
}
<
span
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
-
bundler
-
name=
{
bundlerName
}
>
{
bundlerName
}
</
span
>
<
span
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
-
bundler
-
status
>
enabled
</
span
>
</
div
>
</
div
>
{
showRestartServerButton
&&
(
<
div
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
-
group
>
<
RestartServerButton
showButton=
{
true
}
/>
</
div
>
)
}
</
div
>
)
}
export
const
DEVTOOLS_PANEL_FOOTER_STYLES
=
css
`
[data-nextjs-devtools-panel-footer] {
background-color: var(--color-background-200);
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid var(--color-gray-400);
border-radius: 0 0 var(--rounded-xl) var(--rounded-xl);
height: auto;
}
[data-nextjs-devtools-panel-footer-tab-group] {
display: flex;
align-items: center;
}
[data-nextjs-devtools-panel-footer-tab] {
display: flex;
align-items: center;
padding: 12px;
gap: 8px;
align-self: stretch;
border-right: 1px solid var(--color-gray-400);
color: var(--color-gray-900);
font-size: 12px;
font-family: var(--font-stack-monospace);
}
[data-nextjs-devtools-panel-footer-tab-bundler-name='TURBOPACK'] {
background: linear-gradient(
to right,
var(--color-turbopack-text-red) 0%,
var(--color-turbopack-text-blue) 100%
);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/devtools-panel-tab.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
DevToolsPanelTabType
}
from
'../devtools-panel'
import
type
{
Corners
,
OverlayState
}
from
'../../../shared'
import
type
{
DebugInfo
}
from
'../../../../shared/types'
import
type
{
ReadyRuntimeError
}
from
'../../../utils/get-error-by-type'
import
type
{
HydrationErrorState
}
from
'../../../../shared/hydration-error'
import
{
SettingsTab
}
from
'./settings-tab'
import
{
IssuesTab
}
from
'./issues-tab/issues-tab'
import
{
SegmentsExplorerTab
}
from
'./segments-explorer-tab'
export
function
DevToolsPanelTab
({
activeTab
,
devToolsPosition
,
scale
,
routerType
,
handlePositionChange
,
handleScaleChange
,
debugInfo
,
runtimeErrors
,
getSquashedHydrationErrorDetails
,
buildError
,
page
,
}:
{
activeTab
:
DevToolsPanelTabType
devToolsPosition
:
Corners
routerType
:
'app'
|
'pages'
scale
:
number
handlePositionChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
handleScaleChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
debugInfo
:
DebugInfo
runtimeErrors
:
ReadyRuntimeError
[]
getSquashedHydrationErrorDetails
:
(
error
:
Error
)
=>
HydrationErrorState
|
null
buildError
:
OverlayState
[
'buildError'
]
page
:
string
})
{
switch
(
activeTab
)
{
case
'settings'
:
return
(
<
SettingsTab
devToolsPosition=
{
devToolsPosition
}
scale=
{
scale
}
handlePositionChange=
{
handlePositionChange
}
handleScaleChange=
{
handleScaleChange
}
/>
)
case
'route'
:
return
<
SegmentsExplorerTab
routerType=
{
routerType
}
page=
{
page
}
/>
case
'issues'
:
return
(
<
IssuesTab
debugInfo=
{
debugInfo
}
runtimeErrors=
{
runtimeErrors
}
getSquashedHydrationErrorDetails=
{
getSquashedHydrationErrorDetails
}
buildError=
{
buildError
}
/>
)
default
:
return
null
}
}
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content-layout.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
DebugInfo
}
from
'../../../../../shared/types'
import
type
{
ErrorType
}
from
'../../../errors/error-type-label/error-type-label'
import
{
ErrorMessage
}
from
'../../../errors/error-message/error-message'
import
{
ErrorOverlayToolbar
}
from
'../../../errors/error-overlay-toolbar/error-overlay-toolbar'
import
{
ErrorTypeLabel
}
from
'../../../errors/error-type-label/error-type-label'
import
{
EnvironmentNameLabel
}
from
'../../../errors/environment-name-label/environment-name-label'
import
{
IssueFeedbackButton
}
from
'../../../errors/error-overlay-toolbar/issue-feedback-button'
import
{
css
}
from
'../../../../utils/css'
// This behaves like the ErrorOverlayLayout.
export
function
IssuesTabContentLayout
({
error
,
errorType
,
message
,
debugInfo
,
children
,
errorCode
,
environmentName
,
}:
{
error
:
Error
&
{
environmentName
?:
string
}
errorType
:
ErrorType
message
:
string
debugInfo
:
DebugInfo
children
:
React
.
ReactNode
errorCode
?:
string
|
null
environmentName
?:
string
})
{
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
content
-
layout
>
<
div
className=
"nextjs-container-errors-header"
>
<
div
className=
"nextjs__container_errors__error_title"
// allow assertion in tests before error rating is implemented
data
-
nextjs
-
error
-
code=
{
errorCode
}
>
<
span
data
-
nextjs
-
error
-
label
-
group
>
<
ErrorTypeLabel
errorType=
{
errorType
}
/>
{
environmentName
&&
(
<
EnvironmentNameLabel
environmentName=
{
environmentName
}
/>
)
}
</
span
>
<
ErrorOverlayToolbar
error=
{
error
}
debugInfo=
{
debugInfo
}
// TODO: Move the button inside and remove the feedback on the footer of the error overlay.
feedbackButton=
{
errorCode
&&
<
IssueFeedbackButton
errorCode=
{
errorCode
}
/>
}
/>
</
div
>
<
ErrorMessage
errorMessage=
{
message
}
/>
</
div
>
{
children
}
</
div
>
)
}
// The components in this file shares the style with the Error Overlay.
export
const
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_LAYOUT_STYLES
=
css
`
[data-nextjs-devtools-panel-tab-issues-content-layout] {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
min-height: 0;
padding: 14px;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
OverlayState
}
from
'../../../../shared'
import
type
{
ReadyRuntimeError
}
from
'../../../../utils/get-error-by-type'
import
{
Suspense
,
useMemo
,
useState
}
from
'react'
import
{
Terminal
}
from
'../../../terminal'
import
{
HotlinkedText
}
from
'../../../hot-linked-text'
import
{
PseudoHtmlDiff
}
from
'../../../../container/runtime-error/component-stack-pseudo-html'
import
{
useFrames
}
from
'../../../../utils/get-error-by-type'
import
{
CodeFrame
}
from
'../../../code-frame/code-frame'
import
{
CallStack
}
from
'../../../call-stack/call-stack'
import
{
NEXTJS_HYDRATION_ERROR_LINK
}
from
'../../../../../shared/react-19-hydration-error'
import
{
ErrorContentSkeleton
}
from
'../../../../container/runtime-error/error-content-skeleton'
import
{
css
}
from
'../../../../utils/css'
import
{
getErrorTextFromBuildErrorMessage
}
from
'../../../../container/build-error'
import
{
IssuesTabContentLayout
}
from
'./issues-tab-content-layout'
import
type
{
DebugInfo
}
from
'../../../../../shared/types'
import
type
{
ErrorType
}
from
'../../../errors/error-type-label/error-type-label'
import
{
IssuesTabEmptyContent
}
from
'./issues-tab-empty-content'
// This consists of the Build Error, Runtime Error, etc.
export
function
IssuesTabContent
({
notes
,
buildError
,
hydrationWarning
,
errorDetails
,
activeError
,
errorType
,
debugInfo
,
errorCode
,
}:
{
notes
:
string
|
null
buildError
:
OverlayState
[
'buildError'
]
hydrationWarning
:
string
|
null
errorDetails
:
{
hydrationWarning
:
string
|
null
notes
:
string
|
null
reactOutputComponentDiff
:
string
|
null
}
|
null
activeError
:
ReadyRuntimeError
|
null
errorType
:
ErrorType
|
null
debugInfo
:
DebugInfo
errorCode
:
string
|
null
|
undefined
})
{
if
(
buildError
)
{
return
<
BuildError
message=
{
buildError
}
debugInfo=
{
debugInfo
}
/>
}
return
(
<
ErrorContent
notes=
{
notes
}
hydrationWarning=
{
hydrationWarning
}
errorDetails=
{
errorDetails
}
activeError=
{
activeError
}
errorType=
{
errorType
}
debugInfo=
{
debugInfo
}
errorCode=
{
errorCode
}
/>
)
}
function
ErrorContent
({
notes
,
hydrationWarning
,
errorDetails
,
activeError
,
errorType
,
debugInfo
,
errorCode
,
}:
{
notes
:
string
|
null
hydrationWarning
:
string
|
null
errorDetails
:
{
hydrationWarning
:
string
|
null
notes
:
string
|
null
reactOutputComponentDiff
:
string
|
null
}
|
null
activeError
:
ReadyRuntimeError
|
null
errorType
:
ErrorType
|
null
debugInfo
:
DebugInfo
errorCode
:
string
|
null
|
undefined
})
{
if
(
!
activeError
||
!
errorType
)
{
return
<
IssuesTabEmptyContent
/>
}
return
(
<
IssuesTabContentLayout
error=
{
activeError
.
error
}
errorType=
{
errorType
}
message=
{
activeError
.
error
.
message
}
debugInfo=
{
debugInfo
}
errorCode=
{
errorCode
}
environmentName=
{
activeError
.
error
.
environmentName
}
>
<
div
className=
"error-overlay-notes-container"
>
{
notes
?
(
<>
<
p
id=
"nextjs__container_errors__notes"
className=
"nextjs__container_errors__notes"
>
{
notes
}
</
p
>
</>
)
:
null
}
{
hydrationWarning
?
(
<
p
id=
"nextjs__container_errors__link"
className=
"nextjs__container_errors__link"
>
<
HotlinkedText
text=
{
`See more info here: ${NEXTJS_HYDRATION_ERROR_LINK}`
}
/>
</
p
>
)
:
null
}
</
div
>
{
errorDetails
?.
reactOutputComponentDiff
?
(
<
PseudoHtmlDiff
reactOutputComponentDiff=
{
errorDetails
.
reactOutputComponentDiff
||
''
}
/>
)
:
null
}
<
Suspense
fallback=
{
<
ErrorContentSkeleton
/>
}
>
<
RuntimeError
key=
{
activeError
.
id
.
toString
()
}
error=
{
activeError
}
/>
</
Suspense
>
</
IssuesTabContentLayout
>
)
}
/* Ported the content from container/runtime-error/index.tsx */
function
RuntimeError
({
error
}:
{
error
:
ReadyRuntimeError
})
{
const
[
isIgnoreListOpen
,
setIsIgnoreListOpen
]
=
useState
(
false
)
const
frames
=
useFrames
(
error
)
const
ignoredFramesTally
=
useMemo
(()
=>
{
return
frames
.
reduce
((
tally
,
frame
)
=>
tally
+
(
frame
.
ignored
?
1
:
0
),
0
)
},
[
frames
])
const
firstFrame
=
useMemo
(()
=>
{
const
firstFirstPartyFrameIndex
=
frames
.
findIndex
(
(
entry
)
=>
!
entry
.
ignored
&&
Boolean
(
entry
.
originalCodeFrame
)
&&
Boolean
(
entry
.
originalStackFrame
)
)
return
frames
[
firstFirstPartyFrameIndex
]
??
null
},
[
frames
])
return
(
<>
{
firstFrame
&&
firstFrame
.
originalStackFrame
&&
firstFrame
.
originalCodeFrame
&&
(
<
CodeFrame
stackFrame=
{
firstFrame
.
originalStackFrame
}
codeFrame=
{
firstFrame
.
originalCodeFrame
}
/>
)
}
{
frames
.
length
>
0
&&
(
<
CallStack
frames=
{
frames
}
isIgnoreListOpen=
{
isIgnoreListOpen
}
onToggleIgnoreList=
{
()
=>
setIsIgnoreListOpen
(
!
isIgnoreListOpen
)
}
ignoredFramesTally=
{
ignoredFramesTally
}
/>
)
}
</>
)
}
function
BuildError
({
message
,
debugInfo
,
}:
{
message
:
string
debugInfo
:
DebugInfo
})
{
const
error
=
new
Error
(
message
)
const
formattedMessage
=
useMemo
(
()
=>
getErrorTextFromBuildErrorMessage
(
message
)
||
'Failed to compile'
,
[
message
]
)
return
(
<
IssuesTabContentLayout
errorType=
{
'Build Error'
}
error=
{
error
}
message=
{
formattedMessage
}
debugInfo=
{
debugInfo
}
>
<
Terminal
content=
{
message
}
/>
</
IssuesTabContentLayout
>
)
}
// The components in this file shares the style with the Error Overlay.
export
const
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES
=
css
``
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-empty-content.tsx
deleted
100644 → 0
View file @
5e65f807
import
{
Warning
}
from
'../../../../icons/warning'
import
{
css
}
from
'../../../../utils/css'
export
function
IssuesTabEmptyContent
()
{
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
empty
>
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
empty
-
content
>
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
empty
-
icon
>
<
Warning
width=
{
16
}
height=
{
16
}
/>
</
div
>
<
h3
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
empty
-
title
>
No Issues Found
</
h3
>
<
p
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
empty
-
subtitle
>
Issues will appear here when they occur.
</
p
>
</
div
>
</
div
>
)
}
export
const
DEVTOOLS_PANEL_TAB_ISSUES_EMPTY_CONTENT_STYLES
=
css
`
[data-nextjs-devtools-panel-tab-issues-empty] {
display: flex;
flex: 1;
padding: 12px;
min-height: 0;
}
[data-nextjs-devtools-panel-tab-issues-empty-content] {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
border: 1px dashed var(--color-gray-alpha-500);
border-radius: 4px;
}
[data-nextjs-devtools-panel-tab-issues-empty-icon] {
margin-bottom: 16px;
padding: 8px;
border: 1px solid var(--color-gray-alpha-400);
border-radius: 6px;
background-color: var(--color-background-100);
display: flex;
align-items: center;
justify-content: center;
}
[data-nextjs-devtools-panel-tab-issues-empty-title] {
color: var(--color-gray-1000);
font-size: 16px;
font-weight: 500;
line-height: var(--line-height-20);
}
[data-nextjs-devtools-panel-tab-issues-empty-subtitle] {
color: var(--color-gray-900);
font-size: 14px;
line-height: var(--line-height-21);
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-sidebar-frame-skeleton.tsx
deleted
100644 → 0
View file @
5e65f807
import
{
css
}
from
'../../../../utils/css'
export
function
IssuesTabSidebarFrameSkeleton
()
{
return
(
<>
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
-
skeleton
-
bar=
"1"
/>
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
-
skeleton
-
bar=
"2"
/>
</>
)
}
export
const
DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_FRAME_SKELETON_STYLES
=
css
`
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-skeleton-bar] {
height: var(--size-12);
border-radius: 100px;
background: linear-gradient(
90deg,
var(--color-gray-200) 25%,
var(--color-gray-100) 50%,
var(--color-gray-200) 75%
);
background-size: 200% 100%;
animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-skeleton-bar='1'] {
width: 75%;
margin-bottom: 8px;
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-skeleton-bar='2'] {
width: 36.5%;
}
@keyframes skeleton-shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-skeleton-bar='1'],
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-skeleton-bar='2'] {
animation: none;
background: var(--color-gray-200);
}
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-sidebar.stories.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
Meta
,
StoryObj
}
from
'@storybook/react'
import
{
useState
}
from
'react'
import
{
IssuesTabSidebar
}
from
'./issues-tab-sidebar'
import
{
withShadowPortal
}
from
'../../../../storybook/with-shadow-portal'
import
{
runtimeErrors
}
from
'../../../../storybook/errors'
const
meta
:
Meta
<
typeof
IssuesTabSidebar
>
=
{
component
:
IssuesTabSidebar
,
parameters
:
{
layout
:
'centered'
,
},
decorators
:
[
withShadowPortal
],
}
export
default
meta
type
Story
=
StoryObj
<
typeof
IssuesTabSidebar
>
const
SidebarWrapper
=
({
runtimeErrors
:
errors
,
errorType
,
}:
{
runtimeErrors
:
any
[]
errorType
:
string
|
null
})
=>
{
const
[
activeIdx
,
setActiveIdx
]
=
useState
(
0
)
return
(
<
IssuesTabSidebar
runtimeErrors=
{
errors
}
errorType=
{
errorType
}
activeIdx=
{
activeIdx
}
setActiveIndex=
{
setActiveIdx
}
/>
)
}
export
const
Default
:
Story
=
{
render
:
()
=>
(
<
SidebarWrapper
runtimeErrors=
{
runtimeErrors
}
errorType=
"runtime"
/>
),
}
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-sidebar.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
ReadyRuntimeError
}
from
'../../../../utils/get-error-by-type'
import
{
Suspense
,
useMemo
,
memo
}
from
'react'
import
{
css
}
from
'../../../../utils/css'
import
{
getFrameSource
}
from
'../../../../../shared/stack-frame'
import
{
useFrames
}
from
'../../../../utils/get-error-by-type'
import
{
getErrorTypeLabel
}
from
'../../../../container/errors'
import
{
IssuesTabSidebarFrameSkeleton
}
from
'./issues-tab-sidebar-frame-skeleton'
export
function
IssuesTabSidebar
({
runtimeErrors
,
activeIdx
,
setActiveIndex
,
}:
{
runtimeErrors
:
ReadyRuntimeError
[]
errorType
:
string
|
null
activeIdx
:
number
setActiveIndex
:
(
idx
:
number
)
=>
void
})
{
if
(
runtimeErrors
.
length
===
0
)
{
return
null
}
return
(
<
aside
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
>
{
runtimeErrors
.
map
((
runtimeError
,
idx
)
=>
{
const
isActive
=
idx
===
activeIdx
return
(
<
IssuesTabSidebarFrame
key=
{
idx
}
runtimeError=
{
runtimeError
}
idx=
{
idx
}
isActive=
{
isActive
}
setActiveIndex=
{
setActiveIndex
}
/>
)
})
}
</
aside
>
)
}
const
IssuesTabSidebarFrameItem
=
memo
(
function
IssuesTabSidebarFrameItem
({
runtimeError
,
}:
{
runtimeError
:
ReadyRuntimeError
})
{
const
frames
=
useFrames
(
runtimeError
)
const
firstFrame
=
useMemo
(()
=>
{
const
firstFirstPartyFrameIndex
=
frames
.
findIndex
(
(
entry
)
=>
!
entry
.
ignored
&&
Boolean
(
entry
.
originalCodeFrame
)
&&
Boolean
(
entry
.
originalStackFrame
)
)
return
frames
[
firstFirstPartyFrameIndex
]
??
null
},
[
frames
])
if
(
!
firstFrame
?.
originalStackFrame
)
{
return
null
}
const
errorType
=
getErrorTypeLabel
(
runtimeError
.
error
,
runtimeError
.
type
)
const
frameSource
=
getFrameSource
(
firstFrame
.
originalStackFrame
)
return
(
<>
<
span
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
-
error
-
type
>
{
errorType
}
</
span
>
<
span
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
-
source
>
{
frameSource
}
</
span
>
</>
)
})
const
IssuesTabSidebarFrame
=
memo
(
function
IssuesTabSidebarFrame
({
runtimeError
,
idx
,
isActive
,
setActiveIndex
,
}:
{
runtimeError
:
ReadyRuntimeError
idx
:
number
isActive
:
boolean
setActiveIndex
:
(
idx
:
number
)
=>
void
})
{
return
(
<
button
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
-
sidebar
-
frame
-
active=
{
isActive
}
onClick=
{
()
=>
setActiveIndex
(
idx
)
}
>
<
Suspense
fallback=
{
<
IssuesTabSidebarFrameSkeleton
/>
}
>
<
IssuesTabSidebarFrameItem
runtimeError=
{
runtimeError
}
/>
</
Suspense
>
</
button
>
)
})
export
const
DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_STYLES
=
css
`
[data-nextjs-devtools-panel-tab-issues-sidebar] {
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px;
border-right: 1px solid var(--color-gray-400);
overflow-y: auto;
min-height: 0;
@media (max-width: 575px) {
max-width: 112px;
}
@media (min-width: 576px) {
max-width: 138px;
width: 100%;
}
@media (min-width: 768px) {
max-width: 172.5px;
width: 100%;
}
@media (min-width: 992px) {
max-width: 230px;
width: 100%;
}
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame] {
display: flex;
flex-direction: column;
padding: 10px 8px;
border-radius: var(--rounded-lg);
transition: background-color 0.2s ease-in-out;
&:hover {
background-color: var(--color-gray-200);
}
&:active {
background-color: var(--color-gray-300);
}
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-active='true'] {
background-color: var(--color-gray-100);
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-error-type] {
display: inline-block;
align-self: flex-start;
color: var(--color-gray-1000);
font-size: var(--size-14);
font-weight: 500;
line-height: var(--size-20);
}
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-source] {
display: inline-block;
align-self: flex-start;
color: var(--color-gray-900);
font-size: var(--size-13);
line-height: var(--size-18);
}
/* Ellipsis for long stack frame source or small devices. */
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-error-type],
[data-nextjs-devtools-panel-tab-issues-sidebar-frame-source] {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
OverlayState
}
from
'../../../../shared'
import
type
{
DebugInfo
}
from
'../../../../../shared/types'
import
type
{
ReadyRuntimeError
}
from
'../../../../utils/get-error-by-type'
import
type
{
HydrationErrorState
}
from
'../../../../../shared/hydration-error'
import
{
IssuesTabSidebar
}
from
'./issues-tab-sidebar'
import
{
IssuesTabContent
}
from
'./issues-tab-content'
import
{
css
}
from
'../../../../utils/css'
import
{
useActiveRuntimeError
}
from
'../../../../hooks/use-active-runtime-error'
export
function
IssuesTab
({
debugInfo
,
runtimeErrors
,
getSquashedHydrationErrorDetails
,
buildError
,
}:
{
debugInfo
:
DebugInfo
runtimeErrors
:
ReadyRuntimeError
[]
getSquashedHydrationErrorDetails
:
(
error
:
Error
)
=>
HydrationErrorState
|
null
buildError
:
OverlayState
[
'buildError'
]
})
{
const
{
errorCode
,
errorType
,
hydrationWarning
,
activeError
,
activeIdx
,
setActiveIndex
,
notes
,
errorDetails
,
}
=
useActiveRuntimeError
({
runtimeErrors
,
getSquashedHydrationErrorDetails
})
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
tab
-
issues
>
{
buildError
?
null
:
(
<
IssuesTabSidebar
runtimeErrors=
{
runtimeErrors
}
errorType=
{
errorType
}
activeIdx=
{
activeIdx
}
setActiveIndex=
{
setActiveIndex
}
/>
)
}
<
IssuesTabContent
buildError=
{
buildError
}
notes=
{
notes
}
hydrationWarning=
{
hydrationWarning
}
errorDetails=
{
errorDetails
}
activeError=
{
activeError
}
errorType=
{
errorType
}
debugInfo=
{
debugInfo
}
errorCode=
{
errorCode
}
/>
</
div
>
)
}
export
const
DEVTOOLS_PANEL_TAB_ISSUES_STYLES
=
css
`
[data-nextjs-devtools-panel-tab-issues] {
display: flex;
flex: 1;
min-height: 0;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/segments-explorer-tab.tsx
deleted
100644 → 0
View file @
5e65f807
const
PageSegmentTree
=
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
?
(
require
(
'../../overview/segment-explorer'
)
as
typeof
import
(
'../../overview/segment-explorer'
)
).
PageSegmentTree
:
()
=>
null
function
SegmentsExplorer
({
routerType
,
page
,
}:
React
.
HTMLProps
<
HTMLDivElement
>
&
{
routerType
:
'app'
|
'pages'
page
:
string
})
{
const
isAppRouter
=
routerType
===
'app'
return
<
PageSegmentTree
isAppRouter=
{
isAppRouter
}
page=
{
page
}
/>
}
export
function
SegmentsExplorerTab
({
routerType
,
page
,
}:
{
routerType
:
'app'
|
'pages'
page
:
string
})
{
return
<
SegmentsExplorer
routerType=
{
routerType
}
page=
{
page
}
/>
}
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-tab/settings-tab.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
Corners
}
from
'../../../shared'
import
{
useTheme
}
from
'../hooks/use-theme'
import
{
Select
}
from
'../../select/select'
import
{
STORAGE_KEY_THEME
,
NEXT_DEV_TOOLS_SCALE
}
from
'../../../shared'
import
{
css
}
from
'../../../utils/css'
import
LightIcon
from
'../../../icons/light-icon'
import
DarkIcon
from
'../../../icons/dark-icon'
import
SystemIcon
from
'../../../icons/system-icon'
import
EyeIcon
from
'../../../icons/eye-icon'
function
ThemeIcon
({
theme
}:
{
theme
:
'dark'
|
'light'
|
'system'
})
{
switch
(
theme
)
{
case
'system'
:
return
<
SystemIcon
/>
case
'dark'
:
return
<
DarkIcon
/>
case
'light'
:
return
<
LightIcon
/>
default
:
return
null
}
}
export
function
SettingsTab
({
devToolsPosition
,
scale
,
handlePositionChange
,
handleScaleChange
,
}:
{
devToolsPosition
:
Corners
scale
:
number
handlePositionChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
handleScaleChange
:
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
void
})
{
const
[
theme
,
setTheme
]
=
useTheme
()
const
handleThemeChange
=
(
e
:
React
.
ChangeEvent
<
HTMLSelectElement
>
)
=>
{
const
portal
=
document
.
querySelector
(
'nextjs-portal'
)
if
(
!
portal
)
return
setTheme
(
e
.
target
.
value
)
if
(
e
.
target
.
value
===
'system'
)
{
portal
.
classList
.
remove
(
'dark'
)
portal
.
classList
.
remove
(
'light'
)
localStorage
.
removeItem
(
STORAGE_KEY_THEME
)
return
}
if
(
e
.
target
.
value
===
'dark'
)
{
portal
.
classList
.
add
(
'dark'
)
portal
.
classList
.
remove
(
'light'
)
localStorage
.
setItem
(
STORAGE_KEY_THEME
,
'dark'
)
}
else
{
portal
.
classList
.
remove
(
'dark'
)
portal
.
classList
.
add
(
'light'
)
localStorage
.
setItem
(
STORAGE_KEY_THEME
,
'light'
)
}
}
function
handleRestartDevServer
(
invalidatePersistentCache
:
boolean
)
{
let
endpoint
=
'/__nextjs_restart_dev'
if
(
invalidatePersistentCache
)
{
endpoint
=
'/__nextjs_restart_dev?invalidatePersistentCache'
}
fetch
(
endpoint
,
{
method
:
'POST'
,
}).
then
(()
=>
{
// TODO: poll server status and reload when the server is back up.
// https://github.com/vercel/next.js/pull/80005
})
}
function
hide
()
{
fetch
(
'/__nextjs_disable_dev_indicator'
,
{
method
:
'POST'
,
})
}
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
htmlFor=
"theme"
>
Theme
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Select your theme preference.
</
p
>
</
div
>
<
Select
id=
"theme"
name=
"theme"
prefix=
{
<
ThemeIcon
theme=
{
theme
as
'dark'
|
'light'
|
'system'
}
/>
}
value=
{
theme
}
onChange=
{
handleThemeChange
}
>
<
option
value=
"system"
>
System
</
option
>
<
option
value=
"light"
>
Light
</
option
>
<
option
value=
"dark"
>
Dark
</
option
>
</
Select
>
</
div
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
htmlFor=
"position"
>
Position
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Adjust the placement of your dev tools.
</
p
>
</
div
>
<
Select
id=
"position"
name=
"position"
value=
{
devToolsPosition
}
onChange=
{
handlePositionChange
}
>
<
option
value=
"bottom-left"
>
Bottom Left
</
option
>
<
option
value=
"bottom-right"
>
Bottom Right
</
option
>
<
option
value=
"top-left"
>
Top Left
</
option
>
<
option
value=
"top-right"
>
Top Right
</
option
>
</
Select
>
</
div
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
htmlFor=
"size"
>
Size
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Adjust the size of your dev tools.
</
p
>
</
div
>
<
Select
id=
"size"
name=
"size"
value=
{
scale
}
onChange=
{
handleScaleChange
}
>
{
Object
.
entries
(
NEXT_DEV_TOOLS_SCALE
).
map
(([
key
,
value
])
=>
{
return
(
<
option
value=
{
value
}
key=
{
key
}
>
{
key
}
</
option
>
)
})
}
</
Select
>
</
div
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
id=
"hide-dev-tools"
>
Hide Dev Tools for this session
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Hide Dev Tools until you restart your dev server, or 1 day.
</
p
>
</
div
>
<
div
>
<
button
aria
-
describedby=
"hide-dev-tools"
name=
"hide-dev-tools"
data
-
hide
-
dev
-
tools
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
action
-
button
onClick=
{
hide
}
>
<
EyeIcon
/>
<
span
>
Hide
</
span
>
</
button
>
</
div
>
</
div
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
>
Disable Dev Tools for this project
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
To disable this UI completely, set
{
' '
}
<
code
className=
"dev-tools-info-code"
>
devIndicators: false
</
code
>
in
your
<
code
className=
"dev-tools-info-code"
>
next.config
</
code
>
file.
</
p
>
</
div
>
</
div
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
id=
"restart-dev-server"
>
Restart Dev Server
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Restarts the development server without needing to leave the
browser.
</
p
>
</
div
>
<
div
>
<
button
aria
-
describedby=
"restart-dev-server"
title=
"Restarts the development server without needing to leave the browser."
name=
"restart-dev-server"
data
-
restart
-
dev
-
server
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
action
-
button
onClick=
{
()
=>
handleRestartDevServer
(
/*invalidatePersistentCache*/
false
)
}
>
<
span
>
Restart
</
span
>
</
button
>
</
div
>
</
div
>
{
process
.
env
.
__NEXT_TURBOPACK_PERSISTENT_CACHE
?
(
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
>
<
div
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
header
>
<
label
id=
"reset-bundler-cache"
>
Reset Bundler Cache
</
label
>
<
p
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
description
>
Clears the bundler cache and restarts the dev server. Helpful if
you are seeing stale errors or changes are not appearing.
</
p
>
</
div
>
<
div
>
<
button
aria
-
describedby=
"reset-bundler-cache"
title=
"Clears the bundler cache and restarts the dev server. Helpful if you are seeing stale errors or changes are not appearing."
name=
"reset-bundler-cache"
data
-
reset
-
bundler
-
cache
data
-
nextjs
-
devtools
-
panel
-
settings
-
section
-
action
-
button
onClick=
{
()
=>
handleRestartDevServer
(
/*invalidatePersistentCache*/
true
)
}
>
<
span
>
Reset Cache
</
span
>
</
button
>
</
div
>
</
div
>
)
:
null
}
</
div
>
)
}
export
const
DEVTOOLS_PANEL_TAB_SETTINGS_STYLES
=
css
`
[data-nextjs-devtools-panel-settings] {
padding: 16px;
}
[data-nextjs-devtools-panel-settings-section]:first-child {
padding-top: 0;
}
[data-nextjs-devtools-panel-settings-section] {
padding: 12px 0;
border-bottom: 1px solid var(--color-gray-400);
display: flex;
justify-content: space-between;
align-items: center;
gap: 24px;
}
[data-nextjs-devtools-panel-settings-section]:last-child {
padding-bottom: 0;
border-bottom: none;
}
[data-nextjs-devtools-panel-settings-section-header] {
margin-bottom: 0;
flex: 1;
}
[data-nextjs-devtools-panel-settings-section-header] label {
font-size: var(--size-14);
font-weight: 500;
color: var(--color-gray-1000);
margin: 0;
}
[data-nextjs-devtools-panel-settings-section-description] {
color: var(--color-gray-900);
font-size: var(--size-14);
margin: 0;
}
[data-nextjs-select],
[data-nextjs-devtools-panel-settings-section-action-button] {
display: flex;
align-items: center;
gap: 8px;
background: var(--color-background-100);
border: 1px solid var(--color-gray-400);
border-radius: var(--rounded-lg);
font-weight: 400;
font-size: var(--size-14);
color: var(--color-gray-1000);
padding: 6px 8px;
&:hover {
background: var(--color-gray-100);
}
}
[data-nextjs-select] {
&:focus-within {
outline: var(--focus-ring);
}
select {
all: unset;
}
option {
color: var(--color-gray-1000);
background: var(--color-background-100);
}
}
:global(.icon) {
width: 18px;
height: 18px;
color: #666;
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-version-info.stories.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
Meta
,
StoryObj
}
from
'@storybook/react'
import
{
DevToolsPanelVersionInfo
}
from
'./devtools-panel-version-info'
import
{
withShadowPortal
}
from
'../../storybook/with-shadow-portal'
const
meta
:
Meta
<
typeof
DevToolsPanelVersionInfo
>
=
{
component
:
DevToolsPanelVersionInfo
,
parameters
:
{
layout
:
'centered'
,
},
decorators
:
[
withShadowPortal
],
}
export
default
meta
type
Story
=
StoryObj
<
typeof
DevToolsPanelVersionInfo
>
// Mock version info for different scenarios
const
mockVersionInfo
=
{
fresh
:
{
installed
:
'15.0.0'
,
expected
:
'15.0.0'
,
staleness
:
'fresh'
as
const
,
},
stalePatch
:
{
installed
:
'15.0.0'
,
expected
:
'15.0.1'
,
staleness
:
'stale-patch'
as
const
,
},
staleMinor
:
{
installed
:
'15.0.0'
,
expected
:
'15.1.0'
,
staleness
:
'stale-minor'
as
const
,
},
staleMajor
:
{
installed
:
'14.0.0'
,
expected
:
'15.0.0'
,
staleness
:
'stale-major'
as
const
,
},
stalePrerelease
:
{
installed
:
'15.0.0-canary.0'
,
expected
:
'15.0.0-canary.1'
,
staleness
:
'stale-prerelease'
as
const
,
},
newerThanNpm
:
{
installed
:
'15.0.0-canary.1'
,
expected
:
'15.0.0-canary.0'
,
staleness
:
'newer-than-npm'
as
const
,
},
unknown
:
{
installed
:
'15.0.0'
,
expected
:
'15.0.0'
,
staleness
:
'unknown'
as
const
,
},
}
export
const
Fresh
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
fresh
,
},
}
export
const
StalePatch
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
stalePatch
,
},
}
export
const
StaleMinor
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
staleMinor
,
},
}
export
const
StaleMajor
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
staleMajor
,
},
}
export
const
StalePrerelease
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
stalePrerelease
,
},
}
export
const
NewerThanNpm
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
newerThanNpm
,
},
}
export
const
Unknown
:
Story
=
{
args
:
{
versionInfo
:
mockVersionInfo
.
unknown
,
},
}
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel-version-info.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
OverlayState
}
from
'../../shared'
import
{
EclipseIcon
}
from
'../../icons/eclipse'
import
{
getStaleness
}
from
'../../../shared/version-staleness'
import
{
css
}
from
'../../utils/css'
export
function
DevToolsPanelVersionInfo
({
versionInfo
,
}:
{
versionInfo
:
OverlayState
[
'versionInfo'
]
})
{
const
{
staleness
}
=
versionInfo
const
{
text
,
indicatorClass
,
title
}
=
getStaleness
(
versionInfo
)
const
shouldBeLink
=
staleness
.
startsWith
(
'stale'
)
if
(
shouldBeLink
)
{
return
(
// TODO: Make it button-like and display radix-ui Tooltip on hover.
<
a
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
target=
"_blank"
rel=
"noopener noreferrer"
href=
"https://nextjs.org/docs/messages/version-staleness"
title=
{
title
}
>
<
EclipseIcon
data
-
nextjs
-
version
-
staleness
-
indicator=
{
indicatorClass
}
/>
<
span
>
{
text
}
</
span
>
</
a
>
)
}
return
(
<
div
data
-
nextjs
-
devtools
-
panel
-
footer
-
tab
title=
{
title
}
>
<
EclipseIcon
data
-
nextjs
-
version
-
staleness
-
indicator=
{
indicatorClass
}
/>
<
span
>
{
text
}
</
span
>
</
div
>
)
}
export
const
DEVTOOLS_PANEL_VERSION_INFO_STYLES
=
css
`
[data-nextjs-version-staleness-indicator='fresh'] {
fill: var(--color-green-800);
stroke: var(--color-green-300);
}
[data-nextjs-version-staleness-indicator='stale'] {
fill: var(--color-amber-800);
stroke: var(--color-amber-300);
}
[data-nextjs-version-staleness-indicator='outdated'] {
fill: var(--color-red-800);
stroke: var(--color-red-300);
}
[data-nextjs-version-staleness-indicator='unknown'] {
fill: var(--color-gray-800);
stroke: var(--color-gray-300);
}
`
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.stories.tsx
deleted
100644 → 0
View file @
5e65f807
import
type
{
Meta
,
StoryObj
}
from
'@storybook/react'
import
type
{
OverlayState
}
from
'../../shared'
import
{
DevToolsPanel
}
from
'./devtools-panel'
import
{
INITIAL_OVERLAY_STATE
}
from
'../../shared'
import
{
withShadowPortal
}
from
'../../storybook/with-shadow-portal'
import
{
runtimeErrors
}
from
'../../storybook/errors'
const
meta
:
Meta
<
typeof
DevToolsPanel
>
=
{
component
:
DevToolsPanel
,
parameters
:
{
layout
:
'centered'
,
},
argTypes
:
{},
decorators
:
[
withShadowPortal
],
}
export
default
meta
type
Story
=
StoryObj
<
typeof
DevToolsPanel
>
const
state
:
OverlayState
=
{
...
INITIAL_OVERLAY_STATE
,
routerType
:
'app'
,
isErrorOverlayOpen
:
false
,
isDevToolsPanelOpen
:
true
,
versionInfo
:
{
installed
:
'15.0.0'
,
expected
:
'15.0.0'
,
staleness
:
'fresh'
,
},
}
export
const
Default
:
Story
=
{
args
:
{
state
,
dispatch
:
()
=>
{},
issueCount
:
0
,
runtimeErrors
:
[],
getSquashedHydrationErrorDetails
:
()
=>
null
,
},
}
export
const
WithIssues
:
Story
=
{
args
:
{
state
,
dispatch
:
()
=>
{},
issueCount
:
runtimeErrors
.
length
,
runtimeErrors
,
getSquashedHydrationErrorDetails
:
()
=>
null
,
},
}
export
const
Turbopack
:
Story
=
{
beforeEach
:
()
=>
{
process
.
env
.
__NEXT_BUNDLER
=
'Turbopack'
// clean up callback function
return
()
=>
{
delete
process
.
env
.
__NEXT_BUNDLER
}
},
args
:
{
state
,
dispatch
:
()
=>
{},
issueCount
:
0
,
runtimeErrors
:
[],
getSquashedHydrationErrorDetails
:
()
=>
null
,
},
}
export
const
Rspack
:
Story
=
{
beforeEach
:
()
=>
{
process
.
env
.
__NEXT_BUNDLER
=
'Rspack'
// clean up callback function
return
()
=>
{
delete
process
.
env
.
__NEXT_BUNDLER
}
},
args
:
{
state
,
dispatch
:
()
=>
{},
issueCount
:
0
,
runtimeErrors
:
[],
getSquashedHydrationErrorDetails
:
()
=>
null
,
},
}
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx
deleted
100644 → 0
View file @
5e65f807
This diff is collapsed.
Click to expand it.
packages/next/src/next-devtools/dev-overlay/components/devtools-panel/hooks/use-session-state.ts
0 → 100644
View file @
ed14cd2f
import
{
useState
,
useEffect
}
from
'react'
export
function
useSessionState
<
T
extends
string
>
(
key
:
string
,
initialValue
:
T
):
[
T
,
(
value
:
T
)
=>
void
]
{
const
[
value
,
setValue
]
=
useState
<
T
>
(()
=>
{
if
(
typeof
window
!==
'undefined'
&&
typeof
sessionStorage
!==
'undefined'
)
{
const
stored
=
sessionStorage
.
getItem
(
key
)
return
(
stored
as
T
)
??
initialValue
}
return
initialValue
})
useEffect
(()
=>
{
if
(
typeof
window
!==
'undefined'
&&
typeof
sessionStorage
!==
'undefined'
)
{
sessionStorage
.
setItem
(
key
,
value
)
}
},
[
key
,
value
])
return
[
value
,
setValue
]
}
packages/next/src/next-devtools/dev-overlay/styles/component-styles.tsx
View file @
ed14cd2f
...
@@ -22,21 +22,10 @@ import { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools
...
@@ -22,21 +22,10 @@ import { DEV_TOOLS_INFO_ROUTE_INFO_STYLES } from '../components/errors/dev-tools
import
{
DEV_TOOLS_INFO_USER_PREFERENCES_STYLES
}
from
'../components/errors/dev-tools-indicator/dev-tools-info/user-preferences'
import
{
DEV_TOOLS_INFO_USER_PREFERENCES_STYLES
}
from
'../components/errors/dev-tools-indicator/dev-tools-info/user-preferences'
import
{
FADER_STYLES
}
from
'../components/fader'
import
{
FADER_STYLES
}
from
'../components/fader'
import
{
RESTART_SERVER_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/restart-server-button'
import
{
RESTART_SERVER_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/restart-server-button'
import
{
DEVTOOLS_PANEL_STYLES
}
from
'../components/devtools-panel/devtools-panel'
import
{
DEVTOOLS_PANEL_FOOTER_STYLES
}
from
'../components/devtools-panel/devtools-panel-footer'
import
{
DEVTOOLS_PANEL_VERSION_INFO_STYLES
}
from
'../components/devtools-panel/devtools-panel-version-info'
import
{
DEVTOOLS_PANEL_TAB_SETTINGS_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/settings-tab'
import
{
CALL_STACK_STYLES
}
from
'../components/call-stack/call-stack'
import
{
CALL_STACK_STYLES
}
from
'../components/call-stack/call-stack'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-sidebar'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_FRAME_SKELETON_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-sidebar-frame-skeleton'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content'
import
{
ISSUE_FEEDBACK_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/issue-feedback-button'
import
{
ISSUE_FEEDBACK_BUTTON_STYLES
}
from
'../components/errors/error-overlay-toolbar/issue-feedback-button'
import
{
ERROR_CONTENT_SKELETON_STYLES
}
from
'../container/runtime-error/error-content-skeleton'
import
{
ERROR_CONTENT_SKELETON_STYLES
}
from
'../container/runtime-error/error-content-skeleton'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_LAYOUT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-content-layout'
import
{
DEVTOOLS_PANEL_TAB_ISSUES_EMPTY_CONTENT_STYLES
}
from
'../components/devtools-panel/devtools-panel-tab/issues-tab/issues-tab-empty-content'
import
{
SHORTCUT_RECORDER_STYLES
}
from
'../components/errors/dev-tools-indicator/dev-tools-info/shortcut-recorder'
import
{
SHORTCUT_RECORDER_STYLES
}
from
'../components/errors/dev-tools-indicator/dev-tools-info/shortcut-recorder'
export
function
ComponentStyles
()
{
export
function
ComponentStyles
()
{
return
(
return
(
<
style
>
<
style
>
...
@@ -65,16 +54,6 @@ export function ComponentStyles() {
...
@@ -65,16 +54,6 @@ export function ComponentStyles() {
${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}
${DEV_TOOLS_INFO_ROUTE_INFO_STYLES}
${DEV_TOOLS_INFO_USER_PREFERENCES_STYLES}
${DEV_TOOLS_INFO_USER_PREFERENCES_STYLES}
${FADER_STYLES}
${FADER_STYLES}
${DEVTOOLS_PANEL_STYLES}
${DEVTOOLS_PANEL_FOOTER_STYLES}
${DEVTOOLS_PANEL_VERSION_INFO_STYLES}
${DEVTOOLS_PANEL_TAB_SETTINGS_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_EMPTY_CONTENT_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_SIDEBAR_FRAME_SKELETON_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_STYLES}
${DEVTOOLS_PANEL_TAB_ISSUES_CONTENT_LAYOUT_STYLES}
${ISSUE_FEEDBACK_BUTTON_STYLES}
${ISSUE_FEEDBACK_BUTTON_STYLES}
${ERROR_CONTENT_SKELETON_STYLES}
${ERROR_CONTENT_SKELETON_STYLES}
${SHORTCUT_RECORDER_STYLES}
${SHORTCUT_RECORDER_STYLES}
...
...
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