Skip to content

Reserve a stated height for a widget that draws into its box (x-height), and draw lf-chart at it - #1481

Merged
max-sixty merged 2 commits into
mainfrom
agent-aac27eccaa5133966
Sep 30, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-aac27eccaa5133966

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

A widget whose drawing can't be sized from its markup now states its height up front, so the page lays its box out at first paint and the upgrade moves nothing below it. This is the shared "renderer widgets reserve a declared size" contract; the optional-package widgets (diagram, diff, pr-review, visual-review, targeting, gallery) adopt it in a follow-up from the agent fixing those packages.

The contract (x-height). A registry entry declares x-height: a default height in CSS pixels, or true for none. An occurrence overrides it with data-height. Delivery paints it as data-lf-height through the existing declared marks (schema.DECLARED_MARKS), and markDeclared paints it in a thread message. The kernel theme holds a live page's box to it (attr(data-lf-height px), which Chrome, WebKit and Firefox all resolve) until the module marks the widget lf-rendered; after that the box is the drawing's own. page check refuses a data-height that isn't a whole number, one on a non-widget tag, and one on a widget whose entry lacks x-height.

lf-chart declares 400 and draws Plot at the stated height, drawing a second time with the legend's height taken off when Plot sets one. It reads the height from data-lf-height rather than its box, because an export runs the runtime without the bootstrap's data-lf-live. A body that sets Plot's height now fails soft and asks for data-height; the shipped examples moved their chart heights onto the element (+40px where the chart has a legend, which now sits inside the box).

Behavior moved: lf-chart's keeps-first-box finding is gone from tests/known_widget_findings.py, and the bad-chart test gains a body-height case.

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

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 30, 2026 16:26
…t), and draw lf-chart at it

A widget whose drawing cannot be sized from its markup now states its height up
front: the registry's `x-height` gives a default in CSS pixels (or `true` for none),
and an occurrence overrides it with `data-height`. Delivery paints it as
`data-lf-height` through the declared marks, `markDeclared` paints it in a message,
and the kernel theme holds a live page's box to it from the first paint until the
module marks the widget `lf-rendered`. `page check` takes `data-height` only as a
whole number and only on a widget declaring `x-height`.

lf-chart declares 400 and draws Plot at the stated height, drawing once more with
the legend's height taken off, so the chart's box no longer grows from its source's
height to Plot's at upgrade. Its pre-upgrade source is hidden inside the reserved
box. A body that sets `height` in Plot's options now fails soft asking for
`data-height`; the shipped examples moved their chart heights onto the element.

