R Panels: This and Pins on the left, the selection on the right
The left panel is about the circuit you are in: This (challenge and Check on top, problems, name, statistics, truth table, as a component, transistors, tools) and Pins. The selection gets its own panel on the right, there only while something is selected, with its settings and actions such as making a component out of it. The bars follow the canvas width and drop labels when it gets narrow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
71332a1dfa
commit
c1b70a937f
|
|
@ -7,7 +7,7 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n
|
||||||
## What it does
|
## What it does
|
||||||
|
|
||||||
- Parts: NAND, input switch, output pin, lamp, push button, clock, constant 1, ground, hex display, pixel, cable bundle and split, input panel, note.
|
- Parts: NAND, input switch, output pin, lamp, push button, clock, constant 1, ground, hex display, pixel, cable bundle and split, input panel, note.
|
||||||
- Layout like Figma: two floating rounded bars and one side panel. The top bar, across the whole width: menu (pause menu) with the project name, "Main" and the way into the open component (each name leads back; every other circuit is a component and opens with a double-click, or the pencil in the Components list), Challenges (campaign, puzzle of the week, puzzles, challenges in a drop-down), the clock, search, undo, sound, settings, help, share and account. The bottom bar: your pinned parts first (NAND, AND, OR, NOT, XOR, input, output, lamp, clock to start with; pin from the lists, right-click to unpin, kept per browser, components by name), then one button per kind of part (Logic, Inputs, Outputs, Wiring, Notes, Connectors, Components) that opens its parts on pointing, and a search that opens quick add. The side panel sits on the left.
|
- Layout like Figma: two floating rounded bars over the canvas, a panel on the left for the circuit you are in and one on the right for what is selected. The top bar, across the whole width: menu (pause menu) with the project name, "Main" and the way into the open component (each name leads back; every other circuit is a component and opens with a double-click, or the pencil in the Components list), Challenges (campaign, puzzle of the week, puzzles, challenges in a drop-down), the clock, search, undo, sound, settings, help, share and account. The bottom bar: your pinned parts first (NAND, AND, OR, NOT, XOR, input, output, lamp, clock to start with; pin from the lists, right-click to unpin, kept per browser, components by name), then one button per kind of part (Logic, Inputs, Outputs, Wiring, Notes, Connectors, Components) that opens its parts on pointing, and a search that opens quick add.
|
||||||
- Lamps and output pins pass their signal on: the pin on their right carries the same value, so a lamp can sit in the middle of a wire.
|
- Lamps and output pins pass their signal on: the pin on their right carries the same value, so a lamp can sit in the middle of a wire.
|
||||||
- Gates with more inputs: a placed AND, OR, XOR, NAND or NOR (built in, from the examples, or your own) has an "Inputs" setting from 2 to 16. The wide version is a component built as a balanced tree of the two-input gate (NAND and NOR as the plain gate plus a final inverted one), made once per gate and width in "Wide gates" and reused; transistors count honestly and changes to the two-input gate carry through. Which gates qualify is read off their truth table ([app/lib/logic/wide.ts](app/lib/logic/wide.ts)).
|
- Gates with more inputs: a placed AND, OR, XOR, NAND or NOR (built in, from the examples, or your own) has an "Inputs" setting from 2 to 16. The wide version is a component built as a balanced tree of the two-input gate (NAND and NOR as the plain gate plus a final inverted one), made once per gate and width in "Wide gates" and reused; transistors count honestly and changes to the two-input gate carry through. Which gates qualify is read off their truth table ([app/lib/logic/wide.ts](app/lib/logic/wide.ts)).
|
||||||
- Campaign (Projects → New campaign): you start with NAND, inputs, outputs, lamps and notes, and no examples. Each challenge opens once the ones it builds on are solved (NOT → AND, OR, SR Latch → …), and your own solution becomes a part you can place. Other basic parts unlock on the way: constants with NOT, the input panel with AND, hex display and pixel with the decoder, cables with Adder 2, the button with the SR latch, the clock with the D latch. Rules in [app/lib/logic/progress.ts](app/lib/logic/progress.ts). Sandbox projects keep everything open.
|
- Campaign (Projects → New campaign): you start with NAND, inputs, outputs, lamps and notes, and no examples. Each challenge opens once the ones it builds on are solved (NOT → AND, OR, SR Latch → …), and your own solution becomes a part you can place. Other basic parts unlock on the way: constants with NOT, the input panel with AND, hex display and pixel with the decoder, cables with Adder 2, the button with the SR latch, the clock with the D latch. Rules in [app/lib/logic/progress.ts](app/lib/logic/progress.ts). Sandbox projects keep everything open.
|
||||||
|
|
@ -21,13 +21,13 @@ Nuxt 4 (client-only editor, `ssr: false`), Tailwind CSS v4, Lucide icons via `@n
|
||||||
- Automatic names: copies continue a series (D0 copied gives D1, D2; A gives B), and so does placing a new input or output after a numbered one. A switch, button, lamp or output pin without a name of its own (or with an automatic one) takes the name of the component pin it gets wired to, made unique (Cin, Cin2); a name typed by hand is kept. On the canvas, a switch, button, clock, lamp or output pin without a name typed by hand shows the name of the component pin it is wired to, dimmed and in italics (or its automatic name, also dimmed); the name follows the wiring as it changes.
|
- Automatic names: copies continue a series (D0 copied gives D1, D2; A gives B), and so does placing a new input or output after a numbered one. A switch, button, lamp or output pin without a name of its own (or with an automatic one) takes the name of the component pin it gets wired to, made unique (Cin, Cin2); a name typed by hand is kept. On the canvas, a switch, button, clock, lamp or output pin without a name typed by hand shows the name of the component pin it is wired to, dimmed and in italics (or its automatic name, also dimmed); the name follows the wiring as it changes.
|
||||||
- Every circuit is a component. Its input and output nodes become its pins, ordered top to bottom. Double-click a component to open it.
|
- Every circuit is a component. Its input and output nodes become its pins, ordered top to bottom. Double-click a component to open it.
|
||||||
- Lamps and hex displays inside a component show on its box, with their labels, lit by that instance's state. They are laid out in rows the way they sit inside. A checkbox in the inspector turns this off per component.
|
- Lamps and hex displays inside a component show on its box, with their labels, lit by that instance's state. They are laid out in rows the way they sit inside. A checkbox in the inspector turns this off per component.
|
||||||
- The side panel (left) has four tabs. **Selection**: settings of what you clicked (switches to it when you select something on an idle panel). **Circuit**: name, symbol, group, statistics, and where the transistors are (each kind of part with its count; click a line to select those parts). **Pins**: every input and output of the circuit in pin order, one line each, with its live value (click it to flip a switch, hold it for a button; panel rows are framed under their panel); rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. **Test**: the challenge or puzzle check and the truth table (opens by itself for a challenge). Display and sound preferences are in Settings (gear in the top bar). It folds away to a strip of icons (the panel icon in its tab row, or [).
|
- The panel on the left is about the circuit you are in and has two tabs. **This**: the challenge or puzzle being built with its Check (at the top when there is one), problems, name, statistics, the truth table, how it looks as a component, where the transistors are (each kind of part with its count; click a line to select those parts) and tools. **Pins**: every input and output of the circuit in pin order, one line each, with its live value (click it to flip a switch, hold it for a button; panel rows are framed under their panel); rename in place (Enter goes to the next), "Number all" names a whole side from a pattern (D# → D0, D1, …), duplicate names are flagged, the target icon centres the canvas on a part. Display and sound preferences are in Settings (gear in the top bar). It folds away to a strip of icons (the panel icon in its tab row, or [). The panel on the right is there only while something is selected: its settings and what to do with it (swap, wire them all, make a component out of it); x or Esc closes it.
|
||||||
- Box selection: a box that touches no parts selects every wire and cable it crosses (drag across the wires between parts to bundle them). Dragged right to left (green box) it selects everything it touches, parts and wires. Left to right over parts it takes those parts and only the wires lying fully inside, so Delete never catches unrelated wires passing through.
|
- Box selection: a box that touches no parts selects every wire and cable it crosses (drag across the wires between parts to bundle them). Dragged right to left (green box) it selects everything it touches, parts and wires. Left to right over parts it takes those parts and only the wires lying fully inside, so Delete never catches unrelated wires passing through.
|
||||||
- Wiring many at once: select several parts and drag one wire from one of them to a pin of another part; the others follow onto that part's next pins, in position order (or use "Wire them all to" in the panel).
|
- Wiring many at once: select several parts and drag one wire from one of them to a pin of another part; the others follow onto that part's next pins, in position order (or use "Wire them all to" in the panel).
|
||||||
- Zooming out goes at least far enough to see the whole circuit, further for bigger circuits.
|
- Zooming out goes at least far enough to see the whole circuit, further for bigger circuits.
|
||||||
- Several selected parts are edited together: chips to narrow the selection by type, swap them all for another part, rename all top to bottom from a pattern, set every switch to 0 or 1 or flip each, one colour, one clock frequency or note size for all, line them up or spread them evenly, plus make component, connect one by one, unlink, duplicate, delete.
|
- Several selected parts are edited together: chips to narrow the selection by type, swap them all for another part, rename all top to bottom from a pattern, set every switch to 0 or 1 or flip each, one colour, one clock frequency or note size for all, line them up or spread them evenly, plus make component, connect one by one, unlink, duplicate, delete.
|
||||||
- Transistors: every part shows its count (4 for a NAND, 0 for switches, lamps and cables, the whole inside for a component; the NAND in the palette shows 4T). The count is 4 per CMOS NAND gate the simulator builds, at every depth; a test checks this against the flattened circuit for every example and every wide gate.
|
- Transistors: every part shows its count (4 for a NAND, 0 for switches, lamps and cables, the whole inside for a component; the NAND in the palette shows 4T). The count is 4 per CMOS NAND gate the simulator builds, at every depth; a test checks this against the flattened circuit for every example and every wide gate.
|
||||||
- Clicking anything opens its settings in the side panel. Parts can be swapped in place (wires stay on the pins in the same position): NAND and components with each other, switch/button/clock/constants with each other, output/lamp/display with each other. Clocks have their own frequency or follow the top bar. Switches and buttons can get a keyboard key. Lamps and displays have colours, notes have sizes, components a name on the canvas. Components can be unpacked into their parts or given their own copy of the definition; any part can have all its wires unlinked.
|
- Clicking anything opens its settings in the panel on the right. Parts can be swapped in place (wires stay on the pins in the same position): NAND and components with each other, switch/button/clock/constants with each other, output/lamp/display with each other. Clocks have their own frequency or follow the top bar. Switches and buttons can get a keyboard key. Lamps and displays have colours, notes have sizes, components a name on the canvas. Components can be unpacked into their parts or given their own copy of the definition; any part can have all its wires unlinked.
|
||||||
- Select parts and press "Make component" to turn them into a new component; wires crossing the selection become pins.
|
- Select parts and press "Make component" to turn them into a new component; wires crossing the selection become pins.
|
||||||
- Gate symbols in IEC 60617 (DIN, default) or ANSI. A component with one output can be drawn as a gate symbol.
|
- Gate symbols in IEC 60617 (DIN, default) or ANSI. A component with one output can be drawn as a gate symbol.
|
||||||
- Wires of different signals never share a line: auto-routed wires pick a free column or a detour, and anything still clashing (hand-placed bends) is drawn on its own lane. Crossings are drawn as a bow, triangle, bridge, gap or plain crossing (Settings, the gear in the top bar). Clicking a junction dot selects its whole signal.
|
- Wires of different signals never share a line: auto-routed wires pick a free column or a detour, and anything still clashing (hand-placed bends) is drawn on its own lane. Crossings are drawn as a bow, triangle, bridge, gap or plain crossing (Settings, the gear in the top bar). Clicking a junction dot selects its whole signal.
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ kbd {
|
||||||
|
|
||||||
.workspace {
|
.workspace {
|
||||||
--left: 272px;
|
--left: 272px;
|
||||||
|
--right: 280px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: var(--left) 1fr;
|
grid-template-columns: var(--left) 1fr;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|
@ -72,9 +73,14 @@ kbd {
|
||||||
--left: 36px !important;
|
--left: 36px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.workspace.has-selection {
|
||||||
|
grid-template-columns: var(--left) 1fr var(--right);
|
||||||
|
}
|
||||||
|
|
||||||
.stage {
|
.stage {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
container-type: inline-size;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,10 +110,21 @@ kbd {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 820px) {
|
@media (max-width: 820px) {
|
||||||
.workspace {
|
.workspace,
|
||||||
|
.workspace.has-selection {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
grid-template-rows: 1fr 40%;
|
grid-template-rows: 1fr 40%;
|
||||||
}
|
}
|
||||||
|
/* On a phone the selection takes the place of the panel below the canvas. */
|
||||||
|
.workspace.has-selection > .inspector:not(.selection-panel),
|
||||||
|
.workspace.has-selection > .rail {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.workspace > .selection-panel {
|
||||||
|
order: 2;
|
||||||
|
border-left: 0;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
}
|
||||||
.workspace > .inspector,
|
.workspace > .inspector,
|
||||||
.workspace > .rail {
|
.workspace > .rail {
|
||||||
order: 2;
|
order: 2;
|
||||||
|
|
@ -2632,7 +2649,7 @@ kbd {
|
||||||
}
|
}
|
||||||
|
|
||||||
.itabs {
|
.itabs {
|
||||||
grid-template-columns: 30px repeat(4, 1fr);
|
grid-template-columns: 30px repeat(2, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.rail {
|
.rail {
|
||||||
|
|
@ -4273,7 +4290,7 @@ table.board {
|
||||||
background: var(--border);
|
background: var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1250px) {
|
@container (max-width: 1100px) {
|
||||||
.bar-label {
|
.bar-label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
@ -4591,12 +4608,27 @@ table.board {
|
||||||
translate: 0 -4px;
|
translate: 0 -4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1100px) {
|
/* The bars follow the width of the canvas, which shrinks while the selection panel is open. */
|
||||||
.top-bar .status {
|
@container (max-width: 1000px) {
|
||||||
|
.top-bar .status,
|
||||||
|
.top-bar .cycles,
|
||||||
|
.top-bar .bar-count,
|
||||||
|
.top-bar .bar-text {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@container (max-width: 760px) {
|
||||||
|
.top-bar .project-name,
|
||||||
|
.top-bar .crumbs .bar-btn > span:not(.truncate),
|
||||||
|
.top-bar .tb-select {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.top-bar .bar-btn {
|
||||||
|
padding: 0 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Pinned parts at the start of the parts bar. */
|
/* Pinned parts at the start of the parts bar. */
|
||||||
.bar-btn.pinned-part {
|
.bar-btn.pinned-part {
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
|
@ -4607,8 +4639,30 @@ table.board {
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1600px) {
|
@container (max-width: 1400px) {
|
||||||
.bottom-bar:has(.pinned-part) .bar-label {
|
.bottom-bar:has(.pinned-part) .bar-label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The selection's own panel on the right, there only while something is selected. */
|
||||||
|
.selection-panel {
|
||||||
|
border-right: 0;
|
||||||
|
border-left: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel-panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
height: 45px;
|
||||||
|
padding: 0 8px 0 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-pane .truth {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ function reload() {
|
||||||
location.reload()
|
location.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasSelection = computed(() => ed.selection.value.length + ed.wireSel.value.length > 0)
|
||||||
|
|
||||||
const link = computed(() => {
|
const link = computed(() => {
|
||||||
const l = ed.linking.value
|
const l = ed.linking.value
|
||||||
const end = l?.queue[l.at]
|
const end = l?.queue[l.at]
|
||||||
|
|
@ -35,14 +37,15 @@ watch(
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<EditorMainMenu v-if="ed.screen.value === 'menu'" />
|
<EditorMainMenu v-if="ed.screen.value === 'menu'" />
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="workspace" :class="{ 'no-panel': !ed.sidebars.right }">
|
<div class="workspace" :class="{ 'no-panel': !ed.panelOpen.value, 'has-selection': hasSelection }">
|
||||||
<EditorInspector v-if="ed.sidebars.right" />
|
<EditorInspector v-if="ed.panelOpen.value" />
|
||||||
<EditorRail v-else />
|
<EditorRail v-else />
|
||||||
<main class="stage">
|
<main class="stage">
|
||||||
<EditorToolbar />
|
<EditorToolbar />
|
||||||
<EditorCanvas />
|
<EditorCanvas />
|
||||||
<EditorBottomBar />
|
<EditorBottomBar />
|
||||||
</main>
|
</main>
|
||||||
|
<EditorSelectionPanel v-if="hasSelection" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<Transition name="fade">
|
<Transition name="fade">
|
||||||
|
|
|
||||||
|
|
@ -1029,7 +1029,7 @@ function onKey(e: KeyboardEvent) {
|
||||||
if (n?.kind === 'chip' && n.chip) ed.open(n.chip)
|
if (n?.kind === 'chip' && n.chip) ed.open(n.chip)
|
||||||
} else if (!mod && !e.altKey && key === 'w' && ed.selection.value.length) ed.startLinking(ed.selection.value, e.shiftKey ? 'in' : undefined)
|
} else if (!mod && !e.altKey && key === 'w' && ed.selection.value.length) ed.startLinking(ed.selection.value, e.shiftKey ? 'in' : undefined)
|
||||||
else if (!mod && !e.altKey && key === 'f') fit()
|
else if (!mod && !e.altKey && key === 'f') fit()
|
||||||
else if (!mod && !e.altKey && (e.key === '[' || e.key === ']')) ed.toggleSidebar('right')
|
else if (!mod && !e.altKey && e.key === '[') ed.togglePanel()
|
||||||
else if (!mod && !e.altKey && e.key === '?') ed.showHelp.value = !ed.showHelp.value
|
else if (!mod && !e.altKey && e.key === '?') ed.showHelp.value = !ed.showHelp.value
|
||||||
else if (!mod && !e.altKey && QUICK[key] && ed.canPlaceKind(QUICK[key]!)) ed.placing.value = { kind: QUICK[key]! }
|
else if (!mod && !e.altKey && QUICK[key] && ed.canPlaceKind(QUICK[key]!)) ed.placing.value = { kind: QUICK[key]! }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// Challenges, puzzles and the puzzle of the week, opened from the top bar.
|
// Challenges, puzzles and the puzzle of the week, opened from the top bar.
|
||||||
// Starting one opens its circuit; the Test tab then shows what to build.
|
// Starting one opens its circuit; This on the left then shows what to build.
|
||||||
import { CHALLENGES } from '~/lib/logic/challenges'
|
import { CHALLENGES } from '~/lib/logic/challenges'
|
||||||
import { campaignProgress, challengeName, challengeOpen, isCampaign, NEEDS } from '~/lib/logic/progress'
|
import { campaignProgress, challengeName, challengeOpen, isCampaign, NEEDS } from '~/lib/logic/progress'
|
||||||
import { weekKey, weeklyId } from '~/lib/logic/puzzles'
|
import { weekKey, weeklyId } from '~/lib/logic/puzzles'
|
||||||
|
|
@ -41,7 +41,7 @@ defineExpose({ solvedCount })
|
||||||
</div>
|
</div>
|
||||||
<p v-else class="intro">
|
<p v-else class="intro">
|
||||||
Build each part from NAND and the parts you already made. Start a challenge, wire it up, then press
|
Build each part from NAND and the parts you already made. Start a challenge, wire it up, then press
|
||||||
<strong>Check</strong> in the side panel.
|
<strong>Check</strong> under This, on the left.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="weekly">
|
<div class="weekly">
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ watch(() => def.value.id, () => (confirmDelete.value = false))
|
||||||
<dl class="stats">
|
<dl class="stats">
|
||||||
<dt>Pins</dt>
|
<dt>Pins</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="#" title="List and rename them" @click.prevent="ed.rightTab.value = 'pins'">{{ pins.inputs.length }} in, {{ pins.outputs.length }} out</a>
|
<a href="#" title="List and rename them" @click.prevent="ed.panelTab.value = 'pins'">{{ pins.inputs.length }} in, {{ pins.outputs.length }} out</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>NAND gates</dt>
|
<dt>NAND gates</dt>
|
||||||
<dd>{{ ed.circuitStats.value.nands.toLocaleString() }}</dd>
|
<dd>{{ ed.circuitStats.value.nands.toLocaleString() }}</dd>
|
||||||
|
|
@ -121,6 +121,10 @@ watch(() => def.value.id, () => (confirmDelete.value = false))
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<EditorFold id="circuit-table" title="Truth table">
|
||||||
|
<EditorTestPane part="table" />
|
||||||
|
</EditorFold>
|
||||||
|
|
||||||
<EditorFold id="circuit-component" title="As a component" :note="def.group || ''">
|
<EditorFold id="circuit-component" title="As a component" :note="def.group || ''">
|
||||||
<label class="field">
|
<label class="field">
|
||||||
<span>Description</span>
|
<span>Description</span>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// A folding group in the side panel. It remembers, per group, whether you
|
// A folding group in a side panel. It remembers, per group, whether you
|
||||||
// left it open, so the panel stays as short as you like it.
|
// left it open, so the panel stays as short as you like it.
|
||||||
const props = defineProps<{ title: string; id: string; open?: boolean; /** Short note after the title, like a count. */ note?: string }>()
|
const props = defineProps<{ title: string; id: string; open?: boolean; /** Short note after the title, like a count. */ note?: string }>()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ const ed = useEditor()
|
||||||
const SHORTCUTS: [string, string][] = [
|
const SHORTCUTS: [string, string][] = [
|
||||||
['Esc (nothing selected)', 'Pause menu: save, save as copy, load, settings, main menu'],
|
['Esc (nothing selected)', 'Pause menu: save, save as copy, load, settings, main menu'],
|
||||||
['Click switch', 'Flip an input between 0 and 1 (give it a keyboard key in its settings)'],
|
['Click switch', 'Flip an input between 0 and 1 (give it a keyboard key in its settings)'],
|
||||||
['Click anything', 'Its settings appear in the side panel on the left: swap the part, clock speed, colours, keys, position'],
|
['Click anything', 'A panel on the right shows its settings and what you can do with it: swap the part, clock speed, colours, keys, position'],
|
||||||
['Select several', 'Change them all at once: swap, rename D0, D1, …, switch all to 0 or 1, line up'],
|
['Select several', 'Change them all at once: swap, rename D0, D1, …, switch all to 0 or 1, line up'],
|
||||||
['Pins tab (side panel)', 'Every input and output in one list: rename them one after another with Enter'],
|
['Pins (panel on the left)', 'Every input and output in one list: rename them one after another with Enter'],
|
||||||
['Drag from a pin', 'Draw a wire to another pin; dropping it on a part uses that part’s next free pin'],
|
['Drag from a pin', 'Draw a wire to another pin; dropping it on a part uses that part’s next free pin'],
|
||||||
['Click a pin, then another', 'The same without holding the mouse button'],
|
['Click a pin, then another', 'The same without holding the mouse button'],
|
||||||
['Select parts, then W', 'Connect one by one: click where each of their pins goes, in order (Shift+W: their inputs)'],
|
['Select parts, then W', 'Connect one by one: click where each of their pins goes, in order (Shift+W: their inputs)'],
|
||||||
|
|
@ -25,7 +25,7 @@ const SHORTCUTS: [string, string][] = [
|
||||||
['N, I, O, L, B, C, H, T, P, X', 'Place NAND, input, output, lamp, button, clock, hex display, note, input panel, pixel'],
|
['N, I, O, L, B, C, H, T, P, X', 'Place NAND, input, output, lamp, button, clock, hex display, note, input panel, pixel'],
|
||||||
['Bar at the bottom', 'Point at a kind of part to see them all; click to place, drag onto the canvas, pin the ones you use most to the bar itself (right-click a pinned part to unpin it)'],
|
['Bar at the bottom', 'Point at a kind of part to see them all; click to place, drag onto the canvas, pin the ones you use most to the bar itself (right-click a pinned part to unpin it)'],
|
||||||
['Main (top bar)', 'Back to the main circuit; the names after it lead back to each component you entered'],
|
['Main (top bar)', 'Back to the main circuit; the names after it lead back to each component you entered'],
|
||||||
['[', 'Hide or show the side panel'],
|
['[', 'Hide or show the panel on the left (This and Pins)'],
|
||||||
['Connectors (bottom bar)', 'Make a cable type of your own (HDMI, RJ45): its lines; place its Out and In ports; one cable joins them'],
|
['Connectors (bottom bar)', 'Make a cable type of your own (HDMI, RJ45): its lines; place its Out and In ports; one cable joins them'],
|
||||||
['Select wires, Ctrl+G', 'Bundle them into one cable; an end whose wires all meet one part plugs straight into it'],
|
['Select wires, Ctrl+G', 'Bundle them into one cable; an end whose wires all meet one part plugs straight into it'],
|
||||||
['Select a component, cable button beside its pins', 'A cable plugged onto S0–S3 (or any group); drop its free end on the next part\'s pins'],
|
['Select a component, cable button beside its pins', 'A cable plugged onto S0–S3 (or any group); drop its free end on the next part\'s pins'],
|
||||||
|
|
@ -42,7 +42,7 @@ const SHORTCUTS: [string, string][] = [
|
||||||
['Ctrl+P', 'Print the circuit as a sheet with a title block, or save it as PDF'],
|
['Ctrl+P', 'Print the circuit as a sheet with a title block, or save it as PDF'],
|
||||||
['Select switches or buttons, Combine', 'One input panel (all rows can become buttons); lamps or output pins combine into an output panel'],
|
['Select switches or buttons, Combine', 'One input panel (all rows can become buttons); lamps or output pins combine into an output panel'],
|
||||||
['Select panels, Merge', 'One panel with all their rows; inside a component input panel rows are inputs, output panel rows outputs'],
|
['Select panels, Merge', 'One panel with all their rows; inside a component input panel rows are inputs, output panel rows outputs'],
|
||||||
['Design the box (Circuit tab)', 'Move lamps, displays and the name on a component\'s box, draw lines, boxes, circles and text'],
|
['Design the box (This, As a component)', 'Move lamps, displays and the name on a component\'s box, draw lines, boxes, circles and text'],
|
||||||
['Select several lamps, pins or switches', 'Green boxes show free pins in a row they fit; point along one, click to wire them all'],
|
['Select several lamps, pins or switches', 'Green boxes show free pins in a row they fit; point along one, click to wire them all'],
|
||||||
['Shift + click on canvas', 'Keep placing the same part'],
|
['Shift + click on canvas', 'Keep placing the same part'],
|
||||||
['Ctrl+C, Ctrl+V, Ctrl+D', 'Copy, paste, duplicate; names continue their series (D0 → D1)'],
|
['Ctrl+C, Ctrl+V, Ctrl+D', 'Copy, paste, duplicate; names continue their series (D0 → D1)'],
|
||||||
|
|
@ -82,7 +82,7 @@ function close() {
|
||||||
<strong>Try the challenges</strong> (top bar), or open the examples (NOT up to a 4-bit counter) to see how each step is made of the previous one.
|
<strong>Try the challenges</strong> (top bar), or open the examples (NOT up to a 4-bit counter) to see how each step is made of the previous one.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Select parts and press "Make component"</strong> in the side panel to turn a piece of your drawing into a reusable block.
|
<strong>Select parts and press "Make component"</strong> in the panel on the right to turn a piece of your drawing into a reusable block.
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<h3>Controls</h3>
|
<h3>Controls</h3>
|
||||||
|
|
|
||||||
|
|
@ -1,90 +1,65 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// The side panel: tabs for the selection, the circuit, its pins, and testing.
|
// The panel on the left, about the circuit you are in: "This" (its name,
|
||||||
|
// check, challenge, truth table, statistics and tools) and its Pins.
|
||||||
import { ioList } from '~/lib/logic/bulk'
|
import { ioList } from '~/lib/logic/bulk'
|
||||||
|
|
||||||
const ed = useEditor()
|
const ed = useEditor()
|
||||||
type Tab = 'selection' | 'circuit' | 'pins' | 'test'
|
type Tab = 'circuit' | 'pins'
|
||||||
|
|
||||||
const single = computed(() =>
|
|
||||||
ed.selection.value.length === 1 && !ed.wireSel.value.length ? ed.def.value.nodes.find(n => n.id === ed.selection.value[0]) : undefined,
|
|
||||||
)
|
|
||||||
const selected = computed(() => ed.selection.value.length + ed.wireSel.value.length)
|
|
||||||
const pinCount = computed(() => {
|
const pinCount = computed(() => {
|
||||||
const io = ioList(ed.def.value)
|
const io = ioList(ed.def.value)
|
||||||
return io.inputs.length + io.outputs.length
|
return io.inputs.length + io.outputs.length
|
||||||
})
|
})
|
||||||
const hasTask = computed(() => !!ed.task.value)
|
const hasTask = computed(() => !!ed.task.value)
|
||||||
/** Errors and warnings in the open circuit, on the Circuit tab. */
|
/** Errors and warnings in the open circuit, on the This tab. */
|
||||||
const problems = computed(() => ed.issues.value.filter(i => i.level !== 'info').length)
|
const problems = computed(() => ed.issues.value.filter(i => i.level !== 'info').length)
|
||||||
|
|
||||||
const tabs = computed(() => [
|
const tabs = computed(() => [
|
||||||
{ id: 'selection' as Tab, label: 'Selection', icon: 'lucide:mouse-pointer-2', badge: selected.value || '' },
|
{ id: 'circuit' as Tab, label: 'This', icon: hasTask.value ? 'lucide:flag' : 'lucide:cpu', badge: problems.value || '', warn: problems.value > 0 },
|
||||||
{ id: 'circuit' as Tab, label: 'Circuit', icon: 'lucide:cpu', badge: problems.value || '', warn: problems.value > 0 },
|
{ id: 'pins' as Tab, label: 'Pins', icon: 'lucide:list', badge: pinCount.value || '', warn: false },
|
||||||
{ id: 'pins' as Tab, label: 'Pins', icon: 'lucide:list', badge: pinCount.value || '' },
|
|
||||||
{ id: 'test' as Tab, label: 'Test', icon: hasTask.value ? 'lucide:flag' : 'lucide:table', badge: '' },
|
|
||||||
])
|
])
|
||||||
|
|
||||||
// Selecting something shows its settings, unless you are working in Pins or
|
// Renaming with nothing selected renames the circuit; opening a challenge shows what to build.
|
||||||
// Test (where clicking a switch to try the circuit also selects it).
|
|
||||||
let before: Tab = 'circuit'
|
|
||||||
watch(selected, (now, was) => {
|
|
||||||
const tab = ed.rightTab.value
|
|
||||||
if (now && !was && tab === 'circuit') {
|
|
||||||
before = tab
|
|
||||||
ed.rightTab.value = 'selection'
|
|
||||||
} else if (!now && tab === 'selection') ed.rightTab.value = before
|
|
||||||
})
|
|
||||||
watch(
|
watch(
|
||||||
() => ed.labelFocus.value,
|
() => ed.labelFocus.value,
|
||||||
() => {
|
() => {
|
||||||
if (selected.value) ed.rightTab.value = 'selection'
|
if (!ed.selection.value.length) ed.panelTab.value = 'circuit'
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// Opening a challenge or puzzle shows what to build.
|
|
||||||
watch(
|
watch(
|
||||||
() => ed.def.value.id,
|
() => ed.def.value.id,
|
||||||
() => {
|
() => {
|
||||||
if (ed.task.value) ed.rightTab.value = 'test'
|
if (ed.task.value) ed.panelTab.value = 'circuit'
|
||||||
else if (ed.rightTab.value === 'test') ed.rightTab.value = 'circuit'
|
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<aside class="inspector">
|
<aside class="inspector">
|
||||||
<nav class="itabs" role="tablist">
|
<nav class="itabs" role="tablist">
|
||||||
<button class="collapse-btn" title="Hide this panel ([)" @click="ed.toggleSidebar('right', false)">
|
<button class="collapse-btn" title="Hide this panel ([)" @click="ed.togglePanel(false)">
|
||||||
<Icon name="lucide:panel-left-close" class="size-4" />
|
<Icon name="lucide:panel-left-close" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-for="t in tabs"
|
v-for="t in tabs"
|
||||||
:key="t.id"
|
:key="t.id"
|
||||||
role="tab"
|
role="tab"
|
||||||
:aria-selected="ed.rightTab.value === t.id"
|
:aria-selected="ed.panelTab.value === t.id"
|
||||||
:class="{ active: ed.rightTab.value === t.id, task: t.id === 'test' && hasTask }"
|
:class="{ active: ed.panelTab.value === t.id, task: t.id === 'circuit' && hasTask }"
|
||||||
:title="t.label"
|
:title="t.id === 'circuit' ? 'The circuit you are in' : 'Its inputs and outputs'"
|
||||||
@click="ed.rightTab.value = t.id"
|
@click="ed.panelTab.value = t.id"
|
||||||
>
|
>
|
||||||
<Icon :name="t.icon" class="size-4 shrink-0" />
|
<Icon :name="t.icon" class="size-4 shrink-0" />
|
||||||
<span class="label">{{ t.label }}</span>
|
<span class="label">{{ t.label }}</span>
|
||||||
<span v-if="t.badge" class="badge" :class="{ warn: 'warn' in t && t.warn }">{{ t.badge }}</span>
|
<span v-if="t.badge" class="badge" :class="{ warn: t.warn }">{{ t.badge }}</span>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="scroll">
|
<div class="scroll">
|
||||||
<template v-if="ed.rightTab.value === 'selection'">
|
<template v-if="ed.panelTab.value === 'circuit'">
|
||||||
<EditorNodeSettings v-if="single" :key="single.id" :node="single" />
|
<EditorTestPane part="task" />
|
||||||
<EditorBulkSettings v-else-if="ed.selection.value.length" />
|
<EditorCircuitPane />
|
||||||
<EditorWireSettings v-else-if="ed.wireSel.value.length" />
|
|
||||||
<section v-else class="empty-pane">
|
|
||||||
<Icon name="lucide:mouse-pointer-click" class="size-6" />
|
|
||||||
<p>Click a part or wire to change it.</p>
|
|
||||||
<p class="hint">Shift + click or drag a box to select several; you can then rename, swap or switch them all at once.</p>
|
|
||||||
</section>
|
|
||||||
</template>
|
</template>
|
||||||
<EditorCircuitPane v-else-if="ed.rightTab.value === 'circuit'" />
|
<EditorPinsPane v-else />
|
||||||
<EditorPinsPane v-else-if="ed.rightTab.value === 'pins'" />
|
|
||||||
<EditorTestPane v-else />
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// The side panel, hidden, shrinks to this strip; its buttons bring it back.
|
// The panel on the left, hidden, shrinks to this strip; its buttons bring it back.
|
||||||
const ed = useEditor()
|
const ed = useEditor()
|
||||||
|
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ id: 'selection', label: 'Selection', icon: 'lucide:mouse-pointer-2' },
|
{ id: 'circuit', label: 'This', icon: 'lucide:cpu' },
|
||||||
{ id: 'circuit', label: 'Circuit', icon: 'lucide:cpu' },
|
|
||||||
{ id: 'pins', label: 'Pins', icon: 'lucide:list' },
|
{ id: 'pins', label: 'Pins', icon: 'lucide:list' },
|
||||||
{ id: 'test', label: 'Test', icon: 'lucide:table' },
|
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
function openTab(id: (typeof TABS)[number]['id']) {
|
function openTab(id: (typeof TABS)[number]['id']) {
|
||||||
ed.rightTab.value = id
|
ed.panelTab.value = id
|
||||||
ed.toggleSidebar('right', true)
|
ed.togglePanel(true)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<aside class="rail">
|
<aside class="rail">
|
||||||
<button class="rail-btn" title="Show the side panel ([)" @click="ed.toggleSidebar('right', true)">
|
<button class="rail-btn" title="Show the panel ([)" @click="ed.togglePanel(true)">
|
||||||
<Icon name="lucide:panel-left-open" class="size-4" />
|
<Icon name="lucide:panel-left-open" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
<button v-for="t in TABS" :key="t.id" class="rail-btn" :title="t.label" @click="openTab(t.id)">
|
<button v-for="t in TABS" :key="t.id" class="rail-btn" :title="t.label" @click="openTab(t.id)">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
// The panel on the right: only there while something is selected, with its
|
||||||
|
// settings and what can be done with it (swap, wire up, make a component).
|
||||||
|
const ed = useEditor()
|
||||||
|
|
||||||
|
const single = computed(() =>
|
||||||
|
ed.selection.value.length === 1 && !ed.wireSel.value.length ? ed.def.value.nodes.find(n => n.id === ed.selection.value[0]) : undefined,
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<aside class="inspector selection-panel">
|
||||||
|
<div class="sel-panel-head">
|
||||||
|
<Icon name="lucide:mouse-pointer-2" class="size-4 shrink-0 text-(--accent)" />
|
||||||
|
<span class="grow">Selection</span>
|
||||||
|
<button class="icon-btn" title="Deselect (Esc)" @click="ed.selection.value = [], (ed.wireSel.value = [])"><Icon name="lucide:x" class="size-4" /></button>
|
||||||
|
</div>
|
||||||
|
<div class="scroll">
|
||||||
|
<EditorNodeSettings v-if="single" :key="single.id" :node="single" />
|
||||||
|
<EditorBulkSettings v-else-if="ed.selection.value.length" />
|
||||||
|
<EditorWireSettings v-else />
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</template>
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
// The challenge or puzzle being built (part "task", at the top of This) and the
|
||||||
|
// truth table of the open circuit (part "table", folded further down).
|
||||||
import type { ChallengeCheck } from '~/composables/useEditor'
|
import type { ChallengeCheck } from '~/composables/useEditor'
|
||||||
import { tableMarkdown, type TruthTable } from '~/lib/logic/analyze'
|
import { tableMarkdown, type TruthTable } from '~/lib/logic/analyze'
|
||||||
import { apiId, isTable } from '~/lib/logic/puzzles'
|
import { apiId, isTable } from '~/lib/logic/puzzles'
|
||||||
|
|
||||||
|
const props = defineProps<{ part: 'task' | 'table' }>()
|
||||||
const ed = useEditor()
|
const ed = useEditor()
|
||||||
const def = ed.def
|
const def = ed.def
|
||||||
|
|
||||||
|
|
@ -31,7 +34,7 @@ const showTarget = ref(true)
|
||||||
const puzzleLink = computed(() => (challenge.value?.puzzle ? `${location.origin}/puzzle/${apiId(challenge.value.puzzle.id)}` : ''))
|
const puzzleLink = computed(() => (challenge.value?.puzzle ? `${location.origin}/puzzle/${apiId(challenge.value.puzzle.id)}` : ''))
|
||||||
|
|
||||||
const table = ref<TruthTable | { error: string } | null>(null)
|
const table = ref<TruthTable | { error: string } | null>(null)
|
||||||
watch([() => ed.sim.value, () => def.value.id], () => (table.value = ed.table()), { immediate: true })
|
watch([() => ed.sim.value, () => def.value.id], () => (table.value = props.part === 'table' ? ed.table() : null), { immediate: true })
|
||||||
|
|
||||||
const check = ref<ChallengeCheck | null>(null)
|
const check = ref<ChallengeCheck | null>(null)
|
||||||
const bestHere = computed(() => (challenge.value ? ed.project.value.best?.[challenge.value.id] : undefined))
|
const bestHere = computed(() => (challenge.value ? ed.project.value.best?.[challenge.value.id] : undefined))
|
||||||
|
|
@ -43,7 +46,7 @@ function runCheck() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section v-if="challenge" class="challenge" :class="{ solved }">
|
<section v-if="props.part === 'task' && challenge" class="challenge" :class="{ solved }">
|
||||||
<h3>
|
<h3>
|
||||||
<Icon :name="solved ? 'lucide:badge-check' : 'lucide:flag'" class="size-4" />
|
<Icon :name="solved ? 'lucide:badge-check' : 'lucide:flag'" class="size-4" />
|
||||||
{{ challenge.puzzle ? 'Puzzle' : 'Challenge' }}: {{ challenge.name }}
|
{{ challenge.puzzle ? 'Puzzle' : 'Challenge' }}: {{ challenge.name }}
|
||||||
|
|
@ -91,9 +94,8 @@ function runCheck() {
|
||||||
</template>
|
</template>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<div v-if="props.part === 'table'" class="table-pane">
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center justify-end gap-1">
|
||||||
<h3 class="grow">Truth table</h3>
|
|
||||||
<template v-if="table && !('error' in table)">
|
<template v-if="table && !('error' in table)">
|
||||||
<button class="icon-btn" title="Download as CSV" @click="ed.exportTable(table)"><Icon name="lucide:download" class="size-3.5" /></button>
|
<button class="icon-btn" title="Download as CSV" @click="ed.exportTable(table)"><Icon name="lucide:download" class="size-3.5" /></button>
|
||||||
<button class="icon-btn" title="Copy as a Markdown table" @click="ed.copyText(tableMarkdown(table), 'Truth table copied')">
|
<button class="icon-btn" title="Copy as a Markdown table" @click="ed.copyText(tableMarkdown(table), 'Truth table copied')">
|
||||||
|
|
@ -109,5 +111,5 @@ function runCheck() {
|
||||||
<EditorTruthTable :table="table" />
|
<EditorTruthTable :table="table" />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</section>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ const linkIcon = computed(() => {
|
||||||
<div ref="challengesEl" class="relative">
|
<div ref="challengesEl" class="relative">
|
||||||
<button class="bar-btn" :class="{ open: showChallenges }" title="Challenges, puzzles and the puzzle of the week" @click="showChallenges = !showChallenges">
|
<button class="bar-btn" :class="{ open: showChallenges }" title="Challenges, puzzles and the puzzle of the week" @click="showChallenges = !showChallenges">
|
||||||
<Icon name="lucide:flag" class="size-4" />
|
<Icon name="lucide:flag" class="size-4" />
|
||||||
<span class="hidden lg:inline">Challenges</span>
|
<span class="bar-text">Challenges</span>
|
||||||
<span class="bar-count">{{ solvedCount }}/{{ CHALLENGES.length }}</span>
|
<span class="bar-count">{{ solvedCount }}/{{ CHALLENGES.length }}</span>
|
||||||
</button>
|
</button>
|
||||||
<Transition name="drop">
|
<Transition name="drop">
|
||||||
|
|
@ -125,7 +125,7 @@ const linkIcon = computed(() => {
|
||||||
<span class="bar-sep" />
|
<span class="bar-sep" />
|
||||||
<button class="bar-btn share-btn" :class="ed.linkState.value" title="Save online, share a link, export or import a file" @click="ed.dialog.value = 'share'">
|
<button class="bar-btn share-btn" :class="ed.linkState.value" title="Save online, share a link, export or import a file" @click="ed.dialog.value = 'share'">
|
||||||
<Icon :name="linkIcon" class="size-4" />
|
<Icon :name="linkIcon" class="size-4" />
|
||||||
<span class="hidden md:inline">Share</span>
|
<span class="bar-text">Share</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="bar-btn account-btn"
|
class="bar-btn account-btn"
|
||||||
|
|
@ -139,7 +139,7 @@ const linkIcon = computed(() => {
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<Icon name="lucide:user" class="size-4" />
|
<Icon name="lucide:user" class="size-4" />
|
||||||
<span class="hidden md:inline">Sign in</span>
|
<span class="bar-text">Sign in</span>
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -172,17 +172,17 @@ function create() {
|
||||||
faceFor.value = defId
|
faceFor.value = defId
|
||||||
dialog.value = 'face'
|
dialog.value = 'face'
|
||||||
}
|
}
|
||||||
/** Tab shown in the side panel. */
|
/** Tab of the panel on the left: this circuit, or its pins. The selection has its own panel on the right. */
|
||||||
const rightTab = ref<'selection' | 'circuit' | 'pins' | 'test'>('circuit')
|
const panelTab = ref<'circuit' | 'pins'>('circuit')
|
||||||
/** Which side panels are open; remembered in this browser. */
|
/** Whether the panel on the left is open; remembered in this browser. */
|
||||||
const sidebars = reactive<{ left: boolean; right: boolean }>({ left: true, right: true })
|
const panelOpen = ref(true)
|
||||||
try {
|
try {
|
||||||
Object.assign(sidebars, JSON.parse(localStorage.getItem('logigate:sidebars') ?? '{}'))
|
panelOpen.value = localStorage.getItem('logigate:panel') !== 'closed'
|
||||||
} catch {}
|
} catch {}
|
||||||
function toggleSidebar(side: 'left' | 'right', open = !sidebars[side]) {
|
function togglePanel(open = !panelOpen.value) {
|
||||||
sidebars[side] = open
|
panelOpen.value = open
|
||||||
try {
|
try {
|
||||||
localStorage.setItem('logigate:sidebars', JSON.stringify(sidebars))
|
localStorage.setItem('logigate:panel', open ? 'open' : 'closed')
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
/** Asks the canvas to centre on a part. */
|
/** Asks the canvas to centre on a part. */
|
||||||
|
|
@ -2308,9 +2308,9 @@ function create() {
|
||||||
transistorsOfNode,
|
transistorsOfNode,
|
||||||
toggleInvert,
|
toggleInvert,
|
||||||
nands,
|
nands,
|
||||||
rightTab,
|
panelTab,
|
||||||
sidebars,
|
panelOpen,
|
||||||
toggleSidebar,
|
togglePanel,
|
||||||
focusRequest,
|
focusRequest,
|
||||||
swapMany,
|
swapMany,
|
||||||
connectMany,
|
connectMany,
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ export function useMenu() {
|
||||||
function rename(id: string) {
|
function rename(id: string) {
|
||||||
ed.selection.value = [id]
|
ed.selection.value = [id]
|
||||||
ed.wireSel.value = []
|
ed.wireSel.value = []
|
||||||
ed.toggleSidebar('right', true)
|
|
||||||
ed.labelFocus.value++
|
ed.labelFocus.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue