Skip to content

Move everything Leaf draws to Effect UI, every widget an Effect UI component - #7478

Merged
max-sixty merged 5 commits into
mainfrom
review-effect-ui
Nov 28, 2026
Merged

max-sixty merged 5 commits into
mainfrom
review-effect-ui

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Writes Max's call into the guidance: Leaf moves everything it draws to Effect UI. Every widget, other authors' included, is its declaration plus an Effect UI component that defineWidget defines if it draws anything; a widget that draws nothing, such as lf-group, has no module, and Leaf sets what its declaration states on its element. The chrome moves too, one component at a time, so Lit and LeafElement leave the tree. He made each call on the Effect UI review page on 27 Nov ("yes this would be the intention!", and the picks to move every chrome component and to have Leaf set what a declaration states), and approved the root sentence's words there.

  • browser/AGENTS.md, "Renderers": the destination, that a new widget is written that way, that the chrome moves one component at a time, and that a port is worth making because it brings Leaf closer to drawing everything one way. A function or event a service stands for leaves the package interface once no widget or page script uses it, rather than staying for plain widgets.
  • Root AGENTS.md, "Keep the package interface small": a promise owed on every widget, such as focus across a redraw, is kept in Leaf's own code (defineWidget, or the runtime code that sets the widget's properties and hears its events), in place of "from outside, for an element that imports nothing".
  • packages/AGENTS.md: the matching bullet in "A widget's need of Leaf".
  • Two root-guidance situations for the call.

To weigh: every page will load Effect UI's bundle (191 KB gzipped) before Leaf's own controls draw, once the chrome has moved. The shipped references (module-authoring.md, module-plain-elements.md) still describe plain elements and LeafElement as ways to write a widget, and lf-group and lf-pane still have modules; each changes in its own follow-up.

Scoring is in the comments: root guidance 142/162 head against 139/162 base, on the wording before the plain-language rewrite of the root sentence, which Max asked not to rescore.

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

…ors' included

Max decided on the Effect UI review page (27 Nov 2026) that every widget, plain
custom elements and other authors' included, becomes an Effect UI component that
defineWidget defines, with no Lit in packages (he picked "No Lit in packages"), and
that the guidance states this as a transition on Leaf's way to every view on Effect UI.

- browser/AGENTS.md, "Renderers": the move's destination is every view on Effect UI;
  every widget ends as a defineWidget component and a new one is written that way;
  the chrome follows one view at a time. A widget's port pays by bringing widgets to
  one way of being written; a chrome view's port pays by what it makes easier there.
  A function or event a service stands for leaves the package interface once no
  widget or page script uses it, where it used to stay for plain widgets.
- Root AGENTS.md, "Keep the package interface small": a promise owed on every widget
  is kept in defineWidget or by driving the element it defines, in place of "from
  outside, for an element that imports nothing".
- packages/AGENTS.md: the matching bullet of "A widget's need of Leaf".
- Two root-guidance situations: a new widget is written as a defineWidget component,
  and a promise for every widget goes into the adapter rather than a function each
  widget calls.

Page scripts don't hold the repeated forms back: those in examples/ and docs/ import
mountSample, whileConnected, frameFor, whileInterfaceConnected, setChildren,
connection and generate, none of which a service repeats.

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

One finding, on the second eval case. The verdict is held for now because the description says the root text waits for Max's approval of its words and that the scoring results will follow in a comment.

Comment thread evals/root-guidance/situations.json Resolved
…tion

Tend's review found that the rubric passed an answer that only noted the
plain custom element gains the fix once ported. Its suggested wording,
porting in the same change, failed answers that port the element as their
own next step. The rubric now passes a port the answer itself makes, and
fails a further way to keep the guarantee for widgets defineWidget doesn't
define, which is the route Max's call removes.

Five runs a side: main's root text 2/5 (3 propose keeping focus from
outside for other authors' plain elements), this branch's 4/5.

> _This was written by Claude Code on behalf of max-sixty_
Four of six A/B runs on a chrome port noted that the panel's row is one
Lit render root, so moving one view inside it would break the rule that a
component keeps one renderer. They proposed moving a whole render root.

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

Copy link
Copy Markdown
Owner Author

Scores for this branch.

Root guidance (pnpm run eval:root-guidance, three runs a side, head on the committed root text): head passes 142 of 162 runs, base 139.

  • new-widget-is-an-effect-component: head 3/3, base 0/3. Base writes the plain custom element in every run.
  • widget-promise-kept-in-the-adapter, rescored at five runs a side after Tend's rubric fix (188b0e4): head 4/5, base 2/5. All three base failures propose keeping focus from outside for other authors' plain elements, and the one head failure puts off porting the plain element.
  • state-the-property-not-the-roster and drafts-outgrew-its-price each lost one run in head. Both passed 3/3 in head's earlier run, on a draft of the root sentence.

