Skip to content

Set Leaf's interface in a closed set of voices, and rank About's section headings under its title - #4774

Merged
max-sixty merged 7 commits into
mainfrom
list-ui-fixes
Oct 30, 2026
Merged

max-sixty merged 7 commits into
mainfrom
list-ui-fixes

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Leaf's interface now sets its words in a closed set of named faces, the voices (--voice-*, browser/base.css), and a model-tier test fails any interface rule that sets a size, weight, line height or family of its own. Before this, each rule chose its face where it stood, and the last audit (#4758) found the drift that produces: near-duplicate sizes, line heights from 1.2 to 1.5 across rules for the same kind of text, and one-off weights. #4758 put every size on the type ladder; nothing stopped the next rule from drifting again.

The voices

Each voice is a whole font shorthand: weight, size on the ladder, line height and family. They are declared with the ladder's other derived tokens on :is(:root, .density-working), so a working-density block re-resolves them at its own sizes, as --tip-font and --lf-key-badge-size already were.

Voice Face Speaks for
--voice-ui --t-5 / 1.45 sans the chrome: menus, dialogs, buttons, the default control face
--voice-compact --t-working-label / 1.45 the floating panel and its rows
--voice-small --t-6 / 1.45 qualifiers: a row's end, a status, a description, a time
--voice-heading 600 --t-6 / 1.45 a list's group heading
--voice-title 600 --t-5 / 1.45 a dialog's title, a pane's header
--voice-label 600 --t-6 / 1.3 small capitals (.lf-label adds case and tracking)
--voice-tip 500 --t-6 / 1.2 a tooltip (was --tip-font)
--voice-chip --t-6 / --chip-lh a chip
--voice-count 600 --t-7 / 1 a number on a mark
--voice-fine --t-7 / 1.25 a tooltip's second line, a drawing's status
--voice-code --t-6 / 1.45 mono an error or source shown verbatim
--voice-emoji 16px / 1 the reaction palette's emoji
--voice-message, --voice-name (root only) a thread's words and author name (were --msg-font, --lf-msg-name-size)

Inside a voice, a run may still take weight 400, 500 or 600 for emphasis, and a box may set its line height to a length it is laid out by (a badge's 17px, a field's 22px). Everything else comes from the voice. Every core interface rule is cut over; bundled package rules that spelled a voice's exact face name it too.

The check

tests/model/test_interface_voices.py reads every core sheet with tinycss2 and fails each declaration in a rule that selects an lf- class that sets font to anything but a declared voice or inherit, or sets font-size, font-family, a weight outside 400/500/600, or a unitless line height other than 0 or 1. The reading theme's prose rules select no lf- class and keep the ladder. One rule is exempt by name: the native control default in surfaces.css states the ui voice's parts at a class's specificity, because a weight reset at that specificity once took the pane header's 600 off playground presets (its header says why). The test runs in the model tier, in under half a second.

What changes on screen

Line heights settle on their voice's. The visible case is On me's choice cards: their name and description lines go from 1.3 to 1.45, about 3px taller a card. Elsewhere the change is under a pixel a line: a thread quote (1.5 to 1.45), a pane header (1.4 to 1.45), the response bar (1.5 to 1.45, its buttons keep their height since their padding is computed from the line), the element inspector's tag. The target picker's current hint goes from 700 to 600, and a key badge inside a tooltip from the tooltip's 500 to the badge's 400.

