@adia-ai/web-components 0.7.13 → 0.7.14
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 +5 -0
- package/core/element.js +14 -0
- package/core/element.test.js +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog — @adia-ai/web-components
|
|
2
2
|
|
|
3
|
+
## [0.7.14] — 2026-06-08
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **`input-ui`/`textarea-ui` `.value` property binding set before upgrade is no longer dropped.** A `.value=${x}` (or any reactive property) assigned during template stamp *before* the element upgrades landed as a pre-upgrade own data-property that `installProps`' `Object.defineProperty` clobbered with the signal default — so the field rendered blank while `value="${x}"` (attribute) worked, and `<select-ui>` was unaffected (inconsistent). `installProps` now captures + reifies the pre-upgrade value (WHATWG upgrade-a-property pattern), fixing it for `value` and every UIElement property. (color-app FEEDBACK-99; covered by `core/element.test.js`.)
|
|
7
|
+
|
|
3
8
|
## [0.7.13] — 2026-06-06
|
|
4
9
|
|
|
5
10
|
### Fixed
|
package/core/element.js
CHANGED
|
@@ -34,6 +34,19 @@ function installProps(el, props) {
|
|
|
34
34
|
for (const [key, cfg] of Object.entries(props)) {
|
|
35
35
|
const attr = cfg.attribute ?? key.toLowerCase();
|
|
36
36
|
const type = cfg.type ?? String;
|
|
37
|
+
// Lazy property upgrade: a property assigned on the instance BEFORE it
|
|
38
|
+
// upgraded (a template engine sets `.prop=${v}` during stamp — possibly
|
|
39
|
+
// before the element is defined; see the property-binding path in
|
|
40
|
+
// template.js which sets `el[name] = v` regardless of upgrade state)
|
|
41
|
+
// lives as an own data-property. The defineProperty below would clobber it
|
|
42
|
+
// with the signal default. Capture it and reify it into the signal so the
|
|
43
|
+
// value survives upgrade (WHATWG upgrade-a-property pattern). Fixes
|
|
44
|
+
// input-ui/textarea-ui `.value=${x}`. (A reflect:true prop set pre-upgrade
|
|
45
|
+
// reifies its value but won't update its attribute until the next set —
|
|
46
|
+
// setAttribute is a no-op in the upgrade constructor; a rare, fine corner.)
|
|
47
|
+
const hasPre = Object.prototype.hasOwnProperty.call(el, key);
|
|
48
|
+
const preValue = hasPre ? el[key] : undefined;
|
|
49
|
+
if (hasPre) delete el[key];
|
|
37
50
|
const sig = signal(cfg.default ?? undefined);
|
|
38
51
|
el[SIG].set(key, sig);
|
|
39
52
|
Object.defineProperty(el, key, {
|
|
@@ -47,6 +60,7 @@ function installProps(el, props) {
|
|
|
47
60
|
},
|
|
48
61
|
configurable: true,
|
|
49
62
|
});
|
|
63
|
+
if (hasPre) sig.value = preValue;
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
|
package/core/element.test.js
CHANGED
|
@@ -63,6 +63,23 @@ describe('UIElement — properties', () => {
|
|
|
63
63
|
expect(el.label).toBe('hi');
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
// FEEDBACK-99 (color-app, 2026-06-07): a property assigned on the instance
|
|
67
|
+
// BEFORE upgrade — template engines set `.prop=${v}` during stamp, possibly
|
|
68
|
+
// before the element is defined (see template.js property-binding path) —
|
|
69
|
+
// must survive upgrade, not be clobbered by the signal default. WHATWG
|
|
70
|
+
// "upgrade a property" pattern, here in installProps. Fixes input-ui `.value`.
|
|
71
|
+
it('reifies a property set on the instance before upgrade (lazy upgrade)', () => {
|
|
72
|
+
const tag = `test-el-${++registrationCounter}`;
|
|
73
|
+
const el = document.createElement(tag); // undefined tag → un-upgraded
|
|
74
|
+
document.body.appendChild(el);
|
|
75
|
+
el.value = 'pre-upgrade'; // own data-property, no accessor yet
|
|
76
|
+
class El extends UIElement {
|
|
77
|
+
static properties = { value: { type: String, default: '' } };
|
|
78
|
+
}
|
|
79
|
+
customElements.define(tag, El); // upgrade → installProps runs
|
|
80
|
+
expect(el.value).toBe('pre-upgrade'); // reified, not clobbered to ''
|
|
81
|
+
});
|
|
82
|
+
|
|
66
83
|
it('reflects Boolean properties to HTML attributes when reflect: true', () => {
|
|
67
84
|
class El extends UIElement {
|
|
68
85
|
static properties = { disabled: { type: Boolean, default: false, reflect: true } };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adia-ai/web-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
4
4
|
"description": "AdiaUI web components \u2014 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",
|