You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✨ Feature — extend a component by patching its template
A component extension can now patch its base's template instead of overriding it. Declare export const patch — a static array of ops — and skip writing your own template; the loader
resolves the (local) base template, applies the ops, and compiles the result:
Ops: attr / removeAttr, prepend / append, before / after, replace, remove, wrap.
Selectors match by tag, .class, [attr], or [attr=value]; a selector that matches nothing is a loud build error. Inserted markup and added attributes are ordinary Weave template text ({{ }}, on:, use:, @if/@for, nested components all work).
It's build-time, so it's correct for reactive content — a patch on a @for row applies to every
row, including ones added later (a runtime DOM patch would miss them). The extension compiles with the base's style hash, so the base's scoped CSS still applies.
Two constraints: the base must be a local component (a published package ships no raw template
— patch a local base, or use full override), and an extension uses either patches or a
full-override template, never both.
Known limitation: patch markup isn't type-checked by weave check yet (a typo in a patched
expression surfaces at build/runtime, not in the editor). Full-override (#1) extensions are fully
checked. See Extending a component.
This completes RFC 0008 (both modes: #1 full override from 1.1.0, #3 patches here).