Skip to content

Draw the Page Map with Effect UI, mounted by the runtime into its dialog - #7577

Merged
max-sixty merged 5 commits into
mainfrom
agent-a4620db2a12118b8d
Nov 29, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a4620db2a12118b8d

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The Page Map is the first piece of Leaf's chrome drawn by Effect UI: one component draws everything inside the native dialog the runtime keeps, and the owner keeps the layer, inventory and contributions and hears row presses and Close as the component's events. The mount every Effect UI view stands on moves to one home, host/effect-root.ts, which defineWidget now shares, so a chrome surface mounts with no element or registry entry. mountRoot is the Effect that mounts a typed component and gives back its Renderer.Root<Model, Msg, Props>; the caller runs it with the services the component's type still asks for, so the type check holds a chrome surface to its requirements as #7575 holds a widget, and the Page Map's component carries no any. Focus and reveal after a draw are HtmlCommands on refs; the owner's own refreshes hold focus and place with afterDraw; browser/AGENTS.md states the rule once for the next port.

What to weigh:

  • Every page now loads Effect UI as it boots. Pages without an Effect UI widget (10 of 28 examples) load 584 KB more before they show the server's state and spend 19–27 ms more load CPU; pages that already hold one are unchanged. Every chrome component moves to Effect UI (browser/AGENTS.md, "Renderers"), so every page will load it once the floating panel ports, since the panel draws on every page as it boots. Max chose on the review page to count Effect UI's own load against that move, rather than build a deferred load and a first open that waits for it, which the panel's port would delete, and approved landing this there.
  • A contributor that hands the user to a Page Map row the map hasn't drawn yet, in the same script, now finds no control (the features/contributions.ts header says so). No contributor in the tree does this.
  • The dialog grew from 435 to 637 lines of code. Its opening and search-key logic is now under a Story test.

Stills show 0 px difference. Tests: test:runtime, pnpm run check, and 32 named Page Map browser tests. One test now reads an immediate reorder after a frame instead of synchronously.

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

The Page Map is the first piece of Leaf's chrome drawn by Effect UI. One
component draws everything inside the native dialog the runtime keeps:
the head with Close, the search, the groups and rows, the empty line.
The owner keeps the layer, the inventory and the contributions, gives
the component props, and hears a row press or Close as its events. The
mount every Effect UI view stands on now has one home,
`host/effect-root.ts` (Leaf's Html.Host, the microtask scheduler,
`mountRoot`, `afterDraw`), which `defineWidget` uses too, so a chrome
surface mounts with no element and no registry entry.

Reads after a paint: where the opening puts the user, the spilled
entry's reveal, and the search's Down and Enter are `HtmlCommand`s on
refs; the owner's own refresh holds focus and place across its draw
with `afterDraw`. The view draws outside the presenter's signal
tracking, so the owner reads a thread's heading as it derives the
rows, and each row's Mount runs the contribution writers in an effect.
Shared fragments get builder forms beside their Lit ones
(`searchFieldMarks`, `voicedNodes`, `threadHeadingNodes`); the Lit
directives `contributionHost` and `contributionReceipts`, now unused,
go with their parity test. browser/AGENTS.md says the rule once, in
"Renderers" and "Working on the runtime". The opening's and the
search keys' logic is now under a Story test. The reveal lint accepts
`HtmlCommand.scrollIntoView`, which goes through Leaf's host, and
`leaf-dev bench` gains a `map` input that opens the Page Map.

To weigh:
- Every page now loads Effect UI as it boots. Pages without an Effect
  UI widget (10 of 28 examples) load 584 KB more before they show the
  server's state and spend 19-27 ms more load CPU (log-retention
  168 -> 195 ms, data-explorer 194 -> 214, lowest of 7); the user gains
  nothing from it. Pages that hold one are unchanged, and opening the
  map on 256 threads costs 95 ms against 97.
- A contributor that hands the user to a map row the map hasn't drawn
  yet, in the same script, finds no control; none in the tree does.
- The dialog grew from 435 to 637 lines of code.

Keys, focus and look are unchanged; stills show 0 px difference. Tests:
test:runtime, check, 32 named Page Map browser tests; one now reads an
immediate reorder after a frame rather than synchronously.

> _This was written by Claude Code 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 port itself holds up. At this head the runtime tests pass, and so do the Page Map browser tests I picked (keyed reorder, search walk, small-screen arrivals, disclosure arrival); the second pass found no defect. That leaves the cost the description already raises, which this review can't settle for you.

Root AGENTS.md, "Working on the repository", asks that "a change that adds work before the page first shows the server's state says what the user gains and why the work can't wait." The description says that for the 10 of 28 example pages without an Effect UI widget, the extra 584 KB and 19–27 ms of load CPU come "for no user gain." The cost comes from a static import: browser/leaf.js imports panel/page-map-dialog.js, which loads Effect UI. Nothing on those pages uses it before someone opens the map.

There are two ways to resolve it, and both are your call:

  • Accept the cost as the price of the migration. browser/AGENTS.md moves every chrome component to Effect UI, so every page will load it once the panel or Threads ports. That is a reason the work can't wait, and the description could say so.
  • Load the dialog after the page shows the server's state (a dynamic import() once boot settles). That keeps the open as fast as it is now, but adds a stretch where g P and the Navigate row aren't registered yet. That is a new state in boot that lasts only until the next chrome port, which is the kind of addition "Complicating the core" asks you to approve.

Because the cost is still undecided, and this PR edits browser/AGENTS.md (which Landing in running-tend reserves for your approval), I'm not approving or merging it.

#7575 typed `defineWidget` over its component. The shared mount takes
that typing: `mountRoot` is now the Effect that mounts a typed
component and gives back its `Renderer.Root<Model, Msg, Props>`, which
the caller runs with the services the component's type still asks for
and a Scope, so the check holds a chrome surface to its requirements as
it holds a widget. Leaf's `Html.Host` is provided on each mount.

The Page Map's component is typed throughout, with no `any`: its
view functions take `Html.H<Msg>`, its props are declared Schemas, the
search is a typed `wa-input` whose words reach the Model from its
Mount's `input` listener (`asSearchField`, which `searchField` now
shares), and status rows take a span ref of the rows' name.

> _This was written by Claude Code on behalf of max-sixty_
# Conflicts:
#	browser/AGENTS.md
#	browser/runtime/effect-widget.js
#	browser/runtime/effect-widget.ts
@max-sixty
max-sixty merged commit a6a8ad8 into main Nov 29, 2026
7 checks passed
@max-sixty
max-sixty deleted the agent-a4620db2a12118b8d branch November 29, 2026 05:51
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