Public: anyone can read this; the crew can change it.
Design: /system's memory chart pair uses the base grid utility, and sys-pair leaves §5d #4080
scout/forge:scout/3953-design-system-s-memory-chart-pair-uses-t → main 17 commits fork 3 threads · 3 unresolved
4 files
changed +26
−6
docs/DESIGN.md +3 −3
| @@ -210,8 +210,8 @@ specification. | ||
| 210 | 210 | | **inbox** (`asks_page.ts`) | one list above the feed | — | _On you_: what asks you and what is assigned to you, one row each, each with what it waits for (`needsYouSection`), and one count in the top bar. Absent when empty: a card saying nothing is a zero drawn | the same two panes on the dashboard | |
| 211 | 211 | | **look** (`pages/looks.ts`) | `.look` in a `.looks` strip | `.look[data-slot=phone\|desktop\|thumb\|now]` sizes the frame; `.looks[data-compare]` sets two sides (before · main, then after · the pull) beside each other | a picture always carries its own `width`/`height`, so nothing shifts when it loads; a phone keeps 200px, a desktop takes the rest up to its own size, and under 640px a strip stacks; an attached picture is a `figure` in the strip with its line under it | the picture in the terminal (§6·0c) | |
| 212 | 212 | | **board** (`pages/board.ts`) | `.board` (`.board-grid`, `.board-region`) | `data-wall` (across the room: no keys, no pointer, larger), `data-focus=working\|landed\|decided\|today` | the one whole-screen layout: four live regions fill a second monitor ≥1100px and each list scrolls on its own, one column below; above the panels only a collapsed one-line `#notes` (`<details>`: closed by default, an open list stays open across live swaps), the strips below them; inside, only §5 parts (list card rows, badges, meters, `kbd`); a swapped region's heading wears `data-fresh` for a moment | four panes, one focused by its number | |
| 213 | | **stacked bar chart** `windowSvg()` (`fleet-graph.ts`) | `.plots`, `.plot` (`.plot-name`), `.plot-legend` | bars wear `fg-sN`, the `--series-N` token | server-drawn SVG with `width`/`height` set, so it holds its box before the stylesheet; gridlines `--border`, figures `--muted-fg` in mono, panel names `--faint`; `role="img"` with an `aria-label` totalling it, a `<title>` per bar, and a table of the same numbers beside it | a table of the same numbers | | |
| 214 | | **chart** `chartBox()` (`ui.ts`) | `.chart-box` wrapping `drawChart`'s svg `.chart` (`.big` for the headline figure) | `.is-table` for a table panel | one query or series drawn on the server: the svg carries its own `width`/`height` and the box holds its space, so nothing shifts; `role="img"` with an `aria-label` of its title. Reach for it wherever a page draws a `boards/chart.ts` chart — `/system`'s memory pair and every board panel — and size it from the page (`.bp-*`, `.sys-pair`, `.bgrid`), never inside the frame | the same numbers as a table | | |
| 213 | | **stacked bar chart** `windowSvg()` (`fleet-graph.ts`) | `.plots`, `.plot` (`.plot-name`), `.plot-legend` | bars wear `fg-sN`, the `--series-N` token | server-drawn SVG; `.plots` is also the two-up grid of /system's memory charts, side by side once the content is 776 px wide (two 380 px columns and the 16 px gap), one column below, the fleet graph unchanged; the SVG carries `width`/`height`, so it holds its box before the stylesheet; gridlines `--border`, figures `--muted-fg` in mono, panel names `--faint`; `role="img"` with an `aria-label` totalling it, a `<title>` per bar, and a table of the same numbers beside it | a table of the same numbers | | |
| 214 | | **chart** `chartBox()` (`ui.ts`) | `.chart-box` wrapping `drawChart`'s svg `.chart` (`.big` for the headline figure) | `.is-table` for a table panel | one query or series drawn on the server: the svg carries its own `width`/`height` and the box holds its space, so nothing shifts; `role="img"` with an `aria-label` of its title. Reach for it wherever a page draws a `boards/chart.ts` chart — `/system`'s memory pair and every board panel — and size it from the page (`.bp-*`, `.bgrid`), never inside the frame | the same numbers as a table | | |
| 215 | 215 | |
| 216 | 216 | Two things are deliberately **not** in the vocabulary: skeleton loaders (the |
| 217 | 217 | server renders whole pages — there is nothing to skeletonise) and a custom |
| @@ -395,7 +395,7 @@ gone, so this list only shrinks. | ||
| 395 | 395 | A `.field` directly inside a `.bar` drops its bottom margin and the bar aligns to the end, so a labelled input and its button share a baseline |
| 396 | 396 | - **`style/components.ts`** — parts of the §5 components that the table does not spell out — the palette's list, the menu's items, a dialog's head and foot, comments, the theme picker — and a few small helpers beside them: `.cat` `.clone` `.clone-text` `.comment` `.comment-body` `.comment-form` `.dash` `.dialog-body` `.dialog-foot` `.dialog-head` `.empty-title` `.error-note` `.field-row` `.form-actions` `.hex` `.ico` `.ico-loader` `.list` `.live-status` `.menu-item` `.menu-panel` `.menu-sep` `.menu-title` `.palette-empty` `.palette-foot` `.palette-group` `.palette-heading` `.palette-input` `.palette-item` `.palette-list` `.passkey` `.passkey-lead` `.passkey-note` `.passkey-off` `.passkey-on` `.preview` `.sep` `.split` `.sprite` `.swatch` `.table-scroll` `.tell-here` `.theme-apply` `.theme-option` `.tick` `.timeline` `.tl-dot` `.toast-body` `.topbar-search` |
| 397 | 397 | - **`style/components.ts`, settings rows** — a list whose rows are settings (limits, capacity): the `<ul class="list setting-list">` lets title and meta wrap instead of ellipsizing, and a row's controls take their own line under 640px. `.row-fields` is the form in that row's trail (input, Save, Default): always visible, never hover-gated, wrapping under the text before it would clip. Use both for any page whose rows show a name, a current value, and a control to change it; use `.row-actions` only for secondary actions (delete, wake, pin, revoke). Flags, telemetry, cloud, people, crew roles and subscription headroom/budget use `.row-fields`. Classes: `.row-fields` `.setting-list` |
| 398 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, lineage: `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.commit-body` `.commit-head` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.sys-pair` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` | |
| 398 | - **`style/content.ts`, page furniture** — what frames a page's content: page and repo heads, the merge box, the front page and its tiles, explore, backups, boards, the fleet chart's series colours, lineage: `.app-shelf` `.app-tile` `.app-tile-body` `.app-tile-desc` `.app-tile-look` `.app-tile-name` `.backups-drill` `.backups-error` `.backups-now` `.backups-restore` `.bform` `.bgrid` `.big` `.bmanage` `.boards-result` `.bp-h2` `.bp-h3` `.bp-w2` `.bp-w3` `.break` `.bt-bar` `.bt-grid` `.bt-group` `.bt-hist` `.bt-name` `.bt-procs` `.bt-row` `.bt-val` `.chart` `.chart-box` `.commit-body` `.commit-head` `.domain-records` `.explore-filters` `.explore-line` `.explore-main` `.explore-name` `.explore-row` `.fg-s0` `.fg-s1` `.fg-s2` `.fg-s3` `.fg-s4` `.fg-s5` `.fg-s6` `.fg-s7` `.filters` `.flag-form` `.front-admin` `.front-controls` `.front-crew` `.front-featured` `.front-featured-body` `.front-featured-look` `.front-issues` `.front-live` `.front-more` `.front-pick` `.front-pin-any` `.front-weights` `.frozen` `.frozen-form` `.frozen-sentence` `.headroom` `.issue-head` `.issue-meta` `.merge-box` `.merge-form` `.merge-headline` `.merge-sub` `.mirror-form` `.number` `.origin-link` `.origin-mark` `.origin-name` `.origin-row` `.owner` `.page-head` `.path-head` `.policy-line` `.qf` `.repo-actions` `.repo-audience` `.repo-desc` `.repo-layout` `.repo-lineage` `.repo-title` `.search` `.slash` `.stage-detail` `.stage-dot` `.steps` `.sub` `.table-wrap` `.terminal-line` `.tok` `.tree-row` `.tree-total` `.wall-cells` `.where-sep` | |
| 399 | 399 | - **`style/content.ts`, code view** — the source view and the syntax-highlight token classes `highlight-html.ts` builds as `tok-${kind}`: `.blob-view` `.ln` `.tok-attribute` `.tok-comment` `.tok-constant` `.tok-decorator` `.tok-deleted` `.tok-emphasis` `.tok-function` `.tok-heading` `.tok-inserted` `.tok-keyword` `.tok-link` `.tok-meta` `.tok-number` `.tok-operator` `.tok-plain` `.tok-property` `.tok-punctuation` `.tok-regex` `.tok-string` `.tok-tag` `.tok-type` `.tok-variable` |
| 400 | 400 | - **`style/content.ts`, prose (markdown)** — table cell alignment, built by `markdown.ts` as `ta-${align}`: `.ta-c` `.ta-r` |
| 401 | 401 | - **`style/content.ts`, diff viewer** — the diff table: its gutters, line kinds, file head and inline review comments: `.add` `.del` `.dh` `.diff` `.diff-body` `.diff-head` `.diff-note` `.diff-path` `.diff-stat` `.diff-stub` `.diff-summary` `.diff-table` `.dl` `.dl-review` `.dn` `.dn-comment` `.nonl` `.rc-hidden` `.rc-resolve` `.rc-resolved` `.wd` |
src/web/style/components.ts +1 −1
| @@ -348,7 +348,7 @@ a.sha:hover { color: var(--accent); } | ||
| 348 | 348 | /* Cards stacked in normal flow space themselves. Inside a container that |
| 349 | 349 | already manages its own spacing with gap, that margin would double it. */ |
| 350 | 350 | .card + .card { margin-top: 12px; } |
| 351 | :is(.stack, .dash, .split, .timeline) > .card + .card { margin-top: 0; } | |
| 351 | :is(.stack, .dash, .split, .timeline, .plots) > .card + .card { margin-top: 0; } | |
Fine: the reset is scoped to |
||
| 352 | 352 | .card-head { |
| 353 | 353 | display: flex; align-items: center; gap: 8px; flex-wrap: wrap; |
| 354 | 354 | padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--muted); |
src/web/style/content.ts −2
| @@ -318,8 +318,6 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 318 | 318 | .bt-procs { font-size: 12.5px; } |
| 319 | 319 | .bt-procs th, .bt-procs td { padding: 2px 8px; white-space: nowrap; } |
| 320 | 320 | .bt-group th, .bt-group td { background: var(--muted); font-weight: 600; } |
| 321 | .sys-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; } | |
| 322 | .sys-pair .chart-box { max-width: none; } | |
| 323 | 321 | .bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; } |
| 324 | 322 | .bp-w2 { grid-column: span 2; } |
| 325 | 323 | .bp-w3 { grid-column: span 3; } |
test/system-memory.test.ts +22
| @@ -7,6 +7,7 @@ import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | ||
| 7 | 7 | import { mkdtemp, rm } from "node:fs/promises"; |
| 8 | 8 | import { tmpdir } from "node:os"; |
| 9 | 9 | import { join } from "node:path"; |
| 10 | import { components } from "../src/web/style/components.ts"; | |
| 10 | 11 | import { createApp } from "../src/app.ts"; |
| 11 | 12 | import { HOUR_MS, memoryHours, recordMemory } from "../src/boards/memory.ts"; |
| 12 | 13 | import { createToken } from "../src/core/tokens.ts"; |
| @@ -118,3 +119,24 @@ describe("reaching /system", () => { | ||
| 118 | 119 | expect(await res.text()).toContain("<h1>"); |
| 119 | 120 | }); |
| 120 | 121 | }); |
outdated
This finds the rule by searching for "> .card + .card" in the stylesheet text, so rewording the selector breaks the test. Asserting on a regex that matches the :is(...) list would be steadier. |
||
| 122 | ||
| 123 | describe("memory chart pair layout (#3953)", () => { | |
| 124 | test("the charts sit in the base .plots grid and sys-pair is gone", async () => { | |
| 125 | recordMemory(app.db, 100 * MiB, 50 * MiB, Date.now()); | |
| 126 | const body = await (await get("alice")).text(); | |
| 127 | expect(body).toContain('<div class="plots">'); | |
| 128 | expect(body).not.toContain("sys-pair"); | |
| 129 | expect(body).toContain("RSS (MiB, hourly mean)"); | |
| 130 | expect(body).toContain("JS heap (MiB, hourly mean)"); | |
| 131 | }); | |
| 132 | ||
| 133 | test("the second card in the grid takes no stacked margin, so the pair aligns", () => { | |
| 134 | const rule = components.match(/:is\(([^)]*)\)\s*>\s*\.card\s*\+\s*\.card\s*\{([^}]*)\}/); | |
| 135 | expect(rule?.[1]).toContain(".plots"); | |
| 136 | expect(rule?.[2]).toMatch(/margin-top:\s*0/); | |
| 137 | }); | |
| 138 | ||
| 139 | test("the shared .plots grid keeps its 380px column, so the fleet graph is unchanged", () => { | |
| 140 | expect(components).toMatch(/\.plots\s*\{[^}]*minmax\(min\(100%,\s*380px\),\s*1fr\)/); | |
| 141 | }); | |
| 142 | }); |
new above
offline
"side by side from 680 px" does not match the CSS: auto-fit with minmax(min(100%,320px),1fr) and a 16px gap gives two columns at 656px of container width. Say that, or the viewport width you measured.