About this page (#7 of the last closeout): its section headings ("Page details", "Authored CSS", "This tab at opening") were the browser's h2, 17px bold under a 14px title. Each section is a region of the dialog, so its heading now wears .lf-label, the small capitals that name a region. What names a single value (a copyable text's label such as "Leaf version", a list's h3) is small and muted, as a metric's term already was, and the disclosures ("Selected layer CSS") take the dialog's ui voice instead of the reading theme's bold summary. The result reads title, then section, then a value's name, then the value. A heading now stands nearer its content than the text above it, and the title starts on the report's left edge rather than 4.5px outside it.

Checks

  • leaf-dev stills on 65 interface states (panel views, threads, dialogs, panes, marks, widgets; light and dark): every style difference is a line height settling on its voice's, the About dialog's headings, and the target picker's current hint. Its faces.txt lists no face the head draws that the base doesn't; the only faces it retires are About's 17px and 14px bold headings. thread-choice-hints and plan-capture time out on both arms.
  • A fresh reviewer given only the before/after crops found the first About pass over-corrected: section headings in the group heading voice ranked below the 14px field labels under them. The label voice, smaller field labels and tighter heading spacing above answer that. It judged the choice cards' extra leading more readable at a cost in height, and flagged a shorter panel in ship-answered, which a recapture showed was capture noise (0 px).
  • Firefox computes the same faces for the About dialog and the panel.
  • pnpm run test:runtime (708 pass) and pnpm run check:browser; tests/model/test_interface_voices.py fails when a rule is set back to font-size: 12px; line-height: 1.3; 41 focused tests on fonts, the panel's On views, the command reference, drafts and About pass.

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

@max-sixty
max-sixty merged commit 7badfd6 into main Oct 30, 2026
4 checks passed
@max-sixty
max-sixty deleted the list-ui-fixes branch October 30, 2026 19:27
max-sixty added a commit that referenced this pull request Oct 30, 2026
…es' rules once (#4784)

A cleanup pass over #4774 and #4779, from four reviews of their diff
(reuse, simplification, efficiency, altitude). Nothing renders
differently: `leaf-dev stills` on eight states covering every rule
touched reports no computed-style difference (one state's pixels differ
by the page scrolling behind a thread card, which recurs on unchanged
code).

- **Two rules spelled out a voice.** A thread's news press and a margin
entry set `font: var(--voice-small); font-weight: 600`, which is
`--voice-heading`; they now name it.
- **Three package rules copied the label voice.** The sample's note, a
stacked tab's name and the reading theme's panel name wrote `600
var(--t-6) / 1.3 var(--sans)`, the value of `--voice-label`, beside
comments saying they take the label voice. They now name
`--voice-label`, so a change to the voice reaches them; the voices check
doesn't, since they select no `lf-` class.
- **Comments state the rule once.** `base.css`'s voices block dropped
the drift history the test's docstring and #4774's message already hold,
and one of the two pointers between the root's thread voices and the
block. The floating panel's quiet ink is described in its header only,
and About's rule comment no longer describes the old rendering.
- **The voices test** drops a filter that `declarations()` already
guarantees.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Oct 31, 2026
Main's #4774 set every word of the interface in voices resolved on :root and
under .density-working, which left the reference's advice to set --sans or
--msg-font on a part true of neither: a face set on a part reached no word
there, and --msg-font no longer exists. Each chrome part is now another scope that
resolves the voices, as base.css's rule for derived tokens already asks of any
scope that may restate the ladder, so --sans or a rung set on a part reaches every
word that surface shows. The browser test reads the composer's message voice
after a page sets --sans on it; without the change it stays sans-serif.
max-sixty added a commit that referenced this pull request Nov 3, 2026
…enderer rules inside the diff (#5243)

Two changes to how a package's rules meet the page: every rule that
styles a widget by its tag now names one of the theme's fonts, and the
diff's rules for its renderer's rows stop reaching the page's own
elements.

### Widget faces name the theme's fonts

The font check (`tests/model/test_interface_fonts.py`) read a rule as
Leaf's interface only when it named an `lf-` class, so the 26 rules that
style a widget by its tag set their own faces unchecked, and those had
drifted as the classes' had before #4774: a board card, a note on a line
of code, a worktree and a review each set the small sans on a 1.5
leading, a playground's controls on 1.35 and its instruction on 1.55, a
diff's notes at the prose rung, and the file editor its source at
0.88rem beside the theme's 0.84375rem code size. The check now reads a
rule that names an `lf-` element too (an attribute such as
`data-lf-state` qualifies an element rather than naming one), and every
such rule names a font.

Two fonts join the set in `styles/tokens.css`:

- `--font-widget` (the small sans on the prose's 1.5 leading) for the
words a widget holds: a card's, a code or diff note's, a review's, a
worktree's, a row of options, a playground's instruction.
- `--font-choice` (the interface font at 500) for a segmented control's
choices, which hold the chosen weight so choosing never widens them: a
dial's depths, a shot's views and tools, and the dial's placeholder,
which measures those labels before the buttons arrive and now can't
drift from them.

What changes on screen, by `leaf-dev stills main` over 25 states:

- A diff's author notes go from 17px to 14px, the size a code note
already took.
- The file editor's source takes the theme's code size, 13.5px where it
was 14.08px, and 13.12px on a phone. `--lf-file-editor-size` goes, and a
page sizes the editor's code with `--code-size`, as it does every other
source.
- A playground's controls stand on the interface leading (1.45, from
1.35) and its instruction on 1.5 (from 1.55), about a pixel a line
either way.
- A board card's title takes a pane title's font, its line 20.3px where
it was 19.6px, and a worktree's disclosure takes the small font, its
lines 16.7px apart where they were 17.3px.

Options' card and rail faces compute as they did, and the unused card
value of `--lf-option-font` goes with the variable. A draft keeps its
holder's size above the entry floor, which the check now allows for a
box the user types in, as `surfaces.css` floors every field. The
references point at `styles/tokens.css`, where the fonts have lived
since #5121.

### The diff's renderer rules stay inside the diff

`layer.py` places each package's widget-shadow.css in the document's
lf-base as well as in every declared shadow tree, with no scope around
it, so each rule names the widgets it styles: by tag or `lf-` class in
the document, by `:host(tag)` in a tree. Six of the diff's rules named
only its renderer's attributes (`[data-separator]`, `[data-no-newline]`,
`[data-line-type] [data-diff-span]`, `[data-line]` in print), so they
reached the page's own elements too. A `leaf-dev probe` of the worktree
example with a `<p data-separator>` added read the paragraph's
background as rgb(246, 248, 250), the code ground, with `pre-wrap`. With
each rule under `:where(:host(lf-diff))` it reads transparent and
`normal`. The `:where()` keeps each rule's specificity, and `leaf-dev
stills` over seven diff and worktree states shows no difference inside
the diff.

`test_a_sheet_both_trees_take_names_the_widgets_it_styles` reads every
bundled package's widget-shadow.css, imports included, and fails a rule
that names no `lf-` element or class and no `:host`. It fails on the six
rules above without this change.

### Checks

- `test_interface_fonts.py`, the new scoping check, `pnpm run check`
(type check and runtime tests).
- Browser tests for the file editor's theme, worktree summaries and
disclosures, options' rails, a diff's author notes, and a playground's
instruction and rail.

> _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