lumbda/wasm/app/style.css
russell@unturf.com 1b7de2c9c6
wasm/playground: cancel button, asm state-leak fix, restyle to match homepage
User-visible changes
  - Cancel button — terminates the running worker. Pyodide's slow mandelbrot
    no longer freezes the UI; click cancel and the elapsed counter freezes
    at "(cancelled @ NNNN ms)".
  - Live ms counter ticks per animation frame while a tier is busy, so the
    Pyodide tier's ~5-15 s wait is visible instead of looking hung.
  - Restyled to match lumbda.com: chunkfive wordmark, --green: #227842
    (light) / #5ec07a (dark), lumbda-logo-green.png, lowercase "lumbda"
    everywhere. Pulls fonts/chunkfive locally so the playground stays
    self-contained.

Architecture
  - All tier evaluations now run inside a Web Worker (wasm/app/worker.mjs)
    so the main thread stays responsive. Cancel = worker.terminate(); next
    eval respawns a fresh worker.
  - Loaders use new URL("./...", import.meta.url) so paths resolve against
    the loader file's own location — works identically in window and
    worker contexts, no baseURL argument needed.
  - C tier Emscripten build flipped to EXPORT_ES6=1; loader uses dynamic
    `import()` of the factory module. Integration test updated accordingly.
  - Python loader uses `import("pyodide.mjs")` (ES module) instead of
    document.createElement, which doesn't exist in workers.

Bug fixes
  - Asm tier state leak: running the same demo twice on a cached WASM
    instance produced corrupted output (every other cell on row 2+ rendered
    as " " instead of the expected shade char). Root cause: top-level eval
    passed `global_env` as the env, so closures captured stale globals;
    fixed by passing NIL — env_lookup falls back to the CURRENT global_env
    via its existing two-pass walk. Multi-run regression added to the
    functional test suite.
  - fib-ack demo: (ack 3 4) was too heavy for Pyodide (minutes). Cut to
    (ack 3 3) + (fib 20) max so every tier finishes in seconds.

Test discipline
  - Root `make test-all` now includes `wasm-test`. Adding a language
    feature without exercising it on all six implementations is no longer
    possible by accident.
  - Functional suite: 11 assertions (was 10) — adds asm multi-run stability.
  - Integration + unit: still 20 + 8.
2026-06-14 12:13:20 -04:00

281 lines
6.1 KiB
CSS

