feat: arrowhead endpoints for edges + fix parallel edges not rendering

Add optional filled-triangle arrowheads at either end of an edge,
independently toggleable per edge (EdgeModal) and as per-edge-type
defaults (CustomStyleModal). Arrowheads are custom inline <marker> defs
filled with the live stroke colour so they recolour reactively with
custom_color / vlan / selected state. Persisted frontend (serializer)
and backend (edge columns + schemas + runtime migration).

Also fix two dedupe layers that silently dropped legitimate parallel
links between the same two devices:
- store: React Flow addEdge() connectionExists dropped a second edge
  with matching source+target when handles were null/equal. Build the
  edge with a unique id and append directly.
- render: rewireEdgesForCollapse deduped ALL edges by src->tgt key even
  when nothing was collapsed, filtering real parallel edges out of the
  visible set. Restrict the anti-mesh dedupe to rewired collapse stubs.

Tests: marker render, per-edge/per-type UI, store apply, serializer
round-trip, backend edge/canvas persistence, parallel-edge regressions.

ha-relevant: yes
This commit is contained in:
Pouzor
2026-07-05 01:16:26 +02:00
parent ae2d3e1eab
commit 1cf525844b
20 changed files with 371 additions and 14 deletions
@@ -64,6 +64,8 @@ function defaultEdgeStyle(edgeType: EdgeType): EdgeTypeStyle {
opacity: 1,
pathStyle: 'bezier',
animated: 'none',
arrowStart: false,
arrowEnd: false,
}
}
@@ -279,6 +281,28 @@ function EdgeEditor({ edgeType, style, onChange, onApplyToExisting }: EdgeEditor
<option value="snake">Snake</option>
</select>
</div>
<div>
<div className="text-xs text-[#8b949e] mb-2">Arrows</div>
<div className="flex gap-2">
{([['Start', 'arrowStart'], ['End', 'arrowEnd']] as [string, 'arrowStart' | 'arrowEnd'][]).map(([label, key]) => (
<button
key={key}
type="button"
onClick={() => set(key, !style[key])}
aria-pressed={style[key]}
className="px-3 py-1 text-xs rounded border transition-colors"
style={{
borderColor: style[key] ? '#00d4ff' : '#30363d',
background: style[key] ? '#00d4ff22' : 'transparent',
color: style[key] ? '#00d4ff' : '#8b949e',
}}
>
{label}
</button>
))}
</div>
</div>
</div>
<Button