Files
pplus-web/styles/course/README.md
T
alexm e092cb029c
Build, test, deploy / site (push) Failing after 15m13s
Initial commit
2026-11-12 22:24:02 -05:00

27 lines
2.8 KiB
Markdown

# styles/course
Stylesheets from the course site (`static/css/` in its repository), copied here unchanged so the vendored engines' widgets (pplus-core's `core/src/engines/asm86/views.js` and `hwviews.js`: registers, memory, caches, pipeline, the out-of-order core) can be shown in the app with the look they have on the course pages. `index.html` loads them, and the Hardware area's machine board (`src/ui/hw/board.ts`) is what uses them.
| File here | Course path | What it holds | sha256 |
|---|---|---|---|
| `tokens.css` | `static/css/base/tokens.css` | `--course-*` roles and the `--viz-*` chart palette that `shared/viz.js` and the hardware views read | `b2f40ca21e0f0a38aaf3dd096ec91e8afeb2455742f1fe255577cbaecd01a745` |
| `kit.css` | `static/css/widgets/kit.css` | the `--w-*` tokens and controls shared by the widget families | `51b46da837fcf64d20fd497458d2328a1e896913a2d2fededab198b58e889790` |
| `asm86.css` | `static/css/widgets/asm86.css` | every `.a86-*` rule the x86-64 widgets use (needs `kit.css` first) | `dba269f466b33be7621a2156a0db386d24b89927cf3bfa00397b8af58759e576` |
| `bridge.css` | (ours) | gives the course files the page colors and fonts they expect, from the app's tokens | |
The Quarto extension ships the same three files in `quarto/_extensions/pplus/course/`, with the board's adjustments from `bridge.css` (its `:root` block left out, since a Quarto page has those colors already) as `pplus-hw.css`; `pixi run quarto-css` copies them, and `tests/quarto.test.mjs` fails while the copies differ.
`tests/course-css.test.mjs` checks that each copied file still has the hash above, so a local edit cannot slip in: a change belongs in the course repository, then copy the file again and update its hash here.
## Using them
Load in this order, after `styles.css`: `bridge.css`, `tokens.css`, `kit.css`, `asm86.css`. Then:
- **The theme.** The course files switch to dark on `body.quarto-dark`, and they follow the operating system only when the body has neither `quarto-light` nor `quarto-dark`. The app therefore puts exactly one of those classes on `<body>`, matching the theme it shows: `syncBodyTheme()` in `src/ui/theme.ts` (the choice itself is the pure `themeBodyClass()`, tested in `tests/hardware.test.mjs`) runs at load, on every theme change, on a host page's forced theme, and when the system preference changes. Without that, a light app on a dark system would draw dark widgets.
- **The root class.** The widgets build their own `.a86` root, so their rules cannot touch the rest of the app.
- **The pseudocode lab** (`pseudo-lab.css`) is not copied: the app draws its own views for pseudo and does not use the engine's `views.js` for it.
## Updating
Copy the three files from the course repository's `static/css/` (paths in the table), run `sha256sum styles/course/*.css`, put the new hashes in the table above, and run `pixi run test`.