v1.0.15
✨ Feature — use: actions on component tags
- A
use:action now works on a component tag, not just a DOM element — Weave forwards it to
the component's single root element, with the identical lifecycle it has on an element (runs
at mount, supports a returned cleanup or{ update, destroy }, and re-runsupdatewhen the
argument changes; multipleuse:on one component all run, in order):This lets a<Button use:menu={{ accountMenu }}>Account ▾</Button> <!-- action attaches to the root <button> --> <a use:menu={{ accountMenu }}>Account (footer)</a> <!-- same menu, native trigger -->
@weave-framework/ui<Button>(or any single-root component) be a menu/tooltip
trigger, and preserves the "define once, trigger from many places" pattern across a mix of
components and native elements. The action'saria-*and listeners land on the component's root
element (e.g.aria-haspopup/aria-expandedon the<button>inside<Button>).weave check
type-checks the action as(Element, arg)on components too. - Single-root constraint, fail-loud. A component that renders a fragment (multiple top-level
nodes), a text/comment root, or nothing is a clear error — "use: on<Account>: actions attach
to a single root element, but<Account>renders 3 nodes." — never a silent mis-attach. - Component props,
on:events, and element-leveluse:are unchanged — no behaviour change
for existing code. (transition:/in:/out:andref/bind:thison components are not yet
supported — a natural follow-up on the same forwarding mechanism.)
📋 Docs
- Accepted RFC 0008 — component extension (
extendComponent): a future primitive to subclass
any component (reuse itssetup+ template, override/add on both) without forking. Design record
only — not implemented yet.