@@ -14,6 +14,14 @@ export type DevToolsIndicatorPosition =
14
14
| 'top-left'
15
15
| 'top-right'
16
16
17
+ const BASE_SIZE = 16
18
+
19
+ export const NEXT_DEV_TOOLS_SCALE = {
20
+ Small : BASE_SIZE / 14 ,
21
+ Medium : BASE_SIZE / 16 ,
22
+ Large : BASE_SIZE / 18 ,
23
+ }
24
+
17
25
type FastRefreshState =
18
26
/** No refresh in progress. */
19
27
| { type : 'idle' }
@@ -37,6 +45,7 @@ export interface OverlayState {
37
45
isErrorOverlayOpen : boolean
38
46
isDevToolsPanelOpen : boolean
39
47
indicatorPosition : DevToolsIndicatorPosition
48
+ scale : number
40
49
}
41
50
export type OverlayDispatch = React . Dispatch < DispatcherEvent >
42
51
@@ -65,6 +74,7 @@ export const ACTION_DEVTOOLS_PANEL_CLOSE = 'devtools-panel-close'
65
74
export const ACTION_DEVTOOLS_PANEL_TOGGLE = 'devtools-panel-toggle'
66
75
67
76
export const ACTION_DEVTOOLS_INDICATOR_POSITION = 'devtools-indicator-position'
77
+ export const ACTION_DEVTOOLS_SCALE = 'devtools-scale'
68
78
69
79
export const STORAGE_KEY_THEME = '__nextjs-dev-tools-theme'
70
80
export const STORAGE_KEY_POSITION = '__nextjs-dev-tools-position'
@@ -152,6 +162,11 @@ export interface DevToolsIndicatorPositionAction {
152
162
indicatorPosition : DevToolsIndicatorPosition
153
163
}
154
164
165
+ export interface DevToolsScaleAction {
166
+ type : typeof ACTION_DEVTOOLS_SCALE
167
+ scale : number
168
+ }
169
+
155
170
export type DispatcherEvent =
156
171
| BuildOkAction
157
172
| BuildErrorAction
@@ -174,6 +189,7 @@ export type DispatcherEvent =
174
189
| DevToolsPanelCloseAction
175
190
| DevToolsPanelToggleAction
176
191
| DevToolsIndicatorPositionAction
192
+ | DevToolsScaleAction
177
193
178
194
const REACT_ERROR_STACK_BOTTOM_FRAME_REGEX =
179
195
// 1st group: v8
@@ -216,6 +232,10 @@ export const INITIAL_OVERLAY_STATE: Omit<
216
232
indicatorPosition :
217
233
( localStorage . getItem ( STORAGE_KEY_POSITION ) as DevToolsIndicatorPosition ) ??
218
234
'bottom-left' ,
235
+ scale :
236
+ localStorage . getItem ( STORAGE_KEY_SCALE )
237
+ ? Number ( localStorage . getItem ( STORAGE_KEY_SCALE ) )
238
+ : NEXT_DEV_TOOLS_SCALE . Medium ,
219
239
}
220
240
221
241
function getInitialState (
@@ -390,6 +410,9 @@ export function useErrorOverlayReducer(
390
410
case ACTION_DEVTOOLS_INDICATOR_POSITION : {
391
411
return { ...state , indicatorPosition : action . indicatorPosition }
392
412
}
413
+ case ACTION_DEVTOOLS_SCALE : {
414
+ return { ...state , scale : action . scale }
415
+ }
393
416
default : {
394
417
return state
395
418
}
0 commit comments