memlnaut-nisps/playground/src/primitives/Drawer.module.css
w1n5t0n c3fb63a113 feat(playground): UI primitive library + /dev/primitives showcase
Sixteen primitives at src/primitives/, each with its own .module.css and a
.demo.tsx that wires the primitive to live local state. All primitives
are typed (strict), pointer-event based (touch + mouse), keyboard-accessible
where it makes sense, and free of business logic.

Primitives:
- Slider, SliderBank: value sliders with optional curve mapping;
  collapsible sections.
- VirtualJoystick, XYPad: 2D pointer input, returning [0,1]^2.
- Heatmap: NxN canvas rendering with three color modes
  (luminance/variance/divergence) and a configurable palette.
- OutputDisplay: bar chart of N output values.
- TrainingControls: thumbs-up/down/undo + train/randomise + status.
- Drawer: portal'd slide-in panel from left or right; ESC + scrim close.
- ControlAxis: compound-axis slider (Boldness/Memory/Precision shape)
  with active-preset hint, endpoint labels, double-tap-to-relink.
- ProgressRing: SVG circular progress with optional inline label.
- PillToggle: segmented radio control.
- ParamEditor: min/max/curve/mute/pin/fixedValue editor for a single param.
- JoyMap: zoom minimap with adaptive grid + zoom window, vanishing trail
  with Catmull-Rom spline + tap-to-return, dual concentric noise rings,
  region pin overlays, frozen overlay.
- WeightHealth: 10-bin histogram + dead/saturating/healthy status glow.
- GradientFlow: per-layer bar chart with vanishing/exploding/converged
  color coding.
- LossPlot: log-scale line chart of training loss history.

App.tsx now wires the /dev/primitives route to a lazy-loaded
PrimitivesShowcase that renders all sixteen demos in a responsive grid.
Lazy import keeps the home page bundle ~20 kB while the showcase ships
its own ~42 kB chunk.

Stream 8 of the rewrite (meml-911).
2026-04-29 15:38:55 +03:00

92 lines
1.5 KiB
CSS

.root {
position: fixed;
inset: 0;
z-index: var(--z-drawer);
pointer-events: none;
}
.scrim {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.45);
pointer-events: auto;
animation: fadeIn var(--dur-fast) var(--ease);
}
.panel {
position: absolute;
top: 0;
bottom: 0;
background: var(--bg-1);
border-left: 1px solid var(--line);
pointer-events: auto;
display: flex;
flex-direction: column;
box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
animation: slideIn var(--dur-med) var(--ease);
}
.left .panel {
left: 0;
border-right: 1px solid var(--line);
border-left: 0;
animation-name: slideInLeft;
}
.right .panel {
right: 0;
}
.header {
display: flex;
align-items: center;
gap: var(--sp-3);
padding: var(--sp-3) var(--sp-4);
border-bottom: 1px solid var(--line);
flex: 0 0 auto;
}
.title {
flex: 1;
font-size: var(--fs-md);
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--fg-mute);
}
.close {
background: transparent;
border: 0;
font-size: 22px;
color: var(--fg-mute);
width: 32px;
height: 32px;
border-radius: var(--r-1);
padding: 0;
}
.close:hover {
background: var(--bg-2);
color: var(--fg);
}
.body {
flex: 1;
overflow: auto;
padding: var(--sp-3) var(--sp-4);
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
@keyframes slideInLeft {
from { transform: translateX(-100%); }
to { transform: translateX(0); }
}