@aceshooting/lyra-ui 1.2.0 → 2.1.0

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 (384) hide show
  1. package/README.md +98 -14
  2. package/custom-elements.json +30279 -12124
  3. package/dist/components/app-rail/app-rail-item.d.ts +30 -0
  4. package/dist/components/app-rail/app-rail-item.js +68 -0
  5. package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
  6. package/dist/components/app-rail/app-rail-item.styles.js +65 -0
  7. package/dist/components/app-rail/app-rail.d.ts +168 -0
  8. package/dist/components/app-rail/app-rail.js +419 -0
  9. package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
  10. package/dist/components/app-rail/app-rail.styles.js +128 -0
  11. package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
  12. package/dist/components/attachment-chip/attachment-chip.js +356 -0
  13. package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
  14. package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
  15. package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
  16. package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
  17. package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
  18. package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
  19. package/dist/components/chart/bar-chart.js +2 -18
  20. package/dist/components/chart/box-plot.d.ts +25 -1
  21. package/dist/components/chart/box-plot.js +147 -7
  22. package/dist/components/chart/box-plot.styles.js +13 -0
  23. package/dist/components/chart/bubble-chart.js +2 -18
  24. package/dist/components/chart/chart-loader.d.ts +44 -13
  25. package/dist/components/chart/chart-loader.js +65 -18
  26. package/dist/components/chart/chart.d.ts +55 -12
  27. package/dist/components/chart/chart.js +247 -49
  28. package/dist/components/chart/doughnut-chart.js +2 -18
  29. package/dist/components/chart/histogram-bin.d.ts +7 -1
  30. package/dist/components/chart/histogram-bin.js +32 -14
  31. package/dist/components/chart/histogram.js +8 -16
  32. package/dist/components/chart/line-chart.js +2 -18
  33. package/dist/components/chart/lite-chart.d.ts +134 -3
  34. package/dist/components/chart/lite-chart.js +382 -67
  35. package/dist/components/chart/lite-chart.styles.js +9 -0
  36. package/dist/components/chart/pie-chart.js +2 -18
  37. package/dist/components/chart/polar-area-chart.js +2 -18
  38. package/dist/components/chart/radar-chart.js +2 -18
  39. package/dist/components/chart/scatter-chart.js +2 -18
  40. package/dist/components/chat-composer/chat-composer.d.ts +133 -0
  41. package/dist/components/chat-composer/chat-composer.js +366 -0
  42. package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
  43. package/dist/components/chat-composer/chat-composer.styles.js +145 -0
  44. package/dist/components/chat-message/chat-message.d.ts +141 -0
  45. package/dist/components/chat-message/chat-message.js +331 -0
  46. package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
  47. package/dist/components/chat-message/chat-message.styles.js +203 -0
  48. package/dist/components/checkbox/checkbox.d.ts +117 -0
  49. package/dist/components/checkbox/checkbox.js +353 -0
  50. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  51. package/dist/components/checkbox/checkbox.styles.js +77 -0
  52. package/dist/components/chip/chip-group.d.ts +56 -0
  53. package/dist/components/chip/chip-group.js +130 -0
  54. package/dist/components/chip/chip-group.styles.d.ts +1 -0
  55. package/dist/components/chip/chip-group.styles.js +57 -0
  56. package/dist/components/chip/chip.d.ts +64 -0
  57. package/dist/components/chip/chip.js +122 -0
  58. package/dist/components/chip/chip.styles.d.ts +1 -0
  59. package/dist/components/chip/chip.styles.js +115 -0
  60. package/dist/components/citation-badge/citation-badge.d.ts +113 -0
  61. package/dist/components/citation-badge/citation-badge.js +318 -0
  62. package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
  63. package/dist/components/citation-badge/citation-badge.styles.js +96 -0
  64. package/dist/components/code-block/code-block.d.ts +127 -0
  65. package/dist/components/code-block/code-block.js +382 -0
  66. package/dist/components/code-block/code-block.styles.d.ts +1 -0
  67. package/dist/components/code-block/code-block.styles.js +187 -0
  68. package/dist/components/code-block/code-loader.d.ts +87 -0
  69. package/dist/components/code-block/code-loader.js +142 -0
  70. package/dist/components/combobox/combobox.d.ts +65 -6
  71. package/dist/components/combobox/combobox.js +258 -48
  72. package/dist/components/combobox/combobox.styles.js +3 -3
  73. package/dist/components/combobox/option.d.ts +5 -1
  74. package/dist/components/combobox/option.js +35 -0
  75. package/dist/components/context-meter/context-meter.d.ts +53 -0
  76. package/dist/components/context-meter/context-meter.js +159 -0
  77. package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
  78. package/dist/components/context-meter/context-meter.styles.js +114 -0
  79. package/dist/components/conversation-item/conversation-item.d.ts +125 -0
  80. package/dist/components/conversation-item/conversation-item.js +331 -0
  81. package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
  82. package/dist/components/conversation-item/conversation-item.styles.js +155 -0
  83. package/dist/components/date-picker/calendar-core.d.ts +24 -0
  84. package/dist/components/date-picker/calendar-core.js +51 -4
  85. package/dist/components/date-picker/date-input.d.ts +100 -9
  86. package/dist/components/date-picker/date-input.js +383 -66
  87. package/dist/components/date-picker/date-picker.d.ts +35 -4
  88. package/dist/components/date-picker/date-picker.js +171 -44
  89. package/dist/components/dialog/confirm.d.ts +40 -0
  90. package/dist/components/dialog/confirm.js +76 -0
  91. package/dist/components/dialog/dialog.d.ts +129 -0
  92. package/dist/components/dialog/dialog.js +288 -0
  93. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  94. package/dist/components/dialog/dialog.styles.js +96 -0
  95. package/dist/components/dock-panel/dock-panel.d.ts +142 -0
  96. package/dist/components/dock-panel/dock-panel.js +359 -0
  97. package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
  98. package/dist/components/dock-panel/dock-panel.styles.js +159 -0
  99. package/dist/components/document-preview/document-preview.d.ts +143 -0
  100. package/dist/components/document-preview/document-preview.js +388 -0
  101. package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
  102. package/dist/components/document-preview/document-preview.styles.js +191 -0
  103. package/dist/components/empty/empty.d.ts +1 -2
  104. package/dist/components/empty/empty.js +18 -12
  105. package/dist/components/empty/empty.styles.js +0 -3
  106. package/dist/components/export-button/csv.js +1 -1
  107. package/dist/components/export-button/export-button.d.ts +12 -0
  108. package/dist/components/export-button/export-button.js +35 -5
  109. package/dist/components/export-button/export-button.styles.js +5 -1
  110. package/dist/components/file-input/accept.js +2 -0
  111. package/dist/components/file-input/file-input.d.ts +10 -1
  112. package/dist/components/file-input/file-input.js +36 -5
  113. package/dist/components/flag/flag.d.ts +29 -13
  114. package/dist/components/flag/flag.js +54 -14
  115. package/dist/components/flag/flag.styles.js +1 -1
  116. package/dist/components/flag/language-map.d.ts +4 -1
  117. package/dist/components/flag/language-map.js +6 -3
  118. package/dist/components/gauge/gauge.d.ts +10 -1
  119. package/dist/components/gauge/gauge.js +41 -13
  120. package/dist/components/generation-status/generation-status.d.ts +117 -0
  121. package/dist/components/generation-status/generation-status.js +327 -0
  122. package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
  123. package/dist/components/generation-status/generation-status.styles.js +84 -0
  124. package/dist/components/graph/graph.d.ts +37 -3
  125. package/dist/components/graph/graph.js +132 -20
  126. package/dist/components/heatmap/calendar-grid.d.ts +19 -7
  127. package/dist/components/heatmap/calendar-grid.js +42 -18
  128. package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
  129. package/dist/components/heatmap/heatmap-scale.js +14 -2
  130. package/dist/components/heatmap/heatmap.d.ts +227 -12
  131. package/dist/components/heatmap/heatmap.js +488 -93
  132. package/dist/components/json-viewer/json-viewer.d.ts +70 -0
  133. package/dist/components/json-viewer/json-viewer.js +361 -0
  134. package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
  135. package/dist/components/json-viewer/json-viewer.styles.js +177 -0
  136. package/dist/components/kbd/kbd.d.ts +77 -0
  137. package/dist/components/kbd/kbd.js +231 -0
  138. package/dist/components/kbd/kbd.styles.d.ts +1 -0
  139. package/dist/components/kbd/kbd.styles.js +52 -0
  140. package/dist/components/live-region/live-region.d.ts +90 -0
  141. package/dist/components/live-region/live-region.js +189 -0
  142. package/dist/components/live-region/live-region.styles.d.ts +1 -0
  143. package/dist/components/live-region/live-region.styles.js +10 -0
  144. package/dist/components/map/map.d.ts +32 -7
  145. package/dist/components/map/map.js +133 -32
  146. package/dist/components/markdown/markdown-loader.d.ts +58 -0
  147. package/dist/components/markdown/markdown-loader.js +77 -0
  148. package/dist/components/markdown/markdown.d.ts +119 -0
  149. package/dist/components/markdown/markdown.js +389 -0
  150. package/dist/components/markdown/markdown.styles.d.ts +1 -0
  151. package/dist/components/markdown/markdown.styles.js +88 -0
  152. package/dist/components/media-card/media-card.d.ts +130 -0
  153. package/dist/components/media-card/media-card.js +273 -0
  154. package/dist/components/media-card/media-card.styles.d.ts +1 -0
  155. package/dist/components/media-card/media-card.styles.js +132 -0
  156. package/dist/components/mention-popover/mention-popover.d.ts +203 -0
  157. package/dist/components/mention-popover/mention-popover.js +493 -0
  158. package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
  159. package/dist/components/mention-popover/mention-popover.styles.js +101 -0
  160. package/dist/components/menu/menu-item.d.ts +91 -0
  161. package/dist/components/menu/menu-item.js +206 -0
  162. package/dist/components/menu/menu-item.styles.d.ts +1 -0
  163. package/dist/components/menu/menu-item.styles.js +75 -0
  164. package/dist/components/menu/menu.d.ts +167 -0
  165. package/dist/components/menu/menu.js +461 -0
  166. package/dist/components/menu/menu.styles.d.ts +1 -0
  167. package/dist/components/menu/menu.styles.js +67 -0
  168. package/dist/components/model-select/model-select.d.ts +170 -0
  169. package/dist/components/model-select/model-select.js +588 -0
  170. package/dist/components/model-select/model-select.styles.d.ts +1 -0
  171. package/dist/components/model-select/model-select.styles.js +203 -0
  172. package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
  173. package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
  174. package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
  175. package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
  176. package/dist/components/playback/playback.d.ts +19 -3
  177. package/dist/components/playback/playback.js +109 -33
  178. package/dist/components/playback/playback.styles.js +6 -1
  179. package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
  180. package/dist/components/responsive-panel/responsive-panel.js +363 -0
  181. package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
  182. package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
  183. package/dist/components/result-card/result-card.d.ts +50 -0
  184. package/dist/components/result-card/result-card.js +89 -0
  185. package/dist/components/result-card/result-card.styles.d.ts +1 -0
  186. package/dist/components/result-card/result-card.styles.js +49 -0
  187. package/dist/components/result-card/result-field.d.ts +36 -0
  188. package/dist/components/result-card/result-field.js +87 -0
  189. package/dist/components/result-card/result-field.styles.d.ts +1 -0
  190. package/dist/components/result-card/result-field.styles.js +32 -0
  191. package/dist/components/select/select.d.ts +84 -4
  192. package/dist/components/select/select.js +251 -36
  193. package/dist/components/skeleton/skeleton.d.ts +3 -0
  194. package/dist/components/skeleton/skeleton.js +7 -1
  195. package/dist/components/skeleton/skeleton.styles.js +5 -4
  196. package/dist/components/slider/slider.d.ts +141 -0
  197. package/dist/components/slider/slider.js +467 -0
  198. package/dist/components/slider/slider.styles.d.ts +1 -0
  199. package/dist/components/slider/slider.styles.js +87 -0
  200. package/dist/components/source-card/source-card.d.ts +104 -0
  201. package/dist/components/source-card/source-card.js +195 -0
  202. package/dist/components/source-card/source-card.styles.d.ts +1 -0
  203. package/dist/components/source-card/source-card.styles.js +69 -0
  204. package/dist/components/source-list/source-list.d.ts +63 -0
  205. package/dist/components/source-list/source-list.js +130 -0
  206. package/dist/components/source-list/source-list.styles.d.ts +1 -0
  207. package/dist/components/source-list/source-list.styles.js +59 -0
  208. package/dist/components/sparkline/sparkline.js +58 -20
  209. package/dist/components/split/split.d.ts +224 -5
  210. package/dist/components/split/split.js +617 -43
  211. package/dist/components/split/split.styles.js +47 -0
  212. package/dist/components/stat/stat.d.ts +15 -4
  213. package/dist/components/stat/stat.js +53 -12
  214. package/dist/components/stream-status/stream-status.d.ts +126 -0
  215. package/dist/components/stream-status/stream-status.js +292 -0
  216. package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
  217. package/dist/components/stream-status/stream-status.styles.js +103 -0
  218. package/dist/components/streaming-text/streaming-text.d.ts +104 -0
  219. package/dist/components/streaming-text/streaming-text.js +224 -0
  220. package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
  221. package/dist/components/streaming-text/streaming-text.styles.js +63 -0
  222. package/dist/components/switch/switch.d.ts +103 -0
  223. package/dist/components/switch/switch.js +250 -0
  224. package/dist/components/switch/switch.styles.d.ts +1 -0
  225. package/dist/components/switch/switch.styles.js +75 -0
  226. package/dist/components/table/table.d.ts +89 -5
  227. package/dist/components/table/table.js +243 -26
  228. package/dist/components/table/table.styles.js +6 -1
  229. package/dist/components/tabs/tabs.d.ts +74 -0
  230. package/dist/components/tabs/tabs.js +254 -0
  231. package/dist/components/tabs/tabs.styles.d.ts +1 -0
  232. package/dist/components/tabs/tabs.styles.js +74 -0
  233. package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
  234. package/dist/components/thinking-panel/thinking-panel.js +260 -0
  235. package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
  236. package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
  237. package/dist/components/time-range/time-range.d.ts +59 -2
  238. package/dist/components/time-range/time-range.js +163 -67
  239. package/dist/components/toast/toast-item.d.ts +12 -2
  240. package/dist/components/toast/toast-item.js +106 -44
  241. package/dist/components/toast/toast-item.styles.js +59 -28
  242. package/dist/components/toast/toast.js +17 -5
  243. package/dist/components/toast/toaster.js +10 -1
  244. package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
  245. package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
  246. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
  247. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
  248. package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
  249. package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
  250. package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
  251. package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
  252. package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
  253. package/dist/components/tool-param-form/tool-param-form.js +610 -0
  254. package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
  255. package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
  256. package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
  257. package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
  258. package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
  259. package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
  260. package/dist/components/tool-result-view/registry.d.ts +73 -0
  261. package/dist/components/tool-result-view/registry.js +89 -0
  262. package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
  263. package/dist/components/tool-result-view/tool-result-view.js +152 -0
  264. package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
  265. package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
  266. package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
  267. package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
  268. package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
  269. package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
  270. package/dist/components/tree/tree-node.d.ts +15 -3
  271. package/dist/components/tree/tree-node.js +20 -7
  272. package/dist/components/tree/tree.d.ts +25 -10
  273. package/dist/components/tree/tree.js +39 -31
  274. package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
  275. package/dist/components/typing-indicator/typing-indicator.js +108 -0
  276. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
  277. package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
  278. package/dist/components/virtual-list/virtual-list.d.ts +210 -0
  279. package/dist/components/virtual-list/virtual-list.js +607 -0
  280. package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
  281. package/dist/components/virtual-list/virtual-list.styles.js +56 -0
  282. package/dist/components/widget/widget.d.ts +5 -4
  283. package/dist/components/widget/widget.js +54 -120
  284. package/dist/components/widget/widget.styles.js +8 -2
  285. package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
  286. package/dist/components/word-cloud/word-cloud-layout.js +29 -2
  287. package/dist/components/word-cloud/word-cloud.d.ts +28 -2
  288. package/dist/components/word-cloud/word-cloud.js +69 -19
  289. package/dist/components/word-cloud/word-cloud.styles.js +16 -3
  290. package/dist/internal/anchored-validity.d.ts +1 -0
  291. package/dist/internal/anchored-validity.js +86 -0
  292. package/dist/internal/announcer.d.ts +57 -0
  293. package/dist/internal/announcer.js +71 -0
  294. package/dist/internal/form-associated.d.ts +8 -0
  295. package/dist/internal/form-associated.js +98 -15
  296. package/dist/internal/group-by-recency.d.ts +50 -0
  297. package/dist/internal/group-by-recency.js +80 -0
  298. package/dist/internal/numbers.d.ts +12 -0
  299. package/dist/internal/numbers.js +26 -0
  300. package/dist/internal/overlay-manager.d.ts +51 -0
  301. package/dist/internal/overlay-manager.js +523 -0
  302. package/dist/internal/positioner.js +27 -3
  303. package/dist/internal/rtl.d.ts +23 -0
  304. package/dist/internal/rtl.js +28 -0
  305. package/dist/internal/safe-url.d.ts +12 -0
  306. package/dist/internal/safe-url.js +41 -0
  307. package/dist/internal/scroll-lock.d.ts +10 -5
  308. package/dist/internal/scroll-lock.js +30 -14
  309. package/dist/internal/tokens.styles.js +22 -10
  310. package/dist/lyra.d.ts +133 -31
  311. package/dist/lyra.js +96 -26
  312. package/llms-full.txt +4546 -183
  313. package/llms.txt +21 -5
  314. package/package.json +41 -6
  315. package/dist/components/chart/bar-chart.stories.d.ts +0 -5
  316. package/dist/components/chart/bar-chart.stories.js +0 -20
  317. package/dist/components/chart/box-plot.stories.d.ts +0 -5
  318. package/dist/components/chart/box-plot.stories.js +0 -29
  319. package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
  320. package/dist/components/chart/bubble-chart.stories.js +0 -26
  321. package/dist/components/chart/chart.stories.d.ts +0 -32
  322. package/dist/components/chart/chart.stories.js +0 -141
  323. package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
  324. package/dist/components/chart/doughnut-chart.stories.js +0 -26
  325. package/dist/components/chart/histogram.stories.d.ts +0 -5
  326. package/dist/components/chart/histogram.stories.js +0 -17
  327. package/dist/components/chart/line-chart.stories.d.ts +0 -22
  328. package/dist/components/chart/line-chart.stories.js +0 -99
  329. package/dist/components/chart/lite-chart.stories.d.ts +0 -14
  330. package/dist/components/chart/lite-chart.stories.js +0 -114
  331. package/dist/components/chart/pie-chart.stories.d.ts +0 -5
  332. package/dist/components/chart/pie-chart.stories.js +0 -26
  333. package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
  334. package/dist/components/chart/polar-area-chart.stories.js +0 -20
  335. package/dist/components/chart/radar-chart.stories.d.ts +0 -5
  336. package/dist/components/chart/radar-chart.stories.js +0 -20
  337. package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
  338. package/dist/components/chart/scatter-chart.stories.js +0 -31
  339. package/dist/components/combobox/combobox.stories.d.ts +0 -24
  340. package/dist/components/combobox/combobox.stories.js +0 -102
  341. package/dist/components/date-picker/date-input.stories.d.ts +0 -10
  342. package/dist/components/date-picker/date-input.stories.js +0 -48
  343. package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
  344. package/dist/components/date-picker/date-picker.stories.js +0 -25
  345. package/dist/components/empty/empty.stories.d.ts +0 -7
  346. package/dist/components/empty/empty.stories.js +0 -34
  347. package/dist/components/export-button/export-button.stories.d.ts +0 -7
  348. package/dist/components/export-button/export-button.stories.js +0 -37
  349. package/dist/components/file-input/file-input.stories.d.ts +0 -7
  350. package/dist/components/file-input/file-input.stories.js +0 -19
  351. package/dist/components/flag/flag.stories.d.ts +0 -6
  352. package/dist/components/flag/flag.stories.js +0 -31
  353. package/dist/components/gauge/gauge.stories.d.ts +0 -8
  354. package/dist/components/gauge/gauge.stories.js +0 -19
  355. package/dist/components/graph/graph.stories.d.ts +0 -8
  356. package/dist/components/graph/graph.stories.js +0 -68
  357. package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
  358. package/dist/components/heatmap/heatmap.stories.js +0 -179
  359. package/dist/components/map/map.stories.d.ts +0 -15
  360. package/dist/components/map/map.stories.js +0 -135
  361. package/dist/components/playback/playback.stories.d.ts +0 -7
  362. package/dist/components/playback/playback.stories.js +0 -16
  363. package/dist/components/select/select.stories.d.ts +0 -21
  364. package/dist/components/select/select.stories.js +0 -91
  365. package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
  366. package/dist/components/skeleton/skeleton.stories.js +0 -16
  367. package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
  368. package/dist/components/sparkline/sparkline.stories.js +0 -39
  369. package/dist/components/split/split.stories.d.ts +0 -7
  370. package/dist/components/split/split.stories.js +0 -36
  371. package/dist/components/stat/stat.stories.d.ts +0 -9
  372. package/dist/components/stat/stat.stories.js +0 -81
  373. package/dist/components/table/table.stories.d.ts +0 -12
  374. package/dist/components/table/table.stories.js +0 -67
  375. package/dist/components/time-range/time-range.stories.d.ts +0 -8
  376. package/dist/components/time-range/time-range.stories.js +0 -26
  377. package/dist/components/toast/toast.stories.d.ts +0 -8
  378. package/dist/components/toast/toast.stories.js +0 -72
  379. package/dist/components/tree/tree.stories.d.ts +0 -9
  380. package/dist/components/tree/tree.stories.js +0 -52
  381. package/dist/components/widget/widget.stories.d.ts +0 -9
  382. package/dist/components/widget/widget.stories.js +0 -74
  383. package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
  384. package/dist/components/word-cloud/word-cloud.stories.js +0 -55
