Skip to content

Commit

Permalink
feat: minimize panel while inspecting component node (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz authored Dec 30, 2023
1 parent f329ddb commit f04ff0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/client/src/pages/components.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import { useDevToolsBridgeRpc, useDevToolsState } from '@vue/devtools-core'
import { useDevToolsBridge, useDevToolsBridgeRpc, useDevToolsState } from '@vue/devtools-core'
import type { ComponentBoundingRect, ComponentTreeNode, InspectorState } from '@vue/devtools-kit'
import { VueIcon, VueInput, VTooltip as vTooltip } from '@vue/devtools-ui'
import { Pane, Splitpanes } from 'splitpanes'
const bridgeRpc = useDevToolsBridgeRpc()
const bridge = useDevToolsBridge()
const treeNode = ref<ComponentTreeNode[]>([])
const activeComponentId = ref('')
Expand Down Expand Up @@ -121,13 +122,16 @@ function scrollToComponent(id: string) {
}
function inspectComponentInspector() {
bridge.value.emit('toggle-panel', false)
bridgeRpc.inspectComponentInspector().then(({ data }) => {
selectedComponentTree.value = data.id
selectComponentTree(data.id)
const linkedList = componentTreeLinkedList.value[data.id]
linkedList.forEach((id) => {
componentTreeCollapseMap.value[id] = true
})
}).finally(() => {
bridge.value.emit('toggle-panel', true)
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/overlay/src/composables/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function usePanelVisible() {
},
})

const toggleVisible = () => {
visible.value = !visible.value
const toggleVisible = (_: unknown, state?: boolean) => {
visible.value = state ?? !visible.value
}

const closePanel = () => {
Expand Down

0 comments on commit f04ff0e

Please sign in to comment.