Skip to content

Commit f04ff0e

Browse files
authored
feat: minimize panel while inspecting component node (#119)
1 parent f329ddb commit f04ff0e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/client/src/pages/components.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup lang="ts">
2-
import { useDevToolsBridgeRpc, useDevToolsState } from '@vue/devtools-core'
2+
import { useDevToolsBridge, useDevToolsBridgeRpc, useDevToolsState } from '@vue/devtools-core'
33
44
import type { ComponentBoundingRect, ComponentTreeNode, InspectorState } from '@vue/devtools-kit'
55
import { VueIcon, VueInput, VTooltip as vTooltip } from '@vue/devtools-ui'
66
import { Pane, Splitpanes } from 'splitpanes'
77
88
const bridgeRpc = useDevToolsBridgeRpc()
9+
const bridge = useDevToolsBridge()
910
const treeNode = ref<ComponentTreeNode[]>([])
1011
const activeComponentId = ref('')
1112
@@ -121,13 +122,16 @@ function scrollToComponent(id: string) {
121122
}
122123
123124
function inspectComponentInspector() {
125+
bridge.value.emit('toggle-panel', false)
124126
bridgeRpc.inspectComponentInspector().then(({ data }) => {
125127
selectedComponentTree.value = data.id
126128
selectComponentTree(data.id)
127129
const linkedList = componentTreeLinkedList.value[data.id]
128130
linkedList.forEach((id) => {
129131
componentTreeCollapseMap.value[id] = true
130132
})
133+
}).finally(() => {
134+
bridge.value.emit('toggle-panel', true)
131135
})
132136
}
133137

packages/overlay/src/composables/panel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function usePanelVisible() {
1515
},
1616
})
1717

18-
const toggleVisible = () => {
19-
visible.value = !visible.value
18+
const toggleVisible = (_: unknown, state?: boolean) => {
19+
visible.value = state ?? !visible.value
2020
}
2121

2222
const closePanel = () => {

0 commit comments

Comments
 (0)