@adia-ai/web-components 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/template.js +2 -11
- package/package.json +1 -1
package/core/template.js
CHANGED
|
@@ -68,21 +68,12 @@ export function stamp(result, container) {
|
|
|
68
68
|
update(inst.p, result.values);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
// Safari 14.0 lacks ChildNode.replaceChildren. Fallback manually removes
|
|
72
|
-
// existing children, then appends the new content. Runs once per call;
|
|
73
|
-
// cheap enough to be unconditional.
|
|
74
|
-
function replaceChildren(container, ...nodes) {
|
|
75
|
-
if (container.replaceChildren) { container.replaceChildren(...nodes); return; }
|
|
76
|
-
while (container.firstChild) container.removeChild(container.firstChild);
|
|
77
|
-
for (const n of nodes) container.appendChild(n);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
71
|
function mount(result, container) {
|
|
81
72
|
const { strings } = result;
|
|
82
73
|
const tpl = getTemplate(strings);
|
|
83
74
|
const f = tpl.content.cloneNode(true);
|
|
84
75
|
const parts = scan(f, result.values.length);
|
|
85
|
-
replaceChildren(
|
|
76
|
+
container.replaceChildren(f);
|
|
86
77
|
return { s: strings, p: parts };
|
|
87
78
|
}
|
|
88
79
|
|
|
@@ -147,7 +138,7 @@ function applyValue(p, v) {
|
|
|
147
138
|
stamp(v, wrap(p));
|
|
148
139
|
} else if (Array.isArray(v)) {
|
|
149
140
|
const c = wrap(p);
|
|
150
|
-
replaceChildren(
|
|
141
|
+
c.replaceChildren();
|
|
151
142
|
for (const item of v) {
|
|
152
143
|
if (isResult(item)) {
|
|
153
144
|
const el = document.createElement('span');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adia-ai/web-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "AdiaUI web components — vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-utils.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|