Fully functional logic gates page
All checks were successful
Pre-release on non-main branches / prerelease (push) Successful in 28s

Signed-off-by: Alexander Lyall <alex@adcm.uk>
This commit is contained in:
2026-03-01 16:32:27 +00:00
parent ffab71cfcc
commit e0e72c17e8
16 changed files with 168 additions and 1585 deletions

View File

@@ -1,15 +1,83 @@
/* === LOGIC GATES CANVAS CSS === */
.lg-workspace {
position: relative;
/* === FULL PAGE OVERRIDES FOR LOGIC GATES === */
body:has(#logicPage) {
overflow: hidden; /* Prevents the entire page from scrolling */
}
body:has(#logicPage) .pageWrap {
max-width: 100% !important; /* Forces edge-to-edge canvas */
padding: 0 !important;
margin: 0 !important;
height: calc(100vh - var(--nav-h));
display: flex;
flex-direction: column;
}
#logicPage {
padding: 0 !important; /* CRITICAL: Stops the page/header from shifting when toolbox opens */
margin: 0 !important;
}
/* === MAIN CONTAINER === */
.lg-container {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
/* === FIXED HEADER (Ultra Compact) === */
.lg-top-header {
width: 100%;
text-align: center;
padding: 8px 20px 8px; /* Extremely tight padding to maximize canvas */
background: var(--bg);
z-index: 10;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-bottom: 1px solid rgba(255,255,255,0.08); /* Clean separation line */
}
.lg-title {
font-family: var(--bit-font);
font-size: 32px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text);
margin: 0 0 2px 0; /* Minimal gap between title and subtitle */
line-height: 1;
}
.lg-subtitle {
color: var(--muted);
font-size: 14px;
font-family: var(--ui-font);
font-weight: 500;
margin: 0;
line-height: 1.2;
}
.lg-subtitle kbd {
background: rgba(255,255,255,0.1);
padding: 2px 6px;
border-radius: 4px;
font-family: var(--ui-font);
color: #e8e8ee;
}
/* === DYNAMIC CANVAS === */
.lg-workspace {
flex: 1; /* Automatically fills all remaining vertical space */
position: relative;
width: 100%;
min-height: 750px;
background-color: transparent;
background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
background-size: 24px 24px;
border: none;
border-radius: 0;
box-shadow: none;
overflow: hidden;
}
@@ -29,7 +97,7 @@
fill: none;
stroke-linecap: round;
transition: stroke 0.1s ease, filter 0.1s ease, stroke-width 0.1s ease;
pointer-events: stroke; /* Allows wires to be clicked */
pointer-events: stroke;
cursor: pointer;
}
.lg-wire:hover {
@@ -56,7 +124,7 @@
pointer-events: none;
}
/* Nodes (Borderless & Transparent) */
/* Nodes */
.lg-node {
position: absolute;
background: transparent;
@@ -68,17 +136,12 @@
align-items: center;
cursor: grab;
z-index: 10;
box-shadow: none;
backdrop-filter: none;
user-select: none;
transition: filter 0.2s;
}
.lg-node:active { cursor: grabbing; z-index: 20; }
.lg-node.selected {
filter: drop-shadow(0 0 10px rgba(255,85,85,0.8));
}
.lg-node.selected { filter: drop-shadow(0 0 10px rgba(255,85,85,0.8)); }
/* Node Labels (Seven-Segment, +2 Sizes Bigger) */
.lg-header {
font-size: 24px;
color: var(--muted);
@@ -88,40 +151,71 @@
margin-bottom: 6px;
}
/* Container mapping SVGs to absolutely positioned connection dots */
.lg-gate-container {
position: relative;
display: inline-flex;
align-items: center;
}
.lg-gate-svg {
width: 100px;
height: 50px;
display: block;
}
.lg-line-svg {
width: 30px;
height: 50px;
display: block;
}
.lg-gate-svg { width: 100px; height: 50px; display: block; }
.lg-line-svg { width: 30px; height: 50px; display: block; }
/* Connection Ports */
.lg-port {
width: 16px; height: 16px; background: #a9acb8; border-radius: 50%; cursor: crosshair;
border: 3px solid var(--bg); box-shadow: 0 0 0 1px rgba(255,255,255,0.2); transition: all 0.2s;
position: absolute; z-index: 5;
transform: translate(-50%, -50%); /* Centers the dot exactly over the coordinate */
transform: translate(-50%, -50%);
}
.lg-port:hover { transform: translate(-50%, -50%) scale(1.3); background: #fff; }
.lg-port.active { background: #28f07a; box-shadow: 0 0 12px rgba(40,240,122,0.8); border-color: #1f2027; }
/* Draggable Toolbox Visual Gates Grid */
/* === FLOATING TOOLBOX === */
.toolboxToggle {
position: absolute;
top: 10px; /* Snug inside the thinner header */
right: 20px;
z-index: 90;
display: flex; align-items: center; gap: 10px; padding: 8px 14px;
border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.15);
backdrop-filter: blur(8px); color: rgba(232,232,238,.95); font-family: var(--bit-font);
font-weight: 800; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
}
.toolboxIcon { font-size: 20px; filter: drop-shadow(0 0 8px rgba(255,105,180,.35)); }
.toolboxToggle:hover { border-color: rgba(255,255,255,.22); }
.lg-toolbox {
position: absolute;
top: 60px; /* Sits right under the new thin header */
right: 20px;
bottom: 20px; /* Constrains the height so it scrolls internally */
width: var(--toolbox-w, 360px);
z-index: 80;
display: flex;
flex-direction: column;
gap: 16px;
transform: translateX(0);
transition: transform 420ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
overflow-y: auto;
pointer-events: auto;
padding-right: 6px;
}
/* Faded Subdued Scrollbars */
.lg-toolbox::-webkit-scrollbar { width: 6px; }
.lg-toolbox::-webkit-scrollbar-track { background: transparent; }
.lg-toolbox::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; transition: background 0.3s; }
.lg-toolbox:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }
.lg-toolbox::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }
.lg-container.toolboxCollapsed .lg-toolbox {
transform: translateX(calc(100% + 40px));
opacity: 0;
pointer-events: none;
}
/* Toolbox Grid */
.tb-icon-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.tb-icon-box {
background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15);
@@ -132,14 +226,6 @@
.tb-icon-box:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }
.tb-icon-label { font-family: var(--ui-font); font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: 1px; text-transform: uppercase; }
/* Toolbox Scroll Fix */
.panelCol {
max-height: calc(100vh - var(--nav-h) - 30px) !important;
overflow-y: auto;
padding-bottom: 30px;
pointer-events: auto;
}
/* Truth Table */
.tt-summary {
font-family: var(--ui-font); font-size: 14px; font-weight: 800;
@@ -147,17 +233,15 @@
outline: none; margin-bottom: 10px; text-transform: uppercase;
}
.tt-table-wrap {
width: 100%; max-height: 300px; overflow-y: auto; overflow-x: auto;
width: 100%; max-height: 250px; overflow-y: auto; overflow-x: auto;
border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2);
}
.tt-table {
width: 100%; border-collapse: collapse; text-align: center;
font-family: var(--num-font); font-size: 14px; color: #e8e8ee;
}
.tt-table th {
position: sticky; top: 0; background: rgba(31,32,39,0.95);
padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.15);
color: var(--muted); font-family: var(--bit-font); font-weight: normal;
}
.tt-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.tt-table-wrap::-webkit-scrollbar-track { background: transparent; }
.tt-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.tt-table-wrap:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); }
.tt-table { width: 100%; border-collapse: collapse; text-align: center; font-family: var(--num-font); font-size: 14px; color: #e8e8ee; }
.tt-table th { position: sticky; top: 0; background: rgba(31,32,39,0.95); padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.15); color: var(--muted); font-family: var(--bit-font); font-weight: normal; }
.tt-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.tt-table .tt-on { color: #28f07a; text-shadow: 0 0 8px rgba(40,240,122,0.5); }