@aceshooting/lyra-ui 1.2.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/README.md +98 -14
  2. package/custom-elements.json +30279 -12124
  3. package/dist/components/app-rail/app-rail-item.d.ts +30 -0
  4. package/dist/components/app-rail/app-rail-item.js +68 -0
  5. package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
  6. package/dist/components/app-rail/app-rail-item.styles.js +65 -0
  7. package/dist/components/app-rail/app-rail.d.ts +168 -0
  8. package/dist/components/app-rail/app-rail.js +419 -0
  9. package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
  10. package/dist/components/app-rail/app-rail.styles.js +128 -0
  11. package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
  12. package/dist/components/attachment-chip/attachment-chip.js +356 -0
  13. package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
  14. package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
  15. package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
  16. package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
  17. package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
  18. package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
  19. package/dist/components/chart/bar-chart.js +2 -18
  20. package/dist/components/chart/box-plot.d.ts +25 -1
  21. package/dist/components/chart/box-plot.js +147 -7
  22. package/dist/components/chart/box-plot.styles.js +13 -0
  23. package/dist/components/chart/bubble-chart.js +2 -18
  24. package/dist/components/chart/chart-loader.d.ts +44 -13
  25. package/dist/components/chart/chart-loader.js +65 -18
  26. package/dist/components/chart/chart.d.ts +55 -12
  27. package/dist/components/chart/chart.js +247 -49
  28. package/dist/components/chart/doughnut-chart.js +2 -18
  29. package/dist/components/chart/histogram-bin.d.ts +7 -1
  30. package/dist/components/chart/histogram-bin.js +32 -14
  31. package/dist/components/chart/histogram.js +8 -16
  32. package/dist/components/chart/line-chart.js +2 -18
  33. package/dist/components/chart/lite-chart.d.ts +134 -3
  34. package/dist/components/chart/lite-chart.js +382 -67
  35. package/dist/components/chart/lite-chart.styles.js +9 -0
  36. package/dist/components/chart/pie-chart.js +2 -18
  37. package/dist/components/chart/polar-area-chart.js +2 -18
  38. package/dist/components/chart/radar-chart.js +2 -18
  39. package/dist/components/chart/scatter-chart.js +2 -18
  40. package/dist/components/chat-composer/chat-composer.d.ts +133 -0
  41. package/dist/components/chat-composer/chat-composer.js +366 -0
  42. package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
  43. package/dist/components/chat-composer/chat-composer.styles.js +145 -0
  44. package/dist/components/chat-message/chat-message.d.ts +141 -0
  45. package/dist/components/chat-message/chat-message.js +331 -0
  46. package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
  47. package/dist/components/chat-message/chat-message.styles.js +203 -0
  48. package/dist/components/checkbox/checkbox.d.ts +117 -0
  49. package/dist/components/checkbox/checkbox.js +353 -0
  50. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  51. package/dist/components/checkbox/checkbox.styles.js +77 -0
  52. package/dist/components/chip/chip-group.d.ts +56 -0
  53. package/dist/components/chip/chip-group.js +130 -0
  54. package/dist/components/chip/chip-group.styles.d.ts +1 -0
  55. package/dist/components/chip/chip-group.styles.js +57 -0
  56. package/dist/components/chip/chip.d.ts +64 -0
  57. package/dist/components/chip/chip.js +122 -0
  58. package/dist/components/chip/chip.styles.d.ts +1 -0
  59. package/dist/components/chip/chip.styles.js +115 -0
  60. package/dist/components/citation-badge/citation-badge.d.ts +113 -0
  61. package/dist/components/citation-badge/citation-badge.js +318 -0
  62. package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
  63. package/dist/components/citation-badge/citation-badge.styles.js +96 -0
  64. package/dist/components/code-block/code-block.d.ts +127 -0
  65. package/dist/components/code-block/code-block.js +382 -0
  66. package/dist/components/code-block/code-block.styles.d.ts +1 -0
  67. package/dist/components/code-block/code-block.styles.js +187 -0
  68. package/dist/components/code-block/code-loader.d.ts +87 -0
  69. package/dist/components/code-block/code-loader.js +142 -0
  70. package/dist/components/combobox/combobox.d.ts +65 -6
  71. package/dist/components/combobox/combobox.js +258 -48
  72. package/dist/components/combobox/combobox.styles.js +3 -3
  73. package/dist/components/combobox/option.d.ts +5 -1
  74. package/dist/components/combobox/option.js +35 -0
  75. package/dist/components/context-meter/context-meter.d.ts +53 -0
  76. package/dist/components/context-meter/context-meter.js +159 -0
  77. package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
  78. package/dist/components/context-meter/context-meter.styles.js +114 -0
  79. package/dist/components/conversation-item/conversation-item.d.ts +125 -0
  80. package/dist/components/conversation-item/conversation-item.js +331 -0
  81. package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
  82. package/dist/components/conversation-item/conversation-item.styles.js +155 -0
  83. package/dist/components/date-picker/calendar-core.d.ts +24 -0
  84. package/dist/components/date-picker/calendar-core.js +51 -4
  85. package/dist/components/date-picker/date-input.d.ts +100 -9
  86. package/dist/components/date-picker/date-input.js +383 -66
  87. package/dist/components/date-picker/date-picker.d.ts +35 -4
  88. package/dist/components/date-picker/date-picker.js +171 -44
  89. package/dist/components/dialog/confirm.d.ts +40 -0
  90. package/dist/components/dialog/confirm.js +76 -0
  91. package/dist/components/dialog/dialog.d.ts +129 -0
  92. package/dist/components/dialog/dialog.js +288 -0
  93. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  94. package/dist/components/dialog/dialog.styles.js +96 -0
  95. package/dist/components/dock-panel/dock-panel.d.ts +142 -0
  96. package/dist/components/dock-panel/dock-panel.js +359 -0
  97. package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
  98. package/dist/components/dock-panel/dock-panel.styles.js +159 -0
  99. package/dist/components/document-preview/document-preview.d.ts +143 -0
  100. package/dist/components/document-preview/document-preview.js +388 -0
  101. package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
  102. package/dist/components/document-preview/document-preview.styles.js +191 -0
  103. package/dist/components/empty/empty.d.ts +1 -2
  104. package/dist/components/empty/empty.js +18 -12
  105. package/dist/components/empty/empty.styles.js +0 -3
  106. package/dist/components/export-button/csv.js +1 -1
  107. package/dist/components/export-button/export-button.d.ts +12 -0
  108. package/dist/components/export-button/export-button.js +35 -5
  109. package/dist/components/export-button/export-button.styles.js +5 -1
  110. package/dist/components/file-input/accept.js +2 -0
  111. package/dist/components/file-input/file-input.d.ts +10 -1
  112. package/dist/components/file-input/file-input.js +36 -5
  113. package/dist/components/flag/flag.d.ts +29 -13
  114. package/dist/components/flag/flag.js +54 -14
  115. package/dist/components/flag/flag.styles.js +1 -1
  116. package/dist/components/flag/language-map.d.ts +4 -1
  117. package/dist/components/flag/language-map.js +6 -3
  118. package/dist/components/gauge/gauge.d.ts +10 -1
  119. package/dist/components/gauge/gauge.js +41 -13
  120. package/dist/components/generation-status/generation-status.d.ts +117 -0
  121. package/dist/components/generation-status/generation-status.js +327 -0
  122. package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
  123. package/dist/components/generation-status/generation-status.styles.js +84 -0
  124. package/dist/components/graph/graph.d.ts +37 -3
  125. package/dist/components/graph/graph.js +132 -20
  126. package/dist/components/heatmap/calendar-grid.d.ts +19 -7
  127. package/dist/components/heatmap/calendar-grid.js +42 -18
  128. package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
  129. package/dist/components/heatmap/heatmap-scale.js +14 -2
  130. package/dist/components/heatmap/heatmap.d.ts +227 -12
  131. package/dist/components/heatmap/heatmap.js +488 -93
  132. package/dist/components/json-viewer/json-viewer.d.ts +70 -0
  133. package/dist/components/json-viewer/json-viewer.js +361 -0
  134. package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
  135. package/dist/components/json-viewer/json-viewer.styles.js +177 -0
  136. package/dist/components/kbd/kbd.d.ts +77 -0
  137. package/dist/components/kbd/kbd.js +231 -0
  138. package/dist/components/kbd/kbd.styles.d.ts +1 -0
  139. package/dist/components/kbd/kbd.styles.js +52 -0
  140. package/dist/components/live-region/live-region.d.ts +90 -0
  141. package/dist/components/live-region/live-region.js +189 -0
  142. package/dist/components/live-region/live-region.styles.d.ts +1 -0
  143. package/dist/components/live-region/live-region.styles.js +10 -0
  144. package/dist/components/map/map.d.ts +32 -7
  145. package/dist/components/map/map.js +133 -32
  146. package/dist/components/markdown/markdown-loader.d.ts +58 -0
  147. package/dist/components/markdown/markdown-loader.js +77 -0
  148. package/dist/components/markdown/markdown.d.ts +119 -0
  149. package/dist/components/markdown/markdown.js +389 -0
  150. package/dist/components/markdown/markdown.styles.d.ts +1 -0
  151. package/dist/components/markdown/markdown.styles.js +88 -0
  152. package/dist/components/media-card/media-card.d.ts +130 -0
  153. package/dist/components/media-card/media-card.js +273 -0
  154. package/dist/components/media-card/media-card.styles.d.ts +1 -0
  155. package/dist/components/media-card/media-card.styles.js +132 -0
  156. package/dist/components/mention-popover/mention-popover.d.ts +203 -0
  157. package/dist/components/mention-popover/mention-popover.js +493 -0
  158. package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
  159. package/dist/components/mention-popover/mention-popover.styles.js +101 -0
  160. package/dist/components/menu/menu-item.d.ts +91 -0
  161. package/dist/components/menu/menu-item.js +206 -0
  162. package/dist/components/menu/menu-item.styles.d.ts +1 -0
  163. package/dist/components/menu/menu-item.styles.js +75 -0
  164. package/dist/components/menu/menu.d.ts +167 -0
  165. package/dist/components/menu/menu.js +461 -0
  166. package/dist/components/menu/menu.styles.d.ts +1 -0
  167. package/dist/components/menu/menu.styles.js +67 -0
  168. package/dist/components/model-select/model-select.d.ts +170 -0
  169. package/dist/components/model-select/model-select.js +588 -0
  170. package/dist/components/model-select/model-select.styles.d.ts +1 -0
  171. package/dist/components/model-select/model-select.styles.js +203 -0
  172. package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
  173. package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
  174. package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
  175. package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
  176. package/dist/components/playback/playback.d.ts +19 -3
  177. package/dist/components/playback/playback.js +109 -33
  178. package/dist/components/playback/playback.styles.js +6 -1
  179. package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
  180. package/dist/components/responsive-panel/responsive-panel.js +363 -0
  181. package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
  182. package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
  183. package/dist/components/result-card/result-card.d.ts +50 -0
  184. package/dist/components/result-card/result-card.js +89 -0
  185. package/dist/components/result-card/result-card.styles.d.ts +1 -0
  186. package/dist/components/result-card/result-card.styles.js +49 -0
  187. package/dist/components/result-card/result-field.d.ts +36 -0
  188. package/dist/components/result-card/result-field.js +87 -0
  189. package/dist/components/result-card/result-field.styles.d.ts +1 -0
  190. package/dist/components/result-card/result-field.styles.js +32 -0
  191. package/dist/components/select/select.d.ts +84 -4
  192. package/dist/components/select/select.js +251 -36
  193. package/dist/components/skeleton/skeleton.d.ts +3 -0
  194. package/dist/components/skeleton/skeleton.js +7 -1
  195. package/dist/components/skeleton/skeleton.styles.js +5 -4
  196. package/dist/components/slider/slider.d.ts +141 -0
  197. package/dist/components/slider/slider.js +467 -0
  198. package/dist/components/slider/slider.styles.d.ts +1 -0
  199. package/dist/components/slider/slider.styles.js +87 -0
  200. package/dist/components/source-card/source-card.d.ts +104 -0
  201. package/dist/components/source-card/source-card.js +195 -0
  202. package/dist/components/source-card/source-card.styles.d.ts +1 -0
  203. package/dist/components/source-card/source-card.styles.js +69 -0
  204. package/dist/components/source-list/source-list.d.ts +63 -0
  205. package/dist/components/source-list/source-list.js +130 -0
  206. package/dist/components/source-list/source-list.styles.d.ts +1 -0
  207. package/dist/components/source-list/source-list.styles.js +59 -0
  208. package/dist/components/sparkline/sparkline.js +58 -20
  209. package/dist/components/split/split.d.ts +224 -5
  210. package/dist/components/split/split.js +617 -43
  211. package/dist/components/split/split.styles.js +47 -0
  212. package/dist/components/stat/stat.d.ts +15 -4
  213. package/dist/components/stat/stat.js +53 -12
  214. package/dist/components/stream-status/stream-status.d.ts +126 -0
  215. package/dist/components/stream-status/stream-status.js +292 -0
  216. package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
  217. package/dist/components/stream-status/stream-status.styles.js +103 -0
  218. package/dist/components/streaming-text/streaming-text.d.ts +104 -0
  219. package/dist/components/streaming-text/streaming-text.js +224 -0
  220. package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
  221. package/dist/components/streaming-text/streaming-text.styles.js +63 -0
  222. package/dist/components/switch/switch.d.ts +103 -0
  223. package/dist/components/switch/switch.js +250 -0
  224. package/dist/components/switch/switch.styles.d.ts +1 -0
  225. package/dist/components/switch/switch.styles.js +75 -0
  226. package/dist/components/table/table.d.ts +89 -5
  227. package/dist/components/table/table.js +243 -26
  228. package/dist/components/table/table.styles.js +6 -1
  229. package/dist/components/tabs/tabs.d.ts +74 -0
  230. package/dist/components/tabs/tabs.js +254 -0
  231. package/dist/components/tabs/tabs.styles.d.ts +1 -0
  232. package/dist/components/tabs/tabs.styles.js +74 -0
  233. package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
  234. package/dist/components/thinking-panel/thinking-panel.js +260 -0
  235. package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
  236. package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
  237. package/dist/components/time-range/time-range.d.ts +59 -2
  238. package/dist/components/time-range/time-range.js +163 -67
  239. package/dist/components/toast/toast-item.d.ts +12 -2
  240. package/dist/components/toast/toast-item.js +106 -44
  241. package/dist/components/toast/toast-item.styles.js +59 -28
  242. package/dist/components/toast/toast.js +17 -5
  243. package/dist/components/toast/toaster.js +10 -1
  244. package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
  245. package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
  246. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
  247. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
  248. package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
  249. package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
  250. package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
  251. package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
  252. package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
  253. package/dist/components/tool-param-form/tool-param-form.js +610 -0
  254. package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
  255. package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
  256. package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
  257. package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
  258. package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
  259. package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
  260. package/dist/components/tool-result-view/registry.d.ts +73 -0
  261. package/dist/components/tool-result-view/registry.js +89 -0
  262. package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
  263. package/dist/components/tool-result-view/tool-result-view.js +152 -0
  264. package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
  265. package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
  266. package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
  267. package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
  268. package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
  269. package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
  270. package/dist/components/tree/tree-node.d.ts +15 -3
  271. package/dist/components/tree/tree-node.js +20 -7
  272. package/dist/components/tree/tree.d.ts +25 -10
  273. package/dist/components/tree/tree.js +39 -31
  274. package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
  275. package/dist/components/typing-indicator/typing-indicator.js +108 -0
  276. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
  277. package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
  278. package/dist/components/virtual-list/virtual-list.d.ts +210 -0
  279. package/dist/components/virtual-list/virtual-list.js +607 -0
  280. package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
  281. package/dist/components/virtual-list/virtual-list.styles.js +56 -0
  282. package/dist/components/widget/widget.d.ts +5 -4
  283. package/dist/components/widget/widget.js +54 -120
  284. package/dist/components/widget/widget.styles.js +8 -2
  285. package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
  286. package/dist/components/word-cloud/word-cloud-layout.js +29 -2
  287. package/dist/components/word-cloud/word-cloud.d.ts +28 -2
  288. package/dist/components/word-cloud/word-cloud.js +69 -19
  289. package/dist/components/word-cloud/word-cloud.styles.js +16 -3
  290. package/dist/internal/anchored-validity.d.ts +1 -0
  291. package/dist/internal/anchored-validity.js +86 -0
  292. package/dist/internal/announcer.d.ts +57 -0
  293. package/dist/internal/announcer.js +71 -0
  294. package/dist/internal/form-associated.d.ts +8 -0
  295. package/dist/internal/form-associated.js +98 -15
  296. package/dist/internal/group-by-recency.d.ts +50 -0
  297. package/dist/internal/group-by-recency.js +80 -0
  298. package/dist/internal/numbers.d.ts +12 -0
  299. package/dist/internal/numbers.js +26 -0
  300. package/dist/internal/overlay-manager.d.ts +51 -0
  301. package/dist/internal/overlay-manager.js +523 -0
  302. package/dist/internal/positioner.js +27 -3
  303. package/dist/internal/rtl.d.ts +23 -0
  304. package/dist/internal/rtl.js +28 -0
  305. package/dist/internal/safe-url.d.ts +12 -0
  306. package/dist/internal/safe-url.js +41 -0
  307. package/dist/internal/scroll-lock.d.ts +10 -5
  308. package/dist/internal/scroll-lock.js +30 -14
  309. package/dist/internal/tokens.styles.js +22 -10
  310. package/dist/lyra.d.ts +133 -31
  311. package/dist/lyra.js +96 -26
  312. package/llms-full.txt +4546 -183
  313. package/llms.txt +21 -5
  314. package/package.json +41 -6
  315. package/dist/components/chart/bar-chart.stories.d.ts +0 -5
  316. package/dist/components/chart/bar-chart.stories.js +0 -20
  317. package/dist/components/chart/box-plot.stories.d.ts +0 -5
  318. package/dist/components/chart/box-plot.stories.js +0 -29
  319. package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
  320. package/dist/components/chart/bubble-chart.stories.js +0 -26
  321. package/dist/components/chart/chart.stories.d.ts +0 -32
  322. package/dist/components/chart/chart.stories.js +0 -141
  323. package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
  324. package/dist/components/chart/doughnut-chart.stories.js +0 -26
  325. package/dist/components/chart/histogram.stories.d.ts +0 -5
  326. package/dist/components/chart/histogram.stories.js +0 -17
  327. package/dist/components/chart/line-chart.stories.d.ts +0 -22
  328. package/dist/components/chart/line-chart.stories.js +0 -99
  329. package/dist/components/chart/lite-chart.stories.d.ts +0 -14
  330. package/dist/components/chart/lite-chart.stories.js +0 -114
  331. package/dist/components/chart/pie-chart.stories.d.ts +0 -5
  332. package/dist/components/chart/pie-chart.stories.js +0 -26
  333. package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
  334. package/dist/components/chart/polar-area-chart.stories.js +0 -20
  335. package/dist/components/chart/radar-chart.stories.d.ts +0 -5
  336. package/dist/components/chart/radar-chart.stories.js +0 -20
  337. package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
  338. package/dist/components/chart/scatter-chart.stories.js +0 -31
  339. package/dist/components/combobox/combobox.stories.d.ts +0 -24
  340. package/dist/components/combobox/combobox.stories.js +0 -102
  341. package/dist/components/date-picker/date-input.stories.d.ts +0 -10
  342. package/dist/components/date-picker/date-input.stories.js +0 -48
  343. package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
  344. package/dist/components/date-picker/date-picker.stories.js +0 -25
  345. package/dist/components/empty/empty.stories.d.ts +0 -7
  346. package/dist/components/empty/empty.stories.js +0 -34
  347. package/dist/components/export-button/export-button.stories.d.ts +0 -7
  348. package/dist/components/export-button/export-button.stories.js +0 -37
  349. package/dist/components/file-input/file-input.stories.d.ts +0 -7
  350. package/dist/components/file-input/file-input.stories.js +0 -19
  351. package/dist/components/flag/flag.stories.d.ts +0 -6
  352. package/dist/components/flag/flag.stories.js +0 -31
  353. package/dist/components/gauge/gauge.stories.d.ts +0 -8
  354. package/dist/components/gauge/gauge.stories.js +0 -19
  355. package/dist/components/graph/graph.stories.d.ts +0 -8
  356. package/dist/components/graph/graph.stories.js +0 -68
  357. package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
  358. package/dist/components/heatmap/heatmap.stories.js +0 -179
  359. package/dist/components/map/map.stories.d.ts +0 -15
  360. package/dist/components/map/map.stories.js +0 -135
  361. package/dist/components/playback/playback.stories.d.ts +0 -7
  362. package/dist/components/playback/playback.stories.js +0 -16
  363. package/dist/components/select/select.stories.d.ts +0 -21
  364. package/dist/components/select/select.stories.js +0 -91
  365. package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
  366. package/dist/components/skeleton/skeleton.stories.js +0 -16
  367. package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
  368. package/dist/components/sparkline/sparkline.stories.js +0 -39
  369. package/dist/components/split/split.stories.d.ts +0 -7
  370. package/dist/components/split/split.stories.js +0 -36
  371. package/dist/components/stat/stat.stories.d.ts +0 -9
  372. package/dist/components/stat/stat.stories.js +0 -81
  373. package/dist/components/table/table.stories.d.ts +0 -12
  374. package/dist/components/table/table.stories.js +0 -67
  375. package/dist/components/time-range/time-range.stories.d.ts +0 -8
  376. package/dist/components/time-range/time-range.stories.js +0 -26
  377. package/dist/components/toast/toast.stories.d.ts +0 -8
  378. package/dist/components/toast/toast.stories.js +0 -72
  379. package/dist/components/tree/tree.stories.d.ts +0 -9
  380. package/dist/components/tree/tree.stories.js +0 -52
  381. package/dist/components/widget/widget.stories.d.ts +0 -9
  382. package/dist/components/widget/widget.stories.js +0 -74
  383. package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
  384. package/dist/components/word-cloud/word-cloud.stories.js +0 -55
