Repository navigation
Tell the author the window each lf-grid template stacks below - #1199
Conversation
`version check --render` now gives advice for each track template that stacks into one column in a desktop window: it names the grid and the window width below which it stacks, the width its tracks need side by side, and the width it has at 1200px. A template already stacked at 1200px is told so. The width comes from two owners. lf-grid.js exposes the grid width it stacks below (`stackWidth`, the same function its own judgement now calls), so the probe reads the module's rule rather than restating it. The window that gives the grid that width is the page's geometry, which is piecewise (a wide page holds at its cap, then loses 0.92px of grid per window pixel; a column page holds at 720px; a nested grid gets its track's share), so it cannot be derived from the 1200px reading alone: assuming 1:1 put a `1fr 2.4fr` template at 882px or 906px where it stacks below 854px. The existing 360-1200px overflow sweep now also reads each template grid's width and stacked mark at every step, and the window is interpolated between the two sweep widths around the flip. No new viewport or resize is added; `sweep` returns the readings and `swept_overflow` and `stacking_advice` each consume them. Only windows of 800px or more are reported. Over the shipped corpus the templates stack below 520-757px (the recommended `2fr 1fr` on a wide page stacks below 757px), except triage-board's `3fr 1fr` at 1000px, which is the one page that now carries the advice. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
stacking_advice groups readings by grid["at"], but that is a source description, not an element identity. Two id-less grids under the same named section have the same label, so their samples interleave at every width. pairwise(seen) then compares different grids: it can report the first grid's columns with the second grid's stack point or omit one grid's advice. I reproduced the omission with two grids sharing <lf-grid>. Carry a stable per-element key from templateGrids() through the sweep and use at only to word the advice.
`stacking_advice` grouped the sweep's readings by `at`, the words a finding names an element by. Two grids with no id under one named element share those words, so their readings interleaved at every width: the first grid's stacked reading at 1200px stood for both, and the second got no advice, or a pair across the two grids reported one grid's columns with the other's stack point. `templateGrids` now keys each grid by its place among main's grids in document order, counted before any is filtered out; the sweep only resizes the page, so the key names the same element at every width. `at` only words the advice. An authored lf-grid must carry an id, so the collision needs grids a module writes, which the gate already refuses for missing source provenance. The new test lays out two id-less grids in a project widget and asserts each gets its own advice; it fails without the key. The window test no longer closes the page the `browser` fixture lent it, which `test_the_resources_a_fixture_owns_are_taken_from_that_fixture` refuses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The grid identity issue from my earlier review is resolved. I’m withholding approval because the PR body still calls out the 3fr 1fr board guidance as an open decision: that recommended layout now triggers the new advice at a 1000px window. Please settle whether the guidance, the advice threshold, or the board example should change before merging.
A board in 2fr 1fr cuts its fourth column at 1200px and shows one column at 900px; in 3fr 1fr it shows all four at 1200px and stacks below 1000px, where the board is better given the page's width. The guide keeps 3fr 1fr for a board and says so, so the stacking advice it draws is expected. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#1197 added the label-size advice beside the sweep this branch split out, so once() now reads the labels, then sweeps and reads overflow and stacking from one set of widths. #19 drops the drawn-text and stack-width items the two PRs settle, and the TODO widths item names what still reads one width. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
All three Leaf queues in the arrangement eval chose
lf-grid columns="1fr 2.4fr", which stacks at the user's 900px window, and no author could see it. The render check now advises, for each template grid that stacks in a window 800px or wider, the window width it stacks below, e.g.<lf-grid id=queue> stacks into one column in a window narrower than 854px.The grid's need comes from
lf-grid.js's ownstackWidth; the window is interpolated from the existing 360–1200px sweep, since how a grid's width follows the window is piecewise. No new viewports. The probe keys each grid by its document-order index, so two grids that share a name (id-less grids a module writes) are read apart across the sweep.A board is the one template that stacks in a desktop window by design: in
3fr 1frthe triage board shows all four columns at 1200px and stacks below 1000px, where it takes the page's width; in2fr 1frit cuts its fourth column at 1200px and shows one at 900px.page-authoring.mdkeeps3fr 1frfor a board and now says it stacks below 1000px on purpose, so the advice the triage-board example draws is expected.With #1197 merged, #19 in
notes/workspace-followups.mddrops the drawn-text and stack-width items the two settle, and theTODO.mdwidths item names what still reads one width.Tests:
test_a_template_that_stacks_in_a_desktop_window_gets_advice_naming_the_window,test_two_templates_sharing_a_name_each_get_their_own_stacking_advice.🤖 Generated with Claude Code