11<script setup lang="ts">
2- import type { CSSProperties } from ' vue'
32import { computed , onMounted , reactive , ref , watchEffect } from ' vue'
3+ import type { CSSProperties } from ' vue'
44import type { NuxtDevtoolsHostClient } from ' ../../../types'
5+ import { settings } from ' ../../settings'
56import { state } from ' ./state'
67import { millisecondToHumanreadable , useEventListener , useScreenSafeArea } from ' ./utils'
78import FrameBox from ' ./FrameBox.vue'
@@ -20,6 +21,12 @@ const panelMargins = reactive({
2021const safeArea = useScreenSafeArea ()
2122
2223const isSafari = navigator .userAgent .includes (' Safari' ) && ! navigator .userAgent .includes (' Chrome' )
24+ let isInit = true
25+
26+ watchEffect (() => {
27+ if (state .value .open )
28+ isInit = false
29+ })
2330
2431watchEffect (() => {
2532 panelMargins .left = safeArea .left .value + 10
@@ -167,6 +174,17 @@ function bringUp() {
167174}
168175
169176const isHidden = computed (() => {
177+ if (state .value .open )
178+ return false
179+ if (settings .ui .showPanel === true )
180+ return false
181+ if (settings .ui .showPanel === false )
182+ return true
183+ // If not explicitly set, hide the panel on first load
184+ return isInit
185+ })
186+
187+ const isMinimized = computed (() => {
170188 if (state .value .minimizePanelInactive < 0 )
171189 return false
172190 if (state .value .minimizePanelInactive === 0 )
@@ -180,18 +198,25 @@ const isHidden = computed(() => {
180198 && state .value .minimizePanelInactive
181199})
182200
183- const anchorStyle = computed (() => ({
184- left: ` ${anchorPos .value .left }px ` ,
185- top: ` ${anchorPos .value .top }px ` ,
186- }))
201+ const anchorStyle = computed (() => {
202+ return {
203+ left: ` ${anchorPos .value .left }px ` ,
204+ top: ` ${anchorPos .value .top }px ` ,
205+ pointerEvents: isHidden .value ? ' none' : ' auto' ,
206+ } as const
207+ })
187208
188209const panelStyle = computed (() => {
189210 const style: any = {
190211 transform: isVertical .value
191- ? ` translate(${isHidden .value ? ` calc(-50% ${state .value .position === ' right' ? ' +' : ' -' } 15px) ` : ' -50%' }, -50%) rotate(90deg) `
192- : ` translate(-50%, ${isHidden .value ? ` calc(-50% ${state .value .position === ' top' ? ' -' : ' +' } 15px) ` : ' -50%' }) ` ,
212+ ? ` translate(${isMinimized .value ? ` calc(-50% ${state .value .position === ' right' ? ' +' : ' -' } 15px) ` : ' -50%' }, -50%) rotate(90deg) `
213+ : ` translate(-50%, ${isMinimized .value ? ` calc(-50% ${state .value .position === ' top' ? ' -' : ' +' } 15px) ` : ' -50%' }) ` ,
193214 }
194215 if (isHidden .value ) {
216+ style .opacity = 0
217+ style .pointerEvents = ' none'
218+ }
219+ if (isMinimized .value ) {
195220 switch (state .value .position ) {
196221 case ' top' :
197222 case ' right' :
@@ -313,11 +338,15 @@ onMounted(() => {
313338 :style =" [anchorStyle, vars]"
314339 :class =" {
315340 'nuxt-devtools-vertical': isVertical,
316- 'nuxt-devtools-hide': isHidden ,
341+ 'nuxt-devtools-hide': isMinimized ,
317342 }"
318343 @mousemove =" bringUp"
319344 >
320- <div v-if =" !isSafari" class =" nuxt-devtools-glowing" :style =" isDragging ? 'opacity: 0.6 !important' : ''" />
345+ <div
346+ v-if =" !isSafari"
347+ class =" nuxt-devtools-glowing"
348+ :style =" isDragging ? 'opacity: 0.6 !important' : ''"
349+ />
321350 <div
322351 ref =" panelEl"
323352 class =" nuxt-devtools-panel"
@@ -460,7 +489,7 @@ onMounted(() => {
460489 user-select : none ;
461490 touch-action : none ;
462491 max-width : 150px ;
463- transition : max-width 0.6s ease , padding 0.5s ease , transform 0.4s ease , all 0.6 s ease ;
492+ transition : all 0.6 s ease , max-width 0.6s ease , padding 0.5s ease , transform 0.4s ease , opacity 0.2 s ease ;
464493}
465494
466495#nuxt-devtools-anchor .nuxt-devtools-hide .nuxt-devtools-panel {
0 commit comments