Skip to content

Draw lf-file-tree as an Effect UI component around Pierre Trees - #7395

Merged
max-sixty merged 8 commits into
mainfrom
effect-ui-file-tree
Nov 27, 2026
Merged

max-sixty merged 8 commits into
mainfrom
effect-ui-file-tree

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Requested by Maximilian · project thread

Ports lf-file-tree from Lit to an Effect UI component around Pierre Trees.

Shape. The component draws only the empty state and one container. A stream Mount, DrawTrees, owns the Trees instance on that container:

  • It feeds Trees each new file list and current file from the Mount's args stream.
  • It sends back two Messages: OpenedFile when the reader opens a file, and CountedRows when the number of rows Trees shows changes. "No matching files." reads that count.

Trees still owns paths, sorting, search, folder expansion, focus, selection and virtualization, as on main (search: true). What the reader types in Trees' search lives in Trees' model, which the Mount keeps across redraws. The rows keep role="tree" keyboard navigation, the files.open and files.walk key scopes on the focused row, and Leaf's reveal of a keyboard-reached row. Trees draws only while there are files, as on main, so it measures its scrollbar gutter on a laid-out container. Story tests cover update (tests/runtime/lf-file-tree-story.test.mjs).

Shared modules (kept minimal):

  • effect-widget.js: unchanged; the widget names value through Draw lf-motion as an Effect UI component #7397's properties option.
  • widget-services.js: adds NavigateToDatum, the Command form of navigateToDatum. It, NextOnMe and OpenThread reach Leaf's application through a new host/mounted.js, which mountApplication sets and which imports nothing. A page Leaf doesn't serve still loads none of the application. A call runs in the task of the input that asked. With a dynamic import() in the service instead, the datum reveal landed after the click's rendering had settled. The shift watch reported that as a move without input (test_file_tree_opens_current_diff_files_by_pointer_and_keyboard[patch]).

Visible differences: none found. leaf-dev probe file-tree --base origin/main --shot matches main at rest and with "conf" typed in the search, apart from anti-aliasing on one corner pixel of the frame.

Checks:

  • pnpm run check passes, as do the runtime Story tests.
  • WebKit and Firefox aren't installed here, so their parametrizations didn't run.
  • Here, test_file_tree_opens_current_diff_files_by_pointer_and_keyboard stops at its first expect(search).to_have_value("") on origin/main as well as on this branch, and the two behave the same at that step. CI ran it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y

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


Generated by Claude Code

…ce of Pierre Trees

The navigator is now an Effect UI component (runtime/effect-widget.js) whose Model
holds what the reader does in it: the search query, the folders they closed, the row
holding the tab stop and the file they picked. Its view draws the ARIA tree over
native buttons; its update walks the rows by key. One mount joins the drawn tree to
Leaf's keyboard scope, reveal and route landing.

Pierre Trees owned the widget's whole shadow root, replaced its adopted sheets and
kept the query and expansion in its own model, so it could not share the root with
an Effect UI view. Dropping it removes the 243 KB vendored bundle, its five build
seams and the restaging around it.

- The adapter's `properties` option passes a host-set property, here the registry
  input's `value`, to the component as a prop.
- `NavigateToDatum` joins widget-services.js as the Command for a datum reveal.
- A build seam stops Effect UI writing a focused field's unchanged scroll back,
  which Leaf's write watch reports as a scroll that moves nothing.

Behavior that changed: a pressed row keeps focus during a search (Trees put it back
in the search); ↓ in the search goes to the first matching file's row and Enter
chooses it; search no longer empties on blur; rows show no file icons or
folder-change dots; long names end in an ellipsis rather than eliding each segment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y

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

Holding the verdict for the call the description names: dropping Pierre Trees for a hand-drawn tree goes against root AGENTS.md's "Use dependencies", and that is the maintainer's to make. Beyond that call I have one finding, inline.

The component draws its search input and one container node; a Mount
owns the Trees instance on that node, feeds it files and the query from
its args stream, and sends Trees' events back as Messages. Restores the
trees bundle, its build seams and the Trees-facing tests.

widget-services loads host/application.js lazily inside each service,
so a page whose widgets never ask loads none of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
…nted.js

