From 1be913bd2415602878e1d5ca00edf0e4e5e6b0ac Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Mon, 26 Oct 2026 18:08:27 +0100 Subject: [PATCH] A ports on top of the box, split into lines to wire by hand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a component's box every connector port now sits at the very top of its side, above the single pins, in auto and hand-drawn boxes alike. A port can be split on one placed component (its settings or right click: Split … into lines): right below the socket the box then gets a pin per line, named after the line, so lines can be wired by hand without an adapter. Lines going into the component are inputs, lines coming out outputs, each facing out of its side; a bar in the type's colour ties them to the socket. A cable still plugs into the socket at the same time. Dropping a single wire on a socket (or clicking one while connecting) splits the port and takes the first free line that runs that way. Join … lines takes the line pins and their wires away again, as one undo step. A line wired by hand joins the same net the cable's line reaches inside; a wire and a cable on one line both drive it, and the check says so. Line pins are left out of the open-input warning, docked panels and bubbles; docked panels no longer get a row for a port's socket either. Saved as an optional list on the placed component (splitPorts); without it a box only has its ports moved to the top. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- app/assets/css/main.css | 9 + app/components/editor/Canvas.vue | 49 ++++- app/components/editor/Help.vue | 1 + app/components/editor/NodeSettings.vue | 18 +- app/components/editor/NodeView.vue | 26 ++- app/composables/useEditor.ts | 37 +++- app/composables/useMenu.ts | 10 +- app/lib/logic/check.ts | 18 +- app/lib/logic/compile.ts | 22 ++- app/lib/logic/geometry.ts | 127 +++++++++---- app/lib/logic/labels.ts | 5 +- app/lib/logic/ops.ts | 40 +++- app/lib/logic/panels.ts | 8 +- app/lib/logic/project.ts | 2 +- app/lib/logic/types.ts | 2 + tests/ports.test.ts | 252 +++++++++++++++++++++++++ 17 files changed, 569 insertions(+), 59 deletions(-) create mode 100644 tests/ports.test.ts diff --git a/README.md b/README.md index f5f4f59..3d7953f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n - Sound (speaker in the top bar; volume and clock ticks in Settings, the gear in the top bar): clicks for placing, wiring, switches and buttons, a tick per clock cycle up to 8 Hz (off by default), and jingles for a solve, a failed check, unlocks and new records. All synthesised with Web Audio, no sound files ([app/lib/audio.ts](app/lib/audio.ts)). - Transistors: every component shows how many it takes, counted as a CMOS NAND (4 transistors) per gate at every depth: in the palette, its settings and the circuit stats. Each challenge keeps your record, the fewest transistors of any passing solution, and says so when you beat it. - Cables: a bundle gathers 2 to 32 wires into one cable, a split fans it out again in the same order; one bundle can feed several splits. Select the wires (a box across them, or Shift + click) and press "Bundle into cable" or Ctrl+G: the cable starts right after the sources on their middle row and ends right before the targets on theirs, so the wires keep running as they did (backwards too); an end steps aside when another part is in the way. "Place the ends yourself…" (Ctrl+Shift+G) lets you click where it starts and ends, with a preview; Esc cancels. "Unlink all" on a bundle or split removes only the wires going in or out; the cable stays. Drag the bundle and split later to move the ends. Up to 16 wires, the cable is drawn as a ribbon: each wire is its own thin line inside, in its own colour, lit while it carries a 1. The sleeve starts neutral and gets its own colour (cable or bundle/split settings). "Remove cable" turns it back into single wires. A cable end only joins another cable end, and the cable shows its width. -- Connectors (your own HDMI, RJ45, buses): in the bottom bar's Connectors, "New connector type" makes one: a name, a colour, and lines that each run out → in or back (acknowledge, hot-plug, a receive pair). Each type gives two parts, " out" and " in". Inside a component, a port shows its lines as pins on its inner side (lines coming in are outputs, lines going out inputs) and has a cable pin at the top to hand the whole cable on to a part inside; on the component's box it is one port, in ports on the left, out ports on the right, drawn as a socket in the type's colour. One cable joins an out port to an in port of the same type and carries every line, forward and back; it is drawn as a sleeve in the type's colour with its name. Ports of different types never join, and a cable whose ends stop matching (a port changed type) is removed. Editing a type changes every port and cable of it; lines are matched by their place in the list. A type can only be deleted once no port uses it. +- Connectors (your own HDMI, RJ45, buses): in the bottom bar's Connectors, "New connector type" makes one: a name, a colour, and lines that each run out → in or back (acknowledge, hot-plug, a receive pair). Each type gives two parts, " out" and " in". Inside a component, a port shows its lines as pins on its inner side (lines coming in are outputs, lines going out inputs) and has a cable pin at the top to hand the whole cable on to a part inside; on the component's box it is one port at the very top of its side, in ports on the left, out ports on the right, drawn as a socket in the type's colour. "Split … into lines" (selection panel or right click on the component) gives that box a pin per line right below the socket, named after the line, to wire lines by hand without an adapter: lines going into the component are inputs, lines coming out outputs, and a cable still plugs into the socket. Dropping a single wire on a socket does the same and takes the first free line. "Join … lines" takes the line pins and their wires away again. One cable joins an out port to an in port of the same type and carries every line, forward and back; it is drawn as a sleeve in the type's colour with its name. Ports of different types never join, and a cable whose ends stop matching (a port changed type) is removed. Editing a type changes every port and cable of it; lines are matched by their place in the list. A type can only be deleted once no port uses it. - Pixels and screens: a pixel is a one-grid square that lights at 1, in five colours. Inside a component all pixels show on its box as one screen without gaps (every column and row they sit on becomes one of the screen), so you build your own LCD; see "Screen 4×4" and "Demo: Screen". - Input panel: one part with a column of controls; each row is a switch, button or clock. "Attach input panel" on a placed component docks one to its left with a row per free input, lined up with the pins and named after them. A docked panel moves with its component, gets a row when the component gains an input and loses it when the pin goes; inputs that are wired elsewhere, and rows you remove, are left alone. Inside a component a switch row keeps its position and a button row is 0. - 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. diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 690fa0b..7c03662 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -4347,6 +4347,15 @@ table.board { pointer-events: none; } +/* A port split on a component's box: its lines hang off the socket. */ +.port-bar { + fill: none; + stroke-width: 2; + stroke-linecap: round; + opacity: 0.8; + pointer-events: none; +} + .wire.port-cable .cable-sleeve { stroke: var(--w-on, #8592a3); opacity: 0.9; diff --git a/app/components/editor/Canvas.vue b/app/components/editor/Canvas.vue index c0f3232..9c6cf16 100644 --- a/app/components/editor/Canvas.vue +++ b/app/components/editor/Canvas.vue @@ -1,5 +1,5 @@