@aceshooting/lyra-ui 1.1.0 → 2.0.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 (335) hide show
  1. package/README.md +12 -1
  2. package/custom-elements.json +21460 -8489
  3. package/dist/components/app-rail/app-rail.d.ts +171 -0
  4. package/dist/components/app-rail/app-rail.js +483 -0
  5. package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
  6. package/dist/components/app-rail/app-rail.styles.js +125 -0
  7. package/dist/components/attachment-chip/attachment-chip.d.ts +114 -0
  8. package/dist/components/attachment-chip/attachment-chip.js +312 -0
  9. package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
  10. package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
  11. package/dist/components/attachment-trigger/attachment-trigger.d.ts +83 -0
  12. package/dist/components/attachment-trigger/attachment-trigger.js +258 -0
  13. package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
  14. package/dist/components/attachment-trigger/attachment-trigger.styles.js +68 -0
  15. package/dist/components/chart/box-plot.js +11 -1
  16. package/dist/components/chart/chart-loader.d.ts +44 -13
  17. package/dist/components/chart/chart-loader.js +65 -18
  18. package/dist/components/chart/chart.d.ts +12 -2
  19. package/dist/components/chart/chart.js +121 -14
  20. package/dist/components/chart/histogram-bin.d.ts +4 -1
  21. package/dist/components/chart/histogram-bin.js +24 -14
  22. package/dist/components/chart/lite-chart.d.ts +63 -0
  23. package/dist/components/chart/lite-chart.js +181 -23
  24. package/dist/components/chart/lite-chart.styles.js +9 -0
  25. package/dist/components/chat-composer/chat-composer.d.ts +92 -0
  26. package/dist/components/chat-composer/chat-composer.js +285 -0
  27. package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
  28. package/dist/components/chat-composer/chat-composer.styles.js +135 -0
  29. package/dist/components/chat-message/chat-message.d.ts +113 -0
  30. package/dist/components/chat-message/chat-message.js +291 -0
  31. package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
  32. package/dist/components/chat-message/chat-message.styles.js +203 -0
  33. package/dist/components/checkbox/checkbox.d.ts +59 -0
  34. package/dist/components/checkbox/checkbox.js +230 -0
  35. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  36. package/dist/components/checkbox/checkbox.styles.js +70 -0
  37. package/dist/components/chip/chip-group.d.ts +56 -0
  38. package/dist/components/chip/chip-group.js +124 -0
  39. package/dist/components/chip/chip-group.styles.d.ts +1 -0
  40. package/dist/components/chip/chip-group.styles.js +57 -0
  41. package/dist/components/chip/chip.d.ts +64 -0
  42. package/dist/components/chip/chip.js +115 -0
  43. package/dist/components/chip/chip.styles.d.ts +1 -0
  44. package/dist/components/chip/chip.styles.js +115 -0
  45. package/dist/components/citation-badge/citation-badge.d.ts +113 -0
  46. package/dist/components/citation-badge/citation-badge.js +300 -0
  47. package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
  48. package/dist/components/citation-badge/citation-badge.styles.js +96 -0
  49. package/dist/components/code-block/code-block.d.ts +89 -0
  50. package/dist/components/code-block/code-block.js +317 -0
  51. package/dist/components/code-block/code-block.styles.d.ts +1 -0
  52. package/dist/components/code-block/code-block.styles.js +187 -0
  53. package/dist/components/code-block/code-loader.d.ts +44 -0
  54. package/dist/components/code-block/code-loader.js +79 -0
  55. package/dist/components/combobox/combobox.d.ts +19 -1
  56. package/dist/components/combobox/combobox.js +84 -14
  57. package/dist/components/combobox/option.d.ts +5 -1
  58. package/dist/components/combobox/option.js +35 -0
  59. package/dist/components/context-meter/context-meter.d.ts +53 -0
  60. package/dist/components/context-meter/context-meter.js +150 -0
  61. package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
  62. package/dist/components/context-meter/context-meter.styles.js +120 -0
  63. package/dist/components/conversation-item/conversation-item.d.ts +128 -0
  64. package/dist/components/conversation-item/conversation-item.js +322 -0
  65. package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
  66. package/dist/components/conversation-item/conversation-item.styles.js +155 -0
  67. package/dist/components/date-picker/date-input.d.ts +24 -0
  68. package/dist/components/date-picker/date-input.js +134 -22
  69. package/dist/components/date-picker/date-picker.d.ts +7 -0
  70. package/dist/components/date-picker/date-picker.js +85 -16
  71. package/dist/components/dialog/confirm.d.ts +40 -0
  72. package/dist/components/dialog/confirm.js +79 -0
  73. package/dist/components/dialog/dialog.d.ts +85 -0
  74. package/dist/components/dialog/dialog.js +272 -0
  75. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  76. package/dist/components/dialog/dialog.styles.js +52 -0
  77. package/dist/components/dock-panel/dock-panel.d.ts +134 -0
  78. package/dist/components/dock-panel/dock-panel.js +345 -0
  79. package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
  80. package/dist/components/dock-panel/dock-panel.styles.js +145 -0
  81. package/dist/components/document-preview/document-preview.d.ts +135 -0
  82. package/dist/components/document-preview/document-preview.js +372 -0
  83. package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
  84. package/dist/components/document-preview/document-preview.styles.js +191 -0
  85. package/dist/components/export-button/csv.js +1 -1
  86. package/dist/components/export-button/export-button.js +2 -0
  87. package/dist/components/flag/flag.d.ts +42 -5
  88. package/dist/components/flag/flag.js +70 -3
  89. package/dist/components/gauge/gauge.js +19 -10
  90. package/dist/components/generation-status/generation-status.d.ts +109 -0
  91. package/dist/components/generation-status/generation-status.js +273 -0
  92. package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
  93. package/dist/components/generation-status/generation-status.styles.js +84 -0
  94. package/dist/components/heatmap/calendar-grid.d.ts +4 -1
  95. package/dist/components/heatmap/calendar-grid.js +25 -12
  96. package/dist/components/heatmap/heatmap-scale.d.ts +6 -0
  97. package/dist/components/heatmap/heatmap-scale.js +7 -1
  98. package/dist/components/heatmap/heatmap.d.ts +89 -3
  99. package/dist/components/heatmap/heatmap.js +158 -29
  100. package/dist/components/json-viewer/json-viewer.d.ts +53 -0
  101. package/dist/components/json-viewer/json-viewer.js +283 -0
  102. package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
  103. package/dist/components/json-viewer/json-viewer.styles.js +176 -0
  104. package/dist/components/kbd/kbd.d.ts +77 -0
  105. package/dist/components/kbd/kbd.js +214 -0
  106. package/dist/components/kbd/kbd.styles.d.ts +1 -0
  107. package/dist/components/kbd/kbd.styles.js +52 -0
  108. package/dist/components/live-region/live-region.d.ts +81 -0
  109. package/dist/components/live-region/live-region.js +153 -0
  110. package/dist/components/live-region/live-region.styles.d.ts +1 -0
  111. package/dist/components/live-region/live-region.styles.js +10 -0
  112. package/dist/components/map/map.d.ts +8 -6
  113. package/dist/components/map/map.js +44 -8
  114. package/dist/components/markdown/markdown-loader.d.ts +34 -0
  115. package/dist/components/markdown/markdown-loader.js +43 -0
  116. package/dist/components/markdown/markdown.d.ts +81 -0
  117. package/dist/components/markdown/markdown.js +284 -0
  118. package/dist/components/markdown/markdown.styles.d.ts +1 -0
  119. package/dist/components/markdown/markdown.styles.js +82 -0
  120. package/dist/components/media-card/media-card.d.ts +122 -0
  121. package/dist/components/media-card/media-card.js +295 -0
  122. package/dist/components/media-card/media-card.styles.d.ts +1 -0
  123. package/dist/components/media-card/media-card.styles.js +132 -0
  124. package/dist/components/mention-popover/mention-popover.d.ts +200 -0
  125. package/dist/components/mention-popover/mention-popover.js +475 -0
  126. package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
  127. package/dist/components/mention-popover/mention-popover.styles.js +101 -0
  128. package/dist/components/menu/menu-item.d.ts +62 -0
  129. package/dist/components/menu/menu-item.js +119 -0
  130. package/dist/components/menu/menu-item.styles.d.ts +1 -0
  131. package/dist/components/menu/menu-item.styles.js +67 -0
  132. package/dist/components/menu/menu.d.ts +143 -0
  133. package/dist/components/menu/menu.js +365 -0
  134. package/dist/components/menu/menu.styles.d.ts +1 -0
  135. package/dist/components/menu/menu.styles.js +66 -0
  136. package/dist/components/model-select/model-select.d.ts +125 -0
  137. package/dist/components/model-select/model-select.js +490 -0
  138. package/dist/components/model-select/model-select.styles.d.ts +1 -0
  139. package/dist/components/model-select/model-select.styles.js +189 -0
  140. package/dist/components/model-settings-panel/model-settings-panel.d.ts +69 -0
  141. package/dist/components/model-settings-panel/model-settings-panel.js +145 -0
  142. package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
  143. package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
  144. package/dist/components/playback/playback.d.ts +13 -1
  145. package/dist/components/playback/playback.js +47 -14
  146. package/dist/components/responsive-panel/responsive-panel.d.ts +150 -0
  147. package/dist/components/responsive-panel/responsive-panel.js +365 -0
  148. package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
  149. package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
  150. package/dist/components/result-card/result-card.d.ts +44 -0
  151. package/dist/components/result-card/result-card.js +83 -0
  152. package/dist/components/result-card/result-card.styles.d.ts +1 -0
  153. package/dist/components/result-card/result-card.styles.js +50 -0
  154. package/dist/components/result-card/result-field.d.ts +36 -0
  155. package/dist/components/result-card/result-field.js +87 -0
  156. package/dist/components/result-card/result-field.styles.d.ts +1 -0
  157. package/dist/components/result-card/result-field.styles.js +32 -0
  158. package/dist/components/select/select.d.ts +45 -1
  159. package/dist/components/select/select.js +114 -17
  160. package/dist/components/select/select.styles.js +26 -2
  161. package/dist/components/slider/slider.d.ts +89 -0
  162. package/dist/components/slider/slider.js +352 -0
  163. package/dist/components/slider/slider.styles.d.ts +1 -0
  164. package/dist/components/slider/slider.styles.js +87 -0
  165. package/dist/components/source-card/source-card.d.ts +92 -0
  166. package/dist/components/source-card/source-card.js +148 -0
  167. package/dist/components/source-card/source-card.styles.d.ts +1 -0
  168. package/dist/components/source-card/source-card.styles.js +69 -0
  169. package/dist/components/source-list/source-list.d.ts +63 -0
  170. package/dist/components/source-list/source-list.js +122 -0
  171. package/dist/components/source-list/source-list.styles.d.ts +1 -0
  172. package/dist/components/source-list/source-list.styles.js +59 -0
  173. package/dist/components/sparkline/sparkline.js +27 -13
  174. package/dist/components/split/split.d.ts +93 -1
  175. package/dist/components/split/split.js +284 -15
  176. package/dist/components/split/split.styles.js +30 -0
  177. package/dist/components/stat/stat.d.ts +22 -1
  178. package/dist/components/stat/stat.js +49 -3
  179. package/dist/components/stat/stat.styles.js +20 -0
  180. package/dist/components/stream-status/stream-status.d.ts +110 -0
  181. package/dist/components/stream-status/stream-status.js +210 -0
  182. package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
  183. package/dist/components/stream-status/stream-status.styles.js +103 -0
  184. package/dist/components/streaming-text/streaming-text.d.ts +98 -0
  185. package/dist/components/streaming-text/streaming-text.js +209 -0
  186. package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
  187. package/dist/components/streaming-text/streaming-text.styles.js +62 -0
  188. package/dist/components/switch/switch.d.ts +58 -0
  189. package/dist/components/switch/switch.js +179 -0
  190. package/dist/components/switch/switch.styles.d.ts +1 -0
  191. package/dist/components/switch/switch.styles.js +75 -0
  192. package/dist/components/table/table.d.ts +73 -4
  193. package/dist/components/table/table.js +169 -20
  194. package/dist/components/table/table.styles.js +6 -1
  195. package/dist/components/tabs/tabs.d.ts +51 -0
  196. package/dist/components/tabs/tabs.js +190 -0
  197. package/dist/components/tabs/tabs.styles.d.ts +1 -0
  198. package/dist/components/tabs/tabs.styles.js +63 -0
  199. package/dist/components/thinking-panel/thinking-panel.d.ts +121 -0
  200. package/dist/components/thinking-panel/thinking-panel.js +235 -0
  201. package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
  202. package/dist/components/thinking-panel/thinking-panel.styles.js +117 -0
  203. package/dist/components/toast/toast-item.d.ts +1 -0
  204. package/dist/components/toast/toast-item.js +31 -6
  205. package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +130 -0
  206. package/dist/components/tool-approval-dialog/tool-approval-dialog.js +403 -0
  207. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
  208. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
  209. package/dist/components/tool-call-chip/tool-call-chip.d.ts +89 -0
  210. package/dist/components/tool-call-chip/tool-call-chip.js +288 -0
  211. package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
  212. package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
  213. package/dist/components/tool-param-form/tool-param-form.d.ts +145 -0
  214. package/dist/components/tool-param-form/tool-param-form.js +366 -0
  215. package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
  216. package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
  217. package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +102 -0
  218. package/dist/components/tool-result-dialog/tool-result-dialog.js +393 -0
  219. package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
  220. package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
  221. package/dist/components/tool-result-view/registry.d.ts +81 -0
  222. package/dist/components/tool-result-view/registry.js +84 -0
  223. package/dist/components/tool-result-view/tool-result-view.d.ts +55 -0
  224. package/dist/components/tool-result-view/tool-result-view.js +138 -0
  225. package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
  226. package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
  227. package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
  228. package/dist/components/tool-select-dialog/tool-select-dialog.js +439 -0
  229. package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
  230. package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +182 -0
  231. package/dist/components/tree/tree-node.d.ts +11 -2
  232. package/dist/components/tree/tree-node.js +16 -6
  233. package/dist/components/tree/tree.d.ts +8 -2
  234. package/dist/components/tree/tree.js +18 -11
  235. package/dist/components/typing-indicator/typing-indicator.d.ts +60 -0
  236. package/dist/components/typing-indicator/typing-indicator.js +96 -0
  237. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
  238. package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
  239. package/dist/components/virtual-list/virtual-list.d.ts +173 -0
  240. package/dist/components/virtual-list/virtual-list.js +461 -0
  241. package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
  242. package/dist/components/virtual-list/virtual-list.styles.js +44 -0
  243. package/dist/components/widget/widget.d.ts +10 -0
  244. package/dist/components/widget/widget.js +24 -1
  245. package/dist/components/widget/widget.styles.js +9 -2
  246. package/dist/components/word-cloud/word-cloud-layout.js +14 -1
  247. package/dist/components/word-cloud/word-cloud.d.ts +6 -0
  248. package/dist/components/word-cloud/word-cloud.js +25 -14
  249. package/dist/components/word-cloud/word-cloud.styles.js +4 -2
  250. package/dist/internal/announcer.d.ts +57 -0
  251. package/dist/internal/announcer.js +71 -0
  252. package/dist/internal/form-associated.d.ts +1 -0
  253. package/dist/internal/form-associated.js +55 -11
  254. package/dist/internal/group-by-recency.d.ts +50 -0
  255. package/dist/internal/group-by-recency.js +80 -0
  256. package/dist/internal/rtl.d.ts +23 -0
  257. package/dist/internal/rtl.js +28 -0
  258. package/dist/internal/scroll-lock.d.ts +10 -5
  259. package/dist/internal/scroll-lock.js +30 -14
  260. package/dist/internal/tokens.styles.js +6 -0
  261. package/dist/lyra.d.ts +130 -31
  262. package/dist/lyra.js +94 -26
  263. package/llms-full.txt +3921 -32
  264. package/llms.txt +16 -1
  265. package/package.json +23 -5
  266. package/dist/components/chart/bar-chart.stories.d.ts +0 -5
  267. package/dist/components/chart/bar-chart.stories.js +0 -20
  268. package/dist/components/chart/box-plot.stories.d.ts +0 -5
  269. package/dist/components/chart/box-plot.stories.js +0 -29
  270. package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
  271. package/dist/components/chart/bubble-chart.stories.js +0 -26
  272. package/dist/components/chart/chart.stories.d.ts +0 -32
  273. package/dist/components/chart/chart.stories.js +0 -141
  274. package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
  275. package/dist/components/chart/doughnut-chart.stories.js +0 -26
  276. package/dist/components/chart/histogram.stories.d.ts +0 -5
  277. package/dist/components/chart/histogram.stories.js +0 -17
  278. package/dist/components/chart/line-chart.stories.d.ts +0 -22
  279. package/dist/components/chart/line-chart.stories.js +0 -99
  280. package/dist/components/chart/lite-chart.stories.d.ts +0 -12
  281. package/dist/components/chart/lite-chart.stories.js +0 -98
  282. package/dist/components/chart/pie-chart.stories.d.ts +0 -5
  283. package/dist/components/chart/pie-chart.stories.js +0 -26
  284. package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
  285. package/dist/components/chart/polar-area-chart.stories.js +0 -20
  286. package/dist/components/chart/radar-chart.stories.d.ts +0 -5
  287. package/dist/components/chart/radar-chart.stories.js +0 -20
  288. package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
  289. package/dist/components/chart/scatter-chart.stories.js +0 -31
  290. package/dist/components/combobox/combobox.stories.d.ts +0 -24
  291. package/dist/components/combobox/combobox.stories.js +0 -102
  292. package/dist/components/date-picker/date-input.stories.d.ts +0 -10
  293. package/dist/components/date-picker/date-input.stories.js +0 -48
  294. package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
  295. package/dist/components/date-picker/date-picker.stories.js +0 -25
  296. package/dist/components/empty/empty.stories.d.ts +0 -7
  297. package/dist/components/empty/empty.stories.js +0 -34
  298. package/dist/components/export-button/export-button.stories.d.ts +0 -7
  299. package/dist/components/export-button/export-button.stories.js +0 -37
  300. package/dist/components/file-input/file-input.stories.d.ts +0 -7
  301. package/dist/components/file-input/file-input.stories.js +0 -19
  302. package/dist/components/flag/flag.stories.d.ts +0 -5
  303. package/dist/components/flag/flag.stories.js +0 -17
  304. package/dist/components/gauge/gauge.stories.d.ts +0 -8
  305. package/dist/components/gauge/gauge.stories.js +0 -19
  306. package/dist/components/graph/graph.stories.d.ts +0 -8
  307. package/dist/components/graph/graph.stories.js +0 -68
  308. package/dist/components/heatmap/heatmap.stories.d.ts +0 -22
  309. package/dist/components/heatmap/heatmap.stories.js +0 -154
  310. package/dist/components/map/map.stories.d.ts +0 -15
  311. package/dist/components/map/map.stories.js +0 -135
  312. package/dist/components/playback/playback.stories.d.ts +0 -7
  313. package/dist/components/playback/playback.stories.js +0 -16
  314. package/dist/components/select/select.stories.d.ts +0 -19
  315. package/dist/components/select/select.stories.js +0 -75
  316. package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
  317. package/dist/components/skeleton/skeleton.stories.js +0 -16
  318. package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
  319. package/dist/components/sparkline/sparkline.stories.js +0 -39
  320. package/dist/components/split/split.stories.d.ts +0 -7
  321. package/dist/components/split/split.stories.js +0 -36
  322. package/dist/components/stat/stat.stories.d.ts +0 -8
  323. package/dist/components/stat/stat.stories.js +0 -64
  324. package/dist/components/table/table.stories.d.ts +0 -12
  325. package/dist/components/table/table.stories.js +0 -67
  326. package/dist/components/time-range/time-range.stories.d.ts +0 -8
  327. package/dist/components/time-range/time-range.stories.js +0 -26
  328. package/dist/components/toast/toast.stories.d.ts +0 -8
  329. package/dist/components/toast/toast.stories.js +0 -72
  330. package/dist/components/tree/tree.stories.d.ts +0 -9
  331. package/dist/components/tree/tree.stories.js +0 -52
  332. package/dist/components/widget/widget.stories.d.ts +0 -7
  333. package/dist/components/widget/widget.stories.js +0 -41
  334. package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
  335. package/dist/components/word-cloud/word-cloud.stories.js +0 -55
