A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
// Editor state: the project library, the open project, selection, undo
// history, share links and the running simulation of the open circuit.
// One shared instance for the whole page.
2026-10-17 10:49:38 +00:00
2026-10-20 17:29:16 +00:00
import { nandCounts , runSteps , stats , tableCsv , TRANSISTORS_PER_NAND , truthTable , type Stats , type TestResult , type TruthTable } from '~/lib/logic/analyze'
2026-10-21 12:13:24 +00:00
import {
bundleWires ,
cableFromPins ,
cableIntoPins ,
cablePanel ,
dissolveCable ,
pinGroups ,
pluggedInto ,
plugInto ,
syncCables ,
type PinGroup ,
} from '~/lib/logic/cables'
2026-10-21 10:16:26 +00:00
import { fitLinks , fitSpots } from '~/lib/logic/fit'
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
import { rememberPart } from '~/lib/recent'
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
import { checkCircuit } from '~/lib/logic/check'
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
import { loadSoundSettings , saveSoundSettings , sfx , type Sound , type SoundSettings } from '~/lib/audio'
import { challengeName , challengeOpen , defUsable , isCampaign , KIND_NAMES , kindUnlocked , NEEDS , unlockedBy } from '~/lib/logic/progress'
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
import { apiId , makePuzzle , scoreSolution , weekKey , weeklyId } from '~/lib/logic/puzzles'
2026-10-20 18:09:23 +00:00
import { baseOf , MAX_GATE_INPUTS , NAND_BASE , wideGate } from '~/lib/logic/wide'
2026-10-17 10:49:38 +00:00
import { CHALLENGES , challengeSteps , type Challenge } from '~/lib/logic/challenges'
2026-10-23 13:34:36 +00:00
import { latchedTo , latchInto , latchTarget , syncLatches } from '~/lib/logic/latch'
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
import { cleanBundle , importBundle , importProblem , LIBRARY_LIMITS , libraryBundle , ownedEntry , publishProblem , type LibraryBundle , type LibraryMeta } from '~/lib/logic/library'
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
import { compile , INVERTIBLE , invertedPins , rowSource } from '~/lib/logic/compile'
2026-10-22 16:59:56 +00:00
import { chipPins , MAX_BITS , panelOffsets , pinKindOf , shapeOf , type Pt } from '~/lib/logic/geometry'
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
import { adoptName , continueSeries , newPinLabel , uniqueLabel , usedLabels } from '~/lib/logic/labels'
2026-10-23 10:59:16 +00:00
import { attachPanel , combineIntoPanel , detachPanel , dockedPanels , insertPanelRow , mergePanels , movePanelRow , newPanelRows , removeRow , syncPanels } from '~/lib/logic/panels'
2026-10-17 10:49:38 +00:00
import {
addExamples ,
containsDef ,
copySelection ,
createProject ,
deleteComponent ,
duplicateComponent ,
lookup ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
makeUnique ,
2026-10-21 08:09:43 +00:00
pinKeys ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
mergeComponents ,
2026-10-17 10:49:38 +00:00
newComponent ,
packageSelection ,
pasteClip ,
pruneWires ,
startChallenge ,
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
startPuzzle ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
swapNode ,
2026-10-17 10:49:38 +00:00
uid ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
unlinkWires ,
unpackChip ,
2026-10-17 10:49:38 +00:00
type Clip ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
type SwapTarget ,
2026-10-17 10:49:38 +00:00
} from '~/lib/logic/ops'
2026-10-21 08:09:43 +00:00
import { arrangeNodes , byPosition , numberedNames , seriesLinks , type Arrange , type Link } from '~/lib/logic/bulk'
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
import { parseProject , toProject } from '~/lib/logic/project'
2026-10-17 10:49:38 +00:00
import { Simulator } from '~/lib/logic/sim'
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
import {
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
cachedAccount ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
currentId ,
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
libraryKeys ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
listProjects ,
loadProject ,
migrateLegacy ,
newLocalId ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
pendingDeletes ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
removeProject ,
saveMeta ,
saveProject ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
setCachedAccount ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
setCurrentId ,
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
setLibraryKey ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
setPendingDeletes ,
type AccountUser ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
type ProjectMeta ,
} from '~/lib/logic/storage'
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
import type { CircuitNode , ComponentDef , ConnectorType , LampColor , LibraryOrigin , NodeKind , PanelControl , PanelRow , PinRef , Project , PuzzleSpec , WireColor } from '~/lib/logic/types'
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
2026-10-20 17:29:16 +00:00
/** A challenge check plus how many transistors the solution uses. */
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
/** How everyone did on a puzzle, from the server. */
export interface PuzzleSummary {
players : number
histogram : { t : number ; n : number } [ ]
you ? : { t : number ; d : number | null ; rank : number }
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
/** The best ten, named as the players chose (empty: anonymous). */
top ? : { name : string ; t : number ; d : number | null ; you? : true } [ ]
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
}
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
export type MenuPage = 'main' | 'load' | 'free' | 'campaign' | 'challenges' | 'leaderboard'
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
2026-10-20 17:29:16 +00:00
export interface ChallengeCheck extends TestResult {
transistors : number
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
/** Parts this first solve made usable (campaign). */
unlocked? : string [ ]
/** Challenges it opened. */
nextUp? : string [ ]
2026-10-20 17:29:16 +00:00
/** Fewest transistors of any passing solution so far, this one included. */
best? : number
/** Set when this one beat an earlier record: that record. */
record? : number
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
/** One pin waiting to be wired in "connect one by one". */
export interface LinkEnd {
node : string
pin : string
dir : 'in' | 'out'
label : string
}
2026-10-17 10:49:38 +00:00
export interface Placing {
kind : NodeKind
chip? : string
2026-10-22 16:59:56 +00:00
/** Port: its connector type. */
conn? : string
2026-10-17 10:49:38 +00:00
keep? : boolean
}
export interface View {
x : number
y : number
zoom : number
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
export type LinkState = 'none' | 'viewer' | 'dirty' | 'saving' | 'saved' | 'error'
2026-10-17 10:49:38 +00:00
const BUDGET = 300 _000
function create() {
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
// ── Library ───────────────────────────────────────────────────────
migrateLegacy ( )
const projects = ref < ProjectMeta [ ] > ( listProjects ( ) )
function initial ( ) : { meta : ProjectMeta ; project : Project } {
const list = listProjects ( )
const id = currentId ( )
for ( const m of [ list . find ( m = > m . id === id ) , . . . list ] ) {
if ( ! m ) continue
const p = loadProject ( m . id )
if ( p ) return { meta : m , project : p }
}
const project = createProject ( { examples : true } )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
const meta : ProjectMeta = { id : newLocalId ( ) , name : project.name , updated : Date.now ( ) , starter : true }
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
// The starter project of a first visit is saved only once something
// changes in it. Signed in on a new device, the account's saves load
// instead, so an untouched starter never becomes a second copy.
placeholder = true
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
return { meta , project }
}
let placeholder = false
const start = initial ( )
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
// The starter project of a first visit is in the list now.
projects . value = listProjects ( )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const meta = ref < ProjectMeta > ( start . meta )
const project = ref < Project > ( start . project )
setCurrentId ( start . meta . id )
2026-10-17 10:49:38 +00:00
const getDef = computed ( ( ) = > lookup ( project . value ) )
const def = computed ( ( ) = > getDef . value ( project . value . openId ) ? ? project . value . components [ 0 ] ! )
const selection = ref < string [ ] > ( [ ] )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const wireSel = ref < string [ ] > ( [ ] )
2026-10-17 10:49:38 +00:00
const placing = ref < Placing | null > ( null )
const nav = ref < string [ ] > ( [ ] )
const views = reactive < Record < string , View > > ( { } )
const notice = ref < { text : string ; kind : 'ok' | 'error' } | null > ( null )
const labelFocus = ref ( 0 )
const showHelp = ref ( false )
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
const dialog = ref < null | ' connector ' | ' share ' | ' account ' | ' versions ' | ' table ' | ' publish ' | ' settings ' | ' search ' | ' face ' | ' library ' | ' library - publish ' > ( null )
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
/** The component whose box is being drawn in the face designer. */
const faceFor = ref < string | null > ( null )
function designFace ( defId : string ) {
faceFor . value = defId
dialog . value = 'face'
}
R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and
Check on top, problems, name, statistics, truth table, as a component,
transistors, tools) and Pins. The selection gets its own panel on the
right, there only while something is selected, with its settings and
actions such as making a component out of it. The bars follow the
canvas width and drop labels when it gets narrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:17 +00:00
/** Tab of the panel on the left: this circuit, or its pins. The selection has its own panel on the right. */
const panelTab = ref < 'circuit' | 'pins' > ( 'circuit' )
/** Whether the panel on the left is open; remembered in this browser. */
const panelOpen = ref ( true )
2026-10-21 08:09:43 +00:00
try {
R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and
Check on top, problems, name, statistics, truth table, as a component,
transistors, tools) and Pins. The selection gets its own panel on the
right, there only while something is selected, with its settings and
actions such as making a component out of it. The bars follow the
canvas width and drop labels when it gets narrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:17 +00:00
panelOpen . value = localStorage . getItem ( 'logigate:panel' ) !== 'closed'
2026-10-21 08:09:43 +00:00
} catch { }
R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and
Check on top, problems, name, statistics, truth table, as a component,
transistors, tools) and Pins. The selection gets its own panel on the
right, there only while something is selected, with its settings and
actions such as making a component out of it. The bars follow the
canvas width and drop labels when it gets narrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:17 +00:00
function togglePanel ( open = ! panelOpen . value ) {
panelOpen . value = open
2026-10-21 08:09:43 +00:00
try {
R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and
Check on top, problems, name, statistics, truth table, as a component,
transistors, tools) and Pins. The selection gets its own panel on the
right, there only while something is selected, with its settings and
actions such as making a component out of it. The bars follow the
canvas width and drop labels when it gets narrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:17 +00:00
localStorage . setItem ( 'logigate:panel' , open ? 'open' : 'closed' )
2026-10-21 08:09:43 +00:00
} catch { }
}
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
/** Asks the canvas to centre on a part. */
const focusRequest = ref < { id : string ; n : number } | null > ( null )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
/** Pins being wired one after another; `at` is the one the next click connects. */
const linking = ref < { queue : LinkEnd [ ] ; at : number } | null > ( null )
2026-10-20 11:20:55 +00:00
/** Project whose savegames the versions dialog shows. */
const versionsFor = ref < string | null > ( null )
2026-10-17 10:49:38 +00:00
let noticeTimer : ReturnType < typeof setTimeout > | undefined
function notify ( text : string , kind : 'ok' | 'error' = 'ok' ) {
notice . value = { text , kind }
clearTimeout ( noticeTimer )
noticeTimer = setTimeout ( ( ) = > ( notice . value = null ) , 3500 )
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
function clearSelection() {
selection . value = [ ]
wireSel . value = [ ]
}
// ── Saving ────────────────────────────────────────────────────────
let saveTimer : ReturnType < typeof setTimeout > | undefined
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
let changed = false
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
function persistNow() {
clearTimeout ( saveTimer )
saveTimer = undefined
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
// An untouched starter project is not saved (see initial()).
if ( placeholder ) return
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
meta . value = {
. . . meta . value ,
name : project.value.name ,
updated : Date.now ( ) ,
. . . ( project . value . mode ? { mode : project.value.mode } : { } ) ,
. . . ( changed ? { dirty : true , starter : undefined } : { } ) ,
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
if ( ! saveProject ( toRaw ( meta . value ) , toRaw ( project . value ) ) ) notify ( 'Browser storage is full. Export your project to keep it.' , 'error' )
projects . value = listProjects ( )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
if ( changed ) scheduleCloud ( )
changed = false
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
}
function persist() {
placeholder = false
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
changed = true
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
clearTimeout ( saveTimer )
saveTimer = setTimeout ( persistNow , 300 )
scheduleSync ( )
}
2026-10-17 10:49:38 +00:00
// ── History ───────────────────────────────────────────────────────
2026-10-22 16:59:56 +00:00
const snap = ( ) = > JSON . stringify ( { components : project.value.components , solved : project.value.solved , connectors : project.value.connectors } )
2026-10-17 10:49:38 +00:00
let last = snap ( )
const undoStack : string [ ] = [ ]
const redoStack : string [ ] = [ ]
const canUndo = ref ( false )
const canRedo = ref ( false )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
function resetHistory() {
2026-10-23 13:34:36 +00:00
syncLatches ( project . value )
2026-10-21 09:51:45 +00:00
syncCables ( project . value )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
undoStack . length = 0
redoStack . length = 0
last = snap ( )
canUndo . value = false
canRedo . value = false
2026-10-17 10:49:38 +00:00
}
2026-10-21 09:51:45 +00:00
/ * *
* Record a change . Structural changes ( parts , wires ) rebuild the simulation .
2026-10-23 13:34:36 +00:00
* Latched parts and cables follow every change : a moved part takes them along .
2026-10-21 09:51:45 +00:00
* /
2026-10-17 10:49:38 +00:00
function commit ( structural = true ) {
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
if ( structural ) {
syncPanels ( project . value )
pruneWires ( project . value )
}
2026-10-23 13:34:36 +00:00
syncLatches ( project . value )
2026-10-21 09:51:45 +00:00
syncCables ( project . value )
2026-10-17 10:49:38 +00:00
const s = snap ( )
if ( s === last ) return
undoStack . push ( last )
if ( undoStack . length > 200 ) undoStack . shift ( )
redoStack . length = 0
last = s
canUndo . value = true
canRedo . value = false
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
forkIfViewer ( )
2026-10-17 10:49:38 +00:00
persist ( )
if ( structural ) scheduleRebuild ( )
}
function restore ( s : string ) {
2026-10-22 16:59:56 +00:00
const data = JSON . parse ( s ) as Pick < Project , ' components ' | ' solved ' | ' connectors ' >
2026-10-17 10:49:38 +00:00
project . value . components = data . components
project . value . solved = data . solved
2026-10-22 16:59:56 +00:00
if ( data . connectors ) project . value . connectors = data . connectors
else delete project . value . connectors
2026-10-17 10:49:38 +00:00
if ( ! project . value . components . some ( d = > d . id === project . value . openId ) ) project . value . openId = project . value . components [ 0 ] ! . id
last = s
selection . value = selection . value . filter ( id = > def . value . nodes . some ( n = > n . id === id ) )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = wireSel . value . filter ( id = > def . value . wires . some ( w = > w . id === id ) )
2026-10-17 10:49:38 +00:00
canUndo . value = undoStack . length > 0
canRedo . value = redoStack . length > 0
persist ( )
scheduleRebuild ( )
}
function undo() {
const s = undoStack . pop ( )
if ( s === undefined ) return
redoStack . push ( last )
restore ( s )
}
function redo() {
const s = redoStack . pop ( )
if ( s === undefined ) return
undoStack . push ( last )
restore ( s )
}
// ── Simulation ────────────────────────────────────────────────────
const sim = shallowRef < Simulator | null > ( null )
let simRoot = ''
const tick = ref ( 0 )
const status = ref < 'stable' | 'busy' | 'oscillating' > ( 'stable' )
const running = ref ( true )
const hz = ref ( 2 )
const cycles = ref ( 0 )
const errors = ref < string [ ] > ( [ ] )
const circuitStats = ref < Stats > ( { nands : 0 , sequential : false , delay : 0 } )
const pressed = new Set < string > ( )
function rebuild() {
const d = def . value
const nl = compile ( getDef . value , d . id )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const key = ` ${ meta . value . id } / ${ d . id } `
const carry = sim . value && simRoot === key ? sim . value . carry ( ) : undefined
2026-10-17 10:49:38 +00:00
const s = new Simulator ( nl , carry )
for ( const n of d . nodes ) {
if ( n . kind === 'input' ) s . setSource ( n . id , ! ! n . on )
else if ( n . kind === 'button' ) s . setSource ( n . id , pressed . has ( n . id ) )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
else if ( n . kind === 'panel' ) {
for ( const r of n . rows ? ? [ ] ) {
const key = rowSource ( n . id , r . id )
if ( r . type === 'switch' ) s . setSource ( key , ! ! r . on )
else if ( r . type === 'button' ) s . setSource ( key , pressed . has ( key ) )
}
}
2026-10-17 10:49:38 +00:00
}
s . run ( BUDGET )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
if ( simRoot !== key ) cycles . value = 0
2026-10-17 10:49:38 +00:00
sim . value = s
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
simRoot = key
2026-10-17 10:49:38 +00:00
errors . value = nl . errors
circuitStats . value = stats ( nl )
tick . value ++
}
let rebuildQueued = false
function scheduleRebuild() {
if ( rebuildQueued ) return
rebuildQueued = true
queueMicrotask ( ( ) = > {
rebuildQueued = false
rebuild ( )
} )
}
/** Value at a pin of the open circuit. Reactive through `tick`. */
function val ( nodeId : string , pin : string ) : number {
void tick . value
return sim . value ? . pin ( nodeId , pin ) ? ? 0
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
/** Value at a lamp or display inside a chip of the open circuit. */
function faceVal ( chipNode : string , inner : string , pin : string ) : number {
void tick . value
return sim . value ? . face ( chipNode , inner , pin ) ? ? 0
}
2026-10-17 10:49:38 +00:00
let raf = 0
function startLoop() {
let lastT = performance . now ( )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
let acc : number [ ] = [ ]
2026-10-17 10:49:38 +00:00
let unsettled = 0
let lastChanges = - 1
const frame = ( t : number ) = > {
const dt = Math . min ( 100 , t - lastT )
lastT = t
const s = sim . value
if ( s ) {
let rises = 0
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
let tickHz = 0
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
const n = s . nl . clocks . length
if ( running . value && n ) {
if ( acc . length !== n ) acc = new Array ( n ) . fill ( 0 )
// Ticks count the first clock that follows the top-bar speed (or the first clock).
const counted = Math . max ( 0 , s . nl . clockHz . indexOf ( 0 ) )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
tickHz = s . nl . clockHz [ counted ] || hz . value
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
const fastest : number [ ] = [ ]
for ( let i = 0 ; i < n ; i ++ ) {
const f = s . nl . clockHz [ i ] || hz . value
if ( f <= 0 ) {
fastest . push ( i )
continue
}
acc [ i ] ! += dt
const half = 500 / f
for ( let k = 0 ; acc [ i ] ! >= half && k < 16 ; k ++ ) {
acc [ i ] ! -= half
2026-10-17 10:49:38 +00:00
s . run ( BUDGET )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
if ( s . toggleClock ( i ) && i === counted ) rises ++
2026-10-17 10:49:38 +00:00
}
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
if ( acc [ i ] ! > half ) acc [ i ] = 0
}
if ( fastest . length ) {
2026-10-17 10:49:38 +00:00
const end = performance . now ( ) + 10
while ( performance . now ( ) < end ) {
if ( ! s . run ( BUDGET ) ) break
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
for ( const i of fastest ) if ( s . toggleClock ( i ) && i === counted ) rises ++
2026-10-17 10:49:38 +00:00
}
}
}
if ( rises ) cycles . value += rises
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( rises && sound . value . ticks && tickHz > 0 && tickHz <= 8 ) play ( 'tick' )
2026-10-17 10:49:38 +00:00
const settled = s . run ( BUDGET )
unsettled = settled ? 0 : unsettled + 1
status . value = settled ? 'stable' : unsettled > 30 ? 'oscillating' : 'busy'
if ( s . changes !== lastChanges ) {
lastChanges = s . changes
tick . value ++
}
}
raf = requestAnimationFrame ( frame )
}
raf = requestAnimationFrame ( frame )
return ( ) = > cancelAnimationFrame ( raf )
}
/** One full clock cycle (rise and fall), each half settled. */
function step() {
const s = sim . value
if ( ! s ) return
s . run ( BUDGET )
if ( s . clock ) {
s . setClock ( 0 )
s . run ( BUDGET )
}
s . setClock ( 1 )
s . run ( BUDGET )
cycles . value ++
s . setClock ( 0 )
s . run ( BUDGET )
tick . value ++
}
// ── Navigation ────────────────────────────────────────────────────
function open ( id : string , push = true ) {
if ( id === def . value . id || ! getDef . value ( id ) ) return
if ( push ) nav . value . push ( def . value . id )
project . value . openId = id
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
clearSelection ( )
2026-10-17 10:49:38 +00:00
placing . value = null
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
linking . value = null
2026-10-17 10:49:38 +00:00
persist ( )
rebuild ( )
}
function back() {
const id = nav . value . pop ( )
if ( id ) open ( id , false )
}
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
/** The project's top circuit: "main", or else the first one no other circuit uses. */
const mainId = computed ( ( ) = > {
const list = project . value . components
if ( list . some ( d = > d . id === 'main' ) ) return 'main'
const used = new Set ( list . flatMap ( d = > d . nodes . filter ( n = > n . kind === 'chip' && n . chip ) . map ( n = > n . chip ! ) ) )
return ( list . find ( d = > ! used . has ( d . id ) && ! d . challenge ) ? ? list [ 0 ] ! ) . id
} )
/** Back to the top circuit; the way back is forgotten. */
function goMain() {
nav . value = [ ]
open ( mainId . value , false )
}
/** Back to step `i` of the way here (0 is where it started). */
function goTo ( i : number ) {
const id = nav . value [ i ]
if ( ! id ) return
nav . value = nav . value . slice ( 0 , i )
open ( id , false )
}
2026-10-17 10:49:38 +00:00
// ── Editing ───────────────────────────────────────────────────────
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
/** Asks the canvas to open quick add in its middle (search in the parts bar). */
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
const partSearch = ref ( 0 )
2026-10-21 12:21:40 +00:00
/** A part being dragged in from the parts list, so the canvas can show where it would connect. */
const dragPart = ref < Placing | null > ( null )
/** Places a part; `links` are wires to make at once, with "ghost" standing for the new part. */
function addNode ( p : Placing , x : number , y : number , links : Link [ ] = [ ] ) : CircuitNode {
2026-10-17 10:49:38 +00:00
const node : CircuitNode = { id : uid ( 'n' ) , kind : p.kind , x , y }
if ( p . chip ) node . chip = p . chip
2026-10-22 16:59:56 +00:00
if ( p . conn ) node . conn = p . conn
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
if ( p . kind === 'input' || p . kind === 'output' ) {
node . label = newPinLabel ( def . value , p . kind )
node . autoLabel = true
}
2026-10-17 10:49:38 +00:00
if ( p . kind === 'note' ) node . label = 'Note'
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
if ( p . kind === 'tag' ) {
node . label = uniqueLabel ( 'SIG' , usedLabels ( def . value , 'signal' ) )
node . autoLabel = true
}
// A new reference uses the signal sent last.
if ( p . kind === 'ref' ) node . label = def . value . nodes . filter ( n = > n . kind === 'tag' && n . label ? . trim ( ) ) . at ( - 1 ) ? . label ? . trim ( ) ? ? ''
2026-10-21 12:38:59 +00:00
if ( p . kind === 'panel' || p . kind === 'outpanel' ) node . rows = newPanelRows ( )
2026-10-20 17:29:16 +00:00
if ( p . kind === 'bundle' || p . kind === 'split' ) node . bits = 4
2026-10-17 10:49:38 +00:00
def . value . nodes . push ( node )
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
rememberPart ( p . kind , p . chip )
2026-10-21 12:21:40 +00:00
const swap = ( r : PinRef ) = > ( r . node === 'ghost' ? { node : node.id , pin : r.pin } : r )
const made = links . filter ( l = > addWire ( swap ( l . from ) , swap ( l . to ) ) ) . length
2026-10-17 10:49:38 +00:00
selection . value = [ node . id ]
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = [ ]
2026-10-17 10:49:38 +00:00
commit ( )
2026-10-21 12:21:40 +00:00
play ( made ? 'connect' : 'place' )
if ( made ) notify ( ` Placed and connected ${ made } wire ${ made === 1 ? '' : 's' } ` )
2026-10-17 10:49:38 +00:00
return node
}
function canPlace ( chipId : string ) {
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const d = getDef . value ( chipId )
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
return ! containsDef ( project . value , chipId , def . value . id ) && ( ! d || defUsable ( project . value , d ) )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
}
/** In a campaign, basic parts are earned; elsewhere everything can be placed. */
function canPlaceKind ( kind : NodeKind ) {
return kindUnlocked ( project . value , kind )
}
// ── Sound ─────────────────────────────────────────────────────────
const sound = ref < SoundSettings > ( loadSoundSettings ( ) )
function play ( s : Sound ) {
sfx ( s , sound . value )
}
function setSound ( patch : Partial < SoundSettings > ) {
sound . value = { . . . sound . value , . . . patch }
saveSoundSettings ( sound . value )
if ( patch . on || patch . volume !== undefined ) play ( 'on' )
2026-10-17 10:49:38 +00:00
}
2026-10-22 16:59:56 +00:00
/** What a pin plugs into: '' a single wire, 'bus' a cable end, 'c:<id>' a port of that connector type. Wires join pins of one kind. */
function pinKind ( nodeId : string , pin : string , dir : 'in' | 'out' ) : string {
2026-10-20 17:29:16 +00:00
const n = def . value . nodes . find ( x = > x . id === nodeId )
2026-10-22 16:59:56 +00:00
if ( ! n ) return ''
2026-10-20 17:29:16 +00:00
const s = shapeOf ( n , getDef . value )
2026-10-22 16:59:56 +00:00
const p = ( dir === 'in' ? s.inputs : s.outputs ) . find ( p = > p . key === pin )
return p ? pinKindOf ( p ) : ''
2026-10-20 17:29:16 +00:00
}
2026-10-22 16:59:56 +00:00
/** True when the pin is a cable end or a port. */
const isBus = ( nodeId : string , pin : string , dir : 'in' | 'out' ) = > pinKind ( nodeId , pin , dir ) !== ''
2026-10-21 08:09:43 +00:00
/** Adds one wire (replacing whatever fed that input) without recording an undo step. False for a cable/wire mismatch. */
function addWire ( from : PinRef , to : PinRef , pts? : Pt [ ] ) : boolean {
2026-10-17 10:49:38 +00:00
const d = def . value
2026-10-22 16:59:56 +00:00
if ( pinKind ( from . node , from . pin , 'out' ) !== pinKind ( to . node , to . pin , 'in' ) ) return false
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const old = d . wires . find ( w = > w . to . node === to . node && w . to . pin === to . pin )
d . wires = d . wires . filter ( w = > w !== old )
const wire : ( typeof d . wires ) [ number ] = { id : uid ( 'w' ) , from , to }
if ( pts ? . length ) wire . pts = pts
const sameNet = d . wires . find ( w = > w . from . node === from . node && w . from . pin === from . pin && w . color )
if ( sameNet ? . color ) wire . color = sameNet . color
d . wires . push ( wire )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
// An unnamed switch, lamp or pin takes the name of the component pin it now connects to.
const fn = d . nodes . find ( n = > n . id === from . node )
const tn = d . nodes . find ( n = > n . id === to . node )
if ( fn && tn ) {
adoptName ( d , fn , from . pin , tn , to . pin , getDef . value )
adoptName ( d , tn , to . pin , fn , from . pin , getDef . value )
}
2026-10-21 08:09:43 +00:00
return true
}
2026-10-22 16:59:56 +00:00
/** Why two pins can't be joined, in words. */
function mismatch ( from : PinRef , to : PinRef ) : string {
const name = ( k : string ) = > ( k . startsWith ( 'c:' ) ? ( getDef . value . conn ? . ( k . slice ( 2 ) ) ? . name ? ? 'connector' ) : '' )
const a = name ( pinKind ( from . node , from . pin , 'out' ) )
const b = name ( pinKind ( to . node , to . pin , 'in' ) )
if ( a || b ) return a && b ? ` A ${ a } port only plugs into a ${ a } port, not ${ b } ` : ` A ${ a || b } port only takes a ${ a || b } cable from another ${ a || b } port `
return 'A cable runs from a bundle to a split; single wires go to the bundle’ s and split’ s side pins'
}
2026-10-21 08:09:43 +00:00
function connect ( from : PinRef , to : PinRef , pts? : Pt [ ] ) {
if ( ! addWire ( from , to , pts ) ) {
play ( 'error' )
2026-10-22 16:59:56 +00:00
return notify ( mismatch ( from , to ) , 'error' )
2026-10-21 08:09:43 +00:00
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = [ ]
2026-10-17 10:49:38 +00:00
commit ( )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
play ( 'connect' )
2026-10-17 10:49:38 +00:00
}
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
/ * *
* Moves a wire ' s end to another pin : the wire now runs from ` from ` to
* ` to ` , keeping its colour . An input that had a wire gets this one instead .
* /
function rewire ( wireId : string , from : PinRef , to : PinRef ) {
const d = def . value
const old = d . wires . find ( w = > w . id === wireId )
if ( ! old ) return
if ( old . from . node === from . node && old . from . pin === from . pin && old . to . node === to . node && old . to . pin === to . pin ) return
2026-10-22 16:59:56 +00:00
if ( pinKind ( from . node , from . pin , 'out' ) !== pinKind ( to . node , to . pin , 'in' ) ) {
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
play ( 'error' )
2026-10-22 16:59:56 +00:00
return notify ( mismatch ( from , to ) , 'error' )
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
}
d . wires = d . wires . filter ( w = > w !== old )
addWire ( from , to )
const made = d . wires [ d . wires . length - 1 ] !
if ( old . color && ! made . color ) made . color = old . color
wireSel . value = [ made . id ]
selection . value = [ ]
commit ( )
play ( 'connect' )
}
2026-10-21 08:09:43 +00:00
/** Several wires as one undo step. */
function connectMany ( links : Link [ ] ) {
const made = links . filter ( l = > addWire ( l . from , l . to ) ) . length
if ( ! made ) return
wireSel . value = [ ]
commit ( )
play ( 'connect' )
if ( made > 1 ) notify ( ` Connected ${ made } wires ` )
}
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
/** Asks the canvas for the open circuit as a sheet: printed (or saved as PDF), or as an SVG file. */
const sheetRequest = ref < { mode : 'print' | 'svg' ; n : number } | null > ( null )
function exportSheet ( mode : 'print' | 'svg' ) {
sheetRequest . value = { mode , n : ( sheetRequest . value ? . n ? ? 0 ) + 1 }
}
/** What looks wrong in the open circuit, worst first; a loop that never settles too. */
const issues = computed ( ( ) = > {
const list = checkCircuit ( def . value , getDef . value )
if ( status . value === 'oscillating' ) list . unshift ( { level : 'warn' , text : 'The circuit keeps changing: a loop that never settles' , nodes : [ ] } )
return list
} )
/** Shows the parts of a problem: selects them and centres on the first. */
function showIssue ( nodes : string [ ] ) {
if ( ! nodes . length ) return
focusNode ( nodes [ 0 ] ! )
selection . value = nodes
}
2026-10-21 10:16:26 +00:00
/** Where the selected parts fit as a group (green boxes on the canvas), nearest first. */
const fits = computed ( ( ) = > ( selection . value . length < 2 ? [ ] : fitSpots ( def . value , getDef . value , selection . value ) ) )
/** The fit pointed at: which spot, and its first pin. */
const fitHover = ref < { spot : number ; start : number } | null > ( null )
watch ( fits , ( ) = > ( fitHover . value = null ) )
function connectFit ( spot : number , start : number ) {
const s = fits . value [ spot ]
if ( ! s ) return
fitHover . value = null
connectMany ( fitLinks ( s , start ) )
}
2026-10-21 08:09:43 +00:00
/ * *
* The selected parts to another part ' s pins , in order : their outputs to
* its inputs ( dir 'out' ) , or its outputs to their inputs ( dir 'in' ) .
* /
function connectSelectionTo ( targetId : string , dir : 'in' | 'out' ) {
const target = def . value . nodes . find ( n = > n . id === targetId )
const first = def . value . nodes . filter ( n = > selection . value . includes ( n . id ) && n . id !== targetId ) . sort ( byPosition ) [ 0 ]
if ( ! target || ! first ) return
const mine = dir === 'out' ? pinKeys ( first , getDef . value ) . outs [ 0 ] : pinKeys ( first , getDef . value ) . ins [ 0 ]
const theirs = dir === 'out' ? pinKeys ( target , getDef . value ) . ins [ 0 ] : pinKeys ( target , getDef . value ) . outs [ 0 ]
if ( ! mine || ! theirs ) return notify ( 'No matching pins to connect' , 'error' )
connectMany ( seriesLinks ( def . value , getDef . value , selection . value , { node : first.id , pin : mine , dir } , { node : target.id , pin : theirs } ) )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
/** Parts plus the panels docked to them: they move, copy and delete together. */
function withDocked ( ids : Iterable < string > ) : Set < string > {
const set = new Set ( ids )
for ( const p of dockedPanels ( def . value , set ) ) set . add ( p . id )
return set
}
2026-10-21 09:51:45 +00:00
/** What moves along when parts move: docked panels and plugged-in cable ends, and what is plugged into those. */
function withFollowers ( ids : Iterable < string > ) : Set < string > {
const set = new Set ( ids )
for ( let size = - 1 ; size !== set . size ; ) {
size = set . size
2026-10-23 13:34:36 +00:00
for ( const p of [ . . . dockedPanels ( def . value , set ) , . . . pluggedInto ( def . value , set ) , . . . latchedTo ( def . value , set ) ] ) set . add ( p . id )
2026-10-21 09:51:45 +00:00
}
return set
}
2026-10-17 10:49:38 +00:00
function deleteSelected() {
const d = def . value
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
if ( ! selection . value . length && ! wireSel . value . length ) return
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const ids = withDocked ( selection . value )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const wires = new Set ( wireSel . value )
d . nodes = d . nodes . filter ( n = > ! ids . has ( n . id ) )
d . wires = d . wires . filter ( w = > ! ids . has ( w . from . node ) && ! ids . has ( w . to . node ) && ! wires . has ( w . id ) )
clearSelection ( )
commit ( )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
play ( 'delete' )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
}
const selectedWires = computed ( ( ) = > {
const ids = new Set ( wireSel . value )
return def . value . wires . filter ( w = > ids . has ( w . id ) )
} )
function setWireColor ( color : WireColor | undefined ) {
for ( const w of selectedWires . value ) {
if ( color ) w . color = color
else delete w . color
2026-10-17 10:49:38 +00:00
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
commit ( false )
}
function autoRoute() {
for ( const w of selectedWires . value ) delete w . pts
commit ( false )
}
/** Select every wire that carries the same signal (same source pin). */
function selectNet ( wireId : string ) {
const w = def . value . wires . find ( x = > x . id === wireId )
if ( ! w ) return
wireSel . value = def . value . wires . filter ( x = > x . from . node === w . from . node && x . from . pin === w . from . pin ) . map ( x = > x . id )
2026-10-17 10:49:38 +00:00
}
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
function swap ( nodeId : string , target : SwapTarget ) {
const removed = swapNode ( project . value , def . value , nodeId , target )
commit ( )
if ( removed ) notify ( ` Swapped. ${ removed } wire ${ removed === 1 ? '' : 's' } had no matching pin and were removed. ` )
}
2026-10-20 18:09:23 +00:00
/** Gives a placed gate `n` inputs, by swapping in its wide version (made on first use). */
function setInputs ( node : CircuitNode , n : number ) {
const base = baseOf ( node , getDef . value )
if ( ! base ) return
if ( base !== NAND_BASE && containsDef ( project . value , base , def . value . id ) ) return notify ( 'A component cannot contain itself' , 'error' )
const target = wideGate ( project . value , base , Math . round ( n ) )
if ( ! target ) return notify ( ` Gates can have 2 to ${ MAX_GATE_INPUTS } inputs ` , 'error' )
if ( target . kind === 'chip' && target . chip === node . chip ) return
if ( target . kind === 'nand' && node . kind === 'nand' ) return
swap ( node . id , target )
}
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
function unlink ( ids : string [ ] ) {
const n = unlinkWires ( def . value , new Set ( ids ) )
commit ( )
notify ( n ? ` Removed ${ n } wire ${ n === 1 ? '' : 's' } ` : 'Nothing was connected' )
}
function unpack ( nodeId : string ) {
const res = unpackChip ( project . value , def . value . id , nodeId )
if ( ! res . ok ) return notify ( res . error , 'error' )
selection . value = res . nodes
wireSel . value = [ ]
commit ( )
}
function makeIndependent ( nodeId : string ) {
const copy = makeUnique ( project . value , def . value , nodeId )
if ( ! copy ) return
commit ( )
notify ( ` This one now uses its own copy, " ${ copy . name } " ` )
}
2026-10-17 10:49:38 +00:00
function toggleInput ( node : CircuitNode ) {
node . on = ! node . on
sim . value ? . setSource ( node . id , node . on )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
play ( node . on ? 'on' : 'off' )
2026-10-17 10:49:38 +00:00
persist ( )
}
function press ( node : CircuitNode , down : boolean ) {
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( down && ! pressed . has ( node . id ) ) play ( 'press' )
2026-10-17 10:49:38 +00:00
if ( down ) pressed . add ( node . id )
else pressed . delete ( node . id )
sim . value ? . setSource ( node . id , down )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
/** Click on a panel row: flips a switch row. */
function toggleRow ( node : CircuitNode , row : PanelRow ) {
2026-10-21 12:38:59 +00:00
if ( row . type !== 'switch' || node . kind !== 'panel' ) return
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
row . on = ! row . on
sim . value ? . setSource ( rowSource ( node . id , row . id ) , row . on )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
play ( row . on ? 'on' : 'off' )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
persist ( )
}
function pressRow ( node : CircuitNode , row : PanelRow , down : boolean ) {
2026-10-21 12:38:59 +00:00
if ( row . type !== 'button' || node . kind !== 'panel' ) return
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const key = rowSource ( node . id , row . id )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( down && ! pressed . has ( key ) ) play ( 'press' )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
if ( down ) pressed . add ( key )
else pressed . delete ( key )
sim . value ? . setSource ( key , down )
}
// ── Panels ────────────────────────────────────────────────────────
2026-10-21 12:38:59 +00:00
/** Docks a panel to a component: switches for its free inputs (left), or lamps for its outputs (right). */
function addPanel ( chipId : string , side : 'in' | 'out' = 'in' ) {
const panel = attachPanel ( project . value , def . value , chipId , side )
if ( ! panel ) return notify ( side === 'in' ? 'Every input of this component is already connected' : 'This component has no outputs' , 'error' )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
selection . value = [ panel . id ]
wireSel . value = [ ]
commit ( )
2026-10-21 12:38:59 +00:00
const n = panel . rows ! . length
notify ( side === 'in' ? ` Input panel with ${ n } switch ${ n === 1 ? '' : 'es' } attached ` : ` Output panel with ${ n } lamp ${ n === 1 ? '' : 's' } attached ` )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
}
2026-10-21 12:38:59 +00:00
/** Pins of the open circuit got new keys: circuits that place it keep their wires on them. */
function followPins ( renamed : Map < string , string > ) {
if ( ! renamed . size ) return
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
const id = def . value . id
for ( const d of project . value . components ) {
const chips = new Set ( d . nodes . filter ( n = > n . kind === 'chip' && n . chip === id ) . map ( n = > n . id ) )
if ( ! chips . size ) continue
for ( const w of d . wires ) {
2026-10-21 12:38:59 +00:00
const to = chips . has ( w . to . node ) ? renamed . get ( w . to . pin ) : undefined
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 ( to ) w . to = { node : w.to.node , pin : to }
2026-10-21 12:38:59 +00:00
const from = chips . has ( w . from . node ) ? renamed . get ( w . from . pin ) : undefined
if ( from ) w . from = { node : w.from.node , pin : from }
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
}
}
2026-10-21 12:38:59 +00:00
}
/** Joins the selected panels into one; circuits that place this one keep their wires to the rows. */
function mergeSelectedPanels() {
const res = mergePanels ( def . value , selection . value )
if ( ! res ) return notify ( 'Select at least two panels of the same kind' , 'error' )
followPins ( res . renamed )
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
selection . value = [ res . panel . id ]
wireSel . value = [ ]
commit ( )
notify ( ` One panel with ${ res . panel . rows ? . length ? ? 0 } rows ` )
}
2026-10-21 12:38:59 +00:00
/** The selected switches, buttons and clocks as one input panel, or output pins and lamps as one output panel. */
function combineSelected() {
const res = combineIntoPanel ( def . value , selection . value , getDef . value )
if ( ! res ) return notify ( 'Select switches, buttons and clocks, or output pins and lamps (two or more)' , 'error' )
followPins ( res . renamed )
selection . value = [ res . panel . id ]
wireSel . value = [ ]
commit ( )
notify ( ` ${ res . panel . kind === 'outpanel' ? 'Output' : 'Input' } panel with ${ res . panel . rows ? . length ? ? 0 } rows ` )
}
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
// ── Main menu ─────────────────────────────────────────────────────
/** The title menu shows when the app opens at /; links open straight into the editor. */
const screen = ref < 'menu' | 'editor' > ( location . pathname === '/' ? 'menu' : 'editor' )
const menuPage = ref < MenuPage > ( 'main' )
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
/** The challenges list below its button in the top bar. */
const challengesOpen = ref ( false )
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
function enterGame() {
screen . value = 'editor'
menuPage . value = 'main'
}
function showMenu ( page : MenuPage = 'main' ) {
persistNow ( )
dialog . value = null
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
paused . value = null
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
menuPage . value = page
screen . value = 'menu'
}
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
// ── Pause menu ────────────────────────────────────────────────────
/** The in-game menu over the editor (Esc): its main list, or the saves to load. */
const paused = ref < null | ' main ' | ' load ' > ( null )
function pause ( page : 'main' | 'load' = 'main' ) {
placing . value = null
linking . value = null
paused . value = page
}
/** Saves now: in this browser, and in the account when signed in. */
async function saveNow() {
placeholder = false
changed = true
persistNow ( )
if ( ! account . value ) return notify ( 'Saved in this browser' )
await syncAccount ( )
notify ( cloudState . value === 'synced' ? 'Saved to your account' : 'Saved in this browser; the account will follow when it can be reached' , cloudState . value === 'synced' ? 'ok' : 'error' )
}
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
/** A project's mode, from its index entry, or (for projects saved before it was noted there) from the project. */
const modes = new Map < string , Project [ ' mode ' ] | null > ( )
function projectMode ( m : ProjectMeta ) : Project [ 'mode' ] | undefined {
if ( m . mode ) return m . mode
if ( ! modes . has ( m . id ) ) modes . set ( m . id , loadProject ( m . id ) ? . mode ? ? null )
return modes . get ( m . id ) ? ? undefined
}
/** The newest project of a mode, if any. */
const newestOf = ( mode : Project [ 'mode' ] ) = > listProjects ( ) . filter ( m = > projectMode ( m ) === mode ) . sort ( ( a , b ) = > b . updated - a . updated ) [ 0 ]
/** The newest project of a mode, for the menu to show progress (the open one as it is now). */
function projectOf ( mode : Project [ 'mode' ] ) : Project | null {
const m = newestOf ( mode )
if ( ! m ) return null
return m . id === meta . value . id ? project.value : loadProject ( m . id )
}
/** Into the campaign: the newest one, or a new one. */
function playCampaign() {
const m = newestOf ( 'campaign' )
if ( m ) switchProject ( m . id )
else newProject ( false , true )
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
challengesOpen . value = true
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
enterGame ( )
}
/** Into the challenges project (made on first use: NAND only, every challenge open). */
function intoChallenges() {
const m = newestOf ( 'challenges' )
if ( m ) switchProject ( m . id )
else {
persistNow ( )
const p = createProject ( { examples : false , name : 'Challenges' } )
p . mode = 'challenges'
activate ( addProject ( p ) , p )
}
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
challengesOpen . value = true
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
}
function playChallenge ( c : Challenge ) {
intoChallenges ( )
beginChallenge ( c )
enterGame ( )
}
/** The puzzle of the week, in the challenges project. */
function playWeekly() {
intoChallenges ( )
const spec = project . value . puzzles ? . find ( p = > p . id === weeklyId ( weekKey ( ) ) )
if ( spec ) beginPuzzle ( spec )
else void openPuzzle ( 'weekly' )
enterGame ( )
}
/** Name shown next to your scores on the leaderboards. */
const playerName = ref ( ( ( ) = > {
try {
return localStorage . getItem ( 'logigate:player-name' ) ? ? ''
} catch {
return ''
}
} ) ( ) )
async function setPlayerName ( name : string ) {
const res = await api < { name : string } > ( 'POST' , '/api/players/name' , { player : playerId ( ) , name } )
playerName . value = res . name
try {
localStorage . setItem ( 'logigate:player-name' , res . name )
} catch { }
}
/** A puzzle and its leaderboard from the server ("weekly", "week-2026-43" or a link id). */
async function fetchBoard ( id : string ) : Promise < { id : string ; spec : PuzzleSpec ; summary : PuzzleSummary } | null > {
try {
return await api ( 'GET' , ` /api/puzzles/ ${ encodeURIComponent ( id ) } ?player= ${ encodeURIComponent ( playerId ( ) ) } ` )
} catch {
return null
}
}
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
/** Puts pixels on a named screen of the component's box ('' for the main screen). */
function setScreen ( ids : string [ ] , name : string ) {
const v = name . trim ( )
for ( const n of nodesById ( ids ) ) {
if ( n . kind !== 'pixel' ) continue
if ( v ) n . screen = v
else delete n . screen
}
commit ( false )
}
2026-10-21 12:38:59 +00:00
/** Every row of an input panel the same kind: all switches, all buttons or all clocks. */
function setRowsType ( panel : CircuitNode , type : PanelControl ) {
for ( const r of panel . rows ? ? [ ] ) {
r . type = type
if ( type !== 'switch' ) delete r . on
if ( type !== 'clock' ) delete r . hz
}
commit ( )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
function undock ( panel : CircuitNode ) {
detachPanel ( panel )
commit ( )
}
function setRowType ( row : PanelRow , type : PanelControl ) {
row . type = type
if ( type !== 'switch' ) delete row . on
if ( type !== 'clock' ) delete row . hz
commit ( )
}
2026-10-21 09:51:45 +00:00
/** Swaps a row of a free panel with its neighbour; the rows keep their places, so the switches trade them. */
function moveRow ( panel : CircuitNode , index : number , by : - 1 | 1 ) {
const rows = panel . rows ? ? [ ]
const j = index + by
if ( panel . attach || j < 0 || j >= rows . length ) return
const at = panelOffsets ( rows )
; [ rows [ index ] , rows [ j ] ] = [ rows [ j ] ! , rows [ index ] ! ]
rows . forEach ( ( r , i ) = > ( r . dy = at [ i ] ! ) )
commit ( )
}
/** Empty rows above a row of a free panel; the rows below move along. */
function setRowGap ( panel : CircuitNode , index : number , gap : number ) {
const rows = panel . rows ? ? [ ]
if ( panel . attach || index < 1 || index >= rows . length ) return
const at = panelOffsets ( rows )
const shift = at [ index - 1 ] ! + 1 + Math . max ( 0 , Math . min ( 20 , Math . round ( gap ) || 0 ) ) - at [ index ] !
rows . forEach ( ( r , i ) = > ( r . dy = i < index ? at [ i ] ! : at [ i ] ! + shift ) )
commit ( )
}
/** A keyboard key for a panel row (empty to clear it). */
function setRowKey ( row : PanelRow , key : string | undefined ) {
if ( key ) row . key = key
else delete row . key
commit ( false )
}
function setRowColor ( row : PanelRow , color : LampColor | undefined ) {
if ( color ) row . color = color
else delete row . color
commit ( false )
}
// ── Cable ends ────────────────────────────────────────────────────
/** The part a cable end's single wires all run to (for a bundle: come from), if just one. */
function plugTarget ( end : CircuitNode ) : CircuitNode | undefined {
const wires = end . kind === 'bundle' ? def . value . wires . filter ( w = > w . to . node === end . id ) : def . value . wires . filter ( w = > w . from . node === end . id )
const ids = new Set ( wires . map ( w = > ( end . kind === 'bundle' ? w.from.node : w.to.node ) ) )
const part = ids . size === 1 ? def . value . nodes . find ( n = > n . id === [ . . . ids ] [ 0 ] ) : undefined
return part && part . kind !== 'bundle' && part . kind !== 'split' ? part : undefined
}
function plugEnd ( end : CircuitNode ) {
const part = plugTarget ( end )
if ( ! part || ! plugInto ( def . value , end , part . id , getDef . value ) ) {
return notify ( 'Its wires must all run to the pins of one part, in the same order as the cable' , 'error' )
}
commit ( )
}
/** Pulls a cable end out of its part: it steps two squares away and its wires show again. */
function unplugEnd ( end : CircuitNode ) {
if ( ! end . plug ) return
delete end . plug
end . x += end . kind === 'bundle' ? 2 : - 2
commit ( )
}
/** Ends dragged away from the part they are plugged into come loose. */
function unplugMoved ( ids : Set < string > ) {
2026-10-23 13:34:36 +00:00
for ( const n of def . value . nodes ) {
if ( n . plug && ids . has ( n . id ) && ! ids . has ( n . plug ) ) delete n . plug
if ( n . latch && ids . has ( n . id ) && ! ids . has ( n . latch ) ) delete n . latch
}
}
/** The part a part could latch onto: wired to it, its pins lining up exactly. */
function latchTargetOf ( n : CircuitNode ) : CircuitNode | undefined {
return n . latch ? undefined : latchTarget ( def . value , n , getDef . value )
}
/** Latches a part onto the part it fits: it moves onto that part's pins and goes along with it. */
function latchPart ( n : CircuitNode ) {
const host = latchTarget ( def . value , n , getDef . value )
if ( ! host || ! latchInto ( def . value , n , host . id , getDef . value ) ) {
return notify ( 'Its pins must line up with the pins it is wired to, one for one' , 'error' )
}
commit ( )
play ( 'connect' )
}
/** Lets a latched part go: it steps two squares away and its wires show again. */
function unlatch ( n : CircuitNode ) {
const host = n . latch ? def . value . nodes . find ( x = > x . id === n . latch ) : undefined
if ( ! host ) return
delete n . latch
n . x += n . x >= host . x ? 2 : - 2
commit ( )
2026-10-21 09:51:45 +00:00
}
function setPitch ( end : CircuitNode , pitch : number ) {
if ( end . plug ) return
const p = Math . max ( 1 , Math . min ( 8 , Math . round ( pitch ) || 1 ) )
if ( p === 1 ) delete end . pitch
else end . pitch = p
delete end . offsets
commit ( )
}
2026-10-21 12:13:24 +00:00
/ * *
* Pins of a part a new cable can plug onto : groups of its outputs ( those
* not already in a plugged cable ) and of its free inputs .
* /
function cableChoices ( n : CircuitNode ) : { out : PinGroup [ ] ; in : PinGroup [ ] } {
const none = { out : [ ] , in : [ ] }
if ( n . kind !== 'chip' && n . kind !== 'panel' && n . kind !== 'hex' ) return none
const s = shapeOf ( n , getDef . value )
const d = def . value
const kinds = new Map ( d . nodes . map ( x = > [ x . id , x ] ) )
const cabled = new Set ( d . wires . filter ( w = > w . from . node === n . id && kinds . get ( w . to . node ) ? . plug === n . id ) . map ( w = > w . from . pin ) )
2026-10-21 12:21:40 +00:00
// Inputs already fed by a plugged cable are taken; inputs with a plain wire can take a cable (the wire goes into it).
const fed = new Set ( d . wires . filter ( w = > w . to . node === n . id && kinds . get ( w . from . node ) ? . plug === n . id ) . map ( w = > w . to . pin ) )
2026-10-21 12:13:24 +00:00
const outs = s . outputs . filter ( p = > ! p . bus ) . sort ( ( a , b ) = > a . dy - b . dy )
const ins = n . kind === 'panel' ? [ ] : s . inputs . filter ( p = > ! p . bus ) . sort ( ( a , b ) = > a . dy - b . dy )
return { out : pinGroups ( outs , k = > ! cabled . has ( k ) ) , in : pinGroups ( ins , k = > ! fed . has ( k ) ) }
}
2026-10-21 12:21:40 +00:00
/ * *
* A cable from some of a part ' s outputs . When each of them already has
* one wire , those wires go into the cable ( both ends plug in where they
* can ) ; otherwise a new cable starts there with a free end .
* /
2026-10-21 12:13:24 +00:00
function cableOut ( nodeId : string , pins : string [ ] ) {
2026-10-21 12:21:40 +00:00
const wires = def . value . wires . filter ( w = > w . from . node === nodeId && pins . includes ( w . from . pin ) )
const per = new Map < string , number > ( )
for ( const w of wires ) per . set ( w . from . pin , ( per . get ( w . from . pin ) ? ? 0 ) + 1 )
if ( wires . length >= 2 && pins . every ( p = > per . get ( p ) === 1 ) ) return bundleSelected ( wires . map ( w = > w . id ) )
2026-10-21 12:13:24 +00:00
const res = cableFromPins ( def . value , nodeId , pins , getDef . value )
if ( ! res . ok ) return notify ( res . error , 'error' )
selection . value = [ res . split . id ]
wireSel . value = [ ]
commit ( )
notify ( ` Cable with ${ res . split . bits } wires: drag its free end onto the pins where they go ` )
}
2026-10-21 12:21:40 +00:00
/** A cable into some of a part's inputs: their wires go into it when they all have one, else a new cable into the free ones. */
2026-10-21 12:13:24 +00:00
function cableIn ( nodeId : string , pins : string [ ] ) {
2026-10-21 12:21:40 +00:00
const wires = def . value . wires . filter ( w = > w . to . node === nodeId && pins . includes ( w . to . pin ) )
if ( wires . length >= 2 && wires . length === pins . length ) return bundleSelected ( wires . map ( w = > w . id ) )
2026-10-21 12:13:24 +00:00
const res = cableIntoPins ( def . value , nodeId , pins , getDef . value )
if ( ! res . ok ) return notify ( res . error , 'error' )
selection . value = [ res . bundle . id ]
wireSel . value = [ ]
commit ( )
notify ( ` Cable with ${ res . bundle . bits } wires: drag its free end next to what drives them, or attach an input panel ` )
}
2026-10-21 09:51:45 +00:00
function addCablePanel ( bundleId : string ) {
const panel = cablePanel ( def . value , bundleId , getDef . value )
if ( ! panel ) return notify ( 'Every wire of this cable is already driven' , 'error' )
selection . value = [ panel . id ]
wireSel . value = [ ]
commit ( )
notify ( ` Input panel with ${ panel . rows ! . length } switches plugged into the cable ` )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
function addRow ( panel : CircuitNode ) {
panel . rows = [ . . . ( panel . rows ? ? [ ] ) , . . . newPanelRows ( 1 ) ]
commit ( )
}
2026-10-23 10:59:16 +00:00
/** A new row at a place in a free panel's order (above the row there); returns it. */
function insertRow ( panel : CircuitNode , index : number ) : PanelRow | undefined {
if ( panel . attach ) return
const row = insertPanelRow ( panel , index )
commit ( )
return row
}
/** A row of a free panel dragged to another place in the order. */
function moveRowTo ( panel : CircuitNode , from : number , to : number ) {
if ( panel . attach || ! movePanelRow ( panel , from , to ) ) return
commit ( )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
function dropRow ( panel : CircuitNode , rowId : string ) {
removeRow ( def . value , panel , rowId )
commit ( )
}
2026-10-17 10:49:38 +00:00
let clip : Clip | null = null
let pasteCount = 0
A right-click menu for parts, wires and the canvas, "Wire them all to" as cards, plugged latches in plain greys
- Right click (or the menu key) shows what can be done with what is under the pointer: one part (open, rename, change to, inputs, colour, speed, panels, unpack, plug and unplug, cable colour), several parts (wire them all to with live preview, connect one by one, switches, change all, arrange, keep only, make a component), wires (bundle, colour, whole signal, straighten, remove cable) or empty canvas (paste here, add a part here, select all, fit, tidy, undo); right drag still moves the view
- "Wire them all to": a card per part, each fit a strip of its pins, and which wire goes where for the fit pointed at
- Plugged cable ends no longer look selected: grey connector, steel clips
- Icons named in menus are bundled for the browser too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:33:30 +00:00
/** Something copied, ready to paste. */
const hasClip = ref ( false )
2026-10-17 10:49:38 +00:00
function copy() {
if ( ! selection . value . length ) return
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
clip = copySelection ( def . value , withDocked ( selection . value ) )
A right-click menu for parts, wires and the canvas, "Wire them all to" as cards, plugged latches in plain greys
- Right click (or the menu key) shows what can be done with what is under the pointer: one part (open, rename, change to, inputs, colour, speed, panels, unpack, plug and unplug, cable colour), several parts (wire them all to with live preview, connect one by one, switches, change all, arrange, keep only, make a component), wires (bundle, colour, whole signal, straighten, remove cable) or empty canvas (paste here, add a part here, select all, fit, tidy, undo); right drag still moves the view
- "Wire them all to": a card per part, each fit a strip of its pins, and which wire goes where for the fit pointed at
- Plugged cable ends no longer look selected: grey connector, steel clips
- Icons named in menus are bundled for the browser too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:33:30 +00:00
hasClip . value = true
2026-10-17 10:49:38 +00:00
pasteCount = 0
notify ( ` Copied ${ clip . nodes . length } part ${ clip . nodes . length === 1 ? '' : 's' } ` )
}
A right-click menu for parts, wires and the canvas, "Wire them all to" as cards, plugged latches in plain greys
- Right click (or the menu key) shows what can be done with what is under the pointer: one part (open, rename, change to, inputs, colour, speed, panels, unpack, plug and unplug, cable colour), several parts (wire them all to with live preview, connect one by one, switches, change all, arrange, keep only, make a component), wires (bundle, colour, whole signal, straighten, remove cable) or empty canvas (paste here, add a part here, select all, fit, tidy, undo); right drag still moves the view
- "Wire them all to": a card per part, each fit a strip of its pins, and which wire goes where for the fit pointed at
- Plugged cable ends no longer look selected: grey connector, steel clips
- Icons named in menus are bundled for the browser too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:33:30 +00:00
/** Pastes a little below the copy each time, or with its top left corner at `at`. */
function paste ( at? : Pt ) {
2026-10-17 10:49:38 +00:00
if ( ! clip ) return
pasteCount ++
const blocked = clip . nodes . filter ( n = > n . kind === 'chip' && n . chip && ! canPlace ( n . chip ) )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const usable : Clip = blocked . length ? { nodes : clip.nodes.filter ( n = > ! blocked . includes ( n ) ) , wires : clip.wires } : clip
2026-10-17 10:49:38 +00:00
if ( blocked . length ) notify ( 'Skipped parts that would contain this circuit itself' , 'error' )
A right-click menu for parts, wires and the canvas, "Wire them all to" as cards, plugged latches in plain greys
- Right click (or the menu key) shows what can be done with what is under the pointer: one part (open, rename, change to, inputs, colour, speed, panels, unpack, plug and unplug, cable colour), several parts (wire them all to with live preview, connect one by one, switches, change all, arrange, keep only, make a component), wires (bundle, colour, whole signal, straighten, remove cable) or empty canvas (paste here, add a part here, select all, fit, tidy, undo); right drag still moves the view
- "Wire them all to": a card per part, each fit a strip of its pins, and which wire goes where for the fit pointed at
- Plugged cable ends no longer look selected: grey connector, steel clips
- Icons named in menus are bundled for the browser too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:33:30 +00:00
const [ dx , dy ] = at && usable . nodes . length
? [ Math . round ( at [ 0 ] ) - Math . min ( . . . usable . nodes . map ( n = > n . x ) ) , Math . round ( at [ 1 ] ) - Math . min ( . . . usable . nodes . map ( n = > n . y ) ) ]
: [ 2 * pasteCount , 2 * pasteCount ]
const ids = pasteClip ( def . value , usable , dx , dy )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const fresh = new Set ( ids )
continueSeries ( def . value , def . value . nodes . filter ( n = > fresh . has ( n . id ) ) )
selection . value = ids
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = [ ]
2026-10-17 10:49:38 +00:00
commit ( )
}
function duplicate() {
copy ( )
paste ( )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
// ── Connect one by one ────────────────────────────────────────────
/ * *
* Pins of the given parts , top to bottom , ready to be wired one after the
* other : their outputs , or their inputs when asked for ( or when they have
* no outputs , like lamps ) .
* /
function linkQueue ( ids : string [ ] , want ? : 'in' | 'out' ) : LinkEnd [ ] {
const nodes = def . value . nodes . filter ( n = > ids . includes ( n . id ) && n . kind !== 'note' ) . sort ( ( a , b ) = > a . y - b . y || a . x - b . x )
const shapes = nodes . map ( n = > ( { n , s : shapeOf ( n , getDef . value ) } ) )
const dir = want ? ? ( shapes . some ( ( { s } ) = > s . outputs . length ) ? 'out' : 'in' )
const queue : LinkEnd [ ] = [ ]
for ( const { n , s } of shapes ) {
for ( const p of dir === 'out' ? s.outputs : s.inputs ) {
const label = p . label || n . label ? . trim ( ) || ''
queue . push ( { node : n.id , pin : p.key , dir , label } )
}
}
return queue
}
function startLinking ( ids = selection . value , want ? : 'in' | 'out' ) {
const queue = linkQueue ( ids , want )
if ( ! queue . length ) return notify ( 'Nothing to connect: select parts with pins' , 'error' )
placing . value = null
linking . value = null
linking . value = { queue , at : 0 }
}
2026-10-23 11:11:19 +00:00
/ * *
* Wires the pin whose turn it is to ` target ` , then moves on to the next one .
* With ` more ` ( Shift ) , the wire keeps following the mouse from the same
* signal for another connection : from the same output , or , when it started
* at an input , from the output just wired to it .
* /
function linkTo ( target : PinRef , more = false ) {
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const l = linking . value
const cur = l ? . queue [ l . at ]
if ( ! l || ! cur ) return
const here = { node : cur.node , pin : cur.pin }
if ( cur . dir === 'out' ) connect ( here , target )
else connect ( target , here )
2026-10-23 11:11:19 +00:00
if ( more && cur . dir === 'out' ) return
if ( more && l . queue . length === 1 ) {
linking . value = { queue : [ { . . . target , dir : 'out' , label : '' } ] , at : 0 }
return
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
l . at ++
if ( l . at >= l . queue . length ) {
linking . value = null
if ( l . queue . length > 1 ) notify ( ` Connected ${ l . queue . length } pins ` )
}
}
function stopLinking() {
linking . value = null
}
// ── Tidy wiring ───────────────────────────────────────────────────
function setTidy ( on : boolean ) {
if ( on ) project . value . settings . tidy = true
else delete project . value . settings . tidy
persist ( )
}
/** Removes all hand-placed bends in the open circuit and lays every wire out tidily. */
function tidyAll() {
const bent = def . value . wires . filter ( w = > w . pts ) . length
for ( const w of def . value . wires ) delete w . pts
project . value . settings . tidy = true
commit ( false )
persist ( )
notify ( bent ? ` Tidied. ${ bent } hand-placed bend ${ bent === 1 ? ' was' : 's were' } removed (Ctrl+Z brings ${ bent === 1 ? 'it' : 'them' } back) ` : 'Tidy wiring is on' )
}
2026-10-23 12:57:16 +00:00
/** Tidy wiring in every circuit of the project: all hand-placed bends go, one undo step. */
function tidyEverything() {
let bent = 0
let circuits = 0
for ( const d of project . value . components ) {
const n = d . wires . filter ( w = > w . pts ) . length
if ( n ) circuits ++
bent += n
for ( const w of d . wires ) delete w . pts
}
project . value . settings . tidy = true
commit ( false )
persist ( )
notify (
bent
? ` Tidied every circuit: ${ bent } hand-placed bend ${ bent === 1 ? '' : 's' } in ${ circuits } circuit ${ circuits === 1 ? '' : 's' } removed (Ctrl+Z brings them back) `
: 'Every circuit is tidy' ,
)
}
2026-10-17 10:49:38 +00:00
function selectAll() {
selection . value = def . value . nodes . map ( n = > n . id )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = def . value . wires . map ( w = > w . id )
2026-10-17 10:49:38 +00:00
}
function packageSelected ( name : string ) {
const res = packageSelection ( project . value , def . value . id , new Set ( selection . value ) , name )
if ( ! res . ok ) {
notify ( res . error , 'error' )
return
}
selection . value = [ res . chipNode ]
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel . value = [ ]
2026-10-17 10:49:38 +00:00
commit ( )
notify ( ` Created component " ${ res . def . name } " ` )
}
// ── Components ────────────────────────────────────────────────────
function createComponent ( name = 'New part' ) {
const d = newComponent ( project . value , name )
commit ( )
open ( d . id )
labelFocus . value ++
}
function removeComponent ( id : string ) {
const err = deleteComponent ( project . value , id )
if ( err ) return notify ( err , 'error' )
nav . value = nav . value . filter ( n = > n !== id )
commit ( )
rebuild ( )
}
function copyComponent ( id : string ) {
const d = duplicateComponent ( project . value , id )
if ( ! d ) return
commit ( )
open ( d . id )
}
function beginChallenge ( c : Challenge ) {
const existing = project . value . components . find ( d = > d . challenge === c . id )
if ( existing ) return open ( existing . id )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( ! challengeOpen ( project . value , c . id ) ) {
play ( 'error' )
return notify ( ` Solve ${ ( NEEDS [ c . id ] ? ? [ ] ) . filter ( n = > ! project . value . solved . includes ( n ) ) . map ( challengeName ) . join ( ' and ' ) } first ` , 'error' )
}
2026-10-17 10:49:38 +00:00
const d = startChallenge ( project . value , c )
commit ( )
open ( d . id )
}
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
/** The challenge or puzzle the open circuit is for. */
const task = computed ( ( ) = > {
const id = def . value . challenge
if ( ! id ) return null
const c = CHALLENGES . find ( c = > c . id === id )
if ( c ) return { id , challenge : c , puzzle : undefined , steps : challengeSteps ( c ) }
const p = project . value . puzzles ? . find ( p = > p . id === id )
return p ? { id , challenge : undefined , puzzle : p , steps : p.steps } : null
} )
2026-10-20 17:29:16 +00:00
function checkChallenge ( ) : ChallengeCheck | null {
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const t = task . value
if ( ! t ) return null
const res = t . puzzle ? scoreSolution ( toRaw ( project . value . components ) , def . value . id , toRaw ( t . puzzle ) ) : runSteps ( getDef . value , def . value . id , t . steps )
2026-10-20 17:29:16 +00:00
const used = transistors ( def . value . id )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const before = project . value . best ? . [ t . id ]
if ( ! res . pass ) {
play ( 'fail' )
return { . . . res , transistors : used , best : before }
}
2026-10-20 17:29:16 +00:00
let changed = false
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const first = ! project . value . solved . includes ( t . id )
const opened = first && t . challenge ? unlockedBy ( project . value , t . id ) : { challenges : [ ] , kinds : [ ] }
if ( first ) {
project . value . solved . push ( t . id )
2026-10-20 17:29:16 +00:00
changed = true
}
const record = before === undefined || used < before
if ( record ) {
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
project . value . best = { . . . project . value . best , [ t . id ] : used }
2026-10-20 17:29:16 +00:00
changed = true
}
if ( changed ) {
2026-10-17 10:49:38 +00:00
commit ( false )
2026-10-20 17:29:16 +00:00
persist ( )
2026-10-17 10:49:38 +00:00
}
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const unlocked = isCampaign ( project . value ) && first && t . challenge ? [ def . value . name , . . . opened . kinds . map ( k = > KIND_NAMES [ k ] ? ? k ) ] : [ ]
const nextUp = opened . challenges . map ( challengeName )
play ( record && before !== undefined ? 'record' : 'solve' )
if ( unlocked . length || nextUp . length ) play ( 'unlock' )
if ( t . puzzle ) void submitScore ( t . puzzle )
return {
. . . res ,
transistors : used ,
best : record ? used : before ,
record : record && before !== undefined ? before : undefined ,
unlocked ,
nextUp ,
}
}
// ── Puzzles ───────────────────────────────────────────────────────
/** A random id for this browser, so the server can keep one best score per player. */
function playerId ( ) : string {
try {
let id = localStorage . getItem ( 'logigate:player' )
if ( ! id ) {
id = uid ( 'p' ) + uid ( ) + uid ( )
localStorage . setItem ( 'logigate:player' , id )
}
return id
} catch {
return 'anonymous-player'
}
}
/** How everyone did, per puzzle id, as last heard from the server. */
const boards = reactive < Record < string , PuzzleSummary > > ( { } )
async function loadBoard ( spec : PuzzleSpec ) {
try {
const res = await api < { summary : PuzzleSummary } > ( 'GET' , ` /api/puzzles/ ${ apiId ( spec . id ) } ?player= ${ encodeURIComponent ( playerId ( ) ) } ` )
boards [ spec . id ] = res . summary
} catch { }
}
async function submitScore ( spec : PuzzleSpec ) {
try {
const res = await api < { score : { pass : boolean ; transistors : number } ; summary : PuzzleSummary } > ( 'POST' , ` /api/puzzles/ ${ apiId ( spec . id ) } /scores ` , {
player : playerId ( ) ,
defId : def.value.id ,
components : toRaw ( project . value . components ) ,
} )
boards [ spec . id ] = res . summary
} catch ( e ) {
notify ( ` Your score could not be sent: ${ ( e as Error ) . message } ` , 'error' )
}
}
function beginPuzzle ( spec : PuzzleSpec ) {
const d = startPuzzle ( project . value , spec )
commit ( )
open ( d . id )
void loadBoard ( spec )
}
/** Opens a puzzle from the server: a link id, or "weekly". */
async function openPuzzle ( id : string ) {
try {
const res = await api < { spec : PuzzleSpec ; summary : PuzzleSummary } > ( 'GET' , ` /api/puzzles/ ${ encodeURIComponent ( id ) } ?player= ${ encodeURIComponent ( playerId ( ) ) } ` )
boards [ res . spec . id ] = res . summary
beginPuzzle ( res . spec )
notify ( ` Puzzle: ${ res . spec . name } ` )
} catch ( e ) {
notify ( ( e as Error ) . message , 'error' )
} finally {
syncUrl ( )
}
}
/** Publishes the open circuit as a puzzle; returns its link. */
async function publishPuzzle ( name : string , goal : string ) : Promise < string > {
const spec = makePuzzle ( toRaw ( project . value . components ) , def . value . id , name , goal )
const res = await api < { id : string } > ( 'POST' , '/api/puzzles' , { puzzle : spec } )
return ` ${ location . origin } /puzzle/ ${ res . id } `
2026-10-20 17:29:16 +00:00
}
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
// ── Public library ────────────────────────────────────────────────
/** Edit keys of the library entries this browser published. */
const libKeys = ref ( libraryKeys ( ) )
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
/** The library entry a component is, when this browser published it from here (and so can update or remove it). */
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
function ownEntry ( d : ComponentDef | undefined ) : string | undefined {
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
return d && ownedEntry ( libKeys . value , meta . value . id , d . id )
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
}
/** Why the open circuit can't go to the library; null when it can. */
const libraryProblem = computed ( ( ) = > publishProblem ( project . value , def . value . id ) )
async function listLibrary ( q = '' ) : Promise < { entries : LibraryMeta [ ] ; total : number } > {
return api ( 'GET' , ` /api/library?q= ${ encodeURIComponent ( q . trim ( ) ) } ` )
}
/ * *
* Publishes the open circuit to the library with everything it uses , or a
* new version when this browser published it before . The name and
* description go to the component too ; the author is your leaderboard name .
* /
async function publishToLibrary ( name : string , description : string , author : string ) : Promise < LibraryOrigin > {
const d = def . value
const problem = publishProblem ( project . value , d . id )
if ( problem ) throw new Error ( problem )
if ( author . trim ( ) !== playerName . value ) await setPlayerName ( author )
const text = description . trim ( ) . slice ( 0 , LIBRARY_LIMITS . description )
d . name = name . trim ( ) . slice ( 0 , LIBRARY_LIMITS . name ) || d . name
if ( text ) d . description = text
else delete d . description
try {
const body = { player : playerId ( ) , . . . libraryBundle ( toRaw ( project . value ) , d . id ) }
const own = ownEntry ( d )
let res : { id : string ; key? : string ; version : number } | undefined
if ( own ) {
try {
res = await api ( 'PUT' , ` /api/library/ ${ own } ` , body , libKeys . value [ own ] ! . key )
} catch ( e ) {
// Gone from the library: it goes in again as a new entry.
if ( ( e as { status? : number } ) . status !== 404 ) throw e
setLibraryKey ( own , null )
}
}
res ? ? = await api < { id : string ; key : string ; version : number } > ( 'POST' , '/api/library' , body )
if ( res . key ) setLibraryKey ( res . id , { key : res.key , project : meta.value.id , def : d.id } )
libKeys . value = libraryKeys ( )
d . from = { id : res.id , version : res.version , author : playerName.value }
return d . from
} finally {
commit ( false )
}
}
/** Takes an entry this browser published out of the library; components here keep working, just without the mark. */
async function removeFromLibrary ( id : string ) {
try {
await api ( 'DELETE' , ` /api/library/ ${ id } ` , undefined , libKeys . value [ id ] ? . key )
} catch ( e ) {
if ( ( e as { status? : number } ) . status !== 404 ) throw e
}
setLibraryKey ( id , null )
libKeys . value = libraryKeys ( )
for ( const d of project . value . components ) if ( d . from ? . id === id && ! d . from . inside ) delete d . from
commit ( false )
}
async function fetchEntry ( id : string ) : Promise < { entry : LibraryMeta ; bundle : LibraryBundle } > {
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
const problem = importProblem ( project . value )
if ( problem ) throw new Error ( problem )
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
const res = await api < { entry : LibraryMeta ; bundle : unknown } > ( 'GET' , ` /api/library/ ${ encodeURIComponent ( id ) } ` )
BF library: no solutions inside, nothing into a campaign, marks only from the entry, a small listing, updates clear what they replace
A component with a challenge or puzzle solution anywhere inside stays
private, not only a challenge circuit itself, so wrapping a solution in a
part of its own no longer publishes it.
A campaign takes nothing from the library: Add and "Get version" are off
there, with a line saying why. A library part could be duplicated,
published again or taken apart into a solution, so a check on placing was
not enough.
Library marks come only from the entry being added. The server drops the
marks a publisher sends, and whether an entry is yours depends only on the
key this browser keeps for that project and component, so a part claiming
to be someone's entry can't be published over it.
The listing keeps pin counts and the first 16 pin names a side, short, and
a group of 40 characters at most, so it stays small whatever is sent.
"Get version" clears away what came along with the old version once
nothing else uses it, and the new parts take its names. Adding never
reuses another entry's component, so updating one entry leaves the others
as they were.
Wire corner points that aren't number pairs are dropped when a project,
link or library entry is read, so a circuit can always be drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:44:13 +00:00
return { entry : res.entry , bundle : cleanBundle ( res . bundle ) }
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
}
const originOf = ( entry : LibraryMeta ) : LibraryOrigin = > ( { id : entry.id , version : entry.version , author : entry.author } )
/** Adds a library entry to the open project; returns the id of its component here, ready to place. */
async function addFromLibrary ( id : string ) : Promise < string > {
const { entry , bundle } = await fetchEntry ( id )
const res = importBundle ( project . value , bundle , originOf ( entry ) )
commit ( )
const along = res . added > 1 ? ` and ${ res . added - 1 } component ${ res . added === 2 ? '' : 's' } it uses ` : ''
notify ( res . added ? ` Added " ${ entry . name } " ${ entry . author ? ` by ${ entry . author } ` : '' } ${ along } ` : ` " ${ entry . name } " is in this project already ` )
return res . root
}
/** Brings a component from the library to the newest version of its entry, in place: wherever it is used follows. */
async function updateFromLibrary ( defId : string ) {
const d = getDef . value ( defId )
if ( ! d ? . from || d . from . inside ) return
try {
const { entry , bundle } = await fetchEntry ( d . from . id )
importBundle ( project . value , bundle , originOf ( entry ) , d . id )
commit ( )
notify ( ` " ${ d . name } " is now version ${ entry . version } (Ctrl+Z goes back) ` )
} catch ( e ) {
notify ( ( e as Error ) . message , 'error' )
}
}
/** The newest version of a library entry; null when the library can't be reached or no longer has it. */
async function libraryVersion ( id : string ) : Promise < number | null > {
try {
return ( await api < { entry : LibraryMeta } > ( 'GET' , ` /api/library/ ${ encodeURIComponent ( id ) } ?meta ` ) ) . entry . version
} catch {
return null
}
}
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
// ── Several parts at once ─────────────────────────────────────────
const nodesById = ( ids : string [ ] ) = > {
const set = new Set ( ids )
return def . value . nodes . filter ( n = > set . has ( n . id ) )
}
/** Swaps every given part for the same new one, keeping wires on matching pins. One undo step. */
function swapMany ( ids : string [ ] , target : SwapTarget ) {
let removed = 0
for ( const n of nodesById ( ids ) ) {
if ( n . kind === target . kind && n . chip === target . chip ) continue
removed += swapNode ( project . value , def . value , n . id , target )
}
commit ( )
notify ( removed ? ` Swapped. ${ removed } wire ${ removed === 1 ? '' : 's' } had no matching pin and were removed. ` : ` Swapped ${ ids . length } parts ` )
}
/** Names the parts top to bottom from a pattern (D# → D0, D1, …). An empty pattern clears their names. */
function renameMany ( ids : string [ ] , pattern : string , start = 0 ) {
const nodes = nodesById ( ids ) . sort ( byPosition )
const names = numberedNames ( pattern , nodes . length , start )
nodes . forEach ( ( n , i ) = > {
if ( pattern . trim ( ) ) n . label = names [ i ]
else delete n . label
delete n . autoLabel
} )
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
// Signal names decide what connects.
commit ( nodes . some ( n = > n . kind === 'tag' || n . kind === 'ref' ) )
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
}
/** A name typed by hand (Pins list); empty lets connections name the part again. */
function setLabel ( node : CircuitNode , label : string , row? : PanelRow ) {
const v = label . trim ( )
if ( row ) {
if ( v ) row . label = v
else delete row . label
return commit ( )
}
if ( v ) node . label = v
else delete node . label
delete node . autoLabel
commit ( false )
}
/** Sets the switches among the parts to 0 or 1, or flips each. */
function setSwitches ( ids : string [ ] , to : boolean | 'flip' ) {
for ( const n of nodesById ( ids ) ) {
if ( n . kind !== 'input' ) continue
const on = to === 'flip' ? ! n.on : to
if ( ! ! n . on === on ) continue
n . on = on
sim . value ? . setSource ( n . id , on )
}
play ( to === false ? 'off' : 'on' )
persist ( )
}
/** The same setting on every part (colour, frequency, note size); undefined removes it. */
function patchMany ( ids : string [ ] , patch : Pick < CircuitNode , ' color ' | ' hz ' | ' size ' > , structural = false ) {
for ( const n of nodesById ( ids ) ) {
for ( const [ k , v ] of Object . entries ( patch ) as [ keyof typeof patch , never ] [ ] ) {
if ( v === undefined ) delete n [ k ]
else n [ k ] = v
}
}
commit ( structural )
}
function arrangeSelected ( how : Arrange ) {
arrangeNodes ( nodesById ( selection . value ) , how )
commit ( false )
}
/** Narrows the selection to some of its parts. */
function selectOnly ( ids : string [ ] ) {
selection . value = ids
wireSel . value = [ ]
}
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
/** A reference to a signal, placed to the right of its tag and selected. */
function useSignal ( tag : CircuitNode ) {
const name = tag . label ? . trim ( )
if ( ! name ) return notify ( 'Give the signal a name first' , 'error' )
const b = shapeOf ( tag , getDef . value ) . body
const ref : CircuitNode = { id : uid ( 'n' ) , kind : 'ref' , x : Math.round ( tag . x + b . x + b . w + 3 ) , y : tag.y , label : name }
def . value . nodes . push ( ref )
selection . value = [ ref . id ]
wireSel . value = [ ]
commit ( )
play ( 'place' )
}
/** Every tag and reference of a signal. */
function selectSignal ( name : string ) {
selection . value = def . value . nodes . filter ( n = > ( n . kind === 'tag' || n . kind === 'ref' ) && n . label ? . trim ( ) === name ) . map ( n = > n . id )
wireSel . value = [ ]
}
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
/** Selects a part and centres the view on it. */
function focusNode ( id : string ) {
selection . value = [ id ]
wireSel . value = [ ]
focusRequest . value = { id , n : ( focusRequest . value ? . n ? ? 0 ) + 1 }
}
2026-10-20 17:29:16 +00:00
// ── Transistors ───────────────────────────────────────────────────
const nands = computed ( ( ) = > nandCounts ( project . value . components ) )
/** Transistors in a component at every depth, 4 per NAND gate. */
function transistors ( defId : string ) : number {
return ( nands . value . get ( defId ) ? ? 0 ) * TRANSISTORS_PER_NAND
}
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
/** Transistors in one placed part: 4 for a NAND, its whole inside for a component, 0 for switches, lamps and cables. */
function transistorsOfNode ( n : CircuitNode ) : number {
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
const child = n . kind === 'chip' && n . chip ? getDef . value ( n . chip ) : undefined
const bubbles = invertedPins ( n , child ? chipPins ( child ) : undefined ) . length * TRANSISTORS_PER_NAND
if ( n . kind === 'nand' ) return TRANSISTORS_PER_NAND + bubbles
return ( n . kind === 'chip' && n . chip ? transistors ( n . chip ) : 0 ) + bubbles
}
/** Puts a bubble on an input (it reads the signal inverted, through one NAND), or takes it off. */
function toggleInvert ( n : CircuitNode , pin : string ) {
if ( ! INVERTIBLE . has ( n . kind ) ) return
const set = new Set ( n . invert ? ? [ ] )
if ( ! set . delete ( pin ) ) set . add ( pin )
if ( set . size ) n . invert = [ . . . set ]
else delete n . invert
commit ( )
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
}
2026-10-22 16:59:56 +00:00
// ── Connector types ─────────────────────────────────────────────
/** The connector type open in the connector dialog. */
const connectorFor = ref < string | null > ( null )
/** A new connector type with two lines, opened for editing. */
function addConnector ( ) : ConnectorType {
const names = new Set ( ( project . value . connectors ? ? [ ] ) . map ( c = > c . name . toLowerCase ( ) ) )
let name = 'Connector'
for ( let i = 2 ; names . has ( name . toLowerCase ( ) ) ; i ++ ) name = ` Connector ${ i } `
const c : ConnectorType = { id : uid ( 'k' ) , name , lines : [ { name : 'D0' } , { name : 'D1' } ] }
project . value . connectors = [ . . . ( project . value . connectors ? ? [ ] ) , c ]
commit ( )
editConnector ( c . id )
return c
}
function editConnector ( id : string ) {
connectorFor . value = id
dialog . value = 'connector'
}
/** Where a connector type is used: ports in all circuits. */
function connectorUses ( id : string ) : number {
return project . value . components . reduce ( ( n , d ) = > n + d . nodes . filter ( x = > x . conn === id && ( x . kind === 'portin' || x . kind === 'portout' ) ) . length , 0 )
}
function removeConnector ( id : string ) {
const uses = connectorUses ( id )
if ( uses ) return notify ( ` Still used by ${ uses } port ${ uses === 1 ? '' : 's' } : change or delete those first ` , 'error' )
project . value . connectors = ( project . value . connectors ? ? [ ] ) . filter ( c = > c . id !== id )
if ( ! project . value . connectors . length ) delete project . value . connectors
if ( connectorFor . value === id ) dialog . value = null
commit ( )
}
2026-10-20 17:29:16 +00:00
// ── Cables ────────────────────────────────────────────────────────
2026-10-21 08:39:54 +00:00
/** Bundling with a chosen route: the next click places the start of the cable, the one after its end. */
const cabling = ref < { wires : string [ ] ; start? : Pt } | null > ( null )
function startCable ( wires = wireSel . value ) {
if ( wires . length < 2 ) return notify ( 'Select at least two wires to bundle (Shift + click or drag a box)' , 'error' )
placing . value = null
linking . value = null
cabling . value = { wires : [ . . . wires ] }
}
function placeCable ( at : Pt ) {
const c = cabling . value
if ( ! c ) return
if ( ! c . start ) {
c . start = at
return
}
cabling . value = null
bundleSelected ( c . wires , { start : c.start , end : at } )
}
/** Colour of a cable's sleeve (every cable leaving that bundle); undefined for the default. */
function setCableColor ( bundleId : string , color : WireColor | undefined ) {
for ( const w of def . value . wires ) {
if ( w . from . node !== bundleId ) continue
if ( color ) w . color = color
else delete w . color
}
commit ( false )
}
function bundleSelected ( wires = wireSel . value , at ? : { start : Pt ; end : Pt } ) {
const res = bundleWires ( def . value , wires , getDef . value , at )
2026-10-20 17:29:16 +00:00
if ( ! res . ok ) return notify ( res . error , 'error' )
selection . value = [ res . bundle . id , res . split . id ]
wireSel . value = [ ]
commit ( )
notify ( ` ${ res . bundle . bits } wires bundled into one cable ` )
}
function removeCable ( bundleId : string ) {
const n = dissolveCable ( def . value , bundleId )
clearSelection ( )
commit ( )
notify ( n ? ` Cable removed; ${ n } wire ${ n === 1 ? '' : 's' } run on their own again ` : 'Cable removed' )
}
function setBits ( node : CircuitNode , bits : number ) {
node . bits = Math . min ( MAX_BITS , Math . max ( 2 , Math . round ( bits ) || 2 ) )
commit ( )
2026-10-17 10:49:38 +00:00
}
function table ( ) : TruthTable | { error : string } {
return truthTable ( getDef . value , def . value . id )
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
// ── Projects ──────────────────────────────────────────────────────
function activate ( m : ProjectMeta , p : Project ) {
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
placeholder = false
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
meta . value = m
2026-10-17 10:49:38 +00:00
project . value = p
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
setCurrentId ( m . id )
resetHistory ( )
2026-10-17 10:49:38 +00:00
nav . value = [ ]
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
clearSelection ( )
placing . value = null
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
linking . value = null
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
for ( const k of Object . keys ( views ) ) delete views [ k ]
linkState . value = m . link ? ( m . link . key ? 'saved' : 'viewer' ) : 'none'
projects . value = listProjects ( )
syncUrl ( )
2026-10-17 10:49:38 +00:00
rebuild ( )
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
function switchProject ( id : string ) {
if ( id === meta . value . id ) return
persistNow ( )
const p = loadProject ( id )
const m = listProjects ( ) . find ( x = > x . id === id )
if ( ! p || ! m ) return notify ( 'Could not open that project' , 'error' )
activate ( m , p )
}
function addProject ( p : Project , link? : ProjectMeta [ 'link' ] ) : ProjectMeta {
const m : ProjectMeta = { id : newLocalId ( ) , name : p.name , updated : Date.now ( ) }
if ( link ) m . link = link
saveProject ( m , p )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
scheduleCloud ( )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
return m
}
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
function newProject ( examples : boolean , campaign = false ) {
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
persistNow ( )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
const p = createProject ( { examples , campaign } )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
activate ( addProject ( p ) , p )
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
if ( campaign ) notify ( 'Campaign started: you have NAND. Open Challenges on the left and build NOT first.' )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
}
function duplicateProject ( id : string ) {
persistNow ( )
const p = loadProject ( id )
if ( ! p ) return
p . name = ` ${ p . name } copy `
activate ( addProject ( p ) , p )
}
function deleteProject ( id : string ) {
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
const gone = listProjects ( ) . find ( m = > m . id === id )
if ( gone ? . cloud ) {
setPendingDeletes ( [ . . . pendingDeletes ( ) , { owner : gone.cloud.owner , id } ] )
scheduleCloud ( )
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
removeProject ( id )
projects . value = listProjects ( )
if ( id !== meta . value . id ) return
const next = projects . value [ 0 ]
const p = next && loadProject ( next . id )
if ( next && p ) activate ( next , p )
else {
const fresh = createProject ( { examples : true } )
activate ( addProject ( fresh ) , fresh )
}
}
function renameProject ( id : string , name : string ) {
const clean = name . trim ( ) . slice ( 0 , 80 ) || 'Untitled'
if ( id === meta . value . id ) {
project . value . name = clean
persist ( )
return
}
const p = loadProject ( id )
const m = listProjects ( ) . find ( x = > x . id === id )
if ( ! p || ! m ) return
p . name = clean
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
saveProject ( { . . . m , name : clean , dirty : true } , p )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
projects . value = listProjects ( )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
scheduleCloud ( )
2026-10-17 10:49:38 +00:00
}
function loadExamples() {
const n = addExamples ( project . value )
commit ( )
notify ( n ? ` Added ${ n } example parts ` : 'All examples are already here' )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
function download ( name : string , text : string , type = 'application/json' ) {
const blob = new Blob ( [ text ] , { type } )
2026-10-17 10:49:38 +00:00
const a = document . createElement ( 'a' )
a . href = URL . createObjectURL ( blob )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
a . download = name
2026-10-17 10:49:38 +00:00
a . click ( )
URL . revokeObjectURL ( a . href )
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
const slug = ( name : string , fallback : string ) = > name . toLowerCase ( ) . replace ( /[^a-z0-9]+/g , '-' ) . replace ( /^-|-$/g , '' ) || fallback
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
function exportJson() {
persistNow ( )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
download ( ` ${ slug ( project . value . name , 'project' ) } .logigate.json ` , JSON . stringify ( project . value , null , 1 ) )
}
function exportTable ( t : TruthTable ) {
download ( ` ${ slug ( def . value . name , 'circuit' ) } -truth-table.csv ` , tableCsv ( t ) , 'text/csv' )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
}
/** Opens a project file as a new project in the library. */
async function importAsProject ( file : File ) {
try {
const p = parseProject ( await file . text ( ) )
if ( p . name === 'Untitled' ) p . name = file . name . replace ( /(\.logigate)?\.json$/i , '' )
persistNow ( )
activate ( addProject ( p ) , p )
notify ( ` Opened ${ file . name } ` )
} catch ( e ) {
notify ( ( e as Error ) . message , 'error' )
}
}
/** Adds the components of a project file to the open project. */
async function importComponents ( file : File ) {
try {
const p = parseProject ( await file . text ( ) )
const n = mergeComponents ( project . value , p . components )
commit ( )
notify ( n ? ` Added ${ n } component ${ n === 1 ? '' : 's' } from ${ file . name } ` : 'Nothing new in that file' )
} catch ( e ) {
notify ( ( e as Error ) . message , 'error' )
}
}
// ── Share links ───────────────────────────────────────────────────
const linkState = ref < LinkState > ( meta . value . link ? ( meta . value . link . key ? 'saved' : 'viewer' ) : 'none' )
const linkError = ref ( '' )
const linkUrl = computed ( ( ) = > ( meta . value . link ? ` ${ location . origin } /p/ ${ meta . value . link . id } ` : '' ) )
function syncUrl() {
const path = meta . value . link ? ` /p/ ${ meta . value . link . id } ` : '/'
if ( location . pathname !== path ) history . replaceState ( history . state , '' , path )
}
async function api < T > ( method : string , url : string , body? : unknown , key? : string ) : Promise < T > {
const res = await fetch ( url , {
method ,
headers : { 'content-type' : 'application/json' , . . . ( key ? { 'x-edit-key' : key } : { } ) } ,
body : body === undefined ? undefined : JSON . stringify ( body ) ,
} )
const data = await res . json ( ) . catch ( ( ) = > ( { } ) )
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
if ( ! res . ok ) throw Object . assign ( new Error ( ( data as { message? : string } ) . message || ` Server error ${ res . status } ` ) , { status : res.status } )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
return data as T
}
async function createLink() {
persistNow ( )
linkState . value = 'saving'
2026-10-17 10:49:38 +00:00
try {
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
const res = await api < { id : string ; key : string } > ( 'POST' , '/api/p' , { project : toRaw ( project . value ) } )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
meta . value = { . . . meta . value , link : { id : res.id , key : res.key } , dirty : true }
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
saveMeta ( toRaw ( meta . value ) )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
scheduleCloud ( )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
projects . value = listProjects ( )
linkState . value = 'saved'
syncUrl ( )
} catch ( e ) {
linkError . value = ( e as Error ) . message
linkState . value = 'error'
}
}
let syncTimer : ReturnType < typeof setTimeout > | undefined
let syncing = false
async function pushLink() {
const link = meta . value . link
if ( ! link ? . key ) return
if ( syncing ) return scheduleSync ( )
syncing = true
linkState . value = 'saving'
try {
await api ( 'PUT' , ` /api/p/ ${ link . id } ` , { project : toRaw ( project . value ) } , link . key )
linkState . value = 'saved'
} catch ( e ) {
linkError . value = ( e as Error ) . message
linkState . value = 'error'
} finally {
syncing = false
}
}
/** The person who made a link saves to it automatically, a few seconds after each change. */
function scheduleSync() {
if ( ! meta . value . link ? . key ) return
linkState . value = 'dirty'
clearTimeout ( syncTimer )
syncTimer = setTimeout ( pushLink , 2500 )
}
/** Editing someone else's shared project turns it into your own copy. */
function forkIfViewer() {
if ( ! meta . value . link || meta . value . link . key ) return
meta . value = { . . . meta . value , link : undefined }
saveMeta ( toRaw ( meta . value ) )
linkState . value = 'none'
syncUrl ( )
notify ( 'This is now your own copy. Share it to get your own link.' )
}
/** Opens /p/:id: your own linked project, or a fresh copy of someone else's. */
async function openLink ( id : string ) {
const list = listProjects ( )
const own = list . find ( m = > m . link ? . id === id && m . link . key )
if ( own ) {
if ( own . id !== meta . value . id ) switchProject ( own . id )
return
}
try {
const res = await fetch ( ` /api/p/ ${ encodeURIComponent ( id ) } ` )
if ( ! res . ok ) throw new Error ( res . status === 404 ? 'This link does not exist' : 'Could not load the link' )
const data = ( await res . json ( ) ) as { project : unknown }
const p = toProject ( data . project )
if ( ! placeholder ) persistNow ( )
const viewer = list . find ( m = > m . link ? . id === id && ! m . link . key )
if ( viewer ) {
const m = { . . . viewer , name : p.name , updated : Date.now ( ) }
saveProject ( m , p )
activate ( m , p )
} else activate ( addProject ( p , { id } ) , p )
notify ( ` Opened " ${ p . name } " from a shared link ` )
2026-10-17 10:49:38 +00:00
} catch ( e ) {
notify ( ( e as Error ) . message , 'error' )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
if ( placeholder ) persistNow ( )
syncUrl ( )
}
}
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
async function copyText ( text : string , done = 'Link copied' ) {
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
try {
await navigator . clipboard . writeText ( text )
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
notify ( done )
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
} catch {
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
notify ( 'Copy failed: the browser did not allow it' , 'error' )
2026-10-17 10:49:38 +00:00
}
}
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
window . addEventListener ( 'beforeunload' , ( ) = > {
if ( saveTimer ) persistNow ( )
} )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
// ── Account ───────────────────────────────────────────────────────
// Signed in, every project in this browser is also kept in the account and
// other devices get it on their next sync. Each upload names the revision
// it started from; when another device saved in between, both versions are
// kept (the other one as a copy) instead of one silently replacing the other.
const account = ref < AccountUser | null > ( cachedAccount ( ) )
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
/** False while a signed-in browser is still loading the account's saves at startup: the menu waits, so nothing is started twice. */
const savesReady = ref ( ! account . value )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
const cloudState = ref < 'off' | 'syncing' | 'synced' | 'offline' | 'error' > ( account . value ? 'syncing' : 'off' )
const cloudError = ref ( '' )
function setAccount ( user : AccountUser | null ) {
account . value = user
setCachedAccount ( user )
cloudState . value = user ? cloudState . value : 'off'
}
async function authCall < T > ( method : string , url : string , body? : unknown ) : Promise < T > {
const res = await fetch ( url , {
method ,
headers : { 'content-type' : 'application/json' } ,
body : body === undefined ? undefined : JSON . stringify ( body ) ,
} )
const data = await res . json ( ) . catch ( ( ) = > ( { } ) )
if ( res . status === 401 && url . startsWith ( '/api/me/' ) ) {
setAccount ( null )
notify ( 'You were signed out. Sign in again to keep syncing.' , 'error' )
}
if ( ! res . ok && res . status !== 409 ) throw new Error ( ( data as { message? : string } ) . message || ` Server error ${ res . status } ` )
return { . . . ( data as object ) , status : res.status } as T
}
function localProject ( m : ProjectMeta ) : Project | null {
if ( m . id === meta . value . id ) {
if ( saveTimer ) persistNow ( )
return toRaw ( project . value )
}
return loadProject ( m . id )
}
function updateMeta ( id : string , patch : Partial < ProjectMeta > ) {
const m = listProjects ( ) . find ( x = > x . id === id )
if ( ! m ) return
const next = { . . . m , . . . patch }
if ( patch . dirty === false ) delete next . dirty
saveMeta ( next )
if ( id === meta . value . id ) meta . value = { . . . meta . value , . . . patch }
}
interface CloudMeta {
id : string
name : string
updated : number
rev : number
link? : ProjectMeta [ 'link' ]
}
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
/** Replaces this browser's copy of a project with the account's current one. */
async function takeRemote ( m : ProjectMeta , uid : string , remote : CloudMeta ) {
const res = await authCall < { project? : Project ; status : number } > ( 'GET' , ` /api/me/projects/ ${ m . id } ` )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
if ( ! res . project ) return
const p = toProject ( res . project )
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
const next : ProjectMeta = { . . . m , name : p.name , updated : remote.updated , cloud : { owner : uid , rev : remote.rev } }
delete next . dirty
delete next . snapshot
saveProject ( next , p )
if ( m . id === meta . value . id ) activate ( next , p )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
}
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
/ * *
* One save per project on every device . When another device saved the same
* project in between , the newer save wins everywhere , and the other one is
* kept as a savegame of that project ( Load → savegames ) , never as a copy .
* /
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
async function upload ( m : ProjectMeta , uid : string ) {
const p = localProject ( m )
if ( ! p ) return
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
const baseRev = m . cloud ? . owner === uid ? m.cloud.rev : 0
const body = { project : p , baseRev , link : m.link , snapshot : m.snapshot === true }
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
let res = await authCall < { meta? : CloudMeta ; conflict? : boolean ; status : number } > ( 'PUT' , ` /api/me/projects/ ${ m . id } ` , body )
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
if ( res . conflict && res . meta ) {
if ( res . meta . updated > m . updated ) {
// The other device's save is newer: this one becomes a savegame.
await authCall ( 'POST' , ` /api/me/projects/ ${ m . id } /versions ` , { project : p , baseRev } )
await takeRemote ( m , uid , res . meta )
notify ( ` " ${ m . name } " was changed later on another device and is loaded now. Your version here is in its savegames. ` )
return
}
// This save is newer: it wins, and the server keeps the other one as a savegame.
res = await authCall ( 'PUT' , ` /api/me/projects/ ${ m . id } ` , { . . . body , force : true , snapshot : true } )
notify ( ` " ${ m . name } " was also changed on another device. Yours is newer and saved; the other one is in its savegames. ` )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
}
2026-10-20 11:20:55 +00:00
if ( res . meta ) updateMeta ( m . id , { cloud : { owner : uid , rev : res.meta.rev } , dirty : false , snapshot : undefined } )
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
}
let syncingAccount = false
let syncAgain = false
/** Brings this browser and the account up to date in both directions. */
async function syncAccount() {
const uid = account . value ? . id
if ( ! uid ) return
if ( syncingAccount ) {
syncAgain = true
return
}
syncingAccount = true
cloudState . value = 'syncing'
try {
if ( saveTimer ) persistNow ( )
for ( const d of pendingDeletes ( ) . filter ( d = > d . owner === uid ) ) {
await authCall ( 'DELETE' , ` /api/me/projects/ ${ d . id } ` ) . catch ( ( ) = > { } )
}
setPendingDeletes ( pendingDeletes ( ) . filter ( d = > d . owner !== uid ) )
const remote = await authCall < { projects : CloudMeta [ ] ; deleted : { id : string } [ ] ; status : number } > ( 'GET' , '/api/me/projects' )
if ( ! account . value ) return
// Deleted on another device.
for ( const t of remote . deleted ) {
const m = listProjects ( ) . find ( x = > x . id === t . id && x . cloud ? . owner === uid )
if ( m && ! m . dirty ) {
if ( m . id === meta . value . id ) {
notify ( ` " ${ m . name } " was deleted on another device ` )
deleteProject ( m . id )
} else removeProject ( m . id )
}
}
// New or newer in the account.
for ( const r of remote . projects ) {
const m = listProjects ( ) . find ( x = > x . id === r . id )
if ( m && ( ( m . cloud && m . cloud . owner !== uid ) || m . dirty || ( m . cloud ? . rev ? ? 0 ) >= r . rev ) ) continue
const res = await authCall < { project? : Project ; status : number } > ( 'GET' , ` /api/me/projects/ ${ r . id } ` )
if ( ! res . project ) continue
const p = toProject ( res . project )
const next : ProjectMeta = { id : r.id , name : p.name , updated : r.updated , cloud : { owner : uid , rev : r.rev } }
const link = r . link ? ? m ? . link
if ( link ) next . link = link
saveProject ( next , p )
if ( r . id === meta . value . id ) {
activate ( next , p )
notify ( ` Updated " ${ p . name } " from another device ` )
}
}
// Projects that are new here or changed here (not the untouched starter project).
for ( const m of listProjects ( ) ) {
if ( ( m . cloud && m . cloud . owner !== uid ) || ( m . starter && ! m . dirty ) ) continue
if ( ! m . cloud || m . dirty ) await upload ( m , uid )
}
// A new browser: open the account's latest project instead of the untouched starter.
if ( meta . value . starter && ! meta . value . dirty ) {
const latest = listProjects ( ) . filter ( m = > m . cloud ? . owner === uid ) . sort ( ( a , b ) = > b . updated - a . updated ) [ 0 ]
const p = latest && loadProject ( latest . id )
if ( latest && p ) {
const starter = meta . value . id
activate ( latest , p )
removeProject ( starter )
}
}
projects . value = listProjects ( )
cloudState . value = 'synced'
cloudError . value = ''
} catch ( e ) {
cloudError . value = ( e as Error ) . message
cloudState . value = navigator . onLine ? 'error' : 'offline'
} finally {
syncingAccount = false
if ( syncAgain ) {
syncAgain = false
void syncAccount ( )
}
}
}
let cloudTimer : ReturnType < typeof setTimeout > | undefined
function scheduleCloud() {
if ( ! account . value ) return
clearTimeout ( cloudTimer )
cloudTimer = setTimeout ( syncAccount , 2000 )
}
async function signIn ( email : string , password : string , create : boolean ) {
const res = await authCall < { user? : AccountUser ; message? : string ; status : number } > ( 'POST' , create ? '/api/auth/register' : '/api/auth/login' , { email , password } )
if ( ! res . user ) throw new Error ( res . message || 'Could not sign in' )
setAccount ( res . user )
await syncAccount ( )
notify ( create ? 'Account created. Your projects are now saved in it.' : ` Signed in as ${ res . user . email } ` )
}
async function signOut ( removeHere : boolean ) {
const uid = account . value ? . id
if ( uid ) await syncAccount ( )
await authCall ( 'POST' , '/api/auth/logout' ) . catch ( ( ) = > { } )
setAccount ( null )
if ( removeHere && uid ) {
for ( const m of listProjects ( ) ) if ( m . cloud ? . owner === uid && ! m . dirty ) removeProject ( m . id )
projects . value = listProjects ( )
if ( ! projects . value . some ( m = > m . id === meta . value . id ) ) deleteProject ( meta . value . id )
}
notify ( 'Signed out' )
}
async function changePassword ( current : string , next : string ) {
await authCall ( 'POST' , '/api/auth/password' , { current , next } )
notify ( 'Password changed. Other devices need to sign in again.' )
}
async function deleteAccount ( password : string ) {
const uid = account . value ? . id
await authCall ( 'POST' , '/api/auth/delete' , { password } )
setAccount ( null )
// The projects stay in this browser, now as local-only projects.
for ( const m of listProjects ( ) ) {
if ( m . cloud ? . owner !== uid ) continue
const next = { . . . m }
delete next . cloud
saveMeta ( next )
}
if ( meta . value . cloud ? . owner === uid ) {
const next = { . . . meta . value }
delete next . cloud
meta . value = next
}
projects . value = listProjects ( )
notify ( 'Account deleted. Your projects are still in this browser.' )
}
2026-10-20 11:20:55 +00:00
// ── Savegames ─────────────────────────────────────────────────────
interface VersionInfo {
v : number
at : number
rev : number
name : string
size : number
}
async function listVersions ( projectId : string ) : Promise < VersionInfo [ ] > {
const res = await authCall < { versions : VersionInfo [ ] ; status : number } > ( 'GET' , ` /api/me/projects/ ${ projectId } /versions ` )
return res . versions ? ? [ ]
}
async function fetchVersion ( projectId : string , v : number ) : Promise < Project > {
const res = await authCall < { version ? : { project : unknown } ; status : number } > ( 'GET' , ` /api/me/projects/ ${ projectId } /versions/ ${ v } ` )
if ( ! res . version ) throw new Error ( 'Version not found' )
return toProject ( res . version . project )
}
/ * *
* Brings back a savegame : as a new project , or in place of the current
* state ( which the server keeps as a savegame first , so this can be undone ) .
* /
async function restoreVersion ( projectId : string , v : number , asCopy : boolean ) {
if ( projectId === meta . value . id && saveTimer ) persistNow ( )
const p = await fetchVersion ( projectId , v )
if ( asCopy ) {
p . name = ` ${ p . name } ( ${ new Date ( v ) . toLocaleDateString ( ) } ) `
activate ( addProject ( p ) , p )
notify ( ` Opened the saved version as " ${ p . name } " ` )
return
}
const m = listProjects ( ) . find ( x = > x . id === projectId )
if ( ! m ) return
const next : ProjectMeta = { . . . m , name : p.name , updated : Date.now ( ) , dirty : true , snapshot : true }
saveProject ( next , p )
activate ( next , p )
scheduleCloud ( )
notify ( 'Restored. The state before is kept as a savegame too.' )
}
async function listTrash ( ) : Promise < { id : string ; name : string ; deleted : number ; v : number } [ ] > {
const res = await authCall < { projects : { id : string ; name : string ; deleted : number ; v : number } [ ] ; status : number } > ( 'GET' , '/api/me/trash' )
return res . projects ? ? [ ]
}
async function restoreDeleted ( item : { id : string ; v : number } ) {
const p = await fetchVersion ( item . id , item . v )
persistNow ( )
setPendingDeletes ( pendingDeletes ( ) . filter ( d = > d . id !== item . id ) )
const m : ProjectMeta = { id : item.id , name : p.name , updated : Date.now ( ) , dirty : true }
saveProject ( m , p )
activate ( m , p )
scheduleCloud ( )
notify ( ` " ${ p . name } " is back ` )
}
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
/** Checks the session with the server, then syncs; again on focus and every minute. */
async function startAccount() {
try {
const res = await authCall < { user : AccountUser | null ; status : number } > ( 'GET' , '/api/auth/me' )
setAccount ( res . user )
if ( res . user ) await syncAccount ( )
} catch {
if ( account . value ) cloudState . value = 'offline'
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
} finally {
savesReady . value = true
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
}
let lastFocusSync = Date . now ( )
const onFocus = ( ) = > {
if ( document . visibilityState === 'visible' && Date . now ( ) - lastFocusSync > 10 _000 ) {
lastFocusSync = Date . now ( )
void syncAccount ( )
}
}
document . addEventListener ( 'visibilitychange' , onFocus )
window . addEventListener ( 'online' , ( ) = > void syncAccount ( ) )
setInterval ( ( ) = > document . visibilityState === 'visible' && void syncAccount ( ) , 60 _000 )
}
2026-10-17 10:49:38 +00:00
function shape ( node : CircuitNode ) {
return shapeOf ( node , getDef . value )
}
rebuild ( )
return {
project ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
meta ,
projects ,
2026-10-17 10:49:38 +00:00
getDef ,
def ,
selection ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
wireSel ,
selectedWires ,
clearSelection ,
2026-10-17 10:49:38 +00:00
placing ,
nav ,
views ,
notice ,
labelFocus ,
showHelp ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
dialog ,
2026-10-17 10:49:38 +00:00
notify ,
commit ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
persist ,
2026-10-17 10:49:38 +00:00
undo ,
redo ,
canUndo ,
canRedo ,
sim ,
tick ,
status ,
running ,
hz ,
cycles ,
errors ,
circuitStats ,
val ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
faceVal ,
2026-10-17 10:49:38 +00:00
startLoop ,
step ,
rebuild ,
open ,
back ,
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
mainId ,
goMain ,
goTo ,
2026-10-17 10:49:38 +00:00
addNode ,
canPlace ,
connect ,
deleteSelected ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
setWireColor ,
autoRoute ,
selectNet ,
2026-10-17 10:49:38 +00:00
toggleInput ,
press ,
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
toggleRow ,
pressRow ,
addPanel ,
undock ,
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
mergeSelectedPanels ,
2026-10-21 12:38:59 +00:00
combineSelected ,
setRowsType ,
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
setScreen ,
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
screen ,
menuPage ,
R Top bar like the parts bar, no left panel
The parts panel on the left is gone: pinned parts sit at the start of the
bottom bar, components open from the pencil in its Components list (or a
double-click), examples load from there too. The side panel moved to the
left. The top bar floats across the whole width: menu with the project,
Main and the way into the open component instead of the circuit
selector, Challenges in a drop-down, clock, search, undo, settings,
share and account. / and the bar's search open quick add.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:17:41 +00:00
challengesOpen ,
A main menu: free play, campaign, challenges and leaderboard over a circuit that builds itself
Logigate opens on a title screen. Continue, Free play (your own projects),
Campaign (progress and what is next), Challenges (every challenge and the
puzzle of the week in one Challenges project), Leaderboard (the best ten of
this and earlier weeks, your place, your records), Settings. Arrow keys,
Enter and Esc work through it; links still open straight into the editor.
Players can name themselves on the leaderboards. The logo in the editor
leads back to the menu.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 10:22:35 +00:00
enterGame ,
showMenu ,
projectMode ,
projectOf ,
playCampaign ,
playChallenge ,
playWeekly ,
playerName ,
setPlayerName ,
fetchBoard ,
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
setRowType ,
addRow ,
dropRow ,
2026-10-23 10:59:16 +00:00
insertRow ,
moveRowTo ,
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
withDocked ,
2026-10-21 09:51:45 +00:00
withFollowers ,
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
issues ,
showIssue ,
sheetRequest ,
exportSheet ,
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
faceFor ,
designFace ,
2026-10-21 10:16:26 +00:00
fits ,
fitHover ,
connectFit ,
2026-10-21 09:51:45 +00:00
unplugMoved ,
2026-10-23 13:34:36 +00:00
latchTargetOf ,
latchPart ,
unlatch ,
2026-10-21 09:51:45 +00:00
moveRow ,
setRowGap ,
setRowKey ,
setRowColor ,
plugTarget ,
plugEnd ,
unplugEnd ,
setPitch ,
addCablePanel ,
2026-10-21 12:21:40 +00:00
dragPart ,
A finer component boxes, a regrouped parts list with keyboard search, a real green for wires and cables
- Box designer: drag pins up or down to open gaps between groups; size (+/−) and turn (R) lamps, displays, screens and drawings; pixels belong to named screens, each placed on its own; displays of the components inside can be shown on the box (off unless ticked); a list of everything the box can show, each optional; the box grows to hold what it shows
- Lamps and displays deep inside placed components light up on the box
- Parts list: one search box for parts and components (letters in order match too), recently placed parts first, grouped Logic / Inputs / Outputs / Wiring / Notes, then components by group; groups fold away
- Keys: / searches the parts list (Enter starts placing), Shift+A or Ctrl+K adds a part at the mouse
- Wires and cables get a green; the default swatch shows grey, as the default really is
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 04:48:42 +00:00
partSearch ,
2026-10-21 12:13:24 +00:00
cableChoices ,
cableOut ,
cableIn ,
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
linking ,
startLinking ,
linkTo ,
stopLinking ,
setTidy ,
tidyAll ,
2026-10-23 12:57:16 +00:00
tidyEverything ,
A input panels, automatic names, one-by-one wiring, tidy routing, truth table export
- Input panel part: rows of switches, buttons and clocks. "Attach input
panel" docks one to a component with a row per free input; it moves
with the component and follows its pins.
- Copies and new pins continue name series (D0 -> D1, A -> B); unnamed
switches, lamps and pins take the name of the component pin they are
wired to.
- Connecting: target pins are ringed, dropping on a part uses its next
free pin, click-then-click works, and "Connect one by one" (W) wires a
selection's pins in turn.
- Tidy wiring option and "Tidy all wires": sorted, evenly spaced columns
per gap, one trunk per signal, fewer crossings.
- Truth table full screen, CSV download, copy as Markdown, current row
highlighted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:17:25 +00:00
exportTable ,
2026-10-20 17:29:16 +00:00
transistors ,
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
transistorsOfNode ,
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
toggleInvert ,
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
nands ,
R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and
Check on top, problems, name, statistics, truth table, as a component,
transistors, tools) and Pins. The selection gets its own panel on the
right, there only while something is selected, with its settings and
actions such as making a component out of it. The bars follow the
canvas width and drop labels when it gets narrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:17 +00:00
panelTab ,
panelOpen ,
togglePanel ,
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
focusRequest ,
swapMany ,
2026-10-21 08:09:43 +00:00
connectMany ,
connectSelectionTo ,
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
rewire ,
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
renameMany ,
setLabel ,
setSwitches ,
patchMany ,
arrangeSelected ,
selectOnly ,
focusNode ,
A Loxone-style working aids: named signals, inverted inputs, a project check, values on cables, search, printable sheets; wire ends move by dragging
- 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) <noreply@anthropic.com>
2026-10-21 11:26:59 +00:00
useSignal ,
selectSignal ,
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
canPlaceKind ,
R saves like a game: one save per project on every device, Load game in the menu, a pause menu, and a lean side panel
- Sync: when two devices changed the same project, the newer save wins
everywhere and the other becomes a savegame of it (new endpoint to keep
a savegame without replacing the save), never an "(other device)" copy.
A first visit keeps its starter unsaved until something changes, and
the main menu waits for the account's saves before anything starts.
- Main menu: Load game lists every save. In the editor, Esc with nothing
selected (or the project button) opens a pause menu: Resume, Save,
Save as copy, Load, Settings, How to play, Main menu. The projects
dialog is gone.
- Selection tab: name and transistors on top, one icon row (open,
duplicate, unlink, delete, more = the right-click menu), only the
settings that matter for the part; pins, component tools, keys, cable
and panel options fold away and remember it. X/Y fields removed.
The Circuit tab folds its component settings, transistor breakdown
and tools the same way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:36:17 +00:00
paused ,
pause ,
saveNow ,
savesReady ,
2026-10-20 18:09:23 +00:00
setInputs ,
A campaign with unlocks, synthesised sound, puzzles and the puzzle of the week
- Campaign projects start with NAND only; challenges open along a
dependency chain, each solution becomes a usable part, and basic parts
unlock on the way. Locked parts and challenges say what opens them.
- Sound effects made with Web Audio: place, connect, switches, buttons,
delete, clock ticks (opt-in), solve, fail, unlock, record. Mute and
volume in the top bar and Display settings.
- Publish any circuit as a puzzle link; only its behaviour is shared.
The server re-runs the checks on submitted solutions, counts their
transistors and keeps each player's best; the board shows a histogram
and your place. A generated puzzle of the week for everyone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 17:54:57 +00:00
sound ,
setSound ,
play ,
task ,
boards ,
loadBoard ,
beginPuzzle ,
openPuzzle ,
publishPuzzle ,
A public library of components: publish yours, add everybody's
"Publish to the library…" in the menu on a circuit's name (or Space)
sends the component with every component it uses and their connector
types, under your leaderboard name. The server checks it like any
project, refuses what is missing, inside itself, nested too deep or too
big to run, and counts its transistors and pins itself. Publishing again
from the same browser makes the next version of the same entry; only that
browser holds the entry's key, so only it can update or remove it.
Challenge circuits and puzzle solutions stay private.
The Library (Components in the bottom bar, Space, the main menu) lists
every entry, newest first, searchable by name, description and author,
with a picture of its box, its transistors, pins and what comes along.
Add brings an entry into the open project and starts placing it: what the
project has in exactly that form already is used as it is, the rest comes
with new ids, a taken name gets a number, connector types join one with
the same lines. The This panel says where a component came from and
offers a newer version, which replaces it in place. A campaign only adds
what is built from parts it has earned, and its challenges take nothing
from the library.
Components keep an optional "from" mark; projects without it load and
compute as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:14:46 +00:00
ownEntry ,
libraryProblem ,
listLibrary ,
publishToLibrary ,
removeFromLibrary ,
addFromLibrary ,
updateFromLibrary ,
libraryVersion ,
libKeys ,
2026-10-20 17:29:16 +00:00
isBus ,
2026-10-22 16:59:56 +00:00
pinKind ,
connectorFor ,
addConnector ,
editConnector ,
connectorUses ,
removeConnector ,
2026-10-20 17:29:16 +00:00
bundleSelected ,
2026-10-21 08:39:54 +00:00
cabling ,
startCable ,
placeCable ,
setCableColor ,
2026-10-20 17:29:16 +00:00
removeCable ,
setBits ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
swap ,
unlink ,
unpack ,
makeIndependent ,
2026-10-17 10:49:38 +00:00
copy ,
paste ,
A right-click menu for parts, wires and the canvas, "Wire them all to" as cards, plugged latches in plain greys
- Right click (or the menu key) shows what can be done with what is under the pointer: one part (open, rename, change to, inputs, colour, speed, panels, unpack, plug and unplug, cable colour), several parts (wire them all to with live preview, connect one by one, switches, change all, arrange, keep only, make a component), wires (bundle, colour, whole signal, straighten, remove cable) or empty canvas (paste here, add a part here, select all, fit, tidy, undo); right drag still moves the view
- "Wire them all to": a card per part, each fit a strip of its pins, and which wire goes where for the fit pointed at
- Plugged cable ends no longer look selected: grey connector, steel clips
- Icons named in menus are bundled for the browser too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 10:33:30 +00:00
hasClip ,
2026-10-17 10:49:38 +00:00
duplicate ,
selectAll ,
packageSelected ,
createComponent ,
removeComponent ,
copyComponent ,
beginChallenge ,
checkChallenge ,
table ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
switchProject ,
2026-10-17 10:49:38 +00:00
newProject ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
duplicateProject ,
deleteProject ,
renameProject ,
2026-10-17 10:49:38 +00:00
loadExamples ,
exportJson ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
importAsProject ,
importComponents ,
linkState ,
linkError ,
linkUrl ,
createLink ,
pushLink ,
openLink ,
syncUrl ,
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
account ,
cloudState ,
cloudError ,
syncAccount ,
signIn ,
signOut ,
changePassword ,
deleteAccount ,
startAccount ,
2026-10-20 11:20:55 +00:00
versionsFor ,
listVersions ,
restoreVersion ,
listTrash ,
restoreDeleted ,
A component faces, project library with share links, fine-grained wire editing
- Lamps and hex displays inside a component show on its box with their
labels, lit by that instance's state; Counter 4 example shows its count.
- Several projects per browser; share links at /p/<id> that the creator's
edits save to automatically, others get their own copy. Export, open a
file as project, or add a file's components to the open project.
- Wires: drag any segment or corner, Alt+drag for a new bend, Ctrl+drag to
branch, double-click selects the whole signal, multi-select, arrow keys,
colour tags.
- Share-link API (POST/GET/PUT /api/p) on Nitro fs storage in data/, mounted
as a volume on edgerealm.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:21:49 +00:00
copyText ,
2026-10-17 10:49:38 +00:00
shape ,
}
}
let editor : ReturnType < typeof create > | undefined
export function useEditor() {
editor ? ? = create ( )
return editor
}