Skip to content

Draw the class idioms on every page under lf- names, and let a theme stand alone or name its base - #6715

Merged
max-sixty merged 5 commits into
mainfrom
fable-theme
Nov 22, 2026
Merged

max-sixty merged 5 commits into
mainfrom
fable-theme

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Leaf now draws the class idioms an author writes (tag, callout, lede, facts, metric, panel, terminal session, numeric cell) on every page, under lf- names declared in browser/registry.json and styled in browser/styles/components/idioms.css. The reading theme held them under bare names, so a page with another look lost them and every personal theme had to compose over reading. reading now holds only its look, and themes.with_theme composes a theme alone, or after the base its own registry names ("$theme": {"base": "reading"}), refusing a base that isn't installed and bases that name each other.

Max picked this on the design page for the theme structure, after asking that reading be neither final nor required. There is no compatibility shim: class="tag" on an existing page draws plain until it is renamed. td.num becomes td.lf-numeric, because lf-num is already a widget.

Three calls to weigh. The eyebrow (hgroup > p:first-child) joins the reading face rather than the always-on idioms, since it styles an element and not a class. Leaf's own facts lists (About, a capture's details) take the idiom's layout and keep the interface's small label through one rule in base.css. leaf package check composes a theme the catalogue lists as a page taking it would, so a stand-alone theme is checked without reading.

Stills against the merge base show no pixel difference on reading-theme pages from this change, in Chromium and Firefox, and in Firefox every element an idiom reaches on the 49 corpus pages computes the same style as before. Captures of a page with no theme, a stand-alone theme and a theme built on reading show every idiom drawn in each. The focused model, browser and runtime tests pass, as do pnpm run check and pre-commit.

This was written by Claude Code on behalf of max-sixty

…and alone or name its base

The bundled `reading` theme held two things: a look (paper and ink, the body's
type, the wide-page and parts titles, the reading face) and the vocabulary of
idioms an author writes. Because the idioms lived in the theme, Leaf composed
`reading` under every personal theme, and a page with no theme drew them as
plain text.

Leaf's kernel now draws every class idiom on every page under an `lf-` name
(`browser/styles/components/idioms.css`, declared in `browser/registry.json`):
`.lf-tag`, `.lf-callout`, `.lf-lede`, `.lf-facts`, `.lf-metric`,
`pre.lf-terminal`, `section.lf-panel` and `td.lf-numeric` / `th.lf-numeric`.
Variant words stay bare beside the class (`class="lf-tag warn"`). The eyebrow
(`hgroup > p:first-child`) joins the reading face's element rules, so a page
without the face keeps the browser's paragraph. `reading` keeps only its look
and declares nothing.

A theme now either stands alone or names the theme it builds on in its
registry, `"$theme": {"base": "reading"}`. `themes.with_theme` composes the
base chain, then the theme, then the content packages, and `leaf package
check` and `package install` compose a theme over its base the same way. A
missing base or bases that name each other are refused. This reverses the
decision that every personal theme builds on `reading` (the user's: "reading
shouldn't be final ... it shouldn't be required either").

One home per look: Leaf's own facts lists (About's counts, a capture's
details) now wear the facts idiom, and the option card's copy of the tag face
in `packages/default/styles/chip.css` is gone. `.lf-chip` stays the default
package's, since the recommended chip is a pseudo-element of a widget the
kernel can't name.

Every writer of the old class names is renamed: examples, docs, notes, eval
cases, tests, `leaf-dev`, page widgets, and the shipped instructions. Pages
written earlier show the old classes plain; there is no shim.

Behaviour the tests now hold differently:
- `test_themes.py`: a page with no theme has the idioms; a theme naming
  `reading` composes it first; a theme standing alone composes without it;
  a missing base, a cycle and a malformed `$theme` are refused.
- `test_the_kernel_styles_no_class_a_page_coins` allows a bare class beside
  an idiom's class (a variant) as it allowed a drawing's marks.
…e headers

The references, the site's Extending page and the module headers said a
personal theme builds on `reading` and that the theme supplies the idioms.
They now say a theme stands alone or names its base in `$theme`, that Leaf
draws its idioms on every page, and that "as a themed page does" means a page
in the `reading` theme, which is what wears the reading face. The change in
shipped instructions is to facts only: names, and how a theme composes.
…d-alone theme without reading

Two review findings on the idioms move.

Leaf's own facts lists (About's counts, a capture's details) took the facts
idiom's page look, so their labels grew from the interface's small font to
14px beside the dialog's other 11.5px labels. They keep the idiom's layout and
take their surface's type and spacing again: one rule in base.css, keyed on
`.lf-ui` and `.lf-popover`, since the two surfaces share no ancestor class. It
stands at the idiom's weight so the frame's edge trims still take a first or
last list's margin.

`leaf package check` composed `reading` under any package that named no base,
so a theme that stands alone was checked over a look no page of its has.
`themes.themes_under` now composes a theme the catalogue lists (or `reading`)
over its bases alone, a package naming a base over that base, and any other
package over Leaf's default theme. `catalogue()` reads a config path that is no
directory as no catalogue, as it reads a missing file, so `package init` still
works beside a `~/.config/leaf` that is a file
(`test_package_init_ignores_unselected_packages`).