@@ -0,0 +1,117 @@
1
+ import { css } from 'lit';
2
+ // Shares its collapsible-header shape (border/radius/hover/focus-ring, the
3
+ // rotating chevron) with lyra-source-list's styles almost verbatim -- the two
4
+ // are siblings in the same "collapsible region behind a header button"
5
+ // family and are meant to sit comfortably next to each other in a message.
6
+ export const styles = css `
7
+ :host {
8
+ display: block;
9
+ /* Consumer-overridable cap on how tall the reasoning transcript grows
10
+ before it scrolls internally, e.g. via ::part(body) or by overriding
11
+ this custom property directly -- not exposed as a component prop
12
+ since it's a pure layout knob, not something a template branches on. */
13
+ --lyra-thinking-panel-max-block-size: 16rem;
14
+ }
15
+ [part='base'] {
16
+ border: 1px solid var(--lyra-color-border);
17
+ border-radius: var(--lyra-radius);
18
+ background: var(--lyra-color-surface);
19
+ overflow: hidden;
20
+ }
21
+ [part='header'] {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: var(--lyra-space-xs);
25
+ inline-size: 100%;
26
+ padding: var(--lyra-space-s) var(--lyra-space-m);
27
+ border: none;
28
+ background: none;
29
+ color: var(--lyra-color-text);
30
+ font: inherit;
31
+ font-weight: 600;
32
+ font-size: 0.875rem;
33
+ text-align: start;
34
+ cursor: pointer;
35
+ }
36
+ [part='header']:hover {
37
+ background: var(--lyra-color-brand-quiet);
38
+ color: var(--lyra-color-brand);
39
+ }
40
+ [part='header']:focus-visible {
41
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
42
+ outline-offset: calc(-1 * var(--lyra-focus-ring-offset));
43
+ }
44
+ [part='toggle'] {
45
+ display: inline-flex;
46
+ flex: 0 0 auto;
47
+ transition: transform var(--lyra-transition-fast);
48
+ }
49
+ :host([expanded]) [part='toggle'] {
50
+ transform: rotate(90deg);
51
+ }
52
+ [part='label'] {
53
+ flex: 1 1 auto;
54
+ min-inline-size: 0;
55
+ overflow: hidden;
56
+ text-overflow: ellipsis;
57
+ white-space: nowrap;
58
+ }
59
+ [part='duration'] {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: 0.35em;
63
+ flex: 0 0 auto;
64
+ font-weight: 400;
65
+ font-size: 0.8125rem;
66
+ color: var(--lyra-color-text-quiet);
67
+ }
68
+ /* Actively streaming with no duration yet -- a full-opacity brand-colored
69
+ label plus a separate decorative pulse dot, deliberately *not* animating
70
+ the text's own opacity the way lyra-typing-indicator's pulse variant
71
+ does: that dims it well below AA contrast for part of every cycle, fine
72
+ for a purely decorative shape but not for text carrying real content
73
+ ("Thinking…"). */
74
+ [part='duration'][data-pending] {
75
+ color: var(--lyra-color-brand);
76
+ }
77
+ .pending-dot {
78
+ inline-size: 0.375rem;
79
+ block-size: 0.375rem;
80
+ border-radius: 50%;
81
+ background: currentColor;
82
+ animation: lyra-thinking-panel-pulse var(--lyra-transition-base) infinite;
83
+ }
84
+ @keyframes lyra-thinking-panel-pulse {
85
+ 0%,
86
+ 100% {
87
+ opacity: 0.4;
88
+ transform: scale(0.85);
89
+ }
90
+ 50% {
91
+ opacity: 1;
92
+ transform: scale(1);
93
+ }
94
+ }
95
+ [part='body'] {
96
+ max-block-size: var(--lyra-thinking-panel-max-block-size);
97
+ overflow-y: auto;
98
+ padding: var(--lyra-space-m);
99
+ border-block-start: 1px solid var(--lyra-color-border);
100
+ color: var(--lyra-color-text-quiet);
101
+ font-size: 0.875rem;
102
+ line-height: 1.5;
103
+ }
104
+ [part='body'][hidden] {
105
+ display: none;
106
+ }
107
+ @media (prefers-reduced-motion: reduce) {
108
+ [part='toggle'] {
109
+ transition: none !important;
110
+ }
111
+ .pending-dot {
112
+ animation: none !important;
113
+ opacity: 1;
114
+ transform: none;
115
+ }
116
+ }
117
+ `;
@@ -36,6 +36,7 @@ export declare class LyraToastItem extends LyraElement {
36
36
  private showRafId?;
37
37
  private showAnimTimer?;
38
38
  private hideAnimTimer?;
39
+ private resolvePendingHide?;
39
40
  private hovering;
40
41
  private focused;
41
42
  private hiding;
@@ -76,8 +76,12 @@ export class LyraToastItem extends LyraElement {
76
76
  if (!isFinite(this.duration) || this.duration <= 0)
77
77
  return;
78
78
  const remaining = this.duration - this.elapsedMs;
79
- if (remaining <= 0)
79
+ // A duration shortened below the already-elapsed time must hide promptly,
80
+ // not silently never schedule anything.
81
+ if (remaining <= 0) {
82
+ void this.hide();
80
83
  return;
84
+ }
81
85
  this.startedAt = performance.now();
82
86
  this.timer = window.setTimeout(() => this.hide(), remaining);
83
87
  };
@@ -124,11 +128,12 @@ export class LyraToastItem extends LyraElement {
124
128
  // `elapsedMs`/`duration` are re-read fresh every time the timer is
125
129
  // (re)scheduled, so a `duration` change while paused (hovering/focused)
126
130
  // or before the timer has ever started needs no action here -- the next
127
- // resumeTimer()/startTimer() call already picks up the new value. Only a
128
- // timer that's actively counting down right now is running against a
129
- // setTimeout scheduled for the *old* duration, so that's the one case
130
- // that needs an explicit reschedule.
131
- if (changed.has('duration') && this.timerStarted && this.timer !== undefined) {
131
+ // resumeTimer()/startTimer() call already picks up the new value.
132
+ // Re-evaluate on any duration change once the show sequence has started,
133
+ // not only while a timer is already actively counting down -- this also
134
+ // covers duration flipping from disabled (0/Infinity) back to a positive
135
+ // value, which previously never had `this.timer !== undefined` to gate on.
136
+ if (changed.has('duration') && this.timerStarted && !this.hovering && !this.focused) {
132
137
  this.pauseTimer();
133
138
  this.resumeTimer();
134
139
  }
@@ -136,6 +141,11 @@ export class LyraToastItem extends LyraElement {
136
141
  firstUpdated() {
137
142
  this.showRafId = requestAnimationFrame(() => {
138
143
  this.showRafId = undefined;
144
+ // hide() may have already run synchronously before this frame fired
145
+ // (e.g. a caller creates the toast and immediately dismisses it) --
146
+ // don't resurrect the show sequence on top of an already-hiding item.
147
+ if (this.hiding)
148
+ return;
139
149
  this.setAttribute('data-visible', '');
140
150
  this.emit('lyra-show');
141
151
  this.showAnimTimer = window.setTimeout(() => {
@@ -158,6 +168,12 @@ export class LyraToastItem extends LyraElement {
158
168
  if (this.hideAnimTimer !== undefined) {
159
169
  clearTimeout(this.hideAnimTimer);
160
170
  this.hideAnimTimer = undefined;
171
+ // hide()'s own promise is awaiting this timer firing to resolve() --
172
+ // a disconnect (e.g. the toast's ancestor is removed from the DOM,
173
+ // bypassing this.remove()) must still let that promise settle instead
174
+ // of leaving it pending forever.
175
+ this.resolvePendingHide?.();
176
+ this.resolvePendingHide = undefined;
161
177
  }
162
178
  this.clearTimer();
163
179
  }
@@ -203,11 +219,20 @@ export class LyraToastItem extends LyraElement {
203
219
  this.emit('lyra-hide');
204
220
  this.removeAttribute('data-visible');
205
221
  await new Promise((resolve) => {
222
+ this.resolvePendingHide = resolve;
206
223
  this.hideAnimTimer = window.setTimeout(() => {
207
224
  this.hideAnimTimer = undefined;
225
+ this.resolvePendingHide = undefined;
208
226
  resolve();
209
227
  }, animMs());
210
228
  });
229
+ // An out-of-band disconnect (see disconnectedCallback) resolves this same
230
+ // promise so callers awaiting hide() never hang, but it does so *without*
231
+ // this having reached its normal completion -- guard against then still
232
+ // emitting a "finished hiding" event (and redundantly calling remove())
233
+ // for a node that's already been torn down some other way.
234
+ if (!this.isConnected)
235
+ return;
211
236
  this.emit('lyra-after-hide');
212
237
  this.remove();
213
238
  }
@@ -0,0 +1,130 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ import '../json-viewer/json-viewer.js';
4
+ /**
5
+ * Reason the dialog was dismissed, forwarded as the `lyra-close` event detail
6
+ * -- mirrors `<lyra-dialog>`'s own `DialogCloseReason` shape. `'escape'`/
7
+ * `'backdrop'` come from the dialog's own built-in dismiss triggers,
8
+ * `'approve'`/`'deny'` from the built-in action buttons (fired in addition
9
+ * to, and immediately after, their own dedicated `lyra-approve`/`lyra-deny`
10
+ * event -- see the class doc), and any other string is whatever a caller
11
+ * passes to `close()` directly.
12
+ */
13
+ export type ToolApprovalDialogCloseReason = 'escape' | 'backdrop' | 'approve' | 'deny' | 'api' | string;
14
+ /**
15
+ * `<lyra-tool-approval-dialog>` — a human-in-the-loop gate: presents one
16
+ * proposed tool/function call (`toolName` + `args`) and blocks an agent from
17
+ * executing it until a person explicitly approves or denies it, with an
18
+ * optional inline "edit the arguments before approving" step.
19
+ *
20
+ * This is its own standalone overlay implementation (`role="dialog"`,
21
+ * focus-trapped, Escape/backdrop-dismissible, scroll-locking) rather than
22
+ * nesting a `<lyra-dialog>` in its shadow template — see `<lyra-dialog>`'s
23
+ * own header comment for why a new overlay component in this library
24
+ * duplicates that pattern locally instead of composing the previous one.
25
+ *
26
+ * Approve/Deny/Edit are built-in chrome (not a `footer` slot a consumer must
27
+ * assemble) — this component's interaction shape is fixed enough (there is
28
+ * exactly one correct set of actions for "approve this call") that requiring
29
+ * every consumer to re-build it would just be boilerplate. A `footer` slot is
30
+ * still offered for *supplementary* content a consumer wants alongside those
31
+ * buttons (e.g. a "remember this choice for this tool" checkbox) — its
32
+ * content renders to the start of the action row, before Deny/Edit/Approve.
33
+ *
34
+ * Editing: while `editable`, an Edit button swaps the read-only
35
+ * `<lyra-json-viewer>` for a plain `<textarea>` pre-filled with
36
+ * `JSON.stringify(args, null, 2)`. Every keystroke is re-validated with
37
+ * `JSON.parse` — the Approve button is `disabled` for as long as the current
38
+ * textarea content fails to parse, so a malformed edit can never be silently
39
+ * approved as either the broken text or a stale copy of the original args.
40
+ * The same button relabels to "Cancel" while editing; clicking it discards
41
+ * the draft entirely and returns to the read-only view of the *original*
42
+ * `args` — there is no separate "save" step independent of Approve itself.
43
+ * Both `editing` and any in-progress draft reset back to the read-only view
44
+ * every time the dialog transitions from closed to open, so a reused
45
+ * instance never leaks one proposal's half-finished edit into the next.
46
+ *
47
+ * Initial focus deliberately does *not* land on Approve (see `updated()`):
48
+ * approving a tool call is a consequential, potentially irreversible action,
49
+ * so a user who opens this dialog and reflexively presses Enter/Space before
50
+ * reading anything should deny, not approve. Deny gets the initial focus
51
+ * instead — the same "focus the safe action" convention a native destructive-
52
+ * confirmation dialog (delete, discard, etc.) typically follows for its own
53
+ * Cancel button — rather than the inert dialog panel, which would need an
54
+ * extra Tab press before *any* action is reachable at all.
55
+ *
56
+ * @customElement lyra-tool-approval-dialog
57
+ * @slot footer - Optional supplementary content (e.g. a "remember this
58
+ * choice" checkbox), rendered before the built-in Deny/Edit/Approve buttons.
59
+ * @event lyra-approve - The call was approved. `detail: { args }` — the
60
+ * current, already-parsed arguments object: the original `args` prop, or (if
61
+ * an edit was in progress) the user's edited-and-validated version. Always
62
+ * followed by `lyra-close` with reason `'approve'`.
63
+ * @event lyra-deny - The call was denied (no detail). Always followed by
64
+ * `lyra-close` with reason `'deny'`.
65
+ * @event lyra-close - `detail: ToolApprovalDialogCloseReason`. Fired exactly
66
+ * once per dismissal — via Escape, a backdrop click, the Approve/Deny
67
+ * buttons, or a `close()` call — so there is one consistent "this dialog is
68
+ * now closed" signal regardless of which path triggered it.
69
+ * @csspart backdrop - The full-viewport scrim behind the panel.
70
+ * @csspart panel - The dialog panel itself (`role="dialog"` while open).
71
+ * @csspart header - The wrapper around the heading.
72
+ * @csspart tool-name - The `toolName` text within the heading.
73
+ * @csspart body - The wrapper around the args view/editor.
74
+ * @csspart args-view - The read-only `<lyra-json-viewer>` shown while not editing.
75
+ * @csspart args-editor - The raw-JSON `<textarea>` shown while editing.
76
+ * @csspart error - The inline "invalid JSON" message, shown only while editing with unparseable content.
77
+ * @csspart footer - The action row wrapping the `footer` slot and the built-in buttons.
78
+ * @csspart deny-button - The built-in Deny button.
79
+ * @csspart edit-button - The built-in Edit/Cancel toggle button (only rendered while `editable`).
80
+ * @csspart approve-button - The built-in Approve button — `disabled` while an in-progress edit is invalid JSON.
81
+ */
82
+ export declare class LyraToolApprovalDialog extends LyraElement {
83
+ static styles: import("lit").CSSResultGroup[];
84
+ /** Whether the dialog is open. Set this (or call `close()`) — there is no separate `show()`/`hide()` pair. */
85
+ open: boolean;
86
+ /** The proposed tool/function's name, e.g. `web_search`. Drives the heading and the dialog's accessible name. */
87
+ toolName: string;
88
+ /** The proposed call's arguments — any JSON-serializable value, rendered via `<lyra-json-viewer>` (or, while editing, stringified into the textarea). */
89
+ args: unknown;
90
+ /** Whether an "Edit" affordance is offered at all. When `false`, `args` is always shown read-only and can never be changed before approval. */
91
+ editable: boolean;
92
+ private editing;
93
+ /** The textarea's current raw text while editing — deliberately independent of `args` until Approve is pressed, so a malformed in-progress edit never overwrites it. */
94
+ private draftText;
95
+ /** `JSON.parse` failure message for `draftText`, or `''` while it parses cleanly. Empty string (not `undefined`) so it can drive `?hidden` directly. */
96
+ private draftError;
97
+ private releaseScrollLock?;
98
+ private lastTrigger?;
99
+ private readonly titleId;
100
+ private readonly errorId;
101
+ protected willUpdate(changed: PropertyValues): void;
102
+ protected updated(changed: PropertyValues): void;
103
+ connectedCallback(): void;
104
+ disconnectedCallback(): void;
105
+ /**
106
+ * Close the dialog and return focus to whatever had it before the dialog
107
+ * opened. `reason` is forwarded as the `lyra-close` detail — built-in
108
+ * triggers pass `'escape'`/`'backdrop'`/`'approve'`/`'deny'`; a consumer's
109
+ * own close affordance (e.g. a footer-slotted button) should call this
110
+ * directly with its own reason string, so every dismissal path funnels
111
+ * through the same event instead of the consumer having to also toggle
112
+ * `open` itself.
113
+ */
114
+ close(reason?: ToolApprovalDialogCloseReason): void;
115
+ private onBackdropClick;
116
+ private onDocKeyDown;
117
+ private getFocusableElements;
118
+ private getActiveElement;
119
+ private stringifyArgs;
120
+ private toggleEdit;
121
+ private onDraftInput;
122
+ private onApprove;
123
+ private onDeny;
124
+ render(): TemplateResult;
125
+ }
126
+ declare global {
127
+ interface HTMLElementTagNameMap {
128
+ 'lyra-tool-approval-dialog': LyraToolApprovalDialog;
129
+ }
130
+ }