@adia-ai/web-components 0.8.18 → 0.8.20

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 (126) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/components/nav-group/nav-group.a2ui.json +5 -0
  3. package/components/nav-group/nav-group.class.js +14 -6
  4. package/components/nav-group/nav-group.css +5 -2
  5. package/components/nav-group/nav-group.d.ts +2 -0
  6. package/components/nav-group/nav-group.yaml +4 -0
  7. package/components/select/select.a2ui.json +6 -1
  8. package/components/select/select.class.js +34 -7
  9. package/components/select/select.d.ts +2 -0
  10. package/components/select/select.yaml +16 -1
  11. package/dist/host.min.css +1 -1
  12. package/dist/host.sheet.js +1 -1
  13. package/dist/theme-provider.min.js +1 -1
  14. package/dist/web-components.min.css +1 -1
  15. package/dist/web-components.min.js +18 -18
  16. package/dist/web-components.sheet.js +1 -1
  17. package/package.json +2 -1
  18. package/styles/colors/semantics/core.css +10 -4
  19. package/components/adia-mark/adia-mark.test.js +0 -69
  20. package/components/adia-wordmark/adia-wordmark.test.js +0 -69
  21. package/components/agent-artifact/agent-artifact.test.js +0 -61
  22. package/components/alert/alert.test.js +0 -364
  23. package/components/color-picker/color-picker.test.js +0 -96
  24. package/components/combobox/combobox.test.js +0 -256
  25. package/components/command/command.test.js +0 -99
  26. package/components/date-range-picker/date-range-picker.test.js +0 -387
  27. package/components/datetime-picker/datetime-picker.test.js +0 -454
  28. package/components/demo-toggle/demo-toggle.test.js +0 -102
  29. package/components/description-list/description-list.test.js +0 -72
  30. package/components/display-field/display-field.test.js +0 -115
  31. package/components/empty-state/empty-state.test.js +0 -77
  32. package/components/field/field.test.js +0 -260
  33. package/components/fields/fields.test.js +0 -88
  34. package/components/inline-message/inline-message.test.js +0 -203
  35. package/components/input/input.test.js +0 -335
  36. package/components/integration-card/integration-card.test.js +0 -318
  37. package/components/link/link.test.js +0 -143
  38. package/components/list/list.test.js +0 -106
  39. package/components/list-window/list-window.test.js +0 -303
  40. package/components/loading-overlay/loading-overlay.test.js +0 -257
  41. package/components/menu/menu.test.js +0 -176
  42. package/components/nav/nav.test.js +0 -428
  43. package/components/nav-group/nav-group.test.js +0 -67
  44. package/components/option-card/option-card.test.js +0 -32
  45. package/components/pagination/pagination.test.js +0 -195
  46. package/components/select/select.test.js +0 -453
  47. package/components/slider/slider.test.js +0 -202
  48. package/components/spinner/spinner.test.js +0 -272
  49. package/components/stat/stat.test.js +0 -108
  50. package/components/step-progress/step-progress.test.js +0 -129
  51. package/components/swatch/swatch.test.js +0 -563
  52. package/components/table/table.test.js +0 -479
  53. package/components/table-toolbar/table-toolbar.test.js +0 -152
  54. package/components/tag/tag.test.js +0 -137
  55. package/components/tags-input/tags-input.test.js +0 -477
  56. package/components/text/text.test.js +0 -202
  57. package/components/theme-provider/theme-provider.test.js +0 -94
  58. package/components/time-picker/time-picker.test.js +0 -287
  59. package/components/timeline/timeline.test.js +0 -31
  60. package/components/toggle-scheme/toggle-scheme.test.js +0 -110
  61. package/components/tree/tree.test.js +0 -312
  62. package/core/element.test.js +0 -389
  63. package/core/icons.test.js +0 -187
  64. package/core/logical-children.test.js +0 -54
  65. package/core/markdown.test.js +0 -47
  66. package/core/responsive.test.js +0 -121
  67. package/core/template.test.js +0 -611
  68. package/traits/active-state/active-state.test.js +0 -28
  69. package/traits/anchor-positioning/anchor-positioning.test.js +0 -122
  70. package/traits/announcer/announcer.test.js +0 -268
  71. package/traits/arrow-grid-nav/arrow-grid-nav.test.js +0 -375
  72. package/traits/attention-pulse/attention-pulse.test.js +0 -26
  73. package/traits/confetti/confetti.test.js +0 -46
  74. package/traits/confetti-burst/confetti-burst.test.js +0 -46
  75. package/traits/count-up/count-up.test.js +0 -54
  76. package/traits/declarative.test.js +0 -138
  77. package/traits/dirty-state/dirty-state.test.js +0 -45
  78. package/traits/drag-ghost/drag-ghost.test.js +0 -19
  79. package/traits/draggable/draggable.test.js +0 -60
  80. package/traits/draggable-list-item/draggable-list-item.test.js +0 -51
  81. package/traits/drop-target/drop-target.test.js +0 -241
  82. package/traits/droppable/droppable.test.js +0 -54
  83. package/traits/droppable-collection/droppable-collection.test.js +0 -99
  84. package/traits/error-shake/error-shake.test.js +0 -114
  85. package/traits/fade-presence/fade-presence.test.js +0 -20
  86. package/traits/focus-restore/focus-restore.test.js +0 -202
  87. package/traits/focus-trap/focus-trap.test.js +0 -42
  88. package/traits/focusable/focusable.test.js +0 -53
  89. package/traits/glow-focus/glow-focus.test.js +0 -31
  90. package/traits/gradient-shift/gradient-shift.test.js +0 -22
  91. package/traits/haptic-feedback/haptic-feedback.test.js +0 -52
  92. package/traits/hotkey/hotkey.test.js +0 -61
  93. package/traits/hoverable/hoverable.test.js +0 -24
  94. package/traits/inertia-drag/inertia-drag.test.js +0 -33
  95. package/traits/input-mask/input-mask.test.js +0 -151
  96. package/traits/intersection-observer/intersection-observer.test.js +0 -38
  97. package/traits/keyboard-nav/keyboard-nav.test.js +0 -41
  98. package/traits/keyboard-reorderable/keyboard-reorderable.test.js +0 -45
  99. package/traits/layout-animation/layout-animation.test.js +0 -114
  100. package/traits/long-press/long-press.test.js +0 -244
  101. package/traits/magnetic-hover/magnetic-hover.test.js +0 -30
  102. package/traits/noise-texture/noise-texture.test.js +0 -20
  103. package/traits/parallax/parallax.test.js +0 -26
  104. package/traits/portal/portal.test.js +0 -30
  105. package/traits/pressable/pressable.test.js +0 -73
  106. package/traits/resettable/resettable.test.js +0 -100
  107. package/traits/resizable/resizable.test.js +0 -39
  108. package/traits/resize-observer/resize-observer.test.js +0 -38
  109. package/traits/ripple/ripple.test.js +0 -32
  110. package/traits/roving-tabindex/roving-tabindex.test.js +0 -28
  111. package/traits/scale-press/scale-press.test.js +0 -39
  112. package/traits/scroll-lock/scroll-lock.test.js +0 -45
  113. package/traits/scroll-progress/scroll-progress.test.js +0 -182
  114. package/traits/shimmer-loading/shimmer-loading.test.js +0 -43
  115. package/traits/smoke.test.js +0 -111
  116. package/traits/snap-to-grid/snap-to-grid.test.js +0 -40
  117. package/traits/sound-feedback/sound-feedback.test.js +0 -26
  118. package/traits/spring-animate/spring-animate.test.js +0 -28
  119. package/traits/success-checkmark/success-checkmark.test.js +0 -120
  120. package/traits/tilt-hover/tilt-hover.test.js +0 -32
  121. package/traits/tossable/tossable.test.js +0 -31
  122. package/traits/traits-host.test.js +0 -73
  123. package/traits/typeahead/typeahead.test.js +0 -38
  124. package/traits/typewriter/typewriter.test.js +0 -47
  125. package/traits/validation/validation.test.js +0 -93
  126. package/traits/view-transition/view-transition.test.js +0 -268
