lumbda/wasm/dist-repl/repl.css
russell@unturf.com 7ea65dba21
parity probe: cross-tier corpus + fix python remainder + asm modulo
New: wasm/tests/parity-cross-tier.mjs runs the parity-corpus.mjs (216
test cases tagged by whitepaper section / R7RS concept) against three
tiers — native python (reference), c-wasm, asm-wasm — and fails on any
unknown divergence. Known gaps live in KNOWN_DIVERGE so the table stays
green while the bignum / call/cc / etc. work proceeds.

Wired into `make wasm-test` so a regression against any spec claim gets
caught before merge.

Bugs caught and fixed:
  - python remainder: was `signed_a % signed_b * sign(a)`, which double-
    applied the sign of a (python's % floors) — gave -3 for (-17, 5)
    instead of the R7RS-correct -2. Now uses abs() on both sides.
  - asm-wasm modulo: was i32.rem_s (truncated, remainder semantics)
    where R7RS modulo wants sign of divisor. Added the "if rem and
    divisor disagree on sign, add divisor" branch.

Cross-tier numbers after fix:
  216 passing
    3 known diverge: expt-2-100, expt-3-50, big-arith — all asm-wasm
      (no bignums on the asm tier yet; whitepaper §2.1 claim still open)
    0 fail

REPL layout: body is now the scroll container, prompt-bar is
position:fixed at the viewport bottom so it doesn't get pushed off
screen by a long transcript. Empty space above the prompt on a fresh
session reads like a terminal.

All other tests still pass: 20 unit, 8 integration, 11 functional.
2026-06-14 15:21:19 -04:00

295 lines
7.4 KiB
CSS

/* lumbda repl — grid-only layout. Inherits palette + base from style.css. */
body.repl {
/* Body scrolls naturally. The prompt-bar is position: fixed so it
* stays glued to the viewport bottom; the transcript reserves bottom
* padding equal to the prompt-bar height so its last line isn't hidden
* underneath. */
min-height: 100vh;
overflow: auto;
}
/* ─── Lock screen overlay ──────────────────────────────────────── */
.lock-screen {
position: fixed; inset: 0; z-index: 1000;
display: grid;
place-items: center;
background: rgba(15, 17, 21, 0.85);
backdrop-filter: blur(4px);
}
.lock-card {
background: var(--pane-bg);
border: 1px solid var(--rule);
border-radius: 6px;
padding: 1.5rem 2rem;
max-width: 28rem;
width: 90%;
display: grid;
gap: 0.4rem;
}
.lock-card h2 {
margin: 0 0 0.1rem;
font-family: 'chunkfive', Georgia, serif;
font-size: 1.4rem;
color: var(--green);
font-weight: normal;
}
.lock-card p {
margin: 0;
font-size: 0.85rem;
color: var(--muted);
line-height: 1.5;
}
.lock-card input[type=password] {
width: 100%;
padding: 0.5rem 0.7rem;
margin: 0.4rem 0 0;
background: var(--code-bg);
color: var(--fg);
border: 1px solid var(--rule);
border-radius: 3px;
font-family: var(--mono);
font-size: 0.95rem;
}
.lock-card input[type=password]:focus {
outline: none;
border-color: var(--green);
}
.lock-row {
display: grid;
grid-template-columns: auto auto;
gap: 0.6rem;
margin-top: 0.5rem;
justify-content: start;
}
.lock-row button {
font-family: var(--mono);
font-size: 0.85em; font-weight: 600;
padding: 0.45rem 1.1rem;
border-radius: 3px;
cursor: pointer;
border: 1px solid var(--green);
}
.lock-row .primary { background: var(--green); color: var(--bg); }
.lock-row .secondary { background: transparent; color: var(--green); }
.lock-row .primary:hover { filter: brightness(1.1); }
.lock-row .secondary:hover { background: var(--code-bg); }
.lock-note {
margin: 0.4rem 0 0;
color: var(--err);
font-size: 0.8rem;
min-height: 1.2em;
}
.lock-explain {
margin: 0.4rem 0 0;
font-size: 0.78rem;
color: var(--muted);
}
.lock-explain summary {
cursor: pointer;
color: var(--green);
user-select: none;
}
.lock-explain summary:hover { text-decoration: underline; }
.lock-explain ul {
margin: 0.5rem 0 0;
padding-left: 1.1rem;
display: grid;
gap: 0.3rem;
}
.lock-explain li { line-height: 1.45; }
.lock-explain code {
background: var(--code-bg);
padding: 0 0.2em;
border-radius: 2px;
font-size: 0.92em;
}
.lock-explain a {
color: var(--green);
text-decoration: none;
}
.lock-explain a:hover { text-decoration: underline; }
.lock-explain strong { color: var(--fg); }
/* ─── Tab bar ──────────────────────────────────────────────────── */
.tabbar {
display: grid;
grid-template-columns: auto auto 1fr auto auto auto auto;
gap: 0.3rem;
align-items: center;
padding: 0.2rem 0 0.4rem;
background: transparent;
border-bottom: 1px dashed var(--rule);
margin-bottom: 0.4rem;
}
.tabs {
display: grid;
grid-auto-flow: column;
grid-auto-columns: max-content;
gap: 0.3rem;
overflow-x: auto;
}
.tab {
background: var(--pane-bg);
border: 1px solid var(--rule);
padding: 0.25rem 0.6rem;
border-radius: 3px 3px 0 0;
font-size: 0.85em;
cursor: pointer;
display: inline-grid;
grid-template-columns: auto auto;
gap: 0.3rem;
align-items: center;
white-space: nowrap;
}
.tab.active {
background: var(--code-bg);
border-bottom-color: var(--code-bg);
color: var(--green);
}
.tab .tab-close {
opacity: 0.5;
cursor: pointer;
padding: 0 0.2rem;
}
.tab .tab-close:hover { opacity: 1; color: var(--err); }
.tabbar .ghost {
background: transparent;
border: 1px solid var(--rule);
color: var(--muted);
font-family: var(--mono);
font-size: 0.8em;
padding: 0.2rem 0.6rem;
border-radius: 3px;
cursor: pointer;
}
.tabbar .ghost:hover:not(:disabled) {
border-color: var(--green); color: var(--green);
}
.tabbar .ghost:disabled { opacity: 0.4; cursor: default; }
/* ─── Transcript ───────────────────────────────────────────────── */
/* The REPL stream is the page's only scroller. Header stays pinned;
* tabs, transcript, and prompt all flow inside this one scroller so
* fresh sessions show the prompt up near the top and it drifts down
* with each new entry. */
.repl-stream {
padding: 0.5rem 1rem 0;
background: var(--code-bg);
display: grid;
grid-template-rows: auto auto auto;
align-content: start;
/* Leave room for the fixed prompt bar at the viewport bottom. */
padding-bottom: calc(3.6rem + env(safe-area-inset-bottom, 0));
}
.transcript {
font-family: var(--mono);
font-size: 0.92em;
line-height: 1.45;
max-width: 90rem;
margin: 0 auto;
width: 100%;
}
.transcript .entry {
margin: 0;
padding: 0;
}
.transcript .entry .prompt-line {
color: var(--green);
white-space: pre-wrap;
word-break: break-word;
}
.transcript .entry .prompt-line .sigil {
display: inline-block;
width: 3ch;
opacity: 0.7;
}
.transcript .entry .tier-output {
display: block;
padding: 0;
color: var(--fg);
}
.transcript .entry .tier-result {
white-space: pre-wrap;
word-break: break-word;
padding-left: 3ch; /* line up under "λ> " */
}
.transcript .entry .tier-meta {
color: var(--muted);
font-size: 0.78em;
margin-left: 0.6em;
user-select: none;
}
.transcript .entry .tier-meta::before {
content: "; "; /* render as a lisp comment */
color: var(--muted);
opacity: 0.6;
}
.transcript .entry.error .tier-result { color: var(--err); }
.transcript .entry + .entry { margin-top: 0.4rem; }
/* ─── Prompt bar ───────────────────────────────────────────────── */
.prompt-bar {
position: fixed;
left: 0; right: 0; bottom: 0;
z-index: 50;
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 0.4rem;
align-items: center;
padding: 0.5rem 1rem;
background: var(--code-bg);
border-top: 1px solid var(--rule);
}
.prompt-bar .prompt-sigil {
color: var(--green);
font-weight: 600;
font-size: 0.95em;
}
.prompt-bar textarea {
resize: none;
background: var(--code-bg);
border: none;
color: var(--fg);
padding: 0.25rem 0;
font-family: var(--mono);
font-size: 0.92em;
min-height: 1.5em;
max-height: 30vh;
min-width: 0;
}
.prompt-bar textarea:focus { outline: none; border-color: var(--green); }
.prompt-bar select {
background: var(--code-bg);
border: 1px solid var(--rule);
color: var(--fg);
padding: 0.35rem 0.5rem;
font-family: var(--mono);
font-size: 0.85em;
border-radius: 3px;
}
.prompt-bar button.primary {
background: var(--green);
color: var(--bg);
border: 1px solid var(--green);
padding: 0.4rem 1rem;
font-family: var(--mono);
font-weight: 600;
border-radius: 3px;
cursor: pointer;
}
.prompt-bar button.primary:hover { filter: brightness(1.1); }
.prompt-bar button.primary:disabled { opacity: 0.4; cursor: wait; }
kbd {
font-family: var(--mono);
background: var(--code-bg);
padding: 0.05em 0.3em;
border: 1px solid var(--rule);
border-radius: 2px;
font-size: 0.85em;
}