@adia-ai/web-components 0.4.7 → 0.4.9

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 (236) hide show
  1. package/README.md +39 -0
  2. package/USAGE.md +255 -2
  3. package/components/accordion/accordion.a2ui.json +3 -0
  4. package/components/accordion/accordion.d.ts +12 -2
  5. package/components/accordion/accordion.yaml +4 -0
  6. package/components/action-list/action-list.a2ui.json +18 -1
  7. package/components/action-list/action-list.d.ts +21 -2
  8. package/components/action-list/action-list.yaml +14 -0
  9. package/components/agent-artifact/agent-artifact.a2ui.json +11 -1
  10. package/components/agent-artifact/agent-artifact.d.ts +17 -2
  11. package/components/agent-artifact/agent-artifact.yaml +9 -0
  12. package/components/agent-feedback-bar/agent-feedback-bar.a2ui.json +10 -1
  13. package/components/agent-feedback-bar/agent-feedback-bar.d.ts +19 -2
  14. package/components/agent-feedback-bar/agent-feedback-bar.yaml +8 -0
  15. package/components/agent-questions/agent-questions.a2ui.json +14 -1
  16. package/components/agent-questions/agent-questions.d.ts +19 -2
  17. package/components/agent-questions/agent-questions.yaml +11 -0
  18. package/components/agent-reasoning/agent-reasoning.a2ui.json +29 -3
  19. package/components/agent-reasoning/agent-reasoning.d.ts +33 -2
  20. package/components/agent-reasoning/agent-reasoning.yaml +20 -0
  21. package/components/agent-suggestions/agent-suggestions.a2ui.json +18 -1
  22. package/components/agent-suggestions/agent-suggestions.d.ts +21 -2
  23. package/components/agent-suggestions/agent-suggestions.yaml +14 -0
  24. package/components/agent-trace/agent-trace.a2ui.json +8 -1
  25. package/components/agent-trace/agent-trace.d.ts +17 -2
  26. package/components/agent-trace/agent-trace.yaml +4 -0
  27. package/components/alert/alert.a2ui.json +1 -0
  28. package/components/alert/alert.d.ts +12 -2
  29. package/components/aside/aside.a2ui.json +1 -0
  30. package/components/avatar/avatar.a2ui.json +3 -0
  31. package/components/avatar/avatar.d.ts +3 -2
  32. package/components/avatar/avatar.yaml +4 -0
  33. package/components/badge/badge.a2ui.json +3 -0
  34. package/components/badge/badge.d.ts +3 -2
  35. package/components/badge/badge.yaml +4 -0
  36. package/components/block/block.a2ui.json +1 -0
  37. package/components/block/block.d.ts +3 -2
  38. package/components/breadcrumb/breadcrumb.a2ui.json +5 -0
  39. package/components/breadcrumb/breadcrumb.d.ts +3 -2
  40. package/components/breadcrumb/breadcrumb.yaml +6 -0
  41. package/components/button/button.a2ui.json +3 -0
  42. package/components/button/button.d.ts +12 -2
  43. package/components/button/button.yaml +5 -0
  44. package/components/calendar-picker/calendar-picker.a2ui.json +1 -0
  45. package/components/canvas/canvas.a2ui.json +1 -0
  46. package/components/canvas/canvas.d.ts +18 -2
  47. package/components/canvas/canvas.yaml +12 -0
  48. package/components/card/card.a2ui.json +1 -0
  49. package/components/card/card.d.ts +12 -2
  50. package/components/chart/chart.a2ui.json +4 -0
  51. package/components/chart/chart.d.ts +18 -2
  52. package/components/chart/chart.yaml +5 -0
  53. package/components/chart-legend/chart-legend.a2ui.json +19 -1
  54. package/components/chart-legend/chart-legend.d.ts +21 -2
  55. package/components/chart-legend/chart-legend.yaml +15 -0
  56. package/components/chat-thread/chat-thread.a2ui.json +12 -1
  57. package/components/chat-thread/chat-thread.d.ts +19 -2
  58. package/components/chat-thread/chat-thread.yaml +7 -0
  59. package/components/check/check.a2ui.json +1 -0
  60. package/components/code/code.a2ui.json +37 -7
  61. package/components/code/code.d.ts +30 -0
  62. package/components/code/code.yaml +29 -6
  63. package/components/col/col.a2ui.json +1 -0
  64. package/components/col/col.d.ts +3 -2
  65. package/components/color-picker/class.js +59 -1
  66. package/components/color-picker/color-picker.a2ui.json +37 -0
  67. package/components/color-picker/color-picker.d.ts +70 -8
  68. package/components/color-picker/color-picker.yaml +53 -0
  69. package/components/command/command.a2ui.json +12 -1
  70. package/components/command/command.d.ts +21 -2
  71. package/components/command/command.yaml +7 -0
  72. package/components/demo-toggle/demo-toggle.a2ui.json +8 -1
  73. package/components/demo-toggle/demo-toggle.d.ts +17 -2
  74. package/components/demo-toggle/demo-toggle.yaml +4 -0
  75. package/components/description-list/description-list.a2ui.json +1 -0
  76. package/components/description-list/description-list.d.ts +3 -2
  77. package/components/divider/divider.a2ui.json +1 -0
  78. package/components/divider/divider.d.ts +3 -2
  79. package/components/drawer/drawer.a2ui.json +1 -0
  80. package/components/drawer/drawer.d.ts +12 -2
  81. package/components/embed/embed.a2ui.json +1 -0
  82. package/components/embed/embed.d.ts +3 -2
  83. package/components/empty-state/empty-state.a2ui.json +3 -0
  84. package/components/empty-state/empty-state.d.ts +3 -2
  85. package/components/empty-state/empty-state.yaml +4 -0
  86. package/components/feed/feed.a2ui.json +9 -1
  87. package/components/feed/feed.d.ts +12 -2
  88. package/components/feed/feed.yaml +8 -1
  89. package/components/field/field.a2ui.json +1 -0
  90. package/components/field/field.d.ts +3 -2
  91. package/components/fields/fields.a2ui.json +1 -0
  92. package/components/fields/fields.d.ts +3 -2
  93. package/components/footer/footer.a2ui.json +1 -0
  94. package/components/grid/grid.a2ui.json +1 -0
  95. package/components/grid/grid.d.ts +3 -2
  96. package/components/header/header.a2ui.json +1 -0
  97. package/components/heatmap/heatmap.a2ui.json +12 -2
  98. package/components/heatmap/heatmap.d.ts +20 -2
  99. package/components/heatmap/heatmap.yaml +17 -2
  100. package/components/icon/icon.a2ui.json +1 -0
  101. package/components/icon/icon.d.ts +3 -2
  102. package/components/image/image.a2ui.json +3 -0
  103. package/components/image/image.d.ts +3 -2
  104. package/components/image/image.yaml +4 -0
  105. package/components/index.js +8 -0
  106. package/components/input/input.a2ui.json +4 -0
  107. package/components/input/input.yaml +6 -0
  108. package/components/inspector/inspector.a2ui.json +5 -0
  109. package/components/inspector/inspector.d.ts +3 -2
  110. package/components/inspector/inspector.yaml +6 -0
  111. package/components/kbd/kbd.a2ui.json +1 -0
  112. package/components/kbd/kbd.d.ts +3 -2
  113. package/components/link/link.a2ui.json +12 -1
  114. package/components/link/link.d.ts +19 -2
  115. package/components/link/link.yaml +7 -0
  116. package/components/list/list.a2ui.json +14 -1
  117. package/components/list/list.d.ts +19 -2
  118. package/components/list/list.yaml +11 -0
  119. package/components/menu/menu.a2ui.json +14 -1
  120. package/components/menu/menu.d.ts +19 -2
  121. package/components/menu/menu.yaml +11 -0
  122. package/components/modal/modal.a2ui.json +1 -0
  123. package/components/modal/modal.d.ts +12 -2
  124. package/components/nav/nav.a2ui.json +16 -1
  125. package/components/nav/nav.d.ts +21 -2
  126. package/components/nav/nav.yaml +10 -0
  127. package/components/nav-group/nav-group.a2ui.json +12 -1
  128. package/components/nav-group/nav-group.d.ts +19 -2
  129. package/components/nav-group/nav-group.yaml +7 -0
  130. package/components/nav-item/nav-item.a2ui.json +16 -1
  131. package/components/nav-item/nav-item.d.ts +21 -2
  132. package/components/nav-item/nav-item.yaml +10 -0
  133. package/components/noodles/noodles.a2ui.json +47 -2
  134. package/components/noodles/noodles.d.ts +42 -2
  135. package/components/noodles/noodles.yaml +32 -0
  136. package/components/option-card/option-card.a2ui.json +3 -0
  137. package/components/option-card/option-card.yaml +4 -0
  138. package/components/otp-input/otp-input.a2ui.json +15 -2
  139. package/components/otp-input/otp-input.d.ts +11 -0
  140. package/components/otp-input/otp-input.yaml +10 -2
  141. package/components/page/page.a2ui.json +1 -0
  142. package/components/page/page.d.ts +3 -2
  143. package/components/pagination/pagination.a2ui.json +8 -1
  144. package/components/pagination/pagination.d.ts +17 -2
  145. package/components/pagination/pagination.yaml +4 -0
  146. package/components/pane/pane.a2ui.json +8 -1
  147. package/components/pane/pane.d.ts +12 -2
  148. package/components/pane/pane.yaml +7 -1
  149. package/components/pipeline-status/pipeline-status.a2ui.json +1 -0
  150. package/components/pipeline-status/pipeline-status.d.ts +3 -2
  151. package/components/popover/popover.a2ui.json +1 -0
  152. package/components/popover/popover.d.ts +3 -2
  153. package/components/progress/progress.a2ui.json +1 -0
  154. package/components/progress/progress.d.ts +3 -2
  155. package/components/progress-row/progress-row.a2ui.json +3 -0
  156. package/components/progress-row/progress-row.d.ts +3 -2
  157. package/components/progress-row/progress-row.yaml +4 -0
  158. package/components/radio/radio.a2ui.json +1 -0
  159. package/components/range/range.a2ui.json +1 -0
  160. package/components/rating/rating.a2ui.json +1 -0
  161. package/components/richtext/richtext.a2ui.json +1 -0
  162. package/components/richtext/richtext.d.ts +3 -2
  163. package/components/row/row.a2ui.json +1 -0
  164. package/components/row/row.d.ts +12 -2
  165. package/components/search/search.a2ui.json +1 -0
  166. package/components/section/section.a2ui.json +1 -0
  167. package/components/segment/segment.a2ui.json +3 -0
  168. package/components/segment/segment.d.ts +3 -2
  169. package/components/segment/segment.yaml +4 -0
  170. package/components/segmented/segmented.a2ui.json +1 -0
  171. package/components/select/select.a2ui.json +3 -0
  172. package/components/select/select.yaml +4 -0
  173. package/components/skeleton/skeleton.a2ui.json +1 -0
  174. package/components/skeleton/skeleton.d.ts +3 -2
  175. package/components/slider/slider.a2ui.json +1 -0
  176. package/components/stack/stack.a2ui.json +1 -0
  177. package/components/stack/stack.d.ts +3 -2
  178. package/components/stat/stat.a2ui.json +1 -0
  179. package/components/step-progress/step-progress.a2ui.json +1 -0
  180. package/components/step-progress/step-progress.d.ts +3 -2
  181. package/components/stepper/stepper.a2ui.json +3 -0
  182. package/components/stepper/stepper.d.ts +3 -2
  183. package/components/stepper/stepper.yaml +4 -0
  184. package/components/stream/stream.a2ui.json +8 -1
  185. package/components/stream/stream.d.ts +21 -2
  186. package/components/stream/stream.yaml +4 -0
  187. package/components/swatch/class.js +362 -15
  188. package/components/swatch/swatch.a2ui.json +69 -1
  189. package/components/swatch/swatch.css +150 -0
  190. package/components/swatch/swatch.d.ts +46 -2
  191. package/components/swatch/swatch.yaml +67 -1
  192. package/components/swiper/swiper.a2ui.json +21 -2
  193. package/components/swiper/swiper.d.ts +28 -2
  194. package/components/swiper/swiper.yaml +15 -0
  195. package/components/switch/switch.a2ui.json +1 -0
  196. package/components/table/table.a2ui.json +87 -5
  197. package/components/table/table.d.ts +73 -2
  198. package/components/table/table.yaml +62 -2
  199. package/components/table-toolbar/table-toolbar.a2ui.json +12 -0
  200. package/components/table-toolbar/table-toolbar.d.ts +18 -2
  201. package/components/table-toolbar/table-toolbar.yaml +13 -0
  202. package/components/tabs/tabs.a2ui.json +10 -1
  203. package/components/tabs/tabs.d.ts +17 -2
  204. package/components/tabs/tabs.yaml +8 -0
  205. package/components/tag/tag.a2ui.json +12 -1
  206. package/components/tag/tag.d.ts +19 -2
  207. package/components/tag/tag.yaml +7 -0
  208. package/components/text/text.a2ui.json +1 -0
  209. package/components/text/text.d.ts +3 -2
  210. package/components/textarea/textarea.a2ui.json +1 -0
  211. package/components/timeline/timeline.a2ui.json +14 -1
  212. package/components/timeline/timeline.d.ts +17 -2
  213. package/components/timeline/timeline.yaml +11 -1
  214. package/components/toast/toast.a2ui.json +1 -0
  215. package/components/toast/toast.d.ts +12 -2
  216. package/components/toggle-group/toggle-group.a2ui.json +8 -1
  217. package/components/toggle-group/toggle-group.d.ts +17 -2
  218. package/components/toggle-group/toggle-group.yaml +4 -0
  219. package/components/toggle-scheme/toggle-scheme.a2ui.json +14 -1
  220. package/components/toggle-scheme/toggle-scheme.d.ts +19 -2
  221. package/components/toggle-scheme/toggle-scheme.yaml +11 -0
  222. package/components/toolbar/toolbar.a2ui.json +3 -0
  223. package/components/toolbar/toolbar.d.ts +3 -2
  224. package/components/toolbar/toolbar.yaml +4 -0
  225. package/components/tooltip/tooltip.a2ui.json +1 -0
  226. package/components/tooltip/tooltip.d.ts +3 -2
  227. package/components/tree/tree.a2ui.json +18 -1
  228. package/components/tree/tree.d.ts +21 -2
  229. package/components/tree/tree.yaml +14 -0
  230. package/components/upload/upload.a2ui.json +1 -0
  231. package/core/icons-phosphor.js +93 -0
  232. package/core/icons.js +92 -90
  233. package/core/index.js +5 -0
  234. package/index.d.ts +87 -79
  235. package/index.js +7 -0
  236. package/package.json +3 -2
