@fusion.dev/helix-headless 0.144.0 → 0.146.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 (319) hide show
  1. package/custom-elements.json +15195 -4240
  2. package/dist/accordion/item/accordion-item.d.ts +62 -12
  3. package/dist/accordion/item/accordion-item.js +41 -10
  4. package/dist/accordion/root/accordion-root.d.ts +14 -5
  5. package/dist/accordion/root/accordion-root.js +7 -1
  6. package/dist/announcement/root/announcement-root.d.ts +24 -3
  7. package/dist/announcement/root/announcement-root.js +39 -2
  8. package/dist/app-header/root/app-header-root.d.ts +12 -0
  9. package/dist/app-header/root/app-header-root.js +13 -1
  10. package/dist/app-header/sectioning.d.ts +9 -0
  11. package/dist/app-header/sectioning.js +27 -0
  12. package/dist/avatar/group/avatar-group.d.ts +20 -14
  13. package/dist/avatar/group/avatar-group.js +17 -19
  14. package/dist/badge/root/badge-root.d.ts +3 -1
  15. package/dist/badge/root/badge-root.js +2 -2
  16. package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
  17. package/dist/bar-chart/root/bar-chart-root.js +52 -15
  18. package/dist/bar-chart/stack.d.ts +15 -0
  19. package/dist/bar-chart/stack.js +19 -0
  20. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
  21. package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
  22. package/dist/button/root/button-root.d.ts +26 -0
  23. package/dist/button/root/button-root.js +38 -18
  24. package/dist/button-group/root/button-group-root.d.ts +2 -1
  25. package/dist/button-group/root/button-group-root.js +5 -1
  26. package/dist/canvas/node/canvas-node.d.ts +4 -3
  27. package/dist/canvas/node/canvas-node.js +3 -2
  28. package/dist/canvas/root/canvas-root.d.ts +38 -3
  29. package/dist/canvas/root/canvas-root.js +123 -42
  30. package/dist/card/root/card-root.d.ts +24 -3
  31. package/dist/card/root/card-root.js +20 -8
  32. package/dist/carousel/root/carousel-root.d.ts +133 -4
  33. package/dist/carousel/root/carousel-root.js +174 -24
  34. package/dist/carousel/stops.d.ts +20 -0
  35. package/dist/carousel/stops.js +30 -0
  36. package/dist/chat/composer/chat-composer.d.ts +38 -6
  37. package/dist/chat/composer/chat-composer.js +42 -9
  38. package/dist/chat/message/chat-message.d.ts +32 -1
  39. package/dist/chat/message/chat-message.js +27 -10
  40. package/dist/chat/naming.d.ts +26 -0
  41. package/dist/chat/naming.js +14 -0
  42. package/dist/chat/root/chat-root.d.ts +58 -0
  43. package/dist/chat/root/chat-root.js +43 -3
  44. package/dist/checkbox/root/checkbox-root.d.ts +20 -0
  45. package/dist/checkbox/root/checkbox-root.js +14 -1
  46. package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
  47. package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
  48. package/dist/checkbox-group/select-all.d.ts +27 -0
  49. package/dist/checkbox-group/select-all.js +12 -0
  50. package/dist/code-block/highlight.d.ts +15 -0
  51. package/dist/code-block/highlight.js +4 -0
  52. package/dist/code-block/root/code-block-root.d.ts +57 -2
  53. package/dist/code-block/root/code-block-root.js +63 -8
  54. package/dist/color-input/root/color-input-root.d.ts +3 -0
  55. package/dist/color-input/root/color-input-root.js +6 -3
  56. package/dist/color-picker/root/color-picker-root.d.ts +33 -4
  57. package/dist/color-picker/root/color-picker-root.js +80 -21
  58. package/dist/color-picker/swatches.d.ts +12 -0
  59. package/dist/color-picker/swatches.js +26 -0
  60. package/dist/combobox/root/combobox-root.d.ts +43 -0
  61. package/dist/combobox/root/combobox-root.js +79 -15
  62. package/dist/command/root/command-root.d.ts +16 -1
  63. package/dist/command/root/command-root.js +22 -4
  64. package/dist/copy-button/root/copy-button-root.d.ts +26 -1
  65. package/dist/copy-button/root/copy-button-root.js +12 -5
  66. package/dist/data-table/index.d.ts +1 -1
  67. package/dist/data-table/index.js +1 -1
  68. package/dist/data-table/keys.d.ts +24 -0
  69. package/dist/data-table/keys.js +24 -0
  70. package/dist/data-table/root/data-table-root.d.ts +170 -13
  71. package/dist/data-table/root/data-table-root.js +294 -52
  72. package/dist/data-table/tree.d.ts +55 -0
  73. package/dist/data-table/tree.js +54 -0
  74. package/dist/date-input/root/date-input-root.d.ts +3 -1
  75. package/dist/date-input/root/date-input-root.js +18 -7
  76. package/dist/date-picker/root/date-picker-root.js +12 -6
  77. package/dist/description-list/item/description-list-item.d.ts +17 -2
  78. package/dist/description-list/item/description-list-item.js +15 -2
  79. package/dist/description-list/root/description-list-root.d.ts +27 -1
  80. package/dist/description-list/root/description-list-root.js +26 -1
  81. package/dist/dialog/description.js +15 -1
  82. package/dist/dialog/root/dialog-root.d.ts +8 -2
  83. package/dist/dialog/root/dialog-root.js +16 -1
  84. package/dist/divider/root/divider-root.d.ts +3 -0
  85. package/dist/divider/root/divider-root.js +2 -1
  86. package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
  87. package/dist/donut-chart/root/donut-chart-root.js +48 -1
  88. package/dist/drawer/reveal.d.ts +8 -0
  89. package/dist/drawer/reveal.js +1 -0
  90. package/dist/drawer/root/drawer-root.d.ts +59 -0
  91. package/dist/drawer/root/drawer-root.js +63 -4
  92. package/dist/drilldown/item/drilldown-item.d.ts +11 -6
  93. package/dist/drilldown/item/drilldown-item.js +8 -5
  94. package/dist/drilldown/root/drilldown-root.d.ts +29 -0
  95. package/dist/drilldown/root/drilldown-root.js +28 -5
  96. package/dist/element-events.generated.js +83 -12
  97. package/dist/empty/root/empty-root.d.ts +3 -1
  98. package/dist/empty/root/empty-root.js +3 -2
  99. package/dist/file-input/root/file-input-root.d.ts +69 -6
  100. package/dist/file-input/root/file-input-root.js +82 -19
  101. package/dist/file-input/screen.d.ts +2 -1
  102. package/dist/filter-input/menu/filter-menu.d.ts +5 -0
  103. package/dist/filter-input/menu/filter-menu.js +16 -4
  104. package/dist/filter-input/root/filter-input-root.d.ts +30 -6
  105. package/dist/filter-input/root/filter-input-root.js +1 -1
  106. package/dist/filter-input/suggest.d.ts +28 -3
  107. package/dist/filter-input/suggest.js +18 -8
  108. package/dist/format-date/root/format-date-root.d.ts +9 -16
  109. package/dist/format-date/root/format-date-root.js +10 -27
  110. package/dist/heatmap/root/heatmap-root.d.ts +24 -13
  111. package/dist/heatmap/root/heatmap-root.js +34 -12
  112. package/dist/icon/root/icon-root.d.ts +12 -1
  113. package/dist/icon/root/icon-root.js +21 -10
  114. package/dist/icon/settle.d.ts +7 -0
  115. package/dist/icon/settle.js +10 -0
  116. package/dist/icon-button/root/icon-button-root.d.ts +2 -0
  117. package/dist/image/root/image-root.d.ts +5 -1
  118. package/dist/image/root/image-root.js +10 -2
  119. package/dist/input/root/input-root.d.ts +13 -3
  120. package/dist/input/root/input-root.js +12 -3
  121. package/dist/kbd/root/kbd-root.d.ts +35 -1
  122. package/dist/kbd/root/kbd-root.js +23 -4
  123. package/dist/legend/root/legend-root.d.ts +55 -8
  124. package/dist/legend/root/legend-root.js +55 -13
  125. package/dist/lightbox/root/lightbox-root.d.ts +49 -6
  126. package/dist/lightbox/root/lightbox-root.js +86 -19
  127. package/dist/lightbox/zoom-controller.d.ts +59 -0
  128. package/dist/lightbox/zoom-controller.js +128 -0
  129. package/dist/lightbox/zoom.d.ts +22 -0
  130. package/dist/lightbox/zoom.js +16 -0
  131. package/dist/line-chart/root/line-chart-root.d.ts +22 -1
  132. package/dist/line-chart/root/line-chart-root.js +21 -1
  133. package/dist/list/item/list-item.d.ts +70 -1
  134. package/dist/list/item/list-item.js +77 -6
  135. package/dist/list/numbering.d.ts +14 -0
  136. package/dist/list/numbering.js +8 -0
  137. package/dist/list/root/list-root.d.ts +155 -9
  138. package/dist/list/root/list-root.js +246 -4
  139. package/dist/list/selection.d.ts +49 -0
  140. package/dist/list/selection.js +30 -0
  141. package/dist/listbox/root/listbox-root.d.ts +37 -1
  142. package/dist/listbox/root/listbox-root.js +49 -4
  143. package/dist/loader/busy.d.ts +10 -0
  144. package/dist/loader/busy.js +11 -0
  145. package/dist/loader/root/loader-root.d.ts +9 -2
  146. package/dist/loader/root/loader-root.js +23 -3
  147. package/dist/map/root/map-root.d.ts +6 -2
  148. package/dist/map/root/map-root.js +5 -2
  149. package/dist/megamenu/root/megamenu-root.d.ts +62 -0
  150. package/dist/megamenu/root/megamenu-root.js +90 -5
  151. package/dist/menu/index.d.ts +1 -0
  152. package/dist/menu/index.js +1 -0
  153. package/dist/menu/item/menu-item.d.ts +87 -11
  154. package/dist/menu/item/menu-item.js +78 -22
  155. package/dist/menu/root/menu-root.d.ts +39 -1
  156. package/dist/menu/root/menu-root.js +65 -8
  157. package/dist/menu/section/menu-section.d.ts +55 -0
  158. package/dist/menu/section/menu-section.js +60 -0
  159. package/dist/meter/root/meter-root.d.ts +20 -1
  160. package/dist/meter/root/meter-root.js +11 -15
  161. package/dist/navigation/root/navigation-root.d.ts +18 -2
  162. package/dist/navigation/root/navigation-root.js +29 -3
  163. package/dist/notifications/root/notifications-root.d.ts +25 -0
  164. package/dist/notifications/root/notifications-root.js +33 -5
  165. package/dist/number-input/root/number-input-root.d.ts +17 -8
  166. package/dist/number-input/root/number-input-root.js +2 -7
  167. package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
  168. package/dist/object-inspector/root/object-inspector-root.js +264 -123
  169. package/dist/object-inspector/rows.d.ts +75 -0
  170. package/dist/object-inspector/rows.js +119 -0
  171. package/dist/option/root/option-root.d.ts +5 -3
  172. package/dist/outline/levels.d.ts +31 -0
  173. package/dist/outline/levels.js +23 -0
  174. package/dist/outline/root/outline-root.d.ts +86 -3
  175. package/dist/outline/root/outline-root.js +95 -12
  176. package/dist/pagination/size/pagination-size.d.ts +12 -2
  177. package/dist/pagination/size/pagination-size.js +20 -5
  178. package/dist/pin-input/code.d.ts +10 -0
  179. package/dist/pin-input/code.js +13 -0
  180. package/dist/pin-input/root/pin-input-root.d.ts +25 -1
  181. package/dist/pin-input/root/pin-input-root.js +10 -11
  182. package/dist/popover/hide-outside.d.ts +14 -0
  183. package/dist/popover/hide-outside.js +41 -0
  184. package/dist/popover/root/popover-root.d.ts +57 -7
  185. package/dist/popover/root/popover-root.js +58 -3
  186. package/dist/progress/root/progress-root.d.ts +20 -0
  187. package/dist/progress/root/progress-root.js +15 -15
  188. package/dist/qr-code/export.d.ts +26 -1
  189. package/dist/qr-code/export.js +14 -0
  190. package/dist/qr-code/root/qr-code-root.d.ts +19 -5
  191. package/dist/qr-code/root/qr-code-root.js +58 -9
  192. package/dist/quote/marks.d.ts +8 -0
  193. package/dist/quote/marks.js +5 -0
  194. package/dist/quote/root/quote-root.d.ts +14 -2
  195. package/dist/quote/root/quote-root.js +23 -1
  196. package/dist/radio/group/radio-group.d.ts +4 -10
  197. package/dist/radio/group/radio-group.js +5 -10
  198. package/dist/radio/root/radio-root.d.ts +6 -2
  199. package/dist/radio/root/radio-root.js +6 -1
  200. package/dist/rating/root/rating-root.d.ts +10 -5
  201. package/dist/rating/root/rating-root.js +32 -8
  202. package/dist/rating/steps.d.ts +7 -0
  203. package/dist/rating/steps.js +9 -0
  204. package/dist/scatter-chart/fit.d.ts +15 -0
  205. package/dist/scatter-chart/fit.js +35 -0
  206. package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
  207. package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
  208. package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
  209. package/dist/scroll-area/root/scroll-area-root.js +106 -7
  210. package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
  211. package/dist/scroll-area/scrollbar-controller.js +172 -0
  212. package/dist/scroll-area/scrollbar.d.ts +92 -0
  213. package/dist/scroll-area/scrollbar.js +33 -0
  214. package/dist/select/root/select-root.d.ts +15 -0
  215. package/dist/select/root/select-root.js +18 -6
  216. package/dist/skeleton/root/skeleton-root.d.ts +3 -0
  217. package/dist/skeleton/root/skeleton-root.js +4 -2
  218. package/dist/skip-link/root/skip-link-root.js +2 -2
  219. package/dist/slider/root/slider-root.d.ts +41 -4
  220. package/dist/slider/root/slider-root.js +23 -3
  221. package/dist/sparkline/readings.d.ts +18 -0
  222. package/dist/sparkline/readings.js +19 -0
  223. package/dist/sparkline/root/sparkline-root.d.ts +78 -7
  224. package/dist/sparkline/root/sparkline-root.js +118 -23
  225. package/dist/speed-dial/root/speed-dial-root.js +2 -2
  226. package/dist/splitter/root/splitter-root.d.ts +20 -12
  227. package/dist/splitter/root/splitter-root.js +226 -203
  228. package/dist/splitter/snap.d.ts +9 -0
  229. package/dist/splitter/snap.js +12 -0
  230. package/dist/stat/root/stat-root.d.ts +14 -5
  231. package/dist/stat/root/stat-root.js +21 -5
  232. package/dist/steps/reach.d.ts +20 -0
  233. package/dist/steps/reach.js +15 -0
  234. package/dist/steps/root/steps-root.d.ts +76 -0
  235. package/dist/steps/root/steps-root.js +93 -1
  236. package/dist/steps/step/step.d.ts +45 -2
  237. package/dist/steps/step/step.js +33 -6
  238. package/dist/switch/root/switch-root.d.ts +10 -0
  239. package/dist/table/column/table-column.d.ts +11 -10
  240. package/dist/table/column/table-column.js +8 -19
  241. package/dist/table/root/table-root.d.ts +126 -4
  242. package/dist/table/root/table-root.js +156 -6
  243. package/dist/table/row/table-row.d.ts +47 -1
  244. package/dist/table/row/table-row.js +39 -2
  245. package/dist/tabs/panel/tab-panel.d.ts +22 -5
  246. package/dist/tabs/panel/tab-panel.js +34 -6
  247. package/dist/tabs/root/tabs-root.d.ts +37 -1
  248. package/dist/tabs/root/tabs-root.js +22 -4
  249. package/dist/tabs/tab/tab.d.ts +41 -4
  250. package/dist/tabs/tab/tab.js +49 -3
  251. package/dist/tag/group/tag-group.d.ts +31 -4
  252. package/dist/tag/group/tag-group.js +46 -7
  253. package/dist/tag/root/tag-root.js +9 -2
  254. package/dist/textarea/root/textarea-root.d.ts +28 -1
  255. package/dist/textarea/root/textarea-root.js +40 -1
  256. package/dist/time-input/root/time-input-root.d.ts +5 -1
  257. package/dist/time-input/root/time-input-root.js +16 -8
  258. package/dist/time-picker/root/time-picker-root.d.ts +18 -4
  259. package/dist/time-picker/root/time-picker-root.js +7 -10
  260. package/dist/time-picker/wheel-name.d.ts +9 -0
  261. package/dist/time-picker/wheel-name.js +15 -0
  262. package/dist/timeline/group/timeline-group.d.ts +46 -0
  263. package/dist/timeline/group/timeline-group.js +37 -0
  264. package/dist/timeline/index.d.ts +1 -0
  265. package/dist/timeline/index.js +1 -0
  266. package/dist/timeline/root/timeline-root.d.ts +10 -3
  267. package/dist/toast/item/toast-item.d.ts +24 -18
  268. package/dist/toast/item/toast-item.js +36 -40
  269. package/dist/toast/root/toast-root.d.ts +6 -0
  270. package/dist/toast/root/toast-root.js +16 -1
  271. package/dist/toggle/group/toggle-group.d.ts +24 -3
  272. package/dist/toggle/group/toggle-group.js +34 -5
  273. package/dist/toolbar/root/toolbar-root.d.ts +13 -0
  274. package/dist/toolbar/root/toolbar-root.js +15 -5
  275. package/dist/tooltip/root/tooltip-root.d.ts +13 -2
  276. package/dist/tooltip/root/tooltip-root.js +9 -1
  277. package/dist/tour/back.d.ts +10 -0
  278. package/dist/tour/back.js +8 -0
  279. package/dist/tour/root/tour-root.d.ts +30 -2
  280. package/dist/tour/root/tour-root.js +34 -8
  281. package/dist/tree/item/tree-item.d.ts +61 -4
  282. package/dist/tree/item/tree-item.js +92 -20
  283. package/dist/tree/root/tree-root.d.ts +58 -0
  284. package/dist/tree/root/tree-root.js +80 -16
  285. package/dist/tree/selection.d.ts +24 -0
  286. package/dist/tree/selection.js +13 -0
  287. package/dist/trend/root/trend-root.d.ts +43 -18
  288. package/dist/trend/root/trend-root.js +31 -6
  289. package/dist/video/media-events.d.ts +44 -0
  290. package/dist/video/media-events.js +35 -0
  291. package/dist/video/root/video-root.d.ts +117 -18
  292. package/dist/video/root/video-root.js +93 -47
  293. package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
  294. package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
  295. package/dist/video-playlist/order.d.ts +41 -0
  296. package/dist/video-playlist/order.js +34 -0
  297. package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
  298. package/dist/video-playlist/root/video-playlist-root.js +60 -16
  299. package/dist/virtual-list/controls.d.ts +4 -0
  300. package/dist/virtual-list/controls.js +30 -0
  301. package/dist/virtual-list/fill.d.ts +22 -0
  302. package/dist/virtual-list/fill.js +23 -0
  303. package/dist/virtual-list/keys.d.ts +15 -0
  304. package/dist/virtual-list/keys.js +24 -0
  305. package/dist/virtual-list/plan.d.ts +49 -0
  306. package/dist/virtual-list/plan.js +16 -0
  307. package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
  308. package/dist/virtual-list/root/virtual-list-root.js +333 -49
  309. package/lint.json +1 -1
  310. package/package.json +8 -8
  311. package/types/jsx.d.ts +8113 -1394
  312. package/types/svelte.d.ts +2 -0
  313. package/types/vue.d.ts +1678 -353
  314. package/dist/data-table/root/order.d.ts +0 -141
  315. package/dist/data-table/root/order.js +0 -76
  316. package/dist/listbox/range.d.ts +0 -17
  317. package/dist/listbox/range.js +0 -5
  318. package/dist/tag/selection.d.ts +0 -10
  319. package/dist/tag/selection.js +0 -12
