@aceshooting/lyra-ui 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/README.md +12 -1
  2. package/custom-elements.json +21460 -8489
  3. package/dist/components/app-rail/app-rail.d.ts +171 -0
  4. package/dist/components/app-rail/app-rail.js +483 -0
  5. package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
  6. package/dist/components/app-rail/app-rail.styles.js +125 -0
  7. package/dist/components/attachment-chip/attachment-chip.d.ts +114 -0
  8. package/dist/components/attachment-chip/attachment-chip.js +312 -0
  9. package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
  10. package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
  11. package/dist/components/attachment-trigger/attachment-trigger.d.ts +83 -0
  12. package/dist/components/attachment-trigger/attachment-trigger.js +258 -0
  13. package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
  14. package/dist/components/attachment-trigger/attachment-trigger.styles.js +68 -0
  15. package/dist/components/chart/box-plot.js +11 -1
  16. package/dist/components/chart/chart-loader.d.ts +44 -13
  17. package/dist/components/chart/chart-loader.js +65 -18
  18. package/dist/components/chart/chart.d.ts +12 -2
  19. package/dist/components/chart/chart.js +121 -14
  20. package/dist/components/chart/histogram-bin.d.ts +4 -1
  21. package/dist/components/chart/histogram-bin.js +24 -14
  22. package/dist/components/chart/lite-chart.d.ts +63 -0
  23. package/dist/components/chart/lite-chart.js +181 -23
  24. package/dist/components/chart/lite-chart.styles.js +9 -0
  25. package/dist/components/chat-composer/chat-composer.d.ts +92 -0
  26. package/dist/components/chat-composer/chat-composer.js +285 -0
  27. package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
  28. package/dist/components/chat-composer/chat-composer.styles.js +135 -0
  29. package/dist/components/chat-message/chat-message.d.ts +113 -0
  30. package/dist/components/chat-message/chat-message.js +291 -0
  31. package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
  32. package/dist/components/chat-message/chat-message.styles.js +203 -0
  33. package/dist/components/checkbox/checkbox.d.ts +59 -0
  34. package/dist/components/checkbox/checkbox.js +230 -0
  35. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  36. package/dist/components/checkbox/checkbox.styles.js +70 -0
  37. package/dist/components/chip/chip-group.d.ts +56 -0
  38. package/dist/components/chip/chip-group.js +124 -0
  39. package/dist/components/chip/chip-group.styles.d.ts +1 -0
  40. package/dist/components/chip/chip-group.styles.js +57 -0
  41. package/dist/components/chip/chip.d.ts +64 -0
  42. package/dist/components/chip/chip.js +115 -0
  43. package/dist/components/chip/chip.styles.d.ts +1 -0
  44. package/dist/components/chip/chip.styles.js +115 -0
  45. package/dist/components/citation-badge/citation-badge.d.ts +113 -0
  46. package/dist/components/citation-badge/citation-badge.js +300 -0
  47. package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
  48. package/dist/components/citation-badge/citation-badge.styles.js +96 -0
  49. package/dist/components/code-block/code-block.d.ts +89 -0
  50. package/dist/components/code-block/code-block.js +317 -0
  51. package/dist/components/code-block/code-block.styles.d.ts +1 -0
  52. package/dist/components/code-block/code-block.styles.js +187 -0
  53. package/dist/components/code-block/code-loader.d.ts +44 -0
  54. package/dist/components/code-block/code-loader.js +79 -0
  55. package/dist/components/combobox/combobox.d.ts +19 -1
  56. package/dist/components/combobox/combobox.js +84 -14
  57. package/dist/components/combobox/option.d.ts +5 -1
  58. package/dist/components/combobox/option.js +35 -0
  59. package/dist/components/context-meter/context-meter.d.ts +53 -0
  60. package/dist/components/context-meter/context-meter.js +150 -0
  61. package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
  62. package/dist/components/context-meter/context-meter.styles.js +120 -0
  63. package/dist/components/conversation-item/conversation-item.d.ts +128 -0
  64. package/dist/components/conversation-item/conversation-item.js +322 -0
  65. package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
  66. package/dist/components/conversation-item/conversation-item.styles.js +155 -0
  67. package/dist/components/date-picker/date-input.d.ts +24 -0
  68. package/dist/components/date-picker/date-input.js +134 -22
  69. package/dist/components/date-picker/date-picker.d.ts +7 -0
  70. package/dist/components/date-picker/date-picker.js +85 -16
  71. package/dist/components/dialog/confirm.d.ts +40 -0
  72. package/dist/components/dialog/confirm.js +79 -0
  73. package/dist/components/dialog/dialog.d.ts +85 -0
  74. package/dist/components/dialog/dialog.js +272 -0
  75. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  76. package/dist/components/dialog/dialog.styles.js +52 -0
  77. package/dist/components/dock-panel/dock-panel.d.ts +134 -0
  78. package/dist/components/dock-panel/dock-panel.js +345 -0
  79. package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
  80. package/dist/components/dock-panel/dock-panel.styles.js +145 -0
  81. package/dist/components/document-preview/document-preview.d.ts +135 -0
  82. package/dist/components/document-preview/document-preview.js +372 -0
  83. package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
  84. package/dist/components/document-preview/document-preview.styles.js +191 -0
  85. package/dist/components/export-button/csv.js +1 -1
  86. package/dist/components/export-button/export-button.js +2 -0
  87. package/dist/components/flag/flag.d.ts +42 -5
  88. package/dist/components/flag/flag.js +70 -3
  89. package/dist/components/gauge/gauge.js +19 -10
  90. package/dist/components/generation-status/generation-status.d.ts +109 -0
  91. package/dist/components/generation-status/generation-status.js +273 -0
  92. package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
  93. package/dist/components/generation-status/generation-status.styles.js +84 -0
  94. package/dist/components/heatmap/calendar-grid.d.ts +4 -1
  95. package/dist/components/heatmap/calendar-grid.js +25 -12
  96. package/dist/components/heatmap/heatmap-scale.d.ts +6 -0
  97. package/dist/components/heatmap/heatmap-scale.js +7 -1
  98. package/dist/components/heatmap/heatmap.d.ts +89 -3
  99. package/dist/components/heatmap/heatmap.js +158 -29
  100. package/dist/components/json-viewer/json-viewer.d.ts +53 -0
  101. package/dist/components/json-viewer/json-viewer.js +283 -0
  102. package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
  103. package/dist/components/json-viewer/json-viewer.styles.js +176 -0
  104. package/dist/components/kbd/kbd.d.ts +77 -0
  105. package/dist/components/kbd/kbd.js +214 -0
  106. package/dist/components/kbd/kbd.styles.d.ts +1 -0
  107. package/dist/components/kbd/kbd.styles.js +52 -0
  108. package/dist/components/live-region/live-region.d.ts +81 -0
  109. package/dist/components/live-region/live-region.js +153 -0
  110. package/dist/components/live-region/live-region.styles.d.ts +1 -0
  111. package/dist/components/live-region/live-region.styles.js +10 -0
  112. package/dist/components/map/map.d.ts +8 -6
  113. package/dist/components/map/map.js +44 -8
  114. package/dist/components/markdown/markdown-loader.d.ts +34 -0
  115. package/dist/components/markdown/markdown-loader.js +43 -0
  116. package/dist/components/markdown/markdown.d.ts +81 -0
  117. package/dist/components/markdown/markdown.js +284 -0
  118. package/dist/components/markdown/markdown.styles.d.ts +1 -0
  119. package/dist/components/markdown/markdown.styles.js +82 -0
  120. package/dist/components/media-card/media-card.d.ts +122 -0
  121. package/dist/components/media-card/media-card.js +295 -0
  122. package/dist/components/media-card/media-card.styles.d.ts +1 -0
  123. package/dist/components/media-card/media-card.styles.js +132 -0
  124. package/dist/components/mention-popover/mention-popover.d.ts +200 -0
  125. package/dist/components/mention-popover/mention-popover.js +475 -0
  126. package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
  127. package/dist/components/mention-popover/mention-popover.styles.js +101 -0
  128. package/dist/components/menu/menu-item.d.ts +62 -0
  129. package/dist/components/menu/menu-item.js +119 -0
  130. package/dist/components/menu/menu-item.styles.d.ts +1 -0
  131. package/dist/components/menu/menu-item.styles.js +67 -0
  132. package/dist/components/menu/menu.d.ts +143 -0
  133. package/dist/components/menu/menu.js +365 -0
  134. package/dist/components/menu/menu.styles.d.ts +1 -0
  135. package/dist/components/menu/menu.styles.js +66 -0
  136. package/dist/components/model-select/model-select.d.ts +125 -0
  137. package/dist/components/model-select/model-select.js +490 -0
  138. package/dist/components/model-select/model-select.styles.d.ts +1 -0
  139. package/dist/components/model-select/model-select.styles.js +189 -0
  140. package/dist/components/model-settings-panel/model-settings-panel.d.ts +69 -0
  141. package/dist/components/model-settings-panel/model-settings-panel.js +145 -0
  142. package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
  143. package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
  144. package/dist/components/playback/playback.d.ts +13 -1
  145. package/dist/components/playback/playback.js +47 -14
  146. package/dist/components/responsive-panel/responsive-panel.d.ts +150 -0
  147. package/dist/components/responsive-panel/responsive-panel.js +365 -0
  148. package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
  149. package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
  150. package/dist/components/result-card/result-card.d.ts +44 -0
  151. package/dist/components/result-card/result-card.js +83 -0
  152. package/dist/components/result-card/result-card.styles.d.ts +1 -0
  153. package/dist/components/result-card/result-card.styles.js +50 -0
  154. package/dist/components/result-card/result-field.d.ts +36 -0
  155. package/dist/components/result-card/result-field.js +87 -0
  156. package/dist/components/result-card/result-field.styles.d.ts +1 -0
  157. package/dist/components/result-card/result-field.styles.js +32 -0
  158. package/dist/components/select/select.d.ts +45 -1
  159. package/dist/components/select/select.js +114 -17
  160. package/dist/components/select/select.styles.js +26 -2
  161. package/dist/components/slider/slider.d.ts +89 -0
  162. package/dist/components/slider/slider.js +352 -0
  163. package/dist/components/slider/slider.styles.d.ts +1 -0
  164. package/dist/components/slider/slider.styles.js +87 -0
  165. package/dist/components/source-card/source-card.d.ts +92 -0
  166. package/dist/components/source-card/source-card.js +148 -0
  167. package/dist/components/source-card/source-card.styles.d.ts +1 -0
  168. package/dist/components/source-card/source-card.styles.js +69 -0
  169. package/dist/components/source-list/source-list.d.ts +63 -0
  170. package/dist/components/source-list/source-list.js +122 -0
  171. package/dist/components/source-list/source-list.styles.d.ts +1 -0
  172. package/dist/components/source-list/source-list.styles.js +59 -0
  173. package/dist/components/sparkline/sparkline.js +27 -13
  174. package/dist/components/split/split.d.ts +93 -1
  175. package/dist/components/split/split.js +284 -15
  176. package/dist/components/split/split.styles.js +30 -0
  177. package/dist/components/stat/stat.d.ts +22 -1
  178. package/dist/components/stat/stat.js +49 -3
  179. package/dist/components/stat/stat.styles.js +20 -0
  180. package/dist/components/stream-status/stream-status.d.ts +110 -0
  181. package/dist/components/stream-status/stream-status.js +210 -0
  182. package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
  183. package/dist/components/stream-status/stream-status.styles.js +103 -0
  184. package/dist/components/streaming-text/streaming-text.d.ts +98 -0
  185. package/dist/components/streaming-text/streaming-text.js +209 -0
  186. package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
  187. package/dist/components/streaming-text/streaming-text.styles.js +62 -0
  188. package/dist/components/switch/switch.d.ts +58 -0
  189. package/dist/components/switch/switch.js +179 -0
  190. package/dist/components/switch/switch.styles.d.ts +1 -0
  191. package/dist/components/switch/switch.styles.js +75 -0
  192. package/dist/components/table/table.d.ts +73 -4
  193. package/dist/components/table/table.js +169 -20
  194. package/dist/components/table/table.styles.js +6 -1
  195. package/dist/components/tabs/tabs.d.ts +51 -0
  196. package/dist/components/tabs/tabs.js +190 -0
  197. package/dist/components/tabs/tabs.styles.d.ts +1 -0
  198. package/dist/components/tabs/tabs.styles.js +63 -0
  199. package/dist/components/thinking-panel/thinking-panel.d.ts +121 -0
  200. package/dist/components/thinking-panel/thinking-panel.js +235 -0
  201. package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
  202. package/dist/components/thinking-panel/thinking-panel.styles.js +117 -0
  203. package/dist/components/toast/toast-item.d.ts +1 -0
  204. package/dist/components/toast/toast-item.js +31 -6
  205. package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +130 -0
  206. package/dist/components/tool-approval-dialog/tool-approval-dialog.js +403 -0
  207. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
  208. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
  209. package/dist/components/tool-call-chip/tool-call-chip.d.ts +89 -0
  210. package/dist/components/tool-call-chip/tool-call-chip.js +288 -0
  211. package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
  212. package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
  213. package/dist/components/tool-param-form/tool-param-form.d.ts +145 -0
  214. package/dist/components/tool-param-form/tool-param-form.js +366 -0
  215. package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
  216. package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
  217. package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +102 -0
  218. package/dist/components/tool-result-dialog/tool-result-dialog.js +393 -0
  219. package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
  220. package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
  221. package/dist/components/tool-result-view/registry.d.ts +81 -0
  222. package/dist/components/tool-result-view/registry.js +84 -0
  223. package/dist/components/tool-result-view/tool-result-view.d.ts +55 -0
  224. package/dist/components/tool-result-view/tool-result-view.js +138 -0
  225. package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
  226. package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
  227. package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
  228. package/dist/components/tool-select-dialog/tool-select-dialog.js +439 -0
  229. package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
  230. package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +182 -0
  231. package/dist/components/tree/tree-node.d.ts +11 -2
  232. package/dist/components/tree/tree-node.js +16 -6
  233. package/dist/components/tree/tree.d.ts +8 -2
  234. package/dist/components/tree/tree.js +18 -11
  235. package/dist/components/typing-indicator/typing-indicator.d.ts +60 -0
  236. package/dist/components/typing-indicator/typing-indicator.js +96 -0
  237. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
  238. package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
  239. package/dist/components/virtual-list/virtual-list.d.ts +173 -0
  240. package/dist/components/virtual-list/virtual-list.js +461 -0
  241. package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
  242. package/dist/components/virtual-list/virtual-list.styles.js +44 -0
  243. package/dist/components/widget/widget.d.ts +10 -0
  244. package/dist/components/widget/widget.js +24 -1
  245. package/dist/components/widget/widget.styles.js +9 -2
  246. package/dist/components/word-cloud/word-cloud-layout.js +14 -1
  247. package/dist/components/word-cloud/word-cloud.d.ts +6 -0
  248. package/dist/components/word-cloud/word-cloud.js +25 -14
  249. package/dist/components/word-cloud/word-cloud.styles.js +4 -2
  250. package/dist/internal/announcer.d.ts +57 -0
  251. package/dist/internal/announcer.js +71 -0
  252. package/dist/internal/form-associated.d.ts +1 -0
  253. package/dist/internal/form-associated.js +55 -11
  254. package/dist/internal/group-by-recency.d.ts +50 -0
  255. package/dist/internal/group-by-recency.js +80 -0
  256. package/dist/internal/rtl.d.ts +23 -0
  257. package/dist/internal/rtl.js +28 -0
  258. package/dist/internal/scroll-lock.d.ts +10 -5
  259. package/dist/internal/scroll-lock.js +30 -14
  260. package/dist/internal/tokens.styles.js +6 -0
  261. package/dist/lyra.d.ts +130 -31
  262. package/dist/lyra.js +94 -26
  263. package/llms-full.txt +3921 -32
  264. package/llms.txt +16 -1
  265. package/package.json +23 -5
  266. package/dist/components/chart/bar-chart.stories.d.ts +0 -5
  267. package/dist/components/chart/bar-chart.stories.js +0 -20
  268. package/dist/components/chart/box-plot.stories.d.ts +0 -5
  269. package/dist/components/chart/box-plot.stories.js +0 -29
  270. package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
  271. package/dist/components/chart/bubble-chart.stories.js +0 -26
  272. package/dist/components/chart/chart.stories.d.ts +0 -32
  273. package/dist/components/chart/chart.stories.js +0 -141
  274. package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
  275. package/dist/components/chart/doughnut-chart.stories.js +0 -26
  276. package/dist/components/chart/histogram.stories.d.ts +0 -5
  277. package/dist/components/chart/histogram.stories.js +0 -17
  278. package/dist/components/chart/line-chart.stories.d.ts +0 -22
  279. package/dist/components/chart/line-chart.stories.js +0 -99
  280. package/dist/components/chart/lite-chart.stories.d.ts +0 -12
  281. package/dist/components/chart/lite-chart.stories.js +0 -98
  282. package/dist/components/chart/pie-chart.stories.d.ts +0 -5
  283. package/dist/components/chart/pie-chart.stories.js +0 -26
  284. package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
  285. package/dist/components/chart/polar-area-chart.stories.js +0 -20
  286. package/dist/components/chart/radar-chart.stories.d.ts +0 -5
  287. package/dist/components/chart/radar-chart.stories.js +0 -20
  288. package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
  289. package/dist/components/chart/scatter-chart.stories.js +0 -31
  290. package/dist/components/combobox/combobox.stories.d.ts +0 -24
  291. package/dist/components/combobox/combobox.stories.js +0 -102
  292. package/dist/components/date-picker/date-input.stories.d.ts +0 -10
  293. package/dist/components/date-picker/date-input.stories.js +0 -48
  294. package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
  295. package/dist/components/date-picker/date-picker.stories.js +0 -25
  296. package/dist/components/empty/empty.stories.d.ts +0 -7
  297. package/dist/components/empty/empty.stories.js +0 -34
  298. package/dist/components/export-button/export-button.stories.d.ts +0 -7
  299. package/dist/components/export-button/export-button.stories.js +0 -37
  300. package/dist/components/file-input/file-input.stories.d.ts +0 -7
  301. package/dist/components/file-input/file-input.stories.js +0 -19
  302. package/dist/components/flag/flag.stories.d.ts +0 -5
  303. package/dist/components/flag/flag.stories.js +0 -17
  304. package/dist/components/gauge/gauge.stories.d.ts +0 -8
  305. package/dist/components/gauge/gauge.stories.js +0 -19
  306. package/dist/components/graph/graph.stories.d.ts +0 -8
  307. package/dist/components/graph/graph.stories.js +0 -68
  308. package/dist/components/heatmap/heatmap.stories.d.ts +0 -22
  309. package/dist/components/heatmap/heatmap.stories.js +0 -154
  310. package/dist/components/map/map.stories.d.ts +0 -15
  311. package/dist/components/map/map.stories.js +0 -135
  312. package/dist/components/playback/playback.stories.d.ts +0 -7
  313. package/dist/components/playback/playback.stories.js +0 -16
  314. package/dist/components/select/select.stories.d.ts +0 -19
  315. package/dist/components/select/select.stories.js +0 -75
  316. package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
  317. package/dist/components/skeleton/skeleton.stories.js +0 -16
  318. package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
  319. package/dist/components/sparkline/sparkline.stories.js +0 -39
  320. package/dist/components/split/split.stories.d.ts +0 -7
  321. package/dist/components/split/split.stories.js +0 -36
  322. package/dist/components/stat/stat.stories.d.ts +0 -8
  323. package/dist/components/stat/stat.stories.js +0 -64
  324. package/dist/components/table/table.stories.d.ts +0 -12
  325. package/dist/components/table/table.stories.js +0 -67
  326. package/dist/components/time-range/time-range.stories.d.ts +0 -8
  327. package/dist/components/time-range/time-range.stories.js +0 -26
  328. package/dist/components/toast/toast.stories.d.ts +0 -8
  329. package/dist/components/toast/toast.stories.js +0 -72
  330. package/dist/components/tree/tree.stories.d.ts +0 -9
  331. package/dist/components/tree/tree.stories.js +0 -52
  332. package/dist/components/widget/widget.stories.d.ts +0 -7
  333. package/dist/components/widget/widget.stories.js +0 -41
  334. package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
  335. package/dist/components/word-cloud/word-cloud.stories.js +0 -55
