Repository navigation
Conversation
A prototype of a Lit-first widget contract, measured on five widgets before deciding whether to convert the rest. `LeafElement` (runtime/leaf-element.js) is a LitElement base class whose render() reads through collected readers (its reading and state, a bound data source through `this.data(input)`, asks, reports, the time) and draws again when any of them moves. It owns the widget's render region: a move claims it inside the publication, the next update that draws settles the claim as it commits, and a failed update settles it with the fail-soft box in the render root. It draws nothing while away, holds through the controller's defer() and a drag, gates on an incomplete startup reading, and holds the data version for a tag that declares x-data. Bound data moves only as state application delivers it, as a watchData subscription's staged paint does. A reading of presentation proof (`proofReading`), such as the new `reportsReady` narration gate, draws again without claiming, since a claim would move that proof. Converted: lf-atlas-worker and lf-atlas-tree (command hub, and the corpus copies), lf-options, lf-board, lf-file-editor, and the work fixtures lf-test-worker and lf-test-tree. The controller's subscribe/renderState path and watchData stay for the widgets not converted; the controller's defer() and an ancestor's remount refresh reach a LeafElement through `drawsItself`, and both share `widgetMounted`. Behaviour change: converted widgets draw on the microtask after the publication that moves their reading, not during it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…every failure An update settles the claim it started with; a claim its own reads make while it runs is the next update's. A draw queued as the element left waits for its return even before the arrival batch reports the departure. A failure in the gate or after the draw is reported and shown once, rather than swallowed. Accepted data claims the element's region inside the publication that accepts it and draws at delivery, as a watchData subscription's staged ticket does. The ownership test runs with LeafElement widgets too, covering a remounted part whose owner places it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
While any widget held a drag, every LeafElement, every controller subscription and the document-wide projection pass held new state until the last hand was down. Now only the widget whose drag moves its own nodes holds its drawing, through its controller's defer() (lf-board already did); the hand still holds back a new revision and an undo, which would replace the nodes under it. Other widgets draw foreign state during a drag: a draft above a board that grows mid-drag moves the board 174px under the pointer, and the drop still records the move Sortable made. This deletes the drag waiters in LeafElement and the controller, the projection's drag gate and its deferral reading, watchDragRelease, and the framework's PRESENTATION_HELD, whose only producer was that gate. Tests that asserted the page-wide hold now assert the new behaviour or, where the hold was their subject (a report held behind a body drag, the drag release's projection wake), are deleted. TODO.md gains an unconfirmed item: let Lit's SignalWatcher follow a widget's reads once Leaf's publication is TC39 signals. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/semantic-state.js
# Conflicts: # skills/leaf/packages/file-editor/widgets/lf-file-editor.js
…aim after updated A failed draw replaced the render root's children with the fail-soft box, so a widget that paints retained nodes, as lf-options paints its authored options, had nothing to draw on afterwards: the next reading removed the box and left the options gone. The box now stands at the head of the render root beside what the element drew, and the next update that draws takes it away (`placesFailure` in widget-upgrade.js, which a LeafElement registers). The same placement takes a rejected `present()` preparation and a module's own `failSoft(this, …)`, which had replaced a shadow widget's whole stage and detached its render root. A `setup()` that throws shows its failure and the element draws nothing after it, so lf-file-editor-style builds need no catch of their own. An update's claim now moves at its gate and settles once Lit has run all of it, `updated` included; a failure anywhere, `willUpdate` too, rejects it rather than the coordinator recording a commit before work after the draw failed (leaf-agent's finding). A draw nested in another's `updated` with no claim of its own fails the enclosing one. The hold is one flag, since the controller's `defer()` refuses a second, and the refresh is a private method rather than a symbol. lf-file-editor.js takes prettier's indentation after the merge of #2867. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…raw's failure its own A draw that failed under a claim was reported only by the presentation coordinator, as "Presentation failed", with no widget named. The element now reports it as the widget's own failure before rejecting the claim, so the agent that wrote the widget can find it, and a failure on a claim the coordinator has since retired is still reported. A nested draw's failure no longer rethrows into the enclosing update: Lit's catch there cleared the update a nested publication had queued. Each draw settles its own claim. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…fails leaf-agent's suggestion: a draw that updated() starts at once, as lf-file-editor's paint() may, and that fails with no claim of its own now rejects the enclosing update's claim rather than letting it record a commit beside a fail-soft box. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…he render check lf-draft, lf-playground, lf-call-diff, lf-text-document, lf-atlas-task (both copies), lf-pr-brief (both copies), lf-test-task and the seated-ask, drift and relative page fixtures now draw in render() from what they read, with their one-time build in setup(). Behaviour is unchanged. lf-playground no longer catches its own build failure, which LeafElement shows. A widget whose draw starts asynchronous work holds it with controller.present(): lf-text-document starts its highlighting and preview from updated(), and lf-pr-brief waits for the Markdown renderer once a delivery before drawing its template. A LeafElement declaring x-data now holds the page's data version on both its widget regions, render and preparation, so the version is not stamped before that work lands. The render check's relativeReplays replays a LeafElement through redraw(), which draws the reading again outside any claim and Lit's schedule and throws what fails; renderState widgets still replay through renderState. A startup test covers a widget presenting its authored state offline and the log's on recovery. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent's finding: redraw() ran updated(), whose work may start asynchronous preparation, as lf-text-document's does, which claims the widget's presentation and lands after the synchronous check reads the page. The replay now draws the render alone, the part that states the widget's complete state, as renderState did. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#2898 branched before #2889 committed the kernel, so it landed runtime and widget edits without the kernel rebuild check:browser compares against. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 14, 2026
Owner
Author
|
Closing as a duplicate of #2901, which rebuilds the same kernel files.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2898 branched before #2889 committed the compiled kernel, so it landed runtime and widget edits without rebuilding
skills/leaf/kernel/, andpnpm run check:browseron main reports it stale. This ispnpm run build:browseron main, nothing else.