@@ -5,6 +5,18 @@ component: Canvas
5
5
  category: agent
6
6
  version: 1
7
7
  description: A2UI rendering surface.
8
+ # Per ADR-0027 — primitives that programmatically create other primitives
9
+ # do NOT auto-import them. Consumer (or demo shell) must explicitly import.
10
+ # <canvas-ui> composes only cross-package primitives (a2ui-root + theme-ui);
11
+ # they're declared in cross_package_composes: below per v0.4.9 §92 G1.
12
+ composes: []
13
+ cross_package_composes:
14
+ - tag: a2ui-root
15
+ from: '@adia-ai/web-modules/runtime'
16
+ note: Hosts A2UI rendering. Required whenever canvas mounts content.
17
+ - tag: theme-ui
18
+ from: '@adia-ai/web-modules/theme'
19
+ note: Optional — only read when [theme-wrapper] is set.
8
20
  props:
9
21
  theme:
10
22
  description: 'Component property: theme.'
@@ -75,6 +75,7 @@
75
75
  "x-adiaui": {
76
76
  "anti_patterns": [],
77
77
  "category": "container",
78
+ "composes": [],
78
79
  "events": {
79
80
  "drag-end": {
80
81
  "description": "Fired when a drag completes."
@@ -5,12 +5,15 @@
5
5
  *
6
6
  * Type declarations generated by scripts/build/dts-codegen.mjs from
7
7
  * the component's `.a2ui.json` sidecar. Edit the source `.yaml`,
8
- * run `npm run components`, then `npm run codegen:dts` to regenerate;
9
- * or hand-author this file fully if rich event types are needed.
8
+ * run `npm run build:components`, then `npm run codegen:dts` to
9
+ * regenerate; or hand-author this file fully if rich event types are
10
+ * needed beyond what the yaml `events:` block can express.
10
11
  */
11
12
 
12
13
  import { UIElement } from '../../core/element.js';
13
14
 
15
+ export type CardDragEndEvent = CustomEvent<unknown>;
16
+
14
17
  export class UICard extends UIElement {
15
18
  /** Enables drag handle + cursor:grab. Wires the draggable trait; dispatches drag-end. */
16
19
  draggable: boolean;
@@ -24,4 +27,11 @@ export class UICard extends UIElement {
24
27
  size: 'sm' | 'md' | 'lg';
25
28
  /** Visual style. `outline` is an alias for `outlined`; `flat` removes shadow; `soft`/`primary` apply tinted surfaces. */
26
29
  variant: 'default' | 'outlined' | 'outline' | 'filled' | 'ghost' | 'flat' | 'soft' | 'primary';
30
+
31
+ addEventListener<K extends keyof HTMLElementEventMap>(
32
+ type: K,
33
+ listener: (this: UICard, ev: HTMLElementEventMap[K]) => unknown,
34
+ options?: boolean | AddEventListenerOptions,
35
+ ): void;
36
+ addEventListener(type: 'drag-end', listener: (ev: CardDragEndEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
27
37
  }
@@ -133,6 +133,7 @@
133
133
  "x-adiaui": {
134
134
  "anti_patterns": [],
135
135
  "category": "agent",
136
+ "composes": [],
136
137
  "events": {
137
138
  "chart-hover": {
138
139
  "description": "Fires when the pointer enters a datum (bar / dot / slice). Detail includes {label, value, pct, series, slot, pointerX, pointerY}. Only re-fires when the hovered datum changes — moving inside the same datum is quiet."
@@ -142,6 +143,9 @@
142
143
  },
143
144
  "chart-select": {
144
145
  "description": "Fires on click of a datum with the same detail shape as chart-hover."
146
+ },
147
+ "legend-update": {
148
+ "description": "Fires when the chart's internal legend payload regenerates (datum\nlabel/value re-aggregate). Signal-only — no detail payload.\nUsed by chart-legend-ui to mirror state when wired via [for].\n"
145
149
  }
146
150
  },
147
151
  "examples": [
@@ -5,12 +5,18 @@
5
5
  *
6
6
  * Type declarations generated by scripts/build/dts-codegen.mjs from
7
7
  * the component's `.a2ui.json` sidecar. Edit the source `.yaml`,
8
- * run `npm run components`, then `npm run codegen:dts` to regenerate;
9
- * or hand-author this file fully if rich event types are needed.
8
+ * run `npm run build:components`, then `npm run codegen:dts` to
9
+ * regenerate; or hand-author this file fully if rich event types are
10
+ * needed beyond what the yaml `events:` block can express.
10
11
  */
11
12
 
12
13
  import { UIElement } from '../../core/element.js';
13
14
 
15
+ export type ChartHoverEvent = CustomEvent<unknown>;
16
+ export type ChartLeaveEvent = CustomEvent<unknown>;
17
+ export type ChartSelectEvent = CustomEvent<unknown>;
18
+ export type ChartLegendUpdateEvent = CustomEvent<unknown>;
19
+
14
20
  export class UIChart extends UIElement {
15
21
  /** Chart type. All 18 enum values have dedicated render paths in chart.js. */
16
22
  type: 'bar' | 'line' | 'pie' | 'donut' | 'radar' | 'sparkline' | 'segments' | 'area' | 'scatter' | 'radial-bar' | 'gauge' | 'stacked-bar' | 'grouped-bar' | 'multi-line' | 'funnel' | 'treemap' | 'sankey' | 'composed';
@@ -38,4 +44,14 @@ export class UIChart extends UIElement {
38
44
  x: string;
39
45
  /** Y-axis key(s), comma-separated for multi-series */
40
46
  y: string;
47
+
48
+ addEventListener<K extends keyof HTMLElementEventMap>(
49
+ type: K,
50
+ listener: (this: UIChart, ev: HTMLElementEventMap[K]) => unknown,
51
+ options?: boolean | AddEventListenerOptions,
52
+ ): void;
53
+ addEventListener(type: 'chart-hover', listener: (ev: ChartHoverEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
54
+ addEventListener(type: 'chart-leave', listener: (ev: ChartLeaveEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
55
+ addEventListener(type: 'chart-select', listener: (ev: ChartSelectEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
56
+ addEventListener(type: 'legend-update', listener: (ev: ChartLegendUpdateEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
41
57
  }
@@ -132,6 +132,11 @@ events:
132
132
  description: Fires when the pointer leaves the plot area or a previously-hovered datum with no new one entering.
133
133
  chart-select:
134
134
  description: Fires on click of a datum with the same detail shape as chart-hover.
135
+ legend-update:
136
+ description: |
137
+ Fires when the chart's internal legend payload regenerates (datum
138
+ label/value re-aggregate). Signal-only — no detail payload.
139
+ Used by chart-legend-ui to mirror state when wired via [for].
135
140
  slots:
136
141
  canvas:
137
142
  description: Chart rendering area
@@ -70,9 +70,27 @@
70
70
  "x-adiaui": {
71
71
  "anti_patterns": [],
72
72
  "category": "agent",
73
+ "composes": [
74
+ "badge-ui",
75
+ "swatch-ui"
76
+ ],
73
77
  "events": {
74
78
  "toggle": {
75
- "description": "Fires on row click (non-static). Detail: {key, active, mode}. `active` is the new state (true=visible). Consumers (or chart-ui via [for]) wire this to series visibility."
79
+ "description": "Fires on row click (non-static). Detail: {key, active, mode}. `active` is the new state (true=visible). Consumers (or chart-ui via [for]) wire this to series visibility.",
80
+ "detail": {
81
+ "active": {
82
+ "description": "New visibility state (true = visible).",
83
+ "type": "boolean"
84
+ },
85
+ "key": {
86
+ "description": "Series key identifier.",
87
+ "type": "string"
88
+ },
89
+ "mode": {
90
+ "description": "Visibility mode (default \"hide\").",
91
+ "type": "string"
92
+ }
93
+ }
76
94
  }
77
95
  },
78
96
  "examples": [
@@ -5,12 +5,24 @@
5
5
  *
6
6
  * Type declarations generated by scripts/build/dts-codegen.mjs from
7
7
  * the component's `.a2ui.json` sidecar. Edit the source `.yaml`,
8
- * run `npm run components`, then `npm run codegen:dts` to regenerate;
9
- * or hand-author this file fully if rich event types are needed.
8
+ * run `npm run build:components`, then `npm run codegen:dts` to
9
+ * regenerate; or hand-author this file fully if rich event types are
10
+ * needed beyond what the yaml `events:` block can express.
10
11
  */
11
12
 
12
13
  import { UIElement } from '../../core/element.js';
13
14
 
15
+ export interface ChartLegendToggleEventDetail {
16
+ /** New visibility state (true = visible). */
17
+ active: boolean;
18
+ /** Series key identifier. */
19
+ key: string;
20
+ /** Visibility mode (default "hide"). */
21
+ mode: string;
22
+ }
23
+
24
+ export type ChartLegendToggleEvent = CustomEvent<ChartLegendToggleEventDetail>;
25
+
14
26
  export class UIChartLegend extends UIElement {
15
27
  /** JSON array of {key, label, slot?, pct?} legend items. Takes precedence over [for] when both are provided. */
16
28
  items: string;
@@ -24,4 +36,11 @@ export class UIChartLegend extends UIElement {
24
36
  shape: 'dot' | 'square' | 'line' | 'dashed';
25
37
  /** When set, rows are non-interactive <span>s (no click, no toggle). */
26
38
  static: boolean;
39
+
40
+ addEventListener<K extends keyof HTMLElementEventMap>(
41
+ type: K,
42
+ listener: (this: UIChartLegend, ev: HTMLElementEventMap[K]) => unknown,
43
+ options?: boolean | AddEventListenerOptions,
44
+ ): void;
45
+ addEventListener(type: 'toggle', listener: (ev: ChartLegendToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
27
46
  }
@@ -9,6 +9,11 @@ description: >-
9
9
  badge-ui chips (swatch + label) that are keyboard-focusable and
10
10
  click-toggleable. Composes with chart-ui via [for] id-ref (auto-mirror) or
11
11
  via explicit [items] JSON.
12
+ # Per ADR-0027 — primitives that programmatically create other primitives
13
+ # do NOT auto-import them. Consumer (or demo shell) must explicitly import.
14
+ composes:
15
+ - badge-ui
16
+ - swatch-ui
12
17
  props:
13
18
  for:
14
19
  description: id-ref of a chart-ui / heatmap-ui to mirror series from.
@@ -63,6 +68,16 @@ events:
63
68
  Fires on row click (non-static). Detail: {key, active, mode}. `active` is
64
69
  the new state (true=visible). Consumers (or chart-ui via [for]) wire
65
70
  this to series visibility.
71
+ detail:
72
+ key:
73
+ type: string
74
+ description: Series key identifier.
75
+ active:
76
+ type: boolean
77
+ description: New visibility state (true = visible).
78
+ mode:
79
+ type: string
80
+ description: Visibility mode (default "hide").
66
81
  slots:
67
82
  default:
68
83
  description: >-
@@ -29,9 +29,20 @@
29
29
  "x-adiaui": {
30
30
  "anti_patterns": [],
31
31
  "category": "agent",
32
+ "composes": [],
32
33
  "events": {
33
34
  "submit": {
34
- "description": "Fired when the user submits a chat message via Enter or send button. Detail: { text, model }."
35
+ "description": "Fired when the user submits a chat message via Enter or send button. Detail: { text, model }.",
36
+ "detail": {
37
+ "model": {
38
+ "description": "Selected model identifier.",
39
+ "type": "string"
40
+ },
41
+ "text": {
42
+ "description": "Submitted message text.",
43
+ "type": "string"
44
+ }
45
+ }
35
46
  }
36
47
  },
37
48
  "examples": [
@@ -5,13 +5,30 @@
5
5
  *
6
6
  * Type declarations generated by scripts/build/dts-codegen.mjs from
7
7
  * the component's `.a2ui.json` sidecar. Edit the source `.yaml`,
8
- * run `npm run components`, then `npm run codegen:dts` to regenerate;
9
- * or hand-author this file fully if rich event types are needed.
8
+ * run `npm run build:components`, then `npm run codegen:dts` to
9
+ * regenerate; or hand-author this file fully if rich event types are
10
+ * needed beyond what the yaml `events:` block can express.
10
11
  */
11
12
 
12
13
  import { UIElement } from '../../core/element.js';
13
14
 
15
+ export interface ChatThreadSubmitEventDetail {
16
+ /** Selected model identifier. */
17
+ model: string;
18
+ /** Submitted message text. */
19
+ text: string;
20
+ }
21
+
22
+ export type ChatThreadSubmitEvent = CustomEvent<ChatThreadSubmitEventDetail>;
23
+
14
24
  export class UIChatThread extends UIElement {
15
25
  /** Component property: streaming. */
16
26
  streaming: boolean;
27
+
28
+ addEventListener<K extends keyof HTMLElementEventMap>(
29
+ type: K,
30
+ listener: (this: UIChatThread, ev: HTMLElementEventMap[K]) => unknown,
31
+ options?: boolean | AddEventListenerOptions,
32
+ ): void;
33
+ addEventListener(type: 'submit', listener: (ev: ChatThreadSubmitEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
17
34
  }
@@ -15,6 +15,13 @@ props:
15
15
  events:
16
16
  submit:
17
17
  description: "Fired when the user submits a chat message via Enter or send button. Detail: { text, model }."
18
+ detail:
19
+ text:
20
+ type: string
21
+ description: Submitted message text.
22
+ model:
23
+ type: string
24
+ description: Selected model identifier.
18
25
  slots:
19
26
  default:
20
27
  description: "Default slot — primary child content."
@@ -71,6 +71,7 @@
71
71
  }
72
72
  ],
73
73
  "category": "layout",
74
+ "composes": [],
74
75
  "events": {
75
76
  "change": {
76
77
  "description": "Fired when checked state changes"
@@ -83,21 +83,51 @@
83
83
  "x-adiaui": {
84
84
  "anti_patterns": [],
85
85
  "category": "display",
86
+ "composes": [],
86
87
  "events": {
87
88
  "change": {
88
- "description": "Fired on blur if the buffer changed since focus (editable mode); detail.value is the final buffer"
89
- },
90
- "copy": {
91
- "description": "Fired when text is copied to clipboard"
89
+ "description": "Fired on blur if the buffer changed since focus (editable mode); detail.value is the final buffer.",
90
+ "detail": {
91
+ "value": {
92
+ "description": "Editor contents at blur.",
93
+ "type": "string"
94
+ }
95
+ }
92
96
  },
93
97
  "input": {
94
- "description": "Fired on every doc change (editable mode); detail.value is the current buffer"
98
+ "description": "Fired on every doc change (editable mode); detail.value is the current buffer.",
99
+ "detail": {
100
+ "value": {
101
+ "description": "Current editor contents.",
102
+ "type": "string"
103
+ }
104
+ }
95
105
  },
96
106
  "language-load-error": {
97
- "description": "Fired when the language pack or CodeMirror bundle fails to load; detail.phase is 'core' or 'language'"
107
+ "description": "Fired when CodeMirror's dynamic language-mode or core bundle fails to load.\ndetail.phase is \"core\" (fatal — component falls back to static pre+code) or\n\"language\" (recoverable — editor mounts in plain-text mode).\n",
108
+ "detail": {
109
+ "error": {
110
+ "description": "The underlying load failure.",
111
+ "type": "object"
112
+ },
113
+ "language": {
114
+ "description": "Present when phase is \"language\" — the language slug that failed.",
115
+ "type": "string"
116
+ },
117
+ "phase": {
118
+ "description": "Either \"core\" or \"language\".",
119
+ "type": "string"
120
+ }
121
+ }
98
122
  },
99
123
  "save": {
100
- "description": "Fired on Mod+S keybind (editable mode); detail.value is the current buffer. Cancelable."
124
+ "description": "Fired on Mod+S keybind (editable mode); detail.value is the current buffer. Cancelable — call event.preventDefault() to suppress the host page's save handling.",
125
+ "detail": {
126
+ "value": {
127
+ "description": "Editor contents at the moment of save.",
128
+ "type": "string"
129
+ }
130
+ }
101
131
  }
102
132
  },
103
133
  "examples": [
@@ -12,6 +12,34 @@ export interface CodeChangeEventDetail {
12
12
  export type CodeChangeEvent = CustomEvent<CodeChangeEventDetail>;
13
13
  export type CodeInputEvent = CustomEvent<CodeChangeEventDetail>;
14
14
 
15
+ /**
16
+ * Detail payload for the `save` event — fired when the user invokes the
17
+ * CodeMirror save keybinding (Cmd/Ctrl+S). The event is `cancelable: true`;
18
+ * call `event.preventDefault()` to suppress the host page's save handling.
19
+ */
20
+ export interface CodeSaveEventDetail {
21
+ /** Current editor contents at the moment of save. */
22
+ value: string;
23
+ }
24
+ export type CodeSaveEvent = CustomEvent<CodeSaveEventDetail>;
25
+
26
+ /**
27
+ * Detail payload for the `language-load-error` event — fired when
28
+ * CodeMirror's dynamic language-mode import fails. `phase: "core"`
29
+ * indicates the CodeMirror core bundle itself failed (rare, fatal —
30
+ * the component falls back to a static `<pre><code>`). `phase: "language"`
31
+ * indicates the requested language extension failed (recoverable —
32
+ * editor still mounts in plain-text mode).
33
+ */
34
+ export interface CodeLanguageLoadErrorEventDetail {
35
+ phase: 'core' | 'language';
36
+ /** Present when `phase === 'language'`; the language slug that failed. */
37
+ language?: string;
38
+ /** The underlying load failure. */
39
+ error: unknown;
40
+ }
41
+ export type CodeLanguageLoadErrorEvent = CustomEvent<CodeLanguageLoadErrorEventDetail>;
42
+
15
43
  export class UICode extends UIFormElement {
16
44
  /** CodeMirror language slug — `javascript` / `typescript` / `html` / `css` / `json` / `markdown` / `python` etc. */
17
45
  language: string;
@@ -36,4 +64,6 @@ export class UICode extends UIFormElement {
36
64
  ): void;
37
65
  addEventListener(type: 'change', listener: (ev: CodeChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
38
66
  addEventListener(type: 'input', listener: (ev: CodeInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
67
+ addEventListener(type: 'save', listener: (ev: CodeSaveEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
68
+ addEventListener(type: 'language-load-error', listener: (ev: CodeLanguageLoadErrorEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
39
69
  }
@@ -58,16 +58,39 @@ props:
58
58
  type: boolean
59
59
  default: false
60
60
  events:
61
- copy:
62
- description: Fired when text is copied to clipboard
63
61
  input:
64
- description: Fired on every doc change (editable mode); detail.value is the current buffer
62
+ description: Fired on every doc change (editable mode); detail.value is the current buffer.
63
+ detail:
64
+ value:
65
+ type: string
66
+ description: Current editor contents.
65
67
  change:
66
- description: Fired on blur if the buffer changed since focus (editable mode); detail.value is the final buffer
68
+ description: Fired on blur if the buffer changed since focus (editable mode); detail.value is the final buffer.
69
+ detail:
70
+ value:
71
+ type: string
72
+ description: Editor contents at blur.
67
73
  save:
68
- description: Fired on Mod+S keybind (editable mode); detail.value is the current buffer. Cancelable.
74
+ description: Fired on Mod+S keybind (editable mode); detail.value is the current buffer. Cancelable — call event.preventDefault() to suppress the host page's save handling.
75
+ detail:
76
+ value:
77
+ type: string
78
+ description: Editor contents at the moment of save.
69
79
  language-load-error:
70
- description: Fired when the language pack or CodeMirror bundle fails to load; detail.phase is 'core' or 'language'
80
+ description: |
81
+ Fired when CodeMirror's dynamic language-mode or core bundle fails to load.
82
+ detail.phase is "core" (fatal — component falls back to static pre+code) or
83
+ "language" (recoverable — editor mounts in plain-text mode).
84
+ detail:
85
+ phase:
86
+ type: string
87
+ description: Either "core" or "language".
88
+ language:
89
+ type: string
90
+ description: Present when phase is "language" — the language slug that failed.
91
+ error:
92
+ type: object
93
+ description: The underlying load failure.
71
94
  slots:
72
95
  default:
73
96
  description: Raw text fallback when the text property is not set
@@ -44,6 +44,7 @@
44
44
  "x-adiaui": {
45
45
  "anti_patterns": [],
46
46
  "category": "layout",
47
+ "composes": [],
47
48
  "events": {},
48
49
  "examples": [
49
50
  {
@@ -5,8 +5,9 @@
5
5
  *
6
6
  * Type declarations generated by scripts/build/dts-codegen.mjs from
7
7
  * the component's `.a2ui.json` sidecar. Edit the source `.yaml`,
8
- * run `npm run components`, then `npm run codegen:dts` to regenerate;
9
- * or hand-author this file fully if rich event types are needed.
8
+ * run `npm run build:components`, then `npm run codegen:dts` to
9
+ * regenerate; or hand-author this file fully if rich event types are
10
+ * needed beyond what the yaml `events:` block can express.
10
11
  */
11
12
 
12
13
  import { UIElement } from '../../core/element.js';
@@ -128,9 +128,27 @@ export class UIColorPicker extends UIFormElement {
128
128
  value: { type: String, default: '#3b82f6', reflect: true },
129
129
  format: { type: String, default: 'hex', reflect: true },
130
130
  disabled: { type: Boolean, default: false, reflect: true },
131
+ /**
132
+ * v0.4.9 §99h — generation-constraint props (FEEDBACK-02 #7).
133
+ * When set, the picker clamps OKLCH channels to the consumer's
134
+ * declared bounds before committing. Out-of-bound mutations
135
+ * round-trip to the nearest in-bound equivalent + fire a
136
+ * `constraint-clamp` event with `{ axis, requested, clamped, reason }`
137
+ * so the consumer can surface UX feedback (toast, validity warning,
138
+ * scope-drift indicator). Default values disable the constraint.
139
+ */
140
+ maxChroma: { type: Number, default: Infinity, reflect: true, attribute: 'max-chroma' },
141
+ maxL: { type: Number, default: 1, reflect: true, attribute: 'max-l' },
142
+ minL: { type: Number, default: 0, reflect: true, attribute: 'min-l' },
143
+ /** Maximum allowed hue deviation in degrees from the picker's `baseHue`. NaN = no constraint. */
144
+ hueDriftMax: { type: Number, default: NaN, reflect: true, attribute: 'hue-drift-max' },
145
+ /** Reference hue (degrees) for [hue-drift-max]. NaN = use the value parsed at first commit. */
146
+ baseHue: { type: Number, default: NaN, reflect: true, attribute: 'base-hue' },
131
147
  };
132
148
 
133
149
  #L = 0.6; #C = 0.15; #H = 230;
150
+ /** Cached reference hue for hue-drift constraint. Set on first commit if [base-hue] isn't authored. */
151
+ #resolvedBaseHue = NaN;
134
152
  #bound = false;
135
153
  #dragging = null; // 'area' | 'hue' | null
136
154
  #internalUpdate = false;
@@ -400,9 +418,45 @@ export class UIColorPicker extends UIFormElement {
400
418
  }
401
419
  }
402
420
 
403
- // ── Commit: update value + fire events ──
421
+ // ── Commit: clamp to consumer constraints + gamut-map + update value + fire events ──
404
422
 
405
423
  #commit(eventType) {
424
+ // Apply consumer-declared constraints BEFORE gamut mapping. Each constraint
425
+ // axis records a `constraint-clamp` event-payload entry when it actually
426
+ // moved a value; we dispatch one event per commit so the consumer can
427
+ // surface a single UX response (toast / validity warning / etc.).
428
+ const clamps = [];
429
+ if (this.#L > this.maxL) {
430
+ clamps.push({ axis: 'l', requested: this.#L, clamped: this.maxL, reason: 'max-l' });
431
+ this.#L = this.maxL;
432
+ }
433
+ if (this.#L < this.minL) {
434
+ clamps.push({ axis: 'l', requested: this.#L, clamped: this.minL, reason: 'min-l' });
435
+ this.#L = this.minL;
436
+ }
437
+ if (this.#C > this.maxChroma) {
438
+ clamps.push({ axis: 'c', requested: this.#C, clamped: this.maxChroma, reason: 'max-chroma' });
439
+ this.#C = this.maxChroma;
440
+ }
441
+ if (Number.isFinite(this.hueDriftMax)) {
442
+ const base = Number.isFinite(this.baseHue)
443
+ ? this.baseHue
444
+ : (Number.isFinite(this.#resolvedBaseHue) ? this.#resolvedBaseHue : this.#H);
445
+ if (!Number.isFinite(this.#resolvedBaseHue)) this.#resolvedBaseHue = base;
446
+ // Hue is circular — find the signed shortest-path drift in [-180, 180].
447
+ let drift = ((this.#H - base + 540) % 360) - 180;
448
+ const limit = this.hueDriftMax;
449
+ if (drift > limit) {
450
+ const requestedH = this.#H;
451
+ this.#H = (base + limit + 360) % 360;
452
+ clamps.push({ axis: 'h', requested: requestedH, clamped: this.#H, reason: 'hue-drift-max' });
453
+ } else if (drift < -limit) {
454
+ const requestedH = this.#H;
455
+ this.#H = (base - limit + 360) % 360;
456
+ clamps.push({ axis: 'h', requested: requestedH, clamped: this.#H, reason: 'hue-drift-max' });
457
+ }
458
+ }
459
+
406
460
  const clampedC = gamutMapChroma(this.#L, this.#C, this.#H);
407
461
  const hexVal = oklchToHex(this.#L, clampedC, this.#H);
408
462
  const oklchStr = this.#oklchStr();
@@ -411,6 +465,10 @@ export class UIColorPicker extends UIFormElement {
411
465
  this.value = this.format === 'oklch' ? oklchStr : hexVal;
412
466
  this.syncValue();
413
467
 
468
+ if (clamps.length) {
469
+ this.dispatchEvent(new CustomEvent('constraint-clamp', { bubbles: true, detail: { clamps } }));
470
+ }
471
+
414
472
  const detail = { value: this.value, l: this.#L, c: this.#C, h: this.#H, hex: hexVal, oklch: oklchStr };
415
473
  this.dispatchEvent(new CustomEvent(eventType, { bubbles: true, detail }));
416
474
  }
@@ -13,6 +13,11 @@
13
13
  }
14
14
  ],
15
15
  "properties": {
16
+ "baseHue": {
17
+ "description": "Reference hue (degrees) for the [hue-drift-max] constraint. Default\nNaN — falls back to the picker's hue at first commit so the consumer\ncan pre-seed the picker and constrain drift from that initial value.\n",
18
+ "type": "number",
19
+ "default": "NaN"
20
+ },
16
21
  "component": {
17
22
  "const": "ColorPicker"
18
23
  },
@@ -30,6 +35,26 @@
30
35
  ],
31
36
  "default": "hex"
32
37
  },
38
+ "hueDriftMax": {
39
+ "description": "Generation constraint — maximum allowed signed-shortest-path hue\ndeviation (degrees) from [base-hue] (or the first-committed hue\nif [base-hue] is unset). Default NaN (no constraint). Wrap-aware\nso a drift of 350 degrees resolves as -10.\n",
40
+ "type": "number",
41
+ "default": "NaN"
42
+ },
43
+ "maxChroma": {
44
+ "description": "Generation constraint (v0.4.9 §99h, FEEDBACK-02 #7) — clamp the\nOKLCH chroma channel to at most this value before commit. Out-of-\nbound mutations round-trip to the nearest in-bound equivalent +\nfire `constraint-clamp`. Default Infinity (no constraint).\n",
45
+ "type": "number",
46
+ "default": "Infinity"
47
+ },
48
+ "maxL": {
49
+ "description": "Generation constraint — clamp OKLCH lightness to at most this value (0..1). Default 1 (no constraint).",
50
+ "type": "number",
51
+ "default": 1
52
+ },
53
+ "minL": {
54
+ "description": "Generation constraint — clamp OKLCH lightness to at least this value (0..1). Default 0 (no constraint).",
55
+ "type": "number",
56
+ "default": 0
57
+ },
33
58
  "name": {
34
59
  "description": "Form field name",
35
60
  "type": "string",
@@ -48,10 +73,22 @@
48
73
  "x-adiaui": {
49
74
  "anti_patterns": [],
50
75
  "category": "input",
76
+ "composes": [
77
+ "slider-ui"
78
+ ],
51
79
  "events": {
52
80
  "change": {
53
81
  "description": "Fired on every color change"
54
82
  },
83
+ "constraint-clamp": {
84
+ "description": "Fired immediately before `change` / `input` when one or more\nconsumer-declared constraints (max-chroma / max-l / min-l /\nhue-drift-max) clamped a channel away from the user-requested\nvalue. detail.clamps is an array of axis-specific clamp records.\n",
85
+ "detail": {
86
+ "clamps": {
87
+ "description": "Array of `{ axis, requested, clamped, reason }` objects. axis is\none of \"l\" / \"c\" / \"h\". reason names the triggering constraint\nprop. Empty arrays are never emitted.\n",
88
+ "type": "array"
89
+ }
90
+ }
91
+ },
55
92
  "input": {
56
93
  "description": "Fired during continuous interaction (drag)"
57
94
  }