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">
|
|
|
|
|
import { cableOf } from '~/lib/logic/cables'
|
|
|
|
|
import { WIRE_COLORS } from '~/lib/logic/types'
|
|
|
|
|
|
|
|
|
|
const ed = useEditor()
|
|
|
|
|
const wires = ed.selectedWires
|
|
|
|
|
const wireColor = computed(() => {
|
|
|
|
|
const colors = new Set(wires.value.map(w => w.color ?? ''))
|
|
|
|
|
return colors.size === 1 ? [...colors][0] : null
|
|
|
|
|
})
|
|
|
|
|
const cable = computed(() => (wires.value.length === 1 ? cableOf(ed.def.value, wires.value[0]!) : undefined))
|
2026-10-21 08:39:54 +00:00
|
|
|
/** The selected wire is the cable itself (it leaves a bundle). */
|
|
|
|
|
const isCable = computed(() => wires.value.length === 1 && cable.value?.id === wires.value[0]!.from.node)
|
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>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<section>
|
2026-10-21 08:39:54 +00:00
|
|
|
<h3>{{ isCable ? 'Cable' : wires.length === 1 ? 'Wire' : `${wires.length} wires` }}</h3>
|
|
|
|
|
<p v-if="isCable" class="hint">The colour is the cable's sleeve; each wire inside keeps its own colour. Drag its bundle and split to move where it starts and ends.</p>
|
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 class="field">
|
2026-10-21 08:39:54 +00:00
|
|
|
<span>{{ isCable ? 'Sleeve colour' : 'Colour' }}</span>
|
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 class="swatches">
|
|
|
|
|
<button class="swatch none" :class="{ active: wireColor === '' }" title="Default" @click="ed.setWireColor(undefined)" />
|
|
|
|
|
<button
|
|
|
|
|
v-for="c in WIRE_COLORS"
|
|
|
|
|
:key="c"
|
|
|
|
|
class="swatch"
|
|
|
|
|
:class="[`c-${c}`, { active: wireColor === c }]"
|
|
|
|
|
:title="c"
|
|
|
|
|
@click="ed.setWireColor(c)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="grid grid-cols-2 gap-2">
|
|
|
|
|
<button v-if="wires.length === 1" class="btn" @click="ed.selectNet(wires[0]!.id)"><Icon name="lucide:git-fork" class="size-4" /> Whole signal</button>
|
|
|
|
|
<button class="btn" :disabled="!wires.some(w => w.pts)" @click="ed.autoRoute()"><Icon name="lucide:wand-sparkles" class="size-4" /> Auto route</button>
|
|
|
|
|
</div>
|
2026-10-21 08:39:54 +00:00
|
|
|
<template v-if="wires.length >= 2">
|
2026-10-21 09:21:35 +00:00
|
|
|
<button class="btn btn-primary mt-2 w-full" title="Starts right after the sources, ends right before the targets (Ctrl+G)" @click="ed.bundleSelected()">
|
|
|
|
|
<Icon name="lucide:merge" class="size-4" /> Bundle into cable
|
2026-10-21 08:39:54 +00:00
|
|
|
</button>
|
2026-10-21 09:21:35 +00:00
|
|
|
<button class="btn btn-ghost mt-1 w-full" title="Click where the cable starts, then where it ends (Ctrl+Shift+G)" @click="ed.startCable()">
|
|
|
|
|
Place the ends yourself…
|
2026-10-21 08:39:54 +00:00
|
|
|
</button>
|
|
|
|
|
</template>
|
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
|
|
|
<button v-if="cable" class="btn mt-2 w-full" title="Take the cable apart again into single wires" @click="ed.removeCable(cable.id)">
|
|
|
|
|
<Icon name="lucide:split" class="size-4" /> Remove cable
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn btn-ghost mt-2 w-full" @click="ed.deleteSelected()"><Icon name="lucide:trash-2" class="size-4" /> Delete</button>
|
|
|
|
|
<details class="tips-box">
|
|
|
|
|
<summary>Editing wires</summary>
|
|
|
|
|
<ul class="tips">
|
|
|
|
|
<li><strong>Drag</strong> a segment to move it, a <strong>corner square</strong> to move a bend.</li>
|
|
|
|
|
<li><strong>Alt + drag</strong> pulls a new bend out of a segment.</li>
|
|
|
|
|
<li><strong>Ctrl + drag</strong> starts a new wire from this signal.</li>
|
|
|
|
|
<li><strong>Double-click</strong> selects the whole signal, <strong>Shift + click</strong> adds wires.</li>
|
|
|
|
|
<li><strong>Arrow keys</strong> shift the selected wires.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</details>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|