@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,113 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ export type CitationBadgeStatus = 'default' | 'high' | 'medium' | 'low' | 'verified' | 'unverified';
4
+ export interface CitationActivateDetail {
5
+ sourceId: string;
6
+ index: number;
7
+ }
8
+ export interface CitationOpenDetail {
9
+ sourceId: string;
10
+ index: number;
11
+ href?: string;
12
+ }
13
+ /**
14
+ * `<lyra-citation-badge>` — an inline `[n]` citation marker with a hover/
15
+ * focus preview popover and confidence/verification-status coloring. Used
16
+ * for an agent response's inline citations, each carrying a `source-id`
17
+ * that matches a corresponding `<lyra-source-card>` shown elsewhere on the
18
+ * page (a sibling component in this same family — this component doesn't
19
+ * import or know anything about it, only carries the id through its
20
+ * events).
21
+ *
22
+ * The default slot is *not* the badge's visible content — the badge always
23
+ * renders `[index]` — it's reserved for optional rich preview content (e.g.
24
+ * a filename + short excerpt) shown in a floating popover on hover/focus,
25
+ * positioned with `internal/positioner.js`'s `place()` the same way
26
+ * `<lyra-tool-call-chip>` positions its own detail tooltip. No popover shows
27
+ * at all when the slot carries no content, and the popover never traps
28
+ * focus — it's supplementary preview content, not a modal, so Tab continues
29
+ * past the badge normally even while it happens to be visible from a mouse
30
+ * hover.
31
+ *
32
+ * Two distinct signals fire from the same badge: `lyra-citation-activate`
33
+ * (click, or Enter while focused — native `<button>` behavior, no listener
34
+ * needed for the Enter case) is the lightweight "jump to this source"
35
+ * signal a host wires to scrolling/highlighting the matching
36
+ * `<lyra-source-card>`. `lyra-citation-open` (dblclick, or Space while
37
+ * focused) is a distinct "full preview" signal — `href` in its detail is
38
+ * `undefined` when the `href` prop isn't set; the consumer decides what
39
+ * "open" means (a new tab, a dialog, etc). A double-click still fires two
40
+ * `lyra-citation-activate` events (one per constituent click — standard
41
+ * browser `dblclick` behavior) in addition to the one `lyra-citation-open`;
42
+ * a consumer that only cares about the richer signal on a double-click
43
+ * should ignore the paired activate events in that case.
44
+ *
45
+ * Status coloring: `verified`/`high` use the success tones (a claim that's
46
+ * been checked out, or the model is confident in). `medium`/`low` use
47
+ * warning (progressively less certain, but still a real citation).
48
+ * `unverified` uses danger — deliberately distinct from `low`: "hasn't been
49
+ * checked at all" is a different (arguably riskier) claim than "checked but
50
+ * uncertain". `default` renders as plain neutral text with no background
51
+ * tint, for citations that carry no confidence/verification signal at all.
52
+ *
53
+ * @customElement lyra-citation-badge
54
+ * @slot - Rich preview/tooltip content (e.g. a filename + excerpt), shown in
55
+ * a floating popover on hover/focus. Nothing renders (no hover affordance at
56
+ * all) when this slot is empty.
57
+ * @event lyra-citation-activate - The badge was activated (click, or Enter
58
+ * while focused). `detail: { sourceId, index }`.
59
+ * @event lyra-citation-open - The badge's "full preview" affordance was
60
+ * triggered (dblclick, or Space while focused).
61
+ * `detail: { sourceId, index, href }`.
62
+ * @csspart base - The clickable badge (`<button>`).
63
+ * @csspart bracket - Each of the two literal `[`/`]` glyphs.
64
+ * @csspart index - The citation number.
65
+ * @csspart popover - The floating preview panel (only meaningful while open).
66
+ */
67
+ export declare class LyraCitationBadge extends LyraElement {
68
+ static styles: import("lit").CSSResultGroup[];
69
+ /** The citation number shown, e.g. `3` renders as `[3]`. */
70
+ index: number;
71
+ /** Confidence/verification state — drives the badge's color and (unless
72
+ * `label` is set) part of its accessible name. */
73
+ status: CitationBadgeStatus;
74
+ /** Id of a corresponding `<lyra-source-card>` elsewhere on the page —
75
+ * echoed back verbatim in both events, never read or validated here. */
76
+ sourceId: string;
77
+ /** Optional direct link target for the citation's source. Carried into
78
+ * `lyra-citation-open`'s detail as-is; this component never navigates. */
79
+ href: string;
80
+ /** Overrides the computed accessible name (`"Citation {index}[, {status}]"`). */
81
+ label: string;
82
+ private hasPreviewSlot;
83
+ private popoverOpen;
84
+ private buttonEl?;
85
+ private popoverEl?;
86
+ private readonly popoverId;
87
+ private cleanupPositioner?;
88
+ private hideTimer?;
89
+ private hovering;
90
+ private focused;
91
+ protected willUpdate(): void;
92
+ protected updated(changed: PropertyValues): void;
93
+ disconnectedCallback(): void;
94
+ private get accessibleLabel();
95
+ private onSlotChange;
96
+ private showPreview;
97
+ private scheduleHidePreview;
98
+ private hidePreviewNow;
99
+ private onPointerEnter;
100
+ private onPointerLeave;
101
+ private onFocusIn;
102
+ private onFocusOut;
103
+ private onKeyDown;
104
+ private onClick;
105
+ private onDblClick;
106
+ private emitOpen;
107
+ render(): TemplateResult;
108
+ }
109
+ declare global {
110
+ interface HTMLElementTagNameMap {
111
+ 'lyra-citation-badge': LyraCitationBadge;
112
+ }
113
+ }
@@ -0,0 +1,318 @@
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, query } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { place } from '../../internal/positioner.js';
12
+ import { nextId } from '../../internal/a11y.js';
13
+ import { styles } from './citation-badge.styles.js';
14
+ /** Visible (not just color-coded) status word, folded into the computed
15
+ * accessible name — `''` for `default` omits the status clause entirely
16
+ * rather than announcing a meaningless "Citation 3, Default". */
17
+ const STATUS_LABEL = {
18
+ default: '',
19
+ high: 'High confidence',
20
+ medium: 'Medium confidence',
21
+ low: 'Low confidence',
22
+ verified: 'Verified',
23
+ unverified: 'Unverified',
24
+ };
25
+ // A short grace period before the popover actually hides on pointer-leave/
26
+ // focus-out, so moving the mouse from the badge into the popover itself (to
27
+ // select/copy its text) doesn't make it vanish mid-move. Cancelled outright
28
+ // if hover or focus returns before it fires. No delay on Escape or explicit
29
+ // keyboard blur — those are intentional dismissals, not transient pointer
30
+ // travel, so they close immediately.
31
+ const HIDE_DELAY_MS = 200;
32
+ // The default slot's preview content is often plain text (see the Statuses
33
+ // story: "No source has confirmed this yet.") with no wrapping element at
34
+ // all, so an Element-only check (e.g. Array.from(children)/assignedElements)
35
+ // never counts it. Mirrors result-field.ts's hasRealContent: a node counts as
36
+ // real preview content if it's an element not assigned to some other named
37
+ // slot, or non-whitespace text.
38
+ function isRealPreviewNode(n) {
39
+ return n.nodeType === Node.ELEMENT_NODE
40
+ ? !n.hasAttribute('slot')
41
+ : (n.textContent ?? '').trim().length > 0;
42
+ }
43
+ /**
44
+ * `<lyra-citation-badge>` — an inline `[n]` citation marker with a hover/
45
+ * focus preview popover and confidence/verification-status coloring. Used
46
+ * for an agent response's inline citations, each carrying a `source-id`
47
+ * that matches a corresponding `<lyra-source-card>` shown elsewhere on the
48
+ * page (a sibling component in this same family — this component doesn't
49
+ * import or know anything about it, only carries the id through its
50
+ * events).
51
+ *
52
+ * The default slot is *not* the badge's visible content — the badge always
53
+ * renders `[index]` — it's reserved for optional rich preview content (e.g.
54
+ * a filename + short excerpt) shown in a floating popover on hover/focus,
55
+ * positioned with `internal/positioner.js`'s `place()` the same way
56
+ * `<lyra-tool-call-chip>` positions its own detail tooltip. No popover shows
57
+ * at all when the slot carries no content, and the popover never traps
58
+ * focus — it's supplementary preview content, not a modal, so Tab continues
59
+ * past the badge normally even while it happens to be visible from a mouse
60
+ * hover.
61
+ *
62
+ * Two distinct signals fire from the same badge: `lyra-citation-activate`
63
+ * (click, or Enter while focused — native `<button>` behavior, no listener
64
+ * needed for the Enter case) is the lightweight "jump to this source"
65
+ * signal a host wires to scrolling/highlighting the matching
66
+ * `<lyra-source-card>`. `lyra-citation-open` (dblclick, or Space while
67
+ * focused) is a distinct "full preview" signal — `href` in its detail is
68
+ * `undefined` when the `href` prop isn't set; the consumer decides what
69
+ * "open" means (a new tab, a dialog, etc). A double-click still fires two
70
+ * `lyra-citation-activate` events (one per constituent click — standard
71
+ * browser `dblclick` behavior) in addition to the one `lyra-citation-open`;
72
+ * a consumer that only cares about the richer signal on a double-click
73
+ * should ignore the paired activate events in that case.
74
+ *
75
+ * Status coloring: `verified`/`high` use the success tones (a claim that's
76
+ * been checked out, or the model is confident in). `medium`/`low` use
77
+ * warning (progressively less certain, but still a real citation).
78
+ * `unverified` uses danger — deliberately distinct from `low`: "hasn't been
79
+ * checked at all" is a different (arguably riskier) claim than "checked but
80
+ * uncertain". `default` renders as plain neutral text with no background
81
+ * tint, for citations that carry no confidence/verification signal at all.
82
+ *
83
+ * @customElement lyra-citation-badge
84
+ * @slot - Rich preview/tooltip content (e.g. a filename + excerpt), shown in
85
+ * a floating popover on hover/focus. Nothing renders (no hover affordance at
86
+ * all) when this slot is empty.
87
+ * @event lyra-citation-activate - The badge was activated (click, or Enter
88
+ * while focused). `detail: { sourceId, index }`.
89
+ * @event lyra-citation-open - The badge's "full preview" affordance was
90
+ * triggered (dblclick, or Space while focused).
91
+ * `detail: { sourceId, index, href }`.
92
+ * @csspart base - The clickable badge (`<button>`).
93
+ * @csspart bracket - Each of the two literal `[`/`]` glyphs.
94
+ * @csspart index - The citation number.
95
+ * @csspart popover - The floating preview panel (only meaningful while open).
96
+ */
97
+ export class LyraCitationBadge extends LyraElement {
98
+ constructor() {
99
+ super(...arguments);
100
+ /** The citation number shown, e.g. `3` renders as `[3]`. */
101
+ this.index = 1;
102
+ /** Confidence/verification state — drives the badge's color and (unless
103
+ * `label` is set) part of its accessible name. */
104
+ this.status = 'default';
105
+ /** Id of a corresponding `<lyra-source-card>` elsewhere on the page —
106
+ * echoed back verbatim in both events, never read or validated here. */
107
+ this.sourceId = '';
108
+ /** Optional direct link target for the citation's source. Carried into
109
+ * `lyra-citation-open`'s detail as-is; this component never navigates. */
110
+ this.href = '';
111
+ /** Overrides the computed accessible name (`"Citation {index}[, {status}]"`). */
112
+ this.label = '';
113
+ // A `[part]` always contains a literal `<slot>` child regardless of
114
+ // assigned content, so `:empty` never matches — real emptiness is tracked
115
+ // in JS instead, same fix lyra-tool-call-chip's hasDetailSlot/lyra-stat's
116
+ // hasIcon etc. already establish.
117
+ this.hasPreviewSlot = false;
118
+ this.popoverOpen = false;
119
+ this.popoverId = nextId('citation-badge-popover');
120
+ // Hover and focus are tracked as independent "keep it open" reasons —
121
+ // mirrors lyra-toast-item's identical hovering/focused pair — so releasing
122
+ // one (e.g. the pointer leaving while the badge still has keyboard focus)
123
+ // doesn't schedule a hide the other modality is still holding open.
124
+ this.hovering = false;
125
+ this.focused = false;
126
+ this.onSlotChange = (e) => {
127
+ this.hasPreviewSlot = e.target.assignedNodes({ flatten: true }).some(isRealPreviewNode);
128
+ // The slot can be emptied out from under an already-open popover (e.g. a
129
+ // consumer clearing preview content asynchronously) — nothing left to
130
+ // show, so don't leave an empty panel floating open.
131
+ if (!this.hasPreviewSlot)
132
+ this.hidePreviewNow();
133
+ };
134
+ // Attached to the wrapper (not the button alone) so the popover's own
135
+ // slotted content counts too — pointerenter/pointerleave/focusin/focusout
136
+ // fire relative to whichever element they're bound to, not per descendant,
137
+ // so moving the pointer or focus between the button and the popover panel
138
+ // within this same wrapper never toggles hovering/focused off and on.
139
+ this.onPointerEnter = () => {
140
+ this.hovering = true;
141
+ this.showPreview();
142
+ };
143
+ this.onPointerLeave = () => {
144
+ this.hovering = false;
145
+ this.scheduleHidePreview();
146
+ };
147
+ this.onFocusIn = () => {
148
+ this.focused = true;
149
+ this.showPreview();
150
+ };
151
+ // No grace period here, unlike onPointerLeave -- a blur (Tab/Shift+Tab
152
+ // away, or focus programmatically moved elsewhere) is a deliberate
153
+ // navigation, not the transient pointer travel the delay exists to survive,
154
+ // so it closes at once. Still deferred to hover if the pointer happens to
155
+ // be resting on the badge/popover at the same time.
156
+ this.onFocusOut = () => {
157
+ this.focused = false;
158
+ if (this.hovering)
159
+ return;
160
+ this.hidePreviewNow();
161
+ };
162
+ // keydown bubbles up from whatever actually holds focus (the button, or a
163
+ // focusable element inside slotted preview content) — attaching this at
164
+ // the wrapper, rather than the button alone, is what makes Escape work
165
+ // "while the popover has focus-within" per the component's contract,
166
+ // without needing to track focus targets explicitly here.
167
+ this.onKeyDown = (e) => {
168
+ if (e.key === 'Escape' && this.popoverOpen) {
169
+ // Swallow it here rather than letting it bubble to e.g. a containing
170
+ // lyra-dialog's own Escape-to-close handler — dismissing this
171
+ // lightweight preview shouldn't also close a surrounding modal.
172
+ e.stopPropagation();
173
+ this.hidePreviewNow();
174
+ return;
175
+ }
176
+ // Space normally activates a <button> the same as Enter, but this
177
+ // component gives the two keys distinct meanings (Enter = activate,
178
+ // Space = open) — so Space's native click-on-keyup must be pre-empted
179
+ // here (preventDefault on keydown suppresses it) rather than left to
180
+ // fire alongside this. Enter deliberately gets no such handling: its
181
+ // native immediate click already reaches onClick below.
182
+ if (e.key === ' ' && !e.repeat && e.target === this.buttonEl) {
183
+ e.preventDefault();
184
+ this.emitOpen();
185
+ }
186
+ };
187
+ this.onClick = () => {
188
+ this.emit('lyra-citation-activate', { sourceId: this.sourceId, index: this.index });
189
+ };
190
+ this.onDblClick = () => {
191
+ this.emitOpen();
192
+ };
193
+ }
194
+ static { this.styles = [LyraElement.styles, styles]; }
195
+ willUpdate() {
196
+ if (!this.hasUpdated) {
197
+ this.hasPreviewSlot = Array.from(this.childNodes).some(isRealPreviewNode);
198
+ }
199
+ }
200
+ updated(changed) {
201
+ if (changed.has('popoverOpen')) {
202
+ this.cleanupPositioner?.();
203
+ this.cleanupPositioner = undefined;
204
+ if (this.popoverOpen && this.buttonEl && this.popoverEl) {
205
+ this.cleanupPositioner = place(this.buttonEl, this.popoverEl, { placement: 'top-start' });
206
+ }
207
+ }
208
+ }
209
+ disconnectedCallback() {
210
+ super.disconnectedCallback();
211
+ this.cleanupPositioner?.();
212
+ clearTimeout(this.hideTimer);
213
+ }
214
+ get accessibleLabel() {
215
+ if (this.label)
216
+ return this.label;
217
+ const statusText = STATUS_LABEL[this.status];
218
+ return statusText ? `Citation ${this.index}, ${statusText}` : `Citation ${this.index}`;
219
+ }
220
+ // Named showPreview/hidePreviewNow (not show/hidePopover) to avoid
221
+ // colliding with the standard HTML Popover API's own
222
+ // HTMLElement.prototype.showPopover()/hidePopover() -- this component
223
+ // renders its own floating panel via internal/positioner.js rather than
224
+ // the native `popover` attribute, but TS's DOM lib still declares those
225
+ // method names on every HTMLElement subclass, so reusing them here would
226
+ // be a same-name-different-signature override error.
227
+ showPreview() {
228
+ if (!this.hasPreviewSlot)
229
+ return;
230
+ // Cancel any pending hide unconditionally -- including when the popover
231
+ // is already open -- so hover/focus returning within the grace period
232
+ // (pointerenter -> pointerleave -> pointerenter before HIDE_DELAY_MS)
233
+ // actually cancels the scheduled hide instead of leaving it armed to
234
+ // fire later regardless of the now-restored hover/focus state.
235
+ clearTimeout(this.hideTimer);
236
+ this.hideTimer = undefined;
237
+ if (this.popoverOpen)
238
+ return;
239
+ this.popoverOpen = true;
240
+ }
241
+ scheduleHidePreview() {
242
+ if (!this.popoverOpen || this.hovering || this.focused)
243
+ return;
244
+ clearTimeout(this.hideTimer);
245
+ this.hideTimer = setTimeout(() => {
246
+ this.hideTimer = undefined;
247
+ this.popoverOpen = false;
248
+ }, HIDE_DELAY_MS);
249
+ }
250
+ hidePreviewNow() {
251
+ clearTimeout(this.hideTimer);
252
+ this.hideTimer = undefined;
253
+ if (this.popoverOpen)
254
+ this.popoverOpen = false;
255
+ }
256
+ emitOpen() {
257
+ this.emit('lyra-citation-open', {
258
+ sourceId: this.sourceId,
259
+ index: this.index,
260
+ href: this.href || undefined,
261
+ });
262
+ }
263
+ render() {
264
+ return html `
265
+ <span
266
+ class="wrapper"
267
+ @pointerenter=${this.onPointerEnter}
268
+ @pointerleave=${this.onPointerLeave}
269
+ @focusin=${this.onFocusIn}
270
+ @focusout=${this.onFocusOut}
271
+ @keydown=${this.onKeyDown}
272
+ >
273
+ <button
274
+ part="base"
275
+ type="button"
276
+ aria-label=${this.getAttribute('aria-label') || this.accessibleLabel}
277
+ aria-describedby=${this.hasPreviewSlot && this.popoverOpen ? this.popoverId : nothing}
278
+ @click=${this.onClick}
279
+ @dblclick=${this.onDblClick}
280
+ >
281
+ <span part="bracket" aria-hidden="true">[</span><span part="index">${this.index}</span
282
+ ><span part="bracket" aria-hidden="true">]</span>
283
+ </button>
284
+ <div part="popover" id=${this.popoverId} role="tooltip" ?hidden=${!this.popoverOpen}>
285
+ <slot @slotchange=${this.onSlotChange}></slot>
286
+ </div>
287
+ </span>
288
+ `;
289
+ }
290
+ }
291
+ __decorate([
292
+ property({ type: Number })
293
+ ], LyraCitationBadge.prototype, "index", void 0);
294
+ __decorate([
295
+ property({ reflect: true })
296
+ ], LyraCitationBadge.prototype, "status", void 0);
297
+ __decorate([
298
+ property({ attribute: 'source-id' })
299
+ ], LyraCitationBadge.prototype, "sourceId", void 0);
300
+ __decorate([
301
+ property()
302
+ ], LyraCitationBadge.prototype, "href", void 0);
303
+ __decorate([
304
+ property()
305
+ ], LyraCitationBadge.prototype, "label", void 0);
306
+ __decorate([
307
+ state()
308
+ ], LyraCitationBadge.prototype, "hasPreviewSlot", void 0);
309
+ __decorate([
310
+ state()
311
+ ], LyraCitationBadge.prototype, "popoverOpen", void 0);
312
+ __decorate([
313
+ query('[part="base"]')
314
+ ], LyraCitationBadge.prototype, "buttonEl", void 0);
315
+ __decorate([
316
+ query('[part="popover"]')
317
+ ], LyraCitationBadge.prototype, "popoverEl", void 0);
318
+ defineElement('citation-badge', LyraCitationBadge);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,96 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: inline-flex;
5
+ vertical-align: baseline;
6
+ line-height: 1;
7
+ /* Per-status accent -- one pair of custom properties swapped by the
8
+ :host([status]) rules below rather than repeating background/color
9
+ per part per status. 'default' (and any unrecognized status) stays
10
+ plain/neutral -- transparent background, quiet text -- rather than
11
+ inventing a seventh visual tone for "no signal at all". */
12
+ --lyra-citation-badge-accent: var(--lyra-color-text-quiet);
13
+ --lyra-citation-badge-bg: transparent;
14
+ --lyra-citation-badge-border: transparent;
15
+ }
16
+
17
+ :host([status='high']),
18
+ :host([status='verified']) {
19
+ --lyra-citation-badge-accent: var(--lyra-color-success);
20
+ --lyra-citation-badge-bg: var(--lyra-color-success-quiet);
21
+ }
22
+ :host([status='medium']),
23
+ :host([status='low']) {
24
+ --lyra-citation-badge-accent: var(--lyra-color-warning);
25
+ --lyra-citation-badge-bg: var(--lyra-color-warning-quiet);
26
+ }
27
+ /* Deliberately its own danger tone, not grouped with 'low' -- see the
28
+ component doc's status-coloring note: "hasn't been checked" reads as a
29
+ distinct (riskier) claim from "checked but uncertain". */
30
+ :host([status='unverified']) {
31
+ --lyra-citation-badge-accent: var(--lyra-color-danger);
32
+ --lyra-citation-badge-bg: var(--lyra-color-danger-quiet);
33
+ }
34
+
35
+ .wrapper {
36
+ display: inline-flex;
37
+ }
38
+
39
+ [part='base'] {
40
+ display: inline-flex;
41
+ align-items: baseline;
42
+ box-sizing: border-box;
43
+ padding: 0 0.3em;
44
+ border: 1px solid var(--lyra-citation-badge-border);
45
+ border-radius: calc(var(--lyra-radius) * 0.6);
46
+ background: var(--lyra-citation-badge-bg);
47
+ color: var(--lyra-citation-badge-accent);
48
+ font: inherit;
49
+ font-size: 0.75em;
50
+ font-weight: 600;
51
+ font-variant-numeric: tabular-nums;
52
+ line-height: 1.5;
53
+ cursor: pointer;
54
+ -webkit-tap-highlight-color: transparent;
55
+ transition:
56
+ background-color var(--lyra-transition-fast),
57
+ border-color var(--lyra-transition-fast);
58
+ }
59
+ [part='base']:hover {
60
+ border-color: var(--lyra-citation-badge-accent);
61
+ }
62
+ [part='base']:focus-visible {
63
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
64
+ outline-offset: var(--lyra-focus-ring-offset);
65
+ }
66
+
67
+ [part='bracket'] {
68
+ opacity: 0.7;
69
+ }
70
+
71
+ /* Positioned by internal/positioner.js's place() -- same fixed/z-index/
72
+ max-size shape as lyra-tool-call-chip's own [part='tooltip']. No open/
73
+ close transition, for the same reason that one has none: a preview
74
+ that tracks the pointer/focus target should appear instantly, not
75
+ chase a fade. */
76
+ [part='popover'] {
77
+ position: fixed;
78
+ z-index: 900;
79
+ box-sizing: border-box;
80
+ max-inline-size: min(90vw, 22rem);
81
+ padding: var(--lyra-space-s) var(--lyra-space-m);
82
+ background: var(--lyra-color-surface);
83
+ border: 1px solid var(--lyra-color-border);
84
+ border-radius: var(--lyra-radius);
85
+ box-shadow: var(--lyra-shadow);
86
+ font-size: 0.8125rem;
87
+ line-height: 1.4;
88
+ color: var(--lyra-color-text);
89
+ }
90
+
91
+ @media (prefers-reduced-motion: reduce) {
92
+ [part='base'] {
93
+ transition: none !important;
94
+ }
95
+ }
96
+ `;
@@ -0,0 +1,127 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ import { type ShikiLanguageInput } from './code-loader.js';
4
+ import '../skeleton/skeleton.js';
5
+ /**
6
+ * `<lyra-code-block>` — fenced code display with optional lazy syntax
7
+ * highlighting and a copy button. No highlighting grammar ships in this
8
+ * component itself: it lazy-loads the optional peer dependency `shiki` (see
9
+ * `code-loader.ts`) for the actual tokenizing, and degrades to a plain
10
+ * `<pre><code>` when that peer isn't installed or `language` is unset/
11
+ * unrecognized — the exact same optional-peer shape `<lyra-markdown>` and
12
+ * `<lyra-chart>` already establish. That fallback is the *default* rendering
13
+ * path, not a degraded one: unhighlighted code is perfectly usable, and it's
14
+ * what every instance renders at zero extra bytes until shiki resolves.
15
+ *
16
+ * A `<lyra-skeleton>` placeholder stands in only while shiki itself is
17
+ * loading for the very first time on the page (cached — see
18
+ * `loadShikiHighlighter()`) and `language` is set. It's deliberately *not*
19
+ * shown again for a subsequent per-language grammar load (e.g. a second
20
+ * `<lyra-code-block>` requesting a language no earlier instance has used
21
+ * yet) — that grammar fetch is typically fast, and the plain-text fallback
22
+ * is already a perfectly readable placeholder for it, so a second
23
+ * loading-chrome state would add complexity for little practical benefit.
24
+ *
25
+ * `languages` is an additive, opt-in escape hatch from that default path for
26
+ * a consumer whose language set is fixed and known ahead of time: a map of
27
+ * language id to an already-imported shiki grammar module (e.g. `import bash
28
+ * from 'shiki/langs/bash.mjs'`). When `language` matches a key in `languages`,
29
+ * this component seeds a fine-grained `createHighlighterCore()` highlighter
30
+ * with *only* the pre-supplied grammars (see `code-loader.ts`'s
31
+ * `loadShikiHighlighterCore()`) instead of waiting on `loadShikiHighlighter()`
32
+ * and its dynamic per-language `loadLanguage()` import. The payoff isn't
33
+ * runtime cost — the default dynamic-import path is already well-optimized
34
+ * for that — it's *build output*: shiki's main entry point bundles a dynamic
35
+ * `import()` per bundled language (~200 of them) because a bundler can't
36
+ * statically narrow which of those a `loadLanguage(lang: string)` call might
37
+ * request at runtime, so it conservatively emits a build-output chunk for
38
+ * every one of them. `shiki/core`'s fine-grained API has no such table — a
39
+ * bundler only ever sees the exact grammar modules `languages` itself
40
+ * `import`s, so a consumer who pins its full language set this way trades a
41
+ * hand-maintained list for a build output scoped to just those languages
42
+ * instead of shiki's entire bundled set. A language requested but absent
43
+ * from `languages` still falls back to the ordinary dynamic-import path
44
+ * unchanged, so this is a partial opt-in, not a replacement for it.
45
+ *
46
+ * @customElement lyra-code-block
47
+ * @event lyra-copy - The copy button was activated. `detail: { text }` is
48
+ * always the raw `code` value (never the highlighted HTML), and always
49
+ * fires regardless of whether the actual OS clipboard write succeeded —
50
+ * same convention as `<lyra-json-viewer>`'s own copy button.
51
+ * @event lyra-toggle - The collapse/expand header button was activated.
52
+ * `detail: { collapsed }` — same event name and shape convention as
53
+ * `<lyra-thinking-panel>`'s own `lyra-toggle`.
54
+ * @csspart base - The outer container.
55
+ * @csspart header - The row above the code (filename/language/copy/toggle),
56
+ * present whenever there's anything to put in it.
57
+ * @csspart filename - The `filename` text, when set.
58
+ * @csspart language - The `language` badge, when set, so the language is
59
+ * exposed to assistive tech as visible text rather than only a `language`
60
+ * attribute a screen reader would never announce.
61
+ * @csspart copy-button - The copy-to-clipboard button, when `copyable`.
62
+ * @csspart toggle - The collapse/expand chevron button, when `collapsible`.
63
+ * @csspart body - The scrollable region wrapping the code (or the loading
64
+ * skeleton); respects `max-height`, `hidden` while `collapsible` and
65
+ * `collapsed`.
66
+ * @csspart pre - The rendered `<pre>` — shiki's own in the highlighted path,
67
+ * this component's own plain one in the fallback path.
68
+ * @csspart code - The rendered `<code>`, same split as `pre` above.
69
+ */
70
+ export declare class LyraCodeBlock extends LyraElement {
71
+ static styles: import("lit").CSSResultGroup[];
72
+ /** The raw source text. */
73
+ code: string;
74
+ /** A shiki-recognized language id or alias (e.g. `"javascript"`,
75
+ * `"python"`, `"json"`). When unset, or when shiki doesn't recognize it,
76
+ * the code renders as plain unhighlighted text regardless of whether
77
+ * shiki itself is available. */
78
+ language: string;
79
+ /** Shown in the header above the code, when set. */
80
+ filename: string;
81
+ /** Whether the code region can be collapsed via a header toggle. */
82
+ collapsible: boolean;
83
+ /** Whether the code region is currently hidden. Only has a visible effect
84
+ * while `collapsible` is also true. */
85
+ collapsed: boolean;
86
+ /** Shows a copy-to-clipboard button in the header. */
87
+ copyable: boolean;
88
+ /** A CSS length (e.g. `"20rem"`); once set, the code scrolls internally
89
+ * past this height instead of growing the page. */
90
+ maxHeight: string;
91
+ /** A map of language id to an already-imported shiki grammar module's
92
+ * default export (e.g. `{ bash: bashGrammar }` where `bashGrammar` came
93
+ * from a module-scope `import bash from 'shiki/langs/bash.mjs'`). When
94
+ * `language` matches a key here, highlighting for it is seeded from
95
+ * exactly this pre-supplied grammar via a fine-grained
96
+ * `createHighlighterCore()` highlighter, bypassing the default
97
+ * `loadShikiHighlighter()` singleton and its dynamic per-language
98
+ * `loadLanguage()` import entirely for that language — see the class doc
99
+ * above for the build-output rationale. A `language` value absent from
100
+ * this map (or left unset, or when `languages` itself is unset) falls
101
+ * back to that default dynamic-import path unchanged. */
102
+ languages?: Record<string, ShikiLanguageInput>;
103
+ private highlightedHtml;
104
+ private shikiReady;
105
+ private justCopied;
106
+ private highlighter?;
107
+ private highlightToken;
108
+ private copyTimeoutId?;
109
+ private readonly bodyId;
110
+ connectedCallback(): void;
111
+ disconnectedCallback(): void;
112
+ private preSuppliedGrammar;
113
+ protected willUpdate(changed: PropertyValues): void;
114
+ protected updated(): void;
115
+ private syncHighlight;
116
+ private tokenize;
117
+ private writeClipboard;
118
+ private copy;
119
+ private toggleCollapsed;
120
+ private renderHeader;
121
+ render(): TemplateResult;
122
+ }
123
+ declare global {
124
+ interface HTMLElementTagNameMap {
125
+ 'lyra-code-block': LyraCodeBlock;
126
+ }
127
+ }