@aceshooting/lyra-ui 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/README.md +11 -0
  2. package/custom-elements.json +23341 -11202
  3. package/dist/components/app-rail/app-rail.d.ts +171 -0
  4. package/dist/components/app-rail/app-rail.js +483 -0
  5. package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
  6. package/dist/components/app-rail/app-rail.styles.js +125 -0
  7. package/dist/components/attachment-chip/attachment-chip.d.ts +114 -0
  8. package/dist/components/attachment-chip/attachment-chip.js +312 -0
  9. package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
  10. package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
  11. package/dist/components/attachment-trigger/attachment-trigger.d.ts +83 -0
  12. package/dist/components/attachment-trigger/attachment-trigger.js +258 -0
  13. package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
  14. package/dist/components/attachment-trigger/attachment-trigger.styles.js +68 -0
  15. package/dist/components/chart/box-plot.js +11 -1
  16. package/dist/components/chart/chart-loader.d.ts +44 -13
  17. package/dist/components/chart/chart-loader.js +65 -18
  18. package/dist/components/chart/chart.d.ts +1 -2
  19. package/dist/components/chart/chart.js +67 -12
  20. package/dist/components/chart/histogram-bin.d.ts +4 -1
  21. package/dist/components/chart/histogram-bin.js +24 -14
  22. package/dist/components/chart/lite-chart.d.ts +54 -0
  23. package/dist/components/chart/lite-chart.js +140 -22
  24. package/dist/components/chart/lite-chart.styles.js +9 -0
  25. package/dist/components/chat-composer/chat-composer.d.ts +92 -0
  26. package/dist/components/chat-composer/chat-composer.js +285 -0
  27. package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
  28. package/dist/components/chat-composer/chat-composer.styles.js +135 -0
  29. package/dist/components/chat-message/chat-message.d.ts +113 -0
  30. package/dist/components/chat-message/chat-message.js +291 -0
  31. package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
  32. package/dist/components/chat-message/chat-message.styles.js +203 -0
  33. package/dist/components/checkbox/checkbox.d.ts +59 -0
  34. package/dist/components/checkbox/checkbox.js +230 -0
  35. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  36. package/dist/components/checkbox/checkbox.styles.js +70 -0
  37. package/dist/components/chip/chip-group.d.ts +56 -0
  38. package/dist/components/chip/chip-group.js +124 -0
  39. package/dist/components/chip/chip-group.styles.d.ts +1 -0
  40. package/dist/components/chip/chip-group.styles.js +57 -0
  41. package/dist/components/chip/chip.d.ts +64 -0
  42. package/dist/components/chip/chip.js +115 -0
  43. package/dist/components/chip/chip.styles.d.ts +1 -0
  44. package/dist/components/chip/chip.styles.js +115 -0
  45. package/dist/components/citation-badge/citation-badge.d.ts +113 -0
  46. package/dist/components/citation-badge/citation-badge.js +300 -0
  47. package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
  48. package/dist/components/citation-badge/citation-badge.styles.js +96 -0
  49. package/dist/components/code-block/code-block.d.ts +89 -0
  50. package/dist/components/code-block/code-block.js +317 -0
  51. package/dist/components/code-block/code-block.styles.d.ts +1 -0
  52. package/dist/components/code-block/code-block.styles.js +187 -0
  53. package/dist/components/code-block/code-loader.d.ts +44 -0
  54. package/dist/components/code-block/code-loader.js +79 -0
  55. package/dist/components/combobox/combobox.d.ts +19 -1
  56. package/dist/components/combobox/combobox.js +84 -14
  57. package/dist/components/combobox/option.d.ts +5 -1
  58. package/dist/components/combobox/option.js +35 -0
  59. package/dist/components/context-meter/context-meter.d.ts +53 -0
  60. package/dist/components/context-meter/context-meter.js +150 -0
  61. package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
  62. package/dist/components/context-meter/context-meter.styles.js +120 -0
  63. package/dist/components/conversation-item/conversation-item.d.ts +128 -0
  64. package/dist/components/conversation-item/conversation-item.js +322 -0
  65. package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
  66. package/dist/components/conversation-item/conversation-item.styles.js +155 -0
  67. package/dist/components/date-picker/date-input.d.ts +24 -0
  68. package/dist/components/date-picker/date-input.js +134 -22
  69. package/dist/components/date-picker/date-picker.d.ts +7 -0
  70. package/dist/components/date-picker/date-picker.js +85 -16
  71. package/dist/components/dialog/confirm.d.ts +40 -0
  72. package/dist/components/dialog/confirm.js +79 -0
  73. package/dist/components/dialog/dialog.d.ts +85 -0
  74. package/dist/components/dialog/dialog.js +272 -0
  75. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  76. package/dist/components/dialog/dialog.styles.js +52 -0
  77. package/dist/components/dock-panel/dock-panel.d.ts +134 -0
  78. package/dist/components/dock-panel/dock-panel.js +345 -0
  79. package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
  80. package/dist/components/dock-panel/dock-panel.styles.js +145 -0
  81. package/dist/components/document-preview/document-preview.d.ts +135 -0
  82. package/dist/components/document-preview/document-preview.js +372 -0
  83. package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
  84. package/dist/components/document-preview/document-preview.styles.js +191 -0
  85. package/dist/components/export-button/csv.js +1 -1
  86. package/dist/components/export-button/export-button.js +2 -0
  87. package/dist/components/flag/flag.d.ts +29 -13
  88. package/dist/components/flag/flag.js +39 -13
  89. package/dist/components/gauge/gauge.js +19 -10
  90. package/dist/components/generation-status/generation-status.d.ts +109 -0
  91. package/dist/components/generation-status/generation-status.js +273 -0
  92. package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
  93. package/dist/components/generation-status/generation-status.styles.js +84 -0
  94. package/dist/components/heatmap/calendar-grid.d.ts +4 -1
  95. package/dist/components/heatmap/calendar-grid.js +25 -12
  96. package/dist/components/heatmap/heatmap-scale.d.ts +6 -0
  97. package/dist/components/heatmap/heatmap-scale.js +7 -1
  98. package/dist/components/heatmap/heatmap.d.ts +74 -0
  99. package/dist/components/heatmap/heatmap.js +135 -23
  100. package/dist/components/json-viewer/json-viewer.d.ts +53 -0
  101. package/dist/components/json-viewer/json-viewer.js +283 -0
  102. package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
  103. package/dist/components/json-viewer/json-viewer.styles.js +176 -0
  104. package/dist/components/kbd/kbd.d.ts +77 -0
  105. package/dist/components/kbd/kbd.js +214 -0
  106. package/dist/components/kbd/kbd.styles.d.ts +1 -0
  107. package/dist/components/kbd/kbd.styles.js +52 -0
  108. package/dist/components/live-region/live-region.d.ts +81 -0
  109. package/dist/components/live-region/live-region.js +153 -0
  110. package/dist/components/live-region/live-region.styles.d.ts +1 -0
  111. package/dist/components/live-region/live-region.styles.js +10 -0
  112. package/dist/components/map/map.d.ts +8 -6
  113. package/dist/components/map/map.js +44 -8
  114. package/dist/components/markdown/markdown-loader.d.ts +34 -0
  115. package/dist/components/markdown/markdown-loader.js +43 -0
  116. package/dist/components/markdown/markdown.d.ts +81 -0
  117. package/dist/components/markdown/markdown.js +284 -0
  118. package/dist/components/markdown/markdown.styles.d.ts +1 -0
  119. package/dist/components/markdown/markdown.styles.js +82 -0
  120. package/dist/components/media-card/media-card.d.ts +122 -0
  121. package/dist/components/media-card/media-card.js +295 -0
  122. package/dist/components/media-card/media-card.styles.d.ts +1 -0
  123. package/dist/components/media-card/media-card.styles.js +132 -0
  124. package/dist/components/mention-popover/mention-popover.d.ts +200 -0
  125. package/dist/components/mention-popover/mention-popover.js +475 -0
  126. package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
  127. package/dist/components/mention-popover/mention-popover.styles.js +101 -0
  128. package/dist/components/menu/menu-item.d.ts +62 -0
  129. package/dist/components/menu/menu-item.js +119 -0
  130. package/dist/components/menu/menu-item.styles.d.ts +1 -0
  131. package/dist/components/menu/menu-item.styles.js +67 -0
  132. package/dist/components/menu/menu.d.ts +143 -0
  133. package/dist/components/menu/menu.js +365 -0
  134. package/dist/components/menu/menu.styles.d.ts +1 -0
  135. package/dist/components/menu/menu.styles.js +66 -0
  136. package/dist/components/model-select/model-select.d.ts +125 -0
  137. package/dist/components/model-select/model-select.js +490 -0
  138. package/dist/components/model-select/model-select.styles.d.ts +1 -0
  139. package/dist/components/model-select/model-select.styles.js +189 -0
  140. package/dist/components/model-settings-panel/model-settings-panel.d.ts +69 -0
  141. package/dist/components/model-settings-panel/model-settings-panel.js +145 -0
  142. package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
  143. package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
  144. package/dist/components/playback/playback.d.ts +13 -1
  145. package/dist/components/playback/playback.js +47 -14
  146. package/dist/components/responsive-panel/responsive-panel.d.ts +150 -0
  147. package/dist/components/responsive-panel/responsive-panel.js +365 -0
  148. package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
  149. package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
  150. package/dist/components/result-card/result-card.d.ts +44 -0
  151. package/dist/components/result-card/result-card.js +83 -0
  152. package/dist/components/result-card/result-card.styles.d.ts +1 -0
  153. package/dist/components/result-card/result-card.styles.js +50 -0
  154. package/dist/components/result-card/result-field.d.ts +36 -0
  155. package/dist/components/result-card/result-field.js +87 -0
  156. package/dist/components/result-card/result-field.styles.d.ts +1 -0
  157. package/dist/components/result-card/result-field.styles.js +32 -0
  158. package/dist/components/select/select.d.ts +43 -2
  159. package/dist/components/select/select.js +150 -17
  160. package/dist/components/slider/slider.d.ts +89 -0
  161. package/dist/components/slider/slider.js +352 -0
  162. package/dist/components/slider/slider.styles.d.ts +1 -0
  163. package/dist/components/slider/slider.styles.js +87 -0
  164. package/dist/components/source-card/source-card.d.ts +92 -0
  165. package/dist/components/source-card/source-card.js +148 -0
  166. package/dist/components/source-card/source-card.styles.d.ts +1 -0
  167. package/dist/components/source-card/source-card.styles.js +69 -0
  168. package/dist/components/source-list/source-list.d.ts +63 -0
  169. package/dist/components/source-list/source-list.js +122 -0
  170. package/dist/components/source-list/source-list.styles.d.ts +1 -0
  171. package/dist/components/source-list/source-list.styles.js +59 -0
  172. package/dist/components/sparkline/sparkline.js +27 -13
  173. package/dist/components/split/split.d.ts +93 -1
  174. package/dist/components/split/split.js +284 -15
  175. package/dist/components/split/split.styles.js +30 -0
  176. package/dist/components/stat/stat.d.ts +6 -1
  177. package/dist/components/stat/stat.js +8 -2
  178. package/dist/components/stream-status/stream-status.d.ts +110 -0
  179. package/dist/components/stream-status/stream-status.js +210 -0
  180. package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
  181. package/dist/components/stream-status/stream-status.styles.js +103 -0
  182. package/dist/components/streaming-text/streaming-text.d.ts +98 -0
  183. package/dist/components/streaming-text/streaming-text.js +209 -0
  184. package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
  185. package/dist/components/streaming-text/streaming-text.styles.js +62 -0
  186. package/dist/components/switch/switch.d.ts +58 -0
  187. package/dist/components/switch/switch.js +179 -0
  188. package/dist/components/switch/switch.styles.d.ts +1 -0
  189. package/dist/components/switch/switch.styles.js +75 -0
  190. package/dist/components/table/table.d.ts +73 -4
  191. package/dist/components/table/table.js +169 -20
  192. package/dist/components/table/table.styles.js +6 -1
  193. package/dist/components/tabs/tabs.d.ts +51 -0
  194. package/dist/components/tabs/tabs.js +190 -0
  195. package/dist/components/tabs/tabs.styles.d.ts +1 -0
  196. package/dist/components/tabs/tabs.styles.js +63 -0
  197. package/dist/components/thinking-panel/thinking-panel.d.ts +121 -0
  198. package/dist/components/thinking-panel/thinking-panel.js +235 -0
  199. package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
  200. package/dist/components/thinking-panel/thinking-panel.styles.js +117 -0
  201. package/dist/components/toast/toast-item.d.ts +1 -0
  202. package/dist/components/toast/toast-item.js +31 -6
  203. package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +130 -0
  204. package/dist/components/tool-approval-dialog/tool-approval-dialog.js +403 -0
  205. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
  206. package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
  207. package/dist/components/tool-call-chip/tool-call-chip.d.ts +89 -0
  208. package/dist/components/tool-call-chip/tool-call-chip.js +288 -0
  209. package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
  210. package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
  211. package/dist/components/tool-param-form/tool-param-form.d.ts +145 -0
  212. package/dist/components/tool-param-form/tool-param-form.js +366 -0
  213. package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
  214. package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
  215. package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +102 -0
  216. package/dist/components/tool-result-dialog/tool-result-dialog.js +393 -0
  217. package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
  218. package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
  219. package/dist/components/tool-result-view/registry.d.ts +81 -0
  220. package/dist/components/tool-result-view/registry.js +84 -0
  221. package/dist/components/tool-result-view/tool-result-view.d.ts +55 -0
  222. package/dist/components/tool-result-view/tool-result-view.js +138 -0
  223. package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
  224. package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
  225. package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
  226. package/dist/components/tool-select-dialog/tool-select-dialog.js +439 -0
  227. package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
  228. package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +182 -0
  229. package/dist/components/tree/tree-node.d.ts +11 -2
  230. package/dist/components/tree/tree-node.js +16 -6
  231. package/dist/components/tree/tree.d.ts +8 -2
  232. package/dist/components/tree/tree.js +18 -11
  233. package/dist/components/typing-indicator/typing-indicator.d.ts +60 -0
  234. package/dist/components/typing-indicator/typing-indicator.js +96 -0
  235. package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
  236. package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
  237. package/dist/components/virtual-list/virtual-list.d.ts +173 -0
  238. package/dist/components/virtual-list/virtual-list.js +461 -0
  239. package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
  240. package/dist/components/virtual-list/virtual-list.styles.js +44 -0
  241. package/dist/components/word-cloud/word-cloud-layout.js +14 -1
  242. package/dist/components/word-cloud/word-cloud.d.ts +6 -0
  243. package/dist/components/word-cloud/word-cloud.js +25 -14
  244. package/dist/components/word-cloud/word-cloud.styles.js +3 -2
  245. package/dist/internal/announcer.d.ts +57 -0
  246. package/dist/internal/announcer.js +71 -0
  247. package/dist/internal/form-associated.d.ts +1 -0
  248. package/dist/internal/form-associated.js +55 -11
  249. package/dist/internal/group-by-recency.d.ts +50 -0
  250. package/dist/internal/group-by-recency.js +80 -0
  251. package/dist/internal/rtl.d.ts +23 -0
  252. package/dist/internal/rtl.js +28 -0
  253. package/dist/internal/scroll-lock.d.ts +10 -5
  254. package/dist/internal/scroll-lock.js +30 -14
  255. package/dist/internal/tokens.styles.js +6 -0
  256. package/dist/lyra.d.ts +130 -31
  257. package/dist/lyra.js +94 -26
  258. package/llms-full.txt +3836 -17
  259. package/llms.txt +16 -1
  260. package/package.json +23 -5
  261. package/dist/components/chart/bar-chart.stories.d.ts +0 -5
  262. package/dist/components/chart/bar-chart.stories.js +0 -20
  263. package/dist/components/chart/box-plot.stories.d.ts +0 -5
  264. package/dist/components/chart/box-plot.stories.js +0 -29
  265. package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
  266. package/dist/components/chart/bubble-chart.stories.js +0 -26
  267. package/dist/components/chart/chart.stories.d.ts +0 -32
  268. package/dist/components/chart/chart.stories.js +0 -141
  269. package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
  270. package/dist/components/chart/doughnut-chart.stories.js +0 -26
  271. package/dist/components/chart/histogram.stories.d.ts +0 -5
  272. package/dist/components/chart/histogram.stories.js +0 -17
  273. package/dist/components/chart/line-chart.stories.d.ts +0 -22
  274. package/dist/components/chart/line-chart.stories.js +0 -99
  275. package/dist/components/chart/lite-chart.stories.d.ts +0 -14
  276. package/dist/components/chart/lite-chart.stories.js +0 -114
  277. package/dist/components/chart/pie-chart.stories.d.ts +0 -5
  278. package/dist/components/chart/pie-chart.stories.js +0 -26
  279. package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
  280. package/dist/components/chart/polar-area-chart.stories.js +0 -20
  281. package/dist/components/chart/radar-chart.stories.d.ts +0 -5
  282. package/dist/components/chart/radar-chart.stories.js +0 -20
  283. package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
  284. package/dist/components/chart/scatter-chart.stories.js +0 -31
  285. package/dist/components/combobox/combobox.stories.d.ts +0 -24
  286. package/dist/components/combobox/combobox.stories.js +0 -102
  287. package/dist/components/date-picker/date-input.stories.d.ts +0 -10
  288. package/dist/components/date-picker/date-input.stories.js +0 -48
  289. package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
  290. package/dist/components/date-picker/date-picker.stories.js +0 -25
  291. package/dist/components/empty/empty.stories.d.ts +0 -7
  292. package/dist/components/empty/empty.stories.js +0 -34
  293. package/dist/components/export-button/export-button.stories.d.ts +0 -7
  294. package/dist/components/export-button/export-button.stories.js +0 -37
  295. package/dist/components/file-input/file-input.stories.d.ts +0 -7
  296. package/dist/components/file-input/file-input.stories.js +0 -19
  297. package/dist/components/flag/flag.stories.d.ts +0 -6
  298. package/dist/components/flag/flag.stories.js +0 -31
  299. package/dist/components/gauge/gauge.stories.d.ts +0 -8
  300. package/dist/components/gauge/gauge.stories.js +0 -19
  301. package/dist/components/graph/graph.stories.d.ts +0 -8
  302. package/dist/components/graph/graph.stories.js +0 -68
  303. package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
  304. package/dist/components/heatmap/heatmap.stories.js +0 -179
  305. package/dist/components/map/map.stories.d.ts +0 -15
  306. package/dist/components/map/map.stories.js +0 -135
  307. package/dist/components/playback/playback.stories.d.ts +0 -7
  308. package/dist/components/playback/playback.stories.js +0 -16
  309. package/dist/components/select/select.stories.d.ts +0 -21
  310. package/dist/components/select/select.stories.js +0 -91
  311. package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
  312. package/dist/components/skeleton/skeleton.stories.js +0 -16
  313. package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
  314. package/dist/components/sparkline/sparkline.stories.js +0 -39
  315. package/dist/components/split/split.stories.d.ts +0 -7
  316. package/dist/components/split/split.stories.js +0 -36
  317. package/dist/components/stat/stat.stories.d.ts +0 -9
  318. package/dist/components/stat/stat.stories.js +0 -81
  319. package/dist/components/table/table.stories.d.ts +0 -12
  320. package/dist/components/table/table.stories.js +0 -67
  321. package/dist/components/time-range/time-range.stories.d.ts +0 -8
  322. package/dist/components/time-range/time-range.stories.js +0 -26
  323. package/dist/components/toast/toast.stories.d.ts +0 -8
  324. package/dist/components/toast/toast.stories.js +0 -72
  325. package/dist/components/tree/tree.stories.d.ts +0 -9
  326. package/dist/components/tree/tree.stories.js +0 -52
  327. package/dist/components/widget/widget.stories.d.ts +0 -9
  328. package/dist/components/widget/widget.stories.js +0 -74
  329. package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
  330. package/dist/components/word-cloud/word-cloud.stories.js +0 -55
