@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,141 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ export type AttachmentChipStatus = 'pending' | 'uploading' | 'error' | 'done';
4
+ export interface AttachmentChipIdDetail {
5
+ id: string;
6
+ }
7
+ /**
8
+ * `512` -> `"512 B"`; `2415919` -> `"2.3 MB"`. Whole bytes never get a
9
+ * decimal (there's no meaningful fraction of a byte); every unit past that
10
+ * gets exactly one decimal place. Returns `""` for a negative/non-finite
11
+ * input so a missing/unknown size renders nothing instead of `"NaN B"`.
12
+ */
13
+ export declare function formatFileSize(bytes: number): string;
14
+ /**
15
+ * `<lyra-attachment-chip>` — a compact chip representing one file queued for
16
+ * (or already part of) a chat message: a composer's pre-send attachment
17
+ * tray, or a sent message's `attachments` slot (see `<lyra-chat-message>`).
18
+ *
19
+ * Two independent ways to populate it, matching the two points in a message's
20
+ * lifecycle this is used at:
21
+ * - Set `file` to a real `File` (fresh from a picker/drop) — `name`, `size`,
22
+ * `mime-type` and the image thumbnail are all auto-derived from it.
23
+ * - Set the plain `name`/`size`/`mime-type`/`thumbnail-src` props instead,
24
+ * for reconstructing a chip from server-persisted attachment metadata
25
+ * (e.g. after a page reload, when no real `File` object exists any more).
26
+ *
27
+ * `file` always wins when both are present — see each accessor's own doc.
28
+ * The image thumbnail for a real `File` is a cached `URL.createObjectURL()`
29
+ * blob URL, created in the update lifecycle immediately before the thumbnail
30
+ * renders and revoked automatically once `file`
31
+ * changes away from the object it was created for, and on disconnect — this
32
+ * component never leaks a blob URL.
33
+ *
34
+ * Identifying *which* attachment a `lyra-remove`/`lyra-retry` event is about:
35
+ * this deliberately reuses the platform's own `id`/`id` attribute (every
36
+ * element already has one; there's no need to shadow it with a second,
37
+ * differently-named Lit property, unlike e.g. `<lyra-tool-call-chip>`'s
38
+ * `call-id` which identifies a *call*, a concept distinct from the chip
39
+ * element itself). Set `id="..."` when you have a stable server-side
40
+ * attachment id. When `id` is left unset and `file` is set, a stable id is
41
+ * derived from `` `${file.name}:${file.size}:${file.lastModified}` `` — stable
42
+ * across re-renders of the *same* `File` object without requiring the
43
+ * consumer to invent one. When neither is available, a generated internal id
44
+ * is used as a last resort so the event always has *some* id.
45
+ *
46
+ * i18n/locale: every translatable word rendered by this component is
47
+ * override-able via a dedicated property — `removeLabel`/`retryLabel`
48
+ * (the verb prefixed to the remove/retry buttons' `aria-label`, keeping the
49
+ * `displayName` interpolation), and `uploadingLabel`/`uploadFailedLabel` (the
50
+ * verb/phrase used in the visible `status-text`, keeping the live percentage
51
+ * interpolation for `uploadingLabel`). All four default to today's exact
52
+ * hardcoded English text (`'Remove'`, `'Retry'`, `'Uploading'`, `'Upload
53
+ * failed'`), so leaving them unset changes nothing. These are plain
54
+ * properties, not slots — this component still exposes no slots.
55
+ *
56
+ * @customElement lyra-attachment-chip
57
+ * @event lyra-remove - The user activated the remove (×) button. `detail: { id }`. Only rendered while `removable`.
58
+ * @event lyra-retry - The user activated the retry button. `detail: { id }`. Only rendered while `status="error"`.
59
+ * @csspart base - The chip's root container.
60
+ * @csspart thumbnail - The leading image thumbnail / generic file glyph.
61
+ * @csspart meta - Wrapper around `name` and `size`.
62
+ * @csspart name - The filename (ellipsis-truncated via CSS; the untruncated name is always available via the native `title` tooltip).
63
+ * @csspart size - The human-readable formatted file size. Hidden when no size is known.
64
+ * @csspart status-text - The visible text twin of the status accent color — carries the state in text, not just color. Empty/hidden for `pending`/`done`. Gets `role="alert"` for `status="error"` only, so a screen-reader user not already focused on the chip still hears an upload failure; the ticking `'uploading'` readout deliberately stays out of the accessibility tree the same way `<lyra-generation-status>`'s per-second elapsed/token readout does — a live region re-announcing every progress tick would be noise, not information, while a one-shot failure is exactly the kind of infrequent, actionable transition a live region exists for.
65
+ * @csspart progress - The numeric upload progress bar (`role="progressbar"`), shown only while `status="uploading"` and `progress` is a meaningful (>0) number.
66
+ * @csspart progress-fill - The filled portion of `progress`.
67
+ * @csspart spinner - The indeterminate upload spinner, shown instead of `progress` while `status="uploading"` and `progress` is unset/0.
68
+ * @csspart retry-button - The retry affordance, only rendered while `status="error"`.
69
+ * @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
70
+ */
71
+ export declare class LyraAttachmentChip extends LyraElement {
72
+ static styles: import("lit").CSSResultGroup[];
73
+ /** A real `File`, e.g. fresh from `<lyra-file-input>`'s `lyra-files` event.
74
+ * When set, `name`/`size`/`mime-type`/the image thumbnail are all derived
75
+ * from it, taking precedence over the independent props below. */
76
+ file?: File;
77
+ /** Filename, used only while `file` is unset. */
78
+ name: string;
79
+ /** File size in bytes, used only while `file` is unset. */
80
+ size: number;
81
+ /** MIME type, used only while `file` is unset. */
82
+ mimeType: string;
83
+ /** Thumbnail image URL, used only while `file` is unset (a real `File`'s
84
+ * thumbnail always comes from a generated object URL instead — see the
85
+ * class doc). Unlike the other independent props this one has no
86
+ * `file`-derived equivalent to defer to for a non-image file; it's simply
87
+ * rendered whenever present. */
88
+ thumbnailSrc: string;
89
+ /** Lifecycle state — drives the accent tint and which of `progress`/`spinner`/`retry-button` renders. */
90
+ status: AttachmentChipStatus;
91
+ /** Upload completion, 0-100. Only meaningful while `status="uploading"`;
92
+ * a value of 0 (the default) or `NaN` falls back to the indeterminate spinner. */
93
+ progress: number;
94
+ /** Shows the remove (×) button. */
95
+ removable: boolean;
96
+ /** Verb used in the remove button's `aria-label`, interpolated as
97
+ * `` `${removeLabel} ${displayName}` `` -- override for i18n/locale.
98
+ * Defaults to `'Remove'`, reproducing today's exact `"Remove ${displayName}"`
99
+ * text byte-for-byte. */
100
+ removeLabel: string;
101
+ /** Verb used in the retry button's `aria-label`, interpolated as
102
+ * `` `${retryLabel} ${displayName}` `` -- override for i18n/locale.
103
+ * Defaults to `'Retry'`, reproducing today's exact `"Retry ${displayName}"`
104
+ * text byte-for-byte. */
105
+ retryLabel: string;
106
+ /** Verb used in the visible uploading status text -- rendered as
107
+ * `` `${uploadingLabel} ${percent}%` `` once progress is a meaningful
108
+ * number, else `` `${uploadingLabel}…` ``. Override for i18n/locale.
109
+ * Defaults to `'Uploading'`, reproducing today's exact `"Uploading N%"`/
110
+ * `"Uploading…"` text byte-for-byte. */
111
+ uploadingLabel: string;
112
+ /** Visible status text shown for `status="error"`. Override for
113
+ * i18n/locale. Defaults to `'Upload failed'`, reproducing today's exact
114
+ * text byte-for-byte. */
115
+ uploadFailedLabel: string;
116
+ private objectUrl?;
117
+ private objectUrlFile?;
118
+ private readonly fallbackId;
119
+ private get effectiveName();
120
+ private get effectiveSize();
121
+ private get effectiveMimeType();
122
+ private get resolvedId();
123
+ private get hasNumericProgress();
124
+ private get clampedProgress();
125
+ /** Returns (creating or reusing as needed) the object URL for `file`'s
126
+ * image thumbnail. Called from the update lifecycle, never from `render()`,
127
+ * so rendering stays a pure projection of already-prepared state. */
128
+ private ensureObjectUrl;
129
+ private revokeObjectUrl;
130
+ protected willUpdate(): void;
131
+ disconnectedCallback(): void;
132
+ private onRemoveClick;
133
+ private onRetryClick;
134
+ private renderThumbnail;
135
+ render(): TemplateResult;
136
+ }
137
+ declare global {
138
+ interface HTMLElementTagNameMap {
139
+ 'lyra-attachment-chip': LyraAttachmentChip;
140
+ }
141
+ }
@@ -0,0 +1,356 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, nothing, svg } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { nextId } from '../../internal/a11y.js';
12
+ import { closeIcon } from '../../internal/icons.js';
13
+ import { styles } from './attachment-chip.styles.js';
14
+ // Mirrors the shared icon set's viewBox/stroke conventions
15
+ // (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
16
+ // generic-file glyph to that module -- it's off limits here -- so this one-off
17
+ // icon still reads as part of the same visual language as the rest of the
18
+ // library's inline icons. `closeIcon()` itself already exists there and is
19
+ // imported directly rather than duplicated (see `<lyra-toast-item>`'s /
20
+ // `<lyra-widget>`'s identical import for the same remove/dismiss glyph).
21
+ const ICON_VIEW_BOX = '0 0 24 24';
22
+ const ICON_STROKE_WIDTH = '1.75';
23
+ /** A generic "document" glyph, used as the thumbnail for any non-image file. */
24
+ function fileGlyph() {
25
+ return svg `
26
+ <svg
27
+ width="1em"
28
+ height="1em"
29
+ viewBox=${ICON_VIEW_BOX}
30
+ fill="none"
31
+ stroke="currentColor"
32
+ stroke-width=${ICON_STROKE_WIDTH}
33
+ stroke-linecap="round"
34
+ stroke-linejoin="round"
35
+ aria-hidden="true"
36
+ focusable="false"
37
+ ><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>
38
+ `;
39
+ }
40
+ // Same shape as `<lyra-chat-message>`'s local `retryIcon()` -- duplicated
41
+ // rather than imported (these are two independent, separately-consumable
42
+ // components) but kept visually identical so a retry affordance reads the
43
+ // same wherever it shows up in the library.
44
+ function retryIcon() {
45
+ return svg `
46
+ <svg
47
+ width="1em"
48
+ height="1em"
49
+ viewBox=${ICON_VIEW_BOX}
50
+ fill="none"
51
+ stroke="currentColor"
52
+ stroke-width=${ICON_STROKE_WIDTH}
53
+ stroke-linecap="round"
54
+ stroke-linejoin="round"
55
+ aria-hidden="true"
56
+ focusable="false"
57
+ ><polyline points="1 4 1 10 7 10"></polyline><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"></path></svg>
58
+ `;
59
+ }
60
+ const BYTE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
61
+ /**
62
+ * `512` -> `"512 B"`; `2415919` -> `"2.3 MB"`. Whole bytes never get a
63
+ * decimal (there's no meaningful fraction of a byte); every unit past that
64
+ * gets exactly one decimal place. Returns `""` for a negative/non-finite
65
+ * input so a missing/unknown size renders nothing instead of `"NaN B"`.
66
+ */
67
+ export function formatFileSize(bytes) {
68
+ if (!Number.isFinite(bytes) || bytes < 0)
69
+ return '';
70
+ if (bytes < 1024)
71
+ return `${Math.round(bytes)} B`;
72
+ let value = bytes;
73
+ let unitIndex = 0;
74
+ while (value >= 1024 && unitIndex < BYTE_UNITS.length - 1) {
75
+ value /= 1024;
76
+ unitIndex++;
77
+ }
78
+ return `${value.toFixed(1)} ${BYTE_UNITS[unitIndex]}`;
79
+ }
80
+ /** Visible (not just color-coded) text for every non-resting status --
81
+ * `'pending'`/`'done'` render nothing here, they're resting states.
82
+ * `clampedProgress` (not the raw `progress`) is what gets displayed, so the
83
+ * percentage shown here can never drift from the progressbar's own
84
+ * `aria-valuenow`/fill-width, which reads from the same clamped value.
85
+ * `uploadingLabel`/`uploadFailedLabel` are the host's (possibly overridden)
86
+ * verb/phrase -- defaulting to `'Uploading'`/`'Upload failed'` reproduces
87
+ * today's exact hardcoded text byte-for-byte. */
88
+ function statusText(status, progress, clampedProgress, uploadingLabel, uploadFailedLabel) {
89
+ if (status === 'error')
90
+ return uploadFailedLabel;
91
+ if (status === 'uploading') {
92
+ return Number.isFinite(progress) && progress > 0
93
+ ? `${uploadingLabel} ${Math.round(clampedProgress)}%`
94
+ : `${uploadingLabel}…`;
95
+ }
96
+ return '';
97
+ }
98
+ /**
99
+ * `<lyra-attachment-chip>` — a compact chip representing one file queued for
100
+ * (or already part of) a chat message: a composer's pre-send attachment
101
+ * tray, or a sent message's `attachments` slot (see `<lyra-chat-message>`).
102
+ *
103
+ * Two independent ways to populate it, matching the two points in a message's
104
+ * lifecycle this is used at:
105
+ * - Set `file` to a real `File` (fresh from a picker/drop) — `name`, `size`,
106
+ * `mime-type` and the image thumbnail are all auto-derived from it.
107
+ * - Set the plain `name`/`size`/`mime-type`/`thumbnail-src` props instead,
108
+ * for reconstructing a chip from server-persisted attachment metadata
109
+ * (e.g. after a page reload, when no real `File` object exists any more).
110
+ *
111
+ * `file` always wins when both are present — see each accessor's own doc.
112
+ * The image thumbnail for a real `File` is a cached `URL.createObjectURL()`
113
+ * blob URL, created in the update lifecycle immediately before the thumbnail
114
+ * renders and revoked automatically once `file`
115
+ * changes away from the object it was created for, and on disconnect — this
116
+ * component never leaks a blob URL.
117
+ *
118
+ * Identifying *which* attachment a `lyra-remove`/`lyra-retry` event is about:
119
+ * this deliberately reuses the platform's own `id`/`id` attribute (every
120
+ * element already has one; there's no need to shadow it with a second,
121
+ * differently-named Lit property, unlike e.g. `<lyra-tool-call-chip>`'s
122
+ * `call-id` which identifies a *call*, a concept distinct from the chip
123
+ * element itself). Set `id="..."` when you have a stable server-side
124
+ * attachment id. When `id` is left unset and `file` is set, a stable id is
125
+ * derived from `` `${file.name}:${file.size}:${file.lastModified}` `` — stable
126
+ * across re-renders of the *same* `File` object without requiring the
127
+ * consumer to invent one. When neither is available, a generated internal id
128
+ * is used as a last resort so the event always has *some* id.
129
+ *
130
+ * i18n/locale: every translatable word rendered by this component is
131
+ * override-able via a dedicated property — `removeLabel`/`retryLabel`
132
+ * (the verb prefixed to the remove/retry buttons' `aria-label`, keeping the
133
+ * `displayName` interpolation), and `uploadingLabel`/`uploadFailedLabel` (the
134
+ * verb/phrase used in the visible `status-text`, keeping the live percentage
135
+ * interpolation for `uploadingLabel`). All four default to today's exact
136
+ * hardcoded English text (`'Remove'`, `'Retry'`, `'Uploading'`, `'Upload
137
+ * failed'`), so leaving them unset changes nothing. These are plain
138
+ * properties, not slots — this component still exposes no slots.
139
+ *
140
+ * @customElement lyra-attachment-chip
141
+ * @event lyra-remove - The user activated the remove (×) button. `detail: { id }`. Only rendered while `removable`.
142
+ * @event lyra-retry - The user activated the retry button. `detail: { id }`. Only rendered while `status="error"`.
143
+ * @csspart base - The chip's root container.
144
+ * @csspart thumbnail - The leading image thumbnail / generic file glyph.
145
+ * @csspart meta - Wrapper around `name` and `size`.
146
+ * @csspart name - The filename (ellipsis-truncated via CSS; the untruncated name is always available via the native `title` tooltip).
147
+ * @csspart size - The human-readable formatted file size. Hidden when no size is known.
148
+ * @csspart status-text - The visible text twin of the status accent color — carries the state in text, not just color. Empty/hidden for `pending`/`done`. Gets `role="alert"` for `status="error"` only, so a screen-reader user not already focused on the chip still hears an upload failure; the ticking `'uploading'` readout deliberately stays out of the accessibility tree the same way `<lyra-generation-status>`'s per-second elapsed/token readout does — a live region re-announcing every progress tick would be noise, not information, while a one-shot failure is exactly the kind of infrequent, actionable transition a live region exists for.
149
+ * @csspart progress - The numeric upload progress bar (`role="progressbar"`), shown only while `status="uploading"` and `progress` is a meaningful (>0) number.
150
+ * @csspart progress-fill - The filled portion of `progress`.
151
+ * @csspart spinner - The indeterminate upload spinner, shown instead of `progress` while `status="uploading"` and `progress` is unset/0.
152
+ * @csspart retry-button - The retry affordance, only rendered while `status="error"`.
153
+ * @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
154
+ */
155
+ export class LyraAttachmentChip extends LyraElement {
156
+ constructor() {
157
+ super(...arguments);
158
+ /** Filename, used only while `file` is unset. */
159
+ this.name = '';
160
+ /** File size in bytes, used only while `file` is unset. */
161
+ this.size = 0;
162
+ /** MIME type, used only while `file` is unset. */
163
+ this.mimeType = '';
164
+ /** Thumbnail image URL, used only while `file` is unset (a real `File`'s
165
+ * thumbnail always comes from a generated object URL instead — see the
166
+ * class doc). Unlike the other independent props this one has no
167
+ * `file`-derived equivalent to defer to for a non-image file; it's simply
168
+ * rendered whenever present. */
169
+ this.thumbnailSrc = '';
170
+ /** Lifecycle state — drives the accent tint and which of `progress`/`spinner`/`retry-button` renders. */
171
+ this.status = 'pending';
172
+ /** Upload completion, 0-100. Only meaningful while `status="uploading"`;
173
+ * a value of 0 (the default) or `NaN` falls back to the indeterminate spinner. */
174
+ this.progress = 0;
175
+ /** Shows the remove (×) button. */
176
+ this.removable = true;
177
+ /** Verb used in the remove button's `aria-label`, interpolated as
178
+ * `` `${removeLabel} ${displayName}` `` -- override for i18n/locale.
179
+ * Defaults to `'Remove'`, reproducing today's exact `"Remove ${displayName}"`
180
+ * text byte-for-byte. */
181
+ this.removeLabel = 'Remove';
182
+ /** Verb used in the retry button's `aria-label`, interpolated as
183
+ * `` `${retryLabel} ${displayName}` `` -- override for i18n/locale.
184
+ * Defaults to `'Retry'`, reproducing today's exact `"Retry ${displayName}"`
185
+ * text byte-for-byte. */
186
+ this.retryLabel = 'Retry';
187
+ /** Verb used in the visible uploading status text -- rendered as
188
+ * `` `${uploadingLabel} ${percent}%` `` once progress is a meaningful
189
+ * number, else `` `${uploadingLabel}…` ``. Override for i18n/locale.
190
+ * Defaults to `'Uploading'`, reproducing today's exact `"Uploading N%"`/
191
+ * `"Uploading…"` text byte-for-byte. */
192
+ this.uploadingLabel = 'Uploading';
193
+ /** Visible status text shown for `status="error"`. Override for
194
+ * i18n/locale. Defaults to `'Upload failed'`, reproducing today's exact
195
+ * text byte-for-byte. */
196
+ this.uploadFailedLabel = 'Upload failed';
197
+ // Last-resort id, generated once per instance -- see the class doc's
198
+ // "Identifying which attachment..." section.
199
+ this.fallbackId = nextId('attachment-chip');
200
+ this.onRemoveClick = () => {
201
+ this.emit('lyra-remove', { id: this.resolvedId });
202
+ };
203
+ this.onRetryClick = () => {
204
+ this.emit('lyra-retry', { id: this.resolvedId });
205
+ };
206
+ }
207
+ static { this.styles = [LyraElement.styles, styles]; }
208
+ get effectiveName() {
209
+ return this.file ? this.file.name : this.name;
210
+ }
211
+ get effectiveSize() {
212
+ return this.file ? this.file.size : this.size;
213
+ }
214
+ get effectiveMimeType() {
215
+ return this.file ? this.file.type : this.mimeType;
216
+ }
217
+ get resolvedId() {
218
+ if (this.id)
219
+ return this.id;
220
+ if (this.file)
221
+ return `${this.file.name}:${this.file.size}:${this.file.lastModified}`;
222
+ return this.fallbackId;
223
+ }
224
+ get hasNumericProgress() {
225
+ return this.status === 'uploading' && Number.isFinite(this.progress) && this.progress > 0;
226
+ }
227
+ get clampedProgress() {
228
+ return Math.min(100, Math.max(0, this.progress));
229
+ }
230
+ /** Returns (creating or reusing as needed) the object URL for `file`'s
231
+ * image thumbnail. Called from the update lifecycle, never from `render()`,
232
+ * so rendering stays a pure projection of already-prepared state. */
233
+ ensureObjectUrl(file) {
234
+ if (this.objectUrlFile === file && this.objectUrl)
235
+ return this.objectUrl;
236
+ this.revokeObjectUrl();
237
+ this.objectUrl = URL.createObjectURL(file);
238
+ this.objectUrlFile = file;
239
+ return this.objectUrl;
240
+ }
241
+ revokeObjectUrl() {
242
+ if (this.objectUrl)
243
+ URL.revokeObjectURL(this.objectUrl);
244
+ this.objectUrl = undefined;
245
+ this.objectUrlFile = undefined;
246
+ }
247
+ willUpdate() {
248
+ // Prepare or revoke the non-reactive cache before render. This keeps URL
249
+ // allocation out of the render phase and also handles a file changing to
250
+ // a non-image or to undefined, where no thumbnail render would otherwise
251
+ // revisit the old cache entry.
252
+ if (this.file?.type.startsWith('image/'))
253
+ this.ensureObjectUrl(this.file);
254
+ else if (this.objectUrlFile)
255
+ this.revokeObjectUrl();
256
+ }
257
+ disconnectedCallback() {
258
+ super.disconnectedCallback();
259
+ this.revokeObjectUrl();
260
+ }
261
+ renderThumbnail() {
262
+ if (this.file) {
263
+ return this.effectiveMimeType.startsWith('image/')
264
+ ? html `<img src=${this.objectUrl ?? ''} alt="" />`
265
+ : html `${fileGlyph()}`;
266
+ }
267
+ // No `file`: `thumbnail-src` is used whenever present, regardless of
268
+ // `mime-type` -- a server-generated preview thumbnail (e.g. a rendered
269
+ // first page of a PDF) is itself always an image, independent of the
270
+ // *source* file's own MIME type.
271
+ return this.thumbnailSrc ? html `<img src=${this.thumbnailSrc} alt="" />` : html `${fileGlyph()}`;
272
+ }
273
+ render() {
274
+ const name = this.effectiveName;
275
+ const displayName = name || 'Untitled file';
276
+ // A `0`-byte size reads the same as "unknown" here (there's no prop to
277
+ // distinguish a genuinely empty file from a size that was simply never
278
+ // supplied) -- hide the part entirely rather than show a literal "0 B".
279
+ const sizeText = this.effectiveSize > 0 ? formatFileSize(this.effectiveSize) : '';
280
+ const text = statusText(this.status, this.progress, this.clampedProgress, this.uploadingLabel, this.uploadFailedLabel);
281
+ const uploading = this.status === 'uploading';
282
+ return html `
283
+ <div part="base">
284
+ <span part="thumbnail" aria-hidden="true">${this.renderThumbnail()}</span>
285
+ <span part="meta">
286
+ <span part="name" title=${name || 'Untitled file'}>${displayName}</span>
287
+ <span part="size" ?hidden=${!sizeText}>${sizeText || nothing}</span>
288
+ <span part="status-text" role=${this.status === 'error' ? 'alert' : nothing} ?hidden=${!text}>${text || nothing}</span>
289
+ </span>
290
+ ${uploading
291
+ ? this.hasNumericProgress
292
+ ? html `
293
+ <div
294
+ part="progress"
295
+ role="progressbar"
296
+ aria-valuenow=${Math.round(this.clampedProgress)}
297
+ aria-valuemin="0"
298
+ aria-valuemax="100"
299
+ aria-label=${`Uploading ${displayName}`}
300
+ >
301
+ <div part="progress-fill" style=${`inline-size:${this.clampedProgress}%`}></div>
302
+ </div>
303
+ `
304
+ : html `<span part="spinner" role="status" aria-label=${`Uploading ${displayName}`}></span>`
305
+ : nothing}
306
+ ${this.status === 'error'
307
+ ? html `<button part="retry-button" type="button" aria-label=${`${this.retryLabel} ${displayName}`} @click=${this.onRetryClick}>
308
+ ${retryIcon()}
309
+ </button>`
310
+ : nothing}
311
+ ${this.removable
312
+ ? html `<button part="remove-button" type="button" aria-label=${`${this.removeLabel} ${displayName}`} @click=${this.onRemoveClick}>
313
+ ${closeIcon()}
314
+ </button>`
315
+ : nothing}
316
+ </div>
317
+ `;
318
+ }
319
+ }
320
+ __decorate([
321
+ property({ attribute: false })
322
+ ], LyraAttachmentChip.prototype, "file", void 0);
323
+ __decorate([
324
+ property()
325
+ ], LyraAttachmentChip.prototype, "name", void 0);
326
+ __decorate([
327
+ property({ type: Number })
328
+ ], LyraAttachmentChip.prototype, "size", void 0);
329
+ __decorate([
330
+ property({ attribute: 'mime-type' })
331
+ ], LyraAttachmentChip.prototype, "mimeType", void 0);
332
+ __decorate([
333
+ property({ attribute: 'thumbnail-src' })
334
+ ], LyraAttachmentChip.prototype, "thumbnailSrc", void 0);
335
+ __decorate([
336
+ property({ reflect: true })
337
+ ], LyraAttachmentChip.prototype, "status", void 0);
338
+ __decorate([
339
+ property({ type: Number })
340
+ ], LyraAttachmentChip.prototype, "progress", void 0);
341
+ __decorate([
342
+ property({ type: Boolean, reflect: true })
343
+ ], LyraAttachmentChip.prototype, "removable", void 0);
344
+ __decorate([
345
+ property({ attribute: 'remove-label' })
346
+ ], LyraAttachmentChip.prototype, "removeLabel", void 0);
347
+ __decorate([
348
+ property({ attribute: 'retry-label' })
349
+ ], LyraAttachmentChip.prototype, "retryLabel", void 0);
350
+ __decorate([
351
+ property({ attribute: 'uploading-label' })
352
+ ], LyraAttachmentChip.prototype, "uploadingLabel", void 0);
353
+ __decorate([
354
+ property({ attribute: 'upload-failed-label' })
355
+ ], LyraAttachmentChip.prototype, "uploadFailedLabel", void 0);
356
+ defineElement('attachment-chip', LyraAttachmentChip);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;