@@ -0,0 +1,115 @@
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 { closeIcon } from '../../internal/icons.js';
12
+ import { styles } from './chip.styles.js';
13
+ /**
14
+ * `<lyra-chip>` — a small, content-agnostic pill for a short label: a tag, an
15
+ * active-filter/scope indicator, etc. Distinct from `<lyra-attachment-chip>`
16
+ * (specifically file-shaped, with a thumbnail/size/upload-progress) — this
17
+ * one carries no domain assumptions at all, just a label and an optional
18
+ * leading icon/dot.
19
+ *
20
+ * `tone` tints the whole pill using the same loud-color-on-quiet-tint
21
+ * convention `<lyra-tool-call-chip>`/`<lyra-citation-badge>` already
22
+ * establish for status coloring: background is the tone's `-quiet` tint,
23
+ * text/icon is the tone's loud color. `neutral` (the default) has no
24
+ * dedicated token pair of its own, so it falls back to a plain
25
+ * bordered-surface look — the same "no signal" treatment
26
+ * `<lyra-citation-badge>`'s `default` status and `<lyra-tool-call-chip>`'s
27
+ * `pending` status already use.
28
+ *
29
+ * This is a controlled component: clicking the remove (×) button only fires
30
+ * `lyra-remove` — the chip never removes itself from the DOM on its own
31
+ * interaction, the same contract `<lyra-attachment-chip>`/
32
+ * `<lyra-conversation-item>` already follow. A consumer owns the underlying
33
+ * list and decides whether/how the click actually removes anything.
34
+ *
35
+ * @customElement lyra-chip
36
+ * @slot - The chip's label content.
37
+ * @slot icon - Optional leading icon or status dot. Nothing is reserved for
38
+ * it (no extra gap) when left empty.
39
+ * @event lyra-remove - The remove (×) button was activated (click, or
40
+ * Enter/Space while focused — native `<button>` behavior). `detail: { value }`
41
+ * — `value` is `undefined` when the `value` prop was never set. Only
42
+ * rendered while `removable`.
43
+ * @csspart base - The pill's root container.
44
+ * @csspart icon - Wrapper around the `icon` slot. Hidden entirely while empty.
45
+ * @csspart label - Wrapper around the default slot.
46
+ * @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
47
+ */
48
+ export class LyraChip extends LyraElement {
49
+ constructor() {
50
+ super(...arguments);
51
+ /** Status/emphasis color. `neutral` (the default) reads as plain/unstyled. */
52
+ this.tone = 'neutral';
53
+ /** Shows the remove (×) button. */
54
+ this.removable = false;
55
+ // A `[part]` always contains a literal `<slot>` child regardless of
56
+ // assigned content, so `:empty` never matches — real emptiness is tracked
57
+ // in JS instead, the same fix `<lyra-stat>`'s `hasIcon`/
58
+ // `<lyra-tool-call-chip>`'s `hasDetailSlot` etc. already establish.
59
+ this.hasIconSlot = false;
60
+ this.onIconSlotChange = (e) => {
61
+ this.hasIconSlot = e.target.assignedElements({ flatten: true }).length > 0;
62
+ };
63
+ this.onRemoveClick = () => {
64
+ this.emit('lyra-remove', { value: this.value });
65
+ };
66
+ }
67
+ static { this.styles = [LyraElement.styles, styles]; }
68
+ willUpdate() {
69
+ if (!this.hasUpdated) {
70
+ this.hasIconSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'icon');
71
+ }
72
+ }
73
+ // Only the default slot's own content counts toward the remove button's
74
+ // accessible name — text incidentally living inside the (decorative)
75
+ // `icon` slot shouldn't leak into "Remove {text}".
76
+ get labelText() {
77
+ return Array.from(this.childNodes)
78
+ .filter((n) => !(n instanceof Element && n.getAttribute('slot') === 'icon'))
79
+ .map((n) => n.textContent ?? '')
80
+ .join('')
81
+ .trim();
82
+ }
83
+ get accessibleRemoveLabel() {
84
+ const text = this.labelText;
85
+ return text ? `Remove ${text}` : 'Remove';
86
+ }
87
+ render() {
88
+ return html `
89
+ <span part="base">
90
+ <span part="icon" aria-hidden="true" ?hidden=${!this.hasIconSlot}>
91
+ <slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
92
+ </span>
93
+ <span part="label"><slot></slot></span>
94
+ ${this.removable
95
+ ? html `<button part="remove-button" type="button" aria-label=${this.accessibleRemoveLabel} @click=${this.onRemoveClick}>
96
+ ${closeIcon()}
97
+ </button>`
98
+ : nothing}
99
+ </span>
100
+ `;
101
+ }
102
+ }
103
+ __decorate([
104
+ property({ reflect: true })
105
+ ], LyraChip.prototype, "tone", void 0);
106
+ __decorate([
107
+ property({ type: Boolean, reflect: true })
108
+ ], LyraChip.prototype, "removable", void 0);
109
+ __decorate([
110
+ property()
111
+ ], LyraChip.prototype, "value", void 0);
112
+ __decorate([
113
+ state()
114
+ ], LyraChip.prototype, "hasIconSlot", void 0);
115
+ defineElement('chip', LyraChip);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,115 @@
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
+ /* One custom-property trio swapped by the :host([tone]) rules below,
8
+ rather than repeating background/color/border per part per tone —
9
+ mirrors lyra-tool-call-chip's/lyra-attachment-chip's identical
10
+ -accent/-bg/-border trio so a chip's tone vocabulary reads the same
11
+ everywhere in the library. 'neutral' has no dedicated token pair (see
12
+ the class doc), so it falls back to plain surface/border/text instead
13
+ of inventing a sixth tint. */
14
+ --lyra-chip-accent: var(--lyra-color-text);
15
+ --lyra-chip-bg: var(--lyra-color-surface);
16
+ --lyra-chip-border: var(--lyra-color-border);
17
+ }
18
+
19
+ :host([tone='brand']) {
20
+ --lyra-chip-accent: var(--lyra-color-brand);
21
+ --lyra-chip-bg: var(--lyra-color-brand-quiet);
22
+ --lyra-chip-border: transparent;
23
+ }
24
+ :host([tone='success']) {
25
+ --lyra-chip-accent: var(--lyra-color-success);
26
+ --lyra-chip-bg: var(--lyra-color-success-quiet);
27
+ --lyra-chip-border: transparent;
28
+ }
29
+ :host([tone='warning']) {
30
+ --lyra-chip-accent: var(--lyra-color-warning);
31
+ --lyra-chip-bg: var(--lyra-color-warning-quiet);
32
+ --lyra-chip-border: transparent;
33
+ }
34
+ :host([tone='danger']) {
35
+ --lyra-chip-accent: var(--lyra-color-danger);
36
+ --lyra-chip-bg: var(--lyra-color-danger-quiet);
37
+ --lyra-chip-border: transparent;
38
+ }
39
+
40
+ [part='base'] {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ gap: var(--lyra-space-xs);
44
+ max-inline-size: 100%;
45
+ box-sizing: border-box;
46
+ padding: 0.25rem var(--lyra-space-s);
47
+ border: 1px solid var(--lyra-chip-border);
48
+ border-radius: 999px;
49
+ background: var(--lyra-chip-bg);
50
+ color: var(--lyra-chip-accent);
51
+ font: inherit;
52
+ font-size: 0.8125rem;
53
+ font-weight: 500;
54
+ line-height: 1.3;
55
+ }
56
+
57
+ [part='icon'] {
58
+ display: inline-flex;
59
+ flex: 0 0 auto;
60
+ align-items: center;
61
+ justify-content: center;
62
+ }
63
+ [part='icon'] ::slotted(*) {
64
+ display: block;
65
+ }
66
+ /* Defeats [part='icon']'s own 'display: inline-flex' above -- the native
67
+ [hidden] UA rule alone would lose to it at equal specificity. Same fix
68
+ lyra-stat's identical [part='icon'][hidden] override already applies. */
69
+ [part='icon'][hidden] {
70
+ display: none;
71
+ }
72
+
73
+ [part='label'] {
74
+ flex: 1 1 auto;
75
+ min-inline-size: 0;
76
+ overflow: hidden;
77
+ text-overflow: ellipsis;
78
+ white-space: nowrap;
79
+ }
80
+
81
+ [part='remove-button'] {
82
+ flex: 0 0 auto;
83
+ display: inline-flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ min-inline-size: min(var(--lyra-icon-button-size), 1.25rem);
87
+ min-block-size: min(var(--lyra-icon-button-size), 1.25rem);
88
+ margin-inline-end: -0.15rem;
89
+ padding: 0;
90
+ border: none;
91
+ border-radius: 999px;
92
+ background: transparent;
93
+ color: inherit;
94
+ font-size: 0.75em;
95
+ cursor: pointer;
96
+ -webkit-tap-highlight-color: transparent;
97
+ transition: background-color var(--lyra-transition-fast);
98
+ }
99
+ [part='remove-button']:hover {
100
+ background: color-mix(in srgb, currentColor 16%, transparent);
101
+ }
102
+ [part='remove-button']:focus-visible {
103
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
104
+ outline-offset: var(--lyra-focus-ring-offset);
105
+ }
106
+ [part='remove-button'] svg {
107
+ display: block;
108
+ }
109
+
110
+ @media (prefers-reduced-motion: reduce) {
111
+ [part='remove-button'] {
112
+ transition: none !important;
113
+ }
114
+ }
115
+ `;
@@ -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,300 @@
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
+ /**
33
+ * `<lyra-citation-badge>` — an inline `[n]` citation marker with a hover/
34
+ * focus preview popover and confidence/verification-status coloring. Used
35
+ * for an agent response's inline citations, each carrying a `source-id`
36
+ * that matches a corresponding `<lyra-source-card>` shown elsewhere on the
37
+ * page (a sibling component in this same family — this component doesn't
38
+ * import or know anything about it, only carries the id through its
39
+ * events).
40
+ *
41
+ * The default slot is *not* the badge's visible content — the badge always
42
+ * renders `[index]` — it's reserved for optional rich preview content (e.g.
43
+ * a filename + short excerpt) shown in a floating popover on hover/focus,
44
+ * positioned with `internal/positioner.js`'s `place()` the same way
45
+ * `<lyra-tool-call-chip>` positions its own detail tooltip. No popover shows
46
+ * at all when the slot carries no content, and the popover never traps
47
+ * focus — it's supplementary preview content, not a modal, so Tab continues
48
+ * past the badge normally even while it happens to be visible from a mouse
49
+ * hover.
50
+ *
51
+ * Two distinct signals fire from the same badge: `lyra-citation-activate`
52
+ * (click, or Enter while focused — native `<button>` behavior, no listener
53
+ * needed for the Enter case) is the lightweight "jump to this source"
54
+ * signal a host wires to scrolling/highlighting the matching
55
+ * `<lyra-source-card>`. `lyra-citation-open` (dblclick, or Space while
56
+ * focused) is a distinct "full preview" signal — `href` in its detail is
57
+ * `undefined` when the `href` prop isn't set; the consumer decides what
58
+ * "open" means (a new tab, a dialog, etc). A double-click still fires two
59
+ * `lyra-citation-activate` events (one per constituent click — standard
60
+ * browser `dblclick` behavior) in addition to the one `lyra-citation-open`;
61
+ * a consumer that only cares about the richer signal on a double-click
62
+ * should ignore the paired activate events in that case.
63
+ *
64
+ * Status coloring: `verified`/`high` use the success tones (a claim that's
65
+ * been checked out, or the model is confident in). `medium`/`low` use
66
+ * warning (progressively less certain, but still a real citation).
67
+ * `unverified` uses danger — deliberately distinct from `low`: "hasn't been
68
+ * checked at all" is a different (arguably riskier) claim than "checked but
69
+ * uncertain". `default` renders as plain neutral text with no background
70
+ * tint, for citations that carry no confidence/verification signal at all.
71
+ *
72
+ * @customElement lyra-citation-badge
73
+ * @slot - Rich preview/tooltip content (e.g. a filename + excerpt), shown in
74
+ * a floating popover on hover/focus. Nothing renders (no hover affordance at
75
+ * all) when this slot is empty.
76
+ * @event lyra-citation-activate - The badge was activated (click, or Enter
77
+ * while focused). `detail: { sourceId, index }`.
78
+ * @event lyra-citation-open - The badge's "full preview" affordance was
79
+ * triggered (dblclick, or Space while focused).
80
+ * `detail: { sourceId, index, href }`.
81
+ * @csspart base - The clickable badge (`<button>`).
82
+ * @csspart bracket - Each of the two literal `[`/`]` glyphs.
83
+ * @csspart index - The citation number.
84
+ * @csspart popover - The floating preview panel (only meaningful while open).
85
+ */
86
+ export class LyraCitationBadge extends LyraElement {
87
+ constructor() {
88
+ super(...arguments);
89
+ /** The citation number shown, e.g. `3` renders as `[3]`. */
90
+ this.index = 1;
91
+ /** Confidence/verification state — drives the badge's color and (unless
92
+ * `label` is set) part of its accessible name. */
93
+ this.status = 'default';
94
+ /** Id of a corresponding `<lyra-source-card>` elsewhere on the page —
95
+ * echoed back verbatim in both events, never read or validated here. */
96
+ this.sourceId = '';
97
+ /** Optional direct link target for the citation's source. Carried into
98
+ * `lyra-citation-open`'s detail as-is; this component never navigates. */
99
+ this.href = '';
100
+ /** Overrides the computed accessible name (`"Citation {index}[, {status}]"`). */
101
+ this.label = '';
102
+ // A `[part]` always contains a literal `<slot>` child regardless of
103
+ // assigned content, so `:empty` never matches — real emptiness is tracked
104
+ // in JS instead, same fix lyra-tool-call-chip's hasDetailSlot/lyra-stat's
105
+ // hasIcon etc. already establish.
106
+ this.hasPreviewSlot = false;
107
+ this.popoverOpen = false;
108
+ this.popoverId = nextId('citation-badge-popover');
109
+ // Hover and focus are tracked as independent "keep it open" reasons —
110
+ // mirrors lyra-toast-item's identical hovering/focused pair — so releasing
111
+ // one (e.g. the pointer leaving while the badge still has keyboard focus)
112
+ // doesn't schedule a hide the other modality is still holding open.
113
+ this.hovering = false;
114
+ this.focused = false;
115
+ this.onSlotChange = (e) => {
116
+ this.hasPreviewSlot = e.target.assignedElements({ flatten: true }).length > 0;
117
+ // The slot can be emptied out from under an already-open popover (e.g. a
118
+ // consumer clearing preview content asynchronously) — nothing left to
119
+ // show, so don't leave an empty panel floating open.
120
+ if (!this.hasPreviewSlot)
121
+ this.hidePreviewNow();
122
+ };
123
+ // Attached to the wrapper (not the button alone) so the popover's own
124
+ // slotted content counts too — pointerenter/pointerleave/focusin/focusout
125
+ // fire relative to whichever element they're bound to, not per descendant,
126
+ // so moving the pointer or focus between the button and the popover panel
127
+ // within this same wrapper never toggles hovering/focused off and on.
128
+ this.onPointerEnter = () => {
129
+ this.hovering = true;
130
+ this.showPreview();
131
+ };
132
+ this.onPointerLeave = () => {
133
+ this.hovering = false;
134
+ this.scheduleHidePreview();
135
+ };
136
+ this.onFocusIn = () => {
137
+ this.focused = true;
138
+ this.showPreview();
139
+ };
140
+ // No grace period here, unlike onPointerLeave -- a blur (Tab/Shift+Tab
141
+ // away, or focus programmatically moved elsewhere) is a deliberate
142
+ // navigation, not the transient pointer travel the delay exists to survive,
143
+ // so it closes at once. Still deferred to hover if the pointer happens to
144
+ // be resting on the badge/popover at the same time.
145
+ this.onFocusOut = () => {
146
+ this.focused = false;
147
+ if (this.hovering)
148
+ return;
149
+ this.hidePreviewNow();
150
+ };
151
+ // keydown bubbles up from whatever actually holds focus (the button, or a
152
+ // focusable element inside slotted preview content) — attaching this at
153
+ // the wrapper, rather than the button alone, is what makes Escape work
154
+ // "while the popover has focus-within" per the component's contract,
155
+ // without needing to track focus targets explicitly here.
156
+ this.onKeyDown = (e) => {
157
+ if (e.key === 'Escape' && this.popoverOpen) {
158
+ // Swallow it here rather than letting it bubble to e.g. a containing
159
+ // lyra-dialog's own Escape-to-close handler — dismissing this
160
+ // lightweight preview shouldn't also close a surrounding modal.
161
+ e.stopPropagation();
162
+ this.hidePreviewNow();
163
+ return;
164
+ }
165
+ // Space normally activates a <button> the same as Enter, but this
166
+ // component gives the two keys distinct meanings (Enter = activate,
167
+ // Space = open) — so Space's native click-on-keyup must be pre-empted
168
+ // here (preventDefault on keydown suppresses it) rather than left to
169
+ // fire alongside this. Enter deliberately gets no such handling: its
170
+ // native immediate click already reaches onClick below.
171
+ if (e.key === ' ' && !e.repeat && e.target === this.buttonEl) {
172
+ e.preventDefault();
173
+ this.emitOpen();
174
+ }
175
+ };
176
+ this.onClick = () => {
177
+ this.emit('lyra-citation-activate', { sourceId: this.sourceId, index: this.index });
178
+ };
179
+ this.onDblClick = () => {
180
+ this.emitOpen();
181
+ };
182
+ }
183
+ static { this.styles = [LyraElement.styles, styles]; }
184
+ willUpdate() {
185
+ if (!this.hasUpdated) {
186
+ this.hasPreviewSlot = Array.from(this.children).some((el) => !el.hasAttribute('slot'));
187
+ }
188
+ }
189
+ updated(changed) {
190
+ if (changed.has('popoverOpen')) {
191
+ this.cleanupPositioner?.();
192
+ this.cleanupPositioner = undefined;
193
+ if (this.popoverOpen && this.buttonEl && this.popoverEl) {
194
+ this.cleanupPositioner = place(this.buttonEl, this.popoverEl, { placement: 'top-start' });
195
+ }
196
+ }
197
+ }
198
+ disconnectedCallback() {
199
+ super.disconnectedCallback();
200
+ this.cleanupPositioner?.();
201
+ clearTimeout(this.hideTimer);
202
+ }
203
+ get accessibleLabel() {
204
+ if (this.label)
205
+ return this.label;
206
+ const statusText = STATUS_LABEL[this.status];
207
+ return statusText ? `Citation ${this.index}, ${statusText}` : `Citation ${this.index}`;
208
+ }
209
+ // Named showPreview/hidePreviewNow (not show/hidePopover) to avoid
210
+ // colliding with the standard HTML Popover API's own
211
+ // HTMLElement.prototype.showPopover()/hidePopover() -- this component
212
+ // renders its own floating panel via internal/positioner.js rather than
213
+ // the native `popover` attribute, but TS's DOM lib still declares those
214
+ // method names on every HTMLElement subclass, so reusing them here would
215
+ // be a same-name-different-signature override error.
216
+ showPreview() {
217
+ if (!this.hasPreviewSlot || this.popoverOpen)
218
+ return;
219
+ clearTimeout(this.hideTimer);
220
+ this.hideTimer = undefined;
221
+ this.popoverOpen = true;
222
+ }
223
+ scheduleHidePreview() {
224
+ if (!this.popoverOpen || this.hovering || this.focused)
225
+ return;
226
+ clearTimeout(this.hideTimer);
227
+ this.hideTimer = setTimeout(() => {
228
+ this.hideTimer = undefined;
229
+ this.popoverOpen = false;
230
+ }, HIDE_DELAY_MS);
231
+ }
232
+ hidePreviewNow() {
233
+ clearTimeout(this.hideTimer);
234
+ this.hideTimer = undefined;
235
+ if (this.popoverOpen)
236
+ this.popoverOpen = false;
237
+ }
238
+ emitOpen() {
239
+ this.emit('lyra-citation-open', {
240
+ sourceId: this.sourceId,
241
+ index: this.index,
242
+ href: this.href || undefined,
243
+ });
244
+ }
245
+ render() {
246
+ return html `
247
+ <span
248
+ class="wrapper"
249
+ @pointerenter=${this.onPointerEnter}
250
+ @pointerleave=${this.onPointerLeave}
251
+ @focusin=${this.onFocusIn}
252
+ @focusout=${this.onFocusOut}
253
+ @keydown=${this.onKeyDown}
254
+ >
255
+ <button
256
+ part="base"
257
+ type="button"
258
+ aria-label=${this.getAttribute('aria-label') || this.accessibleLabel}
259
+ aria-describedby=${this.hasPreviewSlot && this.popoverOpen ? this.popoverId : nothing}
260
+ @click=${this.onClick}
261
+ @dblclick=${this.onDblClick}
262
+ >
263
+ <span part="bracket" aria-hidden="true">[</span><span part="index">${this.index}</span
264
+ ><span part="bracket" aria-hidden="true">]</span>
265
+ </button>
266
+ <div part="popover" id=${this.popoverId} role="tooltip" ?hidden=${!this.popoverOpen}>
267
+ <slot @slotchange=${this.onSlotChange}></slot>
268
+ </div>
269
+ </span>
270
+ `;
271
+ }
272
+ }
273
+ __decorate([
274
+ property({ type: Number })
275
+ ], LyraCitationBadge.prototype, "index", void 0);
276
+ __decorate([
277
+ property({ reflect: true })
278
+ ], LyraCitationBadge.prototype, "status", void 0);
279
+ __decorate([
280
+ property({ attribute: 'source-id' })
281
+ ], LyraCitationBadge.prototype, "sourceId", void 0);
282
+ __decorate([
283
+ property()
284
+ ], LyraCitationBadge.prototype, "href", void 0);
285
+ __decorate([
286
+ property()
287
+ ], LyraCitationBadge.prototype, "label", void 0);
288
+ __decorate([
289
+ state()
290
+ ], LyraCitationBadge.prototype, "hasPreviewSlot", void 0);
291
+ __decorate([
292
+ state()
293
+ ], LyraCitationBadge.prototype, "popoverOpen", void 0);
294
+ __decorate([
295
+ query('[part="base"]')
296
+ ], LyraCitationBadge.prototype, "buttonEl", void 0);
297
+ __decorate([
298
+ query('[part="popover"]')
299
+ ], LyraCitationBadge.prototype, "popoverEl", void 0);
300
+ defineElement('citation-badge', LyraCitationBadge);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;