Skip to content

Use one browser rendering lifecycle and native document layout - #4724

Merged
max-sixty merged 22 commits into
mainfrom
codex/lit-render-ownership
Oct 30, 2026
Merged

max-sixty merged 22 commits into
mainfrom
codex/lit-render-ownership

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Leaf currently maintains a separate initial widget renderer and hands its output to the live renderer, while JavaScript also discovers and allocates page layout. This change removes those parallel paths: authored HTML stays readable during loading, ordinary Lit roots own generated controls and subsequent updates, and native CSS lays out explicitly authored flows, sidebars and notes.

The main deletions are in prepaint, initial-render producers/bundles, the layout allocator and tests tied to those mechanisms. Packages render from their native hosts; slots preserve authored children where a generated shell needs a shadow root. The public module contract and in-tree consumers move together. Portable motion and timeline retain their light-DOM, plain-HTML behavior. Native drafts, focus, selection, revision identity and frozen-message semantics remain separate responsibilities.

This deliberately accepts one content-derived resize when shots, diffs or timelines upgrade. Fixed control rows still reserve their space. In particular, data-fed diffs give up the parser-time reservation added on main in #4712: the following content moved 445–605 px in matched inline-data probes when the first authoritative data arrived. Explicit authored data-height eliminated the shift in Opus’s probe. File-capture sources already shifted on main. Authored diff notes likewise remain readable before upgrade, including notes in initially collapsed files; moving or hiding them during upgrade adds to that one-time resize. A matched collapsed-note fixture measured 221→37 px and an upward 184 px paragraph shift, versus main’s constant 37 px. The embedded initial-data bridge is removed end-to-end, while offline export retains one full state/data payload. Authors now state layout structure explicitly; a framed callout or lf-ask requests its own data-width, rather than widening automatically around a wide child. The examples, registry examples, author instructions and containment advice use that same rule; grid children have different margin/float semantics, and tally/worktree shadow boundaries limit page CSS reaching internal elements. Selection understands slots, and some responsive CSS arithmetic is less obvious than the larger JavaScript allocator it replaces. No server-side JavaScript engine, hydration layer or whole-page reveal wait is added.

Independent Opus review covered the full change and integration with main. Its findings led to canonical runtime-attribute normalization for revision snapshots, a site navigation width repair, migrated behavior tests/eval fixtures, restored trace and deck control reservation, consolidation of portable control markers and icon styling, and repairs to startup-shift report serialization, nested sidebar width, standalone flow tracks and generated view membership. The view APIs mark generated holders from the registry before using the shared selection owner; no separate observer or widget-specific marker setup is added. The final review also narrowed the layout dependency guard and removed implicit child-to-holder width propagation.

Validation includes the browser build and pnpm run check (708 runtime and 88 Worker tests), formatting/lint/type gates, 158 focused model/process tests, and focused real-browser checks for revisions, cancellation, native layouts, standalone widgets, motion/timeline controls, traces, activity and tally focus. A fresh main/candidate comparison completed 24 loads without browser errors and confirmed readable content with modules held on four pages. Initial HTML fell by 82–101 KB; one or two additional resource URLs are loaded before presentation, with total body bytes lower on three pages and higher on one. Host contention makes elapsed timings diagnostic only. Five paired authoring probes scored 2/5 for this branch and 1/5 for the base: candidate agents adopted the explicit track markup but still sometimes duplicated layout CSS, so this does not establish reliable instruction compliance. The complete pushed version passes PR CI and has exact-commit reviewer approval. All 18 regenerated catalog previews were visually inspected. Focused checks separately verify native fragment focus clearance, contents-lens accuracy and workspace panel clearance; Opus approved those assertions and the final main integration. A paired run of all 19 decision-authoring cases scored 15/19 for the candidate versus 13/19 for the base, with two improvements and no pass-to-fail regressions. Restricting to the 16 matching cases with confirmed exposure to each arm’s width guidance gives 12/16 versus 10/16. All three candidate authored pages passed plain/render checks. This is one stochastic run of complete branch snapshots; custom CSS remained common, and the window-fit page still failed the judge’s shorter 1920×720 viewport despite fitting the requested 1600×1000. The result supports the instruction repair without establishing universal width compliance.

This was written by Codex on behalf of max-sixty

@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.

The fixed deck controls now move content during startup; this resize is avoidable without restoring a second renderer.

Comment thread packages/deck/defaults.css Resolved
leaf-agent
leaf-agent previously approved these changes Oct 30, 2026
…rship

# Conflicts:
#	build/browser/build.mjs
@max-sixty
max-sixty dismissed stale reviews from leaf-agent via f311197 October 30, 2026 05:50
leaf-agent
leaf-agent previously approved these changes Oct 30, 2026
…rship

# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Oct 30, 2026
…rship

# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty dismissed stale reviews from leaf-agent via 1d4caeb October 30, 2026 06:19
leaf-agent
leaf-agent previously approved these changes Oct 30, 2026
Keep readable authored content before enhancement and measure native layout geometry in the tests. Repair collapsed nested sidebars, standalone flow tracks and generated view membership. Remove dead allocator tokens and diagram spacers. The view APIs now resolve generated holders through the same registry declaration as delivered views.
…rship

