@fusion.dev/helix-headless 0.145.0 → 0.147.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 (343) hide show
  1. package/custom-elements.json +12286 -4281
  2. package/dist/accordion/item/accordion-item.d.ts +51 -18
  3. package/dist/accordion/item/accordion-item.js +45 -13
  4. package/dist/accordion/root/accordion-root.d.ts +16 -7
  5. package/dist/accordion/root/accordion-root.js +3 -3
  6. package/dist/announcement/root/announcement-root.d.ts +16 -6
  7. package/dist/announcement/root/announcement-root.js +37 -7
  8. package/dist/app-header/root/app-header-root.d.ts +7 -2
  9. package/dist/app-header/root/app-header-root.js +9 -1
  10. package/dist/app-header/sectioning.d.ts +3 -1
  11. package/dist/app-header/sectioning.js +3 -2
  12. package/dist/area-chart/root/area-chart-root.d.ts +18 -1
  13. package/dist/area-chart/root/area-chart-root.js +11 -3
  14. package/dist/avatar/group/avatar-group.d.ts +20 -14
  15. package/dist/avatar/group/avatar-group.js +17 -19
  16. package/dist/avatar/root/avatar-root.d.ts +31 -1
  17. package/dist/avatar/root/avatar-root.js +11 -1
  18. package/dist/badge/root/badge-root.d.ts +60 -7
  19. package/dist/badge/root/badge-root.js +89 -6
  20. package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
  21. package/dist/bar-chart/root/bar-chart-root.js +48 -20
  22. package/dist/bar-chart/stack.d.ts +25 -0
  23. package/dist/bar-chart/stack.js +27 -0
  24. package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
  25. package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
  26. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
  27. package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
  28. package/dist/button/root/button-root.d.ts +50 -38
  29. package/dist/button/root/button-root.js +42 -53
  30. package/dist/button/submitter.d.ts +27 -0
  31. package/dist/button/submitter.js +25 -0
  32. package/dist/button-group/root/button-group-root.d.ts +2 -1
  33. package/dist/button-group/root/button-group-root.js +5 -1
  34. package/dist/canvas/node/canvas-node.d.ts +4 -3
  35. package/dist/canvas/node/canvas-node.js +3 -2
  36. package/dist/canvas/root/canvas-root.js +2 -2
  37. package/dist/card/root/card-root.d.ts +36 -4
  38. package/dist/card/root/card-root.js +29 -10
  39. package/dist/carousel/root/carousel-root.d.ts +43 -4
  40. package/dist/carousel/root/carousel-root.js +40 -12
  41. package/dist/carousel/stops.d.ts +20 -0
  42. package/dist/carousel/stops.js +30 -0
  43. package/dist/chat/message/chat-message.js +5 -4
  44. package/dist/chat/naming.d.ts +5 -1
  45. package/dist/chat/naming.js +4 -2
  46. package/dist/chat/root/chat-root.d.ts +40 -4
  47. package/dist/chat/root/chat-root.js +32 -6
  48. package/dist/checkbox/root/checkbox-root.d.ts +20 -0
  49. package/dist/checkbox/root/checkbox-root.js +18 -7
  50. package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
  51. package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
  52. package/dist/checkbox-group/select-all.d.ts +21 -0
  53. package/dist/checkbox-group/select-all.js +7 -0
  54. package/dist/code-block/highlight.d.ts +15 -0
  55. package/dist/code-block/highlight.js +4 -0
  56. package/dist/code-block/root/code-block-root.d.ts +79 -10
  57. package/dist/code-block/root/code-block-root.js +74 -5
  58. package/dist/color-input/root/color-input-root.d.ts +14 -0
  59. package/dist/color-input/root/color-input-root.js +17 -7
  60. package/dist/color-picker/channels.js +1 -2
  61. package/dist/color-picker/root/color-picker-root.d.ts +53 -16
  62. package/dist/color-picker/root/color-picker-root.js +155 -46
  63. package/dist/color-picker/wheel.d.ts +17 -0
  64. package/dist/color-picker/wheel.js +6 -0
  65. package/dist/combobox/root/combobox-root.d.ts +56 -0
  66. package/dist/combobox/root/combobox-root.js +92 -15
  67. package/dist/command/root/command-root.d.ts +19 -2
  68. package/dist/command/root/command-root.js +24 -23
  69. package/dist/copy-button/root/copy-button-root.d.ts +21 -1
  70. package/dist/copy-button/root/copy-button-root.js +16 -4
  71. package/dist/data-table/index.d.ts +1 -1
  72. package/dist/data-table/index.js +1 -1
  73. package/dist/data-table/keys.d.ts +6 -0
  74. package/dist/data-table/keys.js +14 -0
  75. package/dist/data-table/root/data-table-root.d.ts +27 -18
  76. package/dist/data-table/root/data-table-root.js +31 -57
  77. package/dist/data-table/tree.d.ts +16 -1
  78. package/dist/data-table/tree.js +2 -3
  79. package/dist/date-input/root/date-input-root.d.ts +11 -2
  80. package/dist/date-input/root/date-input-root.js +26 -12
  81. package/dist/date-picker/root/date-picker-root.d.ts +14 -9
  82. package/dist/date-picker/root/date-picker-root.js +33 -22
  83. package/dist/description-list/item/description-list-item.d.ts +18 -4
  84. package/dist/description-list/item/description-list-item.js +8 -4
  85. package/dist/dialog/description.js +15 -1
  86. package/dist/dialog/root/dialog-root.d.ts +8 -2
  87. package/dist/dialog/root/dialog-root.js +16 -1
  88. package/dist/divider/root/divider-root.d.ts +3 -0
  89. package/dist/divider/root/divider-root.js +2 -1
  90. package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
  91. package/dist/donut-chart/root/donut-chart-root.js +55 -1
  92. package/dist/donut-chart/slice-label.d.ts +35 -0
  93. package/dist/donut-chart/slice-label.js +11 -0
  94. package/dist/drawer/reveal.d.ts +8 -0
  95. package/dist/drawer/reveal.js +1 -0
  96. package/dist/drawer/root/drawer-root.d.ts +63 -2
  97. package/dist/drawer/root/drawer-root.js +75 -4
  98. package/dist/drilldown/item/drilldown-item.d.ts +21 -1
  99. package/dist/drilldown/item/drilldown-item.js +40 -5
  100. package/dist/drilldown/root/drilldown-root.d.ts +21 -3
  101. package/dist/drilldown/root/drilldown-root.js +22 -3
  102. package/dist/element-events.generated.js +35 -6
  103. package/dist/empty/root/empty-root.d.ts +34 -2
  104. package/dist/empty/root/empty-root.js +26 -4
  105. package/dist/file-input/root/file-input-root.d.ts +99 -8
  106. package/dist/file-input/root/file-input-root.js +120 -22
  107. package/dist/file-input/screen.d.ts +2 -1
  108. package/dist/file-input/status.d.ts +24 -0
  109. package/dist/file-input/status.js +10 -0
  110. package/dist/filter-input/chip/filter-chip.d.ts +23 -0
  111. package/dist/filter-input/chip/filter-chip.js +11 -2
  112. package/dist/filter-input/menu/filter-menu.d.ts +2 -0
  113. package/dist/filter-input/menu/filter-menu.js +12 -4
  114. package/dist/filter-input/root/filter-input-root.d.ts +38 -6
  115. package/dist/filter-input/root/filter-input-root.js +18 -28
  116. package/dist/filter-input/suggest.d.ts +28 -3
  117. package/dist/filter-input/suggest.js +18 -8
  118. package/dist/format-date/options.d.ts +3 -4
  119. package/dist/format-date/options.js +2 -2
  120. package/dist/format-date/root/format-date-root.d.ts +27 -17
  121. package/dist/format-date/root/format-date-root.js +27 -48
  122. package/dist/heatmap/root/buckets.d.ts +21 -0
  123. package/dist/heatmap/root/buckets.js +34 -0
  124. package/dist/heatmap/root/heatmap-root.d.ts +83 -11
  125. package/dist/heatmap/root/heatmap-root.js +104 -12
  126. package/dist/icon/index.d.ts +1 -1
  127. package/dist/icon/index.js +1 -1
  128. package/dist/icon/registry.d.ts +26 -1
  129. package/dist/icon/registry.js +12 -1
  130. package/dist/icon/root/icon-root.d.ts +25 -1
  131. package/dist/icon/root/icon-root.js +44 -12
  132. package/dist/icon/root/index.d.ts +1 -1
  133. package/dist/icon/root/index.js +1 -1
  134. package/dist/icon/settle.d.ts +7 -0
  135. package/dist/icon/settle.js +10 -0
  136. package/dist/icon-button/root/icon-button-root.d.ts +2 -0
  137. package/dist/image/root/image-root.d.ts +14 -1
  138. package/dist/image/root/image-root.js +7 -2
  139. package/dist/input/root/input-root.d.ts +34 -3
  140. package/dist/input/root/input-root.js +17 -4
  141. package/dist/kbd/keys.d.ts +29 -0
  142. package/dist/kbd/keys.js +52 -0
  143. package/dist/kbd/root/kbd-root.d.ts +52 -1
  144. package/dist/kbd/root/kbd-root.js +40 -47
  145. package/dist/legend/hidden-series.d.ts +10 -2
  146. package/dist/legend/hidden-series.js +5 -2
  147. package/dist/legend/root/legend-root.d.ts +77 -12
  148. package/dist/legend/root/legend-root.js +71 -17
  149. package/dist/lightbox/root/lightbox-root.d.ts +98 -10
  150. package/dist/lightbox/root/lightbox-root.js +153 -18
  151. package/dist/lightbox/zoom-controller.d.ts +59 -0
  152. package/dist/lightbox/zoom-controller.js +128 -0
  153. package/dist/lightbox/zoom.d.ts +24 -0
  154. package/dist/lightbox/zoom.js +18 -0
  155. package/dist/line-chart/root/line-chart-root.d.ts +38 -1
  156. package/dist/line-chart/root/line-chart-root.js +31 -3
  157. package/dist/list/item/list-item.d.ts +2 -0
  158. package/dist/list/item/list-item.js +11 -2
  159. package/dist/list/root/list-root.d.ts +70 -13
  160. package/dist/list/root/list-root.js +91 -13
  161. package/dist/list/selection.d.ts +54 -7
  162. package/dist/list/selection.js +32 -7
  163. package/dist/listbox/root/listbox-root.d.ts +44 -4
  164. package/dist/listbox/root/listbox-root.js +72 -34
  165. package/dist/loader/busy.d.ts +10 -0
  166. package/dist/loader/busy.js +11 -0
  167. package/dist/loader/root/loader-root.d.ts +9 -2
  168. package/dist/loader/root/loader-root.js +23 -3
  169. package/dist/megamenu/hand-over.d.ts +75 -0
  170. package/dist/megamenu/hand-over.js +67 -0
  171. package/dist/megamenu/root/megamenu-root.d.ts +80 -15
  172. package/dist/megamenu/root/megamenu-root.js +76 -19
  173. package/dist/menu/item/menu-item.d.ts +51 -2
  174. package/dist/menu/item/menu-item.js +50 -26
  175. package/dist/menu/root/menu-root.d.ts +17 -0
  176. package/dist/menu/root/menu-root.js +2 -2
  177. package/dist/meter/root/meter-root.d.ts +62 -1
  178. package/dist/meter/root/meter-root.js +38 -16
  179. package/dist/navigation/root/navigation-root.d.ts +2 -1
  180. package/dist/navigation/root/navigation-root.js +2 -2
  181. package/dist/notifications/root/notifications-root.d.ts +20 -4
  182. package/dist/notifications/root/notifications-root.js +30 -8
  183. package/dist/number-input/grain.d.ts +28 -0
  184. package/dist/number-input/grain.js +14 -0
  185. package/dist/number-input/root/number-input-root.d.ts +34 -9
  186. package/dist/number-input/root/number-input-root.js +31 -25
  187. package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
  188. package/dist/object-inspector/root/object-inspector-root.js +134 -92
  189. package/dist/object-inspector/rows.d.ts +18 -0
  190. package/dist/object-inspector/rows.js +33 -0
  191. package/dist/option/index.d.ts +1 -0
  192. package/dist/option/index.js +1 -0
  193. package/dist/option/root/option-root.d.ts +5 -3
  194. package/dist/option/separator/option-separator.d.ts +30 -0
  195. package/dist/option/separator/option-separator.js +21 -0
  196. package/dist/outline/root/outline-root.d.ts +30 -0
  197. package/dist/outline/root/outline-root.js +17 -13
  198. package/dist/pagination/size/pagination-size.d.ts +6 -0
  199. package/dist/pagination/size/pagination-size.js +5 -3
  200. package/dist/pin-input/code.d.ts +37 -0
  201. package/dist/pin-input/code.js +25 -0
  202. package/dist/pin-input/root/pin-input-root.d.ts +116 -115
  203. package/dist/pin-input/root/pin-input-root.js +163 -155
  204. package/dist/popover/hide-outside.d.ts +14 -0
  205. package/dist/popover/hide-outside.js +34 -0
  206. package/dist/popover/root/popover-root.d.ts +64 -8
  207. package/dist/popover/root/popover-root.js +67 -4
  208. package/dist/progress/root/progress-root.d.ts +47 -0
  209. package/dist/progress/root/progress-root.js +34 -16
  210. package/dist/qr-code/export.d.ts +45 -1
  211. package/dist/qr-code/export.js +28 -0
  212. package/dist/qr-code/name.d.ts +11 -0
  213. package/dist/qr-code/name.js +7 -0
  214. package/dist/qr-code/root/qr-code-root.d.ts +36 -11
  215. package/dist/qr-code/root/qr-code-root.js +58 -11
  216. package/dist/quote/marks.d.ts +8 -0
  217. package/dist/quote/marks.js +5 -0
  218. package/dist/quote/root/quote-root.d.ts +14 -2
  219. package/dist/quote/root/quote-root.js +23 -1
  220. package/dist/radio/group/radio-group.d.ts +15 -0
  221. package/dist/radio/root/radio-root.d.ts +6 -2
  222. package/dist/radio/root/radio-root.js +7 -2
  223. package/dist/rating/root/rating-root.d.ts +30 -12
  224. package/dist/rating/root/rating-root.js +27 -27
  225. package/dist/scatter-chart/fit.d.ts +15 -0
  226. package/dist/scatter-chart/fit.js +35 -0
  227. package/dist/scatter-chart/root/scatter-chart-root.d.ts +51 -1
  228. package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
  229. package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
  230. package/dist/scroll-area/root/scroll-area-root.js +57 -173
  231. package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
  232. package/dist/scroll-area/scrollbar-controller.js +172 -0
  233. package/dist/scroll-area/scrollbar.d.ts +27 -8
  234. package/dist/scroll-area/scrollbar.js +10 -1
  235. package/dist/select/align.d.ts +47 -0
  236. package/dist/select/align.js +7 -0
  237. package/dist/select/root/select-root.d.ts +71 -0
  238. package/dist/select/root/select-root.js +78 -6
  239. package/dist/skeleton/root/skeleton-root.d.ts +3 -0
  240. package/dist/skeleton/root/skeleton-root.js +4 -2
  241. package/dist/skip-link/root/skip-link-root.js +2 -2
  242. package/dist/slider/root/slider-root.d.ts +59 -5
  243. package/dist/slider/root/slider-root.js +45 -3
  244. package/dist/sparkline/readings.d.ts +36 -0
  245. package/dist/sparkline/readings.js +36 -0
  246. package/dist/sparkline/root/sparkline-root.d.ts +121 -7
  247. package/dist/sparkline/root/sparkline-root.js +160 -26
  248. package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
  249. package/dist/speed-dial/item/speed-dial-item.js +2 -2
  250. package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
  251. package/dist/speed-dial/root/speed-dial-root.js +11 -3
  252. package/dist/splitter/root/splitter-root.d.ts +10 -12
  253. package/dist/splitter/root/splitter-root.js +211 -204
  254. package/dist/stat/root/stat-root.d.ts +14 -5
  255. package/dist/stat/root/stat-root.js +21 -5
  256. package/dist/steps/reach.d.ts +5 -0
  257. package/dist/steps/reach.js +3 -0
  258. package/dist/steps/root/steps-root.d.ts +56 -3
  259. package/dist/steps/root/steps-root.js +50 -6
  260. package/dist/steps/step/step.d.ts +8 -0
  261. package/dist/steps/step/step.js +8 -3
  262. package/dist/switch/root/switch-root.d.ts +10 -0
  263. package/dist/table/column/table-column.d.ts +6 -10
  264. package/dist/table/column/table-column.js +8 -20
  265. package/dist/table/root/table-root.d.ts +31 -10
  266. package/dist/table/root/table-root.js +14 -18
  267. package/dist/table/row/table-row.d.ts +24 -0
  268. package/dist/table/row/table-row.js +37 -1
  269. package/dist/tabs/panel/tab-panel.d.ts +16 -3
  270. package/dist/tabs/panel/tab-panel.js +34 -5
  271. package/dist/tabs/root/tabs-root.d.ts +17 -3
  272. package/dist/tabs/root/tabs-root.js +1 -1
  273. package/dist/tabs/tab/tab.d.ts +5 -0
  274. package/dist/tabs/tab/tab.js +5 -2
  275. package/dist/tag/group/tag-group.d.ts +44 -5
  276. package/dist/tag/group/tag-group.js +60 -9
  277. package/dist/tag/root/tag-root.js +9 -2
  278. package/dist/textarea/root/textarea-root.d.ts +41 -2
  279. package/dist/textarea/root/textarea-root.js +39 -1
  280. package/dist/time-input/root/time-input-root.d.ts +10 -2
  281. package/dist/time-input/root/time-input-root.js +24 -13
  282. package/dist/time-picker/root/time-picker-root.d.ts +28 -17
  283. package/dist/time-picker/root/time-picker-root.js +18 -29
  284. package/dist/time-picker/wheel-name.d.ts +9 -0
  285. package/dist/time-picker/wheel-name.js +15 -0
  286. package/dist/timeline/group/timeline-group.js +2 -2
  287. package/dist/toast/item/toast-item.d.ts +16 -3
  288. package/dist/toast/item/toast-item.js +22 -6
  289. package/dist/toast/root/toast-root.d.ts +34 -4
  290. package/dist/toast/root/toast-root.js +74 -13
  291. package/dist/toast/words.d.ts +12 -0
  292. package/dist/toast/words.js +25 -0
  293. package/dist/toggle/group/toggle-group.d.ts +52 -7
  294. package/dist/toggle/group/toggle-group.js +58 -44
  295. package/dist/toggle/root/toggle-root.js +2 -4
  296. package/dist/toolbar/root/toolbar-root.d.ts +21 -5
  297. package/dist/toolbar/root/toolbar-root.js +52 -8
  298. package/dist/tooltip/root/tooltip-root.d.ts +20 -3
  299. package/dist/tooltip/root/tooltip-root.js +18 -1
  300. package/dist/tour/back.d.ts +10 -0
  301. package/dist/tour/back.js +8 -0
  302. package/dist/tour/root/tour-root.d.ts +45 -2
  303. package/dist/tour/root/tour-root.js +53 -8
  304. package/dist/tour/stop/tour-stop.d.ts +3 -0
  305. package/dist/tour/stop/tour-stop.js +3 -3
  306. package/dist/tree/item/tree-item.d.ts +7 -3
  307. package/dist/tree/item/tree-item.js +3 -0
  308. package/dist/tree/root/tree-root.d.ts +24 -3
  309. package/dist/tree/root/tree-root.js +32 -13
  310. package/dist/tree/selection.js +2 -15
  311. package/dist/trend/figure.d.ts +16 -0
  312. package/dist/trend/figure.js +8 -0
  313. package/dist/trend/root/trend-root.d.ts +83 -19
  314. package/dist/trend/root/trend-root.js +59 -8
  315. package/dist/video/media-events.d.ts +13 -18
  316. package/dist/video/media-events.js +1 -5
  317. package/dist/video/root/extra-controls.d.ts +12 -0
  318. package/dist/video/root/extra-controls.js +6 -2
  319. package/dist/video/root/video-root.d.ts +23 -6
  320. package/dist/video/root/video-root.js +19 -10
  321. package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
  322. package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
  323. package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
  324. package/dist/video-playlist/root/video-playlist-root.js +3 -0
  325. package/dist/virtual-list/fill.d.ts +11 -8
  326. package/dist/virtual-list/fill.js +10 -17
  327. package/dist/virtual-list/keys.d.ts +16 -7
  328. package/dist/virtual-list/keys.js +17 -6
  329. package/dist/virtual-list/plan.d.ts +65 -0
  330. package/dist/virtual-list/plan.js +27 -0
  331. package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
  332. package/dist/virtual-list/root/virtual-list-root.js +218 -51
  333. package/lint.json +1 -1
  334. package/package.json +8 -8
  335. package/types/jsx.d.ts +7441 -1458
  336. package/types/svelte.d.ts +1 -0
  337. package/types/vue.d.ts +1501 -326
  338. package/dist/chat/relative-clock.d.ts +0 -39
  339. package/dist/chat/relative-clock.js +0 -31
  340. package/dist/data-table/root/order.d.ts +0 -141
  341. package/dist/data-table/root/order.js +0 -76
  342. package/dist/tag/selection.d.ts +0 -10
  343. package/dist/tag/selection.js +0 -12
