A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
< script setup lang = "ts" >
// Every input and output of the open circuit in one list, to rename them
2026-10-21 08:09:43 +00:00
// quickly (type a name, Enter goes to the next) and to try them out.
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
import { duplicateNames , entryLabel , ioList , numberedNames , type IoEntry } from '~/lib/logic/bulk'
2026-10-21 08:09:43 +00:00
import type { CircuitNode } from '~/lib/logic/types'
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
const ed = useEditor ( )
const io = computed ( ( ) => ioList ( ed . def . value ) )
const groups = computed ( ( ) => [
{ id : 'in' as const , title : 'Inputs' , entries : io . value . inputs , dup : duplicateNames ( io . value . inputs ) } ,
{ id : 'out' as const , title : 'Outputs' , entries : io . value . outputs , dup : duplicateNames ( io . value . outputs ) } ,
] )
const selected = computed ( ( ) => new Set ( ed . selection . value ) )
2026-10-21 08:09:43 +00:00
type Block = { panel : CircuitNode ; items : { e : IoEntry ; i : number } [ ] } | { e : IoEntry ; i : number }
/** Rows of one panel are framed together under the panel's name. */
function blocks ( entries : IoEntry [ ] ) : Block [ ] {
const out : Block [ ] = [ ]
entries . forEach ( ( e , i ) => {
const last = out [ out . length - 1 ]
if ( e . row && last && 'panel' in last && last . panel . id === e . node . id ) last . items . push ( { e , i } )
else if ( e . row ) out . push ( { panel : e . node , items : [ { e , i } ] } )
else out . push ( { e , i } )
} )
return out
}
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
const keyOf = ( e : IoEntry ) => ( e . row ? ` ${ e . node . id } / ${ e . row . id } ` : e . node . id )
2026-10-21 08:09:43 +00:00
function pinNumber ( e : IoEntry , entries : IoEntry [ ] ) {
return entries . filter ( x => x . pin ) . indexOf ( e ) + 1
}
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
function kindText ( e : IoEntry , entries : IoEntry [ ] ) : string {
BF input panels are component inputs, cable ends plug in more reliably; A merge panels, hex pass-through, design a component's box
- Inside a component, the switch and button rows of its input panels are now input pins (in order with the other inputs, named after the rows); "Rows are component inputs" can be turned off per panel to keep the old fixed switches
- Select input panels, Merge: one panel with all rows, spacing and wires kept; circuits that place this one keep their wires
- Cable ends plug in more often: bundling orders the wires by the part a side runs to, an end with only some wires on a part still plugs, an end placed by hand next to the pins plugs, and dragging an end near its part shows green rings and plugs it on drop
- Hex displays pass their four bits on (outputs on the right), so they can sit in the middle of a bus
- Design the box: move lamps, displays, the screen and the name on a component's box, draw lines, boxes, circles and text in six colours, size it, leave things off; every placed copy shows it
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 11:49:29 +00:00
if ( e . row && e . pin ) return ` pin ${ pinNumber ( e , entries ) } · ${ e . row . type } `
2026-10-21 08:09:43 +00:00
if ( e . row ) return e . row . type === 'clock' && e . row . hz ? ` clock ${ e . row . hz } Hz ` : e . row . type
if ( e . pin ) return ` pin ${ pinNumber ( e , entries ) } `
if ( e . node . kind === 'clock' ) return e . node . hz ? ` clock ${ e . node . hz } Hz ` : 'clock'
return { button : 'button' , lamp : 'lamp' , hex : 'display' } [ e . node . kind as string ] ? ? e . node . kind
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
}
function placeholder ( e : IoEntry , entries : IoEntry [ ] ) : string {
if ( e . row ) return e . row . name ? . trim ( ) || 'no name'
2026-10-21 08:09:43 +00:00
if ( e . pin ) return ` ${ e . node . kind === 'input' ? 'in' : 'out' } ${ pinNumber ( e , entries ) } `
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
return 'no name'
}
const list = ref < HTMLElement > ( )
2026-10-21 08:09:43 +00:00
function next ( ev : KeyboardEvent , group : string , i : number ) {
; ( ev . target as HTMLInputElement ) . blur ( )
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
const el = list . value ? . querySelector < HTMLInputElement > ( ` input[data-group=" ${ group } "][data-i=" ${ i + 1 } "] ` )
el ? . focus ( )
el ? . select ( )
}
2026-10-21 08:09:43 +00:00
// Numbering a whole side.
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
const numbering = ref < null | ' in ' | ' out ' > ( null )
const pattern = ref ( 'D#' )
const start = ref ( 0 )
const pinsOnly = ref ( true )
const targets = computed ( ( ) => {
const g = groups . value . find ( x => x . id === numbering . value )
return g ? g . entries . filter ( e => ! pinsOnly . value || e . pin ) : [ ]
} )
const preview = computed ( ( ) => numberedNames ( pattern . value , targets . value . length , start . value ) )
function openNumbering ( id : 'in' | 'out' ) {
numbering . value = numbering . value === id ? null : id
pattern . value = id === 'in' ? 'D#' : 'Q#'
pinsOnly . value = groups . value . find ( x => x . id === id ) ! . entries . some ( e => e . pin )
}
function applyNumbering ( ) {
targets . value . forEach ( ( e , i ) => {
const name = preview . value [ i ] !
if ( e . row ) e . row . label = name
else {
e . node . label = name
delete e . node . autoLabel
}
} )
ed . commit ( )
numbering . value = null
}
< / script >
< template >
< div ref = "list" >
2026-10-21 08:09:43 +00:00
< section v-for ="g in groups" :key="g.id" class="io-section" >
< div class = "io-head" >
< h3 >
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
{ { g . title } } < span class = "count-pill" > { { g . entries . length } } < / span >
< / h3 >
< button v-if ="g.entries.length > 1" class="btn-sm" title="Name them all with a numbered pattern" @click="openNumbering(g.id)" >
< Icon name = "lucide:list-ordered" class = "size-3.5" / > Number all
< / button >
< / div >
< form v-if ="numbering === g.id" class="numbering" @submit.prevent="applyNumbering" >
< div class = "grid grid-cols-[1fr_5rem] gap-2" >
< label class = "field mb-0" >
< span > Pattern ( # is the number ) < / span >
< input v -model = " pattern " autofocus / >
< / label >
< label class = "field mb-0" >
< span > From < / span >
< input v -model .number = " start " type = "number" min = "0" / >
< / label >
< / div >
< label v-if ="g.entries.some(e => !e.pin) && g.entries.some(e => e.pin)" class="check mt-2" >
< input v -model = " pinsOnly " type = "checkbox" / > Only the pins ( top to bottom )
< / label >
< p class = "hint mt-1" > { { preview . slice ( 0 , 6 ) . join ( ', ' ) } } < template v-if ="preview.length > 6" > , … < / template > < / p >
< div class = "flex gap-2" >
< button class = "btn btn-primary grow" type = "submit" :disabled ="!targets.length" > Rename { { targets . length } } < / button >
< button class = "btn" type = "button" @ click = "numbering = null" > Cancel < / button >
< / div >
< / form >
< p v-if ="!g.entries.length" class="hint" >
{ { g . id === 'in' ? 'No inputs yet. Place an input switch (I) to give this circuit an input pin.' : 'No outputs yet. Place an output pin (O) or a lamp (L).' } }
< / p >
2026-10-21 08:09:43 +00:00
< div v -else class = "io-list" >
< template v-for ="b in blocks(g.entries)" :key="'panel' in b ? `p-${b.panel.id}` : keyOf(b.e)" >
< div v-if ="'panel' in b" class="io-group" :class="{ selected: selected.has(b.panel.id) }" >
< div class = "io-group-head" >
< Icon name = "lucide:sliders-vertical" class = "size-3.5 shrink-0" / >
< span class = "grow truncate" > { { b . panel . label ? . trim ( ) || 'Input panel' } } < / span >
< button class = "icon-btn io-locate" title = "Show on the canvas" @click ="ed.focusNode(b.panel.id)" > < Icon name = "lucide:locate-fixed" class = "size-3.5" / > < / button >
< / div >
< EditorPinRow
v - for = "it in b.items"
: key = "keyOf(it.e)"
: e = "it.e"
: group = "g.id"
: index = "it.i"
: kind = "kindText(it.e, g.entries)"
: placeholder = "placeholder(it.e, g.entries)"
: dup = "g.dup.has(entryLabel(it.e).toLowerCase())"
: selected = "false"
@ next = "next($event, g.id, it.i)"
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
/ >
< / div >
2026-10-21 08:09:43 +00:00
< EditorPinRow
v - else
: e = "b.e"
: group = "g.id"
: index = "b.i"
: kind = "kindText(b.e, g.entries)"
: placeholder = "placeholder(b.e, g.entries)"
: dup = "g.dup.has(entryLabel(b.e).toLowerCase())"
: selected = "selected.has(b.e.node.id)"
@ next = "next($event, g.id, b.i)"
/ >
< / template >
< / div >
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
< / section >
< section >
< p class = "hint" >
2026-10-21 08:09:43 +00:00
Pins are what the circuit shows when you use it as a component , top to bottom . Click a value to flip a switch ( hold a button ) .
Type a name and press Enter for the next one .
A right panel in tabs, Pins list, bulk editing, transistor breakdown, Settings dialog
- Right panel tabs: Selection, Circuit, Pins, Test. Display and sound
preferences move to a Settings dialog (gear in the top bar).
- Pins tab: every input and output in pin order with live values; rename in
place (Enter goes to the next), number a whole side from a pattern, flag
duplicate names, centre the canvas on a part.
- Several selected parts: narrow by type, swap all, rename all from a
pattern, set switches to 0/1 or flip, shared colour/frequency/size, align
and spread.
- Transistors on every part (NAND 4, switches and lamps 0), NAND 4T in the
palette, and a per-part breakdown of the circuit. Test: the count equals
4 x the gates the simulator builds, for every example and wide gate.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 07:29:55 +00:00
< / p >
< / section >
< / div >
< / template >