@fusion.dev/helix-headless 0.0.0-dev → 0.0.3
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.
- package/custom-elements.json +4513 -4483
- package/dist/accordion/item/accordion-item.d.ts +13 -15
- package/dist/accordion/item/accordion-item.js +15 -17
- package/dist/announcement/root/announcement-root.d.ts +7 -25
- package/dist/announcement/root/announcement-root.js +7 -20
- package/dist/app-header/root/app-header-root.d.ts +10 -17
- package/dist/app-header/root/app-header-root.js +9 -18
- package/dist/avatar/group/avatar-group.d.ts +10 -19
- package/dist/avatar/group/avatar-group.js +12 -17
- package/dist/avatar/root/avatar-root.d.ts +8 -8
- package/dist/avatar/root/avatar-root.js +19 -20
- package/dist/badge/root/badge-root.d.ts +6 -6
- package/dist/badge/root/badge-root.js +13 -13
- package/dist/bar-chart/root/bar-chart-root.d.ts +21 -29
- package/dist/bar-chart/root/bar-chart-root.js +42 -57
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +12 -18
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +13 -16
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -28
- package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -28
- package/dist/button/root/button-root.d.ts +84 -94
- package/dist/button/root/button-root.js +82 -92
- package/dist/callout/root/callout-root.d.ts +4 -5
- package/dist/carousel/root/carousel-root.d.ts +59 -71
- package/dist/carousel/root/carousel-root.js +73 -101
- package/dist/chat/composer/chat-composer.d.ts +29 -33
- package/dist/chat/composer/chat-composer.js +40 -44
- package/dist/chat/message/chat-message.d.ts +25 -25
- package/dist/chat/message/chat-message.js +26 -26
- package/dist/chat/root/chat-root.d.ts +28 -41
- package/dist/chat/root/chat-root.js +27 -40
- package/dist/checkbox/root/checkbox-root.d.ts +10 -12
- package/dist/checkbox/root/checkbox-root.js +29 -35
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +32 -45
- package/dist/checkbox-group/root/checkbox-group-root.js +53 -79
- package/dist/code-block/root/code-block-root.d.ts +3 -4
- package/dist/code-block/root/code-block-root.js +8 -12
- package/dist/color-input/root/color-input-root.d.ts +36 -37
- package/dist/color-input/root/color-input-root.js +29 -34
- package/dist/color-picker/color.d.ts +7 -8
- package/dist/color-picker/color.js +7 -8
- package/dist/color-picker/root/color-picker-root.d.ts +55 -57
- package/dist/color-picker/root/color-picker-root.js +60 -64
- package/dist/combobox/root/combobox-root.d.ts +53 -58
- package/dist/combobox/root/combobox-root.js +85 -94
- package/dist/command/root/command-root.d.ts +8 -8
- package/dist/command/root/command-root.js +29 -33
- package/dist/copy-button/root/copy-button-root.d.ts +21 -24
- package/dist/copy-button/root/copy-button-root.js +25 -35
- package/dist/data-table/root/data-table-root.d.ts +77 -76
- package/dist/data-table/root/data-table-root.js +95 -84
- package/dist/data-table/root/order.d.ts +2 -2
- package/dist/data-table/root/order.js +1 -3
- package/dist/date-input/root/date-input-root.d.ts +88 -93
- package/dist/date-input/root/date-input-root.js +147 -158
- package/dist/date-picker/root/date-picker-root.d.ts +75 -83
- package/dist/date-picker/root/date-picker-root.js +120 -143
- package/dist/dialog/root/dialog-root.d.ts +41 -24
- package/dist/dialog/root/dialog-root.js +47 -24
- package/dist/divider/root/divider-root.d.ts +5 -6
- package/dist/divider/root/divider-root.js +4 -5
- package/dist/donut-chart/root/donut-chart-root.d.ts +22 -25
- package/dist/donut-chart/root/donut-chart-root.js +37 -51
- package/dist/drawer/root/drawer-root.d.ts +24 -29
- package/dist/drawer/root/drawer-root.js +15 -22
- package/dist/drilldown/item/drilldown-item.d.ts +14 -14
- package/dist/drilldown/item/drilldown-item.js +24 -26
- package/dist/drilldown/root/drilldown-root.d.ts +8 -10
- package/dist/drilldown/root/drilldown-root.js +6 -7
- package/dist/element-events.generated.js +1 -1
- package/dist/file-input/root/file-input-root.d.ts +20 -24
- package/dist/file-input/root/file-input-root.js +42 -57
- package/dist/format-date/root/format-date-root.js +1 -1
- package/dist/heatmap/root/buckets.d.ts +8 -8
- package/dist/heatmap/root/buckets.js +8 -8
- package/dist/heatmap/root/heatmap-root.d.ts +57 -63
- package/dist/heatmap/root/heatmap-root.js +72 -83
- package/dist/icon/root/icon-root.d.ts +4 -4
- package/dist/icon/root/icon-root.js +9 -9
- package/dist/icon-button/root/icon-button-root.d.ts +4 -6
- package/dist/icon-button/root/icon-button-root.js +4 -6
- package/dist/image/root/image-root.d.ts +49 -59
- package/dist/image/root/image-root.js +55 -65
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/input/root/input-root.d.ts +61 -85
- package/dist/input/root/input-root.js +79 -106
- package/dist/kbd/root/kbd-root.d.ts +8 -7
- package/dist/kbd/root/kbd-root.js +71 -11
- package/dist/legend/root/legend-root.d.ts +1 -1
- package/dist/legend/root/legend-root.js +4 -5
- package/dist/line-chart/root/line-chart-root.d.ts +26 -30
- package/dist/line-chart/root/line-chart-root.js +10 -10
- package/dist/list/item/list-item.d.ts +14 -18
- package/dist/list/item/list-item.js +18 -22
- package/dist/list/root/list-root.d.ts +4 -4
- package/dist/list/root/list-root.js +3 -3
- package/dist/listbox/root/listbox-root.d.ts +31 -58
- package/dist/listbox/root/listbox-root.js +66 -109
- package/dist/megamenu/root/megamenu-root.d.ts +34 -35
- package/dist/megamenu/root/megamenu-root.js +53 -58
- package/dist/menu/item/menu-item.d.ts +39 -53
- package/dist/menu/item/menu-item.js +50 -64
- package/dist/menu/root/menu-root.d.ts +30 -40
- package/dist/menu/root/menu-root.js +49 -82
- package/dist/meter/root/meter-root.d.ts +49 -53
- package/dist/meter/root/meter-root.js +22 -27
- package/dist/navigation/root/navigation-root.js +11 -19
- package/dist/notifications/notification/notification.d.ts +16 -22
- package/dist/notifications/notification/notification.js +21 -27
- package/dist/notifications/root/notifications-root.d.ts +31 -39
- package/dist/notifications/root/notifications-root.js +41 -52
- package/dist/number-input/root/number-input-root.d.ts +31 -33
- package/dist/number-input/root/number-input-root.js +37 -39
- package/dist/option/root/option-root.d.ts +73 -74
- package/dist/option/root/option-root.js +62 -64
- package/dist/outline/root/outline-root.d.ts +38 -44
- package/dist/outline/root/outline-root.js +66 -82
- package/dist/pagination/root/pagination-root.d.ts +87 -92
- package/dist/pagination/root/pagination-root.js +116 -123
- package/dist/pagination/size/pagination-size.d.ts +31 -50
- package/dist/pagination/size/pagination-size.js +35 -55
- package/dist/pagination/summary/pagination-summary.d.ts +12 -12
- package/dist/pagination/summary/pagination-summary.js +18 -18
- package/dist/pin-input/root/pin-input-root.d.ts +53 -70
- package/dist/pin-input/root/pin-input-root.js +74 -94
- package/dist/popover/root/popover-root.d.ts +15 -20
- package/dist/popover/root/popover-root.js +19 -36
- package/dist/progress/root/progress-root.d.ts +12 -14
- package/dist/progress/root/progress-root.js +22 -25
- package/dist/qr-code/root/qr-code-root.d.ts +11 -11
- package/dist/qr-code/root/qr-code-root.js +12 -14
- package/dist/radio/group/radio-group.js +19 -26
- package/dist/radio/root/radio-root.d.ts +12 -13
- package/dist/radio/root/radio-root.js +12 -13
- package/dist/rating/root/rating-root.d.ts +25 -30
- package/dist/rating/root/rating-root.js +43 -50
- package/dist/scroll-area/root/scroll-area-root.d.ts +11 -14
- package/dist/scroll-area/root/scroll-area-root.js +39 -33
- package/dist/select/root/select-root.d.ts +7 -12
- package/dist/select/root/select-root.js +40 -55
- package/dist/slider/root/slider-root.d.ts +53 -60
- package/dist/slider/root/slider-root.js +74 -85
- package/dist/sparkline/root/sparkline-root.d.ts +43 -47
- package/dist/sparkline/root/sparkline-root.js +23 -32
- package/dist/speed-dial/item/speed-dial-item.d.ts +6 -6
- package/dist/speed-dial/item/speed-dial-item.js +9 -9
- package/dist/speed-dial/root/speed-dial-root.d.ts +21 -25
- package/dist/speed-dial/root/speed-dial-root.js +32 -40
- package/dist/splitter/root/splitter-root.d.ts +98 -111
- package/dist/splitter/root/splitter-root.js +96 -123
- package/dist/stat/root/stat-root.d.ts +2 -7
- package/dist/stat/root/stat-root.js +0 -5
- package/dist/steps/step/step.d.ts +19 -24
- package/dist/steps/step/step.js +27 -32
- package/dist/switch/root/switch-root.js +2 -2
- package/dist/table/column/table-column.d.ts +54 -60
- package/dist/table/column/table-column.js +95 -68
- package/dist/table/root/table-root.d.ts +5 -6
- package/dist/table/root/table-root.js +7 -10
- package/dist/tabs/panel/tab-panel.d.ts +21 -25
- package/dist/tabs/panel/tab-panel.js +25 -29
- package/dist/tabs/root/tabs-root.d.ts +25 -34
- package/dist/tabs/root/tabs-root.js +22 -28
- package/dist/tabs/tab/tab.d.ts +12 -12
- package/dist/tabs/tab/tab.js +19 -20
- package/dist/textarea/root/textarea-root.d.ts +36 -36
- package/dist/textarea/root/textarea-root.js +43 -47
- package/dist/time-input/root/time-input-root.d.ts +58 -68
- package/dist/time-input/root/time-input-root.js +62 -77
- package/dist/time-picker/root/time-picker-root.d.ts +73 -79
- package/dist/time-picker/root/time-picker-root.js +72 -84
- package/dist/timeline/item/timeline-item.d.ts +8 -11
- package/dist/timeline/item/timeline-item.js +8 -11
- package/dist/timeline/root/timeline-root.d.ts +5 -7
- package/dist/timeline/root/timeline-root.js +5 -7
- package/dist/toast/item/toast-item.d.ts +9 -27
- package/dist/toast/item/toast-item.js +19 -41
- package/dist/toast/root/toast-root.d.ts +10 -14
- package/dist/toast/root/toast-root.js +4 -5
- package/dist/toggle/group/toggle-group.d.ts +6 -15
- package/dist/toggle/group/toggle-group.js +21 -36
- package/dist/toggle/root/toggle-root.d.ts +26 -27
- package/dist/toggle/root/toggle-root.js +30 -31
- package/dist/toolbar/root/toolbar-root.d.ts +7 -10
- package/dist/toolbar/root/toolbar-root.js +10 -14
- package/dist/tooltip/root/tooltip-root.d.ts +52 -59
- package/dist/tooltip/root/tooltip-root.js +98 -93
- package/dist/tour/root/tour-root.d.ts +19 -23
- package/dist/tour/root/tour-root.js +31 -41
- package/dist/tour/stop/tour-stop.d.ts +14 -15
- package/dist/tour/stop/tour-stop.js +31 -34
- package/dist/tree/item/tree-item.d.ts +30 -35
- package/dist/tree/item/tree-item.js +43 -55
- package/dist/tree/root/tree-root.d.ts +7 -10
- package/dist/tree/root/tree-root.js +33 -42
- package/dist/trend/root/trend-root.d.ts +3 -5
- package/dist/trend/root/trend-root.js +5 -9
- package/dist/video/root/video-root.d.ts +100 -124
- package/dist/video/root/video-root.js +142 -176
- package/dist/video-playlist/item/video-playlist-item.d.ts +16 -16
- package/dist/video-playlist/item/video-playlist-item.js +24 -24
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -8
- package/dist/video-playlist/menu/video-playlist-menu.js +20 -29
- package/dist/video-playlist/root/video-playlist-root.d.ts +16 -11
- package/dist/video-playlist/root/video-playlist-root.js +21 -25
- package/dist/virtual-list/root/virtual-list-root.d.ts +8 -12
- package/dist/virtual-list/root/virtual-list-root.js +11 -16
- package/jsx.d.ts +9797 -12561
- package/package.json +6 -6
- package/vue.d.ts +2684 -3228
|
@@ -13,14 +13,12 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
|
13
13
|
* @summary One node in a tree.
|
|
14
14
|
*
|
|
15
15
|
* @description
|
|
16
|
-
* **`open`, on `MixinControllerOpen`,
|
|
17
|
-
*
|
|
18
|
-
* `AccordionItem`
|
|
19
|
-
* neither
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* renders, because that is the attribute a tree uses; the property is what
|
|
23
|
-
* changed, not the semantics.
|
|
16
|
+
* **`open`, on `MixinControllerOpen`, rather than a bare boolean of its own.** A
|
|
17
|
+
* branch showing its children is the same state a disclosure holds, and
|
|
18
|
+
* `AccordionItem` is on that mixin too. A hand-written toggle announces nothing,
|
|
19
|
+
* so a consumer can neither know a branch opened nor own the state.
|
|
20
|
+
* `aria-expanded` is still what the row renders, because that is the attribute a
|
|
21
|
+
* tree uses; the property is what differs, not the semantics.
|
|
24
22
|
*
|
|
25
23
|
* An element rather than a slot because it owns state: whether it is open,
|
|
26
24
|
* whether it is selected, and whether it is the one holding focus.
|
|
@@ -81,10 +79,6 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
|
81
79
|
let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerOpen(HelixElement) {
|
|
82
80
|
constructor() {
|
|
83
81
|
super(...arguments);
|
|
84
|
-
/**
|
|
85
|
-
* Identifies the item to the consumer, carried in `helix-select`.
|
|
86
|
-
*/
|
|
87
|
-
this.value = '';
|
|
88
82
|
/**
|
|
89
83
|
* Where this node goes, which makes its row a real link.
|
|
90
84
|
*
|
|
@@ -93,10 +87,6 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
93
87
|
* current page on every item a consumer never asked to be one.
|
|
94
88
|
*/
|
|
95
89
|
this.href = '';
|
|
96
|
-
/**
|
|
97
|
-
* Where the link opens, for the rare row that leaves the site.
|
|
98
|
-
*/
|
|
99
|
-
this.target = '';
|
|
100
90
|
/**
|
|
101
91
|
* What the link declares about where it goes.
|
|
102
92
|
*
|
|
@@ -111,16 +101,21 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
111
101
|
*
|
|
112
102
|
* Not reflected, for the reason `level` below gives in full: the tree assigns
|
|
113
103
|
* this after it upgrades, so the attribute would be a change to markup the
|
|
114
|
-
* consumer rendered and hydration would report it.
|
|
115
|
-
*
|
|
104
|
+
* consumer rendered and hydration would report it. Mirroring to
|
|
105
|
+
* `data-selected` on the host instead is the same fault under another name.
|
|
116
106
|
*
|
|
117
|
-
* The stylesheet reads it from the row inside this shadow root,
|
|
118
|
-
*
|
|
119
|
-
* onto the row rather than onto the host, because the row is not part of the
|
|
120
|
-
* tree React hydrates. Mirroring to `data-selected` on the host instead was
|
|
121
|
-
* the same fault with a different name, and React said so.
|
|
107
|
+
* The stylesheet reads it from the row inside this shadow root, because the
|
|
108
|
+
* row is not part of the tree React hydrates.
|
|
122
109
|
*/
|
|
123
110
|
this.selected = false;
|
|
111
|
+
/**
|
|
112
|
+
* Where the link opens, for the rare row that leaves the site.
|
|
113
|
+
*/
|
|
114
|
+
this.target = '';
|
|
115
|
+
/**
|
|
116
|
+
* Identifies the item to the consumer, carried in `helix-select`.
|
|
117
|
+
*/
|
|
118
|
+
this.value = '';
|
|
124
119
|
/**
|
|
125
120
|
* Whether this item holds the tree's single tab stop.
|
|
126
121
|
*/
|
|
@@ -142,14 +137,10 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
142
137
|
};
|
|
143
138
|
this.handleRowClick = (event) => {
|
|
144
139
|
/* A press that landed on a link is that link's, whichever branch of this
|
|
145
|
-
runs
|
|
146
|
-
|
|
147
|
-
the
|
|
148
|
-
|
|
149
|
-
`open` false and the route changed from the one press.
|
|
150
|
-
|
|
151
|
-
"There is nowhere else for the press to mean" was true of a row holding
|
|
152
|
-
a label, and a slot is somewhere else. */
|
|
140
|
+
runs, and the test has to be made on both sides. A row can hold a link in
|
|
141
|
+
its `end` slot, and asked on one side only, pressing that link collapses
|
|
142
|
+
the branch on the way out: one press, `open` false and the route
|
|
143
|
+
changed. */
|
|
153
144
|
const onLink = event.composedPath().some((node) => node instanceof HTMLAnchorElement);
|
|
154
145
|
/* A branch that is also a link goes where it points, and its chevron is
|
|
155
146
|
what opens it. A branch that is not toggles from anywhere in the row. */
|
|
@@ -195,10 +186,8 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
195
186
|
every scrollable ancestor and reveal the element, which is
|
|
196
187
|
`scrollIntoView` by another route and takes the page with it. The root
|
|
197
188
|
calls `scrollItemIntoView` on the next line precisely to avoid that, and
|
|
198
|
-
without this the careful call
|
|
199
|
-
prevent
|
|
200
|
-
at all: measured in Chrome, a tree in a scroller scrolled either way, so
|
|
201
|
-
the util could have been scrolling nothing and nobody would have seen. */
|
|
189
|
+
without this the careful call arrives after the thing it exists to
|
|
190
|
+
prevent has already happened. */
|
|
202
191
|
this.renderRoot
|
|
203
192
|
.querySelector(this.href === '' ? '[part="item"]' : '[part="row"]')
|
|
204
193
|
?.focus({ preventScroll: true });
|
|
@@ -212,9 +201,9 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
212
201
|
*
|
|
213
202
|
* Selecting and following are two things and this is where they meet, so the
|
|
214
203
|
* pointer and the keyboard take one path to the same end. The tree calls this
|
|
215
|
-
* rather than `select` for the keyboard,
|
|
216
|
-
*
|
|
217
|
-
*
|
|
204
|
+
* rather than `select` for the keyboard, or a nav tree whose rows are links
|
|
205
|
+
* could be walked with the arrows and never entered: choosing announces a
|
|
206
|
+
* value and nothing listens for it.
|
|
218
207
|
*/
|
|
219
208
|
activate() {
|
|
220
209
|
this.select();
|
|
@@ -281,9 +270,9 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
281
270
|
/**
|
|
282
271
|
* Mirrors the chosen state where a stylesheet can select on it.
|
|
283
272
|
*
|
|
284
|
-
* **A custom state
|
|
285
|
-
*
|
|
286
|
-
*
|
|
273
|
+
* **A custom state, never a reflected `selected` attribute.** The parent
|
|
274
|
+
* writes this: a listbox choosing a row, a tab strip moving the tab, a radio
|
|
275
|
+
* group answering for its set. Reflected, that puts the element's own
|
|
287
276
|
* bookkeeping onto markup a consumer wrote and a consumer's server never sent,
|
|
288
277
|
* which React reconciles and reports as a mismatch, and which a serialized
|
|
289
278
|
* element pasted back declares as a choice nobody made. `ElementInternals`
|
|
@@ -291,7 +280,7 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
291
280
|
*
|
|
292
281
|
* Reading `selected` is unaffected and so is writing it: the attribute still
|
|
293
282
|
* seeds the property, which is what `<helix-tree-item selected>` in a consumer's
|
|
294
|
-
* markup means. What stops is the write back.
|
|
283
|
+
* markup means. What stops is the write back.
|
|
295
284
|
*/
|
|
296
285
|
willUpdate(changed) {
|
|
297
286
|
super.willUpdate(changed);
|
|
@@ -307,8 +296,7 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
307
296
|
* sibling, which is the navigation flavor of the pattern.
|
|
308
297
|
*
|
|
309
298
|
* Without one, nothing changes: the wrapper is the `treeitem` and holds the
|
|
310
|
-
* group, which is what an `<li>` holding a `<ul>` is
|
|
311
|
-
* fixed to be when the group rendered outside the node it belonged to. */
|
|
299
|
+
* group, which is what an `<li>` holding a `<ul>` is. */
|
|
312
300
|
const linked = this.href !== '';
|
|
313
301
|
const level = this.level ?? 1;
|
|
314
302
|
const expanded = this.branch ? (this.open ? 'true' : 'false') : nothing;
|
|
@@ -340,10 +328,10 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
340
328
|
style="--tree-level: ${level}"
|
|
341
329
|
@click=${this.handleRowClick}
|
|
342
330
|
>${this.renderRow()}</div>`}
|
|
343
|
-
<!-- Inside the treeitem, not beside it.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
331
|
+
<!-- Inside the treeitem, not beside it. As a sibling, the row's
|
|
332
|
+
\`aria-expanded\` describes a group the row does not own and the
|
|
333
|
+
branch reports children it has no relationship to. The pattern is
|
|
334
|
+
\`treeitem\` containing \`group\`, which is also what an \`<li>\`
|
|
347
335
|
holding a \`<ul>\` is. -->
|
|
348
336
|
<div part="group" role="group" ?hidden=${!this.open}>
|
|
349
337
|
<slot name="children"></slot>
|
|
@@ -351,15 +339,12 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
351
339
|
</div>`;
|
|
352
340
|
}
|
|
353
341
|
};
|
|
354
|
-
__decorate([
|
|
355
|
-
property()
|
|
356
|
-
], HelixHeadlessTreeItem.prototype, "value", void 0);
|
|
357
342
|
__decorate([
|
|
358
343
|
property()
|
|
359
344
|
], HelixHeadlessTreeItem.prototype, "href", void 0);
|
|
360
345
|
__decorate([
|
|
361
|
-
property()
|
|
362
|
-
], HelixHeadlessTreeItem.prototype, "
|
|
346
|
+
property({ attribute: 'level', type: Number })
|
|
347
|
+
], HelixHeadlessTreeItem.prototype, "level", void 0);
|
|
363
348
|
__decorate([
|
|
364
349
|
property()
|
|
365
350
|
], HelixHeadlessTreeItem.prototype, "rel", void 0);
|
|
@@ -367,8 +352,11 @@ __decorate([
|
|
|
367
352
|
property({ type: Boolean })
|
|
368
353
|
], HelixHeadlessTreeItem.prototype, "selected", void 0);
|
|
369
354
|
__decorate([
|
|
370
|
-
property(
|
|
371
|
-
], HelixHeadlessTreeItem.prototype, "
|
|
355
|
+
property()
|
|
356
|
+
], HelixHeadlessTreeItem.prototype, "target", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
property()
|
|
359
|
+
], HelixHeadlessTreeItem.prototype, "value", void 0);
|
|
372
360
|
__decorate([
|
|
373
361
|
state()
|
|
374
362
|
], HelixHeadlessTreeItem.prototype, "focusable", void 0);
|
|
@@ -38,10 +38,9 @@ export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
|
38
38
|
/**
|
|
39
39
|
* Every item, in the order a reader moving down would meet them.
|
|
40
40
|
*
|
|
41
|
-
* Selected by tag
|
|
42
|
-
*
|
|
43
|
-
* whatever a consumer slotted into a row included
|
|
44
|
-
* on a tree of any size that is the array a single arrow press rebuilds.
|
|
41
|
+
* Selected by tag, never by `'*'` and a filter: this is the array a single
|
|
42
|
+
* arrow press rebuilds, and `'*'` makes it every descendant element in the
|
|
43
|
+
* tree, labels and icons and whatever a consumer slotted into a row included.
|
|
45
44
|
*
|
|
46
45
|
* The two tag names rather than `instanceof` on everything: a styled
|
|
47
46
|
* `helix-tree-item` extends the base, so both names are needed, and the
|
|
@@ -66,12 +65,10 @@ export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
|
66
65
|
/**
|
|
67
66
|
* A branch opened or closed, whoever did it.
|
|
68
67
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* item's own open events covers every way a branch can move, including a
|
|
74
|
-
* consumer setting `open` directly.
|
|
68
|
+
* Listening for the item's own open events rather than calling `syncItems`
|
|
69
|
+
* from each keyboard path: that misses the pointer, and collapsing a branch
|
|
70
|
+
* by clicking its chevron then leaves the tree's one tab stop on a row inside
|
|
71
|
+
* the subtree just hidden. It also covers a consumer setting `open` directly.
|
|
75
72
|
*/
|
|
76
73
|
private readonly handleBranch;
|
|
77
74
|
connectedCallback(): void;
|
|
@@ -54,25 +54,24 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
54
54
|
* Accessible name for the tree.
|
|
55
55
|
*/
|
|
56
56
|
this.label = 'Tree';
|
|
57
|
-
/* Through the mixin, so a consumer can refuse the change.
|
|
58
|
-
straight from the event
|
|
59
|
-
|
|
57
|
+
/* Through the mixin, so a consumer can refuse the change. Writing the value
|
|
58
|
+
straight from the event makes `helix-before-activate` an announcement
|
|
59
|
+
nobody can answer. */
|
|
60
60
|
this.handleSelection = (event) => {
|
|
61
61
|
this.requestActive(event.detail.value);
|
|
62
62
|
this.syncItems();
|
|
63
63
|
};
|
|
64
64
|
this.handleKeydown = (event) => {
|
|
65
|
-
/* The innermost item the press came from, which `find`
|
|
65
|
+
/* The innermost item the press came from, which `find` cannot give.
|
|
66
66
|
*
|
|
67
67
|
* `items` is every tree item in document order and a nested one is inside
|
|
68
|
-
* all of its ancestors, so `entry.contains(target)`
|
|
69
|
-
* ancestor first
|
|
70
|
-
* branch instead. The
|
|
71
|
-
* and the shallow cases it was written against all looked right.
|
|
68
|
+
* all of its ancestors, so `entry.contains(target)` matches the outermost
|
|
69
|
+
* ancestor first and every key pressed on a nested node moves the root of
|
|
70
|
+
* its branch instead. The shallow cases all look right.
|
|
72
71
|
*
|
|
73
72
|
* `closestInstance` walks up by identity and crosses shadow roots on the
|
|
74
|
-
* way, which is the util that exists for exactly this. `closest('*')`
|
|
75
|
-
*
|
|
73
|
+
* way, which is the util that exists for exactly this. `closest('*')` is a
|
|
74
|
+
* no-op: it returns the element it was called on. */
|
|
76
75
|
const current = closestInstance(event.target, HelixHeadlessTreeItem);
|
|
77
76
|
if (!current || !this.items.includes(current) || !KEYS.has(event.key)) {
|
|
78
77
|
return;
|
|
@@ -116,10 +115,10 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
116
115
|
this.syncItems();
|
|
117
116
|
}
|
|
118
117
|
else {
|
|
119
|
-
/* `activate`, not `select`.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
/* `activate`, not `select`. Announcing the choice and stopping there
|
|
119
|
+
leaves a tree used as navigation walkable with the arrows and never
|
|
120
|
+
enterable: the pointer has a link under it and the keyboard has
|
|
121
|
+
nothing. */
|
|
123
122
|
current.activate();
|
|
124
123
|
}
|
|
125
124
|
}
|
|
@@ -128,12 +127,10 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
128
127
|
/**
|
|
129
128
|
* A branch opened or closed, whoever did it.
|
|
130
129
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* item's own open events covers every way a branch can move, including a
|
|
136
|
-
* consumer setting `open` directly.
|
|
130
|
+
* Listening for the item's own open events rather than calling `syncItems`
|
|
131
|
+
* from each keyboard path: that misses the pointer, and collapsing a branch
|
|
132
|
+
* by clicking its chevron then leaves the tree's one tab stop on a row inside
|
|
133
|
+
* the subtree just hidden. It also covers a consumer setting `open` directly.
|
|
137
134
|
*/
|
|
138
135
|
this.handleBranch = () => {
|
|
139
136
|
this.syncItems();
|
|
@@ -142,10 +139,9 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
142
139
|
/**
|
|
143
140
|
* Every item, in the order a reader moving down would meet them.
|
|
144
141
|
*
|
|
145
|
-
* Selected by tag
|
|
146
|
-
*
|
|
147
|
-
* whatever a consumer slotted into a row included
|
|
148
|
-
* on a tree of any size that is the array a single arrow press rebuilds.
|
|
142
|
+
* Selected by tag, never by `'*'` and a filter: this is the array a single
|
|
143
|
+
* arrow press rebuilds, and `'*'` makes it every descendant element in the
|
|
144
|
+
* tree, labels and icons and whatever a consumer slotted into a row included.
|
|
149
145
|
*
|
|
150
146
|
* The two tag names rather than `instanceof` on everything: a styled
|
|
151
147
|
* `helix-tree-item` extends the base, so both names are needed, and the
|
|
@@ -178,16 +174,13 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
178
174
|
syncItems() {
|
|
179
175
|
const visible = this.visibleItems;
|
|
180
176
|
/* Through the mixin, which resolves an exact match and otherwise falls back
|
|
181
|
-
to the first item.
|
|
182
|
-
|
|
183
|
-
about a check that could not be running. `Tree.Item` is the only
|
|
184
|
-
selectable row in the library without one, which is worth knowing and is
|
|
185
|
-
not this line's business to fix. */
|
|
177
|
+
to the first item. No disabled rows are skipped, because `Tree.Item` is
|
|
178
|
+
the only selectable row in the library with no `disabled` property. */
|
|
186
179
|
const chosen = this.resolveActive(visible);
|
|
187
|
-
/* The keyboard keeps its place
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
180
|
+
/* The keyboard keeps its place: the stop moves only when the row holding it
|
|
181
|
+
is no longer reachable. Bound to the selection instead, a branch opening
|
|
182
|
+
or a child arriving throws the reader back to the selected row from
|
|
183
|
+
wherever they had arrowed to. */
|
|
191
184
|
const held = visible.find((item) => item.focusable);
|
|
192
185
|
const stop = held ?? chosen;
|
|
193
186
|
for (const item of this.items) {
|
|
@@ -218,11 +211,9 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
218
211
|
entry.focusable = entry === item;
|
|
219
212
|
}
|
|
220
213
|
item.focusItem();
|
|
221
|
-
/* And bring it into view,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
something they could not see.
|
|
225
|
-
|
|
214
|
+
/* And bring it into view, or focus lands below the fold and the tree stays
|
|
215
|
+
where it is.
|
|
216
|
+
|
|
226
217
|
Not `scrollIntoView`, which scrolls every scrollable ancestor including
|
|
227
218
|
the page. A reader who pressed Down in a sidebar did not ask the document
|
|
228
219
|
to move. */
|
|
@@ -235,10 +226,10 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
235
226
|
this.addEventListener('helix-before-close', this.handleBranch);
|
|
236
227
|
this.addEventListener('keydown', this.handleKeydown);
|
|
237
228
|
/* Nested items arrive on a *branch's* slot, not on this element's, so the
|
|
238
|
-
root's `slotchange` never fires for them: a subtree
|
|
239
|
-
paint
|
|
240
|
-
wrong indent with no way into it. A
|
|
241
|
-
|
|
229
|
+
root's `slotchange` never fires for them: without this, a subtree
|
|
230
|
+
rendered after first paint gets no `level`, no `selected` and no
|
|
231
|
+
`focusable`, and sits at the wrong indent with no way into it. A
|
|
232
|
+
framework filling a branch on demand is exactly that case. */
|
|
242
233
|
this.watcher = new MutationObserver(() => this.syncItems());
|
|
243
234
|
this.watcher.observe(this, { childList: true, subtree: true });
|
|
244
235
|
}
|
|
@@ -12,12 +12,10 @@ import { type TemplateResult } from 'lit';
|
|
|
12
12
|
* **`good` is absent by default, so an unjudged trend is gray.** Every
|
|
13
13
|
* dashboard convention says up is green, and for churn, latency, error rate,
|
|
14
14
|
* cost and bounce rate that convention is a lie told in the most legible color
|
|
15
|
-
* on the page.
|
|
16
|
-
*
|
|
17
|
-
* which is the cheaper failure. State the metric's polarity once and the
|
|
18
|
-
* component does the part that varies.
|
|
15
|
+
* on the page. State the metric's polarity once and the component does the part
|
|
16
|
+
* that varies.
|
|
19
17
|
*
|
|
20
|
-
* The direction is also written as a word, because a
|
|
18
|
+
* The direction is also written as a word, because a colored arrow says
|
|
21
19
|
* nothing to a reader who is not looking at it. `part="direction"` is what the
|
|
22
20
|
* styled tier clips out of sight and leaves in the accessibility tree.
|
|
23
21
|
*
|
|
@@ -35,12 +35,10 @@ const readDirection = (value) => DIRECTIONS[value] ?? DIRECTIONS.neutral;
|
|
|
35
35
|
* **`good` is absent by default, so an unjudged trend is gray.** Every
|
|
36
36
|
* dashboard convention says up is green, and for churn, latency, error rate,
|
|
37
37
|
* cost and bounce rate that convention is a lie told in the most legible color
|
|
38
|
-
* on the page.
|
|
39
|
-
*
|
|
40
|
-
* which is the cheaper failure. State the metric's polarity once and the
|
|
41
|
-
* component does the part that varies.
|
|
38
|
+
* on the page. State the metric's polarity once and the component does the part
|
|
39
|
+
* that varies.
|
|
42
40
|
*
|
|
43
|
-
* The direction is also written as a word, because a
|
|
41
|
+
* The direction is also written as a word, because a colored arrow says
|
|
44
42
|
* nothing to a reader who is not looking at it. `part="direction"` is what the
|
|
45
43
|
* styled tier clips out of sight and leaves in the accessibility tree.
|
|
46
44
|
*
|
|
@@ -73,13 +71,11 @@ let HelixHeadlessTrend = class HelixHeadlessTrend extends HelixElement {
|
|
|
73
71
|
/* One interpolation rather than two, so the phrase is one text node.
|
|
74
72
|
Lit SSR writes a `<!--lit-part-->` marker around every binding, and two
|
|
75
73
|
bindings put a pair of comments between "Up" and ", worse" in the served
|
|
76
|
-
markup
|
|
77
|
-
server output should read as the thing the DOM will hold, and a test
|
|
78
|
-
against it should be able to say so in one string. */
|
|
74
|
+
markup, which a spec then cannot assert in one string. */
|
|
79
75
|
/* Written out rather than through `drawIcon`, because this one needs a
|
|
80
76
|
`part` and a part behind an interpolation is one the manifest cannot see:
|
|
81
77
|
the helper's `part=${…}` binding took `[part="icon"]` out of the
|
|
82
|
-
stylesheet's reach
|
|
78
|
+
stylesheet's reach. */
|
|
83
79
|
return html `<svg
|
|
84
80
|
aria-hidden="true"
|
|
85
81
|
data-glyph
|