@@ -0,0 +1,610 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, nothing } from 'lit';
8
+ import { state } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { nextId } from '../../internal/a11y.js';
12
+ import { AnchoredValidityController, resolveValidityAnchor, VALIDITY_ANCHOR, } from '../../internal/anchored-validity.js';
13
+ import { styles } from './tool-param-form.styles.js';
14
+ import '../select/select.js';
15
+ import '../combobox/option.js';
16
+ import '../checkbox/checkbox.js';
17
+ const EMPTY_SCHEMA = { type: 'object', properties: {} };
18
+ /**
19
+ * `<lyra-tool-param-form>` — renders one form control per top-level property
20
+ * of a JSON Schema object, for ad hoc tool invocation or approval-editing UIs
21
+ * (e.g. "the agent wants to call `create_event(title, attendees, allDay)` —
22
+ * let the user tweak the arguments before running it").
23
+ *
24
+ * **Scope limitation (intentional, not accidental):** this phase only
25
+ * understands a *flat* object schema — every `properties` entry must be
26
+ * `'string'`, `'number'`, `'integer'`, `'boolean'`, or a string `enum`;
27
+ * primitive `const` is also enforced. Nested objects, arrays,
28
+ * `oneOf`/`anyOf`/`allOf`, `$ref`, constraints such as `minLength`/`minimum`,
29
+ * and schema-valued `additionalProperties` are not read. A full
30
+ * JSON-Schema-to-form renderer is
31
+ * out of scope for this component; a property whose `type` isn't one of the
32
+ * four above renders a visible "Unsupported field type" note and marks the
33
+ * form invalid instead of silently dropping it or throwing.
34
+ *
35
+ * Fields render in `Object.keys(schema.properties)` order (insertion order,
36
+ * which is reliable for a plain object's string keys). A field's label is
37
+ * `title ?? ` the property key; `description` renders as helper text below
38
+ * the control; a key listed in `required` gets a visible `*`. The outer
39
+ * component owns validation because JSON Schema `required` means property
40
+ * presence, unlike HTML controls' nonempty/must-check semantics.
41
+ *
42
+ * This component owns no Submit/Cancel/Approve chrome — a consumer composes
43
+ * it inside their own dialog (e.g. a tool-approval dialog) and reads
44
+ * `.value`/`.errors`/`checkValidity()` (or calls `reportValidity()` right
45
+ * before acting, which also reveals any inline errors that user interaction
46
+ * hasn't surfaced yet).
47
+ *
48
+ * `value` is exactly what the consumer last set it to — a field with no
49
+ * entry in `value` but a schema `default` displays (and is *emitted*, via
50
+ * `lyra-input`) as that default, but the `value` *property* itself is left
51
+ * alone until the user actually edits that field. This mirrors an
52
+ * uncontrolled `<input placeholder>` not writing to `.value`, and means the
53
+ * very first `lyra-input` a consumer receives already carries every default
54
+ * resolved, so round-tripping `e.detail.value` back into `.value` converges
55
+ * after one edit. JSON Schema defines `default` as an annotation; this form
56
+ * renderer deliberately materializes it before validation and submission,
57
+ * so a valid default can satisfy `required` here.
58
+ *
59
+ * Optional native `<form>` participation is implemented via `ElementInternals`
60
+ * attached directly (this component's value is a whole object, not a plain
61
+ * string, so the `FormAssociated` string-value mixin doesn't fit — same
62
+ * shape as `<lyra-combobox>`'s array-valued case). This is a nice-to-have
63
+ * layered on top of the primary integration contract (`value` +
64
+ * `lyra-input`/`lyra-validity-change`), not a requirement: a consumer that
65
+ * never puts this inside a `<form>` loses nothing.
66
+ *
67
+ * @customElement lyra-tool-param-form
68
+ * @event lyra-input - A field's value changed. `detail: { value }` — the
69
+ * full current value object (every property, defaults resolved), not just
70
+ * the field that changed.
71
+ * @event lyra-validity-change - Overall validity or field errors changed.
72
+ * `detail: { valid: boolean; errors: Record<string, string> }`.
73
+ * @csspart base - The outer wrapper around all fields.
74
+ * @csspart field - One property's wrapper (label + control + description + error).
75
+ * @csspart label - A field's label.
76
+ * @csspart description - A field's helper text, from `schema.description`.
77
+ * @csspart error - A field-level or form-level validation message.
78
+ */
79
+ export class LyraToolParamForm extends LyraElement {
80
+ static { this.formAssociated = true; }
81
+ static { this.styles = [LyraElement.styles, styles]; }
82
+ static { this.properties = {
83
+ name: { reflect: true, noAccessor: true },
84
+ schema: { attribute: false, noAccessor: true },
85
+ value: { attribute: false, noAccessor: true },
86
+ disabled: { type: Boolean, reflect: true, noAccessor: true },
87
+ }; }
88
+ constructor() {
89
+ super();
90
+ // The true (touched-independent) per-field error set, recomputed by the
91
+ // synchronous schema/value accessors so native validity APIs and the next
92
+ // render observe the same state. Exposed publicly (read-only) via the
93
+ // `errors` getter below, under a leading underscore so the getter itself
94
+ // can be named plain `errors` without a collision.
95
+ this._errors = {};
96
+ this._formError = '';
97
+ this.showFormError = false;
98
+ // Which fields have been visited (focusout'd) at least once — gates only
99
+ // the *visual* error/aria-invalid presentation, matching every other
100
+ // form control in this library (lyra-select/lyra-combobox/lyra-model-select
101
+ // all avoid flashing red before the user has touched anything).
102
+ this.touchedFields = new Set();
103
+ this.baseId = nextId('tool-param-form');
104
+ this._fieldsetDisabled = false;
105
+ this._name = '';
106
+ this._schema = EMPTY_SCHEMA;
107
+ this._value = {};
108
+ this._effectiveValue = {};
109
+ this._validityFlags = {};
110
+ this._disabled = false;
111
+ this.internals = this.attachInternals();
112
+ this.validityController = new AnchoredValidityController(this, this.internals, () => this[VALIDITY_ANCHOR]());
113
+ this.syncFormState();
114
+ }
115
+ get form() {
116
+ return this.internals.form;
117
+ }
118
+ get labels() {
119
+ return this.internals.labels;
120
+ }
121
+ get validity() {
122
+ return this.internals.validity;
123
+ }
124
+ get validationMessage() {
125
+ return this.internals.validationMessage;
126
+ }
127
+ get willValidate() {
128
+ return this.internals.willValidate;
129
+ }
130
+ /** @internal */
131
+ [VALIDITY_ANCHOR]() {
132
+ const field = this.firstInvalidField();
133
+ if (!field)
134
+ return undefined;
135
+ const input = field.querySelector('input.control');
136
+ if (input)
137
+ return input;
138
+ for (const child of field.children) {
139
+ const anchor = resolveValidityAnchor(child);
140
+ if (anchor)
141
+ return anchor;
142
+ }
143
+ return undefined;
144
+ }
145
+ firstInvalidField() {
146
+ const firstInvalidKey = Object.keys(this._errors)[0];
147
+ if (!firstInvalidKey || !this.renderRoot)
148
+ return undefined;
149
+ return Array.from(this.renderRoot.querySelectorAll('[part="field"]')).find((candidate) => candidate.dataset.key === firstInvalidKey);
150
+ }
151
+ connectedCallback() {
152
+ super.connectedCallback();
153
+ // Seed `errors`/`internals` validity synchronously at connect time —
154
+ // `checkValidity()`/a wrapping `<form>`'s own `reportValidity()` must
155
+ // see the correct answer even if called before Lit's first (async)
156
+ // update has run, mirroring lyra-select's/lyra-checkbox's identical
157
+ // connectedCallback -> updateValidity() call.
158
+ this.syncFormState();
159
+ }
160
+ /** `value`, with any property missing from it filled in from `schema`'s own `default` — see the class doc. */
161
+ get effectiveValue() {
162
+ return { ...this._effectiveValue };
163
+ }
164
+ get schemaProperties() {
165
+ const properties = this.schema?.properties;
166
+ return properties !== null && typeof properties === 'object' && !Array.isArray(properties)
167
+ ? properties
168
+ : {};
169
+ }
170
+ get requiredKeys() {
171
+ const required = this.schema?.required;
172
+ return Array.isArray(required) ? required.filter((key) => typeof key === 'string') : [];
173
+ }
174
+ resolveEffectiveValue() {
175
+ const props = this.schemaProperties;
176
+ const out = { ...this.value };
177
+ for (const key of Object.keys(props)) {
178
+ // `hasOwnProperty`, not `out[key] === undefined` — a number field the
179
+ // user has explicitly cleared is `{ days: undefined }` (a real own
180
+ // property, via the `{...this.value, [key]: val}` spread in
181
+ // setFieldValue()), and must stay cleared rather than silently
182
+ // snapping back to its default just because its current value also
183
+ // happens to be `undefined`. Only a key genuinely absent from `value`
184
+ // (never touched, or reset back to `{}`) falls back to the default.
185
+ if (!Object.prototype.hasOwnProperty.call(this.value, key) && props[key].default !== undefined) {
186
+ Object.defineProperty(out, key, {
187
+ configurable: true,
188
+ enumerable: true,
189
+ writable: true,
190
+ value: props[key].default,
191
+ });
192
+ }
193
+ }
194
+ return out;
195
+ }
196
+ get schema() {
197
+ return this._schema;
198
+ }
199
+ set schema(next) {
200
+ const old = this._schema;
201
+ this._schema = next ?? EMPTY_SCHEMA;
202
+ this.syncFormState();
203
+ this.requestUpdate('schema', old);
204
+ }
205
+ get value() {
206
+ return this._value;
207
+ }
208
+ set value(next) {
209
+ const old = this._value;
210
+ this._value = next ?? {};
211
+ this.syncFormState();
212
+ this.requestUpdate('value', old);
213
+ }
214
+ /** Submission key for the optional native `<form>` participation, reflected synchronously. */
215
+ get name() {
216
+ return this._name;
217
+ }
218
+ set name(next) {
219
+ const old = this._name;
220
+ this._name = next ?? '';
221
+ if (this._name) {
222
+ this.setAttribute('name', this._name);
223
+ }
224
+ else {
225
+ this.removeAttribute('name');
226
+ }
227
+ this.requestUpdate('name', old);
228
+ }
229
+ get disabled() {
230
+ return this._disabled;
231
+ }
232
+ set disabled(next) {
233
+ const old = this._disabled;
234
+ this._disabled = Boolean(next);
235
+ this.toggleAttribute('disabled', this._disabled);
236
+ this.requestUpdate('disabled', old);
237
+ }
238
+ /** Whether the form is disabled explicitly or by an ancestor fieldset. */
239
+ get effectiveDisabled() {
240
+ return this.disabled || this._fieldsetDisabled;
241
+ }
242
+ /**
243
+ * The current per-field validation errors (`{ [propertyKey]: message }`) —
244
+ * required presence, primitive type, integer, enum, const, or unsupported
245
+ * type — mirrors the last `lyra-validity-change` event's `errors`.
246
+ * Independent of which fields have been visited; a consumer wanting the
247
+ * visited-only, screen-reader-announced subset should read the rendered
248
+ * `[part="error"]` elements instead.
249
+ */
250
+ get errors() {
251
+ return { ...this._errors };
252
+ }
253
+ /** A schema-wide or JSON-serialization error that cannot be assigned to one field. */
254
+ get formError() {
255
+ return this._formError;
256
+ }
257
+ /**
258
+ * Computes the supported flat JSON Schema subset against the exact value
259
+ * that will be submitted. Defaults are already materialized in `effective`.
260
+ */
261
+ computeValidation(effective) {
262
+ const props = this.schemaProperties;
263
+ const required = new Set(this.requiredKeys);
264
+ const out = {};
265
+ const flags = {};
266
+ const addError = (key, message) => {
267
+ Object.defineProperty(out, key, {
268
+ configurable: true,
269
+ enumerable: true,
270
+ writable: true,
271
+ value: message,
272
+ });
273
+ };
274
+ for (const key of Object.keys(props)) {
275
+ const prop = props[key];
276
+ const type = prop?.type;
277
+ if (type !== 'string' && type !== 'number' && type !== 'integer' && type !== 'boolean') {
278
+ addError(key, `Unsupported field type "${String(type)}".`);
279
+ flags.customError = true;
280
+ continue;
281
+ }
282
+ const present = Object.prototype.hasOwnProperty.call(effective, key) && effective[key] !== undefined;
283
+ if (!present) {
284
+ if (required.has(key)) {
285
+ addError(key, 'This field is required.');
286
+ flags.valueMissing = true;
287
+ }
288
+ continue;
289
+ }
290
+ const v = effective[key];
291
+ if (type === 'string' && typeof v !== 'string') {
292
+ addError(key, 'Must be a string.');
293
+ flags.typeMismatch = true;
294
+ continue;
295
+ }
296
+ if (type === 'number' && (typeof v !== 'number' || !Number.isFinite(v))) {
297
+ addError(key, 'Must be a finite number.');
298
+ flags.typeMismatch = true;
299
+ continue;
300
+ }
301
+ if (type === 'integer' && (typeof v !== 'number' || !Number.isFinite(v))) {
302
+ addError(key, 'Must be a whole number.');
303
+ flags.typeMismatch = true;
304
+ continue;
305
+ }
306
+ if (type === 'integer' && !Number.isInteger(v)) {
307
+ addError(key, 'Must be a whole number.');
308
+ flags.stepMismatch = true;
309
+ continue;
310
+ }
311
+ if (type === 'boolean' && typeof v !== 'boolean') {
312
+ addError(key, 'Must be a boolean.');
313
+ flags.typeMismatch = true;
314
+ continue;
315
+ }
316
+ if (type === 'string' && Array.isArray(prop.enum) && !prop.enum.includes(v)) {
317
+ addError(key, `Must be one of: ${prop.enum.join(', ')}.`);
318
+ flags.customError = true;
319
+ continue;
320
+ }
321
+ if (prop.const !== undefined && v !== prop.const) {
322
+ addError(key, `Must equal ${JSON.stringify(prop.const)}.`);
323
+ flags.customError = true;
324
+ }
325
+ }
326
+ for (const key of required) {
327
+ if (Object.prototype.hasOwnProperty.call(props, key))
328
+ continue;
329
+ if (!Object.prototype.hasOwnProperty.call(effective, key) || effective[key] === undefined) {
330
+ addError(key, 'This field is required.');
331
+ flags.valueMissing = true;
332
+ }
333
+ }
334
+ return { errors: out, flags };
335
+ }
336
+ /** Resynchronizes validity without revealing inline errors. */
337
+ checkValidity() {
338
+ this.syncFormState();
339
+ return this.internals.checkValidity();
340
+ }
341
+ /**
342
+ * Reveals every current field/root error (as if each field had been
343
+ * visited) and returns overall validity — the hook a
344
+ * consumer's own Submit/Approve button should call right before acting,
345
+ * mirroring a native `<form>`'s `reportValidity()`.
346
+ */
347
+ reportValidity() {
348
+ this.syncFormState();
349
+ if (Object.keys(this._errors).length > 0) {
350
+ this.touchedFields = new Set([...this.touchedFields, ...Object.keys(this._errors)]);
351
+ }
352
+ if (this._formError)
353
+ this.showFormError = true;
354
+ return this.internals.reportValidity();
355
+ }
356
+ formResetCallback() {
357
+ this.value = {};
358
+ this.touchedFields = new Set();
359
+ this.showFormError = false;
360
+ }
361
+ formStateRestoreCallback(state, _mode) {
362
+ let restored = {};
363
+ if (typeof state === 'string') {
364
+ try {
365
+ const parsed = JSON.parse(state);
366
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
367
+ restored = parsed;
368
+ }
369
+ }
370
+ catch {
371
+ // Invalid persisted state restores the safe empty object.
372
+ }
373
+ }
374
+ this.value = restored;
375
+ }
376
+ formDisabledCallback(disabled) {
377
+ this._fieldsetDisabled = disabled;
378
+ this.requestUpdate();
379
+ }
380
+ schemaShapeError() {
381
+ const schema = this.schema;
382
+ if (schema === null || typeof schema !== 'object' || schema.type !== 'object') {
383
+ return 'Schema must describe an object.';
384
+ }
385
+ const properties = schema.properties;
386
+ if (properties === null || typeof properties !== 'object' || Array.isArray(properties)) {
387
+ return 'Schema properties must be a flat object.';
388
+ }
389
+ return '';
390
+ }
391
+ serializeEffectiveValue(effective) {
392
+ const serialized = JSON.stringify(effective, (_key, value) => {
393
+ if (typeof value === 'number' && !Number.isFinite(value)) {
394
+ throw new TypeError('Non-finite numbers are not JSON values.');
395
+ }
396
+ return value;
397
+ });
398
+ if (typeof serialized !== 'string')
399
+ throw new TypeError('Value did not serialize to JSON.');
400
+ return serialized;
401
+ }
402
+ /** Pushes the already-computed snapshot into `ElementInternals`. */
403
+ syncInternals(formValue) {
404
+ this.internals.setFormValue(formValue, formValue);
405
+ if (Object.keys(this._validityFlags).length === 0) {
406
+ this.validityController.setValidity({});
407
+ }
408
+ else {
409
+ const firstMessage = Object.values(this._errors)[0] ?? this._formError ?? 'The value is invalid.';
410
+ this.validityController.setValidity(this._validityFlags, firstMessage);
411
+ }
412
+ }
413
+ syncFormState() {
414
+ let effective = {};
415
+ let errors = {};
416
+ let flags = {};
417
+ let formError = '';
418
+ let formValue = null;
419
+ try {
420
+ formError = this.schemaShapeError();
421
+ effective = this.resolveEffectiveValue();
422
+ const validation = this.computeValidation(effective);
423
+ errors = validation.errors;
424
+ flags = validation.flags;
425
+ formValue = this.serializeEffectiveValue(effective);
426
+ }
427
+ catch {
428
+ formError = 'Value must be JSON-serializable.';
429
+ formValue = null;
430
+ }
431
+ if (formError) {
432
+ flags.customError = true;
433
+ formValue = null;
434
+ }
435
+ this._effectiveValue = effective;
436
+ if (JSON.stringify(this._errors) !== JSON.stringify(errors))
437
+ this._errors = errors;
438
+ this._formError = formError;
439
+ this._validityFlags = flags;
440
+ this.syncInternals(formValue);
441
+ }
442
+ updated(changed) {
443
+ if (changed.has('value') || changed.has('schema') || changed.has('_errors') || changed.has('_formError')) {
444
+ const valid = Object.keys(this._errors).length === 0 && this._formError === '';
445
+ const key = JSON.stringify({ valid, errors: this._errors, formError: this._formError });
446
+ if (key !== this.lastValidityKey) {
447
+ this.lastValidityKey = key;
448
+ this.emit('lyra-validity-change', { valid, errors: { ...this._errors } });
449
+ }
450
+ const nestedUpdates = Array.from(this.firstInvalidField()?.children ?? [])
451
+ .filter((element) => typeof element[VALIDITY_ANCHOR] === 'function')
452
+ .map((element) => element.updateComplete)
453
+ .filter((update) => update !== undefined);
454
+ if (nestedUpdates.length > 0) {
455
+ void Promise.all(nestedUpdates).then(() => this.validityController.refreshAnchor());
456
+ }
457
+ }
458
+ }
459
+ setFieldValue(key, val) {
460
+ if (this.effectiveDisabled)
461
+ return;
462
+ this.value = { ...this.value, [key]: val };
463
+ this.emit('lyra-input', { value: this.effectiveValue });
464
+ }
465
+ markTouched(key) {
466
+ if (this.touchedFields.has(key))
467
+ return;
468
+ this.touchedFields = new Set(this.touchedFields).add(key);
469
+ }
470
+ onTextInput(key, e) {
471
+ this.setFieldValue(key, e.target.value);
472
+ }
473
+ onNumberInput(key, e) {
474
+ const raw = e.target;
475
+ const n = raw.valueAsNumber;
476
+ this.setFieldValue(key, Number.isNaN(n) ? undefined : n);
477
+ }
478
+ onSelectChange(key, e) {
479
+ this.setFieldValue(key, e.target.value);
480
+ }
481
+ onCheckboxChange(key, e) {
482
+ this.setFieldValue(key, e.detail.checked);
483
+ }
484
+ renderControl(key, prop, fieldId, label, required, describedBy, errorMessage, effective) {
485
+ if (prop.type === 'string' && prop.enum && prop.enum.length > 0) {
486
+ // <lyra-select>/<lyra-checkbox> don't forward a host-level
487
+ // aria-describedby to their internal focusable element (neither
488
+ // reads it — and this component doesn't own either file to add that),
489
+ // so a plain aria-describedby here would silently do nothing for
490
+ // assistive tech. Fold the error into aria-label instead, which both
491
+ // select.ts and checkbox.ts *do* read from the host and thread
492
+ // through -- the description text still reads fine from its adjacent,
493
+ // DOM-order-following <p part="description"> even without a formal
494
+ // aria-describedby association.
495
+ return html `<lyra-select
496
+ id=${fieldId}
497
+ aria-label=${errorMessage ? `${label}. ${errorMessage}` : label}
498
+ aria-required=${required ? 'true' : nothing}
499
+ .value=${typeof effective === 'string' ? effective : ''}
500
+ ?disabled=${this.effectiveDisabled}
501
+ @change=${(e) => this.onSelectChange(key, e)}
502
+ >
503
+ ${prop.enum.map((v) => html `<lyra-option value=${v}>${v}</lyra-option>`)}
504
+ </lyra-select>`;
505
+ }
506
+ if (prop.type === 'string') {
507
+ return html `<input
508
+ class="control"
509
+ type="text"
510
+ id=${fieldId}
511
+ aria-describedby=${describedBy || nothing}
512
+ aria-required=${required ? 'true' : nothing}
513
+ aria-invalid=${errorMessage ? 'true' : nothing}
514
+ .value=${typeof effective === 'string' ? effective : ''}
515
+ ?disabled=${this.effectiveDisabled}
516
+ @input=${(e) => this.onTextInput(key, e)}
517
+ />`;
518
+ }
519
+ if (prop.type === 'number' || prop.type === 'integer') {
520
+ const numValue = typeof effective === 'number' && !Number.isNaN(effective) ? String(effective) : '';
521
+ return html `<input
522
+ class="control"
523
+ type="number"
524
+ id=${fieldId}
525
+ step=${prop.type === 'integer' ? '1' : 'any'}
526
+ aria-describedby=${describedBy || nothing}
527
+ aria-required=${required ? 'true' : nothing}
528
+ aria-invalid=${errorMessage ? 'true' : nothing}
529
+ .value=${numValue}
530
+ ?disabled=${this.effectiveDisabled}
531
+ @input=${(e) => this.onNumberInput(key, e)}
532
+ />`;
533
+ }
534
+ if (prop.type === 'boolean') {
535
+ // The label lives inside the slot rather than as a sibling <label> --
536
+ // that slot *is* lyra-checkbox's documented way to give it an
537
+ // accessible name (see checkbox.ts's own @slot doc), and unlike
538
+ // aria-describedby, this genuinely works since it's real slotted
539
+ // content, not an inert host attribute. Once there's an error, fold it
540
+ // into aria-label the same way the enum/select branch above does --
541
+ // an explicit aria-label overrides the slotted accessible name, so the
542
+ // normal (no error) case is left alone to keep deriving its name from
543
+ // the slot per lyra-checkbox's own documented contract.
544
+ return html `<lyra-checkbox
545
+ id=${fieldId}
546
+ aria-label=${errorMessage ? `${label}. ${errorMessage}` : nothing}
547
+ ?checked=${effective === true}
548
+ ?disabled=${this.effectiveDisabled}
549
+ @lyra-change=${(e) => this.onCheckboxChange(key, e)}
550
+ >
551
+ <span part="label">${label}</span>
552
+ </lyra-checkbox>`;
553
+ }
554
+ // Defensive fallback for a schema property outside this phase's scope
555
+ // (see the class doc) — render a visible note instead of silently
556
+ // dropping the field or throwing. Still carries id=fieldId like every
557
+ // other control-slot render, since renderField's shared, non-boolean
558
+ // branch above always renders a <label for=fieldId> pointing at it.
559
+ return html `<p class="unsupported" id=${fieldId}>Unsupported field type "${prop.type}".</p>`;
560
+ }
561
+ renderField(key, prop, index) {
562
+ const required = this.requiredKeys.includes(key);
563
+ const label = prop.title ?? key;
564
+ const fieldId = `${this.baseId}-f${index}`;
565
+ const descId = prop.description ? `${fieldId}-desc` : '';
566
+ const errId = this._errors[key] ? `${fieldId}-err` : '';
567
+ const describedBy = [descId, this.touchedFields.has(key) ? errId : ''].filter(Boolean).join(' ');
568
+ const hasError = this.touchedFields.has(key) && Boolean(this._errors[key]);
569
+ const errorMessage = hasError ? this._errors[key] : '';
570
+ const effective = this._effectiveValue[key];
571
+ const isBoolean = prop.type === 'boolean';
572
+ return html `
573
+ <div part="field" class="field" data-key=${key} data-type=${prop.type} ?data-required=${required}
574
+ @focusout=${() => this.markTouched(key)}
575
+ >
576
+ ${isBoolean
577
+ ? nothing
578
+ : html `<label part="label" for=${fieldId}>${label}</label>`}
579
+ ${this.renderControl(key, prop, fieldId, label, required, describedBy, errorMessage, effective)}
580
+ ${prop.description
581
+ ? html `<p part="description" id=${descId}>${prop.description}</p>`
582
+ : nothing}
583
+ ${hasError ? html `<p part="error" id=${errId} role="alert">${this._errors[key]}</p>` : nothing}
584
+ </div>
585
+ `;
586
+ }
587
+ render() {
588
+ const props = this.schemaProperties;
589
+ const keys = Object.keys(props);
590
+ return html `<div part="base">
591
+ ${keys.map((key, i) => this.renderField(key, props[key], i))}
592
+ ${this.showFormError && this._formError
593
+ ? html `<p part="error" class="form-error" role="alert">${this._formError}</p>`
594
+ : nothing}
595
+ </div>`;
596
+ }
597
+ }
598
+ __decorate([
599
+ state()
600
+ ], LyraToolParamForm.prototype, "_errors", void 0);
601
+ __decorate([
602
+ state()
603
+ ], LyraToolParamForm.prototype, "_formError", void 0);
604
+ __decorate([
605
+ state()
606
+ ], LyraToolParamForm.prototype, "showFormError", void 0);
607
+ __decorate([
608
+ state()
609
+ ], LyraToolParamForm.prototype, "touchedFields", void 0);
610
+ defineElement('tool-param-form', LyraToolParamForm);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,75 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: block;
5
+ }
6
+ [part='base'] {
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: var(--lyra-space-l);
10
+ }
11
+ [part='field'] {
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: flex-start;
15
+ gap: var(--lyra-space-xs);
16
+ }
17
+ [part='label'] {
18
+ display: block;
19
+ font-size: 0.875rem;
20
+ font-weight: 600;
21
+ }
22
+ /* Applies to a boolean field's slotted <span part="label"> (inside
23
+ <lyra-checkbox>) too -- see tool-param-form.ts's class doc for why that
24
+ span still belongs to *this* component's shadow tree for CSS purposes
25
+ even though it's visually projected into a child element's template. */
26
+ [part='field'][data-required] [part='label']::after {
27
+ content: ' *';
28
+ color: var(--lyra-color-danger);
29
+ }
30
+
31
+ [part='field'] > lyra-select,
32
+ [part='field'] > input.control {
33
+ inline-size: 100%;
34
+ }
35
+
36
+ input.control {
37
+ box-sizing: border-box;
38
+ min-block-size: 2.5rem;
39
+ padding: var(--lyra-space-xs) var(--lyra-space-s);
40
+ border: 1px solid var(--lyra-color-border);
41
+ border-radius: var(--lyra-radius);
42
+ background: var(--lyra-color-surface);
43
+ color: inherit;
44
+ font: inherit;
45
+ font-size: 1rem;
46
+ }
47
+ input.control:focus-visible {
48
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
49
+ outline-offset: var(--lyra-focus-ring-offset);
50
+ }
51
+ input.control[aria-invalid='true'] {
52
+ border-color: var(--lyra-color-danger);
53
+ }
54
+ input.control:disabled {
55
+ opacity: var(--lyra-opacity-disabled);
56
+ cursor: not-allowed;
57
+ }
58
+
59
+ [part='description'] {
60
+ margin: 0;
61
+ font-size: 0.8125rem;
62
+ color: var(--lyra-color-text-quiet);
63
+ }
64
+ [part='error'] {
65
+ margin: 0;
66
+ font-size: 0.8125rem;
67
+ color: var(--lyra-color-danger);
68
+ }
69
+ .unsupported {
70
+ margin: 0;
71
+ font-size: 0.8125rem;
72
+ font-style: italic;
73
+ color: var(--lyra-color-text-quiet);
74
+ }
75
+ `;