@@ -1,8 +1,16 @@
1
+ /** A list as it may be given: names separated by commas, or an array of names. */
2
+ export type NameList = string | readonly string[];
3
+ /**
4
+ * The names in a list, written either way: split on commas from a string,
5
+ * trimmed and without blanks from an array, which is what a framework hands
6
+ * over for `hiddenSeries={['Direct']}`.
7
+ */
8
+ export declare const namesIn: (list: NameList) => string[];
1
9
  /** Whether a name is in the list, matched without regard to case, as a heading is. */
2
- export declare const isHidden: (list: string, name: string) => boolean;
10
+ export declare const isHidden: (list: NameList, name: string) => boolean;
3
11
  /**
4
12
  * The list a press on this name leaves: without it where it was hidden, and
5
13
  * with it at the end where it was shown. Written back with a comma and a
6
14
  * space, as a person writes a list.
7
15
  */
8
- export declare const toggledNames: (list: string, name: string) => string;
16
+ export declare const toggledNames: (list: NameList, name: string) => string;
@@ -1,11 +1,14 @@
1
1
  import { commaList, seriesKey } from '@fusion.dev/helix-core';
2
+ export const namesIn = (list) => typeof list === 'string'
3
+ ? commaList(list)
4
+ : list.map((name) => String(name).trim()).filter((name) => name !== '');
2
5
  export const isHidden = (list, name) => {
3
6
  const key = seriesKey(name);
4
- return commaList(list).some((one) => seriesKey(one) === key);
7
+ return namesIn(list).some((one) => seriesKey(one) === key);
5
8
  };
