From f1b72b3e3c1752b536aa74a4e9b909fd8560a5a5 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 21 Oct 2026 10:09:43 +0200 Subject: [PATCH] BF pin names editable again, A dense Pins list with toggles and panel groups, wire many at once, folding side panels, full zoom-out - Pins list rows used the class "pin", which the canvas styles as unclickable: renaming and focusing pins did nothing. Renamed the class. - One line per entry; click the value to flip a switch, hold for a button; panel rows framed under their panel. - Drag one wire from a selected part to another part: all selected parts connect to its next pins in order; "Wire them all to" in the bulk panel. - Both side panels fold to an icon strip ([ and ]), remembered per browser. - Zoom out until the whole circuit fits (further for bigger circuits); grid dots hide when they would be too dense. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 4 +- app/assets/css/main.css | 175 +++++++++++++++++++++---- app/components/editor/App.vue | 8 +- app/components/editor/BulkSettings.vue | 38 +++++- app/components/editor/Canvas.vue | 29 +++- app/components/editor/Inspector.vue | 3 + app/components/editor/Palette.vue | 3 + app/components/editor/PinRow.vue | 65 +++++++++ app/components/editor/PinsPane.vue | 116 +++++++++------- app/components/editor/Rail.vue | 34 +++++ app/composables/useEditor.ts | 58 +++++++- app/lib/logic/bulk.ts | 47 ++++++- tests/bulk.test.ts | 60 ++++++++- 13 files changed, 546 insertions(+), 94 deletions(-) create mode 100644 app/components/editor/PinRow.vue create mode 100644 app/components/editor/Rail.vue diff --git a/README.md b/README.md index ec54074..42bdef8 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,9 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n - Automatic names: copies continue a series (D0 copied gives D1, D2; A gives B), and so does placing a new input or output after a numbered one. A switch, button, lamp or output pin without a name of its own (or with an automatic one) takes the name of the component pin it gets wired to, made unique (Cin, Cin2); a name typed by hand is kept. On the canvas, a switch, button, clock, lamp or output pin without a name typed by hand shows the name of the component pin it is wired to, dimmed and in italics (or its automatic name, also dimmed); the name follows the wiring as it changes. - Every circuit is a component. Its input and output nodes become its pins, ordered top to bottom. Double-click a component to open it. - Lamps and hex displays inside a component show on its box, with their labels, lit by that instance's state. They are laid out in rows the way they sit inside. A checkbox in the inspector turns this off per component. -- The right panel has four tabs. **Selection**: settings of what you clicked (switches to it when you select something on an idle panel). **Circuit**: name, symbol, group, statistics, and where the transistors are (each kind of part with its count; click a line to select those parts). **Pins**: every input and output of the circuit in pin order with its live value; rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. **Test**: the challenge or puzzle check and the truth table (opens by itself for a challenge). Display and sound preferences are in Settings (gear in the top bar). +- The right panel has four tabs. **Selection**: settings of what you clicked (switches to it when you select something on an idle panel). **Circuit**: name, symbol, group, statistics, and where the transistors are (each kind of part with its count; click a line to select those parts). **Pins**: every input and output of the circuit in pin order, one line each, with its live value (click it to flip a switch, hold it for a button; panel rows are framed under their panel); rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. **Test**: the challenge or puzzle check and the truth table (opens by itself for a challenge). Display and sound preferences are in Settings (gear in the top bar). Both side panels fold away to a strip of icons (the panel icon in their tab row, or [ and ]). +- Wiring many at once: select several parts and drag one wire from one of them to a pin of another part; the others follow onto that part's next pins, in position order (or use "Wire them all to" in the panel). +- Zooming out goes at least far enough to see the whole circuit, further for bigger circuits. - Several selected parts are edited together: chips to narrow the selection by type, swap them all for another part, rename all top to bottom from a pattern, set every switch to 0 or 1 or flip each, one colour, one clock frequency or note size for all, line them up or spread them evenly, plus make component, connect one by one, unlink, duplicate, delete. - Transistors: every part shows its count (4 for a NAND, 0 for switches, lamps and cables, the whole inside for a component; the NAND in the palette shows 4T). The count is 4 per CMOS NAND gate the simulator builds, at every depth; a test checks this against the flattened circuit for every example and every wide gate. - Clicking anything opens its settings on the right. Parts can be swapped in place (wires stay on the pins in the same position): NAND and components with each other, switch/button/clock/constants with each other, output/lamp/display with each other. Clocks have their own frequency or follow the top bar. Switches and buttons can get a keyboard key. Lamps and displays have colours, notes have sizes, components a name on the canvas. Components can be unpacked into their parts or given their own copy of the definition; any part can have all its wires unlinked. diff --git a/app/assets/css/main.css b/app/assets/css/main.css index ba13de4..2bf47d4 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -62,11 +62,21 @@ kbd { } .workspace { + --left: 236px; + --right: 300px; display: grid; - grid-template-columns: 236px 1fr 300px; + grid-template-columns: var(--left) 1fr var(--right); min-height: 0; } +.workspace.no-left { + --left: 36px !important; +} + +.workspace.no-right { + --right: 36px !important; +} + .stage { position: relative; min-width: 0; @@ -99,7 +109,8 @@ kbd { @media (max-width: 1100px) { .workspace { - grid-template-columns: 210px 1fr 260px; + --left: 210px; + --right: 260px; } } @@ -1914,25 +1925,44 @@ kbd { letter-spacing: 0; } -.io-list { - display: grid; - gap: 2px; +.io-section { + padding-top: 10px !important; + padding-bottom: 10px !important; } -.io-list li { +.io-head { display: flex; align-items: center; gap: 8px; - padding: 3px 4px; - border-radius: 6px; + margin-bottom: 6px; +} + +.io-head h3 { + flex: 1; + margin: 0 !important; +} + +.io-list { + display: grid; + gap: 1px; +} + +.io-row { + display: grid; + grid-template-columns: 20px minmax(0, 1fr) auto 22px; + align-items: center; + gap: 6px; + height: 26px; + padding: 0 2px; + border-radius: 5px; border: 1px solid transparent; } -.io-list li:hover { +.io-row:hover { background: var(--panel-2); } -.io-list li.selected { +.io-row.selected { border-color: rgb(76 194 255 / 0.5); background: rgb(76 194 255 / 0.07); } @@ -1941,14 +1971,23 @@ kbd { display: grid; place-items: center; width: 20px; - height: 20px; - flex-shrink: 0; - border-radius: 5px; + height: 18px; + border-radius: 4px; background: var(--panel-2); color: var(--muted); font-family: var(--font-mono); font-size: 11px; font-weight: 700; + cursor: default; +} + +.io-value.live { + cursor: pointer; + outline: 1px solid var(--border); +} + +.io-value.live:hover { + outline-color: var(--accent); } .io-value.on { @@ -1956,22 +1995,17 @@ kbd { color: var(--on); } -.io-main { - display: grid; - min-width: 0; - flex: 1; -} - .io-name { width: 100%; min-width: 0; - padding: 3px 6px; + height: 22px; + padding: 0 5px; border: 1px solid transparent; - border-radius: 5px; + border-radius: 4px; background: transparent; color: var(--text); font-family: var(--font-mono); - font-size: 13px; + font-size: 12.5px; font-weight: 600; outline: none; } @@ -1994,16 +2028,51 @@ kbd { .io-kind { display: flex; align-items: center; - gap: 4px; - padding-left: 7px; + gap: 3px; font-size: 10.5px; color: var(--muted); + white-space: nowrap; } -.io-list li.dup .io-kind { +.io-row.dup .io-kind { color: var(--lamp); } +.io-locate { + width: 22px !important; + height: 22px !important; + opacity: 0; +} + +.io-row:hover .io-locate, +.io-group-head:hover .io-locate, +.io-locate:focus-visible { + opacity: 1; +} + +.io-group { + margin: 3px 0; + padding: 0 3px 3px; + border: 1px solid var(--border); + border-radius: 7px; +} + +.io-group.selected { + border-color: rgb(76 194 255 / 0.6); + background: rgb(76 194 255 / 0.05); +} + +.io-group-head { + display: flex; + align-items: center; + gap: 6px; + height: 24px; + padding: 0 2px 0 5px; + font-size: 11px; + font-weight: 600; + color: var(--muted); +} + .numbering { margin: 4px 0 12px; padding: 10px; @@ -2087,3 +2156,59 @@ kbd { margin-top: -4px; margin-bottom: 12px; } + +/* ── Collapsible side panels ────────────────────────────────────── */ +.collapse-btn { + display: grid; + place-items: center; + color: var(--muted); + flex: 0 0 30px; +} + +.collapse-btn:hover { + color: var(--text); +} + +.itabs { + grid-template-columns: 30px repeat(4, 1fr); +} + +.rail { + display: flex; + flex-direction: column; + align-items: center; + gap: 2px; + padding-top: 6px; + background: var(--panel); + min-height: 0; +} + +.rail.left { + border-right: 1px solid var(--border); +} + +.rail.right { + border-left: 1px solid var(--border); +} + +.rail-btn { + display: grid; + place-items: center; + width: 28px; + height: 28px; + border-radius: 6px; + color: var(--muted); +} + +.rail-btn:hover { + background: var(--panel-2); + color: var(--text); +} + +.tabs .collapse-btn, +.itabs .collapse-btn { + flex: 0 0 30px; + flex-direction: row; + padding: 0; + border-bottom: 2px solid transparent; +} diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue index 714ce89..7cf411b 100644 --- a/app/components/editor/App.vue +++ b/app/components/editor/App.vue @@ -20,12 +20,14 @@ onMounted(() => {