The search's ArrowDown, Enter and Escape are now an lfCommands scope on
the focused field, like the rows', and a letter typed on a row reaches
the search through the view's rows container, so the widget adds no
keydown listener of its own.

widget-services reaches Leaf's application through host/mounted.js,
which mountApplication sets, rather than importing it. A page Leaf
doesn't serve still loads none of the application, and a service call
runs in the task of the input that asked: the lazy import's extra hop
let a datum reveal land after the click's rendering had settled, which
the shift watch reported as a move without input.

The search field takes Trees' inset and the interface's code font.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
widget-services keeps main's Announce and KeepInTab beside
NavigateToDatum; NextOnMe reaches the application through
host/mounted.js, as NavigateToDatum does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
Takes lf-activity's and lf-timeline's adapter changes (the display:
contents box, the inputs reread) beside the properties option.
OpenThread reaches threadActions through host/mounted.js, as NextOnMe
and NavigateToDatum do, so widget-services has one route to the
application.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
Takes main's effect-widget.js whole: #7397's `properties` option, with
its pre-upgrade capture, replaces this branch's, and lf-file-tree names
`value` through it. The vendor entry exports HtmlCommand beside main's
HtmlSubscription.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y

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

Pierre Trees is back, which settles the call the last review held for, and the per-key visibleRows cost is gone with it. One question remains, inline: the search field is still hand-built where Trees supplies one.

The title still reads "with its own tree in place of Pierre Trees", and the squash merge makes it main's commit message. Something like "Draw lf-file-tree as an Effect UI component around Pierre Trees" would match what the PR now does.

Trees draws its own search again (`search: true`), as on main. The
component draws only the container and the empty state, and DrawTrees
sends a file opened and the visible row count. The hand-built field,
its five messages, its register scope, the row-letter handler, the
Effect UI scroll seam and the HtmlCommand export go, and the journey
test is main's again.

Trees draws only while there are files, as on main: drawn into the
hidden container of an empty first render, it measured a zero
scrollbar gutter and set its rows 6px narrower.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
@max-sixty max-sixty changed the title Draw lf-file-tree as an Effect UI component, with its own tree in place of Pierre Trees Draw lf-file-tree as an Effect UI component around Pierre Trees Nov 27, 2026
@max-sixty
max-sixty merged commit e1b2b6b into main Nov 27, 2026
7 checks passed
@max-sixty
max-sixty deleted the effect-ui-file-tree branch November 27, 2026 19:21
max-sixty added a commit that referenced this pull request Nov 28, 2026
`leaf-dev interface --base` now reports the names the Effect UI ports
made available to packages. Before this change it read functions from
`widget-api.js` and `portable-api.js` alone, so it reported nothing for
them. Run on each port's own commit against its parent, it now reports
additions for every one of #7374, #7378, #7397, #7399, #7400 and #7395.
For example, against the commit before #7374 it lists
`/runtime/effect-widget.js`, `/runtime/widget-services.js` and
`/vendor/effect-ui.js` as modules, `defineWidget`, `widgetProps` and the
eight `widget-services.js` exports as functions, and Effect UI's 16
exports.

The census now reads every module `$public-modules` lists outside the
library, with each module's exports, including the vendored ones. It
also reads every mark any reference gives, which adds 21 documented
marks it missed, such as `data-lf-focus-visible`, and the chrome parts
`package-themes.md` lists.

Root `AGENTS.md`'s "Keep the package interface small" now names the
public modules and their exports as part of the interface, and the
references that gave Lit as the only way to follow a page reading, or
`widget-api.js` as the only module to import, now name the Effect UI
forms too. What the move to Effect UI keeps and retires is left to the
guidance change that states Max's call on it.

To weigh: a vendored module's exports count as names, so a Lit bump that
adds an export shows as an addition. A widget's own `part` names are its
package's, so the census doesn't count them. A function's options count
as part of that function, so `--base` doesn't list them.

Asked for by Max from the parts-column-scroll page and in the session.
Codex reviewed five rounds. Tests: `dev/tests/model/test_interface.py`,
`tests/runtime/widget-api.test.mjs`. Evals: `widget-controller-lifetime`
and `widget-ratings-recorded-by-leaf`, 12/12 on both arms.

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

3 participants