@@ -0,0 +1,345 @@
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
+ }
181
+ disconnectedCallback() {
182
+ super.disconnectedCallback();
183
+ this.drag = null;
184
+ window.removeEventListener('pointermove', this.onPointerMove);
185
+ window.removeEventListener('pointerup', this.onPointerUp);
186
+ window.removeEventListener('pointercancel', this.onPointerUp);
187
+ window.removeEventListener('lostpointercapture', this.onPointerUp);
188
+ }
189
+ // Applied in willUpdate (before render), not updated (after render): the
190
+ // handle's aria-valuenow is computed during render from the host's own
191
+ // live getBoundingClientRect(), so the new inline-size/block-size has to
192
+ // already be on the host *before* render runs, or aria-valuenow would
193
+ // read back the size from one update cycle ago.
194
+ willUpdate(changed) {
195
+ if (changed.has('size') || changed.has('collapsed') || changed.has('edge')) {
196
+ this.applyHostSize();
197
+ }
198
+ }
199
+ /** `'inline'` for the `start`/`end` edges (resizing changes `inline-size`), `'block'` for
200
+ * `top`/`bottom` (resizing changes `block-size`). */
201
+ get axis() {
202
+ return this.edge === 'start' || this.edge === 'end' ? 'inline' : 'block';
203
+ }
204
+ /** +1 or -1: which physical pointer-movement/keyboard direction *grows* the panel, folding in
205
+ * both which edge is pinned (the opposite edge is what's dragged) and, for the inline axis
206
+ * only, the current RTL-ness -- mirrors lyra-split's own horizontal+RTL delta inversion, just
207
+ * generalized to four possible pinned edges instead of split's always-LTR-authored pair order. */
208
+ get growSign() {
209
+ if (this.edge === 'top')
210
+ return 1;
211
+ if (this.edge === 'bottom')
212
+ return -1;
213
+ const rtl = isRtl(this);
214
+ if (this.edge === 'start')
215
+ return rtl ? -1 : 1;
216
+ return rtl ? 1 : -1; // edge === 'end'
217
+ }
218
+ applyHostSize() {
219
+ const value = this.collapsed ? 'var(--lyra-dock-panel-collapsed-size)' : this.size;
220
+ if (this.axis === 'inline') {
221
+ this.style.inlineSize = value;
222
+ this.style.blockSize = '';
223
+ }
224
+ else {
225
+ this.style.blockSize = value;
226
+ this.style.inlineSize = '';
227
+ }
228
+ }
229
+ /** Live pixel size of the containing block along the resize axis, used both to resolve a `%`
230
+ * `min-size`/`max-size` and as the `max-size` fallback when unset. Falls back to the viewport
231
+ * when there's no parent element (e.g. not yet connected). */
232
+ containerPx() {
233
+ const parent = this.parentElement;
234
+ const rect = parent?.getBoundingClientRect();
235
+ if (this.axis === 'inline')
236
+ return rect?.width ?? window.innerWidth;
237
+ return rect?.height ?? window.innerHeight;
238
+ }
239
+ resolveBoundsPx() {
240
+ const containerPx = this.containerPx();
241
+ const minPx = Math.max(0, parseLengthPx(this.minSize, containerPx, this) ?? 0);
242
+ const maxPx = Math.max(minPx, parseLengthPx(this.maxSize, containerPx, this) ?? containerPx);
243
+ return { minPx, maxPx };
244
+ }
245
+ /** The panel's own current rendered size (px) along the resize axis, read straight off the
246
+ * live box -- this is what lets `size` be expressed in any CSS unit and still drag/step
247
+ * correctly from wherever it actually rendered, with no separate unit-conversion path for the
248
+ * "current" value (only `min-size`/`max-size`, which are never themselves rendered, need
249
+ * `parseLengthPx`). */
250
+ currentSizePx() {
251
+ const rect = this.getBoundingClientRect();
252
+ return this.axis === 'inline' ? rect.width : rect.height;
253
+ }
254
+ applySize(px) {
255
+ const { minPx, maxPx } = this.resolveBoundsPx();
256
+ const clamped = Math.min(Math.max(px, minPx), maxPx);
257
+ this.size = `${Math.round(clamped)}px`;
258
+ // Apply the new host size synchronously instead of waiting for Lit's
259
+ // (microtask-batched) update cycle to reach willUpdate: currentSizePx()
260
+ // measures the *live* box, so back-to-back steps (rapid keyboard repeat,
261
+ // or another pointermove before a paint) must each see the size the
262
+ // previous step just committed, not a stale pre-update box.
263
+ this.applyHostSize();
264
+ this.emit('lyra-resize', { size: this.size });
265
+ }
266
+ /** Rotation (deg) for the collapse-toggle's chevron: it points toward the
267
+ * panel's pinned edge when expanded (that's the direction clicking it
268
+ * will shrink toward) and away from it when collapsed (the direction
269
+ * clicking it will grow toward) -- mirrors lyra-widget's collapse-button
270
+ * rotate-the-wrapping-part technique, generalized across four possible
271
+ * pinned edges and, for `start`/`end`, RTL. */
272
+ get toggleChevronDeg() {
273
+ if (this.edge === 'top')
274
+ return this.collapsed ? 90 : -90;
275
+ if (this.edge === 'bottom')
276
+ return this.collapsed ? -90 : 90;
277
+ const pinnedPhysicalEnd = this.edge === 'end' ? !isRtl(this) : isRtl(this);
278
+ return this.collapsed === pinnedPhysicalEnd ? 0 : 180;
279
+ }
280
+ handleTemplate() {
281
+ if (!this.resizable || this.collapsed)
282
+ return nothing;
283
+ const { minPx, maxPx } = this.resolveBoundsPx();
284
+ return html `<div
285
+ part="handle"
286
+ role="separator"
287
+ aria-label="Resize panel"
288
+ aria-orientation=${this.axis === 'inline' ? 'vertical' : 'horizontal'}
289
+ aria-valuenow=${Math.round(this.currentSizePx())}
290
+ aria-valuemin=${Math.round(minPx)}
291
+ aria-valuemax=${Math.round(maxPx)}
292
+ tabindex="0"
293
+ @pointerdown=${this.onPointerDown}
294
+ @keydown=${this.onHandleKeyDown}
295
+ ></div>`;
296
+ }
297
+ collapseToggleTemplate() {
298
+ if (!this.collapsible)
299
+ return nothing;
300
+ return html `<button
301
+ part="collapse-toggle"
302
+ type="button"
303
+ aria-expanded=${this.collapsed ? 'false' : 'true'}
304
+ aria-controls=${this.contentId}
305
+ aria-label=${this.collapsed ? 'Expand panel' : 'Collapse panel'}
306
+ @click=${this.toggleCollapsed}
307
+ >
308
+ <span style=${`display:inline-flex;transform:rotate(${this.toggleChevronDeg}deg)`}
309
+ >${chevronIcon()}</span
310
+ >
311
+ </button>`;
312
+ }
313
+ render() {
314
+ return html `
315
+ <div part="base">
316
+ <div part="content" id=${this.contentId} ?hidden=${this.collapsed}>
317
+ <slot></slot>
318
+ </div>
319
+ ${this.handleTemplate()} ${this.collapseToggleTemplate()}
320
+ </div>
321
+ `;
322
+ }
323
+ }
324
+ __decorate([
325
+ property({ reflect: true })
326
+ ], LyraDockPanel.prototype, "edge", void 0);
327
+ __decorate([
328
+ property()
329
+ ], LyraDockPanel.prototype, "size", void 0);
330
+ __decorate([
331
+ property({ attribute: 'min-size' })
332
+ ], LyraDockPanel.prototype, "minSize", void 0);
333
+ __decorate([
334
+ property({ attribute: 'max-size' })
335
+ ], LyraDockPanel.prototype, "maxSize", void 0);
336
+ __decorate([
337
+ property({ type: Boolean, reflect: true })
338
+ ], LyraDockPanel.prototype, "collapsible", void 0);
339
+ __decorate([
340
+ property({ type: Boolean, reflect: true })
341
+ ], LyraDockPanel.prototype, "collapsed", void 0);
342
+ __decorate([
343
+ property({ type: Boolean, reflect: true })
344
+ ], LyraDockPanel.prototype, "resizable", void 0);
345
+ defineElement('dock-panel', LyraDockPanel);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,145 @@
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
+ min-inline-size: var(--lyra-dock-panel-collapsed-size);
23
+ }
24
+ :host([edge='top']),
25
+ :host([edge='bottom']) {
26
+ inline-size: 100%;
27
+ min-block-size: var(--lyra-dock-panel-collapsed-size);
28
+ }
29
+
30
+ [part='base'] {
31
+ position: relative;
32
+ inline-size: 100%;
33
+ block-size: 100%;
34
+ background: var(--lyra-color-surface);
35
+ border: 1px solid var(--lyra-color-border);
36
+ overflow: hidden;
37
+ }
38
+
39
+ [part='content'] {
40
+ inline-size: 100%;
41
+ block-size: 100%;
42
+ overflow: auto;
43
+ }
44
+ [part='content'][hidden] {
45
+ display: none;
46
+ }
47
+
48
+ /* The draggable edge -- always the panel's *inner* boundary (opposite the
49
+ docked/pinned edge), positioned with logical insets so it mirrors
50
+ automatically under RTL for the start/end edges. */
51
+ [part='handle'] {
52
+ position: absolute;
53
+ background: var(--lyra-color-border);
54
+ touch-action: none;
55
+ }
56
+ [part='handle']:hover,
57
+ [part='handle']:focus-visible {
58
+ background: var(--lyra-color-brand);
59
+ }
60
+ [part='handle']:focus-visible {
61
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
62
+ outline-offset: calc(-1 * var(--lyra-focus-ring-width));
63
+ }
64
+ /* Transparent hit-slop, widening the draggable/tappable box along the
65
+ resize axis only, without changing the handle's visible 3px thickness --
66
+ same technique as lyra-split's divider. */
67
+ [part='handle']::before {
68
+ content: '';
69
+ position: absolute;
70
+ inset: -6px;
71
+ }
72
+
73
+ :host([edge='start']) [part='handle'] {
74
+ inset-block: 0;
75
+ inset-inline-end: 0;
76
+ inline-size: 3px;
77
+ cursor: col-resize;
78
+ }
79
+ :host([edge='end']) [part='handle'] {
80
+ inset-block: 0;
81
+ inset-inline-start: 0;
82
+ inline-size: 3px;
83
+ cursor: col-resize;
84
+ }
85
+ :host([edge='top']) [part='handle'] {
86
+ inset-inline: 0;
87
+ inset-block-end: 0;
88
+ block-size: 3px;
89
+ cursor: row-resize;
90
+ }
91
+ :host([edge='bottom']) [part='handle'] {
92
+ inset-inline: 0;
93
+ inset-block-start: 0;
94
+ block-size: 3px;
95
+ cursor: row-resize;
96
+ }
97
+
98
+ [part='collapse-toggle'] {
99
+ position: absolute;
100
+ display: inline-flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ inline-size: 1.5rem;
104
+ block-size: 1.5rem;
105
+ padding: 0;
106
+ border: 1px solid var(--lyra-color-border);
107
+ border-radius: var(--lyra-radius);
108
+ background: var(--lyra-color-surface);
109
+ color: var(--lyra-color-text);
110
+ cursor: pointer;
111
+ font-size: 0.75rem;
112
+ line-height: 1;
113
+ transition: background var(--lyra-transition-fast), color var(--lyra-transition-fast);
114
+ z-index: 1;
115
+ }
116
+ [part='collapse-toggle']:hover {
117
+ background: var(--lyra-color-brand-quiet);
118
+ color: var(--lyra-color-brand);
119
+ }
120
+ [part='collapse-toggle']:focus-visible {
121
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
122
+ outline-offset: var(--lyra-focus-ring-offset);
123
+ }
124
+
125
+ :host([edge='start']) [part='collapse-toggle'] {
126
+ inset-inline-end: var(--lyra-space-xs);
127
+ inset-block-start: 50%;
128
+ transform: translateY(-50%);
129
+ }
130
+ :host([edge='end']) [part='collapse-toggle'] {
131
+ inset-inline-start: var(--lyra-space-xs);
132
+ inset-block-start: 50%;
133
+ transform: translateY(-50%);
134
+ }
135
+ :host([edge='top']) [part='collapse-toggle'] {
136
+ inset-block-end: var(--lyra-space-xs);
137
+ inset-inline-start: 50%;
138
+ transform: translateX(-50%);
139
+ }
140
+ :host([edge='bottom']) [part='collapse-toggle'] {
141
+ inset-block-start: var(--lyra-space-xs);
142
+ inset-inline-start: 50%;
143
+ transform: translateX(-50%);
144
+ }
145
+ `;
@@ -0,0 +1,135 @@
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
+ * Accessibility: the `"converting"` state (no numeric `progress`) is a
44
+ * `role="status"` region wrapping a visually-hidden "Converting document…"
45
+ * string. This is a *plain* static region, not routed through
46
+ * `<lyra-live-region>`/`Announcer` — like `<lyra-typing-indicator>`'s
47
+ * identical judgement call (see that component's class doc), this only ever
48
+ * has one thing to announce (entering the state), not a rapidly-repeating
49
+ * stream of updates, so the coalescing machinery a high-frequency component
50
+ * needs would be pure overhead here. Once real `progress` is available, the
51
+ * region becomes a standard `role="progressbar"` instead, which is
52
+ * self-describing via `aria-valuenow` with no extra live-region wiring
53
+ * needed. `status="error"` renders `[part="error"]` as `role="alert"` — an
54
+ * assertive, one-shot failure notice, the same native-role shortcut
55
+ * `<lyra-live-region>`'s own `mode="assertive"` maps to, without requiring
56
+ * the announcer machinery here either.
57
+ *
58
+ * @customElement lyra-document-preview
59
+ * @slot unsupported - Escape hatch: when populated, its content renders
60
+ * *instead of* the generic download fallback for any `mime-type` this
61
+ * component doesn't natively support (i.e. whenever format dispatch would
62
+ * otherwise fall through to "generic"). Ignored while `mime-type` resolves
63
+ * to `text`/`image` dispatch, or while `status` is `"converting"`/`"error"`.
64
+ * @event lyra-download - `detail: { src, filename }` — fired when the
65
+ * generic-download fallback's link is activated. The browser download
66
+ * itself needs no JS (a plain `<a download>` handles it); this is purely
67
+ * for a host that wants to observe/log the download.
68
+ * @event lyra-render-error - `detail: { error }` — fired when this
69
+ * component's own `text/*`/`application/json` `fetch(src)` fails. Distinct
70
+ * from `status="error"`, which is entirely host-driven (see the class
71
+ * doc).
72
+ * @csspart base - The root container.
73
+ * @csspart header - The row above the body, holding `filename`. Hidden entirely when `filename` is unset.
74
+ * @csspart filename - The filename text.
75
+ * @csspart body - The wrapper around whichever content is currently showing (text/image preview, the generic fallback, the spinner, or the error message).
76
+ * @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.
77
+ * @csspart error - The error message region (`role="alert"`) — used both for `status="error"` and for a failed text fetch.
78
+ * @csspart download-link - The `<a download>` affordance in the generic fallback. Only rendered when `src` is set.
79
+ */
80
+ export declare class LyraDocumentPreview extends LyraElement {
81
+ static styles: import("lit").CSSResultGroup[];
82
+ /** URL to fetch (for `text`/`application/json`) or display (`image`, or as
83
+ * the generic fallback's download `href`). Optional — gracefully absent
84
+ * while, e.g., a conversion is still in progress. */
85
+ src: string;
86
+ /** Drives format dispatch — see the class doc. */
87
+ mimeType: string;
88
+ /** Shown in the header and used as the download link's suggested filename. */
89
+ filename: string;
90
+ /** Host-owned lifecycle state. `"converting"` shows the spinner regardless
91
+ * of `mime-type`/`src`; `"error"` shows `errorMessage` regardless of
92
+ * either. `"idle"`/`"ready"` both resume normal format dispatch — this
93
+ * component doesn't require a host that has no conversion step to ever
94
+ * set `"ready"` explicitly. */
95
+ status: DocumentPreviewStatus;
96
+ /** 0-100. Only consulted while `status="converting"`. Unset (the default)
97
+ * renders the indeterminate spinner instead of a determinate progress bar. */
98
+ progress?: number;
99
+ /** Shown (via `[part="error"]`) while `status="error"`. */
100
+ errorMessage: string;
101
+ /** A CSS length (e.g. `"24rem"`); once set, `[part="body"]` scrolls
102
+ * internally past this height instead of growing the page — same
103
+ * contract as `<lyra-json-viewer>`'s identically-named prop. */
104
+ maxHeight: string;
105
+ private hasUnsupportedSlot;
106
+ private textFetch;
107
+ private fetchGeneration;
108
+ protected willUpdate(changed: PropertyValues): void;
109
+ private fetchText;
110
+ private onUnsupportedSlotChange;
111
+ private onDownloadClick;
112
+ /** Renders `[part="spinner"]` -- indeterminate (`role="status"` + a
113
+ * visually-hidden label, per the class doc's accessibility note) when
114
+ * `progressValue` is absent, or a `role="progressbar"` once it's a finite
115
+ * 0-100 number. Shared by the host-driven `"converting"` state and this
116
+ * component's own in-flight text fetch (which never has a numeric
117
+ * progress of its own to report). */
118
+ private renderSpinner;
119
+ private renderError;
120
+ private renderTextPreview;
121
+ private renderImagePreview;
122
+ private renderDownloadFallback;
123
+ /** The `<slot>` element renders unconditionally (not just while
124
+ * `hasUnsupportedSlot`) so a slot-assignment change is always observable
125
+ * via `slotchange` -- same reasoning as `<lyra-chat-message>`'s
126
+ * always-rendered optional slots. */
127
+ private renderGenericFallback;
128
+ private renderBody;
129
+ render(): TemplateResult;
130
+ }
131
+ declare global {
132
+ interface HTMLElementTagNameMap {
133
+ 'lyra-document-preview': LyraDocumentPreview;
134
+ }
135
+ }