@@ -1,93 +0,0 @@
1
- import { describe, it, expect, beforeEach } from 'vitest';
2
- import { validation } from './validation.js';
3
- import { mountHost, connectTrait, spyEvent, resetDOM } from '../test-helpers.js';
4
-
5
- function setValue(host, value) {
6
- host.value = value;
7
- host.dispatchEvent(new Event('input'));
8
- }
9
-
10
- describe('validation', () => {
11
- beforeEach(resetDOM);
12
-
13
- it('required: empty value is invalid', () => {
14
- const host = mountHost('input', { 'data-validate': 'required' });
15
- connectTrait(validation, host);
16
- setValue(host, '');
17
- expect(host.hasAttribute('data-validation-invalid')).toBe(true);
18
- expect(host.getAttribute('data-validation-message')).toBe('This field is required');
19
- });
20
-
21
- it('required: non-empty value is valid', () => {
22
- const host = mountHost('input', { 'data-validate': 'required' });
23
- connectTrait(validation, host);
24
- setValue(host, 'hello');
25
- expect(host.hasAttribute('data-validation-valid')).toBe(true);
26
- expect(host.hasAttribute('data-validation-invalid')).toBe(false);
27
- });
28
-
29
- it('email: rejects malformed input', () => {
30
- const host = mountHost('input', { 'data-validate': 'email' });
31
- connectTrait(validation, host);
32
- setValue(host, 'not-an-email');
33
- expect(host.getAttribute('data-validation-message')).toBe('Invalid email address');
34
- });
35
-
36
- it('email: accepts well-formed addresses', () => {
37
- const host = mountHost('input', { 'data-validate': 'email' });
38
- connectTrait(validation, host);
39
- setValue(host, 'user@example.com');
40
- expect(host.hasAttribute('data-validation-valid')).toBe(true);
41
- });
42
-
43
- it('minlength: enforces minimum character count', () => {
44
- const host = mountHost('input', { 'data-validate': 'minlength:5' });
45
- connectTrait(validation, host);
46
- setValue(host, 'hi');
47
- expect(host.getAttribute('data-validation-message')).toBe('Minimum length is 5');
48
- setValue(host, 'hello!');
49
- expect(host.hasAttribute('data-validation-valid')).toBe(true);
50
- });
51
-
52
- it('pattern: enforces regex match', () => {
53
- const host = mountHost('input', { 'data-validate': 'pattern:^[A-Z]+$' });
54
- connectTrait(validation, host);
55
- setValue(host, 'lower');
56
- expect(host.hasAttribute('data-validation-invalid')).toBe(true);
57
- setValue(host, 'UPPER');
58
- expect(host.hasAttribute('data-validation-valid')).toBe(true);
59
- });
60
-
61
- it('combined rules: required + email both checked', () => {
62
- const host = mountHost('input', { 'data-validate': 'required, email' });
63
- connectTrait(validation, host);
64
- const spy = spyEvent(host, 'validated');
65
- setValue(host, '');
66
- expect(spy.last.errors).toContain('This field is required');
67
- setValue(host, 'bad');
68
- expect(spy.last.errors).toContain('Invalid email address');
69
- setValue(host, 'ok@example.com');
70
- expect(spy.last.valid).toBe(true);
71
- });
72
-
73
- it('dispatches "validated" event with detail.valid and detail.errors', () => {
74
- const host = mountHost('input', { 'data-validate': 'required' });
75
- connectTrait(validation, host);
76
- const spy = spyEvent(host, 'validated');
77
- setValue(host, '');
78
- expect(spy.count).toBe(1);
79
- expect(spy.last.valid).toBe(false);
80
- expect(spy.last.errors.length).toBe(1);
81
- });
82
-
83
- it('disconnect clears all validation attributes', () => {
84
- const host = mountHost('input', { 'data-validate': 'required' });
85
- const inst = connectTrait(validation, host);
86
- setValue(host, '');
87
- expect(host.hasAttribute('data-validation-invalid')).toBe(true);
88
- inst.disconnect(host);
89
- expect(host.hasAttribute('data-validation-invalid')).toBe(false);
90
- expect(host.hasAttribute('data-validation-valid')).toBe(false);
91
- expect(host.hasAttribute('data-validation-message')).toBe(false);
92
- });
93
- });
@@ -1,268 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
- import { viewTransition } from './view-transition.js';
3
- import { _resetMotionCache } from '../motion.js';
4
- import {
5
- mountHost,
6
- connectTrait,
7
- spyEvent,
8
- resetDOM,
9
- expectValidSchema,
10
- wait,
11
- } from '../test-helpers.js';
12
-
13
- describe('view-transition', () => {
14
- beforeEach(() => {
15
- resetDOM();
16
- _resetMotionCache();
17
- // happy-dom has no startViewTransition; ensure we start clean each test.
18
- delete document.startViewTransition;
19
- });
20
-
21
- afterEach(() => {
22
- delete document.startViewTransition;
23
- _resetMotionCache();
24
- });
25
-
26
- it('exposes a valid schema', () => {
27
- expectValidSchema(viewTransition);
28
- expect(viewTransition.schema.name).toBe('view-transition');
29
- expect(viewTransition.schema.category).toBe('motion-positioning');
30
- expect(viewTransition.schema.events).toContain('view-transition-start');
31
- expect(viewTransition.schema.events).toContain('view-transition-end');
32
- expect(viewTransition.schema.config).toContain('data-view-transition-name');
33
- expect(viewTransition.schema.config).toContain('data-view-transition-duration');
34
- expect(viewTransition.schema.config).toContain('data-view-transition-easing');
35
- });
36
-
37
- it('writes view-transition-name to the host inline style', () => {
38
- const host = mountHost('div', { 'data-view-transition-name': 'card-42' });
39
- connectTrait(viewTransition, host);
40
- expect(host.style.viewTransitionName).toBe('card-42');
41
- });
42
-
43
- it('writes --vt-duration / --vt-easing custom props', () => {
44
- const host = mountHost('div', {
45
- 'data-view-transition-name': 'hero',
46
- 'data-view-transition-duration': '450ms',
47
- 'data-view-transition-easing': 'cubic-bezier(0.2, 0.8, 0.2, 1)',
48
- });
49
- connectTrait(viewTransition, host);
50
- expect(host.style.getPropertyValue('--vt-duration')).toBe('450ms');
51
- expect(host.style.getPropertyValue('--vt-easing')).toBe(
52
- 'cubic-bezier(0.2, 0.8, 0.2, 1)',
53
- );
54
- });
55
-
56
- it('omits CSS props when their data attrs are absent', () => {
57
- const host = mountHost('div');
58
- connectTrait(viewTransition, host);
59
- // happy-dom returns undefined for unset viewTransitionName; real browsers
60
- // return ''. Either is acceptable — the contract is "nothing was set."
61
- expect(host.style.viewTransitionName || '').toBe('');
62
- expect(host.style.getPropertyValue('--vt-duration')).toBe('');
63
- expect(host.style.getPropertyValue('--vt-easing')).toBe('');
64
- });
65
-
66
- it('installs host.startTransition() method', () => {
67
- const host = mountHost();
68
- expect(typeof host.startTransition).toBe('undefined');
69
- connectTrait(viewTransition, host);
70
- expect(typeof host.startTransition).toBe('function');
71
- });
72
-
73
- it('removes host.startTransition() on disconnect', () => {
74
- const host = mountHost();
75
- const inst = connectTrait(viewTransition, host);
76
- expect(typeof host.startTransition).toBe('function');
77
- inst.disconnect(host);
78
- expect(host.startTransition).toBeUndefined();
79
- });
80
-
81
- it('runs the callback when the API is missing (feature-detect fallback)', () => {
82
- const host = mountHost();
83
- connectTrait(viewTransition, host);
84
- let ran = false;
85
- host.startTransition(() => { ran = true; });
86
- expect(ran).toBe(true);
87
- });
88
-
89
- it('fires start + end events when the API is missing', async () => {
90
- const host = mountHost();
91
- connectTrait(viewTransition, host);
92
- const startSpy = spyEvent(host, 'view-transition-start');
93
- const endSpy = spyEvent(host, 'view-transition-end');
94
- host.startTransition(() => {});
95
- // start fires synchronously; end fires on the next microtask.
96
- expect(startSpy.count).toBe(1);
97
- await Promise.resolve();
98
- expect(endSpy.count).toBe(1);
99
- });
100
-
101
- it('toggles data-view-transition-active across start → end', async () => {
102
- const host = mountHost();
103
- connectTrait(viewTransition, host);
104
- expect(host.hasAttribute('data-view-transition-active')).toBe(false);
105
- host.startTransition(() => {
106
- // Mutation runs while the attribute is set.
107
- expect(host.hasAttribute('data-view-transition-active')).toBe(true);
108
- });
109
- // The end is queued on a microtask in the fallback path.
110
- await Promise.resolve();
111
- expect(host.hasAttribute('data-view-transition-active')).toBe(false);
112
- });
113
-
114
- it('returns a finished-promise even in the fallback path', async () => {
115
- const host = mountHost();
116
- connectTrait(viewTransition, host);
117
- const transition = host.startTransition(() => {});
118
- expect(transition).toBeTruthy();
119
- expect(transition.finished).toBeInstanceOf(Promise);
120
- await expect(transition.finished).resolves.toBeUndefined();
121
- });
122
-
123
- it('uses real document.startViewTransition when available', () => {
124
- const finished = Promise.resolve();
125
- const fakeTransition = { finished, ready: finished, updateCallbackDone: finished };
126
- const stub = vi.fn((cb) => { cb(); return fakeTransition; });
127
- document.startViewTransition = stub;
128
-
129
- const host = mountHost();
130
- connectTrait(viewTransition, host);
131
- const cb = vi.fn();
132
- const result = host.startTransition(cb);
133
-
134
- expect(stub).toHaveBeenCalledTimes(1);
135
- expect(cb).toHaveBeenCalledTimes(1);
136
- expect(result).toBe(fakeTransition);
137
- });
138
-
139
- it('fires end after the real transition resolves', async () => {
140
- let resolveFinished;
141
- const finished = new Promise((r) => { resolveFinished = r; });
142
- document.startViewTransition = (cb) => {
143
- cb();
144
- return { finished, ready: finished, updateCallbackDone: finished };
145
- };
146
-
147
- const host = mountHost();
148
- connectTrait(viewTransition, host);
149
- const endSpy = spyEvent(host, 'view-transition-end');
150
-
151
- host.startTransition(() => {});
152
- // End hasn't fired yet — the transition is still in flight.
153
- expect(endSpy.count).toBe(0);
154
-
155
- resolveFinished();
156
- await Promise.resolve();
157
- await Promise.resolve();
158
- expect(endSpy.count).toBe(1);
159
- });
160
-
161
- it('fires end even if the real transition rejects (user-skipped)', async () => {
162
- const finished = Promise.reject(new Error('skipped'));
163
- // Pre-attach a noop catch so the rejection isn't unhandled in the test runner.
164
- finished.catch(() => {});
165
- document.startViewTransition = (cb) => {
166
- cb();
167
- return { finished, ready: finished, updateCallbackDone: finished };
168
- };
169
-
170
- const host = mountHost();
171
- connectTrait(viewTransition, host);
172
- const endSpy = spyEvent(host, 'view-transition-end');
173
-
174
- host.startTransition(() => {});
175
- await Promise.resolve();
176
- await Promise.resolve();
177
- expect(endSpy.count).toBe(1);
178
- });
179
-
180
- it('runs callback synchronously even with a missing/invalid argument', () => {
181
- const host = mountHost();
182
- connectTrait(viewTransition, host);
183
- expect(() => host.startTransition()).not.toThrow();
184
- expect(() => host.startTransition('not a function')).not.toThrow();
185
- });
186
-
187
- it('honors prefers-reduced-motion: reduce — synchronous lifecycle, no animation', async () => {
188
- // Force prefersReducedMotion() to return true.
189
- const origMatchMedia = window.matchMedia;
190
- window.matchMedia = (q) => ({
191
- matches: typeof q === 'string' && q.includes('prefers-reduced-motion'),
192
- media: q,
193
- addEventListener() {},
194
- removeEventListener() {},
195
- addListener() {},
196
- removeListener() {},
197
- dispatchEvent() { return false; },
198
- onchange: null,
199
- });
200
- _resetMotionCache();
201
-
202
- // Even if the API is "available", reduced-motion takes the fallback path.
203
- document.startViewTransition = vi.fn();
204
-
205
- const host = mountHost();
206
- connectTrait(viewTransition, host);
207
- const startSpy = spyEvent(host, 'view-transition-start');
208
- const endSpy = spyEvent(host, 'view-transition-end');
209
- let ran = false;
210
- host.startTransition(() => { ran = true; });
211
-
212
- expect(ran).toBe(true);
213
- expect(startSpy.count).toBe(1);
214
- await Promise.resolve();
215
- expect(endSpy.count).toBe(1);
216
- expect(document.startViewTransition).not.toHaveBeenCalled();
217
-
218
- window.matchMedia = origMatchMedia;
219
- _resetMotionCache();
220
- });
221
-
222
- it('disconnect clears active attr and restores inline styles', () => {
223
- const host = mountHost('div', {
224
- 'data-view-transition-name': 'card-9',
225
- 'data-view-transition-duration': '300ms',
226
- });
227
- const inst = connectTrait(viewTransition, host);
228
- // Force the attribute on so disconnect's cleanup is observable.
229
- host.setAttribute('data-view-transition-active', '');
230
- inst.disconnect(host);
231
-
232
- expect(host.hasAttribute('data-view-transition-active')).toBe(false);
233
- expect(host.style.viewTransitionName || '').toBe('');
234
- expect(host.style.getPropertyValue('--vt-duration')).toBe('');
235
- });
236
-
237
- it('does not clobber an existing host.startTransition; restores it on disconnect', () => {
238
- const host = mountHost();
239
- const sentinel = () => 'pre-existing';
240
- host.startTransition = sentinel;
241
- const inst = connectTrait(viewTransition, host);
242
- expect(host.startTransition).not.toBe(sentinel); // trait took over
243
- inst.disconnect(host);
244
- expect(host.startTransition).toBe(sentinel); // restored
245
- });
246
-
247
- it('connect → disconnect → connect-again does not throw', () => {
248
- const host = mountHost('div', { 'data-view-transition-name': 'a' });
249
- const inst1 = connectTrait(viewTransition, host);
250
- inst1.disconnect(host);
251
- expect(() => {
252
- const inst2 = connectTrait(viewTransition, host);
253
- inst2.disconnect(host);
254
- }).not.toThrow();
255
- });
256
-
257
- it('two parallel hosts each get their own startTransition', () => {
258
- const a = mountHost();
259
- const b = mountHost();
260
- const instA = connectTrait(viewTransition, a);
261
- const instB = connectTrait(viewTransition, b);
262
- expect(typeof a.startTransition).toBe('function');
263
- expect(typeof b.startTransition).toBe('function');
264
- expect(a.startTransition).not.toBe(b.startTransition);
265
- instA.disconnect(a);
266
- instB.disconnect(b);
267
- });
268
- });