From 4d0e32d6780624ef6fbdfe54bfe454bed27a4bf9 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 21 Oct 2026 13:26:59 +0200 Subject: [PATCH] A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Send signal / Use signal: name a signal (CLK, RESET) once and use it anywhere in the circuit without a wire; selecting one lights up all of them, a use with no sender shows dashed - Inverted inputs: Alt + click an input (or the menu/settings) puts a bubble on it; it reads the signal inverted through one NAND, counted in every transistor total - Check (Circuit tab): open inputs, parts that drive nothing, duplicate pin names, unsent or doubly sent signals, loops that never settle; click one to show it. Open inputs get an orange marker on the canvas. Components no other circuit uses are listed with a delete - Cables show the number they carry (= 13 · 0x0D); hovering a wire tells where it runs and its value - Ctrl+F finds parts, signals, panel rows, notes and components in every circuit, with where each component is used - Ctrl+P prints the circuit as a sheet with a title block on white paper (or save as PDF); also as an SVG file - + and − under a selected gate change its number of inputs; swaps keep bubbles in place - Drag a wire by its end to move that end to another pin; drop a dragged wire on another wire to tap its signal or feed what it fed Co-Authored-By: Claude Opus 5.5 (1M context) --- app/assets/css/main.css | 306 +++++++++++++++++++++++++ app/components/editor/App.vue | 1 + app/components/editor/Canvas.vue | 230 ++++++++++++++++++- app/components/editor/CircuitPane.vue | 59 +++++ app/components/editor/Help.vue | 6 + app/components/editor/Inspector.vue | 6 +- app/components/editor/NodeSettings.vue | 66 +++++- app/components/editor/NodeView.vue | 65 ++++++ app/components/editor/Palette.vue | 2 + app/components/editor/SearchDialog.vue | 120 ++++++++++ app/components/editor/Toolbar.vue | 1 + app/composables/useEditor.ts | 104 ++++++++- app/composables/useMenu.ts | 32 ++- app/lib/logic/analyze.ts | 7 +- app/lib/logic/bulk.ts | 11 + app/lib/logic/check.ts | 108 +++++++++ app/lib/logic/compile.ts | 58 ++++- app/lib/logic/fit.ts | 2 +- app/lib/logic/geometry.ts | 24 ++ app/lib/logic/labels.ts | 3 +- app/lib/logic/ops.ts | 6 + app/lib/logic/progress.ts | 2 + app/lib/logic/search.ts | 76 ++++++ app/lib/logic/types.ts | 4 + app/lib/logic/wires.ts | 34 +++ app/lib/sheet.ts | 151 ++++++++++++ tests/check.test.ts | 73 ++++++ tests/signals.test.ts | 132 +++++++++++ 28 files changed, 1655 insertions(+), 34 deletions(-) create mode 100644 app/components/editor/SearchDialog.vue create mode 100644 app/lib/logic/check.ts create mode 100644 app/lib/logic/search.ts create mode 100644 app/lib/sheet.ts create mode 100644 tests/check.test.ts create mode 100644 tests/signals.test.ts diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 001ae04..02f9e37 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -755,6 +755,28 @@ kbd { stroke: var(--w-on); } +/* A wire end being moved, and the wire a dragged wire would drop onto. */ +.wire.moving .wire-line { + opacity: 0.3; + stroke-dasharray: 4 4; +} + +.wire.drop-target .wire-line { + stroke: var(--on); + stroke-width: 3.5; +} + +.wire-grip { + fill: var(--bg); + stroke: var(--accent); + stroke-width: 1.5; + cursor: grab; +} + +.wire-grip:hover { + fill: var(--accent); +} + .wire.hover .wire-line { stroke-width: 3; } @@ -788,6 +810,15 @@ kbd { font-weight: 600; } +.cable-mark .cable-value { + fill: var(--muted); + font-weight: 500; +} + +.wire.on .cable-mark .cable-value { + fill: var(--on); +} + /* Bundle and split: the ends of a cable. */ .node .body.cable-end { fill: #2a3240; @@ -847,6 +878,192 @@ kbd { fill: var(--muted); } +.invert-pins { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.invert-pin { + display: inline-flex; + align-items: center; + gap: 5px; + height: 24px; + padding: 0 8px 0 6px; + border: 1px solid var(--border); + border-radius: 6px; + background: var(--panel-2); + color: var(--muted); + font-family: var(--font-mono); + font-size: 11px; +} + +.invert-pin .dot { + width: 9px; + height: 9px; + border: 1.5px solid currentColor; + border-radius: 50%; +} + +.invert-pin.on { + border-color: var(--accent); + color: var(--text); +} + +.invert-pin.on .dot { + background: var(--bg); + border-color: var(--accent); +} + +/* + and − under a selected gate. */ +.widen-btn { + cursor: pointer; +} + +.widen-btn circle { + fill: var(--panel-2); + stroke: var(--accent); + stroke-width: 1.2; +} + +.widen-btn path { + stroke: var(--text); + stroke-width: 1.6; + stroke-linecap: round; +} + +.widen-btn:hover circle { + fill: var(--accent); +} + +.widen-btn:hover path { + stroke: #0e1116; +} + +/* An input with no wire (reads 0). */ +.node .open-pin { + fill: #e8a23a; + opacity: 0.85; + pointer-events: none; +} + +/* Check: problems in the open circuit. */ +.problems-head { + display: flex; + align-items: center; + gap: 8px; + margin-bottom: 6px; +} + +.problems-head h3 { + margin: 0; +} + +.problems-head .ok { + display: inline-flex; + align-items: center; + gap: 4px; + color: var(--on); + font-size: 12px; +} + +.problems-head .check { + font-size: 11px; +} + +.issue-list { + display: grid; + gap: 2px; +} + +.issue { + display: flex; + align-items: flex-start; + gap: 7px; + width: 100%; + padding: 4px 6px; + border-radius: 5px; + color: var(--text); + font-size: 12px; + line-height: 1.35; + text-align: left; +} + +.issue:hover:not(:disabled) { + background: var(--panel-2); +} + +.issue:disabled { + cursor: default; +} + +.issue.error .issue-icon { color: #ff7a7a; } +.issue.warn .issue-icon { color: #e8a23a; } +.issue.info .issue-icon { color: var(--muted); } +.issue.info { color: var(--muted); } + +.unused-row { + display: flex; + align-items: center; + gap: 6px; + padding: 2px 6px; + font-size: 12px; +} + +.btn-sm.danger { + border-color: rgb(255 107 107 / 0.5); + color: #ff8787; +} + +.itabs .badge.warn { + background: #e8a23a; + color: #14181f; +} + +/* An inverted input: the classic bubble. */ +.node .invert-bubble { + fill: var(--bg); + stroke: var(--chip-stroke); + stroke-width: 1.5; + pointer-events: none; +} + +/* Signal tags and references: a flag with the name. */ +.node .signal-flag { + fill: #1d2430; + stroke: #8a7bd8; + stroke-width: 1.5; + stroke-linejoin: round; +} + +.node .signal-flag.use { + fill: #191f29; +} + +.node .signal-flag.on { + fill: rgb(61 220 132 / 0.2); + stroke: var(--on); +} + +.node .signal-flag.orphan { + stroke: #e8a23a; + stroke-dasharray: 3 2; +} + +.node .signal-flag.linked { + stroke: #c9bfff; + stroke-width: 2.5; + filter: drop-shadow(0 0 4px rgb(138 123 216 / 0.8)); +} + +.node .signal-name { + fill: var(--text); + font-family: var(--font-mono); + font-size: 10px; + font-weight: 600; + pointer-events: none; +} + /* Pixel and pixel screens. */ .node .pixel { fill: #141a22; @@ -2697,3 +2914,92 @@ kbd { border-color: var(--accent); outline: none; } + +/* ── Search (Ctrl+F) ────────────────────────────────────────────── */ +.search-backdrop { + align-items: start; + padding-top: 12vh; +} + +.modal.search-modal { + width: min(600px, 100%); + padding: 0; + overflow: hidden; +} + +.search-field { + display: flex; + align-items: center; + gap: 10px; + padding: 12px 14px; + border-bottom: 1px solid var(--border); + color: var(--muted); +} + +.search-field input { + flex: 1; + min-width: 0; + border: 0; + background: transparent; + color: var(--text); + font-size: 15px; + outline: none; +} + +.search-empty { + padding: 14px 16px; +} + +.search-results { + max-height: 60vh; + overflow-y: auto; + padding: 4px 6px 10px; +} + +.search-results h3 { + margin: 10px 8px 4px; +} + +.search-hit { + display: block; + width: 100%; + border-radius: 6px; +} + +.search-hit.active { + background: var(--panel-2); +} + +.search-main { + display: flex; + align-items: center; + gap: 9px; + width: 100%; + min-height: 32px; + padding: 0 10px; + color: var(--text); + font-size: 13px; + text-align: left; +} + +.search-main .iconify, +.search-main > svg { + color: var(--muted); +} + +.search-where { + color: var(--muted); + font-size: 12px; + white-space: nowrap; +} + +.search-uses { + display: flex; + flex-wrap: wrap; + gap: 4px; + padding: 0 10px 8px 35px; +} + +.search-results .muted { + color: var(--muted); +} diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue index 82bcdc8..042fb2b 100644 --- a/app/components/editor/App.vue +++ b/app/components/editor/App.vue @@ -53,5 +53,6 @@ onMounted(() => { + diff --git a/app/components/editor/Canvas.vue b/app/components/editor/Canvas.vue index 4ba0856..78effc3 100644 --- a/app/components/editor/Canvas.vue +++ b/app/components/editor/Canvas.vue @@ -1,14 +1,17 @@