Skip to content

Paint declared marks at delivery, and say which panes a workspace holds by role - #1325

Merged
max-sixty merged 5 commits into
mainfrom
declared-marks-at-delivery
Sep 27, 2026
Merged

max-sixty merged 5 commits into
mainfrom
declared-marks-at-delivery

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A page's declared marks now arrive in the served document, so the stylesheet can read them at first paint. The workspace Layout and the pane grammar key on the pane role alone and no longer name lf-pane.

Owner. The registry declares what the stylesheet reads: x-space, x-inline, x-exhibit, x-bound and x-reading-role. The runtime painted them as data-lf-* in markDeclared, a registry fetch after the first paint. Two workarounds covered that gap:

  • layouts.css and theme.css named lf-pane so panes were held at first paint. The Layout also used the tag to tell authored panes from generated ones, so a package's authored pane took the generated rule.
  • theme.css read the authored main [data-width] next to [data-lf-space].

Delivery now owns the page's marks. compose_document paints them from the revision's registry (mark_declared, revision_delivery.py). Every document goes through it: the HTTP server, the live shell, export and the MCP app. A revision the page patches in is a composed document, so it arrives painted too.

What changed

  • layouts.css holds [data-lf-reading-role="pane"] as the workspace body or a cell of it. A generated pane is held at any depth, and it now carries data-lf-generated, which the playground and visual-review modules write.
  • theme.css's pane grammar keys on the role alone. Its specificity goes from one type selector to one attribute selector. At 1280×800, alert-review and wt-merge are pixel-identical to base once presented.
  • Deleted: every lf-pane selector in the kernel, the main [data-width]/main [data-bound] twins in theme.css, MARKED_IN_PAGE and the page-side markDeclared calls (install, patch arrival, patched attributes), and the runtime's data-width override.
  • The runtime's markDeclared now marks thread messages only. The runtime renders those itself, after the registry has loaded.

Behaviour that moved

  • A package's pane nested in another pane's body now flows as a nested lf-pane does. test_a_package_pane_is_held_where_an_lf_pane_is checks this before and after runtime startup. On base it fails at both points: before startup the package pane is not held, and after startup the nested one scrolls on its own.
  • A wide widget on a column page takes its room at first paint instead of widening once the runtime starts.
  • test_a_delivered_document_carries_its_declared_marks_in_the_source checks the delivered marks, including authored overrides and template content, which is left unmarked.

Phase profile. Served previews, base against candidate, Chromium at 1280×800, median of 9 loads. Times are ms from navigation start; requests and bytes are those that finished before presentation.

page document bytes FCP upgrade = presented requests bytes layout shift
alert-review base 181,102 56 621 193 4,104,210 0
alert-review candidate 181,482 60 556 193 4,102,994 0
triage-board base 159,186 52 618 190 3,794,492 0
triage-board candidate 159,229 48 620 190 3,793,275 0
triage-board on layout-column, base 159,185 44 610 190 3,794,492 0.104
triage-board on layout-column, candidate 159,228 44 608 190 3,793,275 0

The requests are unchanged. The document grows by the marks, 43 to 380 bytes, and the runtime shrinks by about 1.2 KB. The timing differences are within noise. The column-page row shows the benefit: with the runtime held, the base board first paints 720px wide and widens to 1080px once the runtime starts, a layout shift of 0.104. The candidate paints at 1080px from the start.

Left as it is. The runtime keeps its own table of four keys for thread messages. The state wire serves message markup as logged (served_state/page.py), so moving that paint to Python would change that contract. It is a separate change.

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

🤖 Generated with Claude Code

max-sixty and others added 3 commits September 27, 2026 11:27
…ds by role

A page's declared marks (x-space, x-inline, x-exhibit, x-bound, x-reading-role)
now arrive in the served document: `compose_document` paints them from the
revision's registry (`mark_declared`, revision_delivery.py). The runtime
painted them a registry fetch after first paint, so layouts.css and theme.css
named `lf-pane` to hold panes at first paint, and theme.css read authored
`main [data-width]` beside `[data-lf-space]`. Both copies are gone.

The workspace Layout keys on `[data-lf-reading-role="pane"]` and
`data-lf-generated`, which a module writes on a pane it generates. A
package's authored pane nested in another pane's body now flows as a nested
lf-pane does.

