Skip to content

Commit dce3294

Browse files
committed
feat: plugins page
1 parent 53affa0 commit dce3294

22 files changed

Lines changed: 2025 additions & 23 deletions

packages/vite/src/app/app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ useSideNav(() => {
2727
icon: 'i-ph-graph-duotone',
2828
to: '/graph',
2929
},
30+
{
31+
title: 'Plugins',
32+
icon: 'i-ph-plugs-duotone',
33+
to: '/plugins',
34+
},
3035
]
3136
})
3237
</script>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script setup lang="ts" generic="T extends { id: string; text?: string; parent?: T }">
2+
import type { GraphBaseOptions } from 'nanovis'
3+
import { computed } from 'vue'
4+
5+
const props = defineProps<{
6+
selected?: T
7+
options: GraphBaseOptions<any>
8+
}>()
9+
10+
const emit = defineEmits<{
11+
(e: 'select', node: T | null): void
12+
}>()
13+
14+
const parentStack = computed(() => {
15+
const stack: T[] = []
16+
let current = props.selected
17+
while (current) {
18+
stack.unshift(current)
19+
current = current.parent
20+
}
21+
return stack
22+
})
23+
</script>
24+
25+
<template>
26+
<div flex="~ gap-1 items-center wrap">
27+
<template v-for="node, idx of parentStack" :key="node.id">
28+
<div v-if="idx > 0" i-ph-arrow-right-bold text-sm op-fade />
29+
<button
30+
hover="bg-active" rounded px1
31+
@click="emit('select', node)"
32+
>
33+
<span>{{ node.text || node.id }}</span>
34+
</button>
35+
</template>
36+
</div>
37+
</template>

0 commit comments

Comments
 (0)