Skip to content

Let a widget that runs off Leaf ask quoted(), and say the drafting text field is Leaf-only - #6894

Closed
max-sixty wants to merge 3 commits into
mainfrom
agent-a1e532d60814bbecd
Closed

max-sixty wants to merge 3 commits into
mainfrom
agent-a1e532d60814bbecd

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

quoted(el) now loads from /runtime/portable-api.js, so a widget written to run off Leaf can follow the rule every widget is given, to check quoted() before wiring input. Before this it was exported only by widget-api.js: importing it from the portable file failed to link on every page, and importing widget-api.js broke the module on a page without Leaf. Three of six trial authors writing from the shipped references hit one or the other. Off Leaf nothing declares an exhibit, so it answers false; on Leaf it gives Leaf's answer through the seam LeafElement already uses for its reading and controller.

The drafting text field stays Leaf-only, since its editor and its drafts are Leaf's runtime and server; module-authoring.md, "A widget that also runs off Leaf", now says so and names a native control as the text box to use instead.

To weigh. The portable file gains one export (85 to 86); widget-api.js exports the same names as before, and the portable closure gains no module. Three other helpers the references tell every widget to call (says(), named(), motion) are still Leaf-only, and a failed import still shows in the render checks as a 240 s timeout that names no module; both are left for separate changes.

Tests. A runtime test holds quoted to false before Leaf installs its capabilities and to Leaf's answer after, and the plain-page smoke test asks it on a page without Leaf. pnpm run test:runtime (1086), pnpm run check:browser, pre-commit and the focused browser tests pass.

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

…Leaf's own

A widget module that also runs on a page without Leaf imports only
`/runtime/portable-api.js`. `module-authoring.md` tells every widget to ask
`quoted(element)` before it wires input, and only `widget-api.js` exported `quoted`,
which can't load off Leaf. A portable module that followed the rule therefore either
imported `quoted` from the portable file, which fails to link on every page, or
imported `widget-api.js`, which works on Leaf and throws on a plain page, where
`window.lfStorage` is undefined. In November 2026 six agents each wrote a widget
package from the shipped references, and three of them wrote portable modules that
broke this way, on `quoted` and on the drafting text field.

`portable-api.js` now exports `quoted`. leaf-element.js holds the function beside the
capabilities Leaf installs for `LeafElement`. On a Leaf page it gives
widget-descriptors.js's answer; on a page without Leaf, where no registry declares
an exhibit, it is false. `widget-api.js` re-exports the portable file whole, so it
exports the names it did and every existing import keeps working. The portable
file's import closure gains no module.

The drafting text field stays Leaf's own. Its tag's home loads off Leaf, but its
element (composing/text-field.js) reaches about 45 runtime modules outside the
portable file's closure, `wireInput` belongs to the application, and the page's
server keeps the drafts, so off Leaf it would mean nothing. `module-input.md`, "Text
entry and drafts", now says that where a portable author meets the field, and that
a portable widget's text box is a native control.

tests/runtime/exhibit-fence.test.mjs holds the portable `quoted` to false before Leaf
installs its capabilities and to Leaf's answer after, and
tests/smoke/test_plain_page.py asks it on a page without Leaf.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
…ule lives

module-input.md has 38 characters left under the size a skill file may be, so
the note that the field loads only on Leaf goes in module-authoring.md, "A
widget that also runs off Leaf", which owns what a portable widget may import.
@max-sixty

Copy link
Copy Markdown
Owner Author

Superseded by #6946, which removed quoted() from the package API: a widget, on Leaf or off it, now asks el.matches("[data-lf-exhibit] *"), so there is no function for the portable file to export. This pull request's other sentence, that the drafting text field is Leaf-only, goes into the step that folds the module references into one file.

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.

2 participants