Behaviour that moved: a column page's wide widget takes its room at first
paint instead of widening after startup; a package pane is held from first
paint. The runtime's `markDeclared` now paints messages only.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Sep 27, 2026
# Conflicts:
#	TODO.md
leaf-agent
leaf-agent previously approved these changes Sep 27, 2026
# Conflicts:
#	TODO.md
@max-sixty
max-sixty merged commit 148072b into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the declared-marks-at-delivery branch September 27, 2026 20:09
max-sixty added a commit that referenced this pull request Sep 27, 2026
…e page, and widen samples to their data-width (#1364)

Three follow-ups to #1303: two of the open focus/scroll gaps it left,
and one layout bug found while presenting them.

## A pressed Send leaves the user in the box

Clicking a box's Send left focus on the button, so the next letters the
user typed ran page keys (an "ok" hid every mark and closed the margin
card) instead of reaching the box. Pressing Send is now the send key
pressed from the box, on every surface `wireInput` wires (margin card,
thread panel, general box, seat Send and Send & pause, widget comment
boxes):

- A pointer press never takes focus (`mousedown` default prevented), so
the box keeps it throughout.
- A keyboard press on a focused Send returns the user to the box before
submitting, so what the send does next starts from where Enter starts
it. A seat that gives its box up still hands the user to the new
thread's reply, and a first anchored comment still lands on the thread
it starts (#961).
- While an input method holds unfinished words, the press takes focus as
before, since leaving the box is what finishes them; otherwise the
unfinished words went out and the input method's commit wrote them back
into the emptied box.

`sendLanding` (thread/reply-landing.js) no longer takes the button: its
"focus is on the box or its Send" guard is always true now, and box.js's
Send vs Send & pause branch is gone.

Tests: `test_a_pressed_send_leaves_the_user_in_the_box` (six surfaces ×
pointer/keyboard, the composer by pointer only since its Tab walks
response options), 8 of whose cases fail on main;
`test_a_pointer_send_finishes_the_words_an_input_method_holds`, which
drives a composition through CDP and fails without the composition
guard. Tests that expected Send focused after a click now expect the
box.

## Bounded blocks are reading regions

A block bounded with `data-bound`/`x-bound` scrolls on its own but
registered no reading region, so every "which box scrolls this node"
question answered with the page. A talk seat's first send in a bounded
`lf-command` scrolled the page 117px and the second carried the block
off screen; thread travel and the Ask walk into a bounded log moved the
page.

`bounds.js` now holds every `[data-lf-bound]` block as a region while it
stands in the page, whoever painted the bound (delivery for page content
since #1325, `markDeclared` for message markup). A named block in the
page's own document is `lf-region:<id>:bound`, so a revision finds its
place again; an anonymous one, or one in a message's frozen markup,
keeps one id for its life in this document.

- **One arrival watch.** `arrivals.js` (`watchArrivals(selector,
attributes, { arrive, leave })`, `watchArrivalsIn(root)`) is now the one
owner of "keep a paint on elements matching a declaration while they
stand in the document or an enrolled shadow root". External links, which
had their own document observer, and bounds both use it; shadow-stage.js
enrolls each root it fills. The watch starts at boot, before
presentation, so an `end` log opens at its end rather than jumping there
after.
- `scrollersOf(node)` (reading-regions.js) walks the boxes scrolling a
node, innermost first; `holdBox` gives the move to the block and hands
what it cannot take to the page. Anchor travel's `scrollingBoxFor` uses
the same walk. Whether the held control is on screen at all is
geometry.js's answer, so a box in a block the page has scrolled away
doesn't pull the page back when an agent turn arrives.
- **One "seen" reading.** geometry.js's new `seenRect` is what of an
item the user sees: `shownRect` cut at top and foot by the room the
banner and shortcut bar leave (`shownWindow`), its sides left to the
layout viewport so a pinch zoom doesn't count as a clip. Landing,
`bringForward`, read acknowledgement (`thread/read.js`) and the thread
card's "being read" check all ask it; `read.js` had counted lines under
the banner or bar as read, and no longer does.
- Travel and the Ask walk centre the destination in the block, then
scroll the page only as far as needed.
- Continuity records a following `end` block's place as its end
(`followingItsEnd`), so a revision keeps it following; readings of
regions no longer standing are dropped. carry.js restores a region
body's sideways offset and leaves the vertical one to continuity.
- Margin rows for a target in a bounded block in the column's flow keep
the rail (`railBeside`), their lane clipped to the block; rows in a
workspace's panes still pin, as #1333 has it.
- With focus inside a bounded block, `d`/`u` page the block; thread
context takes the nearest labelled region. The glossary now defines a
bounded block as a reading region.

Tests in test_render_threads.py, test_render_navigation.py,
test_render_margin.py and test_render_widgets.py cover the seat send
(`end` and `start`), an arriving agent turn over a full, an unfilled,
and a scrolled-away block, travel into named and anonymous logs, the Ask
walk, margin rows beside the column and in side-by-side panes, `d`/`u`
in a log, a bounded log in an agent reply, and a revision over a
following log. Each fails with the arrival watch disabled, and all but
the revision case fail on main.

## A sample fills the room its `data-width` asks for

`lf-sample` is `display: table; width: 100%`, and a table box does not
fill the negative margins the kernel's breakout gives it, so
`data-width="wide"`/`"available"` shifted a sample left without widening
it. The package theme now gives a sample its own breakout width,
`calc(100% + var(--lf-surplus))`, under the same painted selector as the
kernel's `table[data-lf-space]` rule. It is scoped to the sample's own
breakout because `--lf-surplus` inherits: unscoped, a plain sample
inside a wide section came out 1080px in a 720px item.
`test_a_sample_fills_the_room_its_authored_width_takes`
(test_render_pages.py) fails without the rule.

## Checks

`uv run pytest tests` (1426 passed) and `npm run test:runtime` (151
passed) locally. Independent reviews ran on each of the three changes
and on each repair; the browser files these touch have pre-existing
failures on main (the `?t=` URL assertions after #1337, the margin
`picked_up` cases,
`test_a_coined_class_cannot_reach_the_chromes_rules`), each reproduced
on the merge base.

> _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 Sep 28, 2026
…1351)

The declared marks (x-space, x-inline, x-exhibit, x-bound, x-reading-role) now have one table, `schema.DECLARED_MARKS`, which both painters read. Delivery paints a page's document from it, and the runtime paints a thread message from the same table, stamped into the vocabulary as `$marks`.

**Owner.** #1325 made delivery paint a page's marks, which left the vocabulary stated twice. Python's `revision_delivery.py` had `DECLARED_MARKS` and `AUTHORED_MARKS`, and derived each paint name as `data-lf-<key>`. The runtime's `presentation.js` had `MARKED_IN_MESSAGE`, the five mark entries of `PAGE_PAINT_ATTRIBUTE`, and a separate `data-bound` override line. Nothing had drifted yet. The keys belong to `EXTENSION_SCHEMA`, so the table sits beside it in `schema.py`. Each entry names its paint attribute, the authored attribute that overrides the tag's declaration (`data-width`, `data-bound`), and whether the mark holds in a message. Every mark does except x-space, because the room belongs to the document and a message renders in the panel.

**What changed**

- `registry.layer.stamp_composition` stamps `$decisions` and `$marks`. It replaces the two `stamp_decisions` calls in `page init`'s layer composition and a page's composition, which is the route #1275 took for `$decisions`. A declared `$marks` is overwritten.
- `mark_declared` iterates `DECLARED_MARKS`. The runtime's `markDeclared` iterates `registry.$marks` and skips the marks that don't hold in a message. The registry intake requires `$marks`.
- `PAGE_PAINT_ATTRIBUTE` loses its five mark entries and holds only the runtime's own paint. The replay signature's exclusion is now `isPagePaint(name)`, which accepts the runtime's paint or any `$marks` paint.
- `bounds.js` names `data-lf-bound` literally, as the theme's bound rule does. Its watch on arriving bounds (#1364) starts at boot, before any registry has loaded.
- Deleted: `DECLARED_MARKS`/`AUTHORED_MARKS` in delivery, `MARKED_IN_MESSAGE`, the runtime's `data-bound` special case, and `PAGE_PAINT_ATTRIBUTE`'s `inline`, `space`, `readingRole`, `bound` and `exhibit`.

**What still names the paint attributes.** `theme.css`, `layouts.css`, package themes, `render-checks/layout.js` and `bounds.js` read them by name. Those names are the stylesheet's contract, which `packages.md` documents for package authors. `structure.AUTHORED_ALLOCATIONS` names `data-width` and `data-bound` too. It holds a different fact: the values an author may write, checked by `page check`, and it includes `data-rail`, which is not a mark.

**Behaviour that moved.** None for a user. A served vocabulary without `$marks` now fails at intake, the same way one without `$decisions` does. `test_a_message_carries_the_marks_a_page_would_except_its_room` checks a message's marks through the served registry: exhibit, inline, an authored `data-bound`, and no room even for an authored `data-width`. It fails when `markDeclared` ignores the `message` flag. `test_replay_signatures_exclude_settlement_and_other_runtime_paint` now also checks that a mark's paint stays out of the replay signature.

**Phase profile.** No startup change. The registry fetch and its size are the same apart from the five-entry `$marks`, and delivery paints the same attributes it did before.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
max-sixty added a commit that referenced this pull request Sep 28, 2026
Nightly run
[36372140245](https://github.com/max-sixty/leaf/actions/runs/36372140245)
failed `test_visual_review_gallery_gives_a_laptop_to_the_evidence`: at
1366×768 the evidence stage was 331px tall against a 340px floor. A
bisect run on that test names #1325 (148072b).

#1325 stopped naming `lf-pane` and dropped the `:where()` around the
kernel's pane selectors with it, which raised the pane look from a
type's weight to an attribute's. Package rules share the `lf-base` layer
with the kernel and follow it, so a package's one-class rule for a pane
it generates now lost to the kernel default:

- the visual review's evidence body took 14px of padding and its case
header 10px, so the stage lost 32px;
- the playground's instruction title took the pane header's 14px body
voice instead of the rail's 11.5px small capitals, beside a "Starting
points" title in the rail voice.

The grammar rules (rows, which child sits in which row, the children's
zero margin) keep the attribute's weight, because they must hold over a
widget's own margin, such as a board that is a pane's body. Moving those
under `:where()` too gave the feature gallery's board a 14px margin. The
look (frame, paper, padding, header voice) goes back inside `:where()`.

Evidence: computed styles of every pane, its children, and its header's
children at 1366×768, across the eleven corpus pages and fixtures that
hold a pane, match the commit before #1325 exactly. On main they differ
only in the visual review and the three playgrounds. The notification
playground test now also requires the rail's two titles to share one
voice. It fails on main and passes here, and so does the visual review
test.

Refs #1283.

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

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