2026-10-17 10:49:38 +00:00
< script setup lang = "ts" >
import { gateDrawing , sevenSegment } from '~/lib/draw'
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
import { GRID as G , noteLines , noteScale , PANEL _CONTROL _W , type Shape } from '~/lib/logic/geometry'
2026-10-17 10:49:38 +00:00
import type { CircuitNode } from '~/lib/logic/types'
const props = defineProps < {
node : CircuitNode
shape : Shape
selected : boolean
ghost ? : boolean
2026-10-20 18:09:23 +00:00
/** The pass-through pin of a lamp or output is wired: its label moves out of the wire's way. */
through ? : boolean
2026-10-20 18:15:38 +00:00
/** Name of the pin this part is wired to, shown dimmed while it has no name of its own. */
hint ? : string
2026-10-17 10:49:38 +00:00
} > ( )
const ed = useEditor ( )
const style = computed ( ( ) => ed . project . value . settings . symbols )
const gate = computed ( ( ) => ( props . shape . gate ? gateDrawing ( props . shape , style . value ) : null ) )
const chipDef = computed ( ( ) => ( props . node . chip ? ed . getDef . value ( props . node . chip ) : undefined ) )
const b = computed ( ( ) => props . shape . body )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const rows = computed ( ( ) => props . node . rows ? ? [ ] )
2026-10-20 18:15:38 +00:00
// A name typed by hand shows as is. Otherwise the name of the pin the part is
// wired to, or its automatic name, shows dimmed.
const own = computed ( ( ) => ( props . node . autoLabel ? '' : ( props . node . label ? . trim ( ) ? ? '' ) ) )
const ioText = computed ( ( ) => own . value || props . hint || props . node . label ? . trim ( ) || '' )
const ghosted = computed ( ( ) => ! own . value && ! ! ioText . value )
2026-10-17 10:49:38 +00:00
2026-10-20 17:29:16 +00:00
/** Lines inside a bundle or split from each single wire to the cable pin. */
const cableFan = computed ( ( ) => {
const s = props . shape
const cable = [ ... s . inputs , ... s . outputs ] . find ( p => p . bus )
const singles = [ ... s . inputs , ... s . outputs ] . filter ( p => ! p . bus )
if ( ! cable ) return ''
const cx = props . node . kind === 'bundle' ? 0.75 * G : 0.25 * G
return singles . map ( p => ` M ${ p . dx * G } ${ p . dy * G } L ${ cx } ${ cable . dy * G } ` ) . join ( '' ) + ` M ${ cx } ${ cable . dy * G } L ${ cable . dx * G } ${ cable . dy * G } `
} )
2026-10-17 10:49:38 +00:00
const v = ( pin : string ) => ( props . ghost ? 0 : ed . val ( props . node . id , pin ) )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
/** Value inside this chip, for its lamps and displays. */
const fv = ( inner : string , pin : string ) => ( props . ghost ? 0 : ed . faceVal ( props . node . id , inner , pin ) )
const faceHex = ( inner : string ) => sevenSegment ( [ 0 , 1 , 2 , 3 ] . reduce ( ( n , i ) => n + ( fv ( inner , ` b ${ i } ` ) << i ) , 0 ) )
const FACE _SCALE = 0.6
2026-10-17 10:49:38 +00:00
const hexValue = computed ( ( ) => [ 0 , 1 , 2 , 3 ] . reduce ( ( n , i ) => n + ( v ( ` b ${ i } ` ) << i ) , 0 ) )
const segments = computed ( ( ) => sevenSegment ( hexValue . value ) )
const lit = computed ( ( ) => v ( props . node . kind === 'input' || props . node . kind === 'button' || props . node . kind === 'clock' ? 'q' : 'a' ) === 1 )
const title = computed ( ( ) => {
if ( props . node . kind === 'chip' ) return chipDef . value ? ` ${ chipDef . value . name } ${ chipDef . value . description ? ` : ${ chipDef . value . description } ` : '' } \ nDouble-click to open ` : 'Missing component'
return undefined
} )
< / script >
< template >
< g
: transform = "`translate(${node.x * G} ${node.y * G})`"
: data - node = "node.id"
class = "node"
: class = "{ selected, ghost, [`kind-${node.kind}`]: true }"
>
< title v-if ="title" > {{ title }} < / title >
<!-- Logic gate symbol ( NAND , or a component drawn as a gate ) -- >
< template v-if ="gate" >
< path :d ="gate.stubs" class = "stub" / >
< path :d ="gate.body" class = "body" : class = "{ prim: node.kind === 'nand' }" / >
< path v -if = " gate.extra " :d ="gate.extra" class = "stroke-only" / >
< circle v -if = " gate.bubble " v -bind = " gate.bubble " class = "body" / >
< text v-if ="gate.label" :x="gate.label.x" :y="gate.label.y" class="gate-label" text-anchor="middle" > {{ gate.label.text }} < / text >
< / template >
<!-- Component box -- >
< template v -else -if = " node.kind = = = ' chip ' " >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< text v-if ="node.label" :x="(b.w * G) / 2" :y="b.y * G - 5" text-anchor="middle" class="instance-label" > {{ node.label }} < / text >
2026-10-17 10:49:38 +00:00
< rect :x ="0" : y = "b.y * G" : width = "b.w * G" : height = "b.h * G" rx = "3" class = "body chip" : class = "{ missing: !chipDef }" / >
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
< text : x = "(b.w * G) / 2" : y = "(shape.nameY ?? b.y + b.h / 2) * G + 4" text -anchor = " middle " class = "chip-name" > { { chipDef ? . name ? ? 'Missing' } } < / text >
< template v-for ="f in shape.face" :key="f.id" >
2026-10-20 17:29:16 +00:00
< template v-if ="f.kind === 'screen'" >
< rect : x = "f.x * G - 2" : y = "f.y * G - 2" : width = "f.w * G + 4" : height = "f.h * G + 4" rx = "2" class = "screen-bg" / >
< rect
v - for = "p in f.pixels"
: key = "p.id"
: x = "(f.x + p.col * f.px!) * G"
: y = "(f.y + p.row * f.px!) * G"
: width = "f.px! * G - 0.5"
: height = "f.px! * G - 0.5"
class = "screen-px"
: class = "[p.color ? `px-${p.color}` : '', { on: fv(p.id, 'a') === 1 }]"
/ >
< / template >
< template v -else -if = " f.kind = = = ' lamp ' " >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< circle : cx = "(f.x + f.w / 2) * G" : cy = "(f.y + 0.6) * G" : r = "0.42 * G" class = "lamp" : class = "[f.color ? `l-${f.color}` : '', { on: fv(f.id, 'a') === 1 }]" / >
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
< / template >
< template v-else >
< rect : x = "(f.x + f.w / 2 - 0.62) * G" : y = "f.y * G" : width = "1.24 * G" : height = "2.2 * G" rx = "2" class = "display" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< g : transform = "`translate(${(f.x + f.w / 2) * G - 1.75 * G * FACE_SCALE} ${(f.y + 0.16) * G}) scale(${FACE_SCALE})`" : class = "f.color ? `l-${f.color}` : ''" >
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
< path v -for = " ( s , i ) in faceHex ( f.id ) " :key ="i" :d ="s.d" class = "seg" : class = "{ on: s.on }" / >
< / g >
< / template >
< text v-if ="f.label" :x="(f.x + f.w / 2) * G" :y="(f.y + f.h - 0.15) * G" text-anchor="middle" class="face-label" > {{ f.label }} < / text >
< / template >
2026-10-17 10:49:38 +00:00
< text v-for ="p in shape.inputs" :key="p.key" :x="5" :y="p.dy * G + 3.5" class="pin-label" > {{ p.label }} < / text >
< text v-for ="p in shape.outputs" :key="p.key" :x="b.w * G - 5" :y="p.dy * G + 3.5" text-anchor="end" class="pin-label" > {{ p.label }} < / text >
< / template >
<!-- Switch ( input pin ) -- >
< template v -else -if = " node.kind = = = ' input ' " >
2026-10-20 18:15:38 +00:00
< text :x ="-6" :y ="4" text -anchor = " end " class = "io-label" : class = "{ ghosted }" > { { ioText } } < / text >
2026-10-17 10:49:38 +00:00
< rect x = "0" : y = "-0.6 * G" : width = "2 * G" : height = "1.2 * G" : rx = "0.6 * G" class = "switch" : class = "{ on: lit }" / >
< circle : cx = "lit ? 1.4 * G : 0.6 * G" cy = "0" : r = "0.42 * G" class = "knob" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< text v-if ="node.key" :x="G" :y="1.45 * G" text-anchor="middle" class="key-badge" > {{ node.key.toUpperCase ( ) }} < / text >
2026-10-17 10:49:38 +00:00
< / template >
<!-- Output pin -- >
< template v -else -if = " node.kind = = = ' output ' " >
< path : d = "`M0 0H${0.4 * G}`" class = "stub" / >
< path : d = "`M${0.4 * G} ${-0.6 * G}H${1.5 * G}L${2 * G} 0L${1.5 * G} ${0.6 * G}H${0.4 * G}Z`" class = "terminal" : class = "{ on: lit }" / >
2026-10-20 18:15:38 +00:00
< text : x = "through ? G : 2 * G + 6" : y = "through ? -0.75 * G - 4 : 4" : text -anchor = " through ? ' middle ' : ' start ' " class = "io-label" : class = "{ ghosted }" > { { ioText } } < / text >
2026-10-17 10:49:38 +00:00
< / template >
<!-- Lamp : IEC symbol , circle with a cross -- >
< template v -else -if = " node.kind = = = ' lamp ' " >
< path : d = "`M0 0H${0.35 * G}`" class = "stub" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< circle :cx ="G" cy = "0" : r = "0.65 * G" class = "lamp" : class = "[node.color ? `l-${node.color}` : '', { on: lit }]" / >
2026-10-17 10:49:38 +00:00
< path : d = "`M${G - 0.46 * G} ${-0.46 * G}L${G + 0.46 * G} ${0.46 * G}M${G + 0.46 * G} ${-0.46 * G}L${G - 0.46 * G} ${0.46 * G}`" class = "lamp-cross" : class = "{ on: lit }" / >
2026-10-20 18:15:38 +00:00
< text v-if ="ioText" :x="through ? G : 2 * G + 4" :y="through ? -0.75 * G - 4 : 4" :text-anchor="through ? 'middle' : 'start'" class="io-label" :class="{ ghosted }" > {{ ioText }} < / text >
2026-10-17 10:49:38 +00:00
< / template >
<!-- Constant 1 -- >
< template v -else -if = " node.kind = = = ' high ' " >
< rect x = "0" : y = "-0.6 * G" : width = "1.5 * G" : height = "1.2 * G" rx = "2" class = "body" / >
< text : x = "0.75 * G" y = "4" text -anchor = " middle " class = "const on" > 1 < / text >
< path : d = "`M${1.5 * G} 0H${2 * G}`" class = "stub" / >
< / template >
<!-- Constant 0 : ground symbol -- >
< template v -else -if = " node.kind = = = ' low ' " >
< path : d = "`M${2 * G} 0H${1.1 * G}M${1.1 * G} ${-0.6 * G}V${0.6 * G}M${0.75 * G} ${-0.4 * G}V${0.4 * G}M${0.4 * G} ${-0.2 * G}V${0.2 * G}`" class = "ground" / >
< rect x = "0" : y = "-0.7 * G" : width = "2 * G" : height = "1.4 * G" fill = "transparent" / >
< / template >
<!-- Clock -- >
< template v -else -if = " node.kind = = = ' clock ' " >
< rect x = "0" : y = "-0.7 * G" : width = "2.5 * G" : height = "1.4 * G" rx = "2" class = "body" / >
< path : d = "`M${0.35 * G} ${0.35 * G}H${0.8 * G}V${-0.35 * G}H${1.3 * G}V${0.35 * G}H${1.8 * G}V${-0.35 * G}H${2.15 * G}`" class = "wave" : class = "{ on: lit }" / >
< path : d = "`M${2.5 * G} 0H${3 * G}`" class = "stub" / >
2026-10-20 18:15:38 +00:00
< text : x = "1.25 * G" : y = "1.55 * G" text -anchor = " middle " class = "face-label" : class = "{ ghosted }" > { { ioText || ( node . hz ? ` ${ node . hz } Hz ` : '' ) } } < / text >
2026-10-17 10:49:38 +00:00
< / template >
<!-- Push button -- >
< template v -else -if = " node.kind = = = ' button ' " >
2026-10-20 18:15:38 +00:00
< text v-if ="ioText" :x="-6" :y="4" text-anchor="end" class="io-label" :class="{ ghosted }" > {{ ioText }} < / text >
2026-10-17 10:49:38 +00:00
< rect x = "0" : y = "-0.7 * G" : width = "1.6 * G" : height = "1.4 * G" rx = "3" class = "body" / >
< circle : cx = "0.8 * G" cy = "0" : r = "0.45 * G" class = "button" : class = "{ on: lit }" / >
< path : d = "`M${1.6 * G} 0H${2 * G}`" class = "stub" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< text v-if ="node.key" :x="0.8 * G" :y="1.55 * G" text-anchor="middle" class="key-badge" > {{ node.key.toUpperCase ( ) }} < / text >
2026-10-17 10:49:38 +00:00
< / template >
<!-- Hex display -- >
< template v -else -if = " node.kind = = = ' hex ' " >
< rect x = "0" : y = "b.y * G" : width = "b.w * G" : height = "b.h * G" rx = "3" class = "body display" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< g : class = "node.color ? `l-${node.color}` : ''" >
< path v -for = " ( s , i ) in segments " :key ="i" :d ="s.d" class = "seg" : class = "{ on: s.on }" / >
< / g >
2026-10-17 10:49:38 +00:00
< text v-for ="p in shape.inputs" :key="p.key" :x="4" :y="p.dy * G + 3" class="pin-label tiny" > {{ p.label }} < / text >
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
< text v-if ="node.label" :x="(b.w * G) / 2" :y="(b.y + b.h) * G + 12" text-anchor="middle" class="face-label" > {{ node.label }} < / text >
2026-10-17 10:49:38 +00:00
< / template >
2026-10-20 17:29:16 +00:00
<!-- Cable ends : a bundle gathers wires into one cable , a split fans it out -- >
< template v -else -if = " node.kind = = = ' bundle ' | | node.kind = = = ' split ' " >
< rect :x ="0" : y = "b.y * G" : width = "b.w * G" : height = "b.h * G" rx = "2" class = "body cable-end" / >
< path :d ="cableFan" class = "cable-fan" / >
< / template >
<!-- Pixel : one square of a screen -- >
< template v -else -if = " node.kind = = = ' pixel ' " >
< rect x = "1" : y = "b.y * G + 1" : width = "G - 2" : height = "G - 2" rx = "1" class = "pixel" : class = "[node.color ? `px-${node.color}` : '', { on: v('a') === 1 }]" / >
< / template >
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
<!-- Input panel : a switch , button or clock per row -- >
< template v -else -if = " node.kind = = = ' panel ' " >
< text v-if ="node.label" :x="(b.w * G) / 2" :y="b.y * G - 5" text-anchor="middle" class="instance-label" > {{ node.label }} < / text >
< rect :x ="0" : y = "b.y * G" : width = "b.w * G" : height = "b.h * G" rx = "3" class = "body panel" : class = "{ docked: !!node.attach }" / >
< g v-for ="(p, i) in shape.outputs" :key="p.key" :data-row="p.key" class="panel-row" :transform="`translate(0 ${p.dy * G})`" >
< rect :x ="0" : y = "-0.5 * G" : width = "b.w * G" :height ="G" class = "row-hit" / >
< text :x ="5" y = "3.5" class = "pin-label" : class = "{ named: !!rows[i]?.label || !!rows[i]?.name }" > { { p . label } } < / text >
< g : transform = "`translate(${(b.w - PANEL_CONTROL_W) * G} 0)`" >
< template v-if ="rows[i]?.type === 'button'" >
< rect x = "2" : y = "-0.4 * G" : width = "1.3 * G" : height = "0.8 * G" rx = "2" class = "body" / >
< circle : cx = "2 + 0.65 * G" cy = "0" : r = "0.27 * G" class = "button" : class = "{ on: v(p.key) === 1 }" / >
< / template >
< path
v - else - if = "rows[i]?.type === 'clock'"
: d = "`M2 ${0.25 * G}H${0.4 * G}V${-0.25 * G}H${0.75 * G}V${0.25 * G}H${1.1 * G}V${-0.25 * G}H${1.4 * G}`"
class = "wave"
: class = "{ on: v(p.key) === 1 }"
/ >
< template v-else >
< rect x = "2" : y = "-0.38 * G" : width = "1.3 * G" : height = "0.76 * G" : rx = "0.38 * G" class = "switch" : class = "{ on: v(p.key) === 1 }" / >
< circle : cx = "v(p.key) === 1 ? 2 + 0.92 * G : 2 + 0.38 * G" cy = "0" : r = "0.27 * G" class = "knob" / >
< / template >
< path : d = "`M${1.55 * G} 0H${PANEL_CONTROL_W * G}`" class = "stub" / >
< / g >
< / g >
< / template >
2026-10-17 10:49:38 +00:00
<!-- Note -- >
< template v -else -if = " node.kind = = = ' note ' " >
< rect :x ="-4" : y = "b.y * G" : width = "b.w * G + 8" : height = "b.h * G" rx = "3" class = "note-bg" / >
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
< text
v - for = "(line, i) in noteLines(node)"
: key = "i"
x = "0"
: y = "i * G * noteScale(node) + 4 * noteScale(node)"
class = "note"
: style = "{ fontSize: `${12 * noteScale(node)}px` }"
> { { line } } < / text >
2026-10-17 10:49:38 +00:00
< / template >
< rect
v - if = "selected"
: x = "b.x * G - 4"
: y = "b.y * G - 4"
: width = "b.w * G + 8"
: height = "b.h * G + 8"
rx = "5"
class = "sel-outline"
/ >
< template v-if ="!ghost" >
< g v-for ="p in shape.inputs" :key="`i-${p.key}`" >
< circle : cx = "p.dx * G" : cy = "p.dy * G" r = "7" class = "pin-hit" :data-node ="node.id" :data-pin ="p.key" data -dir = " in " / >
< circle : cx = "p.dx * G" : cy = "p.dy * G" r = "2.6" class = "pin" : class = "{ on: v(p.key) === 1 }" / >
< / g >
< g v-for ="p in shape.outputs" :key="`o-${p.key}`" >
< circle : cx = "p.dx * G" : cy = "p.dy * G" r = "7" class = "pin-hit" :data-node ="node.id" :data-pin ="p.key" data -dir = " out " / >
< circle : cx = "p.dx * G" : cy = "p.dy * G" r = "2.6" class = "pin" : class = "{ on: v(p.key) === 1 }" / >
< / g >
< / template >
< / g >
< / template >