@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,331 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, nothing, svg } from 'lit';
8
+ import { property, state, query } from 'lit/decorators.js';
9
+ import { LyraElement } from '../../internal/lyra-element.js';
10
+ import { defineElement } from '../../internal/prefix.js';
11
+ import { styles } from './conversation-item.styles.js';
12
+ // Mirrors the shared icon set's viewBox/stroke conventions
13
+ // (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
14
+ // pencil/edit glyph to that module -- it's off limits here -- so this
15
+ // one-off icon still reads as part of the same visual language as the rest
16
+ // of the library's inline icons. Same approach lyra-checkbox's own local
17
+ // checkmark/indeterminate glyphs and lyra-chat-message's local retryIcon()
18
+ // take for the identical reason.
19
+ const ICON_VIEW_BOX = '0 0 24 24';
20
+ const ICON_STROKE_WIDTH = '1.75';
21
+ function pencilIcon() {
22
+ return svg `
23
+ <svg
24
+ width="1em"
25
+ height="1em"
26
+ viewBox=${ICON_VIEW_BOX}
27
+ fill="none"
28
+ stroke="currentColor"
29
+ stroke-width=${ICON_STROKE_WIDTH}
30
+ stroke-linecap="round"
31
+ stroke-linejoin="round"
32
+ aria-hidden="true"
33
+ focusable="false"
34
+ ><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>
35
+ `;
36
+ }
37
+ /** `Intl.DateTimeFormat`-based absolute formatter -- clock time ("3:45 PM")
38
+ * for a timestamp that falls on the same calendar day as `now`, otherwise a
39
+ * calendar date ("Jul 10", or "Jul 10, 2024" once it's not the current
40
+ * year). Deliberately not a fuzzy "2 hours ago" relative string -- bucketed
41
+ * relative time (grouping a whole history list into "Today"/"Yesterday"/
42
+ * "Last 7 days" sections) is a separate, later-phase concern at the list
43
+ * level, not this single row's job. `formatTimestamp` overrides this
44
+ * entirely, mirroring `<lyra-chat-message>`'s identical override hook. */
45
+ function defaultFormatTimestamp(date, now = new Date()) {
46
+ const sameDay = date.toDateString() === now.toDateString();
47
+ if (sameDay) {
48
+ return new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit' }).format(date);
49
+ }
50
+ const sameYear = date.getFullYear() === now.getFullYear();
51
+ return new Intl.DateTimeFormat(undefined, sameYear ? { month: 'short', day: 'numeric' } : { month: 'short', day: 'numeric', year: 'numeric' }).format(date);
52
+ }
53
+ /**
54
+ * `<lyra-conversation-item>` — a selectable row representing one chat
55
+ * session in a history sidebar list. Usable standalone or as the
56
+ * `renderItem()` payload of a sibling virtualized-list component; this
57
+ * module has no dependency on that (or any) other component.
58
+ *
59
+ * Takes `title`/`excerpt`/`timestamp` as individual primitive props rather
60
+ * than one opaque bound object, deliberately consistent with how
61
+ * `<lyra-chat-message>` takes individual props instead of a single
62
+ * `.message` blob -- every other component in this family follows that
63
+ * shape, so this one does too even though a single bound `.session` object
64
+ * would also have been a reasonable design.
65
+ *
66
+ * Identifying *which* session a `lyra-select` click/keypress was about: this
67
+ * reuses the platform's own `id` attribute (every element already has one)
68
+ * rather than inventing a second, differently-named id-carrying prop --
69
+ * consumers already have the event's `target`/`currentTarget` (and thus
70
+ * `.id`), the same reasoning `<lyra-attachment-chip>` documents for its own
71
+ * identically-shaped choice. `lyra-select` therefore carries no detail
72
+ * payload at all.
73
+ *
74
+ * `role="button"` on `[part="option"]` so the item has valid semantics both
75
+ * standalone and when placed in a larger history-list layout. A conversation
76
+ * row activates one current session; it is not itself a listbox option and
77
+ * therefore does not require a particular owner role.
78
+ *
79
+ * `role="button"` forbids focusable
80
+ * descendants -- verified against axe-core's `nested-interactive` rule,
81
+ * which flags it. That's why the rename button and the `actions` slot are
82
+ * rendered as DOM *siblings* of `[part="option"]` (both inside
83
+ * `[part="base"]`) rather than nested inside it: `[part="option"]` only ever
84
+ * contains plain text/`<time>` content. The in-place rename `<input>` is the
85
+ * same problem one level deeper -- it replaces the title *inside*
86
+ * `[part="option"]` while renaming -- so `[part="option"]` sheds its
87
+ * `role`/`tabindex`/`aria-current`/`aria-label` entirely for the duration
88
+ * of an edit. A row mid-edit is a text field, so suspending the button
89
+ * semantics is also the more accurate
90
+ * description of what's on screen.
91
+ *
92
+ * Inline rename is a dedicated pencil/edit icon button (not a double-click
93
+ * on the title) -- double-click has no keyboard/screen-reader equivalent
94
+ * and would silently swallow the row's own single-click `lyra-select`,
95
+ * whereas a button is independently focusable, has its own accessible name,
96
+ * and composes cleanly with click-to-select.
97
+ *
98
+ * @customElement lyra-conversation-item
99
+ * @slot actions - Overflow/icon-button controls (e.g. a future pin/delete
100
+ * button) rendered at the trailing edge of the row. `lyra-menu` doesn't
101
+ * exist yet in this phase, so this is a plain slot for whatever a consumer
102
+ * wants to put there today.
103
+ * @event lyra-select - The row was activated: a click on `[part="option"]`
104
+ * (i.e. outside the rename button and the `actions` slot), or Enter/Space
105
+ * while it's focused -- in both cases only while not currently renaming. No
106
+ * detail payload -- see the class doc's "Identifying which session" note.
107
+ * @event lyra-rename - An in-place rename was committed (Enter, or blur
108
+ * while editing). `detail: { title }`. Does not mutate `title` itself --
109
+ * this is a controlled component, the same convention
110
+ * `<lyra-chat-message>` follows by not clearing its own state on retry; the
111
+ * consumer applies the new title once it's actually persisted. Not fired
112
+ * when the trimmed draft is empty or unchanged from the original `title`
113
+ * (that's treated as an implicit cancel).
114
+ * @csspart base - The outer row wrapper (plain, no ARIA role) laying out `[part="option"]`, the rename button, and `actions`.
115
+ * @csspart option - The selectable region (`role="button"`, removed while renaming -- see the class doc). Wraps `content` and `timestamp`.
116
+ * @csspart content - Wrapper around the title and excerpt.
117
+ * @csspart title - The title text, shown while not renaming.
118
+ * @csspart title-input - The in-place rename `<input>`, shown only while renaming.
119
+ * @csspart rename-button - The pencil/edit affordance that starts a rename (only rendered while `editable` and not already renaming).
120
+ * @csspart excerpt - The last-message preview snippet. Only rendered when `excerpt` is non-empty.
121
+ * @csspart timestamp - The formatted `timestamp`, rendered in a `<time>` element. Only rendered when `timestamp` is set and valid.
122
+ * @csspart actions - The wrapper around the `actions` slot.
123
+ */
124
+ export class LyraConversationItem extends LyraElement {
125
+ constructor() {
126
+ super(...arguments);
127
+ /** The session's display title. */
128
+ this.title = '';
129
+ /** A short preview snippet of the last message. Omit for no excerpt line. */
130
+ this.excerpt = '';
131
+ /** Whether this is the currently-selected/open session. Drives the
132
+ * brand-quiet background treatment. */
133
+ this.active = false;
134
+ /** Whether inline-rename is available at all. When `false`, the rename
135
+ * button never renders and the row can never enter its editing state. If
136
+ * flipped to `false` while a rename is already open, the in-progress edit
137
+ * is cancelled (discarded, like Escape) rather than left committable. */
138
+ this.editable = true;
139
+ this.renaming = false;
140
+ this.draftTitle = '';
141
+ this.hasActionsSlot = false;
142
+ this.onOptionClick = () => {
143
+ // While renaming, `[part="option"]` has no role/selection semantics
144
+ // (see the class doc) -- a click inside it (e.g. to place the caret in
145
+ // the input) must not also select the row.
146
+ if (this.renaming)
147
+ return;
148
+ this.select();
149
+ };
150
+ this.onOptionKeyDown = (e) => {
151
+ if (this.renaming)
152
+ return;
153
+ if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
154
+ // Space would otherwise scroll the page, same as lyra-checkbox/lyra-switch.
155
+ e.preventDefault();
156
+ this.select();
157
+ }
158
+ };
159
+ this.onRenameButtonClick = () => {
160
+ // No stopPropagation() needed here: the rename button is a DOM sibling
161
+ // of `[part="option"]` (see the class doc), not a descendant of it, so
162
+ // this click was never going to reach onOptionClick's listener anyway.
163
+ this.startRename();
164
+ };
165
+ this.onTitleInputChange = (e) => {
166
+ this.draftTitle = e.target.value;
167
+ };
168
+ this.onTitleInputKeyDown = (e) => {
169
+ // The input is a descendant of `[part="option"]` (unlike the rename
170
+ // button/actions slot, which are siblings of it) -- its keydown would
171
+ // otherwise bubble into onOptionKeyDown above. Stopping it here avoids a
172
+ // race where commitRename() (called below) has already flipped
173
+ // `renaming` back to `false` by the time that bubbled event reaches
174
+ // onOptionKeyDown's own `if (this.renaming) return;` guard, which would
175
+ // otherwise wrongly let the same Enter keystroke also fire lyra-select.
176
+ e.stopPropagation();
177
+ if (e.key === 'Enter') {
178
+ e.preventDefault();
179
+ this.commitRename();
180
+ }
181
+ else if (e.key === 'Escape') {
182
+ e.preventDefault();
183
+ this.cancelRename();
184
+ }
185
+ };
186
+ this.onTitleInputBlur = () => {
187
+ // If Escape already ended the edit synchronously (cancelRename() runs
188
+ // before this fires), `renaming` is already false by the time the
189
+ // now-removed input's blur event reaches here -- skip so Escape can't
190
+ // also commit.
191
+ if (!this.renaming)
192
+ return;
193
+ this.commitRename();
194
+ };
195
+ this.onActionsSlotChange = (e) => {
196
+ this.hasActionsSlot = e.target.assignedElements({ flatten: true }).length > 0;
197
+ };
198
+ }
199
+ static { this.styles = [LyraElement.styles, styles]; }
200
+ willUpdate(changed) {
201
+ if (!this.hasUpdated) {
202
+ this.hasActionsSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'actions');
203
+ }
204
+ // `editable` documents that flipping it false can never leave a rename
205
+ // committable -- without this, toggling it mid-edit would strand the
206
+ // input mounted (and still submittable via Enter/blur) since nothing
207
+ // else observes `editable` while `renaming` is already true.
208
+ if (changed.has('editable') && !this.editable && this.renaming) {
209
+ this.cancelRename();
210
+ }
211
+ }
212
+ updated(changed) {
213
+ if (changed.has('renaming') && this.renaming) {
214
+ // Runs after render, so the input already exists in the DOM.
215
+ this.titleInput?.focus();
216
+ this.titleInput?.select();
217
+ }
218
+ }
219
+ get normalizedTimestamp() {
220
+ if (this.timestamp === undefined)
221
+ return undefined;
222
+ const date = this.timestamp instanceof Date ? this.timestamp : new Date(this.timestamp);
223
+ return Number.isNaN(date.getTime()) ? undefined : date;
224
+ }
225
+ select() {
226
+ this.emit('lyra-select');
227
+ }
228
+ startRename() {
229
+ if (!this.editable || this.renaming)
230
+ return;
231
+ this.draftTitle = this.title;
232
+ this.renaming = true;
233
+ }
234
+ commitRename() {
235
+ this.renaming = false;
236
+ const next = this.draftTitle.trim();
237
+ // An empty or unchanged draft has nothing meaningful to commit -- treat
238
+ // it the same as Escape rather than firing a no-op (or blanking) rename
239
+ // for the consumer to deal with.
240
+ if (!next || next === this.title)
241
+ return;
242
+ this.emit('lyra-rename', { title: next });
243
+ }
244
+ cancelRename() {
245
+ this.renaming = false;
246
+ }
247
+ render() {
248
+ const ts = this.normalizedTimestamp;
249
+ const formatter = this.formatTimestamp ?? defaultFormatTimestamp;
250
+ const displayTitle = this.title || 'Untitled conversation';
251
+ const showRenameButton = this.editable && !this.renaming;
252
+ // Shared between the rename button and the input it opens: the input is
253
+ // where focus actually lands, so it needs the same row-specific
254
+ // accessible name (not a generic one) to disambiguate which row a
255
+ // screen-reader user is editing.
256
+ const renameLabel = `Rename ${displayTitle}`;
257
+ return html `
258
+ <div part="base">
259
+ <div
260
+ part="option"
261
+ role=${this.renaming ? nothing : 'button'}
262
+ tabindex=${this.renaming ? nothing : '0'}
263
+ aria-current=${this.renaming || !this.active ? nothing : 'true'}
264
+ aria-label=${this.renaming ? nothing : this.getAttribute('aria-label') || displayTitle}
265
+ @click=${this.onOptionClick}
266
+ @keydown=${this.onOptionKeyDown}
267
+ >
268
+ <div part="content">
269
+ ${this.renaming
270
+ ? html `<input
271
+ part="title-input"
272
+ type="text"
273
+ .value=${this.draftTitle}
274
+ aria-label=${renameLabel}
275
+ @input=${this.onTitleInputChange}
276
+ @keydown=${this.onTitleInputKeyDown}
277
+ @blur=${this.onTitleInputBlur}
278
+ />`
279
+ : html `<span part="title" title=${displayTitle}>${displayTitle}</span>`}
280
+ ${this.excerpt ? html `<span part="excerpt">${this.excerpt}</span>` : nothing}
281
+ </div>
282
+ ${ts ? html `<time part="timestamp" datetime=${ts.toISOString()}>${formatter(ts)}</time>` : nothing}
283
+ </div>
284
+ ${showRenameButton
285
+ ? html `<button
286
+ part="rename-button"
287
+ type="button"
288
+ aria-label=${renameLabel}
289
+ @click=${this.onRenameButtonClick}
290
+ >
291
+ ${pencilIcon()}
292
+ </button>`
293
+ : nothing}
294
+ <span part="actions" ?hidden=${!this.hasActionsSlot}>
295
+ <slot name="actions" @slotchange=${this.onActionsSlotChange}></slot>
296
+ </span>
297
+ </div>
298
+ `;
299
+ }
300
+ }
301
+ __decorate([
302
+ property()
303
+ ], LyraConversationItem.prototype, "title", void 0);
304
+ __decorate([
305
+ property()
306
+ ], LyraConversationItem.prototype, "excerpt", void 0);
307
+ __decorate([
308
+ property({ attribute: false })
309
+ ], LyraConversationItem.prototype, "timestamp", void 0);
310
+ __decorate([
311
+ property({ attribute: false })
312
+ ], LyraConversationItem.prototype, "formatTimestamp", void 0);
313
+ __decorate([
314
+ property({ type: Boolean, reflect: true })
315
+ ], LyraConversationItem.prototype, "active", void 0);
316
+ __decorate([
317
+ property({ type: Boolean, reflect: true })
318
+ ], LyraConversationItem.prototype, "editable", void 0);
319
+ __decorate([
320
+ state()
321
+ ], LyraConversationItem.prototype, "renaming", void 0);
322
+ __decorate([
323
+ state()
324
+ ], LyraConversationItem.prototype, "draftTitle", void 0);
325
+ __decorate([
326
+ state()
327
+ ], LyraConversationItem.prototype, "hasActionsSlot", void 0);
328
+ __decorate([
329
+ query('[part="title-input"]')
330
+ ], LyraConversationItem.prototype, "titleInput", void 0);
331
+ defineElement('conversation-item', LyraConversationItem);
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,155 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: block;
5
+ font-size: 0.875rem;
6
+ line-height: 1.4;
7
+ }
8
+
9
+ /* [part='base'] is a plain layout wrapper (no ARIA role of its own) --
10
+ the interactive/selectable region is [part='option'] alone, kept free
11
+ of focusable descendants (see the class doc's nested-interactive note).
12
+ The row-level hover/active background treatments still live here so
13
+ hovering anywhere across the row -- including over the trailing
14
+ rename/actions controls -- highlights the whole thing as one row. */
15
+ [part='base'] {
16
+ display: flex;
17
+ align-items: flex-start;
18
+ gap: var(--lyra-space-xs);
19
+ padding: var(--lyra-space-s) var(--lyra-space-m);
20
+ border-radius: var(--lyra-radius);
21
+ transition: background-color var(--lyra-transition-fast);
22
+ }
23
+ :host(:hover) [part='base'] {
24
+ background: color-mix(in srgb, var(--lyra-color-text) 6%, transparent);
25
+ }
26
+ /* Placed after the :hover rule (equal selector specificity) so an
27
+ active-and-hovered row keeps the stronger active tint instead of the
28
+ two backgrounds visually competing. */
29
+ :host([active]) [part='base'] {
30
+ background: var(--lyra-color-brand-quiet);
31
+ }
32
+
33
+ /* text-quiet's contrast ratio against brand-quiet lands at ~4.25:1 --
34
+ just under the WCAG AA 4.5:1 floor for normal-size text -- even though
35
+ it comfortably passes against the plain (non-active) background used
36
+ the rest of the time. Same class of bug already hit and fixed in
37
+ lyra-attachment-chip's [part='size'] and lyra-chat-message's
38
+ [part='footer']; same fix, full-strength text color once active. */
39
+ :host([active]) [part='excerpt'],
40
+ :host([active]) [part='timestamp'] {
41
+ color: var(--lyra-color-text);
42
+ }
43
+
44
+ [part='option'] {
45
+ display: flex;
46
+ align-items: flex-start;
47
+ gap: var(--lyra-space-s);
48
+ flex: 1 1 auto;
49
+ min-inline-size: 0;
50
+ cursor: pointer;
51
+ outline: none; /* the visible ring below targets [part='option'] directly */
52
+ -webkit-tap-highlight-color: transparent;
53
+ }
54
+ [part='option']:focus-visible {
55
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
56
+ outline-offset: var(--lyra-focus-ring-offset);
57
+ }
58
+
59
+ [part='content'] {
60
+ flex: 1 1 auto;
61
+ min-inline-size: 0;
62
+ display: flex;
63
+ flex-direction: column;
64
+ gap: 0.125rem;
65
+ }
66
+
67
+ [part='title'] {
68
+ display: block;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ white-space: nowrap;
72
+ font-weight: 600;
73
+ color: var(--lyra-color-text);
74
+ }
75
+
76
+ [part='title-input'] {
77
+ display: block;
78
+ inline-size: 100%;
79
+ box-sizing: border-box;
80
+ padding: 0.125rem var(--lyra-space-xs);
81
+ border: 1px solid var(--lyra-color-brand);
82
+ border-radius: calc(var(--lyra-radius) * 0.6);
83
+ background: var(--lyra-color-surface);
84
+ color: var(--lyra-color-text);
85
+ font: inherit;
86
+ font-weight: 600;
87
+ }
88
+ [part='title-input']:focus-visible {
89
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
90
+ outline-offset: var(--lyra-focus-ring-offset);
91
+ }
92
+
93
+ [part='excerpt'] {
94
+ display: block;
95
+ overflow: hidden;
96
+ text-overflow: ellipsis;
97
+ white-space: nowrap;
98
+ color: var(--lyra-color-text-quiet);
99
+ font-size: 0.8125rem;
100
+ }
101
+
102
+ [part='timestamp'] {
103
+ flex: 0 0 auto;
104
+ align-self: flex-start;
105
+ white-space: nowrap;
106
+ color: var(--lyra-color-text-quiet);
107
+ font-size: 0.75rem;
108
+ font-variant-numeric: tabular-nums;
109
+ }
110
+
111
+ [part='rename-button'] {
112
+ flex: 0 0 auto;
113
+ display: inline-flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ min-inline-size: min(var(--lyra-icon-button-size), 1.75rem);
117
+ min-block-size: min(var(--lyra-icon-button-size), 1.75rem);
118
+ padding: 0;
119
+ border: none;
120
+ border-radius: calc(var(--lyra-radius) * 0.6);
121
+ background: transparent;
122
+ color: var(--lyra-color-text-quiet);
123
+ cursor: pointer;
124
+ -webkit-tap-highlight-color: transparent;
125
+ transition: background-color var(--lyra-transition-fast);
126
+ }
127
+ [part='rename-button']:hover {
128
+ background: color-mix(in srgb, var(--lyra-color-text) 8%, transparent);
129
+ color: var(--lyra-color-text);
130
+ }
131
+ [part='rename-button']:focus-visible {
132
+ outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
133
+ outline-offset: var(--lyra-focus-ring-offset);
134
+ }
135
+ [part='rename-button'] svg {
136
+ display: block;
137
+ }
138
+
139
+ [part='actions'] {
140
+ flex: 0 0 auto;
141
+ display: flex;
142
+ align-items: center;
143
+ gap: var(--lyra-space-xs);
144
+ }
145
+ [part='actions'][hidden] {
146
+ display: none;
147
+ }
148
+
149
+ @media (prefers-reduced-motion: reduce) {
150
+ [part='base'],
151
+ [part='rename-button'] {
152
+ transition: none !important;
153
+ }
154
+ }
155
+ `;
@@ -1,4 +1,18 @@
1
1
  export type WeekdayFormat = 'narrow' | 'short' | 'long';
2
+ export type CalendarMode = 'single' | 'range';
3
+ /** Normalize an untyped calendar count to the supported one- or two-month range. */
4
+ export declare function normalizeCalendarMonths(value: unknown): 1 | 2;
5
+ /** Normalize an untyped weekday format before passing it to `Intl.DateTimeFormat`. */
6
+ export declare function normalizeWeekdayFormat(value: unknown): WeekdayFormat;
7
+ /** Normalize an untyped picker mode to the single-date default. */
8
+ export declare function normalizeCalendarMode(value: unknown): CalendarMode;
9
+ /**
10
+ * Construct a date formatter while treating a malformed runtime locale as
11
+ * the platform default. Attribute values and JavaScript property writes are
12
+ * not constrained by TypeScript's declarations, so they must not be allowed
13
+ * to turn a calendar render into a `RangeError`.
14
+ */
15
+ export declare function dateTimeFormat(locale: unknown, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
2
16
  /** Parse `YYYY-MM-DD` into a local Date, or null if invalid. */
3
17
  export declare function parseISO(s: string): Date | null;
4
18
  /** Format a Date as local `YYYY-MM-DD`. */
@@ -6,6 +20,16 @@ export declare function formatISO(d: Date): string;
6
20
  export declare function isSameDay(a: Date, b: Date): boolean;
7
21
  /** First day of the month `n` months from `d`. */
8
22
  export declare function addMonths(d: Date, n: number): Date;
23
+ /**
24
+ * `d` shifted by `n` months, keeping the same day-of-month unless the target
25
+ * month is shorter, in which case the day is clamped to that month's last
26
+ * day. Plain `new Date(year, month + n, d.getDate())` construction instead
27
+ * overflows a too-large day-of-month into the *following* month (e.g. Jan 31
28
+ * + 1 month rolls into March, skipping February entirely) because the Date
29
+ * constructor normalizes out-of-range day components rather than clamping
30
+ * them.
31
+ */
32
+ export declare function addMonthsClampingDay(d: Date, n: number): Date;
9
33
  export declare function clampDate(d: Date, min: Date | null, max: Date | null): Date;
10
34
  /**
11
35
  * A 6×7 grid of Dates covering the given month, week-aligned to `firstDayOfWeek`
@@ -1,3 +1,32 @@
1
+ /** Normalize an untyped calendar count to the supported one- or two-month range. */
2
+ export function normalizeCalendarMonths(value) {
3
+ const numeric = typeof value === 'number' ? value : Number(value);
4
+ if (!Number.isFinite(numeric))
5
+ return 1;
6
+ return Math.min(2, Math.max(1, Math.trunc(numeric)));
7
+ }
8
+ /** Normalize an untyped weekday format before passing it to `Intl.DateTimeFormat`. */
9
+ export function normalizeWeekdayFormat(value) {
10
+ return value === 'narrow' || value === 'long' ? value : 'short';
11
+ }
12
+ /** Normalize an untyped picker mode to the single-date default. */
13
+ export function normalizeCalendarMode(value) {
14
+ return value === 'range' ? 'range' : 'single';
15
+ }
16
+ /**
17
+ * Construct a date formatter while treating a malformed runtime locale as
18
+ * the platform default. Attribute values and JavaScript property writes are
19
+ * not constrained by TypeScript's declarations, so they must not be allowed
20
+ * to turn a calendar render into a `RangeError`.
21
+ */
22
+ export function dateTimeFormat(locale, options) {
23
+ try {
24
+ return new Intl.DateTimeFormat(typeof locale === 'string' && locale ? locale : undefined, options);
25
+ }
26
+ catch {
27
+ return new Intl.DateTimeFormat(undefined, options);
28
+ }
29
+ }
1
30
  /** Parse `YYYY-MM-DD` into a local Date, or null if invalid. */
2
31
  export function parseISO(s) {
3
32
  if (!s)
@@ -32,6 +61,20 @@ export function isSameDay(a, b) {
32
61
  export function addMonths(d, n) {
33
62
  return new Date(d.getFullYear(), d.getMonth() + n, 1);
34
63
  }
64
+ /**
65
+ * `d` shifted by `n` months, keeping the same day-of-month unless the target
66
+ * month is shorter, in which case the day is clamped to that month's last
67
+ * day. Plain `new Date(year, month + n, d.getDate())` construction instead
68
+ * overflows a too-large day-of-month into the *following* month (e.g. Jan 31
69
+ * + 1 month rolls into March, skipping February entirely) because the Date
70
+ * constructor normalizes out-of-range day components rather than clamping
71
+ * them.
72
+ */
73
+ export function addMonthsClampingDay(d, n) {
74
+ const targetMonth = d.getMonth() + n;
75
+ const lastDayOfTargetMonth = new Date(d.getFullYear(), targetMonth + 1, 0).getDate();
76
+ return new Date(d.getFullYear(), targetMonth, Math.min(d.getDate(), lastDayOfTargetMonth));
77
+ }
35
78
  export function clampDate(d, min, max) {
36
79
  if (min && d < min)
37
80
  return min;
@@ -60,18 +103,22 @@ export function monthMatrix(year, month, firstDayOfWeek = 0) {
60
103
  }
61
104
  /** Localized weekday header labels, ordered from `firstDayOfWeek`. */
62
105
  export function weekdayLabels(firstDayOfWeek = 0, format = 'short', locale) {
63
- const fmt = new Intl.DateTimeFormat(locale || undefined, { weekday: format });
106
+ const numericFirstDay = Number(firstDayOfWeek);
107
+ const start = Number.isFinite(numericFirstDay)
108
+ ? ((Math.trunc(numericFirstDay) % 7) + 7) % 7
109
+ : 0;
110
+ const fmt = dateTimeFormat(locale, { weekday: normalizeWeekdayFormat(format) });
64
111
  const labels = [];
65
112
  // 2021-08-01 is a Sunday, so index i maps cleanly to a weekday.
66
113
  for (let i = 0; i < 7; i++) {
67
- const day = (firstDayOfWeek + i) % 7;
114
+ const day = (start + i) % 7;
68
115
  labels.push(fmt.format(new Date(2021, 7, 1 + day)));
69
116
  }
70
117
  return labels;
71
118
  }
72
119
  /** Localized "Month YYYY" title. */
73
120
  export function monthTitle(year, month, locale) {
74
- return new Intl.DateTimeFormat(locale || undefined, { month: 'long', year: 'numeric' }).format(new Date(year, month, 1));
121
+ return dateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(new Date(year, month, 1));
75
122
  }
76
123
  const FDOW = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
77
124
  /** Locale-derived first day of week (0=Sunday … 6=Saturday), or null if unsupported. */
@@ -97,5 +144,5 @@ export function resolveFirstDayOfWeek(value, locale) {
97
144
  const derived = locale ? localeFirstDayOfWeek(locale) : null;
98
145
  return derived ?? 0;
99
146
  }
100
- return FDOW[value.toLowerCase()] ?? 0;
147
+ return typeof value === 'string' ? (FDOW[value.toLowerCase()] ?? 0) : 0;
101
148
  }