@@ -1,30 +1,97 @@
1
1
  import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
+ /**
4
+ * Draws one item into its row, for a list given `renderItem`.
5
+ *
6
+ * Returns anything Lit renders: a template from `html`, a string, or a DOM
7
+ * node the function built.
8
+ */
9
+ export type VirtualListRenderer = (item: unknown, index: number) => unknown;
10
+ /** Where `scrollToIndex` puts an item, and how it gets there. */
11
+ export interface VirtualListScrollOptions {
12
+ /**
13
+ * Where the item lands: the least distance that shows it whole (`nearest`,
14
+ * the default), or at the box's `start`, `center` or `end`.
15
+ */
16
+ align?: 'center' | 'end' | 'nearest' | 'start';
17
+ /** The platform's scroll behavior. Instant when left out. */
18
+ behavior?: ScrollBehavior;
19
+ }
20
+ /** The items on screen: `items.slice(first, last)`. */
21
+ export interface VirtualListRange {
22
+ /** The index of the first item on screen. */
23
+ first: number;
24
+ /** One past the index of the last item on screen. */
25
+ last: number;
26
+ }
3
27
  /**
4
28
  * @summary A list that renders only the rows of a long set that are on screen.
5
29
  *
6
30
  * @description
7
- * The items arrive as data:
31
+ * The items arrive as data, in one of two ways:
32
+ *
33
+ * - `items` takes an array. A framework sets it as a property, and React
34
+ * hydration keeps it.
35
+ * - `for` names a `<script type="application/json">` that holds an array, which
36
+ * a server sends as markup.
37
+ *
38
+ * Each item is drawn into a row in one of two ways:
39
+ *
40
+ * - `renderItem` is a function from an item and its index to the row's
41
+ * content: a Lit template, a string, or a DOM node.
42
+ * - A `<template>` child defines one row. `data-field="name"` fills an element
43
+ * with the item's `name` as text, and `data-field-href="url"` writes the
44
+ * item's `url` into `href`, the same for any attribute. A field may be a path
45
+ * of keys, such as `author.name`.
46
+ *
47
+ * Rows are your markup in the light DOM, so your stylesheet styles them.
48
+ *
49
+ * **Keyboard.** The list is one tab stop.
50
+ *
51
+ * | Key | What it does |
52
+ * |---|---|
53
+ * | Down, Up | Moves to the next or the previous item. |
54
+ * | Home, End | Moves to the first or the last item. |
55
+ * | Page Down, Page Up | Moves by the number of items on screen. |
56
+ * | A letter or a word | Moves to the next item whose text starts with what you typed. |
57
+ * | Tab | Moves into the focused row's own links and buttons, then out of the list. |
58
+ *
59
+ * An item that is not drawn is scrolled into view and focused, so a keyboard
60
+ * reaches the whole set. When the row holding the tab stop scrolls away, the
61
+ * stop moves to the first row on screen. Typing matches each item's
62
+ * `text-field`, which is the first `data-field` of the row template by default,
63
+ * or the item itself when it is a string or a number.
64
+ *
65
+ * Each row says its place in the whole set with `aria-posinset` and
66
+ * `aria-setsize`, so a screen reader says "4,000 of 10,000". The row holding
67
+ * focus stays drawn when it scrolls out.
8
68
  *
9
- * - `for` names a `<script type="application/json">` that holds an array of
10
- * objects.
11
- * - A `<template>` child defines one row. Elements with `data-field="name"` are
12
- * filled with that field of the item.
69
+ * **Selecting.** `selection-mode` makes the list a list box a reader chooses
70
+ * from: `single` selects one item and `multiple` any number. Space or a press
71
+ * selects an item, Shift with Space, Up, Down, Home, End or a press takes in
72
+ * the items from the last one chosen, and Control or Command with A selects
73
+ * them all, in `multiple`. `value` holds the chosen items' keys, separated by
74
+ * commas, in the order of the set: `key-field` names each item's key, and a
75
+ * string or a number item is its own key. A change asks with
76
+ * `helix-before-change` and tells with `change`. Each row is an `option`
77
+ * marked `aria-selected`, so a row's own links and buttons are not reached
78
+ * there: keep those to a list without `selection-mode`.
13
79
  *
14
- * Both are markup. React hydration skips every property it would have to set
15
- * imperatively, so an `items` property would be lost, and light-DOM children
16
- * would all exist before anything could window them. The JSON text is one node
17
- * whatever the row count.
80
+ * **Loading more.** `helix-range-change` fires as the items on screen change,
81
+ * and `range` holds them. `helix-load-more` fires once a reader is within one
82
+ * screen of the end, once for each length of the set: add to `items` and it can
83
+ * fire again. While you fetch, set `loading`: the list is busy, and a row after
84
+ * the last item says "Loading more" (`loading-label`, or your own content in
85
+ * the `loading` slot). `scrollToIndex` takes a reader to an item.
18
86
  *
19
- * For assistive technology the list exposes the rendered window with
20
- * `aria-setsize`. Charts that use the same `for="<id>"` shape render an
21
- * accessible `<table>`, and ten thousand rows in one is the cost this component
22
- * avoids.
87
+ * **Row height.** Rows are placed by `estimate` until they are drawn. Then the
88
+ * list reads the drawn rows' height once and places every row by it, so a
89
+ * wrong estimate still reaches the last item. Set `measured` for rows of
90
+ * different heights.
23
91
  *
24
- * The list follows the source: editing the script's text, or replacing the
25
- * script under the same id, draws the new rows. A row that stays in view keeps
26
- * its element as the list scrolls, and the row holding focus stays drawn when
27
- * it scrolls out, so a link or a button in a row keeps focus.
92
+ * The list follows its source. A new `items` array, an edit to the script's
93
+ * text, or a script replaced under the same id draws the new rows. A row that
94
+ * stays in view keeps its element as the list scrolls.
28
95
  *
29
96
  * The viewport scrolls on this tier. It carries `data-scroller`, and `core`
30
97
  * ships `[data-scroller] { overflow: auto }` into every shadow root, so
@@ -36,9 +103,16 @@ import { type PropertyValues, type TemplateResult } from 'lit';
36
103
  * @documentation https://fusion.dev/helix/components/virtual-list
37
104
  *
38
105
  * @slot - The `<template>` that defines one row. The list writes the rows it renders beside it, and this slot shows them between the two spacers.
106
+ * @slot loading - Content for the row after the last item while `loading` is set. Falls back to `loading-label`.
107
+ *
108
+ * @event {Event} change - Fired once a press or a key has changed which items are selected, in a list with `selection-mode`.
109
+ * @event {HelixBeforeChangeEvent} helix-before-change - Fired before a press or a key changes which items are selected, with the `value` it would leave. Cancelable.
110
+ * @event {HelixLoadMoreEvent} helix-load-more - Fired when a reader comes within one screen of the last item, once for each length of the set.
111
+ * @event {HelixRangeChangeEvent} helix-range-change - Fired when the items on screen change, with the new `first` and `last`, which `range` also holds.
39
112
  *
40
113
  * @csspart after - The space that stands in for the rows below the rendered ones.
41
114
  * @csspart before - The space that stands in for the rows above the rendered ones.
115
+ * @csspart loading - The row after the last item while `loading` is set.
42
116
  * @csspart viewport - The scrolling box. On this tier, it needs only a block size.
43
117
  */
