ui i like most
This commit is contained in:
+113
-44
@@ -5,77 +5,146 @@ const emit = defineEmits<{
|
||||
addNode: [nodeType: string]
|
||||
}>()
|
||||
|
||||
const groups = [
|
||||
{ label: 'Sources', types: ['testpattern', 'ndiin', 'decklinkin'] },
|
||||
{ label: 'Sinks', types: ['ndiout', 'decklinkout', 'fakesink'] },
|
||||
interface PaletteGroup {
|
||||
label: string
|
||||
types: string[]
|
||||
}
|
||||
|
||||
const groups: PaletteGroup[] = [
|
||||
{ label: 'SOURCES', types: ['testpattern', 'ndiin', 'decklinkin', 'videoin'] },
|
||||
{ label: 'SINKS', types: ['ndiout', 'decklinkout', 'fakesink'] },
|
||||
]
|
||||
|
||||
const iconMap: Record<string, string> = {
|
||||
testpattern: '▦',
|
||||
ndiin: '◬',
|
||||
decklinkin: '◧',
|
||||
videoin: '▣',
|
||||
ndiout: '◬',
|
||||
decklinkout: '◧',
|
||||
fakesink: '◯',
|
||||
}
|
||||
|
||||
function onDragStart(event: DragEvent, nodeType: string) {
|
||||
if (event.dataTransfer) {
|
||||
event.dataTransfer.setData('application/dmf-node-type', nodeType)
|
||||
event.dataTransfer.effectAllowed = 'copy'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="palette">
|
||||
<div class="palette-title">Nodes</div>
|
||||
<div v-for="group in groups" :key="group.label" class="palette-group">
|
||||
<div class="group-label">{{ group.label }}</div>
|
||||
<button
|
||||
v-for="type in group.types"
|
||||
:key="type"
|
||||
class="palette-btn"
|
||||
@click="emit('addNode', type)"
|
||||
>
|
||||
+ {{ NODE_TYPES[type]?.label ?? type }}
|
||||
</button>
|
||||
<div class="palette-label">NODES</div>
|
||||
<div class="palette-body">
|
||||
<div v-for="group in groups" :key="group.label" class="palette-group">
|
||||
<div class="group-label">{{ group.label }}</div>
|
||||
<div class="group-items">
|
||||
<button
|
||||
v-for="type in group.types"
|
||||
:key="type"
|
||||
class="node-btn"
|
||||
draggable="true"
|
||||
@dragstart="onDragStart($event, type)"
|
||||
@click="emit('addNode', type)"
|
||||
>
|
||||
<span class="node-icon">{{ iconMap[type] ?? '◯' }}</span>
|
||||
<span class="node-name">{{ NODE_TYPES[type]?.label ?? type }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="palette-footer">DRAG OR CLICK TO ADD</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.palette {
|
||||
width: 140px;
|
||||
background: #181825;
|
||||
border-right: 1px solid #313244;
|
||||
width: var(--palette-width);
|
||||
background: var(--bg-panel-0);
|
||||
border-right: 1px solid var(--border-thin);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
overflow-y: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.palette-title {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: #6c7086;
|
||||
letter-spacing: 0.8px;
|
||||
padding: 12px 12px 6px;
|
||||
text-transform: uppercase;
|
||||
.palette-label {
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 var(--sp-4);
|
||||
border-bottom: 1px solid var(--border-thin);
|
||||
font-size: 9px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 3px;
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.palette-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.palette-body::-webkit-scrollbar { width: 3px; }
|
||||
.palette-body::-webkit-scrollbar-track { background: transparent; }
|
||||
.palette-body::-webkit-scrollbar-thumb { background: var(--border-medium); }
|
||||
|
||||
.palette-group {
|
||||
padding: 4px 0 8px;
|
||||
border-bottom: 1px dotted var(--border-thin);
|
||||
}
|
||||
|
||||
.group-label {
|
||||
font-size: 10px;
|
||||
color: #45475a;
|
||||
padding: 4px 12px 2px;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
padding: 10px var(--sp-4) 4px;
|
||||
font-size: 8px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 2px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.palette-btn {
|
||||
display: block;
|
||||
.node-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: none;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
color: #bac2de;
|
||||
padding: 6px var(--sp-4);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 10px;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
transition: background 0.1s, color 0.1s;
|
||||
border-radius: 0;
|
||||
text-align: left;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
|
||||
}
|
||||
|
||||
.palette-btn:hover {
|
||||
background: #2a2b3d;
|
||||
color: #cdd6f4;
|
||||
.node-btn:hover {
|
||||
background: var(--bg-elevated);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
.node-icon {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
width: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.node-btn:hover .node-icon {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.palette-footer {
|
||||
padding: 8px var(--sp-4);
|
||||
border-top: 1px solid var(--border-thin);
|
||||
font-size: 8px;
|
||||
letter-spacing: 2px;
|
||||
color: var(--text-dim);
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user