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
|
|
|
<script setup lang="ts">
|
2026-10-23 10:43:08 +00:00
|
|
|
// The search box at the mouse (Space, /, Shift+A or Ctrl+K): parts to place
|
|
|
|
|
// right there, and things to do. Empty, it shows the parts used lately and
|
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
|
|
|
// the common actions; typing narrows both and offers to open the circuits
|
|
|
|
|
// of that name. Arrows choose, Enter takes it, Shift+Enter opens a component.
|
2026-10-23 10:43:08 +00:00
|
|
|
import { matchScore } from '~/lib/match'
|
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
|
|
|
import { circuitsNamed, wayTo } from '~/lib/nav'
|
|
|
|
|
import type { ComponentDef, NodeKind } from '~/lib/logic/types'
|
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 props = defineProps<{ x: number; y: number }>()
|
2026-10-23 10:43:08 +00:00
|
|
|
const emit = defineEmits<{ pick: [p: { kind: NodeKind; chip?: string }]; fit: []; close: [] }>()
|
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
|
|
|
|
2026-10-23 10:43:08 +00:00
|
|
|
const ed = useEditor()
|
|
|
|
|
const { search, recentParts } = useParts()
|
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 query = ref('')
|
|
|
|
|
const at = ref(0)
|
|
|
|
|
const input = ref<HTMLInputElement>()
|
|
|
|
|
const el = ref<HTMLElement>()
|
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
|
|
|
const list = ref<HTMLElement>()
|
2026-10-23 10:43:08 +00:00
|
|
|
|
|
|
|
|
interface Action {
|
|
|
|
|
id: string
|
|
|
|
|
label: string
|
|
|
|
|
icon: string
|
|
|
|
|
keys?: string
|
|
|
|
|
/** Other words it is found by. */
|
|
|
|
|
aka?: string
|
|
|
|
|
/** Only offered when this holds. */
|
|
|
|
|
when?: () => boolean
|
|
|
|
|
run: () => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ACTIONS: Action[] = [
|
|
|
|
|
{ id: 'new-comp', label: 'Create a new component', icon: 'lucide:square-plus', aka: 'new part chip block', run: () => ed.createComponent() },
|
|
|
|
|
{
|
|
|
|
|
id: 'package',
|
|
|
|
|
label: 'Make a component from the selection',
|
|
|
|
|
icon: 'lucide:package',
|
|
|
|
|
aka: 'group package extract',
|
|
|
|
|
when: () => ed.selection.value.length > 1,
|
|
|
|
|
run: () => ed.packageSelected('Part'),
|
|
|
|
|
},
|
|
|
|
|
{ id: 'find', label: 'Find anything in the project', icon: 'lucide:search', keys: 'Ctrl+F', aka: 'search where used', run: () => (ed.dialog.value = 'search') },
|
|
|
|
|
{ id: 'table', label: 'Truth table', icon: 'lucide:table', aka: 'test outputs', run: () => (ed.dialog.value = 'table') },
|
|
|
|
|
{ id: 'fit', label: 'Fit the circuit to the screen', icon: 'lucide:scan', keys: 'F', aka: 'zoom view', run: () => emit('fit') },
|
2026-10-23 12:57:16 +00:00
|
|
|
{ id: 'tidy', label: 'Tidy this circuit', icon: 'lucide:wand-sparkles', aka: 'wires clean route layout', when: () => ed.def.value.wires.length > 0, run: () => ed.tidyAll() },
|
|
|
|
|
{ id: 'tidy-all', label: 'Tidy every circuit', icon: 'lucide:sparkles', aka: 'wires clean route layout all components', run: () => ed.tidyEverything() },
|
2026-10-23 10:43:08 +00:00
|
|
|
{ id: 'examples', label: 'Add example parts', icon: 'lucide:book-open', aka: 'library not and or adder counter', run: () => ed.loadExamples() },
|
|
|
|
|
{ id: 'connector', label: 'New connector type', icon: 'lucide:plug', aka: 'cable hdmi rj45 bus port', when: () => ed.canPlaceKind('portin'), run: () => ed.addConnector() },
|
|
|
|
|
{ id: 'undo', label: 'Undo', icon: 'lucide:undo-2', keys: 'Ctrl+Z', when: () => ed.canUndo.value, run: () => ed.undo() },
|
|
|
|
|
{ id: 'print', label: 'Print or save as PDF', icon: 'lucide:printer', keys: 'Ctrl+P', aka: 'sheet export', run: () => ed.exportSheet('print') },
|
|
|
|
|
{ id: 'settings', label: 'Settings', icon: 'lucide:settings', aka: 'symbols sound wires options', run: () => (ed.dialog.value = 'settings') },
|
|
|
|
|
{ id: 'help', label: 'How to play', icon: 'lucide:circle-help', keys: '?', aka: 'help shortcuts keys', run: () => (ed.showHelp.value = true) },
|
|
|
|
|
{ id: 'menu', label: 'Menu: save, load, main menu', icon: 'lucide:menu', keys: 'Esc', aka: 'pause quit', run: () => ed.pause() },
|
|
|
|
|
]
|
|
|
|
|
|
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
|
|
|
type Item =
|
|
|
|
|
| { type: 'part'; id: string; kind: NodeKind; chip?: string; label: string; icon: string; note?: string }
|
|
|
|
|
| { type: 'action'; id: string; act: Action; label: string; icon: string; note?: string }
|
|
|
|
|
| { type: 'open'; id: string; def: string; label: string; icon: string; note?: string; here?: boolean }
|
2026-10-23 10:43:08 +00:00
|
|
|
|
|
|
|
|
const partItem = (p: { kind: NodeKind; chip?: string; name: string; icon: string }, note?: string): Item => ({
|
|
|
|
|
type: 'part',
|
|
|
|
|
id: `p:${p.chip ?? p.kind}`,
|
|
|
|
|
kind: p.kind,
|
|
|
|
|
chip: p.chip,
|
|
|
|
|
label: p.name,
|
|
|
|
|
icon: p.icon,
|
|
|
|
|
note,
|
|
|
|
|
})
|
|
|
|
|
const actItem = (a: Action): Item => ({ type: 'action', id: `a:${a.id}`, act: a, label: a.label, icon: a.icon, note: a.keys })
|
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
|
|
|
// Any circuit can be opened, placeable here or not; the one you are in is only shown.
|
|
|
|
|
const openItem = (d: ComponentDef): Item =>
|
|
|
|
|
d.id === ed.def.value.id
|
|
|
|
|
? { type: 'open', id: `o:${d.id}`, def: d.id, label: d.name, icon: 'lucide:map-pin', note: 'you are here', here: true }
|
|
|
|
|
: { type: 'open', id: `o:${d.id}`, def: d.id, label: `Open ${d.name}`, icon: 'lucide:log-in' }
|
2026-10-23 10:43:08 +00:00
|
|
|
const offered = () => ACTIONS.filter(a => !a.when || a.when())
|
|
|
|
|
|
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
|
|
|
/** Sections to show: parts first, then circuits to open, then actions. */
|
2026-10-23 10:43:08 +00:00
|
|
|
const sections = computed(() => {
|
|
|
|
|
const q = query.value.trim()
|
|
|
|
|
if (!q) {
|
|
|
|
|
const recent = recentParts.value.map(r => partItem(r, 'recent'))
|
|
|
|
|
const parts = recent.length ? recent : search('', 6).map(h => partItem(h, h.group))
|
|
|
|
|
return [
|
|
|
|
|
{ title: recent.length ? 'Recent parts' : 'Parts', items: parts },
|
|
|
|
|
{ title: 'Actions', items: offered().slice(0, 7).map(actItem) },
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
const parts = search(q, 8).map(h => partItem(h, h.group))
|
|
|
|
|
const acts = offered()
|
|
|
|
|
.map(a => ({ a, s: Math.max(matchScore(a.label, q.toLowerCase()), matchScore(a.aka ?? '', q.toLowerCase()) * 0.8) }))
|
|
|
|
|
.filter(x => x.s > 0)
|
|
|
|
|
.sort((x, y) => y.s - x.s)
|
|
|
|
|
.slice(0, 5)
|
|
|
|
|
.map(x => actItem(x.a))
|
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
|
|
|
const circuits = circuitsNamed(ed.project.value.components, q).map(openItem)
|
2026-10-23 10:43:08 +00:00
|
|
|
return [
|
|
|
|
|
{ title: 'Parts', items: parts },
|
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
|
|
|
{ title: 'Circuits', items: circuits },
|
2026-10-23 10:43:08 +00:00
|
|
|
{ title: 'Actions', items: acts },
|
|
|
|
|
].filter(s => s.items.length)
|
|
|
|
|
})
|
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
|
|
|
/** What the arrows walk through: everything but the circuit you are in. */
|
|
|
|
|
const flat = computed(() => sections.value.flatMap(s => s.items).filter(it => !(it.type === 'open' && it.here)))
|
2026-10-23 10:43:08 +00:00
|
|
|
const indexOf = (it: Item) => flat.value.indexOf(it)
|
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
|
|
|
watch(query, () => (at.value = 0))
|
|
|
|
|
|
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
|
|
|
/** Takes what was chosen; `edit` opens a component instead of placing it. */
|
|
|
|
|
function take(it: Item | undefined, edit = false) {
|
|
|
|
|
if (!it || (it.type === 'open' && it.here)) return
|
|
|
|
|
if (it.type === 'open') return go(it.def)
|
|
|
|
|
if (it.type === 'part' && it.chip && edit) return go(it.chip)
|
2026-10-23 10:43:08 +00:00
|
|
|
if (it.type === 'part') return emit('pick', { kind: it.kind, chip: it.chip })
|
|
|
|
|
emit('close')
|
|
|
|
|
it.act.run()
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
/** Into a circuit: back along the way when it is on it, else one step further in. */
|
|
|
|
|
function go(id: string) {
|
|
|
|
|
emit('close')
|
|
|
|
|
const way = wayTo(ed.nav.value, ed.mainId.value, id)
|
|
|
|
|
if (way === 'main') ed.goMain()
|
|
|
|
|
else if (way === 'open') ed.open(id)
|
|
|
|
|
else ed.goTo(way)
|
|
|
|
|
}
|
|
|
|
|
|
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 pos = ref({ left: props.x, top: props.y })
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
input.value?.focus()
|
|
|
|
|
const r = el.value!.getBoundingClientRect()
|
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
|
|
|
// Room below for the list at its longest, so typing never pushes the box off the window.
|
|
|
|
|
const tall = r.height - list.value!.offsetHeight + Math.min(420, window.innerHeight * 0.6)
|
|
|
|
|
pos.value = { left: Math.max(8, Math.min(props.x, window.innerWidth - r.width - 8)), top: Math.max(8, Math.min(props.y, window.innerHeight - tall - 8)) }
|
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
|
|
|
window.addEventListener('pointerdown', outside, true)
|
|
|
|
|
})
|
|
|
|
|
onBeforeUnmount(() => window.removeEventListener('pointerdown', outside, true))
|
|
|
|
|
|
|
|
|
|
function outside(e: Event) {
|
|
|
|
|
if (!el.value?.contains(e.target as Node)) emit('close')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onKey(e: KeyboardEvent) {
|
|
|
|
|
e.stopPropagation()
|
2026-10-23 10:43:08 +00:00
|
|
|
const n = flat.value.length
|
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
|
|
|
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
if (n) at.value = (at.value + (e.key === 'ArrowDown' ? 1 : -1) + n) % n
|
2026-10-23 10:43:08 +00:00
|
|
|
nextTick(() => el.value?.querySelector('.item.active')?.scrollIntoView({ block: 'nearest' }))
|
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
|
|
|
} else if (e.key === 'Enter') {
|
|
|
|
|
e.preventDefault()
|
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
|
|
|
take(flat.value[at.value], e.shiftKey || e.ctrlKey || e.metaKey)
|
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
|
|
|
} else if (e.key === 'Escape') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
emit('close')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Teleport to="body">
|
|
|
|
|
<div ref="el" class="quick-add" :style="{ left: `${pos.left}px`, top: `${pos.top}px` }" @keydown="onKey">
|
|
|
|
|
<div class="search part-search">
|
2026-10-23 10:43:08 +00:00
|
|
|
<Icon name="lucide:search" class="size-3.5 text-(--muted)" />
|
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
|
|
|
<input ref="input" v-model="query" placeholder="Find a part, a circuit or an action…" />
|
2026-10-23 10:43:08 +00:00
|
|
|
</div>
|
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
|
|
|
<div ref="list" class="quick-list">
|
2026-10-23 10:43:08 +00:00
|
|
|
<template v-for="s in sections" :key="s.title">
|
|
|
|
|
<p class="quick-head">{{ s.title }}</p>
|
|
|
|
|
<ul class="items">
|
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
|
|
|
<li v-for="it in s.items" :key="it.id" class="comp-row">
|
|
|
|
|
<button
|
|
|
|
|
class="item"
|
|
|
|
|
:class="{ active: indexOf(it) === at }"
|
|
|
|
|
:disabled="it.type === 'open' && it.here"
|
|
|
|
|
@pointerenter="indexOf(it) >= 0 && (at = indexOf(it))"
|
|
|
|
|
@click="take(it)"
|
|
|
|
|
>
|
2026-10-23 10:43:08 +00:00
|
|
|
<span v-if="it.type === 'part' && it.kind === 'nand'" class="nand-badge">&</span>
|
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
|
|
|
<Icon v-else :name="it.icon" class="size-4 shrink-0" :class="it.type === 'part' ? 'text-(--muted)' : 'text-(--accent)'" />
|
2026-10-23 10:43:08 +00:00
|
|
|
<span class="grow truncate">{{ it.label }}</span>
|
|
|
|
|
<kbd v-if="it.type === 'action' && it.note">{{ it.note }}</kbd>
|
|
|
|
|
<span v-else-if="it.note" class="group-tag">{{ it.note }}</span>
|
|
|
|
|
</button>
|
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 v-if="it.type === 'part' && it.chip" class="open" title="Open it and edit inside (Shift+Enter)" @click="take(it, true)">
|
|
|
|
|
<Icon name="lucide:pencil" class="size-3.5" />
|
|
|
|
|
</button>
|
2026-10-23 10:43:08 +00:00
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</template>
|
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
|
|
|
<p v-if="!sections.length" class="hint px-3 pb-2">Nothing called "{{ query.trim() }}" here.</p>
|
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
|
|
|
</div>
|
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
|
|
|
<p class="quick-foot"><kbd>Enter</kbd> takes it, <kbd>Shift+Enter</kbd> opens a component to edit it.</p>
|
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
|
|
|
</div>
|
|
|
|
|
</Teleport>
|
|
|
|
|
</template>
|