Files
improvise/web/style.css
T
Edward Langley a93d668e5e feat(browser): paint the page bar and the totals strip, and delegate the pointer
improvise-p7lh: `GridCache::page_coords` and `GridCache::totals` were projected
to every session and folded correctly by every client, and NO front end read
either. The shipped front page — `web/demo.improv` is `Quarter: page, Q1` —
drew a grid filtered to Q1 with nothing saying so, and `[`/`]` resolve locally
off that same `page_coords`, so a user could page through quarters watching
every number change with no way to tell which one they were looking at.

`RenderModel` gains `page_coords` and `totals`, fed straight off `state.grid`.
The Page/Filter split is asked of `PageAxis::cycle` rather than re-derived from
`items.is_some()`, which disagrees with it on an empty item list (gotcha 27).
The totals are RELAYED, never summed in the client: the sum runs over every row
including ones a viewport scrolled past (gotcha 44).

`web/tests/render_surface.test.js` gains the direction that would have caught
this when improvise-n10 added the fields. The existing guard is closed under
what `RenderModel` chose to expose, so a cache field that never reaches it is
invisible to it; the new one asks that every `pub` field of every widget cache
is read somewhere the browser runs, or is named as debt with a reason.
`grid.col_widths` is the one entry, pointing at improvise-pcje.

improvise-b8ot: the five clickable surfaces moved from one listener per node,
reallocated inside the render loops on every repaint, to one handler per stable
delegation root — the user's ruling. The operands are carried on the node as
data attributes and read back by a pure `cellAction`/`indexAction` in
`web/shell.js`, so the handler is a LOOKUP rather than a second derivation of
which data row was clicked: `gridPlan` counts data rows because a group header
is not one, and walking the table back up would disagree the moment one appears.
The editor's own keydown/blur stay direct — one transient node, one at a time,
and `blur` does not bubble.

