@fusion.dev/helix-headless 0.145.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 (278) hide show
  1. package/custom-elements.json +7373 -3849
  2. package/dist/accordion/item/accordion-item.d.ts +14 -0
  3. package/dist/accordion/item/accordion-item.js +16 -6
  4. package/dist/accordion/root/accordion-root.d.ts +8 -5
  5. package/dist/announcement/root/announcement-root.d.ts +3 -2
  6. package/dist/announcement/root/announcement-root.js +3 -1
  7. package/dist/app-header/root/app-header-root.d.ts +7 -2
  8. package/dist/app-header/root/app-header-root.js +9 -1
  9. package/dist/app-header/sectioning.d.ts +3 -1
  10. package/dist/app-header/sectioning.js +3 -2
  11. package/dist/avatar/group/avatar-group.d.ts +20 -14
  12. package/dist/avatar/group/avatar-group.js +17 -19
  13. package/dist/badge/root/badge-root.d.ts +3 -1
  14. package/dist/badge/root/badge-root.js +2 -2
  15. package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
  16. package/dist/bar-chart/root/bar-chart-root.js +52 -15
  17. package/dist/bar-chart/stack.d.ts +15 -0
  18. package/dist/bar-chart/stack.js +19 -0
  19. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
  20. package/dist/breadcrumbs/root/breadcrumbs-root.js +50 -3
  21. package/dist/button/root/button-root.d.ts +26 -0
  22. package/dist/button/root/button-root.js +38 -18
  23. package/dist/button-group/root/button-group-root.d.ts +2 -1
  24. package/dist/button-group/root/button-group-root.js +5 -1
  25. package/dist/canvas/node/canvas-node.d.ts +4 -3
  26. package/dist/canvas/node/canvas-node.js +3 -2
  27. package/dist/canvas/root/canvas-root.js +2 -2
  28. package/dist/card/root/card-root.d.ts +24 -3
  29. package/dist/card/root/card-root.js +20 -8
  30. package/dist/carousel/root/carousel-root.d.ts +43 -4
  31. package/dist/carousel/root/carousel-root.js +40 -12
  32. package/dist/carousel/stops.d.ts +20 -0
  33. package/dist/carousel/stops.js +30 -0
  34. package/dist/chat/message/chat-message.js +5 -4
  35. package/dist/chat/naming.d.ts +5 -1
  36. package/dist/chat/naming.js +4 -2
  37. package/dist/chat/root/chat-root.d.ts +25 -3
  38. package/dist/chat/root/chat-root.js +22 -5
  39. package/dist/checkbox/root/checkbox-root.d.ts +20 -0
  40. package/dist/checkbox/root/checkbox-root.js +14 -1
  41. package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
  42. package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
  43. package/dist/checkbox-group/select-all.d.ts +27 -0
  44. package/dist/checkbox-group/select-all.js +12 -0
  45. package/dist/code-block/highlight.d.ts +15 -0
  46. package/dist/code-block/highlight.js +4 -0
  47. package/dist/code-block/root/code-block-root.d.ts +49 -1
  48. package/dist/code-block/root/code-block-root.js +58 -3
  49. package/dist/color-input/root/color-input-root.d.ts +3 -0
  50. package/dist/color-input/root/color-input-root.js +6 -3
  51. package/dist/color-picker/root/color-picker-root.d.ts +33 -4
  52. package/dist/color-picker/root/color-picker-root.js +80 -21
  53. package/dist/color-picker/swatches.d.ts +12 -0
  54. package/dist/color-picker/swatches.js +26 -0
  55. package/dist/combobox/root/combobox-root.d.ts +43 -0
  56. package/dist/combobox/root/combobox-root.js +79 -15
  57. package/dist/command/root/command-root.d.ts +16 -1
  58. package/dist/command/root/command-root.js +22 -4
  59. package/dist/copy-button/root/copy-button-root.d.ts +5 -0
  60. package/dist/copy-button/root/copy-button-root.js +10 -3
  61. package/dist/data-table/index.d.ts +1 -1
  62. package/dist/data-table/index.js +1 -1
  63. package/dist/data-table/keys.d.ts +24 -0
  64. package/dist/data-table/keys.js +24 -0
  65. package/dist/data-table/root/data-table-root.d.ts +27 -18
  66. package/dist/data-table/root/data-table-root.js +20 -52
  67. package/dist/data-table/tree.d.ts +16 -1
  68. package/dist/data-table/tree.js +2 -3
  69. package/dist/date-input/root/date-input-root.d.ts +3 -1
  70. package/dist/date-input/root/date-input-root.js +18 -7
  71. package/dist/date-picker/root/date-picker-root.js +12 -6
  72. package/dist/dialog/description.js +15 -1
  73. package/dist/dialog/root/dialog-root.d.ts +8 -2
  74. package/dist/dialog/root/dialog-root.js +16 -1
  75. package/dist/divider/root/divider-root.d.ts +3 -0
  76. package/dist/divider/root/divider-root.js +2 -1
  77. package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
  78. package/dist/donut-chart/root/donut-chart-root.js +48 -1
  79. package/dist/drawer/reveal.d.ts +8 -0
  80. package/dist/drawer/reveal.js +1 -0
  81. package/dist/drawer/root/drawer-root.d.ts +59 -0
  82. package/dist/drawer/root/drawer-root.js +63 -4
  83. package/dist/drilldown/item/drilldown-item.js +1 -1
  84. package/dist/drilldown/root/drilldown-root.d.ts +21 -3
  85. package/dist/drilldown/root/drilldown-root.js +21 -3
  86. package/dist/element-events.generated.js +31 -5
  87. package/dist/empty/root/empty-root.d.ts +3 -1
  88. package/dist/empty/root/empty-root.js +3 -2
  89. package/dist/file-input/root/file-input-root.d.ts +69 -6
  90. package/dist/file-input/root/file-input-root.js +82 -19
  91. package/dist/file-input/screen.d.ts +2 -1
  92. package/dist/filter-input/menu/filter-menu.d.ts +2 -0
  93. package/dist/filter-input/menu/filter-menu.js +12 -4
  94. package/dist/filter-input/root/filter-input-root.d.ts +30 -6
  95. package/dist/filter-input/root/filter-input-root.js +1 -1
  96. package/dist/filter-input/suggest.d.ts +28 -3
  97. package/dist/filter-input/suggest.js +18 -8
  98. package/dist/format-date/root/format-date-root.d.ts +9 -16
  99. package/dist/format-date/root/format-date-root.js +10 -27
  100. package/dist/heatmap/root/heatmap-root.d.ts +24 -13
  101. package/dist/heatmap/root/heatmap-root.js +34 -12
  102. package/dist/icon/root/icon-root.d.ts +12 -1
  103. package/dist/icon/root/icon-root.js +21 -10
  104. package/dist/icon/settle.d.ts +7 -0
  105. package/dist/icon/settle.js +10 -0
  106. package/dist/icon-button/root/icon-button-root.d.ts +2 -0
  107. package/dist/image/root/image-root.d.ts +5 -1
  108. package/dist/image/root/image-root.js +1 -1
  109. package/dist/input/root/input-root.d.ts +12 -2
  110. package/dist/input/root/input-root.js +11 -2
  111. package/dist/kbd/root/kbd-root.d.ts +35 -1
  112. package/dist/kbd/root/kbd-root.js +23 -4
  113. package/dist/legend/root/legend-root.d.ts +55 -8
  114. package/dist/legend/root/legend-root.js +55 -13
  115. package/dist/lightbox/root/lightbox-root.d.ts +49 -6
  116. package/dist/lightbox/root/lightbox-root.js +86 -19
  117. package/dist/lightbox/zoom-controller.d.ts +59 -0
  118. package/dist/lightbox/zoom-controller.js +128 -0
  119. package/dist/lightbox/zoom.d.ts +22 -0
  120. package/dist/lightbox/zoom.js +16 -0
  121. package/dist/line-chart/root/line-chart-root.d.ts +22 -1
  122. package/dist/line-chart/root/line-chart-root.js +21 -1
  123. package/dist/list/item/list-item.d.ts +2 -0
  124. package/dist/list/item/list-item.js +11 -2
  125. package/dist/list/root/list-root.d.ts +62 -13
  126. package/dist/list/root/list-root.js +70 -13
  127. package/dist/list/selection.d.ts +37 -7
  128. package/dist/list/selection.js +16 -7
  129. package/dist/listbox/root/listbox-root.d.ts +37 -1
  130. package/dist/listbox/root/listbox-root.js +49 -3
  131. package/dist/loader/busy.d.ts +10 -0
  132. package/dist/loader/busy.js +11 -0
  133. package/dist/loader/root/loader-root.d.ts +9 -2
  134. package/dist/loader/root/loader-root.js +23 -3
  135. package/dist/megamenu/root/megamenu-root.d.ts +51 -10
  136. package/dist/megamenu/root/megamenu-root.js +76 -5
  137. package/dist/menu/item/menu-item.d.ts +51 -2
  138. package/dist/menu/item/menu-item.js +47 -23
  139. package/dist/menu/root/menu-root.d.ts +14 -0
  140. package/dist/menu/root/menu-root.js +2 -2
  141. package/dist/meter/root/meter-root.d.ts +20 -1
  142. package/dist/meter/root/meter-root.js +11 -15
  143. package/dist/navigation/root/navigation-root.d.ts +2 -1
  144. package/dist/navigation/root/navigation-root.js +2 -2
  145. package/dist/notifications/root/notifications-root.d.ts +10 -3
  146. package/dist/notifications/root/notifications-root.js +19 -7
  147. package/dist/number-input/root/number-input-root.d.ts +17 -8
  148. package/dist/number-input/root/number-input-root.js +2 -7
  149. package/dist/object-inspector/root/object-inspector-root.d.ts +75 -27
  150. package/dist/object-inspector/root/object-inspector-root.js +117 -76
  151. package/dist/object-inspector/rows.d.ts +18 -0
  152. package/dist/object-inspector/rows.js +33 -0
  153. package/dist/option/root/option-root.d.ts +5 -3
  154. package/dist/outline/root/outline-root.d.ts +18 -0
  155. package/dist/outline/root/outline-root.js +23 -5
  156. package/dist/pagination/size/pagination-size.d.ts +1 -0
  157. package/dist/pagination/size/pagination-size.js +1 -1
  158. package/dist/pin-input/code.d.ts +10 -0
  159. package/dist/pin-input/code.js +13 -0
  160. package/dist/pin-input/root/pin-input-root.d.ts +25 -1
  161. package/dist/pin-input/root/pin-input-root.js +10 -11
  162. package/dist/popover/hide-outside.d.ts +14 -0
  163. package/dist/popover/hide-outside.js +41 -0
  164. package/dist/popover/root/popover-root.d.ts +57 -7
  165. package/dist/popover/root/popover-root.js +58 -3
  166. package/dist/progress/root/progress-root.d.ts +20 -0
  167. package/dist/progress/root/progress-root.js +15 -15
  168. package/dist/qr-code/export.d.ts +26 -1
  169. package/dist/qr-code/export.js +14 -0
  170. package/dist/qr-code/root/qr-code-root.d.ts +19 -5
  171. package/dist/qr-code/root/qr-code-root.js +58 -9
  172. package/dist/quote/marks.d.ts +8 -0
  173. package/dist/quote/marks.js +5 -0
  174. package/dist/quote/root/quote-root.d.ts +14 -2
  175. package/dist/quote/root/quote-root.js +23 -1
  176. package/dist/radio/root/radio-root.d.ts +6 -2
  177. package/dist/radio/root/radio-root.js +6 -1
  178. package/dist/rating/root/rating-root.d.ts +9 -4
  179. package/dist/rating/root/rating-root.js +31 -7
  180. package/dist/rating/steps.d.ts +7 -0
  181. package/dist/rating/steps.js +9 -0
  182. package/dist/scatter-chart/fit.d.ts +15 -0
  183. package/dist/scatter-chart/fit.js +35 -0
  184. package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
  185. package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
  186. package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
  187. package/dist/scroll-area/root/scroll-area-root.js +57 -173
  188. package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
  189. package/dist/scroll-area/scrollbar-controller.js +172 -0
  190. package/dist/scroll-area/scrollbar.d.ts +27 -0
  191. package/dist/scroll-area/scrollbar.js +9 -0
  192. package/dist/select/root/select-root.d.ts +15 -0
  193. package/dist/select/root/select-root.js +18 -6
  194. package/dist/skeleton/root/skeleton-root.d.ts +3 -0
  195. package/dist/skeleton/root/skeleton-root.js +4 -2
  196. package/dist/skip-link/root/skip-link-root.js +2 -2
  197. package/dist/slider/root/slider-root.d.ts +41 -4
  198. package/dist/slider/root/slider-root.js +23 -3
  199. package/dist/sparkline/readings.d.ts +18 -0
  200. package/dist/sparkline/readings.js +19 -0
  201. package/dist/sparkline/root/sparkline-root.d.ts +78 -7
  202. package/dist/sparkline/root/sparkline-root.js +118 -23
  203. package/dist/speed-dial/root/speed-dial-root.js +2 -2
  204. package/dist/splitter/root/splitter-root.d.ts +7 -12
  205. package/dist/splitter/root/splitter-root.js +209 -204
  206. package/dist/stat/root/stat-root.d.ts +14 -5
  207. package/dist/stat/root/stat-root.js +21 -5
  208. package/dist/steps/reach.d.ts +5 -0
  209. package/dist/steps/reach.js +3 -0
  210. package/dist/steps/root/steps-root.d.ts +49 -3
  211. package/dist/steps/root/steps-root.js +44 -5
  212. package/dist/steps/step/step.d.ts +7 -0
  213. package/dist/steps/step/step.js +7 -2
  214. package/dist/switch/root/switch-root.d.ts +10 -0
  215. package/dist/table/column/table-column.d.ts +0 -10
  216. package/dist/table/column/table-column.js +3 -19
  217. package/dist/table/root/table-root.d.ts +31 -10
  218. package/dist/table/root/table-root.js +2 -13
  219. package/dist/tabs/panel/tab-panel.d.ts +16 -3
  220. package/dist/tabs/panel/tab-panel.js +34 -5
  221. package/dist/tabs/root/tabs-root.d.ts +12 -0
  222. package/dist/tabs/root/tabs-root.js +1 -1
  223. package/dist/tabs/tab/tab.d.ts +5 -0
  224. package/dist/tabs/tab/tab.js +5 -2
  225. package/dist/tag/group/tag-group.d.ts +31 -4
  226. package/dist/tag/group/tag-group.js +46 -7
  227. package/dist/tag/root/tag-root.js +9 -2
  228. package/dist/textarea/root/textarea-root.d.ts +28 -1
  229. package/dist/textarea/root/textarea-root.js +40 -1
  230. package/dist/time-input/root/time-input-root.d.ts +5 -1
  231. package/dist/time-input/root/time-input-root.js +16 -8
  232. package/dist/time-picker/root/time-picker-root.d.ts +18 -4
  233. package/dist/time-picker/root/time-picker-root.js +7 -10
  234. package/dist/time-picker/wheel-name.d.ts +9 -0
  235. package/dist/time-picker/wheel-name.js +15 -0
  236. package/dist/timeline/group/timeline-group.js +2 -2
  237. package/dist/toast/item/toast-item.d.ts +14 -1
  238. package/dist/toast/item/toast-item.js +22 -5
  239. package/dist/toast/root/toast-root.d.ts +6 -0
  240. package/dist/toast/root/toast-root.js +16 -1
  241. package/dist/toggle/group/toggle-group.d.ts +24 -3
  242. package/dist/toggle/group/toggle-group.js +34 -5
  243. package/dist/tooltip/root/tooltip-root.d.ts +13 -2
  244. package/dist/tooltip/root/tooltip-root.js +9 -1
  245. package/dist/tour/back.d.ts +10 -0
  246. package/dist/tour/back.js +8 -0
  247. package/dist/tour/root/tour-root.d.ts +30 -2
  248. package/dist/tour/root/tour-root.js +34 -8
  249. package/dist/tree/item/tree-item.d.ts +7 -3
  250. package/dist/tree/item/tree-item.js +3 -0
  251. package/dist/tree/root/tree-root.d.ts +24 -3
  252. package/dist/tree/root/tree-root.js +32 -13
  253. package/dist/tree/selection.js +2 -15
  254. package/dist/trend/root/trend-root.d.ts +43 -18
  255. package/dist/trend/root/trend-root.js +31 -6
  256. package/dist/video/media-events.d.ts +13 -18
  257. package/dist/video/media-events.js +1 -5
  258. package/dist/video/root/video-root.d.ts +18 -5
  259. package/dist/video/root/video-root.js +19 -10
  260. package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
  261. package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
  262. package/dist/video-playlist/root/video-playlist-root.d.ts +7 -1
  263. package/dist/virtual-list/fill.d.ts +0 -8
  264. package/dist/virtual-list/fill.js +1 -17
  265. package/dist/virtual-list/plan.d.ts +49 -0
  266. package/dist/virtual-list/plan.js +16 -0
  267. package/dist/virtual-list/root/virtual-list-root.d.ts +114 -13
  268. package/dist/virtual-list/root/virtual-list-root.js +183 -40
  269. package/lint.json +1 -1
  270. package/package.json +8 -8
  271. package/types/jsx.d.ts +4577 -835
  272. package/types/vue.d.ts +926 -168
  273. package/dist/chat/relative-clock.d.ts +0 -39
  274. package/dist/chat/relative-clock.js +0 -31
  275. package/dist/data-table/root/order.d.ts +0 -141
  276. package/dist/data-table/root/order.js +0 -76
  277. package/dist/tag/selection.d.ts +0 -10
  278. package/dist/tag/selection.js +0 -12
