11<script setup lang="ts">
22import { VueButton , VueCard , VueDropdown , vTooltip } from ' @vue/devtools-ui'
33import { CustomTab } from ' @vue/devtools-kit'
4+ import { CustomInspector as CustomInspectorComponent } from ' @vue/devtools-applet'
45import { ModuleBuiltinTab } from ' ~/types'
56
67function close() {
@@ -13,6 +14,7 @@ const router = useRouter()
1314const route = useRoute ()
1415const PageComponent = shallowRef ()
1516const customTabName = ref <string | null >(null )
17+ const customTabType = ref <' custom-tab' | ' custom-inspector' | null >(null )
1618
1719function isMatchedWithRoute(tab ? : typeof flattenedTabs [' value' ][number ]) {
1820 const routeTabName = getRouteTabName ()
@@ -31,11 +33,16 @@ const mainViewName = computed(() =>
3133)
3234
3335function getRouteTabName() {
34- return route .path .startsWith (` /${CUSTOM_TAB_VIEW }/ ` )
35- ? route .path .slice (CUSTOM_TAB_VIEW .length + 2 )
36- : route .path .startsWith (' /' )
37- ? route .path .slice (1 )
38- : route .path
36+ if (route .path .startsWith (` /${CUSTOM_TAB_VIEW }/ ` )) {
37+ return route .path .slice (CUSTOM_TAB_VIEW .length + 2 )
38+ }
39+ if (route .path .startsWith (` /${CUSTOM_INSPECTOR_TAB_VIEW }/ ` )) {
40+ return route .path .slice (CUSTOM_INSPECTOR_TAB_VIEW .length + 2 )
41+ }
42+ if (route .path .startsWith (' /' )) {
43+ return route .path .slice (1 )
44+ }
45+ return route .path
3946}
4047
4148watch (
@@ -46,6 +53,12 @@ watch(
4653 // check if is a custom tab
4754 if ((tab as CustomTab ).view ) {
4855 customTabName .value = tab .name
56+ customTabType .value = ' custom-tab'
57+ return
58+ }
59+ if ((tab as ModuleBuiltinTab ).path .startsWith (CUSTOM_INSPECTOR_TAB_VIEW )) {
60+ customTabName .value = tab .name
61+ customTabType .value = ' custom-inspector'
4962 return
5063 }
5164 customTabName .value = null
@@ -93,7 +106,10 @@ const showGridPanel = ref(false)
93106 <div i-carbon:side-panel-open />
94107 </button >
95108 </div >
96- <CustomTabComponent v-if =" customTabName && currentTab" :tab =" currentTab as CustomTab" class =" h-[calc(100%-50px)]" iframe-inline of-auto />
109+ <template v-if =" customTabName && currentTab " >
110+ <CustomTabComponent v-if =" customTabType === 'custom-tab'" :tab =" currentTab as CustomTab" class =" h-[calc(100%-50px)]" iframe-inline of-auto />
111+ <CustomInspectorComponent v-else :id =" customTabName" />
112+ </template >
97113 <div v-else-if =" PageComponent && currentTab" of-auto class =" h-[calc(100%-50px)]" >
98114 <component :is =" PageComponent" :key =" `tab-${currentTab.name}`" />
99115 </div >
0 commit comments