@adia-ai/a2ui-compose 0.6.42 → 0.6.43
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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/transpiler/transpiler-maps.js +7 -0
- package/transpiler/transpiler.js +48 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog — @adia-ai/a2ui-compose
|
|
2
2
|
|
|
3
|
+
## [0.6.43] — 2026-05-27
|
|
4
|
+
|
|
5
|
+
### Fixed — Cycle-18 transpiler substrate sweeps (RL + RL2)
|
|
6
|
+
|
|
7
|
+
- **`transpiler/transpiler.js`** — two substrate sweeps from gen-review cycle-18:
|
|
8
|
+
- **Ralph Loop**: 6 visual bugs fixed at SoT — header slot grammar, leaf children, button slot preservation.
|
|
9
|
+
- **RL2**: 10 visual bugs across header slot, leaf children, calendar widget.
|
|
10
|
+
- **`transpiler/transpiler-maps.js`** — preserve `slot=` annotations through transpilation so card-ui transpiled `text-ui` chunks match the substrate CSS selector.
|
|
11
|
+
|
|
3
12
|
## [0.6.42] — 2026-05-26
|
|
4
13
|
|
|
5
14
|
### Maintenance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adia-ai/a2ui-compose",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.43",
|
|
4
4
|
"description": "AdiaUI A2UI compose engine \u2014 framework-agnostic. Takes natural-language intents + a catalog and produces A2UI protocol messages. Pairs with `@adia-ai/a2ui-retrieval` (intent classification, catalog lookup) and `@adia-ai/a2ui-validator` (schema + semantic checks).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -310,6 +310,13 @@ export function extractProps(el, a2uiType) {
|
|
|
310
310
|
const props = {};
|
|
311
311
|
const attr = (name) => el.getAttribute?.(name) ?? el.attributes?.get?.(name) ?? null;
|
|
312
312
|
|
|
313
|
+
// Universal: preserve [slot] for every element. Slot is a layout-bearing
|
|
314
|
+
// HTML attribute that card-ui / drawer-ui / etc. depend on via :has(> [slot])
|
|
315
|
+
// grid activation. Yamls don't declare slot as a prop (it's an HTML standard
|
|
316
|
+
// attribute, not a component prop), so the catalog pass below won't pick it up.
|
|
317
|
+
const slotAttr = attr('slot');
|
|
318
|
+
if (slotAttr) props.slot = slotAttr;
|
|
319
|
+
|
|
313
320
|
// §163 (v0.5.4) — Catalog-driven generic extraction FIRST. Fills in
|
|
314
321
|
// every prop the v0.9 catalog declares for this type (label, icon,
|
|
315
322
|
// variant=, etc.). Legacy per-type blocks below run AFTER and can
|
package/transpiler/transpiler.js
CHANGED
|
@@ -200,7 +200,54 @@ function walkNode(el, context) {
|
|
|
200
200
|
]);
|
|
201
201
|
|
|
202
202
|
if (LEAF_TYPES.has(a2uiType)) {
|
|
203
|
-
|
|
203
|
+
// Leaf types still need to carry slotted or container children in two
|
|
204
|
+
// shapes:
|
|
205
|
+
//
|
|
206
|
+
// (1) Trailing icons / kbd shortcuts inside Button:
|
|
207
|
+
// `<button-ui text="Next"><icon-ui slot="trailing" name="caret-right">`
|
|
208
|
+
// (2) Slotted container wrappers that themselves transpile to a leaf
|
|
209
|
+
// type but hold inline child elements:
|
|
210
|
+
// `<span slot="heading"><text-ui strong>Title</text-ui> <badge-ui>...`
|
|
211
|
+
// The span maps to Text via HTML_TAG_MAP, but it functions as a
|
|
212
|
+
// flex container (per card.css `> [slot="heading"]`) and needs
|
|
213
|
+
// to keep its children.
|
|
214
|
+
//
|
|
215
|
+
// Rule: if the element has ANY element children, recurse all of them.
|
|
216
|
+
// Pure text leaves (no element children) keep the text-prop path.
|
|
217
|
+
const elementChildren = (el.children || []).filter(c => c.tagName);
|
|
218
|
+
if (elementChildren.length === 0) {
|
|
219
|
+
context.components.push({ id, component: a2uiType, ...props });
|
|
220
|
+
return id;
|
|
221
|
+
}
|
|
222
|
+
// When a leaf has element children, the auto-extracted textContent prop
|
|
223
|
+
// would be the CONCATENATED descendant text (e.g.
|
|
224
|
+
// <text-ui>$49<text-ui>/month</text-ui></text-ui>
|
|
225
|
+
// has textContent "$49/month"), causing every label to render twice
|
|
226
|
+
// alongside the child components. Replace it with the element's DIRECT
|
|
227
|
+
// text nodes only — text the element OWNS, not what its children own.
|
|
228
|
+
// The minimal HTML parser represents text nodes as pseudo-elements
|
|
229
|
+
// with tagName === '' inside the children array.
|
|
230
|
+
const directText = (el.children || [])
|
|
231
|
+
.filter(n => !n.tagName)
|
|
232
|
+
.map(n => n.textContent || '')
|
|
233
|
+
.join(' ').replace(/\s+/g, ' ').trim();
|
|
234
|
+
const containerProps = { ...props };
|
|
235
|
+
if (directText) {
|
|
236
|
+
// Preserve the direct text on whichever prop the type uses
|
|
237
|
+
if (a2uiType === 'Text' || a2uiType === 'Kbd' || a2uiType === 'Code') containerProps.textContent = directText;
|
|
238
|
+
else if (a2uiType === 'Button' || a2uiType === 'Badge') {
|
|
239
|
+
if (containerProps.text === undefined) containerProps.text = directText;
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
delete containerProps.textContent;
|
|
243
|
+
delete containerProps.text;
|
|
244
|
+
}
|
|
245
|
+
const childIds = [];
|
|
246
|
+
for (const child of elementChildren) {
|
|
247
|
+
const childId = walkNode(child, context);
|
|
248
|
+
if (childId) childIds.push(childId);
|
|
249
|
+
}
|
|
250
|
+
context.components.push({ id, component: a2uiType, ...containerProps, children: childIds });
|
|
204
251
|
return id;
|
|
205
252
|
}
|
|
206
253
|
|