Skip to content

Expose Lit template helpers through the shared browser facade - #2321

Merged
max-sixty merged 2 commits into
mainfrom
lit-foundations
Oct 11, 2026
Merged

max-sixty merged 2 commits into
mainfrom
lit-foundations

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Package and runtime templates can import the Lit helpers they need through the shared facade: nothing, live, ref/createRef, classMap, styleMap, guard, svg/mathml, when, ifDefined, keyed and unsafeHTML. The widget API keeps Leaf’s focus-preserving render wrapper, and the runtime no longer imports Lit directly. This re-exports the existing vendored singleton and keeps the dependency pin. The Lit build backports upstream #5218 so optional ref(undefined) survives disconnect/reconnect; lit-html stays at 3.3.0 to avoid the repeat marker leak. The authoring reference explains when live restores an application-owned native value after a refused gesture.

Survey item 2. Measured source lines: browser/index.ts 12 → 23; widget-api.js 250 → 267; widget-elements.js 595 → 595. These are API additions, not a line reduction; generated facade and build assertions are also updated. The ref backport grows browser/build.mjs from 306 to 326 lines.

Validation: focused browser-build tests (7 passed), runtime tests (313 passed), served base/candidate startup comparison, and optional-ref lifecycle regressions in Node and Chromium.

This was written by Codex 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 new public ref route exposes a reproducible crash with Leaf's pinned lit-html 3.3.0. The inline suggestion removes it from the widget API; the helper list in module-authoring.md should match.

@max-sixty
max-sixty merged commit 87484ca into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lit-foundations branch October 11, 2026 02:53
max-sixty added a commit that referenced this pull request Oct 11, 2026
The banner status view renders one template with refs, classMap, and a
native popover target. Approval renders directly into its toolbar button
with synchronous attributes, removing the child component that wrote its
parent. Publication links remain ordinary links outside the disclosure.
Phone notices keep a fixed first-line position when background news
changes from two lines to one.

Survey item 13. Measured source: banner-status-view.js 171 → 192,
banner.js 890 → 899, banner-approval.js 67 → 0; total 1,128 → 1,091
(−37), plus four stylesheet lines for the stable phone notice slot. The
survey underestimated formatted template size. The dot export was
unused, but its getter serves favicon coloring and is retained. The
layout test now protects publication links and keyboard disclosure
rather than requiring node identity across the page-lifetime publication
branch. Template helpers use the shared facade from #2321.

The notice slot reserves two lines and top-aligns news while keeping
ordinary status centered. Previously a shorter notice moved down by half
a line; retaining its Text node exposed that existing layout defect. The
regression reproduces the 8.73px movement before the fix and now passes.

Validation: focused status, publication, approval, favicon, phone-notice
replacement, and the 390px primary-package browser journeys passed.
Independent source review and 323 runtime tests passed. CI runs the
complete landing gates.

> _This was written by Codex 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