Repository navigation
Keep the page's reading face in a shadow tree's slots, and .lf-ui border-box there - #7447
Conversation
…der-box there A declared shadow tree reset `--lf-reading-face` on its host, so the author content it slots lost the page's face, and lf-motion and lf-options each put it back on their host. The host now keeps the page's value and hands it to its slots; the reset sits on the tree's own top-level elements. Both workarounds go, and so does worktrees.css's face on every later lf-worktree host, which made later worktrees draw differently from the first. controls.css states the `.lf-ui` border-box reset for shadow trees, which chrome.css states for the document alone, so options-shadow.css drops its copy. lf-file-tree, lf-diff and lf-file-editor's `.lf-ui` boxes become border-box. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
leaf-agent
left a comment
There was a problem hiding this comment.
The top-level reset can't be undone from a widget module's own sheet, which contradicts both the new comment in reading.css and the promise in skills/leaf/references/module-reading.md, "Code": "a block in a shadow tree wears it where the widget sets --lf-reading-face: 1 on a box around it".
A declared tree reads shadow.css in lf-shadow (composed_sheets in src/leaf/source/layer.py). The stylesheet a module writes itself goes in lf-base (inBaseLayer, and module-authoring.md tells authors to wrap it that way). lf-base ranks below lf-shadow, and layer order decides before specificity, so zero specificity on :where(:host > :not(slot)) doesn't help. If a module's sheet sets .root { --lf-reading-face: 1 } on its tree's top-level box, the reset wins, the box loses the face, and dressCode leaves its code uncoloured. Before this PR the reset sat on :host, so the same rule on the box won. Only a package's widget-shadow.css, which follows shadow.css inside lf-shadow, or a box below the top level still gets the face.
No bundled widget hits this today: the only places that set the face from a module are syntax.js reading it and the transcript and Markdown rules later in this sheet. But it is now package-interface prose that misleads a third-party author. One fix is to move the reset below lf-base. Otherwise both texts should say where the face can be set again; the suggestion covers the comment, and module-reading.md needs the same caveat.
A module's own sheet stands in `lf-base`, under the tree's top-level reset in `lf-shadow`, so it sets the face on a box inside the top-level element. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
…ws it (#7506) #7439 put a drawing part's marks on the frame the part is drawn in (`markedParts` in `dom/geometry.ts`), and the margin entry's trace is one of those marks. So hovering the margin entry for the thread on diagram node U now traces the node's `rect`, not its `g[data-id="U"]`. `test_threads_on_two_parts_of_a_picture_stand_an_entry_each_tracing_its_part` still expected the group and has failed on `main` since #7439 landed. The test now expects the node's frame. It still checks what it was written to protect: one trace, on that node alone, not on the picture. Nothing changes in the product. The test fails on current `main` (`AssertionError: flow`, traced element `<rect … data-lf-traced>`) and passes with this change. #7497 names a second test, `test_native_sidebar_is_placed_before_widget_activation`. It passes at #7439 and first fails at #7447, so it has a different cause and this PR doesn't touch it. The issue has the diagnosis. Refs #7497 — automated triage Co-authored-by: leaf-agent <[email protected]>
Requested by Maximilian · project thread
Part of the Effect UI core pass: a declared shadow tree's slots keep the page's reading face, and its
.lf-uicontrols size at their border, so decorating widgets stop restoring either on their own.Reading face.
reading.cssset:host { --lf-reading-face: initial }. That kept a widget's own drawing out of markup's face, but slotted author content inherits through the host, so it lost the page's face too. lf-motion and lf-options each put--lf-reading-face: inheritback on their host. Now the host keeps the page's value and hands it to its slots (--lf-host-reading-face); the reset sits on the tree's top-level elements other than slots, and each rule has zero specificity so a widget's sheet or the transcript rule can still set the face on its own elements. Both per-widget workarounds are gone..lf-uibox-sizing. chrome.css's.lf-uiborder-box reset reaches only the document.controls.css, which every declared tree reads, now states it for shadow trees (:where(:host .lf-ui …)), and options-shadow.css drops its own copy.Visible differences, from
leaf-dev stills --base origin/mainover the option, motion, worktree, file-tree, diff and file-editor states:ptext-wrap,svgvertical-align). The rendered crops show no pixel change.worktrees.cssgave the later ones--lf-reading-face: 1on the host, which, because a document rule on a host beats:host, also put the face on their drawn summary and path. That declaration is gone, so every worktree's drawing is the same. The first worktree's facts block sits 11px higher..lf-uiboxes are border-box, as they are in the document. The file tree's search field is about 6px shorter.🤖 Generated with Claude Code
https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
Generated by Claude Code