44
118
  export declare class HelixHeadlessVirtualList extends HelixElement {
@@ -50,9 +124,24 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
50
124
  */
51
125
  estimate: number;
52
126
  /**
53
- * The id of the script element that holds the rows as JSON.
127
+ * The id of the script element that holds the items as JSON. `items` wins
128
+ * where both are set.
54
129
  */
55
130
  for: string;
131
+ /**
132
+ * The items, as an array. Set it as a property.
133
+ *
134
+ * Each item is drawn by `renderItem`, or into the row `<template>` by its
135
+ * fields. A new array draws the new rows, so replace the array to change it.
136
+ * Left unset, the list reads the script that `for` names.
137
+ */
138
+ items: readonly unknown[] | undefined;
139
+ /**
140
+ * The field of each item that is its key in `value`, as a key or a path of
141
+ * keys. Empty reads a string or a number item as its own key, and any
142
+ * other item by its place in the set.
143
+ */
144
+ keyField: string;
56
145
  /**
57
146
  * The list's name, read by screen readers, because only some of its rows
58
147
  * are rendered at a time.
@@ -62,28 +151,83 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
62
151
  */
63
152
  label: string;
64
153
  /**
65
- * Places rows by their measured height. Without it, every row is placed by
66
- * `estimate`.
154
+ * Marks the list as busy fetching more items, and draws a row after the last
155
+ * item that says so.
156
+ *
157
+ * Set it when `helix-load-more` starts a fetch, and clear it when the items
158
+ * arrive. The list does not ask for more while it is set.
159
+ */
160
+ loading: boolean;
161
+ /** The text of the row drawn while `loading` is set, where the `loading` slot is empty. */
162
+ loadingLabel: string;
163
+ /**
164
+ * Places each row by its own measured height. Without it, rows are placed
165
+ * by one height: `estimate` until rows are drawn, then the drawn rows' height,
166
+ * read once.
67
167
  *
68
168
  * **Off by default, because the straight line is better when it holds.** One
69
- * estimate makes offset and index convert by division, which can never
169
+ * height makes offset and index convert by division, which can never
70
170
  * disagree with itself; measuring is what a set of genuinely different
71
171
  * heights needs and costs a read of each row as it renders. A list of
72
172
  * one-line rows should leave this alone.
73
173
  */
74
174
  measured: boolean;
75
175
  /**
76
- * The parsed source.
176
+ * Draws one item into its row, given the item and its index. Set it as a
177
+ * property.
178
+ *
179
+ * It returns what Lit renders: a template from `html`, a string, or a DOM
180
+ * node. The list wraps each result in a `<div>` that carries the row's role
181
+ * and place in the set. Where it is unset, the row `<template>` is used.
182
+ */
183
+ renderItem: VirtualListRenderer | undefined;
184
+ /**
185
+ * Makes the list a list box a reader chooses from: `single` selects one
186
+ * item, and `multiple` any number. Unset is a list a reader reads.
187
+ */
188
+ selectionMode?: 'multiple' | 'single';
189
+ /**
190
+ * The field of each item that typing matches, as a key or a path of keys
191
+ * (`author.name`).
192
+ *
193
+ * Empty by default, which matches the first `data-field` of the row
194
+ * template, or the item itself where it is a string or a number.
195
+ */
196
+ textField: string;
197
+ /**
198
+ * The keys of the chosen items, separated by commas, in a list with
199
+ * `selection-mode`. Set it to start with items chosen.
200
+ */
201
+ value: string;
202
+ /**
203
+ * The parsed script.
77
204
  *
78
205
  * Empty on a server, which has nothing to read.
79
206
  */
80
207
  private rows;
81
208
  /** The `for` that `rows` came from, so it is read again only when that changes. */
82
209
  private readFor;
83
- /** The rows the drawn elements were filled from, so new data fills them again. */
210
+ /** The items the drawn rows were filled from, so new data fills them again. */
84
211
  private filledFrom;
212
+ /** The function the drawn rows were filled by, so a new one draws them again. */
213
+ private filledBy;
85
214
  /** The script the rows were read from, which the watcher follows. */
86
215
  private source;
216
+ /**
217
+ * The item whose row holds the tab stop.
218
+ *
219
+ * A plain field, because the pass that places the rows is the one that keeps
220
+ * it on a drawn row and writes the `tabindex` that follows from it.
221
+ */
222
+ private active;
223
+ /** The item whose row's own controls are in the tab order. */
224
+ private released;
225
+ /** The range last reported, so `helix-range-change` fires only on a change. */
226
+ private said;
227
+ /** The letters typed at the list, which move to the item they start. */
228
+ private readonly typeahead;
229
+ /** The key of the item a Shift range runs from: the last one chosen. */
230
+ private anchor;
87
231
  /**
88
232
  * Watches the source and the tree around it.
89
233
  *
@@ -96,6 +240,23 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
96
240
  /** Carries a host `aria-label` and `aria-labelledby` to the element with the `list` role. */
97
241
  protected readonly aria: AriaForwardController;
98
242
  private readonly virtualize;
243
+ /**
244
+ * The items on screen, as `items.slice(first, last)` reads them.
245
+ *
246
+ * Read from the scroll offset when asked. Both are 0 before the list has a
247
+ * box to measure.
248
+ */
249
+ get range(): VirtualListRange;
250
+ /**
251
+ * Scrolls the list to show the item at `index`.
252
+ *
253
+ * By default the least distance that shows it whole. `align` puts it at the
254
+ * `start`, `center` or `end` of the box, and `behavior: 'smooth'` animates the
255
+ * scroll. An index past either end goes to the first or the last item.
256
+ */
257
+ scrollToIndex(index: number, options?: VirtualListScrollOptions): void;
258
+ /** The items in force: `items` where it is set, and the script otherwise. */
259
+ private get data();
99
260
  /**
100
261
  * The rows in the tree, each with the item it drew.
101
262
  *
@@ -133,6 +294,62 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
133
294
  protected firstUpdated(changed: PropertyValues): void;
134
295
  protected updated(changed: PropertyValues): void;
135
296
  private read;
297
+ /**
298
+ * Fires `helix-range-change` when the items on screen moved, and
299
+ * `helix-load-more` when a reader is within one screen of the end.
300
+ *
301
+ * After a render and on every scroll, which are the two times either can
302
+ * change. `helix-load-more` waits for a box with a height, so a list that
303
+ * has not been laid out yet asks for nothing.
304
+ */
305
+ private report;
306
+ /**
307
+ * The text typing matches for each item: `text-field`, the template's first
308
+ * `data-field`, or a string or number item itself.
309
+ */
310
+ private texts;
311
+ /** The item a row element drew, for an element that is one of the rows. */
312
+ private indexOf;
313
+ /** The row that holds the tab stop for item `index`, where it is drawn. */
314
+ private rowFor;
315
+ /**
316
+ * Moves between items with the keys `stepIndex` names.
317
+ *
318
+ * Only from a row itself. A key pressed in a row's own link, button or field
319
+ * is that control's, so a field in a row keeps its arrows.
320
+ */
321
+ private readonly handleKeydown;
322
+ /** The key of item `at` in `value`. See `keyField`. */
323
+ private keyAt;
324
+ /** Every item's key, in the order of the set. */
325
+ private keys;
326
+ /** The keys chosen now. */
327
+ private get chosen();
328
+ /**
329
+ * Selects item `at`, or lets it go, asking first. With `extend`, in
330
+ * `multiple`, the items from the anchor to it are taken in, as Data Table
331
+ * and List take in a range. Otherwise the item is where the next range runs
332
+ * from.
333
+ */
334
+ private press;
335
+ /** Keys in the order of the set, a key it no longer holds kept after them. */
336
+ private inOrder;
337
+ /** Asks for a new `value`, and says so once it has moved. */
338
+ private choose;
339
+ /**
340
+ * A press on a row selects it, in a list with `selection-mode`, except on a
341
+ * control of its own. Shift takes in a range.
342
+ */
343
+ private readonly handleClick;
344
+ /**
345
+ * Focuses the row for item `index`, scrolling it into view and drawing it
346
+ * first when it is not drawn.
347
+ */
348
+ private focusIndex;
349
+ /** The row kept for focus is let go once focus has left it. */
350
+ private readonly handleFocusOut;
351
+ /** A row that takes focus, by a press or by Tab, takes the tab stop with it. */
352
+ private readonly handleFocusIn;
136
353
  /**
137
354
  * The item whose row holds focus, where one does.
138
355
  *
@@ -140,10 +357,22 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
140
357
  * own shadow root to the row's element.
141
358
  */
142
359
  private focusedIndex;
143
- /** The item drawn outside the window to keep focus, if there is one. */
360
+ /** The item a key is moving focus to, drawn until it has it. */
361
+ private focusing;
362
+ /** The item drawn outside the window to keep focus, or to take it, if there is one. */
144
363
  private keptIndex;
145
- /** Fills a row's holes and its place in the set from an item. */
364
+ /**
365
+ * Writes a row's role, and whether it is chosen in a list that selects:
366
+ * `option` with `aria-selected` there, and `listitem` otherwise. Every pass,
367
+ * since a choice changes no row's content.
368
+ */
369
+ private mark;
370
+ /** Writes a row's place in the set. */
371
+ private stamp;
372
+ /** Fills a drawn row from its item, by `renderItem` or by the template's holes. */
146
373
  private fill;
374
+ /** New elements for item `at`: a `<div>` for `renderItem`, or the template's clone. */
375
+ private draw;
147
376
  /**
148
377
  * Puts the windowed rows into the light DOM, and takes the rest out.
149
378
  *
@@ -151,10 +380,14 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
151
380
  * cloning every row on every move replaced the node a reader had focused,
152
381
  * so a link in a row lost focus to the body on any scroll, even with its row
153
382
  * still on screen. Rows are keyed by item: the ones leaving go, the ones
154
- * arriving are cloned in their place, and the ones staying are not moved.
383
+ * arriving are drawn in their place, and the ones staying are not moved.
155
384
  *
156
385
  * **The row holding focus is drawn outside the window too**, beside it on the
157
386
  * side it belongs, and the spacer on that side gives up its room.
387
+ *
388
+ * **One row holds the tab stop**, the one the reader last focused while it is
389
+ * drawn, and the first row on screen once it is not. Its own links and
390
+ * buttons are in the tab order, and those of every other row wait.
158
391
  */
159
392
  private place;
160
393
  protected render(): TemplateResult;