6
9
  export const toggledNames = (list, name) => {
7
10
  const key = seriesKey(name);
8
- const now = commaList(list);
11
+ const now = namesIn(list);
9
12
  const next = isHidden(list, name)
10
13
  ? now.filter((one) => seriesKey(one) !== key)
11
14
  : [...now, name.trim()];
@@ -1,5 +1,5 @@
1
- import { HelixElement, SourceController } from '@fusion.dev/helix-core';
2
- import { type PropertyValues, type TemplateResult } from 'lit';
1
+ import { HelixElement, KeyboardNavigationController, SourceController } from '@fusion.dev/helix-core';
2
+ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
3
3
  /**
4
4
  * @summary A list of the series in a chart, each name beside the color it is drawn in.
5
5
  *
@@ -21,8 +21,14 @@ import { type PropertyValues, type TemplateResult } from 'lit';
21
21
  * **`toggles` makes each entry a button that hides its series.** Every chart
22
22
  * reading the same table draws without a hidden series and fits its scale to
23
23
  * the rest, and the series keeps its color. The button says whether its
24
- * series is shown with `aria-pressed`. `hidden-series` holds the hidden names,
25
- * so a page can start with some hidden or read which are.
24
+ * series is shown with `aria-pressed`. The buttons are a `toolbar`, named
25
+ * as the list is, and one tab stop: the arrow keys move between them, Home
26
+ * and End go to the first and the last, and a typed letter goes to the next
27
+ * name starting with it.
28
+ * `hidden-series` holds the hidden names,
29
+ * so a page can start with some hidden or read which are. Two legends on one
30
+ * table show the same hidden series: the list written last wins, and the
31
+ * other legend takes it for its own entries.
26
32
  *
27
33
  * @since 0.1.0
28
34
  * @status stable
@@ -37,7 +43,7 @@ import { type PropertyValues, type TemplateResult } from 'lit';
37
43
  * `::part(entry)::before` in your stylesheet. The entry holds its series color
38
44
  * as `--chart-series`, and this tier ships no CSS.
39
45
  * @csspart entry-hidden - An entry whose series is hidden. Set alongside `entry`.
40
- * @csspart list - The list of entries.
46
+ * @csspart list - The list of entries, a `toolbar` under `toggles`.
41
47
  * @csspart name - One series name.
42
48
  * @csspart toggle - The button around a name under `toggles`, which hides or shows its series.
43
49
  */
@@ -79,9 +85,11 @@ export declare class HelixHeadlessLegend extends HelixElement {
79
85
  *
80
86
  * Set it to start with series hidden. Every chart reading the same table
81
87
  * draws without them. Commas only, because a column's heading may hold a
82
- * space. For a ring the names are the rows.
88
+ * space. For a ring the names are the rows. An array of names set on the
89
+ * property works too, as React sets `hiddenSeries={['Direct']}`; a toggle
90
+ * writes the list back as a string.
83
91
  */
84
- hiddenSeries: string;
92
+ hiddenSeries: string | readonly string[];
85
93
  /**
86
94
  * The name of the list, which a screen reader announces before its entries.
87
95
  *
@@ -99,16 +107,56 @@ export declare class HelixHeadlessLegend extends HelixElement {
99
107
  */
100
108
  toggles: boolean;
101
109
  protected readonly source: SourceController;
102
- /** Whether this legend has written the table's hidden series, so leaving undoes it. */
103
- private wrote;
110
+ /**
111
+ * The toggle that holds the one tab stop, by place: the one a reader was
112
+ * last on, or the first.
113
+ */
114
+ private stop;
115
+ /**
116
+ * The arrow keys, Home, End and typed letters among the toggles, so a
117
+ * legend of twelve series is one tab stop, as a toolbar of
118
+ * toggle buttons is. Nothing without `toggles`, where there is nothing to
119
+ * press.
120
+ */
121
+ protected readonly keys: KeyboardNavigationController;
122
+ /** The table this legend last wrote its `hidden-series` to, so leaving undoes it. */
123
+ private wroteTo;
124
+ /** Whether this update writes `hidden-series` to the table, decided before the render. */
125
+ private writes;
126
+ /**
127
+ * Decides who holds the hidden series for this update: this legend, or the
128
+ * table.
129
+ *
130
+ * **This legend, where its own `hidden-series` moved**, by a press, by the
131
+ * page, or by its first value, and where it has a list the table it now
132
+ * reads has not had from it yet. **The table otherwise**, which is a second
133
+ * legend on the same table having hidden something: this one takes the
134
+ * table's list for its own entries and writes nothing back.
135
+ *
136
+ * Writing back on every update is what hung a page with two legends whose
137
+ * lists differed: each write asks every reader of the table to update,
138
+ * which included the other legend, which wrote its own list back. Now the
139
+ * last list written wins and the other legend shows it, as two switches on
140
+ * one lamp do.
141
+ */
104
142
  protected willUpdate(changed: PropertyValues<this>): void;
143
+ /**
144
+ * Takes the table's hidden series as this legend's own, for its entries.
145
+ *
146
+ * A name hidden on the table that is not one of this legend's entries stays
147
+ * out of its list: a legend of the rows and one of the columns share a
148
+ * table, and each keeps a list of its own.
149
+ */
150
+ private follow;
105
151
  /**
106
152
  * Hands `hidden-series` to the table, where every chart reading it finds
107
153
  * it.
108
154
  *
109
155
  * After the update rather than before, because a server has no table and a
110
156
  * hydrating render must draw what the server drew: the charts follow a frame
111
- * after the legend, which is when they draw at all.
157
+ * after the legend, which is when they draw at all. Only this legend's own
158
+ * entries are written, so a series another legend hid among other names
159
+ * stays hidden.
112
160
  */
113
161
  protected updated(changed: PropertyValues<this>): void;
114
162
  disconnectedCallback(): void;
@@ -131,13 +179,30 @@ export declare class HelixHeadlessLegend extends HelixElement {
131
179
  */
132
180
  protected names(): string[];
133
181
  protected render(): TemplateResult;
182
+ /**
183
+ * What an entry shows before its name, behind a seam a tier can fill.
184
+ *
185
+ * Nothing on this tier, which ships no CSS: the styled tier and a page draw
186
+ * the swatch with `::part(entry)::before`, from the entry's `--chart-series`.
187
+ * A tier that draws its swatch as an element, or a mark per series, returns
188
+ * it here, and `index` says which palette slot the series takes.
189
+ */
190
+ protected renderSwatch(_name: string, _index: number): TemplateResult | typeof nothing;
191
+ /**
192
+ * An entry's name, behind a seam a tier can move: a value beside the name,
193
+ * or the name in other words. `index` is the series' place among the
194
+ * entries. A toggle holds the same name inside its button.
195
+ */
196
+ protected renderName(name: string, _index: number): TemplateResult;
134
197
  /**
135
198
  * The button around a name under `toggles`, behind a seam a tier can move.
136
199
  *
137
200
  * Pressed while its series is shown, which is the state a reader changes by
138
- * pressing it: a toggle button says whether its thing is on.
201
+ * pressing it: a toggle button says whether its thing is on. `holds` says
202
+ * whether it is the one tab stop, which is the last toggle a reader was on,
203
+ * the toggle at `index`.
139
204
  */
140
- protected renderToggle(name: string, off: boolean): TemplateResult;
205
+ protected renderToggle(name: string, off: boolean, index?: number, holds?: boolean): TemplateResult;
141
206
  }
142
207
  declare global {
143
208
  interface HTMLElementTagNameMap {
@@ -4,10 +4,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { commaList, customElement, HelixBeforeChangeEvent, HelixElement, requestChange, SourceController, seriesIndex, } from '@fusion.dev/helix-core';
7
+ import { customElement, HelixBeforeChangeEvent, HelixElement, KeyboardNavigationController, requestChange, SourceController, seriesIndex, seriesKey, typeaheadBy, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
- import { property } from 'lit/decorators.js';
10
- import { isHidden, toggledNames } from '../hidden-series.js';
9
+ import { property, state } from 'lit/decorators.js';
10
+ import { isHidden, namesIn, toggledNames } from '../hidden-series.js';
11
11
  let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
12
12
  constructor() {
13
13
  super(...arguments);
@@ -16,25 +16,59 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
16
16
  this.label = '';
17
17
  this.toggles = false;
18
18
  this.source = new SourceController(this);
19
- this.wrote = false;
19
+ this.stop = 0;
20
+ this.keys = new KeyboardNavigationController(this, {
21
+ items: () => this.toggles
22
+ ? [...this.renderRoot.querySelectorAll('[part="toggle"]')].map((button) => ({
23
+ contains: (node) => button.contains(node),
24
+ disabled: false,
25
+ focusItem: () => button.focus(),
26
+ select: () => { },
27
+ selected: false,
28
+ words: button.textContent?.trim() ?? '',
29
+ }))
30
+ : [],
31
+ origin: 'focus',
32
+ selects: () => false,
33
+ typeahead: typeaheadBy((item) => item.words ?? ''),
34
+ });
35
+ this.wroteTo = null;
36
+ this.writes = false;
20
37
  }
21
38
  willUpdate(changed) {
22
39
  if (changed.has('for')) {
23
40
  this.source.watch();
24
41
  }
42
+ const table = this.source.element;
43
+ const asked = changed.has('hiddenSeries') &&
44
+ !(changed.get('hiddenSeries') === undefined && namesIn(this.hiddenSeries).length === 0);
45
+ this.writes =
46
+ asked || (table !== null && table !== this.wroteTo && namesIn(this.hiddenSeries).length > 0);
47
+ if (!this.writes && table !== null) {
48
+ this.follow();
49
+ }
50
+ }
51
+ follow() {
52
+ const hidden = this.source.hidden;
53
+ const now = namesIn(this.hiddenSeries);
54
+ const next = this.names().filter((name) => hidden.has(seriesKey(name)));
55
+ const same = next.length === now.length &&
56
+ next.every((name) => now.some((one) => seriesKey(one) === seriesKey(name)));
57
+ if (!same) {
58
+ this.hiddenSeries = next.join(', ');
59
+ }
25
60
  }
26
61
  updated(changed) {
27
62
  super.updated(changed);
28
- const names = commaList(this.hiddenSeries);
29
- if (names.length > 0 || this.wrote) {
30
- this.source.hide(names);
31
- this.wrote = names.length > 0;
63
+ if (this.writes) {
64
+ this.writes = false;
65
+ this.wroteTo = this.source.hide(namesIn(this.hiddenSeries), this.names()) ?? this.wroteTo;
32
66
  }
33
67
  }
34
68
  disconnectedCallback() {
35
- if (this.wrote) {
36
- this.source.hide([]);
37
- this.wrote = false;
69
+ if (this.wroteTo !== null) {
70
+ this.source.hide([], this.names());
71
+ this.wroteTo = null;
38
72
  }
39
73
  super.disconnectedCallback();
40
74
  }
@@ -58,28 +92,45 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
58
92
  }
59
93
  render() {
60
94
  const named = this.label || this.source.element?.querySelector('caption')?.textContent?.trim();
61
- return html `<ul aria-label=${named || nothing} part="list" role="list">
62
- ${this.names().map((name, index) => {
95
+ const names = this.names();
96
+ const stop = Math.min(this.stop, names.length - 1);
97
+ const toolbar = this.toggles;
98
+ return html `<ul
99
+ aria-label=${named || nothing}
100
+ part="list"
101
+ role=${toolbar ? 'toolbar' : 'list'}
102
+ >
103
+ ${names.map((name, index) => {
63
104
  const off = isHidden(this.hiddenSeries, name);
64
105
  return html `<li
65
106
  data-series=${seriesIndex(index)}
66
107
  part="entry${off ? ' entry-hidden' : ''}"
67
108
  style="--chart-series: var(--chart-series-${seriesIndex(index)})"
68
- role="listitem"
109
+ role=${toolbar ? 'none' : 'listitem'}
69
110
  >
70
- ${this.toggles ? this.renderToggle(name, off) : html `<span part="name">${name}</span>`}
111
+ ${this.renderSwatch(name, index)}${toolbar ? this.renderToggle(name, off, index, index === stop) : this.renderName(name, index)}
71
112
  </li>`;
72
113
  })}
73
114
  </ul>`;
74
115
  }
75
- renderToggle(name, off) {
116
+ renderSwatch(_name, _index) {
117
+ return nothing;
118
+ }
119
+ renderName(name, _index) {
120
+ return html `<span part="name">${name}</span>`;
121
+ }
122
+ renderToggle(name, off, index = 0, holds = true) {
76
123
  return html `<button
77
124
  aria-pressed=${off ? 'false' : 'true'}
78
125
  part="toggle"
126
+ tabindex=${holds ? '0' : '-1'}
79
127
  type="button"
80
128
  @click=${() => this.toggle(name)}
129
+ @focus=${() => {
130
+ this.stop = index;
131
+ }}
81
132
  >
82
- <span part="name">${name}</span>
133
+ ${this.renderName(name, index)}
83
134
  </button>`;
84
135
  }
85
136
  };
@@ -98,6 +149,9 @@ __decorate([
98
149
  __decorate([
99
150
  property({ reflect: true, type: Boolean })
100
151
  ], HelixHeadlessLegend.prototype, "toggles", void 0);
152
+ __decorate([
153
+ state()
154
+ ], HelixHeadlessLegend.prototype, "stop", void 0);
101
155
  HelixHeadlessLegend = __decorate([
102
156
  customElement('helix-headless-legend')
103
157
  ], HelixHeadlessLegend);
@@ -19,9 +19,22 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
19
19
  * focus stays in the dialog.
20
20
  *
21
21
  * Set `controls` for the viewer's own previous, next and close controls, named
22
- * by `previous-label`, `next-label` and `dismiss-label`. Without it, compose the
23
- * chrome yourself in the `header` and `footer` slots, with buttons that send
24
- * `--previous`, `--next` and `--close`.
22
+ * by `previous-label`, `next-label` and `dismiss-label`, whose glyphs you can
23
+ * replace in the `previous-icon`, `next-icon` and `dismiss-icon` slots. Without
24
+ * it, compose the chrome yourself in the `header` and `footer` slots, with
25
+ * buttons that send `--previous`, `--next` and `--close`.
26
+ *
27
+ * **Set `max-zoom` to let a reader zoom into the shown item**, such as `3`.
28
+ * Two fingers pinch it, a double click or a double tap zooms all the way in
29
+ * about the point pressed and back out, and once zoomed one pointer drags it
30
+ * about. `+` and `-` zoom in and out from the keyboard, and `0` puts it back.
31
+ * The scale and the offset are on the `viewport` part as `--lightbox-zoom`,
32
+ * `--lightbox-pan-x` and `--lightbox-pan-y`, written only while zoomed, and a
33
+ * swipe moves to the next item only while the item is at its own size. With
34
+ * `controls`, the viewer also draws zoom-out and zoom-in controls, for a
35
+ * pointer with no wheel and no second finger. Once a reader stops zooming, the
36
+ * live region says the new scale in the words of `zoom-status-label`, such as
37
+ * "Zoomed to 150%".
25
38
  *
26
39
  * Each item is a slide: a `group` with the role description in
27
40
  * `slide-role-label`, named by its `label` or by `slide-label`. A touch or a pen
@@ -41,8 +54,13 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
41
54
  * @documentation https://fusion.dev/helix/components/lightbox
42
55
  *
43
56
  * @slot - The items, which are `<helix-headless-lightbox-item>` elements.
57
+ * @slot dismiss-icon - Replaces the glyph inside the close control.
44
58
  * @slot footer - Content below the item, such as a counter or a thumbnail strip.
45
59
  * @slot header - Content above the item, such as a title and a close button.
60
+ * @slot next-icon - Replaces the glyph inside the next control.
61
+ * @slot previous-icon - Replaces the glyph inside the previous control.
62
+ * @slot zoom-in-icon - Replaces the glyph inside the zoom-in control.
63
+ * @slot zoom-out-icon - Replaces the glyph inside the zoom-out control.
46
64
  *
47
65
  * @event {Event} close - Fired when the viewer closes. The component dispatches it again from the host, because the dialog's own event does not leave the shadow root.
48
66
  * @event {HelixActivateEvent} helix-activate - Fired after the shown item changes, when the element already holds the new item.
@@ -51,30 +69,52 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
51
69
  * @event {HelixBeforeOpenEvent} helix-before-open - Fired before the viewer opens. Cancelable.
52
70
  * @event {ToggleEvent} toggle - Fired when the viewer opens or closes, with `newState` and `oldState`.
53
71
  *
72
+ * @csspart counter - The place of the shown item in the set, drawn with `counter`.
54
73
  * @csspart dialog - The native dialog element.
55
74
  * @csspart dismiss - The close control, drawn with `controls`.
56
- * @csspart dismiss-mark - The glyph on the close control.
57
- * @csspart live - The live region that announces which item is shown.
75
+ * @csspart dismiss-mark - The glyph on the close control, where none is slotted.
76
+ * @csspart footer - The slot the footer is in. It draws no box until you give it one.
77
+ * @csspart header - The slot the header is in. It draws no box until you give it one.
78
+ * @csspart live - The live region that announces which item is shown, and the scale once a reader has zoomed.
58
79
  * @csspart next - The control that shows the next item, drawn with `controls`.
59
- * @csspart next-mark - The glyph on the next control.
80
+ * @csspart next-mark - The glyph on the next control, where none is slotted.
60
81
  * @csspart previous - The control that shows the previous item, drawn with `controls`.
61
- * @csspart previous-mark - The glyph on the previous control.
82
+ * @csspart previous-mark - The glyph on the previous control, where none is slotted.
62
83
  * @csspart viewport - The box the current item is shown in.
84
+ * @csspart zoom-in - The control that zooms in by half again, drawn with `controls` where `max-zoom` allows zooming.
85
+ * @csspart zoom-in-mark - The glyph on the zoom-in control, where none is slotted.
86
+ * @csspart zoom-out - The control that zooms back out, drawn with `controls` where `max-zoom` allows zooming.
87
+ * @csspart zoom-out-mark - The glyph on the zoom-out control, where none is slotted.
88
+ *
89
+ * @cssproperty --lightbox-pan-x - How far the zoomed item is moved across from the middle of the viewport, in pixels, toward the right. Written only while zoomed.
90
+ * @cssproperty --lightbox-pan-y - How far the zoomed item is moved down from the middle of the viewport, in pixels. Written only while zoomed.
91
+ * @cssproperty --lightbox-zoom - The scale the shown item is zoomed to, such as `2`. Written only while zoomed.
63
92
  *
64
93
  * @cssstate fullscreen - While the viewer fills the screen.
65
94
  * @cssstate idle - The user has been still long enough for the controls to hide.
66
95
  * @cssstate open - While the viewer is open.
96
+ * @cssstate zoomable - While `max-zoom` lets a reader zoom.
97
+ * @cssstate zoomed - While the shown item is zoomed past its own size.
67
98
  */
68
99
  export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
69
100
  /**
70
- * Draws the viewer's own previous, next and close controls over the picture.
101
+ * Draws the viewer's own previous, next and close controls over the picture,
102
+ * and zoom-out and zoom-in controls where `max-zoom` allows zooming.
71
103
  *
72
104
  * Off by default, for a viewer whose chrome you compose in the `header` and
73
105
  * `footer` slots. The controls hide with the rest of the chrome while the
74
- * reader is idle, and the previous and next ones say they are unavailable at
75
- * either end of a set that does not `loop`.
106
+ * reader is idle, the previous and next ones say they are unavailable at
107
+ * either end of a set that does not `loop`, and the zoom ones at either end
108
+ * of the scale.
76
109
  */
77
110
  controls: boolean;
111
+ /**
112
+ * Draws the place of the shown item in the set over the picture, in the
113
+ * words of `status-label`, such as "2 of 5". It hides with the controls while
114
+ * the reader is idle. Screen readers hear the place from the live region, so
115
+ * the drawn copy is hidden from them.
116
+ */
117
+ counter: boolean;
78
118
  /**
79
119
  * The close control's accessible name. Translate it with the rest of your
80
120
  * interface.
@@ -97,6 +137,11 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
97
137
  * Whether moving past the last item returns to the first.
98
138
  */
99
139
  loop: boolean;
140
+ /**
141
+ * How far a reader can zoom into the shown item, as a scale, such as `3`.
142
+ * `1`, the default, turns zooming off.
143
+ */
144
+ maxZoom: number;
100
145
  /**
101
146
  * The next control's accessible name.
102
147
  */
@@ -125,13 +170,41 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
125
170
  * counter in the chrome can empty this and say it themselves.
126
171
  */
127
172
  statusLabel: string;
173
+ /**
174
+ * The zoom-in control's accessible name.
175
+ */
176
+ zoomInLabel: string;
177
+ /**
178
+ * The zoom-out control's accessible name.
179
+ */
180
+ zoomOutLabel: string;
181
+ /**
182
+ * What the live region says once a reader has stopped zooming, with the
183
+ * scale as a whole `{percent}` filled in. Empty it to say nothing.
184
+ */
185
+ zoomStatusLabel: string;
128
186
  /** Whether the reader has been still long enough to hide the chrome. */
129
187
  private resting;
130
188
  /** Whether the viewer is filling the screen. */
131
189
  private filled;
132
190
  /** What the live region is currently saying. */
133
191
  private announcement;
192
+ /** The scale the shown item is drawn at, which the zoom controls read. */
193
+ private zoomScale;
194
+ private readonly zoomSaid;
195
+ /** Whether the zoom is being put back because the item changed, which says nothing. */
196
+ private quietZoom;
134
197
  protected readonly swipes: SwipeController;
198
+ private readonly zoomer;
199
+ /** Writes the zoom on the viewport, and nothing at the item's own size. */
200
+ private drawZoom;
201
+ /** Says the new scale in the live region, a moment after the last change. */
202
+ private sayZoom;
203
+ /**
204
+ * Zooms the shown item to `scale`, held between `1` and `max-zoom`, about
205
+ * the middle of the viewport.
206
+ */
207
+ zoomTo(scale: number): void;
135
208
  private readonly fullscreen;
136
209
  private readonly idle;
137
210
  /**
@@ -202,6 +275,12 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
202
275
  * a reader having no way to know which one this component thinks it is.
203
276
  */
204
277
  private readonly handleKeydown;
278
+ /** `+` and `-` zoom in and out by half again, and `0` puts the item back. Returns whether it was one. */
279
+ private zoomKey;
280
+ /** Zooms in by half again, as `+` and the zoom-in control do. */
281
+ private zoomIn;
282
+ /** Zooms out by as much, as `-` and the zoom-out control do. */
283
+ private zoomOut;
205
284
  /** Home and End, which are an index rather than a step. */
206
285
  private toEnd;
207
286
  /** The item on screen: the one `active` names, or the first where it names none. */
@@ -236,6 +315,8 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
236
315
  * every page load.
237
316
  */
238
317
  private say;
318
+ /** The shown item's place in the set, in the words of `status-label`. */
319
+ private place;
239
320
  protected render(): TemplateResult;
240
321
  /**
241
322
  * The viewer's own controls, behind a seam a tier above can move.
@@ -245,6 +326,13 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
245
326
  * control that has just shown the last picture keeps focus.
246
327
  */
247
328
  protected renderControls(): TemplateResult;
329
+ /**
330
+ * Zoom out and zoom in, for a pointer with no wheel and no second finger.
331
+ *
332
+ * Out before in, so they read as a scale runs. `aria-disabled` at either
333
+ * limit, as the previous and next controls are at the ends.
334
+ */
335
+ protected renderZoomControls(): TemplateResult;
248
336
  }
249
337
  declare global {
250
338
  interface HTMLElementTagNameMap {