All four documented behaviours a naive delegation loses are preserved and each
is now asserted in `harness/tests/contract.spec.js`: mousedown rather than click
(asserted by dispatching mousedown ALONE), `preventDefault` and only over a cell,
the conditionally skipped repaint (asserted by the editor's survival), and
closing a live editor before composing the click.

Gates: 1598 passed / 0 failed / 7 ignored over 37 binaries (baseline 1595);
node --test 47 over 6 files (baseline 36 over 5); Playwright 47 passed /
4 skipped (baseline 43 / 4); clippy, fmt and --check-evidence clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FC2jVn8Au7E9JPkw6bwXXH
2026-09-21 19:21:57 -07:00

332 lines
5.6 KiB
CSS

/* Legibility only. Styling the browser client properly is not improvise-cr3. */
:root {
--bg: #fbfaf7;
--fg: #1c1b19;
--line: #d8d4cc;
--accent: #2f6f4f;
--selected: #e8e2d4;
--error: #a8322d;
color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #17181a;
--fg: #e7e4de;
--line: #35373b;
--accent: #7fc4a0;
--selected: #2c2f33;
--error: #e2827c;
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
background: var(--bg);
color: var(--fg);
font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
header {
display: flex;
gap: 1rem;
align-items: baseline;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--line);
}
header h1 {
margin: 0;
font-size: 1rem;
color: var(--accent);
}
#doc-name {
opacity: 0.85;
}
#mode {
color: var(--accent);
}
#status {
margin-left: auto;
opacity: 0.75;
}
main {
flex: 1;
display: flex;
min-height: 0;
}
#categories {
width: 15rem;
flex: none;
overflow: auto;
padding: 0.5rem;
border-right: 1px solid var(--line);
}
#formulas,
#views {
width: 18rem;
flex: none;
overflow: auto;
padding: 0.5rem;
border-right: 1px solid var(--line);
}
#categories ul,
#formulas ul,
#views ul {
margin: 0;
padding: 0;
list-style: none;
}
#views .axes {
margin-left: 0.5rem;
opacity: 0.6;
font-size: 0.85em;
}
#views .active .name {
color: var(--accent);
}
/* The tile bar. One line above the grid, as the TUI draws it. */
#tiles {
display: flex;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
border-bottom: 1px solid var(--line);
overflow-x: auto;
white-space: nowrap;
}
#tiles .tile {
padding: 0 0.4rem;
border: 1px solid var(--line);
border-radius: 3px;
font-size: 0.85em;
}
/* The page bar. Magenta in the TUI; the FACT that an axis is navigable is
`cycle`, decided in Rust, and only this weight is the page's. */
#pages {
display: flex;
gap: 0.5rem;
padding: 0.25rem 0.5rem;
border-bottom: 1px solid var(--line);
overflow-x: auto;
white-space: nowrap;
font-size: 0.85em;
}
#pages .page-axis {
padding: 0 0.4rem;
border: 1px solid var(--line);
border-radius: 3px;
opacity: 0.7;
}
#pages .navigable {
color: var(--accent, inherit);
opacity: 1;
}
/* The totals strip. Never summed here — it is projected, because the sum runs
over rows this viewport scrolled past. */
tfoot th,
td.total {
font-weight: 700;
border-top: 2px solid var(--line);
/* `td:not(.editable)` dims every unsettable cell; a total is unsettable and
is not incidental, so it opts back out. */
opacity: 1;
}
#categories .item {
padding-left: 1.5rem;
opacity: 0.85;
}
#categories .selected,
#formulas .selected,
#views .selected,
#tiles .selected,
td.selected {
background: var(--selected);
outline: 1px solid var(--accent);
}
#hint {
opacity: 0.7;
font-size: 0.85em;
}
/* A keyboard edit in progress. Left-aligned even in a numeric column,
because what is drawn is the text being typed rather than a value. */
td.typing {
text-align: left;
outline: 2px solid var(--accent);
}
#grid {
flex: 1;
overflow: auto;
padding: 0.5rem;
}
table {
border-collapse: collapse;
}
th,
td {
border: 1px solid var(--line);
padding: 0.25rem 0.5rem;
min-width: 6rem;
height: 1.75rem;
text-align: left;
font-weight: normal;
}
th {
background: color-mix(in srgb, var(--line) 35%, transparent);
font-weight: 600;
}
/* A group header, on either axis. The TUI draws these green and bold; the
glyph is already in the text (`indicator` in app.js). */
th.group {
color: var(--accent, inherit);
font-weight: 700;
}
td.numeric {
text-align: right;
}
td.error {
color: var(--error);
}
/* The only affordance that matters: a cell the server said is settable. */
td.editable {
cursor: text;
}
td:not(.editable) {
opacity: 0.7;
}
td input {
width: 100%;
border: none;
padding: 0;
font: inherit;
color: inherit;
background: transparent;
}
/* The page cannot reach a server from a static host, and says so. */
#backend-notice {
margin: 0;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--line);
background: color-mix(in srgb, var(--accent) 10%, transparent);
font-size: 0.85rem;
}
#backend-notice code {
background: color-mix(in srgb, var(--line) 45%, transparent);
padding: 0 0.25rem;
}
/* The help overlay. Content is improvise_protocol::help's; this is paint. */
#help {
position: fixed;
inset: 2rem;
overflow: auto;
padding: 1rem;
border: 1px solid var(--accent);
background: var(--bg);
font-size: 0.9rem;
}
.help-tabs {
display: flex;
gap: 0.75rem;
border-bottom: 1px solid var(--line);
padding-bottom: 0.5rem;
margin-bottom: 0.75rem;
}
.help-tab.active {
color: var(--accent);
font-weight: 600;
}
.help-body {
display: grid;
grid-template-columns: 16rem 1fr;
gap: 0 1rem;
margin: 0;
}
.help-body dt,
.help-body dd {
margin: 0;
min-height: 1.2em;
}
.help-heading {
grid-column: 1 / -1;
font-weight: 600;
color: var(--accent);
}
.help-banner {
grid-column: 1 / -1;
font-weight: 700;
}
.help-text,
.help-accent,
.help-blank {
grid-column: 1 / -1;
white-space: pre;
}
.help-dim {
opacity: 0.7;
}
/* The bottom-bar prompt while a text-entry mode is open. The colour is the
mode's own answer (`MinibufColor`); this is the last translation, exactly
as `draw.rs::minibuf_fg` is the TUI's. */
#minibuffer {
padding: 0.25rem 0.5rem;
font-family: inherit;
border-top: 1px solid var(--accent);
}
#minibuffer.green {
color: #7ec699;
}
#minibuffer.cyan {
color: #6fd0d8;
}
#minibuffer.yellow {
color: #d8c96f;
}