Ship output

Delegate interaction from one SVG root

Use full-mode semantic datasets without regenerating the schematic for every state change.

sheet
8 / 13
rev
v0.4
sections
2
compiled
2

01 / EventsListen once and mutate state classes

Compile once in full mode, then delegate. One listener on the host resolves event.target.closest('[data-node-id], [data-wire-source], [data-port-id]'), and that is the entire interaction layer. A simulation toggles classes or custom properties on whatever it finds; moving a slider must never recompile the tree. Application state lives outside the SVG — recompiling the same source is deterministic, so the drawing is safe to treat as disposable.

logic:ONE "1" at (80, 130) #blue [type=high]
buffer:T "tri-state" at (300, 130) #cyan [type=tristate]
clock:CLK "enable" at (300, 270) #amber
testpoint:TP "probe" at (530, 130) #purple
load:L "lamp" at (740, 130) #emerald [type=lamp]
ONE.out -> T.in1 #blue [digital line]
CLK.out -> T.enable #amber [digital ortho]
T.out1 -> TP.node #cyan [digital line]
TP.node -> L.in #emerald [digital line]
compiled by @schemd/core → shown in the rail

Source-to-vector mapping uses the compiler's own one-based lines. Do not reparse the language with a browser regex — the response already carries the authoritative source map, and a second parser is simply a second answer waiting to disagree.

02 / AccessibilityKeep pointer and keyboard paths equivalent

Nodes and ports carry stable labels in the generated SVG, but that only covers what the compiler emitted. Anything we add around it is ours to make equivalent: semantic buttons, honest aria-pressed/aria-expanded state, visible focus, and keyboard activation for every path a pointer can take.

prepare:P "|0\rangle" at (80, 130) #blue
rx:R "R_x" at (300, 130) #purple [parameter="\pi/2"]
measure:M "M" at (540, 130) #emerald
P.out -> R.in #blue [quantum line]
R.out -> M.in #purple [quantum line]
compiled by @schemd/core → shown in the rail