Skip to content

Add lf-grid, text-or-surface widths, and bounded blocks - #1014

Merged
max-sixty merged 3 commits into
mainfrom
workspace-review
Sep 23, 2026
Merged

max-sixty merged 3 commits into
mainfrom
workspace-review

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A page grows by insertion: status tiles are an lf-grid inside the document, not a
separate page form (notes/layout-model.md, slices #29 and #32).

  • lf-grid places its direct children as cells at the page's available width.
    columns takes a count (a ceiling that rewraps a column at a time) or a template
    of fr tracks, which stacks below 600px. Each cell is a frame.
  • x-measure says how a block uses its frame: a surface fills it, a group (tabs, a
    comparison, a grid, a pane) passes the measure to what it holds, and an
    undeclared block is text and keeps the reading measure inside a frame wider than
    the column. The theme declares the plain HTML elements.
  • x-bound and data-bound hold a block to its own height; end follows the newest
    entry unless the reader has scrolled back (runtime/bounds.js). lf-record declares
    it, and lf-text-document scrolls its listing under a caption that stays in view,
    declaring that inner box with --lf-bound-box.
  • version check advises against page CSS that makes a box scroll vertically or
    places an element declaring a reading role, by tag or by the id the page gives
    it; data-bound validates like data-width.
  • lf-metrics is gone: a row of metrics is an lf-grid of lf-metric tiles.
  • live-progress is a document with a status grid and checks beside a bounded log,
    so lf-monitor, lf-monitor-grid and lf-monitor-region retire; the monitoring
    package keeps its release request and guides release pages instead. The command
    hub stays a plan tree: its header already carries the counts tiles would repeat,
    and its record now bounds itself and follows the newest receipt.
  • page-authoring.md's "Composing a page" replaces "Document, page tabs, or
    workspace" with the recipes; the glossary gains frame, grid, cell, text and
    surface, and bounded block.

Tests: the monitor-posture test became one for the release document's grids and
log; the log-evidence test now also checks following the newest line; new tests
cover grid frames, the template stack, the CSS advice, the bound's validation, and a
followed bound surviving wholesale child replacement.

🤖 Generated with Claude Code

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

A page grows by insertion: status tiles are an lf-grid inside the document, not a
separate page form (notes/layout-model.md, slices #29 and #32).

- lf-grid places its direct children as cells at the page's available width.
  `columns` takes a count (a ceiling that rewraps a column at a time) or a template
  of fr tracks, which stacks below 600px. Each cell is a frame.
- x-measure says how a block uses its frame: a surface fills it, a group (tabs, a
  comparison, a grid, a pane) passes the measure to what it holds, and an
  undeclared block is text and keeps the reading measure inside a frame wider than
  the column. The theme declares the plain HTML elements.
- x-bound and data-bound hold a block to its own height; `end` follows the newest
  entry unless the reader has scrolled back (runtime/bounds.js). lf-record declares
  it, and lf-text-document scrolls its listing under a caption that stays in view.
- version check advises against page CSS that makes a box scroll vertically or
  places an element declaring a reading role; data-bound validates like data-width.
- lf-metrics is gone: a row of metrics is an lf-grid of lf-metric tiles.
- live-progress is a document with a status grid and checks beside a bounded log,
  so lf-monitor, lf-monitor-grid and lf-monitor-region retire; the monitoring
  package keeps its release request and guides release pages instead. The command
  hub stays a plan tree: its header already carries the counts tiles would repeat,
  and its record now bounds itself and follows the newest receipt.
- page-authoring.md's "Composing a page" replaces "Document, page tabs, or
  workspace" with the recipes; the glossary gains frame, grid, cell, text and
  surface, and bounded block.

Tests: the monitor-posture test became one for the release document's grids and
log; the log-evidence test now also checks following the newest line; new tests
cover grid frames, the template stack, the CSS advice and the bound's validation.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layout_css_advice only reads type selectors, so the selector form this repo's own pages use bypasses it. _subject_tags collects token.type == "ident" out of each complex selector's subject, and layout_css_advice intersects that with the tags declaring x-reading-role — an id or class selector on a grid contributes no ident, so nothing is advised. Running the function against a page carrying both forms returns one line:

#status { display: flex }        -> (nothing)
main lf-grid { display: flex }   -> rule `main lf-grid` sets display on <lf-grid>, whose geometry the layout owns

Every selector in examples/live-progress.html's page CSS is an id or a class (#lp-checks-table, #lp-current-state > strong, .release-check-result), and both forms go unadvised, so the shape an author will actually reach for is the one the check cannot see, while page-authoring.md ("page CSS that sets a grid's own display, grid-* or position fights it, and version check says so") and the x-reading-role entry ("advises against page CSS that places an element declaring a role") both state the advice without that qualification. parser.lf_elements already carries each element's tag and attrs, so the id-to-tag map the check needs is in hand; a class would need a second read, or the guidance needs to say the check reads tag selectors.

skills/leaf/references/packages.md still tells package authors the role set is closed at three: "A structural element declares x-reading-role as workspace, pane, or partition". schema.py now admits grid, instances.py validates it, and styles.py keys the new advice on it — and registry.json's own $ entry and docs/registry.html both say so. This diff edits the paragraph directly above that sentence, so the package reference is the one public surface left stating the old enum, and it is the file a package author reads before declaring a role. Happy to push the sentence (plus a clause for the new page-CSS advice) if you'd rather not spin another commit on it.

scrollerOf finds the box that scrolls by taking the first descendant whose computed max-height is not none, which is a weaker read than the contract packages.md now offers package authors ("the package theme moves the bound there under [data-lf-bound]"). Any capped box earlier in document order — a badge, an avatar, a thumbnail — wins the scan, and the consequence is silent: atEnd is trivially true on a non-scroller, scrollTop = scrollHeight is a no-op, and the block keeps its bound but stops following. Reading overflow-y alongside the cap, or letting the package name the box, would make the wrong answer impossible rather than unlikely.

That heuristic is worth a second look because the two shipped consumers have different shapes and only one is covered. lf-text-document replaces the code node inside the pre (lf-text-document.js line 69), so the scroller node and its scrollTop survive every update — that is the shape the new browser cases in test_render_widgets.py exercise. lf-record is the scroller itself and calls this.replaceChildren(list) on every history change (lf-record.js line 126). pin latches state.left = true whenever box.scrollTop < state.pinned - SLACK && !atEnd(box), and once latched the block never follows again until the reader scrolls to the end by hand. Whether a wholesale replaceChildren leaves scrollTop intact is the browser's business, not the module's, and no test names it — so "its record now bounds itself and follows the newest receipt" rests on an assumption the suite does not hold.

What the pass checked and cleared
  • --lf-grid-template: initial correctly yields the guaranteed-invalid value, so var(--lf-grid-template, repeat(auto-fit, …)) takes its fallback on a count grid.
  • The kernel's main [data-bound] and the package's lf-text-document[data-lf-bound] tie at (0,1,1); layer_inputs concatenates ASSETS before DEFAULT_PACKAGE, so the package rule wins and the caption stays out of the scroller. Before markDeclared paints, only the kernel rule matches, so the first paint scrolls the whole widget — a flash, not a wrong final state.
  • Removing lf-monitor/lf-monitor-grid/lf-monitor-region left nothing stranded: minimumSize, registerReadingArrangement, defineReadingPaneElement and x-required-members each keep other consumers, and no lf-metrics/lf-monitor reference survives outside notes/layout-model.md.
  • itertools.pairwise is fine against requires-python = ">=3.10".
  • Local selection: tests/test_interact_contract.py and tests/test_interact_document.py (493 passed, including the three new validation cases), and tests/test_interact_product.py with tests/test_product_page.py (61 passed, 1 failed — the demo recorder, which launches Chrome). Chrome aborts on socket() in this sandbox, so no browser case ran: the grid geometry and bound-following assertions are CI's to prove, and test was still pending when this was written.

…the grid role

The page-CSS advice now reaches a layout element through the id this page gives it,
not only its tag; a widget that bounds a box inside itself declares that box with
--lf-bound-box instead of bounds.js searching for a capped descendant; packages.md
lists grid among the reading roles. A new test holds that a followed bound survives
the wholesale child replacement lf-record performs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A block bounded at its end that holds a bounded lf-text-document takes that document's pre as its own scroller. scrollerOf now scans the whole subtree for the first box declaring --lf-bound-box, and the default theme sets that marker on lf-text-document[data-lf-bound] pre, so the outer block never follows — it drives scrollTop on a box it does not own — and two follow closures pin the same pre against each other. Before this commit the first check was holdsBound(bounded), and the kernel rule [data-lf-bound], main [data-bound] gives every bounded block a max-block-size, so the outer block was always its own scroller.

It is one attribute away in the shipped corpus: examples/live-progress.html already nests <lf-text-document id="lp-live-log" data-bound="end"> inside <section id="lp-log">, and data-bound is an allocation a page may state for any block. Setting it on that section and resolving both readings in the browser:

scrollerOf(#lp-log)      -> <pre>     (this commit)
scrollerOf(#lp-log)      -> #lp-log   (with the guard suggested inline)
scrollerOf(#lp-live-log) -> <pre>     (either way)

The marker inherits as well, so every descendant of the declaring box answers to it — assets/theme.css already resets the sibling fact for that reason, with --lf-natural-inline-size: 0 on [data-lf-space], main [data-width]. A reset on [data-lf-bound] would not reach this case, because the declaration sits under a nested bound rather than above it; the scan is what has to stop at one. Happy to push the inline suggestion if you would rather not spin another commit on it.

Comment thread skills/leaf/assets/runtime/bounds.js Resolved
A bounded block containing another bound (a log section around an end-bounded
text document) took the inner document's listing for its own scroller, and two
followers pinned it against each other.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 95474ea into main Sep 23, 2026
5 checks passed
@max-sixty
max-sixty deleted the workspace-review branch September 23, 2026 17:48
max-sixty added a commit that referenced this pull request Sep 24, 2026
…it (#1088)

live-progress read as broken on leaf.page after #1014: its prose sat in
the centred 720px column while its tiles and evidence grids ran across
the window, so no edge lined up. This makes a page able to be a
**sheet**, rebuilds live-progress and triage-board on it, and fixes the
smaller layout defects found on the way.

## The sheet

`<main data-width="available">` (or `"wide"`) makes the page one frame:
every block, the title included, starts at one left edge and takes the
sheet's width, while text keeps the 720px reading measure through
`--lf-measure`. The column layout centred prose on one axis and wide
exhibits on another. The sheet sits in a gutter that grows with the
window (up to 64px, never narrower than the margin rail's strip, the
same on both sides) and caps at `--sheet-max`, 1600px.

A sheet reads as one structure when its regions stand on shared vertical
lines, so the examples use one set of tracks: a `2fr 1fr` (or `3fr 1fr`)
grid of a body beside a rail, each a nested `columns="1"` stack.

## Vocabulary

- `section.panel`: a titled region of a sheet, a card with a small
capitals heading in the tile label's voice, so every region is drawn
alike.
- `.tag` and `.callout` take `ok`, `warn` or `danger`; `lf-column` takes
`tone` (the feature gallery's Done column shows `ok`).
- `lf-release-actions` and `lf-release-action` declare `x-measure:
group`, so the card fills its frame while its prose keeps the measure.
- `page-authoring.md` and the `lf-grid` entry describe the sheet, one
set of tracks, and panels.

## Fixes

- **Grid width** (327daf0): `lf-grid` defaults to `wide`, centred on
the column, rather than `available`.
- **Tables in cells:** a table in a grid cell, or in a section that is
one, is a table again and fills the cell; as a block its rows kept their
content width, and the old selector never reached a table in a section.
- **Nested grids stack:** a template grid stacks by its `columns`
attribute. The span used to reach cells as the inherited
`--lf-grid-stack`, which every `lf-grid` reset on itself, so a cell that
was a grid never stacked and live-progress's rail ran off a 560px
window.
- **Playground copies** hide their controls region and drop the written
row template, so a copy's preview no longer sits under an empty track.
- **Command-hub cards** put the press after the prose instead of in a
5.5rem gutter that left the prose about 130px a line.
- **Corpus:** `corpus.py` takes a `<main>` with attributes and drops
them, since a tab is part of the corpus's own page.

## Examples

- **live-progress:** status tags under the lede, tiles across the body,
the pause as a warn callout beside its rollback, a chart of candidate
traffic stopping at 25%, checks and the log as panels; release steps and
facts in the rail.
- **triage-board:** a four-column board, its blocking column in danger
and needs-a-repro in warn, beside counts and a panel of recent moves.

## Tests

- The release-page test holds the body's and the rail's shared edges at
1600px, the lede within the measure, and the rail stacking under the
body at 560px; with the log below the fold it checks that following the
log leaves the page at its top.
- The monitoring test matches its source passages across whatever
wrapping the example uses.
- The startup test expects the triage board's board, grid and activity
modules.
- The product test's `<main>` slice takes a `<main>` with attributes.

Local runs: widgets, gate, startup, controls, product, layer,
projection, export, site, margin, navigation and interact-session files
pass except
`test_every_base_corpus_tab_stop_has_a_visible_focus_indicator` (failing
on main) and `test_submitting_a_reply_reveals_its_new_message` (fails
identically on 327daf0). Both pages pass `version check --render` in
light and dark at 1200px and 540px.

The site's catalog stills need `wt refresh-previews` once this lands,
since both examples' first viewports changed.

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

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

---------

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