# Conflicts:
#	browser/layouts.css
#	browser/runtime/version.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-box-motion.js
#	packages/default/styles/tabs.css
A framed lf-ask or callout now requests its own data-width; a wide child alone remains contained and may scroll. Remove implicit child-to-holder propagation, migrate examples and author instructions together, and distinguish framed width advice from unframed layout-flow composition. Preserve main focus-region spacing on native tracks and page tabs. Clear view-owned hiding when a generated child leaves membership. Opus reviewed the integration and repairs with no remaining blockers; focused composition, containment and ring checks pass.
…rship

# Conflicts:
#	dist/kernel/kernel.json
leaf-agent added a commit that referenced this pull request Nov 2, 2026
The column grid introduced in #4724 places the boxless wrapper's
children in separate tracks. The target picker sorts by visible
position, so the wrapper can precede the heading: both Tab commands
execute, but the second correctly announces the heading. A passing
attempt could catch the wrapper's delayed first announcement before the
heading replaced it.

Keep this hit-testing fixture in ordinary block flow and verify the
heading announcement before advancing to the wrapper. This preserves the
test's separated painted runs and the product's native grid layout.

Validation: reproduced the reported heading diagnostic on unchanged main
at 20× CPU throttling; a temporary trace at 6× confirmed both
next-target invocations and the wrapper-then-heading announcements. The
repaired test passes at 6× and 20× throttling. Ruff lint and formatting
checks pass.

Closes #4957 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 2, 2026
The JavaScript export check (`tests/journeys/test_unused_exports.py`)
ran only in the daily `journeys` tier. That run has failed every day
this week, with over a hundred failures each time, so an orphaned export
reached main and stayed until Tend triaged the daily report: #4724 and
#4873 left seven on 30 and 31 October, and #5014 removed them on 1
November. Vulture, its Python counterpart, runs as a pre-commit hook,
which both landing paths (a pull request's lint step and `wt merge`'s
pre-merge) run over the whole tree, so the change that orphans a Python
definition is the one told.

This moves the export check beside vulture:

- `leaf-dev unused-exports` holds the check, unchanged, with the test's
docstring as its module header. It takes about two seconds.
- `.pre-commit-config.yaml` runs it as `unused-exports`, woken locally
by the file kinds that export or read (`.js`, `.mjs`, `.ts`, `.py`,
`.html`, `.md`, `worker/wrangler.toml`). CI runs every hook on every
file.

It also removes what #5014's deletion of `since-seen.js` left behind:

- the `keepalive` option of `deliverBookkeeping` and `postEvent`, which
only the departing `seen` send set, and `runtime.seen`, which only
`since-seen.js` read;
- the six arrival tests skipped while `since-seen.js` was unmounted. The
module, renamed `test_changes_in_place.py`, keeps the comparison and
at-work tests;
- the prose in `change-walk.js`, `events.md`, `read_state.py`,
`agent_state.py` and `browser/AGENTS.md` that described the turned-off
marking. The server's reading of `seen` events is unchanged, and no tab
posts one.

And it drops the `uuid` devDependency, which no module imports. A
one-off knip scan of dependencies flagged 33; the other 32 are bundled
from `build/entries`, loaded by evals or `tests/*.mjs`, or resolved as
types and peers. As #2326 and #3423 found for exports, knip would need
more configuration than it saves, so it is not added as a gate.

Validation: `leaf-dev unused-exports` and every pre-commit hook pass on
the changed files; `pnpm run check:browser`, the 737 runtime tests, and
the browser test for comparison bars and the `h` walk pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 2, 2026
Merging main brought tests and fixtures adapted to the grid. In block flow
the view-geometry reading lists only the page's own rows, since the column
is no grid; the column-loss probe needs only a 720px column with no room
beside it; and the drawing tests measure the room a breakout may take as the
prose plus the room the column pads.

