@adia-ai/web-components 0.5.2 → 0.5.4
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/USAGE.md +42 -0
- package/components/accordion/accordion.a2ui.json +8 -2
- package/components/accordion/accordion.d.ts +7 -2
- package/components/accordion/accordion.yaml +8 -2
- package/components/accordion/class.js +6 -0
- package/components/agent-questions/agent-questions.yaml +2 -0
- package/components/agent-questions/class.js +6 -0
- package/components/agent-reasoning/agent-reasoning.yaml +5 -0
- package/components/agent-reasoning/class.js +6 -0
- package/components/agent-trace/agent-trace.js +6 -0
- package/components/agent-trace/agent-trace.yaml +3 -0
- package/components/calendar-picker/calendar-picker.yaml +4 -0
- package/components/calendar-picker/class.js +7 -0
- package/components/canvas/canvas.a2ui.json +1 -10
- package/components/canvas/canvas.d.ts +0 -6
- package/components/canvas/canvas.yaml +1 -7
- package/components/card/card.a2ui.json +1 -5
- package/components/card/card.d.ts +0 -9
- package/components/card/card.yaml +1 -3
- package/components/chat-thread/chat-input.a2ui.json +158 -0
- package/components/chat-thread/chat-input.yaml +251 -0
- package/components/check/class.js +1 -0
- package/components/color-picker/class.js +6 -0
- package/components/color-picker/color-picker.yaml +2 -0
- package/components/command/class.js +6 -0
- package/components/command/command.yaml +2 -0
- package/components/drawer/class.js +25 -3
- package/components/drawer/drawer.a2ui.json +13 -1
- package/components/drawer/drawer.d.ts +6 -1
- package/components/drawer/drawer.yaml +11 -1
- package/components/feed/feed-item.a2ui.json +86 -0
- package/components/pane/class.js +6 -0
- package/components/pane/pane.yaml +2 -0
- package/components/radio/class.js +1 -0
- package/components/row/row.a2ui.json +1 -5
- package/components/row/row.d.ts +0 -9
- package/components/row/row.yaml +1 -3
- package/components/select/class.js +7 -0
- package/components/select/select.yaml +2 -0
- package/components/slider/class.js +25 -0
- package/components/switch/class.js +1 -0
- package/components/table/class.js +6 -0
- package/components/table/table.a2ui.json +13 -0
- package/components/table/table.d.ts +9 -0
- package/components/table/table.yaml +13 -0
- package/components/tag/class.js +6 -0
- package/components/tag/tag.yaml +2 -0
- package/components/textarea/class.js +1 -0
- package/components/tree/class.js +6 -0
- package/components/tree/tree.yaml +2 -0
- package/components/upload/class.js +1 -0
- package/core/icons.d.ts +148 -0
- package/core/icons.js +148 -5
- package/core/icons.test.js +187 -0
- package/core/template.js +59 -3
- package/package.json +16 -2
package/core/template.js
CHANGED
|
@@ -31,15 +31,48 @@ export function css(strings, ...values) {
|
|
|
31
31
|
|
|
32
32
|
const templateCache = new WeakMap();
|
|
33
33
|
|
|
34
|
+
// §155 (v0.5.3): walks the accumulated static-string chunk to decide
|
|
35
|
+
// whether each ${…} placeholder is in tag-position (substitute {{p:N}})
|
|
36
|
+
// or content-position (substitute <!--p:N-->). The walker tracks `<`,
|
|
37
|
+
// `>`, `'`, `"` for that decision.
|
|
38
|
+
//
|
|
39
|
+
// FEEDBACK-06 §1 P0: HTML comments must be treated as opaque. An
|
|
40
|
+
// apostrophe inside `<!-- foo's bar -->` previously put `q = 1`
|
|
41
|
+
// (single-quoted-string state); the `-->` closer was then treated as
|
|
42
|
+
// string content; all subsequent `<` / `>` chars were masked. Result:
|
|
43
|
+
// every placeholder after the comment got mis-classified, producing
|
|
44
|
+
// `<segmented-ui .value=<!--p:10--> …>` (which the DOM parser eats),
|
|
45
|
+
// `scan()` finds no part registered, and `update()` falls through
|
|
46
|
+
// `isFn` branch — invoking the consumer's arrow handler with no
|
|
47
|
+
// arguments → "Cannot read properties of undefined (reading 'detail')"
|
|
48
|
+
// crash at mount with a stack trace pointing at user code.
|
|
49
|
+
//
|
|
50
|
+
// Fix: skip HTML comments wholesale before the quote/tag walker runs.
|
|
51
|
+
// Comments cannot open a tag and cannot contain real string delimiters
|
|
52
|
+
// as far as the live HTML parser is concerned. Unterminated comments
|
|
53
|
+
// fall through to `last = 0` (content-position) which is the safe
|
|
54
|
+
// default.
|
|
34
55
|
function inTag(m) {
|
|
35
|
-
let q = 0, last = 0;
|
|
36
|
-
|
|
56
|
+
let q = 0, last = 0, i = 0;
|
|
57
|
+
while (i < m.length) {
|
|
58
|
+
if (q === 0 &&
|
|
59
|
+
m.charCodeAt(i) === 60 /* < */ &&
|
|
60
|
+
m.charCodeAt(i + 1) === 33 /* ! */ &&
|
|
61
|
+
m.charCodeAt(i + 2) === 45 /* - */ &&
|
|
62
|
+
m.charCodeAt(i + 3) === 45 /* - */) {
|
|
63
|
+
const end = m.indexOf('-->', i + 4);
|
|
64
|
+
if (end === -1) { last = 0; break; }
|
|
65
|
+
i = end + 3;
|
|
66
|
+
last = 0;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
37
69
|
const c = m.charCodeAt(i);
|
|
38
70
|
if (q) { if (c === (q === 1 ? 39 : 34)) q = 0; }
|
|
39
71
|
else if (c === 39) q = 1;
|
|
40
72
|
else if (c === 34) q = 2;
|
|
41
73
|
else if (c === 60) last = 1;
|
|
42
74
|
else if (c === 62) last = 0;
|
|
75
|
+
i++;
|
|
43
76
|
}
|
|
44
77
|
return last === 1;
|
|
45
78
|
}
|
|
@@ -93,7 +126,30 @@ function scan(fragment, count) {
|
|
|
93
126
|
} else if (n.nodeType === 1) {
|
|
94
127
|
for (const attr of [...n.attributes]) {
|
|
95
128
|
const m = attr.value.match(/^\{\{p:(\d+)\}\}$/);
|
|
96
|
-
if (!m)
|
|
129
|
+
if (!m) {
|
|
130
|
+
// §152 (v0.5.3): partial-attribute interpolation runtime guard.
|
|
131
|
+
// The attribute-part contract is whole-value-only (one placeholder
|
|
132
|
+
// per attribute, full replacement). Partial like `style="bg:${a};
|
|
133
|
+
// color:${b}"` produces post-concat `bg:{{p:0}}; color:{{p:1}}`
|
|
134
|
+
// which fails the ^…$ regex above. Without this guard the literal
|
|
135
|
+
// {{p:N}} text reaches the DOM as the attribute's static value —
|
|
136
|
+
// silent-garbage class. Warn loudly so consumers don't ship the
|
|
137
|
+
// bug. Hot template paths fire many times, so warn (not throw):
|
|
138
|
+
// a thrown error would crash render; warn surfaces the bug class.
|
|
139
|
+
if (attr.value.includes('{{p:')) {
|
|
140
|
+
// eslint-disable-next-line no-console
|
|
141
|
+
console.warn(
|
|
142
|
+
`[template] Partial attribute interpolation is not supported.\n` +
|
|
143
|
+
` Element: <${n.tagName.toLowerCase()}>\n` +
|
|
144
|
+
` Attribute: ${attr.name}="${attr.value.slice(0, 80)}${attr.value.length > 80 ? '…' : ''}"\n` +
|
|
145
|
+
` Use one of:\n` +
|
|
146
|
+
` ${attr.name}="\${expression}" ← full replacement (whole attr is the placeholder)\n` +
|
|
147
|
+
` .${attr.name}=\${expression} ← property assignment (preferred for objects/functions)\n` +
|
|
148
|
+
` Compute the full attr value as a single expression and interpolate the whole.`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
97
153
|
const i = +m[1], name = attr.name;
|
|
98
154
|
if (name[0] === '@') {
|
|
99
155
|
n.removeAttribute(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adia-ai/web-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "AdiaUI web components — vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -58,7 +58,21 @@
|
|
|
58
58
|
"./core/icons-phosphor.js"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@adia-ai/a2ui-runtime": "^0.5.0"
|
|
61
|
+
"@adia-ai/a2ui-runtime": "^0.5.0",
|
|
62
|
+
"@codemirror/commands": "^6.10.3",
|
|
63
|
+
"@codemirror/language": "^6.12.3",
|
|
64
|
+
"@codemirror/lint": "^6.9.5",
|
|
65
|
+
"@codemirror/state": "^6.6.0",
|
|
66
|
+
"@codemirror/view": "^6.41.1",
|
|
67
|
+
"@lezer/highlight": "^1.2.3"
|
|
68
|
+
},
|
|
69
|
+
"optionalDependencies": {
|
|
70
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
71
|
+
"@codemirror/lang-html": "^6.4.11",
|
|
72
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
73
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
74
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
75
|
+
"@codemirror/lang-yaml": "^6.1.3"
|
|
62
76
|
},
|
|
63
77
|
"publishConfig": {
|
|
64
78
|
"access": "public",
|