@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
@@ -4,7 +4,7 @@ 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 { byRow, CHART_PLOT, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, unbroken, } from '@fusion.dev/helix-core';
7
+ import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing, svg } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import '../../tooltip/index.js';
@@ -12,6 +12,8 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  this.area = false;
15
+ this.dashed = '';
16
+ this.markers = false;
15
17
  this.zero = false;
16
18
  }
17
19
  get rulesValue() {
@@ -62,7 +64,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
62
64
  const columns = this.plottedColumns;
63
65
  const latest = series.flatMap((one, depth) => {
64
66
  const last = one.points.at(-1);
65
- if (last === undefined) {
67
+ if (last === undefined || !this.showsSeries(one.name)) {
66
68
  return [];
67
69
  }
68
70
  const text = rows[last.at]?.cells[columns[depth] ?? -1]?.text ?? String(last.value);
@@ -109,6 +111,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
109
111
  ${series.map((one, depth) => this.renderSeries(one, depth, x, y))}
110
112
  </svg>
111
113
  ${this.renderTermini(ends)}
114
+ ${this.renderMarkers(series, x, y)}
112
115
  ${this.renderTooltip()}
113
116
  </div>`;
114
117
  }
@@ -149,6 +152,25 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
149
152
  style=${`--chart-series: var(--chart-series-${end.index}); --chart-terminus-x: ${end.x}%; --chart-terminus-y: ${end.y}%`}
150
153
  ></span>`)}`;
151
154
  }
155
+ renderMarkers(series, x, y) {
156
+ const marks = series.flatMap((one, depth) => this.showsSeries(one.name)
157
+ ? unbroken(one).flatMap((run) => run.length > 1 && !this.markers
158
+ ? []
159
+ : run.map((point) => ({ depth, lone: run.length === 1, point })))
160
+ : []);
161
+ if (marks.length === 0) {
162
+ return nothing;
163
+ }
164
+ return html `${marks.map(({ depth, lone, point }) => html `<span
165
+ aria-hidden="true"
166
+ part="marker${lone ? ' marker-lone' : ''}"
167
+ style=${`--chart-series: var(--chart-series-${seriesIndex(depth)}); inset-inline-start: ${(x(point.at) / PLOT_WIDTH) * 100}%; inset-block-start: ${(y(point.value) / PLOT_HEIGHT) * 100}%`}
168
+ ></span>`)}`;
169
+ }
170
+ dashes(name) {
171
+ const key = seriesKey(name);
172
+ return this.dashed !== '' && commaList(this.dashed).some((one) => seriesKey(one) === key);
173
+ }
152
174
  renderSeries(one, depth, x, y) {
153
175
  if (!this.showsSeries(one.name)) {
154
176
  return html `${nothing}`;
@@ -182,7 +204,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
182
204
  d=${path}
183
205
  data-series=${index}
184
206
  fill="none"
185
- part="line"
207
+ part="line${this.dashes(one.name) ? ' line-dashed' : ''}"
186
208
  style="--chart-series: var(--chart-series-${index})"
187
209
  />`;
188
210
  }
@@ -218,9 +240,15 @@ __decorate([
218
240
  __decorate([
219
241
  property({ reflect: true })
220
242
  ], HelixHeadlessLineChart.prototype, "curve", void 0);
243
+ __decorate([
244
+ property()
245
+ ], HelixHeadlessLineChart.prototype, "dashed", void 0);
221
246
  __decorate([
222
247
  property()
223
248
  ], HelixHeadlessLineChart.prototype, "gridlines", void 0);
249
+ __decorate([
250
+ property({ reflect: true, type: Boolean })
251
+ ], HelixHeadlessLineChart.prototype, "markers", void 0);
224
252
  __decorate([
225
253
  property({ reflect: true })
226
254
  ], HelixHeadlessLineChart.prototype, "terminus", void 0);
@@ -109,6 +109,8 @@ export declare class HelixHeadlessListItem extends HelixElement {
109
109
  value: string;
110
110
  /** The row's words, or none where the children are not known yet. */
111
111
  get words(): string;
112
+ /** Whether something is slotted into `description`, or false where the children are not known yet. */
113
+ private get described();
112
114
  /** Whether a list with `selection-mode` holds this row, which makes it a row of a grid. */
113
115
  private get grouped();
114
116
  /** @internal The cell a list with `selection-mode` moves focus to. */
@@ -20,6 +20,9 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
20
20
  get words() {
21
21
  return this.childrenKnown ? slottedWords(this, ['']) : '';
22
22
  }
23
+ get described() {
24
+ return this.childrenKnown && this.knownChildren.some((child) => child.slot === 'description');
25
+ }
23
26
  get grouped() {
24
27
  return this.focusable !== undefined;
25
28
  }
@@ -54,20 +57,26 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
54
57
  }
55
58
  render() {
56
59
  const content = html `${this.renderRail()}<slot name="start"></slot>
57
- <slot></slot>
58
- <slot name="description"></slot>`;
60
+ <slot id="label"></slot>
61
+ <slot name="description" id="description"></slot>`;
59
62
  const role = this.grouped ? 'gridcell' : nothing;
60
63
  const tabindex = this.grouped ? (this.focusable ? '0' : '-1') : nothing;
64
+ const labelledby = this.grouped && this.words !== '' ? 'label' : nothing;
65
+ const describedby = this.grouped && this.described ? 'description' : nothing;
61
66
  return this.href === ''
62
67
  ? html `<div
63
68
  part="row${this.current === undefined ? '' : ' row-current'}"
64
69
  role=${role}
65
70
  tabindex=${tabindex}
71
+ aria-labelledby=${labelledby}
72
+ aria-describedby=${describedby}
66
73
  >${content}<slot name="end"></slot></div>`
67
74
  : html `<div
68
75
  part="row${this.current === undefined ? '' : ' row-current'}"
69
76
  role=${role}
70
77
  tabindex=${tabindex}
78
+ aria-labelledby=${labelledby}
79
+ aria-describedby=${describedby}
71
80
  ><a
72
81
  part="link"
73
82
  href=${this.href}
@@ -1,7 +1,7 @@
1
1
  import { HelixElement, KeyboardNavigationController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import { HelixHeadlessListItem } from '../item/list-item.js';
4
- import { type ListSelectionMode } from '../selection.js';
4
+ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection.js';
5
5
  /**
6
6
  * @summary A set of rows, announced as a list.
7
7
  *
@@ -10,15 +10,35 @@ import { type ListSelectionMode } from '../selection.js';
10
10
  * announces each one's position, such as "1 of 7".
11
11
  *
12
12
  * **`selection-mode` makes the list interactive**, in the way of a grid list:
13
- * a grid of rows that is one tab stop. Up and Down move between rows, Home
14
- * and End go to the first and the last, and a typed letter goes to the next
15
- * row starting with it. Left and Right move between the row and the controls
16
- * in its `end` slot. `single` selects one row at a time and `multiple` any
17
- * number, with Space or a press, and `value` holds the selected rows' values,
13
+ * a grid of rows that is one tab stop. `single` selects one row at a time and
14
+ * `multiple` any number, and `value` holds the selected rows' values,
18
15
  * separated by commas. A change asks with `helix-before-change` and tells
19
- * with `change`. Enter acts on the row: it follows the row's link, or sends
20
- * `helix-action` from the row. `none` selects nothing, so a press acts too. A
21
- * `disabled` row is passed over.
16
+ * with `change`. `none` selects nothing, so a press acts on the row. A
17
+ * `disabled` row is passed over. Each row is named by its label and described
18
+ * by its description, so the words of the controls in `end` are not read as
19
+ * part of its name.
20
+ *
21
+ * `selection-behavior` says what a press does to the rows already selected.
22
+ * `toggle`, the default, adds or takes out the row. `replace` selects the row
23
+ * alone, as a file list does, and the arrow keys carry the selection with
24
+ * them. Control or Command with a press then adds or takes out one row.
25
+ *
26
+ * | Key | What it does |
27
+ * |---|---|
28
+ * | Down, Up | Moves to the next or the previous row. Under `replace`, selects it. |
29
+ * | Home, End | Moves to the first or the last row. Under `replace`, selects it. |
30
+ * | Page Down, Page Up | Moves a box's height of rows, so the row at one edge lands at the other. Under `replace`, selects the row it lands on. |
31
+ * | A letter or a word | Moves to the next row whose words start with what you typed. |
32
+ * | Left, Right | Moves between the row and the controls in its `end` slot. |
33
+ * | Space | Selects the row, or lets it go. |
34
+ * | Shift with Down, Up, Home, End, Page Down, Page Up or Space | Selects every row from the last one pressed, in `multiple`. |
35
+ * | Control or Command with Down, Up, Home, End, Page Down or Page Up | Moves without selecting, under `replace`. |
36
+ * | Control or Command with A | Selects every row, in `multiple`. |
37
+ * | Escape | Lets go of every selected row, asking first, and keeps the key from the dialog or menu around the list. With nothing selected, the key goes on to them. |
38
+ * | Enter | Acts on the row: follows its link, or sends `helix-action` from it. |
39
+ *
40
+ * A press with Shift selects every row from the last one pressed, and a press
41
+ * with Control or Command adds or takes out one row under `replace`.
22
42
  *
23
43
  * **Leave `selection-mode` unset for a list a reader reads**, and set it for
24
44
  * one a reader chooses from or acts on. The rows of an interactive list are
@@ -80,6 +100,12 @@ export declare class HelixHeadlessList extends HelixElement {
80
100
  * its last row, as `<ol reversed>` does.
81
101
  */
82
102
  reversed: boolean;
103
+ /**
104
+ * What a press does to the rows already selected, in a list that selects:
105
+ * `toggle` adds or takes out the row, and `replace` selects it alone and
106
+ * lets the arrow keys carry the selection.
107
+ */
108
+ selectionBehavior: ListSelectionBehavior;
83
109
  /**
84
110
  * Makes the list interactive: `single` selects one row, `multiple` any
85
111
  * number, and `none` moves and acts without selecting. Unset is a list a
@@ -112,6 +138,13 @@ export declare class HelixHeadlessList extends HelixElement {
112
138
  value: string;
113
139
  /** The row the reader was last on, which keeps the tab stop. */
114
140
  private last;
141
+ /** The value of the row a Shift range runs from: the last row pressed. */
142
+ private anchor;
143
+ /**
144
+ * Shift and Control or Command on the key that is moving focus, read when
145
+ * focus arrives on a row and cleared once the key has been answered.
146
+ */
147
+ private moving;
115
148
  /**
116
149
  * Up, Down, Home, End and typed letters, moving focus and choosing nothing,
117
150
  * from the focused row and without wrapping. Left and Right are the row's.
@@ -136,15 +169,39 @@ export declare class HelixHeadlessList extends HelixElement {
136
169
  /** The row a press or a key came from, read off the event's path. */
137
170
  private rowOf;
138
171
  /**
139
- * Selects the row, or lets it go, asking first. `helix-before-change`
140
- * carries the `value` the press would leave, and `change` follows once it
141
- * has moved.
172
+ * Selects what a press or a key leaves, asking first. `helix-before-change`
173
+ * carries the `value` it would leave, and `change` follows once it has moved.
142
174
  */
143
- protected press(row: HelixHeadlessListItem): void;
175
+ private choose;
176
+ /** What `choiceValue` needs of this list for a row. */
177
+ private choice;
178
+ /**
179
+ * Selects the row, or lets it go, by `selection-behavior`: Shift takes in
180
+ * the rows from the last one pressed, and Control or Command toggles one row
181
+ * under `replace`. The row is where the next range runs from.
182
+ */
183
+ protected press(row: HelixHeadlessListItem, extend?: boolean, toggle?: boolean): void;
184
+ /**
185
+ * A key moved focus onto the row: under `replace` it is selected alone, and
186
+ * with Shift the rows from the anchor are taken in, from `from` where
187
+ * nothing was pressed yet.
188
+ */
189
+ private arrive;
190
+ /**
191
+ * Page Down or Page Up from the row: focus moves a box's height of rows, the
192
+ * list's own where it scrolls and the window's where it does not, and lands
193
+ * the way an arrow does, so `replace` and Shift choose as they do there.
194
+ */
195
+ private page;
144
196
  /** Acts on the row: follows its link, or says it was acted on. */
145
197
  protected act(row: HelixHeadlessListItem): void;
146
198
  /** Left and Right inside a row: the cell, then each control in `end`, and back. */
147
199
  private moveInRow;
200
+ /**
201
+ * Notes the modifiers of a key before the keyboard controller moves focus
202
+ * with it, which happens first, in the same dispatch.
203
+ */
204
+ private readonly handleKeyCapture;
148
205
  private readonly handleKeydown;
149
206
  private readonly handleClick;
150
207
  private readonly handleFocusin;
@@ -4,46 +4,66 @@ 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, HelixActionEvent, HelixBeforeChangeEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, requestChange, rovingStop, whenHydrated, } from '@fusion.dev/helix-core';
7
+ import { commaList, customElement, HelixActionEvent, HelixBeforeChangeEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, requestChange, rovingStop, selectsAll, typeaheadByWords, whenHydrated, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { HelixHeadlessListItem } from '../item/list-item.js';
11
11
  import { numbering } from '../numbering.js';
12
- import { pressedValue, rowStop } from '../selection.js';
12
+ import { choiceValue, pageReach, rowStop, } from '../selection.js';
13
13
  const PRESSABLE = 'a[href], button, input, label, select, textarea, [tabindex]';
14
14
  let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  this.label = '';
18
18
  this.reversed = false;
19
+ this.selectionBehavior = 'toggle';
19
20
  this.value = '';
20
21
  this.keys = new KeyboardNavigationController(this, {
21
22
  items: () => this.reachable.map((row) => this.navigable(row)),
22
23
  origin: 'focus',
23
24
  reserved: () => ['ArrowLeft', 'ArrowRight'],
24
25
  selects: () => false,
25
- typeahead: (item) => item.words,
26
+ typeahead: typeaheadByWords(),
26
27
  wrap: false,
27
28
  });
29
+ this.handleKeyCapture = (event) => {
30
+ this.moving = { extend: event.shiftKey, toggle: event.ctrlKey || event.metaKey };
31
+ };
28
32
  this.handleKeydown = (event) => {
29
33
  const row = this.interactive ? this.rowOf(event) : undefined;
30
- if (!row || row.disabled || event.altKey || event.ctrlKey || event.metaKey) {
34
+ if (row && !row.disabled && !event.altKey && /^Page(Down|Up)$/.test(event.key)) {
35
+ event.preventDefault();
36
+ this.page(row, event.key === 'PageDown' ? 1 : -1);
37
+ }
38
+ this.moving = undefined;
39
+ if (!row || row.disabled || event.altKey) {
31
40
  return;
32
41
  }
33
- if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
42
+ const toggle = event.ctrlKey || event.metaKey;
43
+ if (!toggle && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
34
44
  this.moveInRow(row, event);
35
45
  return;
36
46
  }
37
47
  if (event.composedPath()[0] !== row.cell) {
38
48
  return;
39
49
  }
40
- if (event.key === 'Enter') {
50
+ if (selectsAll(event) && this.selectionMode === 'multiple') {
51
+ event.preventDefault();
52
+ const every = this.reachable.map((one) => this.valueFor(one)).join(', ');
53
+ this.choose(every === this.value ? null : every);
54
+ }
55
+ else if (event.key === 'Escape' && this.value !== '' && this.selectionMode !== 'none') {
56
+ event.preventDefault();
57
+ event.stopPropagation();
58
+ this.choose('');
59
+ }
60
+ else if (event.key === 'Enter' && !toggle) {
41
61
  event.preventDefault();
42
62
  this.act(row);
43
63
  }
44
- else if (event.key === ' ') {
64
+ else if (event.key === ' ' && !event.defaultPrevented) {
45
65
  event.preventDefault();
46
- this.press(row);
66
+ this.press(row, event.shiftKey, toggle);
47
67
  }
48
68
  };
49
69
  this.handleClick = (event) => {
@@ -62,13 +82,17 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
62
82
  this.act(row);
63
83
  }
64
84
  else {
65
- this.press(row);
85
+ this.press(row, event.shiftKey, event.ctrlKey || event.metaKey);
66
86
  }
67
87
  };
68
88
  this.handleFocusin = (event) => {
69
89
  const row = this.interactive ? this.rowOf(event) : undefined;
70
90
  if (row && row !== this.last) {
91
+ const from = this.last;
71
92
  this.last = row;
93
+ if (event.composedPath()[0] === row.cell) {
94
+ this.arrive(row, from);
95
+ }
72
96
  this.sync();
73
97
  }
74
98
  };
@@ -121,9 +145,8 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
121
145
  .composedPath()
122
146
  .find((node) => node instanceof HelixHeadlessListItem && node.parentElement === this);
123
147
  }
124
- press(row) {
125
- const mode = this.selectionMode;
126
- if (mode === undefined || mode === 'none' || row.disabled) {
148
+ choose(next) {
149
+ if (next === null) {
127
150
  return;
128
151
  }
129
152
  requestChange({
@@ -133,9 +156,59 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
133
156
  },
134
157
  event: (value) => new HelixBeforeChangeEvent({ value }),
135
158
  host: this,
136
- next: pressedValue(mode, this.value, this.valueFor(row)),
159
+ next,
137
160
  });
138
161
  }
162
+ choice(row, extend, toggle, arrived) {
163
+ return {
164
+ anchor: this.anchor,
165
+ arrived,
166
+ behavior: this.selectionBehavior,
167
+ extend,
168
+ mode: this.selectionMode ?? 'none',
169
+ pressed: this.valueFor(row),
170
+ shown: this.reachable.map((one) => this.valueFor(one)),
171
+ toggle,
172
+ value: this.value,
173
+ };
174
+ }
175
+ press(row, extend = false, toggle = false) {
176
+ const mode = this.selectionMode;
177
+ if (mode === undefined || mode === 'none' || row.disabled) {
178
+ return;
179
+ }
180
+ const next = choiceValue(this.choice(row, extend, toggle, false));
181
+ if (!extend) {
182
+ this.anchor = this.valueFor(row);
183
+ }
184
+ this.choose(next);
185
+ }
186
+ arrive(row, from) {
187
+ const moving = this.moving;
188
+ if (!moving || this.selectionMode === undefined || this.selectionMode === 'none') {
189
+ return;
190
+ }
191
+ if (moving.extend && this.anchor === undefined && from) {
192
+ this.anchor = this.valueFor(from);
193
+ }
194
+ const next = choiceValue(this.choice(row, moving.extend, moving.toggle, true));
195
+ if (!moving.extend && next !== null) {
196
+ this.anchor = this.valueFor(row);
197
+ }
198
+ this.choose(next);
199
+ }
200
+ page(row, step) {
201
+ const rows = this.reachable;
202
+ const edges = rows.map((one) => {
203
+ const box = one.getBoundingClientRect();
204
+ return { bottom: box.bottom, top: box.top };
205
+ });
206
+ const room = this.scrollHeight > this.clientHeight + 1 ? this.clientHeight : window.innerHeight;
207
+ const target = rows[pageReach(edges, rows.indexOf(row), room, step)];
208
+ if (target && target !== row) {
209
+ target.focusItem();
210
+ }
211
+ }
139
212
  act(row) {
140
213
  if (row.disabled) {
141
214
  return;
@@ -160,12 +233,14 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
160
233
  }
161
234
  connectedCallback() {
162
235
  super.connectedCallback();
236
+ this.addEventListener('keydown', this.handleKeyCapture, true);
163
237
  this.addEventListener('keydown', this.handleKeydown);
164
238
  this.addEventListener('click', this.handleClick);
165
239
  this.addEventListener('focusin', this.handleFocusin);
166
240
  }
167
241
  disconnectedCallback() {
168
242
  super.disconnectedCallback();
243
+ this.removeEventListener('keydown', this.handleKeyCapture, true);
169
244
  this.removeEventListener('keydown', this.handleKeydown);
170
245
  this.removeEventListener('click', this.handleClick);
171
246
  this.removeEventListener('focusin', this.handleFocusin);
@@ -202,6 +277,9 @@ __decorate([
202
277
  __decorate([
203
278
  property({ type: Boolean })
204
279
  ], HelixHeadlessList.prototype, "reversed", void 0);
280
+ __decorate([
281
+ property({ attribute: 'selection-behavior' })
282
+ ], HelixHeadlessList.prototype, "selectionBehavior", void 0);
205
283
  __decorate([
206
284
  property({ attribute: 'selection-mode' })
207
285
  ], HelixHeadlessList.prototype, "selectionMode", void 0);
@@ -1,13 +1,43 @@
1
- /** How many rows a reader can select in an interactive list. */
2
- export type ListSelectionMode = 'multiple' | 'none' | 'single';
1
+ import { type SelectionMode } from '@fusion.dev/helix-core';
2
+ /** How many rows a reader can select in an interactive list: core's `SelectionMode`. */
3
+ export type ListSelectionMode = SelectionMode;
3
4
  /**
4
- * The `value` a press on the row carrying `pressed` leaves.
5
+ * What a press does to the rows already selected: `toggle` adds or takes out
6
+ * the row, and `replace` selects it alone, as a file list does.
7
+ */
8
+ export type ListSelectionBehavior = 'replace' | 'toggle';
9
+ /** A press on a row, or a key arriving on one, and what the list held then. */
10
+ export interface ListChoice {
11
+ /** The list's `selection-mode`. */
12
+ mode: ListSelectionMode;
13
+ /** The list's `selection-behavior`. */
14
+ behavior: ListSelectionBehavior;
15
+ /** The list's `value`, before the press. */
16
+ value: string;
17
+ /** The value of the row pressed or arrived on. */
18
+ pressed: string;
19
+ /** The values of the rows a reader can reach, in order. */
20
+ shown: readonly string[];
21
+ /** The value of the row a range runs from, where there is one. */
22
+ anchor?: string | undefined;
23
+ /** Whether Shift was held, which takes in the rows from the anchor. */
24
+ extend?: boolean;
25
+ /** Whether Control or Command was held, which toggles under `replace` and moves without choosing. */
26
+ toggle?: boolean;
27
+ /** Whether a key moved focus onto the row, where a press is false. */
28
+ arrived?: boolean;
29
+ }
30
+ /**
31
+ * The `value` a press or an arrival leaves, or `null` where it changes nothing.
5
32
  *
6
- * `single` selects that row alone, or none where it was the one selected.
7
- * `multiple` adds it, or takes it out. `none` selects nothing and leaves the
8
- * value as it was. Tag Group answers the same question for its tags.
33
+ * - With Shift, in a list that selects many, every row from the anchor to this
34
+ * one is added, as Data Table and Listbox add a range.
35
+ * - Under `replace`, the row is selected alone, by a press or by a key moving
36
+ * onto it. Control or Command toggles it under a press, and moves without
37
+ * choosing under a key.
38
+ * - Under `toggle`, a press adds or takes out the row, and a key only moves.
9
39
  */
10
- export declare const pressedValue: (mode: ListSelectionMode, value: string, pressed: string) => string;
40
+ export declare const choiceValue: ({ anchor, arrived, behavior, extend, mode, pressed, shown, toggle, value, }: ListChoice) => string | null;
11
41
  /**
12
42
  * Where Left or Right goes inside a row: `at` is the row's place among its
13
43
  * `count` stops, the cell first and its controls after it, and `step` is the
@@ -17,3 +47,20 @@ export declare const pressedValue: (mode: ListSelectionMode, value: string, pres
17
47
  * and from the cell going back reaches the last control.
18
48
  */
19
49
  export declare const rowStop: (count: number, at: number, step: -1 | 1) => number;
50
+ /** Where a row sits along the list, in pixels, as the page keys measure it. */
51
+ export interface RowEdges {
52
+ /** The row's top edge. */
53
+ top: number;
54
+ /** The row's bottom edge. */
55
+ bottom: number;
56
+ }
57
+ /**
58
+ * Where Page Down (`step` 1) or Page Up (`step` -1) goes from row `at`: the
59
+ * farthest row that fits whole in `room` pixels together with row `at`, so the
60
+ * row at one edge of the box lands at the other, and at least the next row.
61
+ *
62
+ * Measured rather than counted, because a list's rows differ in height. Rows of
63
+ * one height `h` move `floor(room / h) - 1` rows, which is what Data Table and
64
+ * Virtual List move. At either end it stays on row `at`.
65
+ */
66
+ export declare const pageReach: (rows: readonly RowEdges[], at: number, room: number, step: -1 | 1) => number;
@@ -1,13 +1,22 @@
1
- import { commaList, toggleValue } from '@fusion.dev/helix-core';
2
- export const pressedValue = (mode, value, pressed) => {
1
+ import { commaList, pressedValue, rangeAdd } from '@fusion.dev/helix-core';
2
+ export const choiceValue = ({ anchor, arrived = false, behavior, extend = false, mode, pressed, shown, toggle = false, value, }) => {
3
+ if (mode === 'none') {
4
+ return null;
5
+ }
3
6
  const now = commaList(value);
4
- if (mode === 'single') {
5
- return now.includes(pressed) ? '' : pressed;
7
+ if (extend && mode === 'multiple') {
8
+ const from = anchor === undefined ? -1 : shown.indexOf(anchor);
9
+ const range = rangeAdd(now, shown, from, shown.indexOf(pressed));
10
+ return range ? range.join(', ') : null;
11
+ }
12
+ if (behavior === 'replace' && !toggle) {
13
+ return now.length === 1 && now[0] === pressed ? null : pressed;
6
14
  }
7
- if (mode === 'multiple') {
8
- return toggleValue(now, pressed).join(', ');
15
+ if (arrived) {
16
+ return null;
9
17
  }
10
- return value;
18
+ const next = pressedValue(mode, value, pressed);
19
+ return next === value ? null : next;
11
20
  };
12
21
  export const rowStop = (count, at, step) => {
13
22
  if (count <= 1) {
@@ -19,3 +28,19 @@ export const rowStop = (count, at, step) => {
19
28
  }
20
29
  return next < 0 ? count - 1 : next;
21
30
  };
31
+ export const pageReach = (rows, at, room, step) => {
32
+ const from = rows[at];
33
+ if (!from) {
34
+ return at;
35
+ }
36
+ let reach = at;
37
+ for (let next = at + step; next >= 0 && next < rows.length; next += step) {
38
+ const row = rows[next];
39
+ const span = step === 1 ? row.bottom - from.top : from.bottom - row.top;
40
+ if (span > room && next !== at + step) {
41
+ break;
42
+ }
43
+ reach = next;
44
+ }
45
+ return reach;
46
+ };