Skip to content

Commit

Permalink
feat: components tree panel (#655)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
webfansplz and antfu committed May 10, 2024
1 parent a1ad266 commit 3162269
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 19 deletions.
40 changes: 40 additions & 0 deletions packages/devtools/client/pages/modules/components-tree.vue
@@ -0,0 +1,40 @@
<script setup lang="ts">
import { Components as VueComponents } from '@vue/devtools-applet'
import '@vue/devtools-applet/style.css'
const { connected } = useVueDevToolsState()
const client = useClient()
const openInEditor = useOpenInEditor()
definePageMeta({
icon: 'i-carbon-category',
title: 'Components Tree',
layout: 'full',
show: () => {
const client = useClient()
return () => !!client.value
},
order: 3,
})
function togglePanel(status: boolean) {
if (status)
client.value.devtools.open()
else
client.value.devtools.close()
}
</script>

<template>
<div class="h-full w-full">
<VueComponents
v-if="connected"
@on-inspect-component-start="togglePanel(false)"
@on-inspect-component-end="togglePanel(true)"
@open-in-editor="openInEditor"
/>
<NLoading v-else>
Connecting....
</NLoading>
</div>
</template>
2 changes: 1 addition & 1 deletion packages/devtools/client/pages/modules/imports.vue
Expand Up @@ -5,7 +5,7 @@ import Fuse from 'fuse.js'
definePageMeta({
icon: 'carbon-function',
title: 'Imports',
order: 3,
order: 4,
})
const config = useServerConfig()
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/client/pages/modules/modules.vue
Expand Up @@ -2,7 +2,7 @@
definePageMeta({
icon: 'carbon-3d-mpr-toggle',
title: 'Modules',
order: 4,
order: 5,
})
const installModuleOpen = ref(false)
Expand Down
34 changes: 17 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3162269

Please sign in to comment.