@@ -0,0 +1,77 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ /** A single rendered key token: the compact glyph shown in the key cap, and
4
+ * the spelled-out word used in the chip's `aria-label` (glyphs like `⌘`/
5
+ * `⇧`/`⌥` are not reliably announced across every screen reader/platform
6
+ * combination, so the accessible name always spells them out in full). */
7
+ export interface KbdKeyLabel {
8
+ visual: string;
9
+ word: string;
10
+ }
11
+ /**
12
+ * Resolves one `+`-separated token of a `keys` string to its rendered glyph
13
+ * and spelled-out word, given whether the shortcut is being shown on macOS.
14
+ *
15
+ * Exported as a pure function (parameterized on `isMac` rather than reading
16
+ * the module-scope platform constant directly) so both the macOS and
17
+ * non-macOS branches are directly unit-testable without having to spoof
18
+ * `navigator` in a browser test environment that only ever runs as one
19
+ * platform.
20
+ */
21
+ export declare function shortcutTokenLabel(rawToken: string, isMac: boolean): KbdKeyLabel;
22
+ /** Splits a `keys` string (e.g. `'mod+shift+p'`) into its resolved token
23
+ * labels, dropping empty segments from stray/leading/trailing `+`s. */
24
+ export declare function parseShortcut(keys: string, isMac: boolean): KbdKeyLabel[];
25
+ /**
26
+ * `<lyra-kbd>` — a small chip representing a keyboard shortcut, rendering
27
+ * the platform-appropriate glyph for cross-platform modifier keys (⌘ on
28
+ * macOS, "Ctrl" elsewhere) from a single platform-neutral `keys` string.
29
+ *
30
+ * `keys` is a `+`-separated sequence of tokens, e.g. `"mod+k"` or
31
+ * `"mod+shift+p"`. Recognized modifier tokens: `mod` (the platform-neutral
32
+ * primary modifier — ⌘ on macOS, "Ctrl" elsewhere), `alt` (⌥ / "Alt"),
33
+ * `shift` (⇧ on every platform), and `ctrl` (always the literal Control
34
+ * key, distinct from `mod`, for a shortcut that's specifically Ctrl even on
35
+ * macOS). Any other token renders as typed, except a bare single
36
+ * letter/digit which is upper-cased, with a small built-in map of friendly
37
+ * labels for common named keys (`enter` → `↵`, `esc` → "Esc", the four
38
+ * arrow keys → arrow glyphs, plus `tab`/`space`/`backspace`/`delete`/`home`/
39
+ * `end`/`pageup`/`pagedown`/`plus`/`minus`). `enter` renders as its `↵`
40
+ * glyph (not the word "Enter") to match the other single-glyph modifier/
41
+ * arrow keys visually — its spelled-out word form still appears in the
42
+ * computed `aria-label`.
43
+ *
44
+ * Each token renders as its own key cap (`part="key"`); consecutive caps
45
+ * are joined by a small "+" separator between them, matching how most
46
+ * cross-platform shortcut documentation (including on macOS, despite the
47
+ * OS's own native shortcut hints usually running the glyphs together with
48
+ * no separator) reads unambiguously regardless of how many/which glyphs are
49
+ * involved.
50
+ *
51
+ * The default slot is not used for the normal glyph rendering above — it's
52
+ * an escape hatch for fully custom content (e.g. an icon instead of a text
53
+ * glyph) that, when non-empty, replaces the `keys`-driven rendering
54
+ * entirely and stops this component from asserting its own `aria-label`,
55
+ * leaving the slotted content to carry its own accessible name.
56
+ *
57
+ * @customElement lyra-kbd
58
+ * @slot - Optional override for fully custom key-cap content, replacing the
59
+ * `keys`-driven rendering. Leave empty to use `keys`.
60
+ * @csspart base - The chip's root element.
61
+ * @csspart key - Each rendered key cap (one per token in `keys`).
62
+ */
63
+ export declare class LyraKbd extends LyraElement {
64
+ static styles: import("lit").CSSResultGroup[];
65
+ /** A `+`-separated shortcut, e.g. `'mod+k'`. See the class doc for the
66
+ * full token grammar. */
67
+ keys: string;
68
+ private hasCustomContent;
69
+ protected willUpdate(): void;
70
+ private onSlotChange;
71
+ render(): TemplateResult;
72
+ }
73
+ declare global {
74
+ interface HTMLElementTagNameMap {
75
+ 'lyra-kbd': LyraKbd;
76
+ }
77
+ }
@@ -0,0 +1,231 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, nothing } from 'lit';
8
+ import { 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 './kbd.styles.js';
12
+ // A deliberately small map — just the modifier-adjacent/navigation keys
13
+ // common enough in real shortcuts to be worth a friendly glyph. Anything not
14
+ // listed here (e.g. 'f1', 'k', a punctuation key) falls through to the
15
+ // generic "render as typed, upper-case single letters" rule in
16
+ // `shortcutTokenLabel` below, per this component's spec.
17
+ //
18
+ // 'plus'/'minus' exist specifically so a shortcut that includes a literal
19
+ // "+" or "-" key (e.g. the classic zoom-in shortcut) has a way to say so:
20
+ // the '+'-separated `keys` grammar can't itself carry a literal "+" token
21
+ // (it's the delimiter), so callers spell it as the word instead.
22
+ const NAMED_KEY_LABELS = {
23
+ enter: { visual: '↵', word: 'Enter' },
24
+ esc: { visual: 'Esc', word: 'Escape' },
25
+ escape: { visual: 'Esc', word: 'Escape' },
26
+ tab: { visual: 'Tab', word: 'Tab' },
27
+ space: { visual: 'Space', word: 'Space' },
28
+ backspace: { visual: '⌫', word: 'Backspace' },
29
+ delete: { visual: 'Del', word: 'Delete' },
30
+ home: { visual: 'Home', word: 'Home' },
31
+ end: { visual: 'End', word: 'End' },
32
+ pageup: { visual: 'PgUp', word: 'Page Up' },
33
+ pagedown: { visual: 'PgDn', word: 'Page Down' },
34
+ arrowup: { visual: '↑', word: 'Arrow Up' },
35
+ arrowdown: { visual: '↓', word: 'Arrow Down' },
36
+ arrowleft: { visual: '←', word: 'Arrow Left' },
37
+ arrowright: { visual: '→', word: 'Arrow Right' },
38
+ plus: { visual: '+', word: 'Plus' },
39
+ minus: { visual: '−', word: 'Minus' },
40
+ };
41
+ /**
42
+ * Resolves one `+`-separated token of a `keys` string to its rendered glyph
43
+ * and spelled-out word, given whether the shortcut is being shown on macOS.
44
+ *
45
+ * Exported as a pure function (parameterized on `isMac` rather than reading
46
+ * the module-scope platform constant directly) so both the macOS and
47
+ * non-macOS branches are directly unit-testable without having to spoof
48
+ * `navigator` in a browser test environment that only ever runs as one
49
+ * platform.
50
+ */
51
+ export function shortcutTokenLabel(rawToken, isMac) {
52
+ const token = rawToken.trim();
53
+ const lower = token.toLowerCase();
54
+ // 'mod' is the platform-neutral primary modifier: Command on macOS,
55
+ // Control everywhere else. 'ctrl' is deliberately distinct — it always
56
+ // means the literal Control key, even on macOS, for shortcuts that are
57
+ // specifically Ctrl-based (e.g. terminal Ctrl+C) rather than
58
+ // platform-adapted.
59
+ if (lower === 'mod')
60
+ return isMac ? { visual: '⌘', word: 'Command' } : { visual: 'Ctrl', word: 'Control' };
61
+ if (lower === 'ctrl' || lower === 'control')
62
+ return { visual: 'Ctrl', word: 'Control' };
63
+ if (lower === 'alt')
64
+ return isMac ? { visual: '⌥', word: 'Option' } : { visual: 'Alt', word: 'Alt' };
65
+ if (lower === 'shift')
66
+ return { visual: '⇧', word: 'Shift' };
67
+ const named = NAMED_KEY_LABELS[lower];
68
+ if (named)
69
+ return named;
70
+ // Anything else renders as typed (preserving the caller's own casing),
71
+ // except a bare single letter/digit, which is upper-cased for a
72
+ // consistent key-cap look ('k' and 'K' both render 'K').
73
+ if (token.length === 1) {
74
+ const upper = token.toUpperCase();
75
+ return { visual: upper, word: upper };
76
+ }
77
+ return { visual: token, word: token };
78
+ }
79
+ /** Splits a `keys` string (e.g. `'mod+shift+p'`) into its resolved token
80
+ * labels, dropping empty segments from stray/leading/trailing `+`s. */
81
+ export function parseShortcut(keys, isMac) {
82
+ return keys
83
+ .split('+')
84
+ .map((t) => t.trim())
85
+ .filter((t) => t.length > 0)
86
+ .map((t) => shortcutTokenLabel(t, isMac));
87
+ }
88
+ /**
89
+ * Detects macOS to decide whether `mod`/`alt` render their Mac glyphs (⌘/⌥)
90
+ * or their generic-platform text (Ctrl/Alt). Prefers the modern
91
+ * `navigator.userAgentData` (Client Hints) API when the browser exposes it,
92
+ * falling back through `navigator.platform` and finally a `navigator.userAgent`
93
+ * substring check — all three are deprecated/non-standard to varying
94
+ * degrees (`userAgentData` is Chromium-only so far; `platform` is
95
+ * long-deprecated; `userAgent` sniffing is a last resort) but remain, in
96
+ * combination, the practical cross-browser way to answer "is this macOS"
97
+ * today with no dependency.
98
+ */
99
+ function detectIsMac() {
100
+ if (typeof navigator === 'undefined')
101
+ return false;
102
+ const uaData = navigator.userAgentData;
103
+ if (uaData?.platform)
104
+ return uaData.platform.toLowerCase().includes('mac');
105
+ if (navigator.platform)
106
+ return /mac/i.test(navigator.platform);
107
+ return /mac/i.test(navigator.userAgent ?? '');
108
+ }
109
+ // Computed once at module scope, not per-instance/per-render — a page's
110
+ // platform never changes mid-session, so there is nothing to gain (and a
111
+ // little cost, however small) from re-detecting it on every <lyra-kbd>
112
+ // instance or every re-render.
113
+ const IS_MAC = detectIsMac();
114
+ // The one "is there real content" predicate shared by both the initial
115
+ // synchronous seed (willUpdate, reading light-DOM childNodes) and the
116
+ // runtime slotchange handler (reading assignedNodes) — using two different
117
+ // predicates for the same question let them disagree: a text-only check
118
+ // would seed correctly for whitespace-only text but (wrongly) treat a
119
+ // content-less icon element as empty, and a node-count-only check would
120
+ // treat *any* assigned node — including a whitespace-only text node — as
121
+ // real content. Counting every element node as real content (regardless of
122
+ // its own text) while requiring non-whitespace text from text nodes gets
123
+ // both cases right in one place.
124
+ const hasRealContent = (nodes) => Array.from(nodes).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim().length > 0);
125
+ /**
126
+ * `<lyra-kbd>` — a small chip representing a keyboard shortcut, rendering
127
+ * the platform-appropriate glyph for cross-platform modifier keys (⌘ on
128
+ * macOS, "Ctrl" elsewhere) from a single platform-neutral `keys` string.
129
+ *
130
+ * `keys` is a `+`-separated sequence of tokens, e.g. `"mod+k"` or
131
+ * `"mod+shift+p"`. Recognized modifier tokens: `mod` (the platform-neutral
132
+ * primary modifier — ⌘ on macOS, "Ctrl" elsewhere), `alt` (⌥ / "Alt"),
133
+ * `shift` (⇧ on every platform), and `ctrl` (always the literal Control
134
+ * key, distinct from `mod`, for a shortcut that's specifically Ctrl even on
135
+ * macOS). Any other token renders as typed, except a bare single
136
+ * letter/digit which is upper-cased, with a small built-in map of friendly
137
+ * labels for common named keys (`enter` → `↵`, `esc` → "Esc", the four
138
+ * arrow keys → arrow glyphs, plus `tab`/`space`/`backspace`/`delete`/`home`/
139
+ * `end`/`pageup`/`pagedown`/`plus`/`minus`). `enter` renders as its `↵`
140
+ * glyph (not the word "Enter") to match the other single-glyph modifier/
141
+ * arrow keys visually — its spelled-out word form still appears in the
142
+ * computed `aria-label`.
143
+ *
144
+ * Each token renders as its own key cap (`part="key"`); consecutive caps
145
+ * are joined by a small "+" separator between them, matching how most
146
+ * cross-platform shortcut documentation (including on macOS, despite the
147
+ * OS's own native shortcut hints usually running the glyphs together with
148
+ * no separator) reads unambiguously regardless of how many/which glyphs are
149
+ * involved.
150
+ *
151
+ * The default slot is not used for the normal glyph rendering above — it's
152
+ * an escape hatch for fully custom content (e.g. an icon instead of a text
153
+ * glyph) that, when non-empty, replaces the `keys`-driven rendering
154
+ * entirely and stops this component from asserting its own `aria-label`,
155
+ * leaving the slotted content to carry its own accessible name.
156
+ *
157
+ * @customElement lyra-kbd
158
+ * @slot - Optional override for fully custom key-cap content, replacing the
159
+ * `keys`-driven rendering. Leave empty to use `keys`.
160
+ * @csspart base - The chip's root element.
161
+ * @csspart key - Each rendered key cap (one per token in `keys`).
162
+ */
163
+ export class LyraKbd extends LyraElement {
164
+ constructor() {
165
+ super(...arguments);
166
+ /** A `+`-separated shortcut, e.g. `'mod+k'`. See the class doc for the
167
+ * full token grammar. */
168
+ this.keys = '';
169
+ // Real (non-whitespace) light-DOM content overrides the keys-driven
170
+ // rendering below — same "seed synchronously, refine on slotchange"
171
+ // pattern as lyra-checkbox's hasLabelSlot/lyra-citation-badge's
172
+ // hasPreviewSlot, so a declaratively-slotted override doesn't flash the
173
+ // keys rendering for one frame before the first slotchange event.
174
+ this.hasCustomContent = false;
175
+ this.onSlotChange = (e) => {
176
+ this.hasCustomContent = hasRealContent(e.target.assignedNodes({ flatten: true }));
177
+ };
178
+ }
179
+ static { this.styles = [LyraElement.styles, styles]; }
180
+ willUpdate() {
181
+ if (!this.hasUpdated) {
182
+ this.hasCustomContent = hasRealContent(this.childNodes);
183
+ }
184
+ }
185
+ render() {
186
+ const explicitLabel = this.getAttribute('aria-label');
187
+ if (this.hasCustomContent) {
188
+ return html `
189
+ <span part="base" aria-label=${explicitLabel || nothing}>
190
+ <slot @slotchange=${this.onSlotChange}></slot>
191
+ </span>
192
+ `;
193
+ }
194
+ const tokens = parseShortcut(this.keys, IS_MAC);
195
+ // role="img" treats the chip as one opaque unit (matching
196
+ // lyra-context-meter's/lyra-chart's canvas usage of the same pattern):
197
+ // the individual glyphs and "+" separators aren't real words, so
198
+ // exposing them as separate accessible-tree text would read worse than
199
+ // the single spelled-out aria-label below. An empty `keys` (and no
200
+ // explicit override) renders nothing visible, so it's marked
201
+ // aria-hidden instead of exposed as a nameless image.
202
+ //
203
+ // role/aria-hidden are both derived from this same `ariaLabel` value
204
+ // (rather than each independently re-deriving "is there a label" from
205
+ // tokens.length/explicitLabel) so role="img" can never be absent while
206
+ // aria-label is present — that combination is an aria-prohibited-attr
207
+ // violation (a nameless-but-labeled, role-less element).
208
+ const ariaLabel = explicitLabel || tokens.map((t) => t.word).join('+');
209
+ return html `
210
+ <span
211
+ part="base"
212
+ role=${ariaLabel ? 'img' : nothing}
213
+ aria-hidden=${ariaLabel ? nothing : 'true'}
214
+ aria-label=${ariaLabel || nothing}
215
+ >
216
+ ${tokens.map((t, i) => html `
217
+ ${i > 0 ? html `<span class="sep" aria-hidden="true">+</span>` : nothing}
218
+ <span part="key">${t.visual}</span>
219
+ `)}
220
+ <slot @slotchange=${this.onSlotChange} hidden></slot>
221
+ </span>
222
+ `;
223
+ }
224
+ }
225
+ __decorate([
226
+ property()
227
+ ], LyraKbd.prototype, "keys", void 0);
228
+ __decorate([
229
+ state()
230
+ ], LyraKbd.prototype, "hasCustomContent", void 0);
231
+ defineElement('kbd', LyraKbd);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,52 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: inline-flex;
5
+ max-inline-size: 100%;
6
+ vertical-align: middle;
7
+ }
8
+
9
+ [part='base'] {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ flex-wrap: wrap;
13
+ /* The body font, not a monospace stack — unlike lyra-code-block's own
14
+ local --lyra-code-block-font token, a key cap's content is mostly
15
+ single characters and modifier glyphs (⌘⇧⌥), which read more legibly
16
+ — and have more complete glyph coverage — in the UI font than in a
17
+ monospace stack that may not even ship those symbols. */
18
+ font-family: var(--lyra-font);
19
+ font-size: 0.8125rem;
20
+ line-height: 1.3;
21
+ color: var(--lyra-color-text-quiet);
22
+ }
23
+
24
+ [part='key'] {
25
+ display: inline-flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ box-sizing: border-box;
29
+ min-inline-size: 1.5em;
30
+ padding: 0.0625rem var(--lyra-space-xs);
31
+ border: 1px solid var(--lyra-color-border);
32
+ border-radius: calc(var(--lyra-radius) * 0.6);
33
+ background: var(--lyra-color-surface);
34
+ color: var(--lyra-color-text);
35
+ font-weight: 500;
36
+ /* A subtle bottom-weighted inset shadow reads as a slightly-raised
37
+ physical key cap rather than a flat label chip, echoing the
38
+ lyra-chip/lyra-checkbox box's own bordered-box treatment. */
39
+ box-shadow: inset 0 -1px 0 var(--lyra-color-border);
40
+ }
41
+
42
+ .sep {
43
+ margin-inline: 0.1875rem;
44
+ color: var(--lyra-color-text-quiet);
45
+ font-size: 0.75em;
46
+ user-select: none;
47
+ }
48
+
49
+ ::slotted(*) {
50
+ vertical-align: middle;
51
+ }
52
+ `;
@@ -0,0 +1,90 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ import { type AnnounceOptions } from '../../internal/announcer.js';
4
+ export type LiveRegionMode = 'polite' | 'assertive';
5
+ /**
6
+ * `<lyra-live-region>` — a visually-hidden ARIA live region that throttles
7
+ * and coalesces announcements instead of relaying every call verbatim.
8
+ *
9
+ * Naive live regions plus token-by-token streaming text (a chat response, a
10
+ * progress readout, ...) equals screen-reader spam: every incremental chunk
11
+ * gets announced. This component wraps `Announcer`
12
+ * (`../../internal/announcer.js`) so callers can fire `announce()` as often
13
+ * as they like — only the latest text within each `throttle-ms` window
14
+ * actually reaches assistive tech, and a `{ force: true }` call (e.g. once a
15
+ * stream ends) always lands immediately regardless of any window in
16
+ * progress.
17
+ *
18
+ * A consumer typically mounts one `<lyra-live-region>` per page/surface
19
+ * (much like `<lyra-toast>` is one region per placement — see
20
+ * `../toast/toaster.ts`) and keeps a reference to call `announce()` from
21
+ * application code or a parent component:
22
+ *
23
+ * @example
24
+ * ```html
25
+ * <!-- once, near the root of a chat surface's shell -->
26
+ * <lyra-live-region id="chat-live" mode="polite"></lyra-live-region>
27
+ * ```
28
+ * ```ts
29
+ * const live = document.getElementById('chat-live') as LyraLiveRegion;
30
+ *
31
+ * // streaming tokens: fine to call on every chunk, only the trailing state lands
32
+ * live.announce(`${partialText} …`);
33
+ *
34
+ * // stream finished: always announced, even mid-throttle-window
35
+ * live.announce('Response complete', { force: true });
36
+ * ```
37
+ *
38
+ * A parent Lit component would instead hold the reference via `@query`:
39
+ * ```ts
40
+ * @query('lyra-live-region') private liveRegion!: LyraLiveRegion;
41
+ * ```
42
+ * and is exactly what later components in this family (a stream-status
43
+ * indicator, a tool-call chip's status transitions, a chat message's
44
+ * streaming state) are expected to do rather than hand-rolling their own
45
+ * `aria-live` element.
46
+ *
47
+ * @customElement lyra-live-region
48
+ * @csspart region - The visually-hidden element carrying `role`/`aria-live`.
49
+ */
50
+ export declare class LyraLiveRegion extends LyraElement {
51
+ static styles: import("lit").CSSResultGroup[];
52
+ /** `polite` (role="status") waits for the user to be idle; `assertive`
53
+ * (role="alert") interrupts. Mirrors native `aria-live` semantics.
54
+ *
55
+ * `write()` also applies `role`/`aria-live` imperatively at announce time
56
+ * (not only through this property's template binding) so a caller that
57
+ * sets `mode` and immediately force-announces in the same synchronous
58
+ * turn -- e.g. a stream-status transition -- gets the new urgency and the
59
+ * new text landing together, rather than the text beating Lit's
60
+ * re-render to the DOM. */
61
+ mode: LiveRegionMode;
62
+ /** Throttle window in ms — see `Announcer` in `internal/announcer.ts`. */
63
+ throttleMs: number;
64
+ private readonly announcer;
65
+ private lastWritten;
66
+ private regionEl?;
67
+ private reannounceHandle?;
68
+ private reannounceView?;
69
+ private pendingWrite?;
70
+ constructor();
71
+ protected updated(changed: PropertyValues): void;
72
+ firstUpdated(): void;
73
+ disconnectedCallback(): void;
74
+ /**
75
+ * Queue `text` for announcement. Calls arriving within `throttle-ms` of
76
+ * the first call in a burst collapse to a single announcement of the
77
+ * latest text; pass `{ force: true }` to bypass the window and flush
78
+ * immediately (e.g. for a final/terminal message that must not be
79
+ * dropped).
80
+ */
81
+ announce(text: string, options?: AnnounceOptions): void;
82
+ private write;
83
+ private cancelReannounce;
84
+ render(): TemplateResult;
85
+ }
86
+ declare global {
87
+ interface HTMLElementTagNameMap {
88
+ 'lyra-live-region': LyraLiveRegion;
89
+ }
90
+ }
@@ -0,0 +1,189 @@
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 } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { srOnly } from '../../internal/a11y.js';
12
+ import { Announcer } from '../../internal/announcer.js';
13
+ import { styles } from './live-region.styles.js';
14
+ /**
15
+ * `<lyra-live-region>` — a visually-hidden ARIA live region that throttles
16
+ * and coalesces announcements instead of relaying every call verbatim.
17
+ *
18
+ * Naive live regions plus token-by-token streaming text (a chat response, a
19
+ * progress readout, ...) equals screen-reader spam: every incremental chunk
20
+ * gets announced. This component wraps `Announcer`
21
+ * (`../../internal/announcer.js`) so callers can fire `announce()` as often
22
+ * as they like — only the latest text within each `throttle-ms` window
23
+ * actually reaches assistive tech, and a `{ force: true }` call (e.g. once a
24
+ * stream ends) always lands immediately regardless of any window in
25
+ * progress.
26
+ *
27
+ * A consumer typically mounts one `<lyra-live-region>` per page/surface
28
+ * (much like `<lyra-toast>` is one region per placement — see
29
+ * `../toast/toaster.ts`) and keeps a reference to call `announce()` from
30
+ * application code or a parent component:
31
+ *
32
+ * @example
33
+ * ```html
34
+ * <!-- once, near the root of a chat surface's shell -->
35
+ * <lyra-live-region id="chat-live" mode="polite"></lyra-live-region>
36
+ * ```
37
+ * ```ts
38
+ * const live = document.getElementById('chat-live') as LyraLiveRegion;
39
+ *
40
+ * // streaming tokens: fine to call on every chunk, only the trailing state lands
41
+ * live.announce(`${partialText} …`);
42
+ *
43
+ * // stream finished: always announced, even mid-throttle-window
44
+ * live.announce('Response complete', { force: true });
45
+ * ```
46
+ *
47
+ * A parent Lit component would instead hold the reference via `@query`:
48
+ * ```ts
49
+ * @query('lyra-live-region') private liveRegion!: LyraLiveRegion;
50
+ * ```
51
+ * and is exactly what later components in this family (a stream-status
52
+ * indicator, a tool-call chip's status transitions, a chat message's
53
+ * streaming state) are expected to do rather than hand-rolling their own
54
+ * `aria-live` element.
55
+ *
56
+ * @customElement lyra-live-region
57
+ * @csspart region - The visually-hidden element carrying `role`/`aria-live`.
58
+ */
59
+ export class LyraLiveRegion extends LyraElement {
60
+ static { this.styles = [LyraElement.styles, styles, srOnly]; }
61
+ constructor() {
62
+ super();
63
+ /** `polite` (role="status") waits for the user to be idle; `assertive`
64
+ * (role="alert") interrupts. Mirrors native `aria-live` semantics.
65
+ *
66
+ * `write()` also applies `role`/`aria-live` imperatively at announce time
67
+ * (not only through this property's template binding) so a caller that
68
+ * sets `mode` and immediately force-announces in the same synchronous
69
+ * turn -- e.g. a stream-status transition -- gets the new urgency and the
70
+ * new text landing together, rather than the text beating Lit's
71
+ * re-render to the DOM. */
72
+ this.mode = 'polite';
73
+ /** Throttle window in ms — see `Announcer` in `internal/announcer.ts`. */
74
+ this.throttleMs = 500;
75
+ // The live region's own last-written text. Tracked separately from
76
+ // whatever Lit thinks the DOM looks like because `write()` mutates
77
+ // `regionEl.textContent` directly (outside Lit's template bindings) --
78
+ // see `write()` for why.
79
+ this.lastWritten = '';
80
+ // Built in the constructor (not a class-field initializer) so it reads
81
+ // `this.throttleMs` only after that property's own field initializer
82
+ // has already run and set the declared default.
83
+ this.announcer = new Announcer({
84
+ throttleMs: this.throttleMs,
85
+ onFlush: (text) => this.write(text),
86
+ });
87
+ }
88
+ updated(changed) {
89
+ if (changed.has('throttleMs')) {
90
+ this.announcer.throttleMs = this.throttleMs;
91
+ }
92
+ }
93
+ firstUpdated() {
94
+ this.regionEl = this.renderRoot.querySelector('[part="region"]') ?? undefined;
95
+ if (this.pendingWrite !== undefined) {
96
+ const text = this.pendingWrite;
97
+ this.pendingWrite = undefined;
98
+ this.write(text);
99
+ }
100
+ }
101
+ disconnectedCallback() {
102
+ super.disconnectedCallback();
103
+ this.announcer.cancel();
104
+ this.pendingWrite = undefined;
105
+ this.cancelReannounce();
106
+ }
107
+ /**
108
+ * Queue `text` for announcement. Calls arriving within `throttle-ms` of
109
+ * the first call in a burst collapse to a single announcement of the
110
+ * latest text; pass `{ force: true }` to bypass the window and flush
111
+ * immediately (e.g. for a final/terminal message that must not be
112
+ * dropped).
113
+ */
114
+ announce(text, options) {
115
+ this.announcer.announce(text, options);
116
+ }
117
+ write(text) {
118
+ const region = this.regionEl;
119
+ if (!region) {
120
+ this.pendingWrite = text;
121
+ return;
122
+ }
123
+ // A same-text reannounce frame still in flight is now stale the moment
124
+ // any new write() call comes in -- if it fired later it would clobber
125
+ // whatever text this call is about to land with the older, already-
126
+ // superseded string. Cancel it up front so at most one reannounce is
127
+ // ever pending and it can never overwrite a newer announcement.
128
+ this.cancelReannounce();
129
+ const assertive = this.mode === 'assertive';
130
+ if (text === this.lastWritten) {
131
+ // Screen readers announce a live region on text-content *change* --
132
+ // re-writing the identical string is otherwise a silent no-op to
133
+ // assistive tech. Clearing first and re-setting on the next frame
134
+ // (rather than in the same task) gives the DOM an actual empty ->
135
+ // populated transition to observe instead of a same-tick clear+set
136
+ // that can coalesce into nothing ever appearing to change.
137
+ //
138
+ // role/aria-live are set imperatively here (not left to Lit's
139
+ // template binding) so a caller that sets `mode` and immediately
140
+ // force-announces -- e.g. stream-status's announceTransition() --
141
+ // gets the new urgency in the same synchronous operation as the text,
142
+ // rather than racing Lit's async re-render.
143
+ region.setAttribute('role', assertive ? 'alert' : 'status');
144
+ region.setAttribute('aria-live', assertive ? 'assertive' : 'polite');
145
+ region.textContent = '';
146
+ const view = region.ownerDocument.defaultView;
147
+ if (!view) {
148
+ region.textContent = text;
149
+ return;
150
+ }
151
+ this.reannounceView = view;
152
+ this.reannounceHandle = view.requestAnimationFrame(() => {
153
+ this.reannounceHandle = undefined;
154
+ this.reannounceView = undefined;
155
+ region.textContent = text;
156
+ });
157
+ }
158
+ else {
159
+ region.setAttribute('role', assertive ? 'alert' : 'status');
160
+ region.setAttribute('aria-live', assertive ? 'assertive' : 'polite');
161
+ region.textContent = text;
162
+ }
163
+ this.lastWritten = text;
164
+ }
165
+ cancelReannounce() {
166
+ if (this.reannounceHandle === undefined)
167
+ return;
168
+ this.reannounceView?.cancelAnimationFrame(this.reannounceHandle);
169
+ this.reannounceHandle = undefined;
170
+ this.reannounceView = undefined;
171
+ }
172
+ render() {
173
+ const assertive = this.mode === 'assertive';
174
+ return html `<div
175
+ part="region"
176
+ class="sr-only"
177
+ role=${assertive ? 'alert' : 'status'}
178
+ aria-live=${assertive ? 'assertive' : 'polite'}
179
+ aria-atomic="true"
180
+ ></div>`;
181
+ }
182
+ }
183
+ __decorate([
184
+ property({ reflect: true })
185
+ ], LyraLiveRegion.prototype, "mode", void 0);
186
+ __decorate([
187
+ property({ type: Number, attribute: 'throttle-ms' })
188
+ ], LyraLiveRegion.prototype, "throttleMs", void 0);
189
+ defineElement('live-region', LyraLiveRegion);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,10 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ /* The host contributes no box of its own -- \`.sr-only\` (composed in via
4
+ internal/a11y.ts's shared \`srOnly\`) already takes the single child out
5
+ of flow via absolute positioning, so a wrapping host box would just be
6
+ an empty, purposeless inline element sitting in the document. */
7
+ :host {
8
+ display: contents;
9
+ }
10
+ `;