A/B of browser/AGENTS.md and packages/AGENTS.md (plan-mode agents in a scratch home, three runs a side): the two area files don't change either task they aim at, and the chrome guardrail holds.

  • New widget, a count its markup states: 0/3 in both arms. Every run made it a widget with no module, a registry entry and a stylesheet, which packages.md offers. With a module required, both arms went 3/3, all on defineWidget.
  • Port lf-pane: 0/3 in both arms. defineWidget can't hold a widget that draws nothing, since its component draws only into a box of its own and sees its element only in inputs. lf-pane only sets attributes on itself and its body. Base runs exempted it on their own judgment; head runs put the exemption to the maintainer. lf-group, lf-card and lf-playground-output are the same kind. That gap is open.
  • Port a chrome view (On Me): 3/3 in both arms decline to port for uniformity. Four of the six noted that the panel's row is one Lit render root, so cd9d57e has the chrome move one component at a time.

Spend: about $10 for the root-guidance runs and $36 for the A/B.

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

…plain words

Max picked moving every chrome component, whether or not each gains on its own, so
Lit and LeafElement leave the tree; a port is now worth making because it brings
Leaf closer to drawing everything one way. He also found both the old and the new
wording of the root sentence on widget promises hard to read, so it now says what
the rule is with focus across a redraw as its example. He asked for no rescore.
@max-sixty max-sixty changed the title Make an Effect UI component the one way to write a widget, other authors' included Move everything Leaf draws to Effect UI, every widget an Effect UI component Nov 28, 2026
…laration states

Max picked this for lf-group and lf-pane: Effect UI has no way for a component to set
attributes on its own element, and Leaf already paints a widget's declared
reading-role onto its element as it serves the page. So a widget is its declaration,
plus an Effect UI component if it draws, and the root sentence names defineWidget as
where every widget that draws moves.
@max-sixty

Copy link
Copy Markdown
Owner Author

Max approved the root AGENTS.md sentence's words on the review page, and asked for this to merge. The last push, a206480, writes his pick on widgets that draw nothing into "Renderers": such a widget has no module, and Leaf sets what its declaration states. It also narrows the root sentence to "every widget that draws" is moving to defineWidget, which follows from that pick.

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

@max-sixty
max-sixty merged commit 10bfefd into main Nov 28, 2026
7 checks passed
@max-sixty
max-sixty deleted the review-effect-ui branch November 28, 2026 02:39
max-sixty added a commit that referenced this pull request Nov 28, 2026
…tion (#7482)

A widget that draws nothing now needs no module: Leaf sets what its
declaration states. `lf-group` and `lf-pane` only gave themselves a
role, an accessible name and (the pane) its body's scroll marks, so
their modules are deleted. Max picked this on the Effect UI review page
("Have Leaf set what the declaration states"), and #7478's "Renderers"
now says a widget that draws nothing has no module.

- The kernel registry's `reading-role` mark gains `role` (`pane` →
`region`, `group` → `group`). Both existing painters, `mark_declared`
for served pages and revisions and `markDeclared` for thread messages,
write that `role` and an `aria-label` from `label`, each unless the
author wrote it.
- `watchPanes` (`declared-words.ts`) marks a pane's body as its reading
region as the pane arrives, with `watchArrivals`. That re-runs when the
pane's children change, so a body a revision brings in takes the region.
These marks are runtime paint, which a revision's source strips, so the
server can't deliver them.
- `verbatim` leaves both declarations, since composition refuses it
without a module. The version comparison counts an element in a reading
role as a block in its place, which is the same two tags.

What a user sees differently: a revision that renames a pane's or
group's label now edits it in place instead of replacing it, so scroll
and focus stay. An author's own `aria-label` wins over `label`. A
package's own module-less pane tag gets its reading region too.

To weigh: the reading-role → ARIA role table is a kernel fact in
`$marks`, not a package-interface name (`leaf-dev interface --base` adds
none).

Code +50/−62 (−54 is the two modules), tests +112/−15, docs +11/−10,
excluding compiled mirrors. `pnpm run check` passes; the pane, group,
revision and ring browser tests pass by node id; `leaf-dev stills
--base` shows 7 of 7 pane and group states unchanged.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 28, 2026
… component (#7544)

The shipped references now teach one way to write a widget: its
declaration, plus, if it draws, an Effect UI component that
`defineWidget` defines. `module-plain-elements.md` becomes
`module-widgets.md`, which describes the element protocol as what the
adapter does for the component, and the other module references drop
their Lit and plain-element routes. The starter `leaf package init
--widget` writes is now such a component.

The eval suite grades the form a fresh agent writes: a new case,
`widget-written-as-a-component`, is graded by
`dev/leaf_dev/widget_form.py`, which parses the module the page runs,
and the rubrics whose expected form changed accept `declare` and a keyed
move. The grader and `resource_urls` build their parsers from one
grammar, `javascript_language`.

Rescored against main, the references lead on 7 of 10 cases and tie on
3. Fresh agents wrote a `defineWidget` component in 3 of 3 runs, against
0 of 3 on main. On keeping focus in a list, 1 of 2 graded runs passed,
against 0 of 4.

`leaf-dev interface` adds no name. Its protocol count drops from 78 to
77, since the index no longer lists `redraw()`, which a component never
defines. `--base` can't read this branch's base, which has no
`module-widgets.md`, so compare runs on each tree.

Max set the destination, every widget an Effect UI component, on the
Effect UI review page and in #7478. This follows #7542, the adapter it
describes, and Codex reviewed it. `pnpm run test:runtime` (1240), the
grader, interface and reference tests, and the starter's browser test
pass.

> _This was written by Claude Code on behalf of max-sixty_
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