@adia-ai/web-components 0.8.4 → 0.8.5

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/USAGE.md +60 -25
  3. package/components/adia-mark/adia-mark.a2ui.json +123 -0
  4. package/components/adia-mark/adia-mark.class.js +64 -0
  5. package/components/adia-mark/adia-mark.css +48 -0
  6. package/components/adia-mark/adia-mark.d.ts +20 -0
  7. package/components/adia-mark/adia-mark.examples.md +26 -0
  8. package/components/adia-mark/adia-mark.js +17 -0
  9. package/components/adia-mark/adia-mark.test.js +69 -0
  10. package/components/adia-mark/adia-mark.yaml +121 -0
  11. package/components/agent-questions/agent-questions.a2ui.json +2 -1
  12. package/components/agent-questions/agent-questions.class.js +96 -53
  13. package/components/agent-questions/agent-questions.css +27 -106
  14. package/components/agent-questions/agent-questions.yaml +1 -0
  15. package/components/button/button.class.js +5 -1
  16. package/components/calendar-grid/calendar-grid.a2ui.json +3 -1
  17. package/components/calendar-grid/calendar-grid.class.js +11 -6
  18. package/components/calendar-grid/calendar-grid.css +42 -20
  19. package/components/calendar-grid/calendar-grid.yaml +5 -0
  20. package/components/calendar-picker/calendar-picker.a2ui.json +3 -1
  21. package/components/calendar-picker/calendar-picker.class.js +11 -6
  22. package/components/calendar-picker/calendar-picker.css +39 -19
  23. package/components/calendar-picker/calendar-picker.yaml +5 -0
  24. package/components/chart/chart.class.js +17 -14
  25. package/components/color-input/color-input.class.js +8 -5
  26. package/components/color-picker/color-picker.class.js +6 -3
  27. package/components/field/field.class.js +10 -7
  28. package/components/fields/fields.class.js +15 -12
  29. package/components/icon/icon.class.js +9 -5
  30. package/components/index.js +1 -0
  31. package/components/nav/nav.class.js +2 -1
  32. package/components/noodles/noodles.class.js +14 -10
  33. package/components/page/page.class.js +3 -2
  34. package/components/select/select.class.js +3 -2
  35. package/components/swatch/swatch.class.js +27 -24
  36. package/components/swiper/swiper.class.js +4 -1
  37. package/components/swiper/swiper.css +13 -4
  38. package/components/toolbar/toolbar.class.js +11 -6
  39. package/components/tree/tree.class.js +5 -2
  40. package/core/data-stream.js +21 -15
  41. package/core/element.js +36 -1
  42. package/core/element.test.js +67 -0
  43. package/core/icons-phosphor.js +86 -22
  44. package/core/icons.js +22 -8
  45. package/dist/theme-provider.min.js +2 -2
  46. package/dist/web-components.min.css +1 -1
  47. package/dist/web-components.min.js +107 -102
  48. package/dist/web-components.sheet.js +1 -1
  49. package/package.json +1 -5
  50. package/styles/components.css +1 -0
  51. package/traits/error-shake/error-shake.js +23 -17
  52. package/traits/fade-presence/fade-presence.js +19 -15
  53. package/traits/success-checkmark/success-checkmark.js +21 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/web-components",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
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",
@@ -61,10 +61,6 @@
61
61
  "types": "./css-module.d.ts",
62
62
  "default": "./components/*/*.css"
63
63
  },
