Skip to content

Draw lf-worktree and lf-worktree-diffs as Effect UI components - #7377

Merged
max-sixty merged 1 commit into
mainfrom
effect-ui-worktrees
Nov 27, 2026
Merged

max-sixty merged 1 commit into
mainfrom
effect-ui-worktrees

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Requested by Maximilian · project thread

This is the second step of moving Leaf's widgets to Effect UI, after #7374. lf-worktree and lf-worktree-diffs now draw as Effect UI components through defineWidget.

What changes

  • Both widgets mount in a shadow root with lfPatch: "members". Their inputs read the element's attributes, and for the collection its members' attributes. worktree-view.js and worktree-diffs-view.js are deleted.
  • defineWidget gains lfPatch. A descendant's lf-connect now reads inputs again, as LeafElement draws again then, so a kept collection redraws its totals in place after a revision changes its members.
  • inputs is read through one guarded call, so a throw from that re-read reports through failSoft, as a signal-driven one already does.
  • lf-worktree-diffs's view wraps its overview and slot in a display: contents div, because an Effect UI view has one root.
  • The capture test drives the defined elements instead of the deleted view functions. It still checks that the disclosure, its open state, focus and the slotted evidence are kept while totals change.

What a user sees

leaf-dev stills --base origin/main reports worktree-startup unchanged. worktree-summaries and worktree-cases-open differ only in how "+7" kerns: Lit wrote "+" and "7" as two text nodes, and Effect UI writes one string. The styles diff lists only the wrapper div in place of the overview and slot standing directly in the shadow root.

Tests

  • tests/browser/test_render_diff_controls.py and tests/journeys/test_render_diff_controls.py, worktree tests (5 passed, WebKit skipped locally).
  • tests/runtime/authored-capture.test.mjs and tests/runtime/effect-widget.test.mjs.
  • pnpm run check and pre-commit.

🤖 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

Both widgets now mount through `defineWidget` in a shadow root with
`lfPatch: "members"`, and their inputs read the element's and its members'
attributes. A descendant's `lf-connect` reads them again, so a kept widget
redraws in place and its native disclosure keeps its open state and focus.
`worktree-view.js` and `worktree-diffs-view.js` are deleted.

`lf-worktree-diffs`'s view wraps the overview and slot in a `display: contents`
div, since an Effect UI view has one root. Stills show one visible difference:
"+7" kerns as one text node rather than Lit's two.

The adapter reads `inputs` through one guarded call, so a throw from a
descendant's `lf-connect` stays on the widget as a signal-driven one does. The
capture test now drives the defined elements rather than the deleted view
functions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
@max-sixty
max-sixty merged commit b58cdcc into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the effect-ui-worktrees branch November 27, 2026 10:14
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