Skip to content

Commit 897ce82

Browse files
authored
fix(core): auto-close dock overflow panel when dock minimizes (#338)
1 parent 82e50a5 commit 897ce82

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/core/src/client/webcomponents/components/dock/Dock.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script setup lang="ts">
22
import type { DocksContext } from '@vitejs/devtools-kit/client'
3-
import { useEventListener, useScreenSafeArea } from '@vueuse/core'
3+
import { useEventListener, useScreenSafeArea, whenever } from '@vueuse/core'
44
import { computed, onMounted, reactive, ref, useTemplateRef, watchEffect } from 'vue'
55
import { BUILTIN_ENTRY_CLIENT_AUTH_NOTICE } from '../../constants'
66
import { docksSplitGroupsWithCapacity } from '../../state/dock-settings'
7+
import { setDocksOverflowPanel } from '../../state/floating-tooltip'
78
import BracketLeft from '../icons/BracketLeft.vue'
89
import BracketRight from '../icons/BracketRight.vue'
910
import VitePlusCore from '../icons/VitePlusCore.vue'
@@ -245,6 +246,10 @@ const panelStyle = computed(() => {
245246
return style
246247
})
247248
249+
whenever(isMinimized, () => {
250+
setDocksOverflowPanel(null)
251+
})
252+
248253
onMounted(() => {
249254
if (context.panel.store.open && !isRpcTrusted.value)
250255
context.panel.store.open = false
@@ -344,6 +349,7 @@ onMounted(() => {
344349
:groups="splitEntries.overflow"
345350
:selected="selectedEntry"
346351
@select="(e) => context.docks.switchEntry(e?.id)"
352+
@activity="bringUp"
347353
/>
348354
</template>
349355
</div>

packages/core/src/client/webcomponents/components/dock/DockOverflowButton.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const props = defineProps<{
1717
1818
const emit = defineEmits<{
1919
(e: 'select', entry: DevToolsDockEntry): void
20+
(e: 'activity'): void
2021
}>()
2122
2223
const overflowButton = useTemplateRef<HTMLButtonElement>('overflowButton')
@@ -37,6 +38,7 @@ function showOverflowPanel() {
3738
setDocksOverflowPanel({
3839
content: () => h('div', {
3940
class: 'flex gap-0 flex-wrap max-w-220px',
41+
onMousemove: () => emit('activity'),
4042
}, [
4143
h(DockEntriesWithCategories, {
4244
context: props.context,

0 commit comments

Comments
 (0)