Repository navigation
Set Leaf's interface in a closed set of voices, and rank About's section headings under its title - #4774
Merged
Conversation
… disclosures in the ui voice
# Conflicts: # browser/styles/components/controls.css
leaf-agent
approved these changes
Oct 30, 2026
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_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
fontshorthand: 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-fontand--lf-key-badge-sizealready were.--voice-ui--t-5/ 1.45 sans--voice-compact--t-working-label/ 1.45--voice-small--t-6/ 1.45--voice-heading--t-6/ 1.45--voice-title--t-5/ 1.45--voice-label--t-6/ 1.3.lf-labeladds case and tracking)--voice-tip--t-6/ 1.2--tip-font)--voice-chip--t-6/--chip-lh--voice-count--t-7/ 1--voice-fine--t-7/ 1.25--voice-code--t-6/ 1.45 mono--voice-emoji--voice-message,--voice-name--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.pyreads every core sheet with tinycss2 and fails each declaration in a rule that selects anlf-class that setsfontto anything but a declared voice orinherit, or setsfont-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 nolf-class and keep the ladder. One rule is exempt by name: the native control default insurfaces.cssstates 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 boldsummary. 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 stillson 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. Itsfaces.txtlists 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-hintsandplan-capturetime out on both arms.ship-answered, which a recapture showed was capture noise (0 px).pnpm run test:runtime(708 pass) andpnpm run check:browser;tests/model/test_interface_voices.pyfails when a rule is set back tofont-size: 12px; line-height: 1.3; 41 focused tests on fonts, the panel's On views, the command reference, drafts and About pass.