@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,359 @@
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 } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { isRtl } from '../../internal/rtl.js';
12
+ import { nextId } from '../../internal/a11y.js';
13
+ import { chevronIcon } from '../../internal/icons.js';
14
+ import { styles } from './dock-panel.styles.js';
15
+ /** Arrow-key step, in px, per keydown on the resize handle. */
16
+ const KEYBOARD_STEP_PX = 16;
17
+ const LENGTH_RE = /^(-?[\d.]+)(px|rem|em|vw|vh|%)?$/;
18
+ /**
19
+ * Resolves an arbitrary CSS length (`px`, `rem`, `em`, `vw`, `vh`, `%`, or a
20
+ * bare/unitless number treated as `px`) to a live pixel value, without a DOM
21
+ * probe measurement -- `min-size`/`max-size` are pure constraints that are
22
+ * never themselves rendered anywhere, so there's nothing to measure; the
23
+ * *current* `size` is instead always read back from the host's own
24
+ * `getBoundingClientRect()` (see `currentSizePx()`), which handles any unit
25
+ * for free since the browser already resolved it during layout. Returns
26
+ * `undefined` for an empty/unparseable string.
27
+ */
28
+ export function parseLengthPx(length, containerPx, fontSizeEl = document.documentElement) {
29
+ const trimmed = length.trim();
30
+ if (!trimmed)
31
+ return undefined;
32
+ const match = LENGTH_RE.exec(trimmed);
33
+ if (!match)
34
+ return undefined;
35
+ const value = parseFloat(match[1]);
36
+ switch (match[2]) {
37
+ case '%':
38
+ return (value / 100) * containerPx;
39
+ case 'rem':
40
+ return value * parseFloat(getComputedStyle(document.documentElement).fontSize);
41
+ case 'em':
42
+ return value * parseFloat(getComputedStyle(fontSizeEl).fontSize);
43
+ case 'vw':
44
+ return (value / 100) * window.innerWidth;
45
+ case 'vh':
46
+ return (value / 100) * window.innerHeight;
47
+ default:
48
+ return value;
49
+ }
50
+ }
51
+ /**
52
+ * `<lyra-dock-panel>` — a single panel docked to one edge of whatever
53
+ * contains it, resizable by dragging its inner edge. Unlike `<lyra-split>`
54
+ * (which owns and lays out N sibling panels, and requires restructuring a
55
+ * layout so every panel becomes its direct child), this is one self-
56
+ * contained element you drop next to your existing content -- typically as
57
+ * an absolutely-positioned child of a `position: relative` parent, or as a
58
+ * flex item alongside a main-content sibling. It deliberately imposes no
59
+ * `position`/`inset` of its own (see the styles module): it only manages its
60
+ * own size along the resize axis (`inline-size` for `start`/`end`,
61
+ * `block-size` for `top`/`bottom`) and fills 100% of the cross axis, leaving
62
+ * where it sits in the page entirely up to the consumer's own layout.
63
+ *
64
+ * `lyra-split` stays the right primitive for the multi-sibling-panel case;
65
+ * this is the primitive for the single-edge-docked case, kept as a separate
66
+ * component rather than a second mode bolted onto `lyra-split`'s API.
67
+ *
68
+ * Pointer-drag-resize mirrors `lyra-split`'s pointer-capture technique
69
+ * (pointerdown captures the pointer on the handle, pointermove computes a
70
+ * new size, pointerup/pointercancel/lostpointercapture all release it) but
71
+ * for a single draggable edge instead of N-1 dividers between N panels, and
72
+ * reasons in raw pixels throughout rather than percent -- `size` is a CSS
73
+ * length, and pointer movement is naturally pixels, so there's no percent
74
+ * domain to convert through here. Every resize (drag step, drag release, or
75
+ * keyboard step) always commits `size` as a `px` string regardless of what
76
+ * unit `size`/`min-size`/`max-size` were originally expressed in -- a drag
77
+ * inherently produces a pixel-precise result, so re-expressing it in the
78
+ * caller's original unit (e.g. back into `rem`) would just be lossy
79
+ * re-derivation for no benefit.
80
+ *
81
+ * Collapsing hides the slotted content but keeps the panel itself at a
82
+ * small persistent "rail" width/height (`--lyra-dock-panel-collapsed-size`,
83
+ * default `var(--lyra-icon-button-size)`) rather than collapsing to zero --
84
+ * a zero-size collapsed panel would have nowhere left to host the toggle
85
+ * button that re-expands it. `size` itself is left untouched while
86
+ * collapsed, so re-expanding restores exactly what it was.
87
+ *
88
+ * @customElement lyra-dock-panel
89
+ * @slot - The panel's own content.
90
+ * @event lyra-resize - `detail: { size }` (a `px` CSS length string), fired on every drag step,
91
+ * drag release, and keyboard step.
92
+ * @event lyra-collapse-change - `detail: { collapsed }`, fired whenever the collapse toggle changes
93
+ * `collapsed`.
94
+ * @csspart base - The panel root.
95
+ * @csspart content - The wrapper around the default slot; hidden while `collapsed`.
96
+ * @csspart handle - The draggable resize handle on the panel's inner edge. Only rendered when
97
+ * `resizable` and not `collapsed`.
98
+ * @csspart collapse-toggle - The collapse/expand toggle button. Only rendered when `collapsible`.
99
+ */
100
+ export class LyraDockPanel extends LyraElement {
101
+ constructor() {
102
+ super(...arguments);
103
+ this.edge = 'end';
104
+ /** The current docked size along the resize axis, as a CSS length (e.g. `"320px"`). */
105
+ this.size = '280px';
106
+ /** Minimum resize bound, as a CSS length. */
107
+ this.minSize = '160px';
108
+ /** Maximum resize bound, as a CSS length. Empty means "no explicit cap" -- the live extent of
109
+ * the containing element is used instead, so the panel still can't be dragged wider/taller than
110
+ * its container. */
111
+ this.maxSize = '';
112
+ this.collapsible = false;
113
+ this.collapsed = false;
114
+ /** When `false`, no drag handle renders at all and the panel is a fixed size. */
115
+ this.resizable = true;
116
+ this.drag = null;
117
+ this.contentId = nextId('dock-panel-content');
118
+ this.onPointerDown = (e) => {
119
+ if (!this.resizable || this.collapsed || this.drag)
120
+ return;
121
+ this.drag = {
122
+ pointerId: e.pointerId,
123
+ startPos: this.axis === 'inline' ? e.clientX : e.clientY,
124
+ startSizePx: this.currentSizePx(),
125
+ };
126
+ e.target.setPointerCapture(e.pointerId);
127
+ window.addEventListener('pointermove', this.onPointerMove);
128
+ window.addEventListener('pointerup', this.onPointerUp);
129
+ // A drag can end without a pointerup: a system gesture / palm rejection
130
+ // can fire pointercancel, and losing capture (e.g. element removed) fires
131
+ // lostpointercapture -- both need the same teardown as pointerup or the
132
+ // handle keeps "resizing" in response to unrelated movement.
133
+ window.addEventListener('pointercancel', this.onPointerUp);
134
+ window.addEventListener('lostpointercapture', this.onPointerUp);
135
+ };
136
+ this.onPointerMove = (e) => {
137
+ const drag = this.drag;
138
+ if (!drag || e.pointerId !== drag.pointerId)
139
+ return;
140
+ const pos = this.axis === 'inline' ? e.clientX : e.clientY;
141
+ const delta = this.growSign * (pos - drag.startPos);
142
+ this.applySize(drag.startSizePx + delta);
143
+ };
144
+ this.onPointerUp = (e) => {
145
+ if (!this.drag || e.pointerId !== this.drag.pointerId)
146
+ return;
147
+ this.drag = null;
148
+ window.removeEventListener('pointermove', this.onPointerMove);
149
+ window.removeEventListener('pointerup', this.onPointerUp);
150
+ window.removeEventListener('pointercancel', this.onPointerUp);
151
+ window.removeEventListener('lostpointercapture', this.onPointerUp);
152
+ };
153
+ this.onHandleKeyDown = (e) => {
154
+ if (!this.resizable || this.collapsed)
155
+ return;
156
+ // The physical "positive direction" key is always Right/Down; growSign
157
+ // already encodes whether that direction grows or shrinks the panel for
158
+ // the current edge + RTL-ness, exactly mirroring how onPointerMove folds
159
+ // it into the drag delta above.
160
+ const forwardKey = this.axis === 'inline' ? 'ArrowRight' : 'ArrowDown';
161
+ const backwardKey = this.axis === 'inline' ? 'ArrowLeft' : 'ArrowUp';
162
+ if (e.key === forwardKey) {
163
+ e.preventDefault();
164
+ this.applySize(this.currentSizePx() + this.growSign * KEYBOARD_STEP_PX);
165
+ }
166
+ else if (e.key === backwardKey) {
167
+ e.preventDefault();
168
+ this.applySize(this.currentSizePx() - this.growSign * KEYBOARD_STEP_PX);
169
+ }
170
+ };
171
+ this.toggleCollapsed = () => {
172
+ this.collapsed = !this.collapsed;
173
+ this.emit('lyra-collapse-change', { collapsed: this.collapsed });
174
+ };
175
+ }
176
+ static { this.styles = [LyraElement.styles, styles]; }
177
+ connectedCallback() {
178
+ super.connectedCallback();
179
+ this.applyHostSize();
180
+ this.armContainerResizeObserver();
181
+ }
182
+ disconnectedCallback() {
183
+ super.disconnectedCallback();
184
+ this.drag = null;
185
+ window.removeEventListener('pointermove', this.onPointerMove);
186
+ window.removeEventListener('pointerup', this.onPointerUp);
187
+ window.removeEventListener('pointercancel', this.onPointerUp);
188
+ window.removeEventListener('lostpointercapture', this.onPointerUp);
189
+ this.containerResizeObserver?.disconnect();
190
+ }
191
+ /** Creates (idempotently) and (re-)observes the containing element with a
192
+ * `ResizeObserver` that just requests a re-render on every callback --
193
+ * `containerPx()`/`currentSizePx()` already read the live DOM on every
194
+ * render, so there's no separate cached value to update here, only the
195
+ * render that was otherwise never being triggered. A no-op when not yet
196
+ * connected (no `parentElement`). */
197
+ armContainerResizeObserver() {
198
+ if (!this.parentElement)
199
+ return;
200
+ this.containerResizeObserver ??= new ResizeObserver(() => this.requestUpdate());
201
+ this.containerResizeObserver.observe(this.parentElement);
202
+ }
203
+ // Applied in willUpdate (before render), not updated (after render): the
204
+ // handle's aria-valuenow is computed during render from the host's own
205
+ // live getBoundingClientRect(), so the new inline-size/block-size has to
206
+ // already be on the host *before* render runs, or aria-valuenow would
207
+ // read back the size from one update cycle ago.
208
+ willUpdate(changed) {
209
+ if (changed.has('size') || changed.has('collapsed') || changed.has('edge')) {
210
+ this.applyHostSize();
211
+ }
212
+ }
213
+ /** `'inline'` for the `start`/`end` edges (resizing changes `inline-size`), `'block'` for
214
+ * `top`/`bottom` (resizing changes `block-size`). */
215
+ get axis() {
216
+ return this.edge === 'start' || this.edge === 'end' ? 'inline' : 'block';
217
+ }
218
+ /** +1 or -1: which physical pointer-movement/keyboard direction *grows* the panel, folding in
219
+ * both which edge is pinned (the opposite edge is what's dragged) and, for the inline axis
220
+ * only, the current RTL-ness -- mirrors lyra-split's own horizontal+RTL delta inversion, just
221
+ * generalized to four possible pinned edges instead of split's always-LTR-authored pair order. */
222
+ get growSign() {
223
+ if (this.edge === 'top')
224
+ return 1;
225
+ if (this.edge === 'bottom')
226
+ return -1;
227
+ const rtl = isRtl(this);
228
+ if (this.edge === 'start')
229
+ return rtl ? -1 : 1;
230
+ return rtl ? 1 : -1; // edge === 'end'
231
+ }
232
+ applyHostSize() {
233
+ const value = this.collapsed ? 'var(--lyra-dock-panel-collapsed-size)' : this.size;
234
+ if (this.axis === 'inline') {
235
+ this.style.inlineSize = value;
236
+ this.style.blockSize = '';
237
+ }
238
+ else {
239
+ this.style.blockSize = value;
240
+ this.style.inlineSize = '';
241
+ }
242
+ }
243
+ /** Live pixel size of the containing block along the resize axis, used both to resolve a `%`
244
+ * `min-size`/`max-size` and as the `max-size` fallback when unset. Falls back to the viewport
245
+ * when there's no parent element (e.g. not yet connected). */
246
+ containerPx() {
247
+ const parent = this.parentElement;
248
+ const rect = parent?.getBoundingClientRect();
249
+ if (this.axis === 'inline')
250
+ return rect?.width ?? window.innerWidth;
251
+ return rect?.height ?? window.innerHeight;
252
+ }
253
+ resolveBoundsPx() {
254
+ const containerPx = this.containerPx();
255
+ const minPx = Math.max(0, parseLengthPx(this.minSize, containerPx, this) ?? 0);
256
+ const maxPx = Math.max(minPx, parseLengthPx(this.maxSize, containerPx, this) ?? containerPx);
257
+ return { minPx, maxPx };
258
+ }
259
+ /** The panel's own current rendered size (px) along the resize axis, read straight off the
260
+ * live box -- this is what lets `size` be expressed in any CSS unit and still drag/step
261
+ * correctly from wherever it actually rendered, with no separate unit-conversion path for the
262
+ * "current" value (only `min-size`/`max-size`, which are never themselves rendered, need
263
+ * `parseLengthPx`). */
264
+ currentSizePx() {
265
+ const rect = this.getBoundingClientRect();
266
+ return this.axis === 'inline' ? rect.width : rect.height;
267
+ }
268
+ applySize(px) {
269
+ const { minPx, maxPx } = this.resolveBoundsPx();
270
+ const clamped = Math.min(Math.max(px, minPx), maxPx);
271
+ this.size = `${Math.round(clamped)}px`;
272
+ // Apply the new host size synchronously instead of waiting for Lit's
273
+ // (microtask-batched) update cycle to reach willUpdate: currentSizePx()
274
+ // measures the *live* box, so back-to-back steps (rapid keyboard repeat,
275
+ // or another pointermove before a paint) must each see the size the
276
+ // previous step just committed, not a stale pre-update box.
277
+ this.applyHostSize();
278
+ this.emit('lyra-resize', { size: this.size });
279
+ }
280
+ /** Rotation (deg) for the collapse-toggle's chevron: it points toward the
281
+ * panel's pinned edge when expanded (that's the direction clicking it
282
+ * will shrink toward) and away from it when collapsed (the direction
283
+ * clicking it will grow toward) -- mirrors lyra-widget's collapse-button
284
+ * rotate-the-wrapping-part technique, generalized across four possible
285
+ * pinned edges and, for `start`/`end`, RTL. */
286
+ get toggleChevronDeg() {
287
+ if (this.edge === 'top')
288
+ return this.collapsed ? 90 : -90;
289
+ if (this.edge === 'bottom')
290
+ return this.collapsed ? -90 : 90;
291
+ const pinnedPhysicalEnd = this.edge === 'end' ? !isRtl(this) : isRtl(this);
292
+ return this.collapsed !== pinnedPhysicalEnd ? 0 : 180;
293
+ }
294
+ handleTemplate() {
295
+ if (!this.resizable || this.collapsed)
296
+ return nothing;
297
+ const { minPx, maxPx } = this.resolveBoundsPx();
298
+ return html `<div
299
+ part="handle"
300
+ role="separator"
301
+ aria-label="Resize panel"
302
+ aria-orientation=${this.axis === 'inline' ? 'vertical' : 'horizontal'}
303
+ aria-valuenow=${Math.round(this.currentSizePx())}
304
+ aria-valuemin=${Math.round(minPx)}
305
+ aria-valuemax=${Math.round(maxPx)}
306
+ tabindex="0"
307
+ @pointerdown=${this.onPointerDown}
308
+ @keydown=${this.onHandleKeyDown}
309
+ ></div>`;
310
+ }
311
+ collapseToggleTemplate() {
312
+ if (!this.collapsible)
313
+ return nothing;
314
+ return html `<button
315
+ part="collapse-toggle"
316
+ type="button"
317
+ aria-expanded=${this.collapsed ? 'false' : 'true'}
318
+ aria-controls=${this.contentId}
319
+ aria-label=${this.collapsed ? 'Expand panel' : 'Collapse panel'}
320
+ @click=${this.toggleCollapsed}
321
+ >
322
+ <span style=${`display:inline-flex;transform:rotate(${this.toggleChevronDeg}deg)`}
323
+ >${chevronIcon()}</span
324
+ >
325
+ </button>`;
326
+ }
327
+ render() {
328
+ return html `
329
+ <div part="base">
330
+ <div part="content" id=${this.contentId} ?hidden=${this.collapsed}>
331
+ <slot></slot>
332
+ </div>
333
+ ${this.handleTemplate()} ${this.collapseToggleTemplate()}
334
+ </div>
335
+ `;
336
+ }
337
+ }
338
+ __decorate([
339
+ property({ reflect: true })
340
+ ], LyraDockPanel.prototype, "edge", void 0);
341
+ __decorate([
342
+ property()
343
+ ], LyraDockPanel.prototype, "size", void 0);
344
+ __decorate([
345
+ property({ attribute: 'min-size' })
346
+ ], LyraDockPanel.prototype, "minSize", void 0);
347
+ __decorate([
348
+ property({ attribute: 'max-size' })
349
+ ], LyraDockPanel.prototype, "maxSize", void 0);
350
+ __decorate([
351
+ property({ type: Boolean, reflect: true })
352
+ ], LyraDockPanel.prototype, "collapsible", void 0);
353
+ __decorate([
354
+ property({ type: Boolean, reflect: true })
355
+ ], LyraDockPanel.prototype, "collapsed", void 0);
356
+ __decorate([
357
+ property({ type: Boolean, reflect: true })
358
+ ], LyraDockPanel.prototype, "resizable", void 0);
359
+ defineElement('dock-panel', LyraDockPanel);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,159 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ /* No :host position/inset is imposed here -- unlike an overlay component,
4
+ lyra-dock-panel deliberately stays layout-agnostic (see the class doc):
5
+ drop it as an absolutely-positioned child of a position:relative parent,
6
+ or as a flex item alongside your existing content, and it only manages
7
+ its own size along the resize axis plus filling the cross axis. */
8
+ :host {
9
+ display: block;
10
+ box-sizing: border-box;
11
+ /* Themeable persistent-rail width/height while collapsed -- overridable
12
+ from outside since it's a plain custom property, not a JS prop (see
13
+ the class doc for why collapse hides content rather than zeroing the
14
+ box). Reuses the shared icon-button tap-target token so the collapse
15
+ toggle sitting on the rail stays comfortably tappable by default. */
16
+ --lyra-dock-panel-collapsed-size: var(--lyra-icon-button-size);
17
+ position: relative;
18
+ }
19
+ :host([edge='start']),
20
+ :host([edge='end']) {
21
+ block-size: 100%;
22
+ }
23
+ :host([edge='top']),
24
+ :host([edge='bottom']) {
25
+ inline-size: 100%;
26
+ }
27
+ /* The collapsed-rail floor only applies once actually collapsed -- scoped
28
+ here rather than to the bare [edge] selectors above, so it can never
29
+ override a smaller explicit min-size (resolved in JS by
30
+ resolveBoundsPx()) while expanded. An unconditional floor here would
31
+ silently win over a min-size below the rail token's width, since a CSS
32
+ min-inline-size/min-block-size always wins over an inline size style
33
+ regardless of what value applySize() computed and announced via
34
+ aria-valuenow. */
35
+ :host([edge='start'][collapsed]),
36
+ :host([edge='end'][collapsed]) {
37
+ min-inline-size: var(--lyra-dock-panel-collapsed-size);
38
+ }
39
+ :host([edge='top'][collapsed]),
40
+ :host([edge='bottom'][collapsed]) {
41
+ min-block-size: var(--lyra-dock-panel-collapsed-size);
42
+ }
43
+
44
+ [part='base'] {
45
+ position: relative;
46
+ inline-size: 100%;
47
+ block-size: 100%;
48
+ background: var(--lyra-color-surface);
49
+ border: 1px solid var(--lyra-color-border);
50
+ overflow: hidden;
51
+ }
52
+
53
+ [part='content'] {
54
+ inline-size: 100%;
55
+ block-size: 100%;
56
+ overflow: auto;
57
+ }
58
+ [part='content'][hidden] {
59
+ display: none;
60
+ }
61
+
62
+ /* The draggable edge -- always the panel's *inner* boundary (opposite the
63
+ docked/pinned edge), positioned with logical insets so it mirrors
64
+ automatically under RTL for the start/end edges. */
65
+ [part='handle'] {
66
+ position: absolute;
67
+ background: var(--lyra-color-border);
68
+ touch-action: none;
69
+ }
70
+ [part='handle']:hover,
71
+ [part='handle']:focus-visible {
72
+ background: var(--lyra-color-brand);
73
+ }
74
+ [part='handle']:focus-visible {
75
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
76
+ outline-offset: calc(-1 * var(--lyra-focus-ring-width));
77
+ }
78
+ /* Transparent hit-slop, widening the draggable/tappable box along the
79
+ resize axis only, without changing the handle's visible 3px thickness --
80
+ same technique as lyra-split's divider. */
81
+ [part='handle']::before {
82
+ content: '';
83
+ position: absolute;
84
+ inset: -6px;
85
+ }
86
+
87
+ :host([edge='start']) [part='handle'] {
88
+ inset-block: 0;
89
+ inset-inline-end: 0;
90
+ inline-size: 3px;
91
+ cursor: col-resize;
92
+ }
93
+ :host([edge='end']) [part='handle'] {
94
+ inset-block: 0;
95
+ inset-inline-start: 0;
96
+ inline-size: 3px;
97
+ cursor: col-resize;
98
+ }
99
+ :host([edge='top']) [part='handle'] {
100
+ inset-inline: 0;
101
+ inset-block-end: 0;
102
+ block-size: 3px;
103
+ cursor: row-resize;
104
+ }
105
+ :host([edge='bottom']) [part='handle'] {
106
+ inset-inline: 0;
107
+ inset-block-start: 0;
108
+ block-size: 3px;
109
+ cursor: row-resize;
110
+ }
111
+
112
+ [part='collapse-toggle'] {
113
+ position: absolute;
114
+ display: inline-flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ inline-size: 1.5rem;
118
+ block-size: 1.5rem;
119
+ padding: 0;
120
+ border: 1px solid var(--lyra-color-border);
121
+ border-radius: var(--lyra-radius);
122
+ background: var(--lyra-color-surface);
123
+ color: var(--lyra-color-text);
124
+ cursor: pointer;
125
+ font-size: 0.75rem;
126
+ line-height: 1;
127
+ transition: background var(--lyra-transition-fast), color var(--lyra-transition-fast);
128
+ z-index: 1;
129
+ }
130
+ [part='collapse-toggle']:hover {
131
+ background: var(--lyra-color-brand-quiet);
132
+ color: var(--lyra-color-brand);
133
+ }
134
+ [part='collapse-toggle']:focus-visible {
135
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
136
+ outline-offset: var(--lyra-focus-ring-offset);
137
+ }
138
+
139
+ :host([edge='start']) [part='collapse-toggle'] {
140
+ inset-inline-end: var(--lyra-space-xs);
141
+ inset-block-start: 50%;
142
+ transform: translateY(-50%);
143
+ }
144
+ :host([edge='end']) [part='collapse-toggle'] {
145
+ inset-inline-start: var(--lyra-space-xs);
146
+ inset-block-start: 50%;
147
+ transform: translateY(-50%);
148
+ }
149
+ :host([edge='top']) [part='collapse-toggle'] {
150
+ inset-block-end: var(--lyra-space-xs);
151
+ inset-inline-start: 50%;
152
+ transform: translateX(-50%);
153
+ }
154
+ :host([edge='bottom']) [part='collapse-toggle'] {
155
+ inset-block-start: var(--lyra-space-xs);
156
+ inset-inline-start: 50%;
157
+ transform: translateX(-50%);
158
+ }
159
+ `;
@@ -0,0 +1,143 @@
1
+ import { type TemplateResult, type PropertyValues } from 'lit';
2
+ import { LyraElement } from '../../internal/lyra-element.js';
3
+ export type DocumentPreviewStatus = 'idle' | 'converting' | 'ready' | 'error';
4
+ /**
5
+ * `<lyra-document-preview>` — a format-dispatching viewer for one document/
6
+ * attachment, plus the visual state machine for an async server-side
7
+ * conversion a host app runs in front of it.
8
+ *
9
+ * Format dispatch is intentionally minimal (see this family's scope
10
+ * guidance): only `text/*`/`application/json` (plain, scrollable `<pre>` —
11
+ * no syntax highlighting; compose `<lyra-code-block>` yourself via the
12
+ * `unsupported` slot for that) and `image/*` (a contained `<img>`) render
13
+ * inline. Everything else — PDF, office documents, video, audio, or any
14
+ * unrecognized MIME type — falls back to a generic "can't preview this"
15
+ * state: a file glyph, a short message, and (when `src` is set) a native
16
+ * `<a download>` link. This is a deliberate ceiling, not a gap: this
17
+ * component ships a dispatch *shell*, not a format registry. The
18
+ * `unsupported` slot is the escape hatch for every format left out of the
19
+ * built-in three — plug in a PDF.js viewer, an office-doc renderer, a
20
+ * `<lyra-code-block>`, or anything else keyed off `mime-type` yourself.
21
+ *
22
+ * `status="converting"` is a second, independent axis from format dispatch.
23
+ * This component does not know your backend's conversion API shape and
24
+ * therefore owns none of the actual polling/fetch — a host that's converting
25
+ * a non-natively-previewable format server-side (e.g. .docx → .pdf) polls
26
+ * its own backend and updates `status`/`progress`/`src` here as that
27
+ * proceeds. This component only *visualizes* that state: an indeterminate
28
+ * spinner, or a determinate one once `progress` is supplied. Once the host
29
+ * flips `status` to `"ready"` (typically alongside a new `src`/`mime-type`
30
+ * pointing at the converted artifact), normal format dispatch resumes.
31
+ *
32
+ * The one piece of async work this component *does* own is fetching a
33
+ * `text/*`/`application/json` `src` itself (there's no other way to get a
34
+ * `<pre>`'s text content from a URL) — gated behind the same generation-
35
+ * counter guard `<lyra-tool-result-view>`'s `resolve()` uses, so a `src`
36
+ * reassigned mid-fetch can't have a stale response clobber a newer one. A
37
+ * failure here (network error, non-2xx response) renders inline via
38
+ * `[part="error"]` and fires `lyra-render-error`, independently of the
39
+ * host-owned `status` prop — mirrors `<lyra-markdown>`'s identical stance
40
+ * that a *rendering* failure and a host's own state machine are different
41
+ * concerns.
42
+ *
43
+ * Every `src` is validated for the DOM/API sink that consumes it. Text
44
+ * fetches and image sources allow relative URLs plus `http:`, `https:`,
45
+ * `blob:`, and `data:`. Download links deliberately exclude `data:` because
46
+ * following a `data:text/html` URL can create an active document. Unsafe or
47
+ * malformed URLs never reach `fetch()`, an image `src`, or an anchor `href`;
48
+ * they render a non-interactive fallback/error instead.
49
+ *
50
+ * Accessibility: the `"converting"` state (no numeric `progress`) is a
51
+ * `role="status"` region wrapping a visually-hidden "Converting document…"
52
+ * string. This is a *plain* static region, not routed through
53
+ * `<lyra-live-region>`/`Announcer` — like `<lyra-typing-indicator>`'s
54
+ * identical judgement call (see that component's class doc), this only ever
55
+ * has one thing to announce (entering the state), not a rapidly-repeating
56
+ * stream of updates, so the coalescing machinery a high-frequency component
57
+ * needs would be pure overhead here. Once real `progress` is available, the
58
+ * region becomes a standard `role="progressbar"` instead, which is
59
+ * self-describing via `aria-valuenow` with no extra live-region wiring
60
+ * needed. `status="error"` renders `[part="error"]` as `role="alert"` — an
61
+ * assertive, one-shot failure notice, the same native-role shortcut
62
+ * `<lyra-live-region>`'s own `mode="assertive"` maps to, without requiring
63
+ * the announcer machinery here either.
64
+ *
65
+ * @customElement lyra-document-preview
66
+ * @slot unsupported - Escape hatch: when populated, its content renders
67
+ * *instead of* the generic download fallback for any `mime-type` this
68
+ * component doesn't natively support (i.e. whenever format dispatch would
69
+ * otherwise fall through to "generic"). Ignored while `mime-type` resolves
70
+ * to `text`/`image` dispatch, or while `status` is `"converting"`/`"error"`.
71
+ * @event lyra-download - `detail: { src, filename }` — fired when the safe
72
+ * generic-download fallback link is activated. The browser download itself
73
+ * needs no JS (a plain `<a download>` handles it); this is purely for a host
74
+ * that wants to observe/log the download.
75
+ * @event lyra-render-error - `detail: { error }` — fired when this
76
+ * component's own `text/*`/`application/json` `fetch(src)` fails. Distinct
77
+ * from `status="error"`, which is entirely host-driven (see the class
78
+ * doc).
79
+ * @csspart base - The root container.
80
+ * @csspart header - The row above the body, holding `filename`. Hidden entirely when `filename` is unset.
81
+ * @csspart filename - The filename text.
82
+ * @csspart body - The wrapper around whichever content is currently showing (text/image preview, the generic fallback, the spinner, or the error message).
83
+ * @csspart spinner - The converting/loading indicator — indeterminate (`role="status"`) or, once numeric progress is known, a determinate `role="progressbar"`. Used both for `status="converting"` and for this component's own in-flight text fetch.
84
+ * @csspart error - The error message region (`role="alert"`) — used both for `status="error"` and for a failed text fetch.
85
+ * @csspart download-link - The `<a download>` affordance in the generic fallback. Only rendered when `src` is set and safe for link navigation.
86
+ */
87
+ export declare class LyraDocumentPreview extends LyraElement {
88
+ static styles: import("lit").CSSResultGroup[];
89
+ /** URL to fetch (for `text`/`application/json`) or display (`image`, or as
90
+ * the generic fallback's download `href`). The value is validated against
91
+ * a sink-specific scheme allowlist before use. Optional — gracefully
92
+ * absent while, e.g., a conversion is still in progress. */
93
+ src: string;
94
+ /** Drives format dispatch — see the class doc. */
95
+ mimeType: string;
96
+ /** Shown in the header and used as the download link's suggested filename. */
97
+ filename: string;
98
+ /** Host-owned lifecycle state. `"converting"` shows the spinner regardless
99
+ * of `mime-type`/`src`; `"error"` shows `errorMessage` regardless of
100
+ * either. `"idle"`/`"ready"` both resume normal format dispatch — this
101
+ * component doesn't require a host that has no conversion step to ever
102
+ * set `"ready"` explicitly. */
103
+ status: DocumentPreviewStatus;
104
+ /** 0-100. Only consulted while `status="converting"`. Unset (the default)
105
+ * renders the indeterminate spinner instead of a determinate progress bar. */
106
+ progress?: number;
107
+ /** Shown (via `[part="error"]`) while `status="error"`. */
108
+ errorMessage: string;
109
+ /** A CSS length (e.g. `"24rem"`); once set, `[part="body"]` scrolls
110
+ * internally past this height instead of growing the page — same
111
+ * contract as `<lyra-json-viewer>`'s identically-named prop. */
112
+ maxHeight: string;
113
+ private hasUnsupportedSlot;
114
+ private textFetch;
115
+ private fetchGeneration;
116
+ protected willUpdate(changed: PropertyValues): void;
117
+ private fetchText;
118
+ private onUnsupportedSlotChange;
119
+ private onDownloadClick;
120
+ /** Renders `[part="spinner"]` -- indeterminate (`role="status"` + a
121
+ * visually-hidden label, per the class doc's accessibility note) when
122
+ * `progressValue` is absent, or a `role="progressbar"` once it's a finite
123
+ * 0-100 number. Shared by the host-driven `"converting"` state and this
124
+ * component's own in-flight text fetch (which never has a numeric
125
+ * progress of its own to report). */
126
+ private renderSpinner;
127
+ private renderError;
128
+ private renderTextPreview;
129
+ private renderImagePreview;
130
+ private renderDownloadFallback;
131
+ /** The `<slot>` element renders unconditionally (not just while
132
+ * `hasUnsupportedSlot`) so a slot-assignment change is always observable
133
+ * via `slotchange` -- same reasoning as `<lyra-chat-message>`'s
134
+ * always-rendered optional slots. */
135
+ private renderGenericFallback;
136
+ private renderBody;
137
+ render(): TemplateResult;
138
+ }
139
+ declare global {
140
+ interface HTMLElementTagNameMap {
141
+ 'lyra-document-preview': LyraDocumentPreview;
142
+ }
143
+ }