The margin reading counts as room only what the column pads beside its prose,
so a page whose own padding replaces the column's keeps its spills reported.
A page whose runtime could not start shows each undrawn widget's source at
the prose's measure again, as the column did before #4724.
max-sixty added a commit that referenced this pull request Nov 2, 2026
A page that sized the column itself, such as a catalog's
main { box-sizing: border-box; max-width: var(--wide) }, lost its prose in
block flow: the column padded by the room computed from the shell's width, so
at 1720px nothing was left inside a 907px box (test_rail's catalog case).

The column is now a box --col wide, centred by auto margins, as before #4724.
The room each side is the shell's width less the column's own content, kept as
a percentage that each block in the flow resolves against its own 100%, so it
follows whatever width the page gives the column. Text keeps the measure from
the box's start edge, as base.css already says.

The render check reads the column's content box as the column again, as it
did before #4724, and counts note rows and sidebar Layouts in the flow among
the breakouts it holds to the room. So a box the page pulls past the prose by
its own margins is reported again, and the column-loss probe needs no
fixture CSS. The drawing tests read the room from the shell's width.
max-sixty added a commit that referenced this pull request Nov 3, 2026
…ule (#5056)

Since #4724 the reading column has been a CSS grid. A grid item never collapses margins with its children, so a section's box began in the empty band above its first child's top margin, and every mark Leaf places by that box (the focus ring, the margin entry, the thread card, a fragment's landing) stood in that band. #4858 moved a heading's gap onto the item that opens with it; lists, asks and widgets kept their bands. This puts the column and every `layout-flow` back in ordinary block flow, where a first child's margin collapses out through its parent's box, and deletes #4858's rule and its `--lf-items-keep-margins` token.

## How the column works

- **Prose and room.** The column is a box with the measure (`--col`) inside its gutters, centred by auto margins, as before #4724, and a page's CSS sizes it as any box. On the Layout's box, the room past the gutter on each side is the shell's width (`100cqi`) less the column's own content, kept as a percentage that each breakout resolves against its own containing block (`--lf-free-start`, `--lf-free-end`), so the room follows whatever width the page gives the column, as long as the column stands centred in its shell. A column nested in another box has no room.
- **Breakouts.** `wide` keeps the prose's start edge and grows to `min(--wide, 100% + --lf-free-end)`. `available`, and a sidebar Layout standing in the column's flow, take both sides, moved there by a relative offset chosen by the holder's direction, so a page's own margins can't undo it. An available table is centred on the room's axis with `left` and `translate`, since Firefox lacks `justify-self` on a block. On paper every block keeps the prose's measure, and a failed exhibit, or an undrawn widget on a page whose runtime could not start, returns to it. A flow's box grows into the room as far as the blocks in it break out, by padding matched with a negative margin, so its focus ring and every mark drawn round it enclose them while its content box, and so its blocks' room, stays at the prose.
- **Sidebar pages.** The body column pads its end by the width the flex row leaves past the prose, so auto margins and floats work against the prose rather than the whole body.
- **Runtime and checks.** The runtime finds the prose from `--lf-prose-measure`, which the column declares, instead of parsing grid track names (`content-layout.js`, `margin-layout.js`). The render check drops its subgrid `flow-tracks` advice. It reads spills against the page's room, the shell's content box less a gutter each side, as it read them against the grid's window-wide box, and judges what stands in the margin against the column's content box, so a page's own furniture beside the column still answers for itself.
- **Author instructions.** `page-layout.md`'s "Document flow" now describes ordinary block flow and drops the grid caveats: margins that add, floats that don't float, and auto margins that shrink a block. Authors write the same markup as before.

## Measured in Firefox

- **Bands** of 6px or more at the top of a region's box on the 36 examples, each opened alone: 12, against 32 on main and 91 before #4858, with none added. The 12 are sidebar rails, sections in a page's own grid, flex lanes a page lays out, and two widgets that reserve room. On 37 stored pages that built on both versions: 56 to 11, none added.
- **Horizontal geometry:** block edges on 41 example and site pages at 1600, 1280, 900 and 390px match main (5,005 readings; 27 of the pages rerun on the final column in Firefox, 3,884 readings, and the feature gallery in Chromium and WebKit too), except that the column's own box is as wide as the prose, a `layout-flow`'s box stands round what it holds where main's spans the window, and floats float. On ten example pages at 1600, 1000 and 390px in all three engines, no flow's box is crossed by a block inside it.
- **Vertical gaps:** a block's bottom margin counts again, so 32 gaps on nine example pages change, mostly by 3–4px and by up to 17px under the feature gallery's title. On the three pages also compared with the column before #4724, every gap matches it.

## Costs

- A flow holding a table that declares a width rings the table's whole room, since the table's columns set its width.
- Page CSS on the column box itself acts on a plain box, as before #4724, where the grid's tracks absorbed it. A page that widens the column, such as `main { max-width: 960px }`, gets that box with its text at the measure from the box's start edge, where the grid centred a 720px text track inside it. A page that moves the column off centre (a margin or padding on one side, a grid track of its own beside a nav, a universal `margin: 0` reset) or sets `direction: rtl` in CSS rather than `dir` gets breakouts placed for a centred column: they can cover the nav or leave the window, which the render check reports as `past-room`. A universal `box-sizing: border-box` reset narrows the prose to 672px, where the grid kept 720px. None of 261 stored column pages sizes the column, and of 145 real column pages under `~/.tmp` none offsets or resets it; `--col` is the documented way to change the measure.
- A section that is its own formatting context (`display: flow-root`, flex) keeps its band, which #4858's rule covered.
- Two engine gaps are worked around and recorded in `notes/browser-support.md`: the available table's translate, and WebKit leaving a non-inheriting registered length stale after a container resize, which is why the room tokens inherit.

## Tests

`test_a_column_block_starts_at_its_first_line` replaces #4858's heading test and holds heading-, eyebrow-, prose-, list- and flow-led blocks at a band of 0. The subgrid `flow-tracks` test goes. Tests main had adapted to the grid return to block-flow expectations: the view-geometry reading no longer lists the column as an arrangement, the column-loss journey gets a column with no room by narrowing `body`, the drawing tests read the room from the shell's width, and the obligation test holds boxes pulled past the prose to the shell's room rather than to `main`'s box. Locally, the focused layout, rail, pane, tab, drawing and gate tests pass (369), apart from eight that fail on main too, among them `test_an_obligation_and_a_callout_keep_the_column_and_widen_to_what_they_hold`, which main's latest CI run fails on the same `#padded` assertion. The 745 runtime tests pass.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…reads (#5207)

A render named each Page Map marker's position ("N percent down")
against `main`'s own box, while the margin's layout pass hands its
`lf-margin-layout` listeners the prose box, `proseRect(main)` (the event
detail #1425 added). Since #4724 a render and its layout pass run in one
script, so on the feature gallery's embedded page the "On me" marker was
named 7 percent down by the render, renamed 6 percent down by the layout
listener, and back again on the next render — an A→B→A write the suite's
write watch reports as `unchanged write: aria-label on
span.lf-margin-marker`. The render now measures the same prose box, so
both readings agree and the listener's same-basis early return actually
fires. The event's declared type said `DOMRect`; it now names the
`ProseBox` the pass sends. The kernel is rebuilt.

On screen, a marker's spoken position may differ by a percent or so from
before on pages whose prose box is narrower or offset from `main`;
nothing visible changes.

Verification:
`tests/journeys/test_render_startup.py::test_the_gallery_embeds_an_ordinary_stamped_page`
failed locally on main with the reported finding and passes with this
change. A probe wrapping `setAttribute` captured the two writes and
their callers (`renderNow → nameMarkers` and `layoutMountedRows →
lf-margin-layout → nameMarkers`). The tests that read the spoken
position
(`test_a_pointed_row_is_announced_where_it_stands_and_by_its_words`,
`test_a_margin_entry_walk_position_stays_out_of_its_visible_word`) and
`pnpm run test:runtime` pass.

Closes #5162 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…5411)

The widget-quality check now accepts that a generated playground's first
box changes once on activation. Its live view builds each control's
label and native field from the declarations, then moves the preview
beside the controls. `known_widget_findings.py` lists that resize for
`lf-playground`, `-control`, `-preset`, `-preview` and `-choice`, as
max-sixty decided in #4951.

#4724 moved the playground's drawing from the initial producer into the
live widget. It accepted the same content-derived resize for shots,
diffs and timelines. The alternative would have authors hand-write the
controls the declarations already describe. Nothing on screen changes;
only the test's accepted set does.

`test_bundled_widgets_meet_the_widget_quality_checks[playground]` failed
on `1b3e0770c` with the 16 findings reported in the issue. With this
change it passes, and so does `tests/model/test_widget_quality.py`.

Fixes #4951

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 5, 2026
File tree rows show file names, which the reading theme sets in mono
with other code (`packages/reading/defaults.css`, "What it *shows* is
mono: code, diffs, trees, timestamps"). Since #4724 they have been set
in the UI sans instead, and the tree's search field with them.

Leaf's default face for native controls caused it. That default is meant
to weigh nothing, so that any rule a component, package or page states
outranks it. In the document it stands at the head of `lf-base` and
does. In a declared shadow tree it came in with the rest of the shared
sheet in `lf-shadow`, which ranks above `lf-base`, where a widget's
adopted rules sit. Trees' rules sit lower still, in layers inside
`lf-base` (the `cssWrappers.js` seam in `build/vendor.mjs`), so the
default outranked Trees' own fonts for its rows, which are buttons, and
for its search field.

The default now has its own sheet, `browser/styles/control-face.css`,
moved unchanged from `surfaces.css`. `composed_sheets` places it at the
head of `lf-base` in the document, as before, and in `lf-reset` in a
shadow tree, below everything a widget adopts. The portable sheet keeps
it first inside its nesting. The rule this branch first added to the
file tree's package is gone, since Trees' own rules now apply.

Every control in a shadow tree on `corpus`, `file-tree`,
`file-tree-input`, `file-editor`, `worktree-diffs` and
`diff-thread-gallery` was compared with `leaf-dev probe --base`. Only
the file tree's rows and search field changed, in Chromium and Firefox:

| | Font | Size | Row height | Search field height |
|---|---|---|---|---|
| main | `system-ui, -apple-system, "Segoe UI", sans-serif` | 12.5px |
30px | 34px |
| this change | `ui-monospace, SFMono-Regular, Menlo, monospace` | 13px
| 30px | 34px |

Rows take `--code-size`: 13px at working density, as above, and 13.5px
at reading density.

A new browser test seats a bare button, one the widget dresses, and one
a library layer inside `lf-base` dresses in a declared tree. The bare
one takes Leaf's face, and the other two keep their own. With the old
placement the last two fail. The face-order, distribution, font-token,
press-face, portable-page and file tree tests pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 5, 2026
lf-diff has drawn no counted reservation for an inline patch since #4724, which accepted the resize as the drawing replaces the source text. page-layout.md still said it sized textual patches from their inline content, and the drawn-height test named its authored-body case after counted rows.
max-sixty added a commit that referenced this pull request Nov 5, 2026
…it drew (#5571)

`page-layout.md` has said since #3984 that `page check --render`
suggests a drawing's height wherever it differs from what was reserved,
and no check did. A fresh agent writing an eval report gave its
`lf-diagram` no `data-height`. The check printed only startup
layout-shift evidence, whose `after` box was all zeros, so the agent
found the 937px height with `leaf-dev probe`.

The render check now gives `drawn-height` advice for every drawn element
whose tag declares `x-height`. It fires when the drawing is taller or
shorter than the box the element showed before it drew. On that report's
page, copied with the diagram's `data-height` varied:

| `data-height` | Advice |
|---|---|
| none | `<lf-diagram id=campaign-flow> was 314px tall before drawing
and its drawing is 937px tall, so what follows it moved down 623px as it
drew; data-height="937" holds the drawing's height from first paint` |
| 600 | `… was 600px tall before drawing and its drawing is 937px tall,
so what follows it moved down 337px as it drew; …` |
| 1200 | `… was 1200px tall before drawing and its drawing is 937px
tall, leaving 263px blank under the drawing; …` |
| 937 | nothing |

The shift evidence couldn't carry the height. The Layout Instability API
clips each source's box to the window, and that diagram's drawn box sits
below the window inside the workspace's tab scroller, so it came back as
zeros. A shift-based check also can't see a stated height that is too
large, since that moves nothing. So the reading comes from the element's
own box:

- The probe driver records the first box each such element shows before
it is marked `lf-rendered`, with a ResizeObserver started as the page
parses, so nothing holds startup.
- After the page settles, `drawnHeights` measures the drawing with
`data-lf-height` lifted for one synchronous read, since the diagram's
CSS keeps a larger stated height after drawing.
- Elements hidden at check time, or never marked drawn, such as a file
tree held at its stated height, are left out. It is read in the light
scheme at the desktop and phone windows, so a drawing whose height
depends on the width gets a finding at each.

On the shipped examples it fires only on `pr-walkthrough`, and both
firings are real. `pr-key-hunk`, an inline diff, shows its patch as
508px of source text before it draws and is 473px drawn, at both
windows. `lf-pr-brief` states 1037px and draws 1041px on desktop and
1204px on the phone. `security-boundary`, `alert-review`, `heat-loss`
and `live-progress` get nothing.

An inline diff shows its source text until it draws, and #4724 accepted
the resize that follows, so `packages/diff/instructions/author.md` says
to leave `data-height` off inline patches. The advice gives a height
there too. Whether inline patches should take one is a separate
decision.

`page-layout.md` and `evals/README.md` now say what the check reports,
and `page-layout.md` no longer says `lf-diff` sizes a textual patch from
its inline content, which it hasn't since #4724.
`test_a_drawing_reports_its_height_where_its_first_box_differed` covers
no height, too small, too large, a match and an authored body that
already takes the drawing's height. It fails with the reservation lift
removed and with the stated height read in place of the recorded box.
The startup shift, diagram reservation and widget-quality render tests,
the browser type check and `build/registry.test.mjs` pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 9, 2026
…s lends, aim's destroy (#5720)

Removes declarations and branches nothing reads, found in the nightly
survey. No behavior changes.

- **Atlas `$work` keys.** `lf-atlas-task` in the [command-hub
example](https://github.com/max-sixty/leaf/blob/main/examples/command-hub.page/registry.json)
declared `review`, `stalled` and `depends`, and the work test fixture
copied them.
[`work.js`](https://github.com/max-sixty/leaf/blob/main/browser/runtime/work.js)
reads only `state`, `done`, `stopped` and `stoppedAt` on a goal, which
is also the set `module-reading.md`, "Work hierarchies", documents. A
package author copying the worked example would copy three declarations
that do nothing. `review` and `stalled` remain among the role's
`stopped` values.
- **`lf-toc`'s `lends` reading.** It existed for the first-paint
renderer that #4724 deleted. Every caller now passes `true`, so the
`!lends` branch could not run. It is gone from `toc-view.js`,
`lf-toc.js` and two runtime tests, and `#reconcile` now re-renders with
the reading the drawing already holds, not a copy of it.
- **Uncalled or no-op code.** `createAim`'s `destroy` had no caller. The
`if (quoted(this)) return;` at the end of `lf-suggestion`'s `setup()`
did nothing, so its comment moves to `#offer()`, the guard it describes.
`lfWatchPlatform.cancelLater` had no reader. The go-to destination test
kept a Threads (`"T"`) branch that its parametrize no longer reaches.
- **Stale reference.** The service schema's `runtime` description named
`hosting.payload_provenance`, but the function is
`layer.payload_provenance`. The protocol baseline carries the same
annotation, which is not part of the comparison.

Verification: `pnpm run test:runtime` (906 pass) and `pnpm run
check:browser` pass. `leaf package check examples/command-hub.page`
reports no findings. Focused browser tests pass: `test_render_work.py`,
six `lf-toc` tests in `test_contents_and_glosses.py` (outline, title
groups, live reconcile, empty route, section marks, generated
interface), the quoted-widget exhibit, the suggestion margin tests and
`test_the_reference_enters_named_go_to_destinations`.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 15, 2026
)

A sidebar page's prose now stands where a column page's would: centred
in the window, moving right only as far as the sidebar needs. Since
#4724 the body started its prose at its own start edge beside the
sidebar. Once #5772 narrowed a contents-only sidebar to its 56px spine,
that put the prose at x=104 on a 1728px window, with 880px empty past it
and the panel centred 400px off it. In Firefox the prose now stands at
504px beside the spine or an outline column at 1728, 360px at 1440 and
280px at 1280, and below about 930px where it did. Pointing at the spine
on a wide window shows its titles in the empty margin rather than over
the words.

The body pads its start by a new `--lf-room-before` and splits its room
into `--lf-free-start` and `--lf-free-end`, so `available` blocks still
reach the whole room and `wide` grows from the prose. An aside after the
body centres the prose short of the aside. Two limits carry over from
the room math, which predicts flex geometry from `--aside` and the gap:
a percentage `--aside` zeroes the room, as before this change, and
nested flows written in alternating directions don't grow their box
toward a wide block's start side, as on column pages.

Max picked this layout from three drawn candidates. Tests: the spine,
outline and other-direction-flow tests assert the centred prose; the
sidebar browser tests and the contents journey pass.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 17, 2026
…et a page float its own sidenotes (#6237)

Two changes Max picked, one commit each:

- **Sections share the column's room.** A plain `<section>`, `<article>`
or `<details>` now passes the reading column's room to its children, so
a `data-width` block inside one breaks out as it would directly in
`layout-column`, and the `layout-flow` class leaves the author's
vocabulary. A box carrying a Layout (`layout-tiles` and the rest) keeps
its blocks, and so does a section with its own `data-width`. A tab set
that should share the page's flow says `flow="page"` (a conditional
`x-flow`, read the same way in Python and the browser), replacing
`--lf-views-flow`. The `outside-frame` advice, which had recommended a
declaration that does nothing since #4724, now says what works: take the
frame out of the flow or give it `data-width`.
- **Margin note rows go.** `layout-note`, `layout-notes`, `aside.note`,
`--lf-note` and the margin's note avoidance are removed;
`page-layout.md` shows a page floating its own sidenote into the margin,
un-floated below 75rem.

Before this, 32 wide blocks on about 12 real pages sat in plain sections
or disclosures where `data-width` did nothing; stills show the security
example's state diagram, cut off at the column's edge on main, now
whole. Lost: a page's own framed section lets its wide block run over
its border (no tracked page does; `outside-frame` reports it), and the
feature gallery's column re-centres without `layout-notes`. `leaf-dev
bench`: keystroke and wheel step unchanged on every page shape, e.g.
document 7.4 → 7.3 ms and 4.4 → 4.2 ms at 256 sections.

Scored on the nine layout and tab-set eval cases against main, Opus 5.5
author and judge: 18 of 18 pass. Tests: `pnpm run check`, the focused
browser and model tests, and stills over the catalogue. An independent
review's one finding (a tiles section passing room on) is fixed with a
test.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 21, 2026
)

Skim now folds an `<aside>` like any other block. The dial still
promises that Skim shows the gists "and nothing else", but until now it
never folded an aside. This is the sixth override from #6640 (which
removes five places Leaf overrode a page's markup). That PR left it out
because deleting the `aside` entry alone broke the sidebar Layout. Max
asked on 20 Nov to "simplify a lot and delegate to the wise agent, not
to add more folds". So instead of adding a rule that spares the sidebar,
the dial now governs the element it stands in.

### Why deleting the entry alone broke the sidebar

The `aside` entry began as `aside.sidebar` in #4506, the sidebar
Layout's region, and became every `aside` in #4724. The dial walked the
whole view or `main` holding it, so on a `main.layout-sidebar` page it
took the Layout's regions for blocks. Without the entry, Skim folded the
sidebar's contents map and set its ⋯ as a flex item of `main`. That
moved the body from x=104 (1272px wide) to x=628 (748px) in a 1400px
window, in both Chromium and Firefox (third column below).

### What changed

The dial governs its parent element. That is also the box its `position:
sticky` keeps it within, so where the author writes the dial now decides
both what it folds and where it travels with the reader. What it governs
on each Layout, when written as its registry entry says:

- column page: `main`, as before;
- sidebar page: the body (a `.layout-column` or a plain `div`), never
the sidebar beside it;
- tab, or a part's Layout element: that element, as before;
- `main` with no Layout: `main`, where an aside now folds;
- agent message: the message's markup, as before.

An aside with a gist inside it keeps the gist and folds the rest. The
`aside` entry, the three cases in the scope getter, and the dial's
imports of `viewDocument` and `authoredScope` are gone. The dial's
registry entry, which authors read, replaces "It governs the nearest tab
or part containing it, or the whole main" with "It governs the element
it stands in and sticks within it, so write it directly in the element
whose text it governs, such as the `layout-column` element, a sidebar
page's body or a tab, not in a `header` holding the title."

#6640 suggested governing "the flow it stands in, the Layout column". I
didn't build that version. The browser can only find a Layout's column
by its class or by reading the Layout's internal properties
(`--lf-layout-box`, `--lf-prose-measure`). Neither would cover the
commonest shape of an agent's sidebar page, where the title and lede sit
in a `header` spanning both regions.

### Stills, all at Skim in a 1400×900 window

**A sidebar page:** the `sidebar-contents` test page, plus a dial, four
gists and one aside in its body ("Last quarter's rotation overlapped the
payout batch…"). On main and on this branch, the contents map and the
body stand in the same place (x=104, 1272px wide). The body's aside
folds on this branch only.

| | main | this PR | `aside` deleted alone |
|---|---|---|---|
| Chromium | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-chromium-main.png"
width="300"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-chromium-this-pr.png"
width="300"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-chromium-aside-deleted-alone.png"
width="300"> |
| Firefox | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-firefox-main.png"
width="300"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-firefox-this-pr.png"
width="300"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/sidebar-firefox-aside-deleted-alone.png"
width="300"> |

**A column page with asides in its sections.** The Cause aside folds
whole. The Fix aside keeps its gist and folds its other sentence.

| | main | this PR |
|---|---|---|
| Chromium | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/column-chromium-main.png"
width="380"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/column-chromium-this-pr.png"
width="380"> |
| Firefox | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/column-firefox-main.png"
width="380"> | <img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/column-firefox-this-pr.png"
width="380"> |

The Fix ⋯ stands inside the aside, because that is where its gap starts.
Pressing it opens the aside's other sentence, the paragraph after the
aside and the gist-less Timeline section, as below (Chromium). That
follows the dial's existing rule for a gap that starts inside a box, as
it already does for a list item. A framed aside makes the rule easier to
see.

<img
src="https://gist.githubusercontent.com/max-sixty/ed117622b65dac6b2d9a37b57724effb/raw/5cab0ac5b02d9219dad256006d76cbdfa5f9e80a/column-chromium-fix-gap-pressed.png"
width="380">

### What users lose

- **A dial written inside a wrapper governs only that wrapper.** If the
dial sits in the `header` holding the title, for example, Skim folds
nothing below the header. On main such a dial governed the whole `main`,
but its sticky box scrolled away with the header. Of 180 recent pages
under `~/.tmp` that have a lede, 167 hold it in a `header` or `hgroup`,
so this is where an author is likeliest to go wrong; the registry entry
now says where to write the dial (eval below).
- **A sidebar page's spanning header no longer folds.** Where a `header`
spans both regions, it stays whole at Skim, byline and tags included,
because a dial in the body doesn't govern it.
- **An aside counts toward reading time, and Everything opens its
disclosures.** An aside's words count toward each depth's minutes, and
Everything opens a closed `details` inside an aside.

### Eval of the registry entry

In the dial's eval (`skim-carries-the-argument`), three runs per arm,
every run read its arm's dial entry, and every author on both arms wrote
the dial directly in a sidebar page's body. This branch passed 3 of 3
and main 2 of 3; main's miss was a gist given to background material,
unrelated to placement. The eval ran on an earlier wording of the entry
("directly in `main`, a sidebar page's body, a tab or a part"), which I
reworded after review because a part holds a single Layout element.

### A ⋯ inside a grid, unchanged

Skim still sets its ⋯ among the items of a grid or flex box it walks
into, such as `layout-tiles`. With a tile holding a gist beside one that
doesn't, main and this branch both put a third item in the tiles grid,
which narrows the kept tile from 348px to 224px. That doesn't depend on
asides or on the dial's scope.

### Tests

The two changed dial tests, plus
`test_depths_fold_keep_the_place_and_restore`,
`test_a_section_without_a_gist_folds_whole` and
`test_a_folded_block_that_sets_its_own_height_takes_no_room`, all pass.
`pnpm run test:runtime` (1078 passed) and `pnpm run check:browser` pass.
Each new assertion was also run against a control: the aside assertions
fail with main's dial, and the sidebar test fails with the one-word
deletion, where the contents map is hidden.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 22, 2026
Six fresh agents each wrote a package (asks, data, compound, drawing,
theme, portable) from the corrected references and listed where the
references failed them. This fixes the entries that were gaps or
misleading sentences in a reference, each as `main` behaves.

`packages.md`:
- `--package`: a name is lowercase letters, digits and hyphens, so a
  bare `pkg` is a name; a path is relative to where `page init` runs.
  An installed package goes by its directory's name.
- "Seeing it" lists `keeps-first-box` again, with its remedies: a
  `:not(:defined)` rule sized from the theme's tokens, or `height`, with
  `true` and an occurrence's `data-height`, and that the advice may
  stand for content no rule can size. #4724 dropped the bullet while
  the check stayed. The examples draw with no data, and a package with
  no widget has nothing to draw.
- `verbatim`, which the starter declares and no reference mentioned,
  and what a module may add to a verbatim widget. A member tag names
  its holders in `owners`.
- Where the install's `browser/runtime/` and `browser/vendor/` are
  (`leaf --root`), so the references' links under `browser/` and
  `src/` can be opened and a plain host mapped to them.
- "Widget interface" points at the roles that give a press Leaf's face.

`package-data.md`, "User state":
- A version retracts a decision with `restated` and a stamp records
  it; a widget with a whole-widget user verb declares the attribute.
- A `value` record's attribute is a string or string enum.
- A position container is a declared tag inside the widget, never the
  widget itself. `page state` gives each move's rank, not the order,
  and how the ranks order. A version that re-authors a container stops
  earlier moves placing their members, so its author writes them.
- A verb's `detail` schema holds only `type`, `properties`, `required`
  and `additionalProperties`, so `if`/`then` is refused.
- An input may name a source, a reference with its output, or both.
- "Views of an answer" called the `shows` key `attr`; it is `reference`.

`module-state.md`:
- Undo is ⌘Z or the leaf's menu row, and shows a gesture's `says` only
  in the tab that made it.
- `defer()` is for a gesture in which the module changes the nodes
  itself; `render()` doesn't run while it holds, so a widget that
  previews through `render()` leaves it alone.
- Off Leaf `this.reading` is `null` and `this.state` and
  `this.controller` throw.
- Leaf moves no member of a position record; `render()` places them.
- `drawn`'s detail holds one key, the input's property.

`module-authoring.md`: `svg` among Lit's names, which read as a closed
list; in a template `offeredAction`'s `label` is only a symbol's or
mark's accessible name, so the template writes the words.

`module-annotations.md`: when to call `registerVisualParts`, how a user
picks a part, and that a part must take a hit across its area.

`module-input.md`: `onPress`'s `begin` is a passive listener.

`package-themes.md`: tokens go in `defaults.css`; `default` names a
listed theme and `reading` needs no listing; `--package ./path` tries a
theme without installing and reads no `$theme.base`; a texture goes on
`body`; `page check --render` draws the light scheme only.

`page-authoring.md`: pointing at something is Alt-click or Select mode.

`module-authoring.md` and `module-input.md` stand 1 and 2 characters
under the 30,000 a skill file may hold
(`test_every_skill_file_reads_in_one_command`), so the first-box
remedy, the install's layout and recorded state off Leaf went to the
references beside them, and the clarifications of `offered`'s label and
the draft helpers were left out.

Verified by running: `leaf package check` on scratch registries (a
number `value` record, a missing `restated`, `if`/`then` in a detail, a
rule inside one property); `package check --render` for the first-box
advice before and after the `:not(:defined)` rule, and for a
widgetless package; `page init` with `pkg`, `./pkg`, `pkg/` and from a
subdirectory; `theme list` and `page init` over three `themes.toml`
files, `--package ./theme` with a base that isn't installed, and
`--theme` after install; `page state` on a recorded ranking; `page
check --render` on a verbatim widget adding marked and unmarked words
and a control; and `leaf-dev probe` journeys for what `offerAction`,
`offerActionElement` and `offer` write for a label, `defer()` holding
`render()`, `registerVisualParts` twice, `preventDefault()` in
`onPress`, ⌘Z after a pick, Alt-click, `says()` over added words, and
the page's ground on `html` and `body`. A plain page served beside the
tree mapped `/runtime/` and `/vendor/` to `browser/` and drew a
`LeafElement`, whose `reading` was `null` and whose `state` and
`controller` threw. By reading only: the render check's light scheme
(`render_gate/scheme.py`), the Undo row in the leaf's menu and its
words after a reload (`undo.js`), Select mode's key
(`composing/target-picker.js`), how a re-authored container absorbs
moves (`projection.py`), and `fill: none` hit-testing.

A fresh agent then answered seventeen questions an author would ask of
these passages from the skill alone. Sixteen were settled by the text,
and its guesses and re-reads shaped the final wording, including the
`shows` correction.

Tests: `tests/runtime/widget-api.test.mjs`, the three tests of
`tests/model/test_interact_layer.py` that read the references, and
`tests/model/test_theme_tokens.py` pass.
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…nd list of extensions (#6969)

A diff now decides which files wrap from the page's own language table,
so a page whose packages add or remove a Markdown extension gets diffs
that wrap the right files. Before this, `overflowFor`
(`packages/diff/widgets/overflow.js`) kept its own regex,
`\.(?:md|markdown|txt)$`. A page whose packages call `.mdx` Markdown
therefore got an `.mdx` diff that scrolled sideways, and a page that
took `.md` away still wrapped it. Meanwhile `lf-diff` colours each file
by the composed table (`langForPath`), so the two could disagree about
the same file.

The copy dates from a first-paint script (`initial/lf-diff.js`) that ran
before the registry loaded. #4724 removed that script, and with it the
copy's only reason. `overflowFor` now asks `langForPath(path) ===
"markdown"` and keeps `.txt` as plain text, since the table names no
language for it. The registry's instructions for the diff ("Markdown and
plain-text files wrap by default") already describe this behavior.

**Test:** `tests/runtime/diff-overflow.test.mjs` installs a language
table that adds `mdx` and remaps `md`. It fails on the old regex
(`expected 'wrap'`, `actual 'scroll'`) and passes with the fix. It
replaces the old test, which only checked that the regex agreed with the
shipped table.

Also ran: `pnpm run test:runtime` (1099 passed), `pnpm run
check:browser`, pre-commit on the changed files, and
`tests/browser/widgets/test_diffs.py::test_diff_wraps_prose_by_default_and_accepts_an_overflow_choice`.

Co-authored-by: leaf-agent <[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