Behavior moved: lf-chart's `keeps-first-box` finding is gone from
`known_widget_findings.py`; the bad-chart test gains a body `height` case.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit b2982c0 into main Sep 30, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-aac27eccaa5133966 branch September 30, 2026 23:53
max-sixty added a commit that referenced this pull request Oct 1, 2026
…st paint (#1485)

The optional packages' widgets now paint their presented box at first
paint wherever that box can be known before the module runs, so
upgrading them moves nothing below. Two mechanisms cover the causes, one
per cause:

- **An arrangement the markup already determines** is laid out by the
package theme under `html[data-lf-live]` before the module runs. The
swipe deck reserves each pile's verdict label and its row of controls
(one height token, `--lf-swipe-press`, now sizes both the presses and
their reserved room). A ledger row also keeps its Return control's room
while the control is hidden, so a classified card's row does not grow
when the log makes it returnable. The deck reads "quoted" from the
painted `data-lf-exhibit` instead of a class the module set at upgrade,
so a quoted deck is flat from first paint. Given a stated height, the
playground's stage stands in its region from first paint.
- **A drawing or data view whose height only the module knows** declares
`x-height: true` (#1481) and adds `lf-rendered` once drawn:
`lf-diagram`, `lf-diff`, `lf-targeting`, `lf-playground`,
`lf-pull-request`, `lf-call-diff`, and `lf-visual-review`. The data
widgets remove `lf-rendered` while their data is absent, so the
reservation holds until the data arrives. An unrendered live diagram now
takes its `available` width from first paint; only a page without the
runtime keeps its source in the column.

`page check --render` now advises the page's author which height to
state: for each `x-height` widget whose box changed between first paint
and presentation, it prints ``<lf-diagram id='flow'> draws 287px tall
where its first paint reserves no height, so what follows it moves when
it is drawn: state data-height="287"``. It is advice and refuses
nothing. The shipped examples and site pages state the heights it
reported.

Worked examples: the diagram, diff, pr-review, and visual-review
examples state `data-height`, and the playground example gains a preset,
so `lf-playground-preset` and `lf-playground-setting` have an example.

Removed from `tests/known_widget_findings.py`: diagram, diff, pr-review
(both), swipe (both), visual-review, and the missing-example findings
for `lf-playground-preset` and `lf-playground-setting`.

Left, with the reason in the file:

- `lf-margin-entry-gallery`, `lf-targeting`, and `lf-playground` with
its preview: their generated interface wraps words, so its height
follows the viewer's fonts. The same examples drew 22px to 45px taller
on CI's Linux than on macOS, so no stated height holds on every
platform, and their examples state none. A page's `data-height` on
targeting or a playground is the author's estimate: on the targeting
example, a height taken on macOS leaves Linux a 39px shift where stating
none leaves over 500px. The same limit applies to a pull request's or
visual run's real data, which wraps words too; their examples carry no
data and so measure only the reservation holding.
- `lf-playground-control`, `-output`, and `-value`: the module builds
each control's Web Awesome inputs and writes the controls' current
values into the instruction, restoring them per viewer from the tab's
storage, so the rail's contents do not exist until it runs.

Tests:
`test_a_widget_drawn_at_a_height_its_first_paint_did_not_reserve_gets_advice`
covers the advice (an unreserved occurrence, a mis-reserved one, and a
correctly reserved control that goes red if the kernel's reservation is
removed). The widget-quality test covers each fixed widget through its
example.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 1, 2026
On a live page the default package's widgets now paint the box their
module will draw from the first paint, so upgrading them moves nothing
below them. This clears nine of the base layer's `keeps-first-box`
findings from `tests/known_widget_findings.py` (lf-code, lf-gloss,
lf-milestone, lf-note, lf-option, lf-shot, lf-tab, lf-tabs, lf-tree).
#1481 already cleared lf-chart.

Each rule is scoped to `html[data-lf-live]`, which the served page's
inline bootstrap sets before first paint, so a page read with no runtime
keeps its readable pre-upgrade fallback. The two rules that hide
authored words until the module shows them (lf-tabs' later panels,
lf-gloss's inline tip) also stand down once the bootstrap records a
startup failure (`data-lf-startup-error`), since no module will come to
show them.

**Theme rules, one per widget**
(`skills/leaf/packages/default/theme.css`)
- lf-gloss keeps its tip out of the line, since the module shows it in
the card.
- lf-options gives the last authored cell the hairline it will draw
above the reserved Add and Done cells. That missing pixel was the
lf-option finding; the Add row itself was already reserved and measured.
- lf-milestone reserves one row of chips for `when` and `tags`.
- lf-tree sets each body line at its rendered row's pitch, and a
rendered change badge rides the line's top, so Linux's font metrics no
longer grow a row with badges by a pixel.
- lf-code frames its source like its numbered lines and wraps where they
wrap. A note now carries its own band, so the module docks the `lf-note`
itself and the `.lf-code-note` wrapper is gone.
- lf-tabs draws its flow's frame (boxed, page flow, or side list), an
empty strip row, and its first panel. A boxed strip's first row now
takes the stated `--lf-tabstrip-h`, as a page strip already does, so the
reserved room is one number.

**Served media size** (`revision_delivery.py`). An lf-shot has no height
until its images decode. Delivery now reads the size of the page media
an element's attributes name from the image bytes (`media_size`: PNG,
GIF, WebP, JPEG; a file cut short reads as no size). `mark_declared`
paints the largest width and height as `data-lf-media-width` /
`data-lf-media-height`. The lf-shot theme turns them into the frame's
`aspect-ratio` with typed `attr()`. `packages.md` documents the
attributes for other packages' media widgets.

**Still in the known list, each with its reason in a comment**
- lf-activity and lf-text-document draw the page's state (the log's
history, a bound source's value). It arrives with the first state
answer, after first paint, and the served document carries none of it.
- lf-toc takes one of two forms, the fixed margin map or the in-flow
outline. Which one is the margin pass's residency decision
(`data-lf-margin`), made after first paint from the room it measures.

**Not reserved.** Chips or tab names that wrap onto a second row; an
excerpt's elided rows; a tab set that opens on another panel because the
URL's fragment is inside it or this browser tab left it open. The
browser matches `:target` only once the document has loaded.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 1, 2026
…when it upgrades

page check --render on main's runtime (since #1481) advises the height an
lf-playground occurrence should reserve.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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