logigate/app/components/editor/SelectionPanel.vue

25 lines
1006 B
Vue
Raw Normal View History

<script setup lang="ts">
// The panel on the right: only there while something is selected, with its
// settings and what can be done with it (swap, wire up, make a component).
const ed = useEditor()
const single = computed(() =>
ed.selection.value.length === 1 && !ed.wireSel.value.length ? ed.def.value.nodes.find(n => n.id === ed.selection.value[0]) : undefined,
)
</script>
<template>
<aside class="inspector selection-panel">
<div class="sel-panel-head">
<Icon name="lucide:mouse-pointer-2" class="size-4 shrink-0 text-(--accent)" />
<span class="grow">Selection</span>
<button class="icon-btn" title="Deselect (Esc)" @click="ed.selection.value = [], (ed.wireSel.value = [])"><Icon name="lucide:x" class="size-4" /></button>
</div>
<div class="scroll">
<EditorNodeSettings v-if="single" :key="single.id" :node="single" />
<EditorBulkSettings v-else-if="ed.selection.value.length" />
<EditorWireSettings v-else />
</div>
</aside>
</template>