Tests: `test_package_check_composes_a_theme_as_a_page_taking_it_does` holds
the composition for a stand-alone theme, a theme on `reading`, a theme on
another theme and a content package.
@max-sixty
max-sixty merged commit b54a16f into main Nov 22, 2026
6 checks passed
@max-sixty
max-sixty deleted the fable-theme branch November 22, 2026 03:53
leaf-agent added a commit that referenced this pull request Nov 22, 2026
…-fix (#6721)

`test_every_idiom_in_the_catalog_stands_in_a_corpus_source` has failed
on main since #6715. That change moved the terminal-session idiom from
the `reading` package into Leaf's own registry as `pre.lf-terminal`, and
the test checks every idiom in that registry. No example had ever held
the idiom: #6542 added it to `reading`, which this test doesn't read.
The fix-review example (`examples/review-a-fix.html`) says its
regression test "fails on each without the fix" but showed no run. It
now shows that run as a terminal session: output captured from the fix's
own regression test, `test_a_draft_s_image_closes_back_to_the_draft`,
run at #2882's commit with its runtime files set back to their parent's
(2 failed) and then restored (2 passed). So the page carries the
evidence for its claim and the idiom has a corpus source.

The test fails on `b54a16fc4` with `no example holds pre.lf-terminal`
and passes on this branch. `leaf page check` on the example's page
directory reports no findings. The render check couldn't launch Chrome
in the triage sandbox, so this PR's corpus render tests are the first
browser draw of the new figure. The figure sits below the recordings, so
it shouldn't change the page's first screen, but the site previews
haven't been regenerated.

The other failure in [run
44982643983](https://github.com/max-sixty/leaf/actions/runs/44982643983),
`test_a_coarse_pointer_keeps_useful_status_without_keyboard_hints`, was
fixed by #6717, which merged after that run's commit.

Refs #6719 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 22, 2026
…ce (#6722)

Three evals had drifted from the code they test. This brings each back
in line.

- **`control-legibility` couldn't start.** `views.py` exits when
`actions.json` and `ACTIONS` in `browser/runtime/icon-paths.js`
disagree. #6679 and #6687 added four presses to `ACTIONS`
(`resume-writing`, `restore-edit`, `show-annotations`, `show-changes`)
that `actions.json` didn't have. Each now has a line saying what
pressing it does, taken from the notice that offers it (`drafts.js`,
`thread/message-edit.js`, `annotation-layer.js`, `since-seen.js`). A
Node comparison of the two key sets now comes back empty.
- **Two rubrics failed pages that follow the shipped guidance.**
`proposals-get-individual-decisions` (`recommendation-markers`) and
`options-stay-words-for-wording` (`comparison-labels`) still asked for a
"recommended small.lf-tag". Since #6289, the advice marker is the
`recommended` attribute on the `lf-option`, which draws the badge;
`authoring-on-me.md` and the `lf-option` registry entry both teach it.
#6715's rename to `lf-tag` carried the stale requirement forward. Both
rubrics now ask for `recommended`. This only corrects a fact, so there's
no instruction scoring. The header of
`proposals-get-individual-decisions` still calls compact recommendation
markers a known failure, and that may have been this mismatch; the next
run of the case will show whether it holds.
- **`evals/README.md`** still described the JavaScript assertion that
#6681 replaced. Complete authoring tasks now grade with the Python
assertion `regrade.py:authoring`.

No regression test is added. `views.py`'s own startup check is what
reports `actions.json` drift, and a suite test would charge every new
icon action for an experiment. `dev/tests/test_evals.py` passes and both
case files parse.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 23, 2026
#6783)

A block live sample that starts just out of view stood at its 32rem
loading height when the page first read as ready, and shrank to its
page's height 100–200 ms later. On the feature gallery,
`#bg-margin-layer-status` drops from 552px to 309px, so `leaf-dev
stills` caught the taller side in one arm and reported the whole frame
changed: four of the seven stills that differed on #6715, and two of
four states on identical arms in each engine here. With this change on
both arms, those four states read unchanged in all 7 runs per engine.

Three gaps closed, each needed:

- **Host** (`sample.js`): a block's document now counts toward the
page's arrival wherever its frame stands, until it arrives, since the
frame takes its height. Before, it counted only while the frame was on
screen (#6558). A window sample's frame keeps its own height, so it
counts as before, and so does a block once a check asks for all near
work, since `start_near_work` then brings the frame into view itself.
- **Child** (`sample-child.js`): it reads its height again as it
arrives. Chromium delivers no ResizeObserver change off screen, so a
page whose recorded history changes its height after upgrading kept the
upgrade's height (381px for a page of 326px).
- **`settle`** (`leaf-dev`): it lets one rendering update pass before
reading readiness, after the input and again after the motion
`pageSettled` waits out. In Chromium the near observer reports a
scrolled-to sample only in that update.

To weigh: Chromium gives an off-screen opaque frame no rendering (0
animation frames in 5 s; Firefox ran 600), so a block sample whose page
waits on a rendering, such as a chart, never arrives there. A 20 s
deadline ends that wait, so `leaf-dev stills` and `probe` read such a
page as ready after 20 s rather than never, with the frame still at its
loading height; `page check --render` doesn't wait. No page in
`examples/` or `docs/` has one; the chart journey test, which covers the
deadline, now takes about 28 s.

Asked for by Max as "fix" on a question in the theme session's Leaf
page. Reviewed by a fresh Claude agent (two rounds), Codex and the
automated review; the fixes for their findings are in.

Tests: two new browser tests, one failing on main (readiness `None`, and
381 vs 326 without the child's change), the other checking a check's
near-work ask ends the wait; the off-screen chart journey gains a block
chart sample. The hosting, frame-visibility and sample-delivery tests,
`pnpm run test:runtime` and `pnpm run check:browser` pass.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants