Repository navigation
Move everything Leaf draws to Effect UI, every widget an Effect UI component - #7478
Conversation
…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
left a comment
There was a problem hiding this comment.
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.
…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_
|
Scores for this branch. Root guidance (
A/B of
Spend: about $10 for the root-guidance runs and $36 for the A/B.
|
…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.
…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 approved the root
|
…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_
… 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_
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
defineWidgetdefines if it draws anything; a widget that draws nothing, such aslf-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 andLeafElementleave 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.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".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 andLeafElementas ways to write a widget, andlf-groupandlf-panestill 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.