/* lumbda playground — styled to match lumbda.com homepage.
* palette + typography mirror www/style.css.
*/
@font-face {
font-family: 'chunkfive';
src: url('fonts/chunkfive/chunkfive-regular-webfont.woff2') format('woff2'),
url('fonts/chunkfive/chunkfive-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
:root {
--fg: #1a1a1a;
--bg: #fafaf7;
--muted: #666;
--accent: #227842; /* single brand green — matches homepage */
--green: #227842;
--rule: #d4d4d0;
--code-bg: #f0ede4;
--pane-bg: #ffffff;
--busy: #b15a00;
--err: #b1262b;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
@media (prefers-color-scheme: dark) {
:root {
--fg: #e8e6e0;
--bg: #161613;
--muted: #9a9892;
--accent: #5ec07a; /* lightened for contrast on dark bg */
--green: #5ec07a;
--rule: #3a3a36;
--code-bg: #22221f;
--pane-bg: #1c1c19;
--busy: #e0a050;
--err: #f06070;
}
}
* { box-sizing: border-box; }
html, body {
margin: 0; padding: 0;
background: var(--bg);
color: var(--fg);
font-family: var(--mono);
font-size: 14px;
line-height: 1.55;
min-height: 100%;
}
/* ─── Header ────────────────────────────────────────────────────── */
header {
border-bottom: 1px solid var(--rule);
padding: 1.5rem 1.5rem 1rem;
}
.brand {
display: inline-flex;
align-items: flex-end;
gap: 0.6rem;
text-decoration: none;
color: inherit;
}
.brand:hover .period { transform: translateY(-2px); }
.brand .logo {
width: 3.2rem;
height: auto;
display: block;
}
header h1 {
font-family: 'chunkfive', Georgia, serif;
font-size: 2.4rem;
margin: 0;
letter-spacing: -0.01em;
line-height: 1;
font-weight: normal;
}
header h1 .period {
color: var(--green);
display: inline-block;
transition: transform 120ms ease;
}
header .tagline {
font-family: 'chunkfive', Georgia, serif;
color: var(--muted);
margin: 0.4rem 0 0.6rem;
font-size: 1rem;
letter-spacing: 0.01em;
}
header .lede {
margin: 0;
max-width: 70rem;
color: var(--fg);
font-size: 0.85rem;
line-height: 1.55;
}
header .lede strong {
color: var(--green);
font-weight: 600;
}
header code {
background: var(--code-bg);
padding: 0 0.2em;
border-radius: 2px;
font-size: 0.9em;
}
/* ─── Controls ──────────────────────────────────────────────────── */
.controls {
padding: 0.75rem 1.5rem;
border-bottom: 1px solid var(--rule);
display: flex;
gap: 1rem;
align-items: center;
flex-wrap: wrap;
background: var(--bg);
}
.controls fieldset {
border: 1px solid var(--rule);
border-radius: 3px;
padding: 3px 10px 5px;
margin: 0;
background: var(--pane-bg);
}
.controls fieldset legend {
color: var(--muted);
font-size: 0.7rem;
padding: 0 0.4em;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.controls label {
margin-right: 0.7em;
cursor: pointer;
user-select: none;
font-size: 0.85em;
}
.controls label input {
margin-right: 0.3em;
accent-color: var(--green);
}
.controls button {
font-family: var(--mono);
font-size: 0.85em;
font-weight: 600;
padding: 6px 16px;
border-radius: 3px;
cursor: pointer;
border: 1px solid var(--green);
}
.controls button.primary {
background: var(--green);
color: var(--bg);
}
.controls button.primary:hover { filter: brightness(1.08); }
.controls button.primary:disabled {
opacity: 0.4; cursor: wait;
filter: none;
}
.controls button.secondary {
background: transparent;
color: var(--green);
}
.controls button.secondary:hover {
background: var(--code-bg);
}
.controls button.secondary:disabled {
opacity: 0.35; cursor: default;
}
.controls .status {
color: var(--muted);
font-size: 0.8em;
margin-left: auto;
}
.controls .status.busy { color: var(--busy); }
.controls .status.warn { color: var(--busy); }
.controls .status.err { color: var(--err); }
.controls .status.ok { color: var(--green); }
/* ─── Panes ─────────────────────────────────────────────────────── */
.panes {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1px;
background: var(--rule);
height: calc(100vh - 260px);
min-height: 360px;
}
.pane {
background: var(--pane-bg);
padding: 0.5rem 0.75rem 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
}
.pane h2 {
margin: 0 0 0.4rem;
font-size: 0.7rem;
font-weight: 500;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.1em;
}
#editor {
flex: 1;
overflow: hidden;
border-radius: 2px;
}
.cm-editor { height: 100%; font-size: 13px; }
.cm-editor.cm-focused { outline: none; }
#output {
flex: 1;
white-space: pre;
overflow: auto;
background: var(--code-bg);
border-radius: 2px;
padding: 0.6rem 0.8rem;
font-size: 13px;
line-height: 1.35;
}
#output .tier-block { margin-bottom: 1rem; }
#output .tier-block:last-child { margin-bottom: 0; }
#output .tier-block h3 {
margin: 0 0 0.25rem;
font-size: 0.7rem;
color: var(--green);
text-transform: uppercase;
letter-spacing: 0.1em;
font-weight: 600;
}
#output .tier-block .time {
color: var(--muted);
font-size: 0.65rem;
font-weight: 400;
letter-spacing: 0;
text-transform: none;
}
#output .tier-block pre {
margin: 0;
white-space: pre;
font-family: var(--mono);
}
#output .err {
color: var(--err);
}
/* ─── Footer ────────────────────────────────────────────────────── */
footer {
padding: 0.7rem 1.5rem;
border-top: 1px solid var(--rule);
color: var(--muted);
font-size: 0.75rem;
}
footer code {
background: var(--code-bg);
padding: 0 0.2em;
border-radius: 2px;
}
footer a {
color: var(--green);
text-decoration: none;
}
footer a:hover { text-decoration: underline; }
footer strong { color: var(--fg); }