@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
@@ -8,6 +8,7 @@ import { html, svg } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import { LyraElement } from '../../internal/lyra-element.js';
10
10
  import { defineElement } from '../../internal/prefix.js';
11
+ import { finiteNumber } from '../../internal/numbers.js';
11
12
  import { styles } from './gauge.styles.js';
12
13
  // Radial gauge sweeps 270° (like a speedometer), leaving a 90° gap at the bottom.
13
14
  const SWEEP_DEG = 270;
@@ -44,7 +45,11 @@ const RADIAL_ARC_LENGTH = (SWEEP_DEG / 360) * 2 * Math.PI * RADIUS;
44
45
  * generic gauge widget exists in Web Awesome.
45
46
  *
46
47
  * @customElement lyra-gauge
47
- * @csspart base, track, fill, value, label
48
+ * @csspart base - The root `<svg>`.
49
+ * @csspart track - The background track arc/line.
50
+ * @csspart fill - The animated fill arc/line.
51
+ * @csspart value - The value text.
52
+ * @csspart label - The label text.
48
53
  */
49
54
  export class LyraGauge extends LyraElement {
50
55
  constructor() {
@@ -56,29 +61,52 @@ export class LyraGauge extends LyraElement {
56
61
  this.label = '';
57
62
  }
58
63
  static { this.styles = [LyraElement.styles, styles]; }
64
+ // Normalizes a reversed min > max domain by swapping lo/hi, but only once
65
+ // both bounds are finite -- shared by `ratio` (fill geometry) and
66
+ // `willUpdate` (aria-value* trio) so the two can never silently diverge.
67
+ get domain() {
68
+ const min = finiteNumber(this.min, 0);
69
+ const max = finiteNumber(this.max, 100);
70
+ return { lo: Math.min(min, max), hi: Math.max(min, max) };
71
+ }
59
72
  get ratio() {
60
- if (isNaN(this.value) || isNaN(this.min) || isNaN(this.max))
73
+ if (!Number.isFinite(this.value))
74
+ return 0;
75
+ const { lo, hi } = this.domain;
76
+ if (!Number.isFinite(lo) || !Number.isFinite(hi))
61
77
  return 0;
62
- const span = this.max - this.min || 1;
63
- return Math.min(1, Math.max(0, (this.value - this.min) / span));
78
+ const span = hi - lo || 1;
79
+ return Math.min(1, Math.max(0, (this.value - lo) / span));
80
+ }
81
+ /** The text rendered/announced for the current value: `valueLabel` when set,
82
+ * else the numeric `value`, blanked (like the ARIA attributes and fill) when
83
+ * `value` is non-finite (NaN/undefined/Infinity/-Infinity). */
84
+ get displayText() {
85
+ return this.valueLabel || (!Number.isFinite(this.value) ? '' : String(this.value));
64
86
  }
65
87
  willUpdate() {
66
88
  this.setAttribute('role', 'meter');
67
- if (!isNaN(this.value) && !isNaN(this.min) && !isNaN(this.max)) {
68
- const clamped = Math.min(this.max, Math.max(this.min, this.value));
89
+ // Normalize a reversed min > max domain the same way `ratio` does, so the
90
+ // announced aria-value* trio always agrees with the visual fill instead
91
+ // of aria-valuenow pinning to one bound regardless of `value` (and
92
+ // aria-valuemin/valuemax reporting an inverted, invalid ARIA range).
93
+ const { lo, hi } = this.domain;
94
+ const finiteTrio = Number.isFinite(this.value) && Number.isFinite(lo) && Number.isFinite(hi);
95
+ if (finiteTrio) {
96
+ const clamped = Math.min(hi, Math.max(lo, this.value));
69
97
  this.setAttribute('aria-valuenow', String(clamped));
70
98
  }
71
99
  else {
72
100
  this.removeAttribute('aria-valuenow');
73
101
  }
74
- if (isNaN(this.min))
102
+ if (Number.isFinite(lo))
103
+ this.setAttribute('aria-valuemin', String(lo));
104
+ else
75
105
  this.removeAttribute('aria-valuemin');
106
+ if (Number.isFinite(hi))
107
+ this.setAttribute('aria-valuemax', String(hi));
76
108
  else
77
- this.setAttribute('aria-valuemin', String(this.min));
78
- if (isNaN(this.max))
79
109
  this.removeAttribute('aria-valuemax');
80
- else
81
- this.setAttribute('aria-valuemax', String(this.max));
82
110
  if (this.label)
83
111
  this.setAttribute('aria-label', this.label);
84
112
  else
@@ -89,7 +117,7 @@ export class LyraGauge extends LyraElement {
89
117
  this.removeAttribute('aria-valuetext');
90
118
  }
91
119
  renderRadial() {
92
- const text = this.valueLabel || (isNaN(this.value) ? '' : String(this.value));
120
+ const text = this.displayText;
93
121
  // Dashoffset counts down from the full arc length (nothing revealed) to 0
94
122
  // (whole sweep revealed) as ratio goes 0 -> 1 — the classic "draw an SVG
95
123
  // path" technique, which transitions smoothly via plain CSS.
@@ -108,7 +136,7 @@ export class LyraGauge extends LyraElement {
108
136
  </svg>`;
109
137
  }
110
138
  renderLinear() {
111
- const text = this.valueLabel || (isNaN(this.value) ? '' : String(this.value));
139
+ const text = this.displayText;
112
140
  const dashoffset = LINEAR_LENGTH * (1 - this.ratio);
113
141
  return html `<svg part="base" viewBox="0 0 100 20" preserveAspectRatio="none">
114
142
  <line part="track" x1="0" y1=${LINEAR_BAR_Y} x2="100" y2=${LINEAR_BAR_Y} stroke-width=${LINEAR_STROKE}></line>
@@ -0,0 +1,117 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ /**
4
+ * `<lyra-generation-status>` — a compact, ticking status readout shown
5
+ * alongside an in-progress AI response: elapsed time, token count, and
6
+ * token-throughput, plus a built-in Stop button. Renders as e.g.
7
+ * `12.3s · 340 tokens · 27 tok/s [Stop]`.
8
+ *
9
+ * This is deliberately a *different* concern than the already-landed
10
+ * `<lyra-stream-status>`: that component is about transport/connection
11
+ * health (idle/connecting/streaming/stalled, heartbeat-aware stall
12
+ * detection), while this one is a user-facing metrics readout for a
13
+ * generation that both components' hosts typically already know is
14
+ * healthily in progress. Neither imports or depends on the other, and a
15
+ * consumer building a full generation UI is expected to compose both side by
16
+ * side rather than pick one.
17
+ *
18
+ * `active` drives an internal ~1s `setInterval` ticker that recomputes the
19
+ * elapsed-time display (a plain interval is sufficient here -- unlike
20
+ * `<lyra-stream-status>`'s stall timer, this never needs to be armed with a
21
+ * precise deadline, only to refresh a display roughly once a second). The
22
+ * elapsed clock's start instant is `started-at` when set (an epoch-ms
23
+ * timestamp -- lets a host that already knows exactly when generation began,
24
+ * e.g. from its own request-dispatch timestamp, feed that in directly and
25
+ * survive this component being created slightly later than that instant);
26
+ * when `started-at` is unset, this component falls back to capturing
27
+ * `Date.now()` itself at the moment `active` flips from `false`/unset to
28
+ * `true`, so the ticker still starts from a sensible instant with zero
29
+ * required host bookkeeping. The ticker is cleared whenever `active` becomes
30
+ * `false` and on disconnect; the display is left at whatever it last showed
31
+ * (frozen, not reset to zero) -- a static "Generated in 12.3s" reads better
32
+ * as a completed-state summary than the readout blanking out the instant
33
+ * generation ends.
34
+ *
35
+ * `tokens-per-second`, when the host supplies it directly (e.g. from its own
36
+ * smoothed/windowed rate calculation), is always used as-is. When omitted,
37
+ * this component derives a live figure itself from `token-count` divided by
38
+ * elapsed seconds -- but only once at least one full second of elapsed time
39
+ * has accumulated, since dividing by a sub-second elapsed window can produce
40
+ * wildly-swinging, misleading early readings (e.g. 3 tokens in 40ms reading
41
+ * as "75 tok/s"). A host that wants a stable figure from the very first tick
42
+ * should supply `tokens-per-second` itself. The tokens segment and the
43
+ * throughput segment are independently optional: either, both, or neither
44
+ * may render depending on what's available, per each property's own doc.
45
+ *
46
+ * Accessibility: this readout ticks roughly once per second while active,
47
+ * which is exactly the kind of high-frequency update
48
+ * `<lyra-live-region>`/`Announcer` (`../../internal/announcer.js`) exists to
49
+ * *prevent* from being read aloud verbatim -- routing a per-second numeric
50
+ * tick through even a throttled announcer would still narrate a new number
51
+ * to a screen-reader user roughly once every throttle window for as long as
52
+ * generation runs, which is noise, not information. This component
53
+ * therefore carries no `role="status"`/`aria-live` of its own and never
54
+ * announces anything; a host that wants generation-start/-end announced
55
+ * should pair this with something that announces state *transitions* (e.g.
56
+ * `<lyra-typing-indicator>`'s mount-time announcement), not this ticking
57
+ * readout. The one genuinely actionable, infrequent control here -- the Stop
58
+ * button -- gets a normal, always-present `aria-label`, no different from
59
+ * any other icon-only button in this library.
60
+ *
61
+ * @customElement lyra-generation-status
62
+ * @event lyra-stop - The built-in Stop button was clicked. No detail payload.
63
+ * @csspart base - The root inline layout container.
64
+ * @csspart elapsed - The elapsed-time segment, e.g. `"12.3s"`. Always rendered (reads `"0.0s"` before the component has ever been active).
65
+ * @csspart tokens - The token-count segment, e.g. `"340 tokens"`. Only rendered when `token-count` is set.
66
+ * @csspart throughput - The throughput segment, e.g. `"27 tok/s"`. Only rendered when a value is available (host-supplied or derived; see the class doc).
67
+ * @csspart stop-button - The built-in Stop button. Only rendered while `show-stop` is true.
68
+ */
69
+ export declare class LyraGenerationStatus extends LyraElement {
70
+ static styles: import("lit").CSSResultGroup[];
71
+ /** Whether generation is currently in progress. The elapsed-time ticker
72
+ * runs only while this is `true` (see the class doc). */
73
+ active: boolean;
74
+ /** Epoch-ms timestamp of when generation began. Optional -- when unset (or
75
+ * when set to a value that fails to parse as a finite number, e.g. an
76
+ * ISO-8601 date string) while `active` is `true`, this component captures
77
+ * the current time itself the moment `active` becomes `true` and counts
78
+ * from there instead (see the class doc). */
79
+ startedAt?: number;
80
+ /** Running token count so far. Omitted from the readout entirely (no
81
+ * `tokens` segment) while unset. */
82
+ tokenCount?: number;
83
+ /** Host-computed tokens/sec figure, used as-is when set. When unset, this
84
+ * component derives a live figure from `token-count` and elapsed time
85
+ * itself once one is available -- see the class doc for the exact rule
86
+ * and why. */
87
+ tokensPerSecond?: number;
88
+ /** Whether the built-in Stop button renders at all. Defaults to `true`.
89
+ * Uses {@link showStopConverter} rather than Lit's default presence-based
90
+ * `type: Boolean` handling, so a plain-HTML consumer with no way to write
91
+ * a `.showStop` property binding can still turn this off with
92
+ * `show-stop="false"`; a Lit template can do the same with either that
93
+ * attribute string or a `.showStop=${false}` property binding. */
94
+ showStop: boolean;
95
+ private elapsedMs;
96
+ private tickTimer?;
97
+ private fallbackStartMs?;
98
+ connectedCallback(): void;
99
+ disconnectedCallback(): void;
100
+ protected willUpdate(changed: PropertyValues): void;
101
+ protected updated(changed: PropertyValues): void;
102
+ private startTicker;
103
+ private stopTicker;
104
+ private get validStartedAt();
105
+ private computeElapsedMs;
106
+ /** `tokens-per-second` when set; otherwise a derived figure once enough
107
+ * elapsed time has accumulated for it to be meaningful; otherwise
108
+ * `undefined` (the throughput segment doesn't render at all). */
109
+ private get effectiveTokensPerSecond();
110
+ private onStopClick;
111
+ render(): TemplateResult;
112
+ }
113
+ declare global {
114
+ interface HTMLElementTagNameMap {
115
+ 'lyra-generation-status': LyraGenerationStatus;
116
+ }
117
+ }
@@ -0,0 +1,327 @@
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, svg, } from 'lit';
8
+ import { property, state } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { styles } from './generation-status.styles.js';
12
+ // Mirrors the shared icon set's viewBox/stroke conventions
13
+ // (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
14
+ // stop glyph to that module -- it's off limits here -- so this one-off icon
15
+ // still reads as part of the same visual language as the rest of the
16
+ // library's inline icons. Identical shape to `<lyra-chat-composer>`'s own
17
+ // local `stopIcon()` (the conventional filled-square "stop generating"
18
+ // glyph), duplicated rather than imported since these are two independently
19
+ // consumable components with no dependency between them.
20
+ function stopIcon() {
21
+ return svg `
22
+ <svg
23
+ width="1em"
24
+ height="1em"
25
+ viewBox="0 0 24 24"
26
+ fill="currentColor"
27
+ stroke="none"
28
+ aria-hidden="true"
29
+ focusable="false"
30
+ ><rect x="6" y="6" width="12" height="12" rx="1.5"></rect></svg>
31
+ `;
32
+ }
33
+ /** `4200` -> `"4.2s"`; `65000` -> `"1m 5s"`. Sub-minute durations get one
34
+ * decimal place of seconds (the common case: most single generations finish
35
+ * in single-digit seconds, where whole-second precision would look static
36
+ * between ticks); once a full minute is reached, `"Xm Ys"` reads better than
37
+ * a fractional-minute or a 3-4 digit seconds count. The `59.95` cutoff (not
38
+ * a plain `60`) exists so a value that *rounds* to `"60.0s"` at one-decimal
39
+ * precision is displayed as `"1m 0s"` instead -- without it, the two
40
+ * branches could each independently round the same instant to a different
41
+ * minute. */
42
+ function formatElapsed(ms) {
43
+ const totalSeconds = Math.max(0, ms) / 1000;
44
+ if (totalSeconds < 59.95) {
45
+ return `${(Math.round(totalSeconds * 10) / 10).toFixed(1)}s`;
46
+ }
47
+ const wholeSeconds = Math.round(totalSeconds);
48
+ const minutes = Math.floor(wholeSeconds / 60);
49
+ const seconds = wholeSeconds % 60;
50
+ return `${minutes}m ${seconds}s`;
51
+ }
52
+ /** `340` -> `"340 tokens"`; `1` -> `"1 token"`. Same plain singular/plural
53
+ * ternary `<lyra-json-viewer>`'s array/object summary already uses -- this
54
+ * library has no general i18n/pluralization system (see
55
+ * `<lyra-source-list>`'s class doc for that stance), but a two-way English
56
+ * ternary for one fixed noun is a different, much smaller thing than a
57
+ * general pluralization engine, and reads better than an unconditional
58
+ * "1 tokens". */
59
+ function formatTokenCount(count) {
60
+ const rounded = Math.max(0, Math.round(count));
61
+ return `${rounded} ${rounded === 1 ? 'token' : 'tokens'}`;
62
+ }
63
+ /** `27.4` -> `"27 tok/s"`; `3.2` -> `"3.2 tok/s"`. Same shape as this file's
64
+ * `formatElapsed`/`<lyra-tool-call-chip>`'s `formatDuration`: the low end of
65
+ * the range (where a whole-number rounding would flatten every early
66
+ * reading to the same "0" or "1") gets one decimal place, while anything at
67
+ * or above 10 tok/s rounds to a whole number, which is plenty precise for a
68
+ * live-updating throughput figure. */
69
+ function formatThroughput(value) {
70
+ const clamped = Math.max(0, value);
71
+ const rounded = clamped < 10 ? Math.round(clamped * 10) / 10 : Math.round(clamped);
72
+ return `${rounded} tok/s`;
73
+ }
74
+ /**
75
+ * String-aware boolean attribute converter for `show-stop`. Lit's built-in
76
+ * `type: Boolean` converter is presence-based -- the attribute's mere
77
+ * presence (regardless of its string value) maps to `true`, so a plain-
78
+ * markup consumer writing the literal `show-stop="false"` would actually get
79
+ * the button *shown*, the opposite of what that string reads as (the same
80
+ * bug class `<lyra-streaming-text>`'s `optionalBooleanConverter` and
81
+ * `<lyra-line-chart>`'s `WithoutBeginAtZero` story both document). Unlike
82
+ * `<lyra-streaming-text>`'s tri-state converter, this property's default is
83
+ * `true`, not "unset" -- so this one only needs two states: attribute absent
84
+ * (or removed) -> `true` (the default); `show-stop="false"` -> `false`;
85
+ * anything else present (no value, `="true"`, ...) -> `true`.
86
+ */
87
+ const showStopConverter = {
88
+ fromAttribute(value) {
89
+ return value !== 'false';
90
+ },
91
+ toAttribute(value) {
92
+ // `true` is this property's default, so there's nothing worth reflecting
93
+ // for it; only the non-default `false` needs an attribute at all.
94
+ return value ? null : 'false';
95
+ },
96
+ };
97
+ /**
98
+ * `<lyra-generation-status>` — a compact, ticking status readout shown
99
+ * alongside an in-progress AI response: elapsed time, token count, and
100
+ * token-throughput, plus a built-in Stop button. Renders as e.g.
101
+ * `12.3s · 340 tokens · 27 tok/s [Stop]`.
102
+ *
103
+ * This is deliberately a *different* concern than the already-landed
104
+ * `<lyra-stream-status>`: that component is about transport/connection
105
+ * health (idle/connecting/streaming/stalled, heartbeat-aware stall
106
+ * detection), while this one is a user-facing metrics readout for a
107
+ * generation that both components' hosts typically already know is
108
+ * healthily in progress. Neither imports or depends on the other, and a
109
+ * consumer building a full generation UI is expected to compose both side by
110
+ * side rather than pick one.
111
+ *
112
+ * `active` drives an internal ~1s `setInterval` ticker that recomputes the
113
+ * elapsed-time display (a plain interval is sufficient here -- unlike
114
+ * `<lyra-stream-status>`'s stall timer, this never needs to be armed with a
115
+ * precise deadline, only to refresh a display roughly once a second). The
116
+ * elapsed clock's start instant is `started-at` when set (an epoch-ms
117
+ * timestamp -- lets a host that already knows exactly when generation began,
118
+ * e.g. from its own request-dispatch timestamp, feed that in directly and
119
+ * survive this component being created slightly later than that instant);
120
+ * when `started-at` is unset, this component falls back to capturing
121
+ * `Date.now()` itself at the moment `active` flips from `false`/unset to
122
+ * `true`, so the ticker still starts from a sensible instant with zero
123
+ * required host bookkeeping. The ticker is cleared whenever `active` becomes
124
+ * `false` and on disconnect; the display is left at whatever it last showed
125
+ * (frozen, not reset to zero) -- a static "Generated in 12.3s" reads better
126
+ * as a completed-state summary than the readout blanking out the instant
127
+ * generation ends.
128
+ *
129
+ * `tokens-per-second`, when the host supplies it directly (e.g. from its own
130
+ * smoothed/windowed rate calculation), is always used as-is. When omitted,
131
+ * this component derives a live figure itself from `token-count` divided by
132
+ * elapsed seconds -- but only once at least one full second of elapsed time
133
+ * has accumulated, since dividing by a sub-second elapsed window can produce
134
+ * wildly-swinging, misleading early readings (e.g. 3 tokens in 40ms reading
135
+ * as "75 tok/s"). A host that wants a stable figure from the very first tick
136
+ * should supply `tokens-per-second` itself. The tokens segment and the
137
+ * throughput segment are independently optional: either, both, or neither
138
+ * may render depending on what's available, per each property's own doc.
139
+ *
140
+ * Accessibility: this readout ticks roughly once per second while active,
141
+ * which is exactly the kind of high-frequency update
142
+ * `<lyra-live-region>`/`Announcer` (`../../internal/announcer.js`) exists to
143
+ * *prevent* from being read aloud verbatim -- routing a per-second numeric
144
+ * tick through even a throttled announcer would still narrate a new number
145
+ * to a screen-reader user roughly once every throttle window for as long as
146
+ * generation runs, which is noise, not information. This component
147
+ * therefore carries no `role="status"`/`aria-live` of its own and never
148
+ * announces anything; a host that wants generation-start/-end announced
149
+ * should pair this with something that announces state *transitions* (e.g.
150
+ * `<lyra-typing-indicator>`'s mount-time announcement), not this ticking
151
+ * readout. The one genuinely actionable, infrequent control here -- the Stop
152
+ * button -- gets a normal, always-present `aria-label`, no different from
153
+ * any other icon-only button in this library.
154
+ *
155
+ * @customElement lyra-generation-status
156
+ * @event lyra-stop - The built-in Stop button was clicked. No detail payload.
157
+ * @csspart base - The root inline layout container.
158
+ * @csspart elapsed - The elapsed-time segment, e.g. `"12.3s"`. Always rendered (reads `"0.0s"` before the component has ever been active).
159
+ * @csspart tokens - The token-count segment, e.g. `"340 tokens"`. Only rendered when `token-count` is set.
160
+ * @csspart throughput - The throughput segment, e.g. `"27 tok/s"`. Only rendered when a value is available (host-supplied or derived; see the class doc).
161
+ * @csspart stop-button - The built-in Stop button. Only rendered while `show-stop` is true.
162
+ */
163
+ export class LyraGenerationStatus extends LyraElement {
164
+ constructor() {
165
+ super(...arguments);
166
+ /** Whether generation is currently in progress. The elapsed-time ticker
167
+ * runs only while this is `true` (see the class doc). */
168
+ this.active = false;
169
+ /** Whether the built-in Stop button renders at all. Defaults to `true`.
170
+ * Uses {@link showStopConverter} rather than Lit's default presence-based
171
+ * `type: Boolean` handling, so a plain-HTML consumer with no way to write
172
+ * a `.showStop` property binding can still turn this off with
173
+ * `show-stop="false"`; a Lit template can do the same with either that
174
+ * attribute string or a `.showStop=${false}` property binding. */
175
+ this.showStop = true;
176
+ // Recomputed on activation and on every ~1s tick; frozen (not reset) once
177
+ // `active` goes false -- see the class doc's "ticker" paragraph.
178
+ this.elapsedMs = 0;
179
+ this.onStopClick = () => {
180
+ this.emit('lyra-stop');
181
+ };
182
+ }
183
+ static { this.styles = [LyraElement.styles, styles]; }
184
+ // A re-parenting host (e.g. a virtualized/reordering list) disconnects and
185
+ // reconnects this element without ever toggling `active` -- `willUpdate`/
186
+ // `updated` only react to *changes* of `active`, so with no override here
187
+ // a still-active element would come back with `disconnectedCallback`'s
188
+ // cleared ticker never restarted, freezing the readout even though
189
+ // `active` (still `true`) says generation is ongoing. Restarting from
190
+ // `computeElapsedMs()` (rather than resuming a stale in-flight interval)
191
+ // matches how `startTicker()` already re-baselines on every fresh start.
192
+ connectedCallback() {
193
+ super.connectedCallback();
194
+ if (this.active) {
195
+ this.elapsedMs = this.computeElapsedMs();
196
+ this.startTicker();
197
+ }
198
+ }
199
+ disconnectedCallback() {
200
+ super.disconnectedCallback();
201
+ this.stopTicker();
202
+ }
203
+ // Recomputing `elapsedMs` here (rather than in `updated()`) matters: Lit
204
+ // runs `willUpdate()` *before* render, as part of the same update pass, so
205
+ // a property set here is picked up by this same render with no extra
206
+ // cycle. Setting a reactive property from inside `updated()` instead would
207
+ // schedule a *second* update after the first has already completed (Lit
208
+ // warns about exactly this in dev mode) -- meaning a caller doing
209
+ // `el.active = true; await el.updateComplete;` would still observe the
210
+ // stale pre-activation `elapsedMs` once that first promise resolves.
211
+ //
212
+ // `changed.has('active')` fires on the very first update too when the
213
+ // element mounts already `active` (the parsed-attribute/property value
214
+ // differs from the `false` field-initializer default that was seen first)
215
+ // -- same mechanism `<lyra-stream-status>`'s `onPhaseChanged` relies on to
216
+ // arm its stall timer on a `phase="streaming"` mount, so mounting this
217
+ // component already active correctly seeds `elapsedMs` with no separate
218
+ // first-update special case needed.
219
+ willUpdate(changed) {
220
+ if (changed.has('active') && this.active) {
221
+ if (this.validStartedAt == null)
222
+ this.fallbackStartMs = Date.now();
223
+ this.elapsedMs = this.computeElapsedMs();
224
+ }
225
+ else if (this.active && changed.has('startedAt')) {
226
+ // A `started-at` that arrives (or changes) mid-generation should
227
+ // immediately re-baseline the displayed elapsed time rather than wait
228
+ // up to ~1s for the next tick.
229
+ this.elapsedMs = this.computeElapsedMs();
230
+ }
231
+ }
232
+ // Starting/stopping the interval is a genuine side effect (not a reactive-
233
+ // property write), so it belongs in `updated()`, unlike the `elapsedMs`
234
+ // computation above.
235
+ updated(changed) {
236
+ if (changed.has('active')) {
237
+ if (this.active)
238
+ this.startTicker();
239
+ else
240
+ this.stopTicker();
241
+ }
242
+ }
243
+ startTicker() {
244
+ this.stopTicker();
245
+ // Setting `elapsedMs` here (unlike inside `updated()`, see that method's
246
+ // doc) is fine: an interval callback is a wholly separate future task,
247
+ // not a continuation of an in-progress Lit update, so this starts a
248
+ // normal, self-contained update cycle rather than a same-tick "second
249
+ // update" scheduled mid-render.
250
+ this.tickTimer = setInterval(() => {
251
+ this.elapsedMs = this.computeElapsedMs();
252
+ }, 1000);
253
+ }
254
+ stopTicker() {
255
+ if (this.tickTimer !== undefined) {
256
+ clearInterval(this.tickTimer);
257
+ this.tickTimer = undefined;
258
+ }
259
+ }
260
+ // `startedAt` is host-supplied and, unlike `tokenCount`/`tokensPerSecond`
261
+ // (both already guarded at their read sites), had no `Number.isFinite`
262
+ // check of its own -- a non-numeric `started-at` attribute (e.g. an
263
+ // ISO-8601 date string that failed the `type: Number` conversion, landing
264
+ // as `NaN`) would flow straight into `Date.now() - start`, permanently
265
+ // rendering the literal text "NaNm NaNs" with no fallback or recovery.
266
+ // Treating an invalid value the same as "unset" here restores this
267
+ // property's own documented fallback-clock behavior instead.
268
+ get validStartedAt() {
269
+ return this.startedAt != null && Number.isFinite(this.startedAt) ? this.startedAt : undefined;
270
+ }
271
+ computeElapsedMs() {
272
+ const start = this.validStartedAt ?? this.fallbackStartMs;
273
+ return start == null ? 0 : Math.max(0, Date.now() - start);
274
+ }
275
+ /** `tokens-per-second` when set; otherwise a derived figure once enough
276
+ * elapsed time has accumulated for it to be meaningful; otherwise
277
+ * `undefined` (the throughput segment doesn't render at all). */
278
+ get effectiveTokensPerSecond() {
279
+ if (this.tokensPerSecond != null && Number.isFinite(this.tokensPerSecond)) {
280
+ return this.tokensPerSecond;
281
+ }
282
+ if (this.tokenCount != null && Number.isFinite(this.tokenCount)) {
283
+ const elapsedSeconds = this.elapsedMs / 1000;
284
+ if (elapsedSeconds >= 1)
285
+ return this.tokenCount / elapsedSeconds;
286
+ }
287
+ return undefined;
288
+ }
289
+ render() {
290
+ const hasTokens = this.tokenCount != null && Number.isFinite(this.tokenCount);
291
+ const throughput = this.effectiveTokensPerSecond;
292
+ const hasThroughput = throughput !== undefined;
293
+ return html `
294
+ <div part="base">
295
+ <span part="elapsed">${formatElapsed(this.elapsedMs)}</span>
296
+ ${hasTokens ? html `<span part="tokens">${formatTokenCount(this.tokenCount)}</span>` : nothing}
297
+ ${hasThroughput ? html `<span part="throughput">${formatThroughput(throughput)}</span>` : nothing}
298
+ ${this.showStop
299
+ ? html `
300
+ <button part="stop-button" type="button" aria-label="Stop generating" @click=${this.onStopClick}>
301
+ ${stopIcon()}
302
+ </button>
303
+ `
304
+ : nothing}
305
+ </div>
306
+ `;
307
+ }
308
+ }
309
+ __decorate([
310
+ property({ type: Boolean, reflect: true })
311
+ ], LyraGenerationStatus.prototype, "active", void 0);
312
+ __decorate([
313
+ property({ type: Number, attribute: 'started-at' })
314
+ ], LyraGenerationStatus.prototype, "startedAt", void 0);
315
+ __decorate([
316
+ property({ type: Number, attribute: 'token-count' })
317
+ ], LyraGenerationStatus.prototype, "tokenCount", void 0);
318
+ __decorate([
319
+ property({ type: Number, attribute: 'tokens-per-second' })
320
+ ], LyraGenerationStatus.prototype, "tokensPerSecond", void 0);
321
+ __decorate([
322
+ property({ attribute: 'show-stop', converter: showStopConverter })
323
+ ], LyraGenerationStatus.prototype, "showStop", void 0);
324
+ __decorate([
325
+ state()
326
+ ], LyraGenerationStatus.prototype, "elapsedMs", void 0);
327
+ defineElement('generation-status', LyraGenerationStatus);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,84 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: inline-flex;
5
+ vertical-align: middle;
6
+ max-inline-size: 100%;
7
+ }
8
+
9
+ [part='base'] {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ max-inline-size: 100%;
13
+ font-size: 0.8125rem;
14
+ line-height: 1.3;
15
+ color: var(--lyra-color-text-quiet);
16
+ }
17
+
18
+ [part='elapsed'] {
19
+ /* Full-strength text, not the quieter --lyra-color-text-quiet the rest
20
+ of the readout uses -- elapsed time is the one figure this component
21
+ always shows (tokens/throughput are optional), so it gets the higher-
22
+ contrast treatment to read as the primary value at a glance. */
23
+ color: var(--lyra-color-text);
24
+ font-variant-numeric: tabular-nums;
25
+ white-space: nowrap;
26
+ }
27
+ [part='tokens'],
28
+ [part='throughput'] {
29
+ font-variant-numeric: tabular-nums;
30
+ white-space: nowrap;
31
+ }
32
+
33
+ /* Segments are joined with a middot rather than a flex gap + separate
34
+ separator element, so a segment that doesn't render (tokens/throughput
35
+ are both optional, see the class doc) never leaves a dangling
36
+ double-gap -- the dot only ever appears immediately before a segment
37
+ that's actually present. */
38
+ [part='tokens']::before,
39
+ [part='throughput']::before {
40
+ content: '·';
41
+ margin-inline: 0.4em;
42
+ opacity: 0.6;
43
+ }
44
+
45
+ [part='stop-button'] {
46
+ flex: 0 0 auto;
47
+ display: inline-flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ /* Same "shrink the shared icon-button token for a compact inline
51
+ control" idiom as lyra-attachment-chip's retry-/remove-button. */
52
+ min-inline-size: min(var(--lyra-icon-button-size), 1.75rem);
53
+ min-block-size: min(var(--lyra-icon-button-size), 1.75rem);
54
+ margin-inline-start: var(--lyra-space-s);
55
+ padding: 0;
56
+ border: 1px solid var(--lyra-color-border);
57
+ border-radius: 50%;
58
+ background: var(--lyra-color-surface);
59
+ color: var(--lyra-color-text);
60
+ cursor: pointer;
61
+ -webkit-tap-highlight-color: transparent;
62
+ transition:
63
+ background-color var(--lyra-transition-fast),
64
+ border-color var(--lyra-transition-fast),
65
+ color var(--lyra-transition-fast);
66
+ }
67
+ [part='stop-button']:hover {
68
+ border-color: var(--lyra-color-brand);
69
+ color: var(--lyra-color-brand);
70
+ }
71
+ [part='stop-button']:focus-visible {
72
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
73
+ outline-offset: var(--lyra-focus-ring-offset);
74
+ }
75
+ [part='stop-button'] svg {
76
+ display: block;
77
+ }
78
+
79
+ @media (prefers-reduced-motion: reduce) {
80
+ [part='stop-button'] {
81
+ transition: none !important;
82
+ }
83
+ }
84
+ `;