Skip to content

Commit dea79bf

Browse files
committed
feat(custom inspector): node tags
1 parent 1a82058 commit dea79bf

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

packages/api/src/api/api.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ export interface CustomInspectorNode {
4242
id: string
4343
label: string
4444
children?: CustomInspectorNode[]
45+
tags?: CustomInspectorNodeTag[]
46+
}
47+
48+
export interface CustomInspectorNodeTag {
49+
label: string
50+
textColor: number
51+
backgroundColor: number
4552
}
4653

4754
export interface CustomInspectorState {

packages/app-frontend/src/features/inspector/custom/CustomInspectorNode.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ export default {
8585
<span>
8686
{{ node.label }}
8787
</span>
88+
89+
<span
90+
v-for="(tag, index) of node.tags"
91+
:key="index"
92+
:style="{
93+
color: `#${tag.textColor.toString(16).padStart(6, '0')}`,
94+
backgroundColor: `#${tag.backgroundColor.toString(16).padStart(6, '0')}`,
95+
}"
96+
class="tag px-1 rounded-sm ml-2"
97+
>
98+
{{ tag.label }}
99+
</span>
88100
</div>
89101

90102
<div v-if="expanded && node.children">
@@ -97,3 +109,9 @@ export default {
97109
</div>
98110
</div>
99111
</template>
112+
113+
<style lang="postcss" scoped>
114+
.tag {
115+
font-size: 0.65rem;
116+
}
117+
</style>

packages/shell-dev-vue3/src/devtools-plugin/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,19 @@ export default {
6969
children: [
7070
{
7171
id: 'child',
72-
label: `Child ${payload.filter}`
72+
label: `Child ${payload.filter}`,
73+
tags: [
74+
{
75+
label: 'active',
76+
textColor: 0x000000,
77+
backgroundColor: 0xFF984F
78+
},
79+
{
80+
label: 'test',
81+
textColor: 0xffffff,
82+
backgroundColor: 0x000000
83+
}
84+
]
7385
}
7486
]
7587
}

0 commit comments

Comments
 (0)