@@ -10,190 +10,8 @@ import { html, nothing } from 'lit';
10
10
  import { property, state } from 'lit/decorators.js';
11
11
  import { snapTo } from '../snap.js';
12
12
  const STACK_BELOW = 512;
13
+ const channel = new WeakMap();
13
14
  let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitter extends HelixElement {
14
- constructor() {
15
- super(...arguments);
16
- this.collapsedLabel = 'Collapsed';
17
- this.collapsedSize = 0;
18
- this.cornerLabel = 'Resize both';
19
- this.defaultPosition = 50;
20
- this.label = 'Resize panes';
21
- this.aria = new AriaForwardController(this, {
22
- label: true,
23
- target: () => this.partNamed('separator'),
24
- });
25
- this.max = 100;
26
- this.min = 0;
27
- this.snap = '';
28
- this.snapThreshold = 12;
29
- this.step = 2;
30
- this.positionState = undefined;
31
- this.collapsedState = undefined;
32
- this.opened = undefined;
33
- this.began = undefined;
34
- this.reached = undefined;
35
- this.dragging = false;
36
- this.crossings = [];
37
- this.outer = null;
38
- this.crossedAt = undefined;
39
- this.cornerOrigin = null;
40
- this.origin = null;
41
- this.stacked = false;
42
- this.handlePointerDown = (event) => {
43
- const separator = event.currentTarget;
44
- const box = this.getBoundingClientRect();
45
- this.origin = this.vertical
46
- ? { length: box.height, start: box.top }
47
- : { length: box.width, start: box.left };
48
- capturePointer(separator, event.pointerId);
49
- this.opened = this.collapsed ? undefined : this.position;
50
- this.began = this.position;
51
- this.reached = undefined;
52
- this.dragging = true;
53
- event.preventDefault();
54
- };
55
- this.handlePointerMove = (event) => {
56
- const origin = this.origin;
57
- if (!origin || origin.length === 0) {
58
- return;
59
- }
60
- const along = this.vertical ? event.clientY : event.clientX;
61
- const raw = ((along - origin.start) / origin.length) * 100;
62
- const rtl = !this.vertical && isRtl(this);
63
- this.move(this.snapped(rtl ? 100 - raw : raw, origin.length));
64
- };
65
- this.handlePointerUp = (event) => {
66
- if (!this.origin) {
67
- return;
68
- }
69
- const separator = event.currentTarget;
70
- if (separator.hasPointerCapture(event.pointerId)) {
71
- separator.releasePointerCapture(event.pointerId);
72
- }
73
- this.origin = null;
74
- this.dragging = false;
75
- this.settle(this.reached ?? this.position);
76
- };
77
- this.handleKeydown = (event) => {
78
- if (event.key === 'Enter') {
79
- this.toggleCollapse();
80
- event.preventDefault();
81
- return;
82
- }
83
- const toward = this.travel(event.key);
84
- let next;
85
- if (toward !== 0) {
86
- next = this.position + toward * this.step;
87
- }
88
- else if (event.key === 'Home') {
89
- next = this.minPercent;
90
- }
91
- else if (event.key === 'End') {
92
- next = this.maxPercent;
93
- }
94
- else {
95
- return;
96
- }
97
- this.settle(next);
98
- event.preventDefault();
99
- };
100
- this.handleDoubleClick = () => {
101
- this.reset();
102
- };
103
- this.handleCornerDoubleClick = (event) => {
104
- const crossing = this.crossings[Number(event.currentTarget.dataset.cross)];
105
- if (!crossing) {
106
- return;
107
- }
108
- this.reset();
109
- crossing.by.reset();
110
- this.leaveSeparator(event);
111
- };
112
- this.handleCornerDown = (event) => {
113
- const handle = event.currentTarget;
114
- const crossing = this.crossings[Number(handle.dataset.cross)];
115
- if (!crossing) {
116
- return;
117
- }
118
- const mine = this.getBoundingClientRect();
119
- const theirs = crossing.by.getBoundingClientRect();
120
- this.cornerOrigin = {
121
- by: crossing.by,
122
- inner: crossing.by.vertical
123
- ? { length: theirs.height, start: theirs.top }
124
- : { length: theirs.width, start: theirs.left },
125
- outer: this.vertical
126
- ? { length: mine.height, start: mine.top }
127
- : { length: mine.width, start: mine.left },
128
- };
129
- capturePointer(handle, event.pointerId);
130
- this.opened = this.collapsed ? undefined : this.position;
131
- crossing.by.opened = crossing.by.collapsed ? undefined : crossing.by.position;
132
- this.began = this.position;
133
- crossing.by.began = crossing.by.position;
134
- this.reached = undefined;
135
- crossing.by.reached = undefined;
136
- this.dragging = true;
137
- crossing.by.dragging = true;
138
- this.leaveSeparator(event);
139
- };
140
- this.handleCornerMove = (event) => {
141
- const origin = this.cornerOrigin;
142
- if (!origin) {
143
- return;
144
- }
145
- const rtl = isRtl(this);
146
- const along = (box, at, inline) => {
147
- if (box.length === 0) {
148
- return undefined;
149
- }
150
- const raw = ((at - box.start) / box.length) * 100;
151
- return inline && rtl ? 100 - raw : raw;
152
- };
153
- const mine = along(origin.outer, this.vertical ? event.clientY : event.clientX, !this.vertical);
154
- const theirs = along(origin.inner, origin.by.vertical ? event.clientY : event.clientX, !origin.by.vertical);
155
- if (mine !== undefined) {
156
- this.moveTo(mine);
157
- }
158
- if (theirs !== undefined) {
159
- origin.by.moveTo(theirs);
160
- }
161
- this.leaveSeparator(event);
162
- };
163
- this.handleCornerUp = (event) => {
164
- const origin = this.cornerOrigin;
165
- if (!origin) {
166
- return;
167
- }
168
- const handle = event.currentTarget;
169
- if (handle.hasPointerCapture(event.pointerId)) {
170
- handle.releasePointerCapture(event.pointerId);
171
- }
172
- this.cornerOrigin = null;
173
- this.moveTo(this.reached ?? this.position, true);
174
- origin.by.moveTo(origin.by.reached ?? origin.by.position, true);
175
- this.leaveSeparator(event);
176
- };
177
- this.handleCornerKeydown = (event) => {
178
- const crossing = this.crossings[Number(event.currentTarget.dataset.cross)];
179
- if (!crossing) {
180
- return;
181
- }
182
- const inner = crossing.by;
183
- const mine = this.travel(event.key);
184
- const theirs = inner.travel(event.key);
185
- if (mine !== 0) {
186
- this.moveTo(this.position + mine * this.step, true);
187
- }
188
- else if (theirs !== 0) {
189
- inner.moveTo(inner.position + theirs * inner.step, true);
190
- }
191
- else {
192
- return;
193
- }
194
- this.leaveSeparator(event);
195
- };
196
- }
197
15
  get collapsed() {
198
16
  const held = this.collapsedState;
199
17
  if (held === undefined) {
@@ -388,26 +206,211 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
388
206
  const home = this.clamp(this.defaultPosition);
389
207
  this.settle(home);
390
208
  }
391
- cross(by, at) {
392
- const found = this.crossings.find((crossing) => crossing.by === by);
393
- if (found) {
394
- if (found.at === at) {
209
+ constructor() {
210
+ super();
211
+ this.collapsedLabel = 'Collapsed';
212
+ this.collapsedSize = 0;
213
+ this.cornerLabel = 'Resize both';
214
+ this.defaultPosition = 50;
215
+ this.label = 'Resize panes';
216
+ this.aria = new AriaForwardController(this, {
217
+ label: true,
218
+ target: () => this.partNamed('separator'),
219
+ });
220
+ this.max = 100;
221
+ this.min = 0;
222
+ this.snap = '';
223
+ this.snapThreshold = 12;
224
+ this.step = 2;
225
+ this.positionState = undefined;
226
+ this.collapsedState = undefined;
227
+ this.opened = undefined;
228
+ this.began = undefined;
229
+ this.reached = undefined;
230
+ this.dragging = false;
231
+ this.crossings = [];
232
+ this.outer = null;
233
+ this.crossedAt = undefined;
234
+ this.cornerOrigin = null;
235
+ this.origin = null;
236
+ this.stacked = false;
237
+ this.handlePointerDown = (event) => {
238
+ const separator = event.currentTarget;
239
+ const box = this.getBoundingClientRect();
240
+ this.origin = this.vertical
241
+ ? { length: box.height, start: box.top }
242
+ : { length: box.width, start: box.left };
243
+ capturePointer(separator, event.pointerId);
244
+ this.opened = this.collapsed ? undefined : this.position;
245
+ this.began = this.position;
246
+ this.reached = undefined;
247
+ this.dragging = true;
248
+ event.preventDefault();
249
+ };
250
+ this.handlePointerMove = (event) => {
251
+ const origin = this.origin;
252
+ if (!origin || origin.length === 0) {
395
253
  return;
396
254
  }
397
- found.at = at;
398
- }
399
- else {
400
- this.crossings.push({ at, by });
401
- }
402
- this.requestUpdate();
403
- }
404
- uncross(by) {
405
- const at = this.crossings.findIndex((crossing) => crossing.by === by);
406
- if (at === -1) {
407
- return;
408
- }
409
- this.crossings.splice(at, 1);
410
- this.requestUpdate();
255
+ const along = this.vertical ? event.clientY : event.clientX;
256
+ const raw = ((along - origin.start) / origin.length) * 100;
257
+ const rtl = !this.vertical && isRtl(this);
258
+ this.move(this.snapped(rtl ? 100 - raw : raw, origin.length));
259
+ };
260
+ this.handlePointerUp = (event) => {
261
+ if (!this.origin) {
262
+ return;
263
+ }
264
+ const separator = event.currentTarget;
265
+ if (separator.hasPointerCapture(event.pointerId)) {
266
+ separator.releasePointerCapture(event.pointerId);
267
+ }
268
+ this.origin = null;
269
+ this.dragging = false;
270
+ this.settle(this.reached ?? this.position);
271
+ };
272
+ this.handleKeydown = (event) => {
273
+ if (event.key === 'Enter') {
274
+ this.toggleCollapse();
275
+ event.preventDefault();
276
+ return;
277
+ }
278
+ const toward = this.travel(event.key);
279
+ let next;
280
+ if (toward !== 0) {
281
+ next = this.position + toward * this.step;
282
+ }
283
+ else if (event.key === 'Home') {
284
+ next = this.minPercent;
285
+ }
286
+ else if (event.key === 'End') {
287
+ next = this.maxPercent;
288
+ }
289
+ else {
290
+ return;
291
+ }
292
+ this.settle(next);
293
+ event.preventDefault();
294
+ };
295
+ this.handleDoubleClick = () => {
296
+ this.reset();
297
+ };
298
+ this.handleCornerDoubleClick = (event) => {
299
+ const crossing = this.crossings[Number(event.currentTarget.dataset.cross)];
300
+ if (!crossing) {
301
+ return;
302
+ }
303
+ this.reset();
304
+ crossing.by.reset();
305
+ this.leaveSeparator(event);
306
+ };
307
+ this.handleCornerDown = (event) => {
308
+ const handle = event.currentTarget;
309
+ const crossing = this.crossings[Number(handle.dataset.cross)];
310
+ if (!crossing) {
311
+ return;
312
+ }
313
+ const mine = this.getBoundingClientRect();
314
+ const theirs = crossing.by.getBoundingClientRect();
315
+ this.cornerOrigin = {
316
+ by: crossing.by,
317
+ inner: crossing.by.vertical
318
+ ? { length: theirs.height, start: theirs.top }
319
+ : { length: theirs.width, start: theirs.left },
320
+ outer: this.vertical
321
+ ? { length: mine.height, start: mine.top }
322
+ : { length: mine.width, start: mine.left },
323
+ };
324
+ capturePointer(handle, event.pointerId);
325
+ this.opened = this.collapsed ? undefined : this.position;
326
+ crossing.by.opened = crossing.by.collapsed ? undefined : crossing.by.position;
327
+ this.began = this.position;
328
+ crossing.by.began = crossing.by.position;
329
+ this.reached = undefined;
330
+ crossing.by.reached = undefined;
331
+ this.dragging = true;
332
+ crossing.by.dragging = true;
333
+ this.leaveSeparator(event);
334
+ };
335
+ this.handleCornerMove = (event) => {
336
+ const origin = this.cornerOrigin;
337
+ if (!origin) {
338
+ return;
339
+ }
340
+ const rtl = isRtl(this);
341
+ const along = (box, at, inline) => {
342
+ if (box.length === 0) {
343
+ return undefined;
344
+ }
345
+ const raw = ((at - box.start) / box.length) * 100;
346
+ return inline && rtl ? 100 - raw : raw;
347
+ };
348
+ const mine = along(origin.outer, this.vertical ? event.clientY : event.clientX, !this.vertical);
349
+ const theirs = along(origin.inner, origin.by.vertical ? event.clientY : event.clientX, !origin.by.vertical);
350
+ if (mine !== undefined) {
351
+ this.moveTo(mine);
352
+ }
353
+ if (theirs !== undefined) {
354
+ origin.by.moveTo(theirs);
355
+ }
356
+ this.leaveSeparator(event);
357
+ };
358
+ this.handleCornerUp = (event) => {
359
+ const origin = this.cornerOrigin;
360
+ if (!origin) {
361
+ return;
362
+ }
363
+ const handle = event.currentTarget;
364
+ if (handle.hasPointerCapture(event.pointerId)) {
365
+ handle.releasePointerCapture(event.pointerId);
366
+ }
367
+ this.cornerOrigin = null;
368
+ this.moveTo(this.reached ?? this.position, true);
369
+ origin.by.moveTo(origin.by.reached ?? origin.by.position, true);
370
+ this.leaveSeparator(event);
371
+ };
372
+ this.handleCornerKeydown = (event) => {
373
+ const crossing = this.crossings[Number(event.currentTarget.dataset.cross)];
374
+ if (!crossing) {
375
+ return;
376
+ }
377
+ const inner = crossing.by;
378
+ const mine = this.travel(event.key);
379
+ const theirs = inner.travel(event.key);
380
+ if (mine !== 0) {
381
+ this.moveTo(this.position + mine * this.step, true);
382
+ }
383
+ else if (theirs !== 0) {
384
+ inner.moveTo(inner.position + theirs * inner.step, true);
385
+ }
386
+ else {
387
+ return;
388
+ }
389
+ this.leaveSeparator(event);
390
+ };
391
+ channel.set(this, {
392
+ cross: (by, at) => {
393
+ const found = this.crossings.find((crossing) => crossing.by === by);
394
+ if (found) {
395
+ if (found.at === at) {
396
+ return;
397
+ }
398
+ found.at = at;
399
+ }
400
+ else {
401
+ this.crossings.push({ at, by });
402
+ }
403
+ this.requestUpdate();
404
+ },
405
+ uncross: (by) => {
406
+ const at = this.crossings.findIndex((crossing) => crossing.by === by);
407
+ if (at === -1) {
408
+ return;
409
+ }
410
+ this.crossings.splice(at, 1);
411
+ this.requestUpdate();
412
+ },
413
+ });
411
414
  }
412
415
  findOuter() {
413
416
  const outer = closestInstance(this.parentElement, HelixHeadlessSplitter_1);
@@ -416,7 +419,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
416
419
  }
417
420
  this.outer = outer;
418
421
  this.crossedAt = this.position;
419
- outer.cross(this, this.position);
422
+ channel.get(outer)?.cross(this, this.position);
420
423
  }
421
424
  leaveSeparator(event) {
422
425
  event.stopPropagation();
@@ -433,7 +436,9 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
433
436
  super.disconnectedCallback();
434
437
  this.sizes?.disconnect();
435
438
  this.sizes = undefined;
436
- this.outer?.uncross(this);
439
+ if (this.outer) {
440
+ channel.get(this.outer)?.uncross(this);
441
+ }
437
442
  this.outer = null;
438
443
  this.crossedAt = undefined;
439
444
  }
@@ -461,7 +466,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
461
466
  }
462
467
  if (this.outer && this.showing !== this.crossedAt) {
463
468
  this.crossedAt = this.showing;
464
- this.outer.cross(this, this.showing);
469
+ channel.get(this.outer)?.cross(this, this.showing);
465
470
  }
466
471
  }
467
472
  willUpdate(changed) {
@@ -12,6 +12,13 @@ import { type PropertyValues, type TemplateResult } from 'lit';
12
12
  * add an attribute after upgrade, which markup rendered on the server by React
13
13
  * does not have.
14
14
  *
15
+ * **A stat with a label is a group named by it**, so a reader moving through a
16
+ * dashboard hears "Revenue, group" and then the figure, its unit and its
17
+ * trend as one reading, rather than a run of loose words. The role and the name
18
+ * are set through `ElementInternals` once the label is known, which writes no
19
+ * attribute; a stat with no label has no role. Put a `Trend` in the `trend`
20
+ * slot to have it read inside the group, after the figure it qualifies.
21
+ *
15
22
  * @since 0.1.0
16
23
  * @status stable
17
24
  * @category data
@@ -19,7 +26,8 @@ import { type PropertyValues, type TemplateResult } from 'lit';
19
26
  * @documentation https://fusion.dev/helix/components/stat
20
27
  *
21
28
  * @slot - The value.
22
- * @slot label - What the value measures.
29
+ * @slot label - What the value measures, which also names the stat for a screen reader.
30
+ * @slot trend - How the value moved, usually a `Trend`, read after the value inside the stat's group.
23
31
  * @slot unit - The unit, shown beside the value.
24
32
  *
25
33
  * @csspart value - The slot the value is written in. A slot draws no box, so it takes the inherited properties, such as color and font, and passes them to the value.
@@ -40,10 +48,9 @@ export declare class HelixHeadlessStat extends HelixElement {
40
48
  * the value's baseline whichever way the pair goes, and only this element
41
49
  * knows which of its children the unit belongs to.
42
50
  *
43
- * **`Trend` has a `direction` too, and there it means which way a number
44
- * moved:** `up`, `down` or `neutral`. A Stat and a Trend are often written
45
- * side by side, so watch for the mix-up. On a Stat those three words are not
46
- * layouts, and the pair stays the column.
51
+ * The name and the values are `Flex`'s, which lays out the same way. Which
52
+ * way a number moved is `Trend`'s `movement`. On a Stat, `up`, `down` and
53
+ * `neutral` are not layouts, and the pair stays the column.
47
54
  *
48
55
  * **Optional rather than defaulted to `column`, which is not a style
49
56
  * preference.** A reflecting property with a default writes its attribute onto
@@ -54,6 +61,8 @@ export declare class HelixHeadlessStat extends HelixElement {
54
61
  * carries nothing nobody wrote.
55
62
  */
56
63
  direction?: 'column-reverse' | 'row' | 'row-reverse';
64
+ protected willUpdate(changed: PropertyValues): void;
65
+ protected firstUpdated(changed: PropertyValues): void;
57
66
  protected updated(changed: PropertyValues): void;
58
67
  protected render(): TemplateResult;
59
68
  }
@@ -4,10 +4,25 @@ 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 { customElement, HelixElement, reportRuntime } from '@fusion.dev/helix-core';
7
+ import { customElement, HelixElement, hostAria, reportRuntime, slottedWords, } from '@fusion.dev/helix-core';
8
8
  import { html } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
11
+ willUpdate(changed) {
12
+ super.willUpdate(changed);
13
+ const labels = this.knownChildren.filter((child) => child.slot === 'label');
14
+ hostAria(this.internals, {
15
+ label: labels.length > 0 && !('ariaLabelledByElements' in this.internals)
16
+ ? slottedWords(this, ['label'])
17
+ : '',
18
+ labelledBy: labels,
19
+ role: labels.length > 0 ? 'group' : '',
20
+ });
21
+ }
22
+ firstUpdated(changed) {
23
+ super.firstUpdated(changed);
24
+ this.finishHydration();
25
+ }
11
26
  updated(changed) {
12
27
  super.updated(changed);
13
28
  const given = this.direction;
@@ -15,16 +30,17 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
15
30
  reportRuntime({
16
31
  kind: 'misread-direction',
17
32
  message: `<${this.localName} direction="${given}"> lays out as the column: \`${given}\` is a ` +
18
- "direction of Trend's, which says which way a number moved. Put it on the " +
19
- '`helix-trend` beside the stat.',
33
+ "`movement` of Trend's, which says which way a number moved. Put it on the " +
34
+ "`helix-trend` in the stat's `trend` slot.",
20
35
  tag: this.localName,
21
36
  });
22
37
  }
23
38
  }
24
39
  render() {
25
- return html `<slot name="label"></slot>
40
+ return html `<slot name="label" @slotchange=${() => this.requestUpdate()}></slot>
26
41
  <slot part="value"></slot>
27
- <slot name="unit"></slot>`;
42
+ <slot name="unit"></slot>
43
+ <slot name="trend"></slot>`;
28
44
  }
29
45
  };
30
46
  __decorate([
@@ -13,3 +13,8 @@ export interface ReachableStep {
13
13
  * complete or optional, so no stage is passed unfinished.
14
14
  */
15
15
  export declare const canReach: (steps: readonly ReachableStep[], from: number, to: number) => boolean;
16
+ /**
17
+ * How far through a sequence is, from 0 to 100: the share of its stages that
18
+ * are complete, rounded to a whole number. An empty sequence is at 0.
19
+ */
20
+ export declare const progressOf: (steps: readonly Pick<ReachableStep, 'complete'>[]) => number;
@@ -10,3 +10,6 @@ export const canReach = (steps, from, to) => {
10
10
  }
11
11
  return true;
12
12
  };
13
+ export const progressOf = (steps) => steps.length === 0
14
+ ? 0
15
+ : Math.round((steps.filter((step) => step.complete).length / steps.length) * 100);
@@ -1,5 +1,6 @@
1
1
  import { HelixElement } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
+ import type { HelixHeadlessStep } from '../step/step.js';
3
4
  declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & typeof HelixElement;
4
5
  /**
5
6
  * @summary A sequence of stages that shows which stage the user is on.
@@ -16,9 +17,25 @@ declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.
16
17
  * `linear` keeps a reader from passing a stage they have not finished, as Ark
17
18
  * UI's linear steps do: a stage ahead is out of reach, and its button disabled,
18
19
  * until every stage before it is `complete` or `optional`. Going back is always
19
- * allowed. To check a stage before a reader leaves it, cancel
20
- * `helix-before-activate` while it is not valid. `next()` and `previous()` move
21
- * one stage either way, under the same rules, for your own buttons.
20
+ * allowed. `next()` and `previous()` move one stage either way, under the
21
+ * same rules, for your own buttons.
22
+ *
23
+ * To check a stage before a reader moves on from it, set `validate` to a
24
+ * function that answers whether the stage is valid, as Ark UI's `isStepValid`
25
+ * does. Moving forward asks it about the stage the reader is on, and where it
26
+ * answers `false` the reader stays and the stage is `:state(invalid)` until it
27
+ * answers `true`. An `optional` stage is not asked. `helix-before-activate`
28
+ * is still sent for every move, for a check of your own.
29
+ *
30
+ * `progress` is how far through the sequence is, from 0 to 100: the share of
31
+ * its stages that are `complete`. The `progress` part carries it as a
32
+ * `progressbar` and as `--steps-progress`, and is hidden until a stylesheet
33
+ * gives it a `display`, so a bar of your own costs nothing until you draw it.
34
+ * The sequence is `:state(complete)` once every stage is.
35
+ *
36
+ * The sequence is a list named by `label`, and each step a list item. The
37
+ * current stage's button says `aria-current="step"`, and a finished stage's
38
+ * button is described by its `complete-label`.
22
39
  *
23
40
  * @since 0.1.0
24
41
  * @status stable
@@ -31,6 +48,12 @@ declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.
31
48
  * @event {HelixActivateEvent} helix-activate - Fired after the current step changes, when the element already holds the new step.
32
49
  * @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the active step changes. Cancelable: cancel it to keep the current step.
33
50
  * @event {HelixSelectEvent} helix-select - Fired when a step is pressed. The step dispatches it, and you can listen for it on the sequence. Cancelable: cancel it to keep the current step.
51
+ *
52
+ * @csspart progress - How far through the sequence is, as a `progressbar` carrying `--steps-progress`. Hidden until a stylesheet gives it a `display`.
53
+ *
54
+ * @cssproperty --steps-progress - How far through the sequence is, as a percentage, written on the `progress` part.
55
+ *
56
+ * @cssstate complete - Every stage is complete.
34
57
  */
35
58
  export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
36
59
  /**
@@ -59,6 +82,17 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
59
82
  * catches people out.
60
83
  */
61
84
  orientation?: 'vertical';
85
+ /**
86
+ * A function that answers whether a stage is valid, asked about the stage a
87
+ * reader is on before they move forward from it. Return `false` to keep them
88
+ * there. Not asked of an `optional` stage, nor for a move back.
89
+ */
90
+ validate?: (step: HelixHeadlessStep) => boolean;
91
+ /**
92
+ * How far through the sequence is, from 0 to 100: the share of its stages
93
+ * that are `complete`, rounded to a whole number.
94
+ */
95
+ get progress(): number;
62
96
  /**
63
97
  * What each step is marked with.
64
98
  *
@@ -86,6 +120,12 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
86
120
  previous(): boolean;
87
121
  /** Moves `delta` stages, skipping disabled ones. */
88
122
  private step;
123
+ /**
124
+ * Whether the stage the reader is on lets them go to the stage at `index`,
125
+ * by `validate`. Only a move forward is asked, and an `optional` stage is
126
+ * never asked. The stage is marked invalid while the answer is no.
127
+ */
128
+ private valid;
89
129
  /** Whether the stage at `index` can be gone to from where the reader is. */
90
130
  private reachable;
91
131
  /** Marks the stages a linear sequence holds out of reach. Client only. */
@@ -108,7 +148,13 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
108
148
  private readonly handleSlotChange;
109
149
  connectedCallback(): void;
110
150
  disconnectedCallback(): void;
151
+ /**
152
+ * The steps where they can be known, and none on a server or while
153
+ * hydrating, so the progress drawn first is the server's.
154
+ */
155
+ private get known();
111
156
  protected willUpdate(changed: PropertyValues): void;
157
+ protected firstUpdated(changed: PropertyValues): void;
112
158
  protected updated(changed: PropertyValues): void;
113
159
  protected render(): TemplateResult;
114
160
  }