R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< script setup lang = "ts" >
// The floating bar at the bottom of the canvas, like Figma's toolbar: one
// button per kind of part. Pointing at one opens its parts above it; click
// a part to place it (or drag it onto the canvas), pin it to keep it on the
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
// bar itself. Components and your connector types have their own buttons.
2026-10-23 10:33:47 +00:00
// Parts and components show as drawn tiles in a strip, like a city
// builder's: the mouse wheel scrolls it sideways.
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
import { shortCount } from '~/lib/logic/analyze'
import { BASIC _GROUPS } from '~/composables/useParts'
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
import { unusedComponents } from '~/lib/logic/check'
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
import type { ComponentDef , NodeKind } from '~/lib/logic/types'
const ed = useEditor ( )
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
const { place , dragStart , dragEnd , isPinned , togglePin , pinned , unpin } = usePlace ( )
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
const { componentGroups } = useParts ( )
const ICONS : Record < string , string > = {
Logic : 'lucide:square-function' ,
Inputs : 'lucide:toggle-left' ,
Outputs : 'lucide:lightbulb' ,
Wiring : 'lucide:spline' ,
Notes : 'lucide:sticky-note' ,
}
type Cat = { id : string ; label : string ; icon : string }
const cats = computed < Cat [ ] > ( ( ) => [
... BASIC _GROUPS . map ( g => ( { id : g . name , label : g . name , icon : ICONS [ g . name ] ? ? 'lucide:shapes' } ) ) ,
{ id : 'connectors' , label : 'Connectors' , icon : 'lucide:plug' } ,
{ id : 'components' , label : 'Components' , icon : 'lucide:boxes' } ,
] )
// ── Flyout: opens on pointing, stays while the pointer is over it ──
const open = ref < string | null > ( null )
let timer : ReturnType < typeof setTimeout > | undefined
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
const dock = ref < HTMLElement > ( )
2026-10-23 10:33:47 +00:00
const fly = ref < HTMLElement > ( )
/** Pointer position along the dock, the dock's width and the flyout's, in px. */
const at = ref ( { x : 0 , dock : 0 , fly : 250 } )
/** Where the flyout opens: centred above the pointer, kept inside the canvas. */
const anchor = computed ( ( ) => {
const half = at . value . fly / 2
return Math . min ( Math . max ( at . value . x , half ) , Math . max ( half , at . value . dock - half ) )
} )
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
function anchorAt ( x : number ) {
const r = dock . value ! . getBoundingClientRect ( )
2026-10-23 10:33:47 +00:00
at . value = { ... at . value , x : x - r . left , dock : r . width }
}
function measure ( ) {
if ( fly . value ) at . value = { ... at . value , fly : fly . value . offsetWidth }
const el = strip . value
edges . value = el ? { left : el . scrollLeft > 4 , right : el . scrollLeft + el . clientWidth < el . scrollWidth - 4 } : { left : false , right : false }
}
// ── The strip of tiles: sideways with the wheel, arrows at the ends ──
const strip = ref < HTMLElement > ( )
const edges = ref ( { left : false , right : false } )
function onWheel ( e : WheelEvent ) {
const el = strip . value
if ( ! el || Math . abs ( e . deltaX ) > Math . abs ( e . deltaY ) ) return
e . preventDefault ( )
el . scrollLeft += e . deltaY
}
2026-10-23 10:43:08 +00:00
/** Pinned parts that do not fit: the wheel scrolls them sideways too. */
function sideways ( e : WheelEvent ) {
const el = e . currentTarget as HTMLElement
if ( el . scrollWidth <= el . clientWidth || Math . abs ( e . deltaX ) > Math . abs ( e . deltaY ) ) return
e . preventDefault ( )
el . scrollLeft += e . deltaY
}
2026-10-23 10:33:47 +00:00
function page ( dir : number ) {
strip . value ? . scrollBy ( { left : dir * strip . value . clientWidth * 0.8 , behavior : 'smooth' } )
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
}
2026-10-23 10:33:47 +00:00
const placeable = ( d : ComponentDef ) => d . id !== ed . def . value . id && ed . canPlace ( d . id )
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
/** Components placed nowhere (not the open one, Main, examples or challenges): a tab of their own, to clear out. */
const UNUSED = 'unused'
const unused = computed ( ( ) => unusedComponents ( ed . project . value ) . filter ( d => d . id !== ed . def . value . id && d . id !== ed . mainId . value ) )
const confirmDrop = ref < string | null > ( null )
function drop ( d : ComponentDef ) {
if ( confirmDrop . value !== d . id ) return ( confirmDrop . value = d . id )
confirmDrop . value = null
ed . removeComponent ( d . id )
ed . notify ( ` Deleted " ${ d . name } " (Ctrl+Z brings it back) ` )
}
2026-10-23 10:33:47 +00:00
/** The component group shown; your own components first. */
const compTab = ref ( '' )
const compGroup = computed (
( ) =>
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
( compTab . value === UNUSED && unused . value . length ? { name : 'Unused' , defs : unused . value } : undefined ) ? ?
2026-10-23 10:33:47 +00:00
componentGroups . value . find ( g => g . name === compTab . value ) ? ?
// Untouched: the first group with something that can go in here.
componentGroups . value . find ( g => g . defs . some ( placeable ) ) ? ?
componentGroups . value [ 0 ] ,
)
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
function show ( id : string , e : PointerEvent ) {
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
clearTimeout ( timer )
const go = ( ) => {
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
if ( open . value !== id ) anchorAt ( e . clientX )
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
open . value = id
}
// Moving along the bar switches at once; the first one waits a moment.
if ( open . value ) go ( )
else timer = setTimeout ( go , 110 )
}
function leave ( ) {
clearTimeout ( timer )
2026-10-23 10:33:47 +00:00
// While a part is dragged out of it, the flyout stays (it closes when the drag ends).
if ( ed . dragPart . value ) return
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
timer = setTimeout ( ( ) => ( open . value = null ) , 220 )
}
function stay ( ) {
clearTimeout ( timer )
}
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
function toggle ( id : string , e : MouseEvent ) {
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
if ( open . value === id ) open . value = null
else {
clearTimeout ( timer )
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
anchorAt ( e . clientX )
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
open . value = id
}
}
function pick ( kind : NodeKind , chip ? : string , conn ? : string ) {
place ( kind , chip , conn )
open . value = null
}
2026-10-23 10:33:47 +00:00
function endDrag ( ) {
dragEnd ( )
open . value = null
}
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
/** Which button the part being placed belongs to, to show it as active. */
const activeCat = computed ( ( ) => {
const p = ed . placing . value
if ( ! p ) return null
if ( p . kind === 'chip' ) return 'components'
if ( p . kind === 'portin' || p . kind === 'portout' ) return 'connectors'
return BASIC _GROUPS . find ( g => g . parts . some ( x => x . kind === p . kind ) ) ? . name ? ? null
} )
const group = computed ( ( ) => BASIC _GROUPS . find ( g => g . name === open . value ) )
2026-10-23 10:43:08 +00:00
/** Components that belong with a kind of part: gates (drawn as one, or in the Gates group) under Logic. */
const groupComps = computed ( ( ) =>
open . value === 'Logic' ? ed . project . value . components . filter ( d => d . group ? . trim ( ) === 'Gates' || ( d . symbol && d . symbol !== 'box' ) ) : [ ] ,
)
watch ( [ open , compTab , ( ) => compGroup . value ? . defs . length , ( ) => groupComps . value . length ] , ( ) => nextTick ( measure ) )
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
const connectors = computed ( ( ) => ed . project . value . connectors ? ? [ ] )
const portsOk = computed ( ( ) => ed . canPlaceKind ( 'portin' ) )
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
// Pinned parts sit on the bar; a pinned component this project lacks is left out.
const shown = computed ( ( ) => pinned . value . filter ( p => p . kind !== 'chip' || p . chip ) )
const named = ( p : { kind : NodeKind } ) => p . kind === 'chip' || p . kind === 'nand'
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
function onKey ( e : KeyboardEvent ) {
if ( e . key === 'Escape' && open . value ) {
open . value = null
e . stopPropagation ( )
}
}
onMounted ( ( ) => window . addEventListener ( 'keydown' , onKey , true ) )
onBeforeUnmount ( ( ) => window . removeEventListener ( 'keydown' , onKey , true ) )
< / script >
< template >
R Packed panels, Tab adds rows, flyouts at the pointer, steady top bar
Combining switches, buttons, lamps or outputs into a panel, and merging
panels, puts the rows right under each other (space 0). Tab in the last
row's name of a panel, or the last line of a connector type, adds the
next one once it is filled in. The bottom bar's lists open centred above
the pointer. The top bar keeps the width it has with both panels open,
centred, so it no longer grows and shrinks with the panels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 20:47:38 +00:00
< div ref = "dock" class = "bottom-dock" @ pointerdown.stop >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< Transition name = "flyout" >
2026-10-23 10:33:47 +00:00
< div v-if ="open" ref="fly" class="flyout" :class="{ 'part-flyout': open !== 'connectors' }" :style="{ left: `${anchor}px` }" @pointerenter="stay" @pointerleave="leave" >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
<!-- Built - in parts -- >
< template v-if ="group" >
< p class = "flyout-head" > { { group . name } } < / p >
2026-10-23 10:33:47 +00:00
< div class = "strip-wrap" >
< button v-if ="edges.left" class="strip-arrow left" title="Scroll left" @click="page(-1)" > < Icon name = "lucide:chevron-left" class = "size-4" / > < / button >
< div ref = "strip" class = "part-strip" @wheel ="onWheel" @scroll ="measure" >
< div v-for ="p in group.parts" :key="p.kind" class="part-slot" >
< button
class = "part-tile"
: class = "{ blocked: !ed.canPlaceKind(p.kind), active: ed.placing.value?.kind === p.kind && !ed.placing.value?.chip }"
: title = "p.hint"
draggable = "true"
@ click = "pick(p.kind)"
@ dragstart = "dragStart($event, p.kind)"
@ dragend = "endDrag"
>
< span class = "part-art" > < EditorPartThumb :kind ="p.kind" / > < / span >
< span class = "part-name" > { { p . name } } < / span >
< kbd v-if ="p.key" class="part-key" > {{ p.key }} < / kbd >
< Icon v -if = " ! ed.canPlaceKind ( p.kind ) " name = "lucide:lock" class = "part-lock size-3.5" / >
< / button >
< button class = "pin-btn" : class = "{ on: isPinned(p.kind) }" : title = "isPinned(p.kind) ? 'Unpin from the bar' : 'Pin to the bar, to have it at hand'" @click ="togglePin(p.kind)" >
< Icon : name = "isPinned(p.kind) ? 'lucide:pin-off' : 'lucide:pin'" class = "size-3.5" / >
< / button >
< / div >
2026-10-23 10:43:08 +00:00
< div v-for ="d in groupComps" :key="d.id" class="part-slot" >
< button
class = "part-tile"
: class = "{ blocked: !placeable(d), active: ed.placing.value?.chip === d.id }"
: title = "d.id === ed.def.value.id ? 'You are editing this one' : d.description || ''"
: draggable = "placeable(d)"
@ click = "pick('chip', d.id)"
@ dragstart = "dragStart($event, 'chip', d.id)"
@ dragend = "endDrag"
>
< span class = "part-art" > < EditorPartThumb kind = "chip" :chip ="d.id" / > < / span >
< span class = "part-name" > { { d . name } } < / span >
< span v-if ="d.id === ed.def.value.id" class="part-meta" > editing < / span >
< span v -else -if = " ed.transistors ( d.id ) " class = "part-meta" > { { shortCount ( ed . transistors ( d . id ) ) } } transistors < / span >
< / button >
< button class = "pin-btn" : class = "{ on: isPinned('chip', d) }" : title = "isPinned('chip', d) ? 'Unpin from the bar' : 'Pin to the bar'" @ click = "togglePin('chip', d)" >
< Icon : name = "isPinned('chip', d) ? 'lucide:pin-off' : 'lucide:pin'" class = "size-3.5" / >
< / button >
< / div >
2026-10-23 10:33:47 +00:00
< / div >
< button v-if ="edges.right" class="strip-arrow right" title="Scroll right" @click="page(1)" > < Icon name = "lucide:chevron-right" class = "size-4" / > < / button >
< / div >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< / template >
<!-- Connector types -- >
< template v -else -if = " open = = = ' connectors ' " >
< p class = "flyout-head" > Connectors < / p >
< p v-if ="!connectors.length" class="flyout-empty" > Make a cable type of your own : HDMI , RJ45 , a bus. It gets an Out and an In port. < / p >
< ul class = "flyout-list" >
< li v-for ="c in connectors" :key="c.id" >
< span class = "flyout-item static" >
< span class = "conn-swatch" : class = "c.color ? `c-${c.color}` : ''" / >
< span class = "grow truncate" > { { c . name } } < / span >
< span class = "flyout-note" > { { c . lines . length } } lines < / span >
< / span >
< button
v - for = "side in ['portout', 'portin'] as const"
: key = "side"
class = "btn-sm"
: disabled = "!portsOk"
draggable = "true"
: title = "side === 'portout' ? `Where a ${c.name} cable leaves this circuit` : `Where a ${c.name} cable comes in`"
@ click = "pick(side, undefined, c.id)"
@ dragstart = "dragStart($event, side, undefined, c.id)"
@ dragend = "dragEnd"
>
{ { side === 'portout' ? 'Out' : 'In' } }
< / button >
< button class = "pin-btn" title = "Edit its name, colour and lines" @ click = "ed.editConnector(c.id), (open = null)" > < Icon name = "lucide:pencil" class = "size-3.5" / > < / button >
< / li >
< / ul >
< button class = "flyout-new" :disabled ="!portsOk" @ click = "ed.addConnector(), (open = null)" > < Icon name = "lucide:plus" class = "size-4" / > New connector type < / button >
< / template >
<!-- Components , by group -- >
< template v -else -if = " open = = = ' components ' " >
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
< div v-if ="componentGroups.length > 1 || unused.length" class="part-tabs" role="tablist" >
2026-10-23 10:33:47 +00:00
< button
v - for = "g in componentGroups"
: key = "g.name"
role = "tab"
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
: aria - selected = "compGroup?.name === g.name && compTab !== UNUSED"
: class = "{ active: compGroup?.name === g.name && compTab !== UNUSED }"
2026-10-23 10:33:47 +00:00
@ click = "compTab = g.name"
>
{ { g . name } } < span class = "count" > { { g . defs . length } } < / span >
< / button >
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
< button
v - if = "unused.length"
role = "tab"
class = "unused-tab"
: aria - selected = "compTab === UNUSED"
: class = "{ active: compTab === UNUSED }"
title = "Placed in no other circuit: clear out what you no longer need"
@ click = "compTab = UNUSED"
>
< Icon name = "lucide:archive" class = "size-3.5" / > Unused < span class = "count" > { { unused . length } } < / span >
< / button >
2026-10-23 10:33:47 +00:00
< / div >
< p v -else class = "flyout-head" > { { compGroup ? . name ? ? 'Components' } } < / p >
< div class = "strip-wrap" >
< button v-if ="edges.left" class="strip-arrow left" title="Scroll left" @click="page(-1)" > < Icon name = "lucide:chevron-left" class = "size-4" / > < / button >
< div ref = "strip" class = "part-strip" @wheel ="onWheel" @scroll ="measure" >
< div v-for ="d in compGroup?.defs ?? []" :key="d.id" class="part-slot" >
< button
class = "part-tile"
: class = "{ blocked: !placeable(d), active: ed.placing.value?.chip === d.id }"
: title = "d.id === ed.def.value.id ? 'You are editing this one' : d.description || ''"
: draggable = "placeable(d)"
@ click = "pick('chip', d.id)"
@ dragstart = "dragStart($event, 'chip', d.id)"
@ dragend = "endDrag"
>
< span class = "part-art" > < EditorPartThumb kind = "chip" :chip ="d.id" / > < / span >
< span class = "part-name" > { { d . name } } < / span >
< span v-if ="d.id === ed.def.value.id" class="part-meta" > editing < / span >
< span v -else -if = " ed.transistors ( d.id ) " class = "part-meta" > { { shortCount ( ed . transistors ( d . id ) ) } } transistors < / span >
< / button >
BF jumps always on top of what they cross; R circuit commands in a menu on its name, the side panel only says what it is
A jump is drawn once more over every line, so a cable that arches over
another is never hidden under it, whatever order they are drawn in. Cable
labels sit on the longest stretch no other line crosses.
The circuit's name in the top bar opens what can be done with it: tidy
its wires or every circuit's, design its box, duplicate, delete, print,
export SVG, publish as a puzzle. The This panel keeps what the circuit is:
its health, its numbers (the transistors tile opens their breakdown), its
truth table and how it looks as a part. Unused components are a tab of
the Components list in the parts bar, with a delete button on each.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 13:12:43 +00:00
< button
v - if = "compTab === UNUSED"
class = "pin-btn drop-btn"
: class = "{ confirm: confirmDrop === d.id }"
: title = "confirmDrop === d.id ? 'Click again to delete it' : 'Delete this component'"
@ click = "drop(d)"
@ pointerleave = "confirmDrop === d.id && (confirmDrop = null)"
>
< Icon name = "lucide:trash-2" class = "size-3.5" / >
< span v-if ="confirmDrop === d.id" > Delete ? < / span >
< / button >
< button v -else class = "pin-btn" : class = "{ on: isPinned('chip', d) }" : title = "isPinned('chip', d) ? 'Unpin from the bar' : 'Pin to the bar'" @ click = "togglePin('chip', d)" >
2026-10-23 10:33:47 +00:00
< Icon : name = "isPinned('chip', d) ? 'lucide:pin-off' : 'lucide:pin'" class = "size-3.5" / >
< / button >
< button v-if ="d.id !== ed.def.value.id" class="pin-btn edit" title="Open it and edit inside (or double-click it on the canvas)" @click="ed.open(d.id), (open = null)" >
< Icon name = "lucide:pencil" class = "size-3.5" / >
< / button >
< / div >
< / div >
< button v-if ="edges.right" class="strip-arrow right" title="Scroll right" @click="page(1)" > < Icon name = "lucide:chevron-right" class = "size-4" / > < / button >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< / div >
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
< div class = "flex gap-1" >
< button class = "flyout-new grow" @ click = "ed.createComponent(), (open = null)" > < Icon name = "lucide:plus" class = "size-4" / > New component < / button >
< button class = "flyout-new" title = "NOT, AND, … up to a 4-bit counter, all built from NAND" @ click = "ed.loadExamples(), (open = null)" > < Icon name = "lucide:book-open" class = "size-4" / > Examples < / button >
< / div >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< / template >
< / div >
< / Transition >
< nav class = "bottom-bar" aria -label = " Parts " @pointerleave ="leave" >
2026-10-23 10:43:08 +00:00
< div class = "bb-group pinned" @wheel ="sideways" >
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
< button
v - for = "p in shown"
: key = "p.pin"
class = "bar-btn pinned-part"
: class = "{ blocked: p.missing, active: ed.placing.value?.kind === p.kind && ed.placing.value?.chip === p.chip }"
: title = "`${p.name}${p.key ? ` (${p.key})` : ''}: click to place, drag onto the canvas. Right-click to unpin`"
: draggable = "!p.missing"
@ pointerenter = "leave"
@ click = "pick(p.kind, p.chip)"
@ contextmenu . prevent = "unpin(p.pin)"
@ dragstart = "dragStart($event, p.kind, p.chip)"
@ dragend = "dragEnd"
>
<!-- Gates and components by name , the rest ( switch , lamp , clock ) by icon . -- >
< Icon v -if = " ! named ( p ) " :name ="p.icon" class = "size-[18px]" / >
< span v-else > {{ p.name }} < / span >
< / button >
2026-10-23 10:43:08 +00:00
< / div >
< div class = "bb-group" >
< button
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
v - for = "c in cats"
: key = "c.id"
class = "bar-btn"
: class = "{ open: open === c.id, active: activeCat === c.id }"
: title = "c.label"
@ pointerenter = "show(c.id, $event)"
@ click = "toggle(c.id, $event)"
>
< Icon :name ="c.icon" class = "size-[18px]" / >
< span class = "bar-label" > { { c . label } } < / span >
2026-10-23 10:43:08 +00:00
< / button >
< / div >
< div class = "bb-group end" >
R bars and panels fit small windows, Main always in reach; A Space search opens components
The top and bottom bars keep their steady centred width on wide windows,
but never get narrower than 760px as far as the panels leave room, and
move off the centre rather than under a panel. On a narrow bar the words
go first, the names between Main and the open component fold into "…"
(a menu back to each), and sound, settings and help, then undo, redo and
share, then challenges and search move into a "⋯" menu. Main keeps its
house at every width; before, the rule that hid its label hid the icons
too, and on a squeezed bar the crumbs, Main with them, were cut off.
From 821 to 1100px the selection's panel floats over the canvas edge
between the bars instead of narrowing the canvas. The zoom buttons sit
above the parts bar where it reaches them. The challenges drop-down, the
flyouts and the search box stay on screen.
In the Space search, Shift+Enter (or Ctrl+Enter, or the pencil on a
component's line) opens the component to edit it instead of placing it,
and typing a name lists "Open <name>" for every circuit of the project,
also those that cannot be placed here; the one you are in shows as where
you are. A circuit on the way here is reached by going back along it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:10:54 +00:00
< button class = "bar-btn" title = "Find a part, a circuit to open or an action (Space or /)" @click ="ed.partSearch.value++" >
2026-10-23 10:43:08 +00:00
< Icon name = "lucide:search" class = "size-[18px]" / >
< kbd class = "bar-label" > Space < / kbd >
< / button >
< / div >
R a Figma-like workspace: a floating bottom bar of part kinds with flyouts, pinned parts on the left
- Bottom bar over the canvas: Logic, Inputs, Outputs, Wiring, Notes,
Connectors, Components (and search). Pointing at one opens its parts
above it: click to place, drag onto the canvas, pin to the left.
Connectors offer Out/In, edit and new type; components come grouped
with their transistor counts.
- Left panel: pinned parts first (NAND, AND, OR, NOT, XOR, input,
output, lamp, clock to start with; kept per browser, components by
name so they follow you into every project), then the circuits list.
The long list of built-in parts and the connector list moved to the
bar.
- Slimmer top bar and side panels; notices sit above the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:04:43 +00:00
< / nav >
< / div >
< / template >