64
- "./components/*/*.css": {
65
- "types": "./css-module.d.ts",
66
- "default": "./components/*/*.css"
67
- },
68
64
  "./components/*/css/*.css": {
69
65
  "types": "./css-module.d.ts",
70
66
  "default": "./components/*/css/*.css"
@@ -49,6 +49,7 @@
49
49
  @import "../components/card/card.css";
50
50
  @import "../components/frame/frame.css";
51
51
  @import "../components/avatar/avatar.css";
52
+ @import "../components/adia-mark/adia-mark.css";
52
53
  @import "../components/progress/progress.css";
53
54
  @import "../components/skeleton/skeleton.css";
54
55
  @import "../components/alert/alert.css";
@@ -121,28 +121,34 @@ export const errorShake = defineTrait({
121
121
  // synchronously *before* dispatching `validated`, so the observer
122
122
  // and event listener can both fire — we de-dupe by tracking the
123
123
  // last-known invalid state and only triggering on false → true.
124
- const observer = new MutationObserver((muts) => {
125
- for (const m of muts) {
126
- if (m.attributeName === 'data-validation-invalid') {
127
- const nowInvalid = host.hasAttribute('data-validation-invalid');
128
- if (nowInvalid && !lastInvalid) shake();
129
- lastInvalid = nowInvalid;
130
- } else if (m.attributeName === 'data-error-shake-trigger') {
131
- // Toggle (any change) fires a shake. Empty-string and "" are
132
- // both treated as "present" — the convention for boolean attrs.
133
- if (host.hasAttribute('data-error-shake-trigger')) shake();
124
+ // gh#285 SSR DOM shims (linkedom) have no MutationObserver global.
125
+ // Guard construction; the `validated` event listener below still
126
+ // covers the primary trigger path, so this degrades rather than crashes.
127
+ let observer = null;
128
+ if (typeof MutationObserver !== 'undefined') {
129
+ observer = new MutationObserver((muts) => {
130
+ for (const m of muts) {
131
+ if (m.attributeName === 'data-validation-invalid') {
132
+ const nowInvalid = host.hasAttribute('data-validation-invalid');
133
+ if (nowInvalid && !lastInvalid) shake();
134
+ lastInvalid = nowInvalid;
135
+ } else if (m.attributeName === 'data-error-shake-trigger') {
136
+ // Toggle (any change) fires a shake. Empty-string and "" are
137
+ // both treated as "present" — the convention for boolean attrs.
138
+ if (host.hasAttribute('data-error-shake-trigger')) shake();
139
+ }
134
140
  }
135
- }
136
- });
137
- observer.observe(host, {
138
- attributes: true,
139
- attributeFilter: ['data-validation-invalid', 'data-error-shake-trigger'],
140
- });
141
+ });
142
+ observer.observe(host, {
143
+ attributes: true,
144
+ attributeFilter: ['data-validation-invalid', 'data-error-shake-trigger'],
145
+ });
146
+ }
141
147
 
142
148
  host.addEventListener('validated', onValidated);
143
149
 
144
150
  return () => {
145
- observer.disconnect();
151
+ observer?.disconnect();
146
152
  host.removeEventListener('validated', onValidated);
147
153
  for (const t of activeTimers) clearTimeout(t);
148
154
  activeTimers.clear();
@@ -21,20 +21,24 @@ export const fadePresence = defineTrait({
21
21
  }
22
22
  }
23
23
 
24
- const observer = new MutationObserver(() => {
25
- const visible = host.hasAttribute('data-fade-presence-visible');
26
- if (visible) {
27
- host.setAttribute('data-fade-presence-entering', '');
28
- host.removeAttribute('data-fade-presence-exiting');
29
- host.style.opacity = '1';
30
- } else {
31
- host.setAttribute('data-fade-presence-exiting', '');
32
- host.removeAttribute('data-fade-presence-entering');
33
- host.style.opacity = '0';
34
- }
35
- });
36
-
37
- observer.observe(host, { attributes: true, attributeFilter: ['data-fade-presence-visible'] });
24
+ // gh#285 SSR DOM shims (linkedom) have no MutationObserver global;
25
+ // skip construction rather than throwing (progressive enhancement).
26
+ let observer = null;
27
+ if (typeof MutationObserver !== 'undefined') {
28
+ observer = new MutationObserver(() => {
29
+ const visible = host.hasAttribute('data-fade-presence-visible');
30
+ if (visible) {
31
+ host.setAttribute('data-fade-presence-entering', '');
32
+ host.removeAttribute('data-fade-presence-exiting');
33
+ host.style.opacity = '1';
34
+ } else {
35
+ host.setAttribute('data-fade-presence-exiting', '');
36
+ host.removeAttribute('data-fade-presence-entering');
37
+ host.style.opacity = '0';
38
+ }
39
+ });
40
+ observer.observe(host, { attributes: true, attributeFilter: ['data-fade-presence-visible'] });
41
+ }
38
42
  host.addEventListener('transitionend', onTransitionEnd);
39
43
 
40
44
  // Apply initial state
@@ -43,7 +47,7 @@ export const fadePresence = defineTrait({
43
47
  }
44
48
 
45
49
  return () => {
46
- observer.disconnect();
50
+ observer?.disconnect();
47
51
  host.removeEventListener('transitionend', onTransitionEnd);
48
52
  host.style.opacity = '';
49
53
  host.style.transition = '';
@@ -188,27 +188,32 @@ export const successCheckmark = defineTrait({
188
188
  if (e?.detail && e.detail.valid === true) draw();
189
189
  }
190
190
 
191
- // Watch data-validation-valid (false true) + the manual trigger.
192
- const observer = new MutationObserver((muts) => {
193
- for (const m of muts) {
194
- if (m.attributeName === 'data-validation-valid') {
195
- const nowValid = host.hasAttribute('data-validation-valid');
196
- if (nowValid && !lastValid) draw();
197
- lastValid = nowValid;
198
- } else if (m.attributeName === 'data-success-checkmark-trigger') {
199
- if (host.hasAttribute('data-success-checkmark-trigger')) draw();
191
+ // gh#285 SSR DOM shims (linkedom) have no MutationObserver global.
192
+ // Guard construction; the `validated` event listener below still
193
+ // covers the primary trigger path, so this degrades rather than crashes.
194
+ let observer = null;
195
+ if (typeof MutationObserver !== 'undefined') {
196
+ observer = new MutationObserver((muts) => {
197
+ for (const m of muts) {
198
+ if (m.attributeName === 'data-validation-valid') {
199
+ const nowValid = host.hasAttribute('data-validation-valid');
200
+ if (nowValid && !lastValid) draw();
201
+ lastValid = nowValid;
202
+ } else if (m.attributeName === 'data-success-checkmark-trigger') {
203
+ if (host.hasAttribute('data-success-checkmark-trigger')) draw();
204
+ }
200
205
  }
201
- }
202
- });
203
- observer.observe(host, {
204
- attributes: true,
205
- attributeFilter: ['data-validation-valid', 'data-success-checkmark-trigger'],
206
- });
206
+ });
207
+ observer.observe(host, {
208
+ attributes: true,
209
+ attributeFilter: ['data-validation-valid', 'data-success-checkmark-trigger'],
210
+ });
211
+ }
207
212
 
208
213
  host.addEventListener('validated', onValidated);
209
214
 
210
215
  return () => {
211
- observer.disconnect();
216
+ observer?.disconnect();
212
217
  host.removeEventListener('validated', onValidated);
213
218
  for (const t of activeTimers) clearTimeout(t);
214
219
  activeTimers.clear();