@fusion.dev/helix-headless 0.143.0 → 0.145.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.
- package/custom-elements.json +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -4,21 +4,51 @@ 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, SourceController, seriesIndex, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { commaList, customElement, HelixBeforeChangeEvent, HelixElement, requestChange, SourceController, seriesIndex, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { isHidden, toggledNames } from '../hidden-series.js';
|
|
10
11
|
let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
13
14
|
this.for = '';
|
|
15
|
+
this.hiddenSeries = '';
|
|
14
16
|
this.label = '';
|
|
17
|
+
this.toggles = false;
|
|
15
18
|
this.source = new SourceController(this);
|
|
19
|
+
this.wrote = false;
|
|
16
20
|
}
|
|
17
21
|
willUpdate(changed) {
|
|
18
22
|
if (changed.has('for')) {
|
|
19
23
|
this.source.watch();
|
|
20
24
|
}
|
|
21
25
|
}
|
|
26
|
+
updated(changed) {
|
|
27
|
+
super.updated(changed);
|
|
28
|
+
const names = commaList(this.hiddenSeries);
|
|
29
|
+
if (names.length > 0 || this.wrote) {
|
|
30
|
+
this.source.hide(names);
|
|
31
|
+
this.wrote = names.length > 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
if (this.wrote) {
|
|
36
|
+
this.source.hide([]);
|
|
37
|
+
this.wrote = false;
|
|
38
|
+
}
|
|
39
|
+
super.disconnectedCallback();
|
|
40
|
+
}
|
|
41
|
+
toggle(name) {
|
|
42
|
+
requestChange({
|
|
43
|
+
apply: (value) => {
|
|
44
|
+
this.hiddenSeries = value;
|
|
45
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
46
|
+
},
|
|
47
|
+
event: (value) => new HelixBeforeChangeEvent({ value }),
|
|
48
|
+
host: this,
|
|
49
|
+
next: toggledNames(this.hiddenSeries, name),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
22
52
|
names() {
|
|
23
53
|
const series = this.source.series;
|
|
24
54
|
if (this.entries === 'categories') {
|
|
@@ -29,16 +59,29 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
|
29
59
|
render() {
|
|
30
60
|
const named = this.label || this.source.element?.querySelector('caption')?.textContent?.trim();
|
|
31
61
|
return html `<ul aria-label=${named || nothing} part="list" role="list">
|
|
32
|
-
${this.names().map((name, index) =>
|
|
62
|
+
${this.names().map((name, index) => {
|
|
63
|
+
const off = isHidden(this.hiddenSeries, name);
|
|
64
|
+
return html `<li
|
|
33
65
|
data-series=${seriesIndex(index)}
|
|
34
|
-
part="entry"
|
|
66
|
+
part="entry${off ? ' entry-hidden' : ''}"
|
|
35
67
|
style="--chart-series: var(--chart-series-${seriesIndex(index)})"
|
|
36
68
|
role="listitem"
|
|
37
69
|
>
|
|
38
|
-
|
|
39
|
-
</li
|
|
70
|
+
${this.toggles ? this.renderToggle(name, off) : html `<span part="name">${name}</span>`}
|
|
71
|
+
</li>`;
|
|
72
|
+
})}
|
|
40
73
|
</ul>`;
|
|
41
74
|
}
|
|
75
|
+
renderToggle(name, off) {
|
|
76
|
+
return html `<button
|
|
77
|
+
aria-pressed=${off ? 'false' : 'true'}
|
|
78
|
+
part="toggle"
|
|
79
|
+
type="button"
|
|
80
|
+
@click=${() => this.toggle(name)}
|
|
81
|
+
>
|
|
82
|
+
<span part="name">${name}</span>
|
|
83
|
+
</button>`;
|
|
84
|
+
}
|
|
42
85
|
};
|
|
43
86
|
__decorate([
|
|
44
87
|
property({ reflect: true })
|
|
@@ -46,9 +89,15 @@ __decorate([
|
|
|
46
89
|
__decorate([
|
|
47
90
|
property()
|
|
48
91
|
], HelixHeadlessLegend.prototype, "for", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ attribute: 'hidden-series' })
|
|
94
|
+
], HelixHeadlessLegend.prototype, "hiddenSeries", void 0);
|
|
49
95
|
__decorate([
|
|
50
96
|
property()
|
|
51
97
|
], HelixHeadlessLegend.prototype, "label", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ reflect: true, type: Boolean })
|
|
100
|
+
], HelixHeadlessLegend.prototype, "toggles", void 0);
|
|
52
101
|
HelixHeadlessLegend = __decorate([
|
|
53
102
|
customElement('helix-headless-legend')
|
|
54
103
|
], HelixHeadlessLegend);
|
|
@@ -8,6 +8,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
8
8
|
* or a chart. The lightbox shows one item at a time, and the root decides
|
|
9
9
|
* which.
|
|
10
10
|
*
|
|
11
|
+
* Each item is a `group` with the role description `slide`, named by its
|
|
12
|
+
* `label` or, without one, by its place in the set, such as "2 of 5", as the
|
|
13
|
+
* APG carousel pattern names a slide. The lightbox supplies both words, so they
|
|
14
|
+
* are translated on the lightbox.
|
|
15
|
+
*
|
|
11
16
|
* An item that is not current is hidden and stays in the DOM, as a `TabPanel`
|
|
12
17
|
* does. Crawlers can read it, it is in the server-rendered markup, and an
|
|
13
18
|
* `<img>` that has decoded does not decode again when you go back to it.
|
|
@@ -37,6 +42,16 @@ export declare class HelixHeadlessLightboxItem extends HelixElement {
|
|
|
37
42
|
* lightbox's `status-label`.
|
|
38
43
|
*/
|
|
39
44
|
label: string;
|
|
45
|
+
/**
|
|
46
|
+
* @internal Set by the lightbox: the item's name where it has no `label`,
|
|
47
|
+
* which is its place in the set.
|
|
48
|
+
*/
|
|
49
|
+
position: string;
|
|
50
|
+
/**
|
|
51
|
+
* @internal Set by the lightbox: the word a screen reader says in place of
|
|
52
|
+
* the item's role. Empty leaves the role as it is.
|
|
53
|
+
*/
|
|
54
|
+
roleLabel: string;
|
|
40
55
|
/**
|
|
41
56
|
* The item's identifier. The root compares its `active` value against it.
|
|
42
57
|
*/
|
|
@@ -12,6 +12,8 @@ let HelixHeadlessLightboxItem = class HelixHeadlessLightboxItem extends HelixEle
|
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.current = false;
|
|
14
14
|
this.label = '';
|
|
15
|
+
this.position = '';
|
|
16
|
+
this.roleLabel = '';
|
|
15
17
|
this.value = '';
|
|
16
18
|
}
|
|
17
19
|
willUpdate(changed) {
|
|
@@ -22,7 +24,8 @@ let HelixHeadlessLightboxItem = class HelixHeadlessLightboxItem extends HelixEle
|
|
|
22
24
|
return html `<div
|
|
23
25
|
part="item"
|
|
24
26
|
role="group"
|
|
25
|
-
aria-
|
|
27
|
+
aria-roledescription=${this.roleLabel || nothing}
|
|
28
|
+
aria-label=${this.label || this.position || nothing}
|
|
26
29
|
?hidden=${!this.current}
|
|
27
30
|
>
|
|
28
31
|
<slot></slot>
|
|
@@ -36,6 +39,12 @@ __decorate([
|
|
|
36
39
|
__decorate([
|
|
37
40
|
property()
|
|
38
41
|
], HelixHeadlessLightboxItem.prototype, "label", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
property({ attribute: false })
|
|
44
|
+
], HelixHeadlessLightboxItem.prototype, "position", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
property({ attribute: false })
|
|
47
|
+
], HelixHeadlessLightboxItem.prototype, "roleLabel", void 0);
|
|
39
48
|
__decorate([
|
|
40
49
|
property()
|
|
41
50
|
], HelixHeadlessLightboxItem.prototype, "value", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandController, HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { CommandController, HelixElement, SwipeController } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
4
4
|
/**
|
|
@@ -18,6 +18,16 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
18
18
|
* holds the current item, as in `Tabs`. The arrow keys change the item while
|
|
19
19
|
* focus stays in the dialog.
|
|
20
20
|
*
|
|
21
|
+
* Set `controls` for the viewer's own previous, next and close controls, named
|
|
22
|
+
* by `previous-label`, `next-label` and `dismiss-label`. Without it, compose the
|
|
23
|
+
* chrome yourself in the `header` and `footer` slots, with buttons that send
|
|
24
|
+
* `--previous`, `--next` and `--close`.
|
|
25
|
+
*
|
|
26
|
+
* Each item is a slide: a `group` with the role description in
|
|
27
|
+
* `slide-role-label`, named by its `label` or by `slide-label`. A touch or a pen
|
|
28
|
+
* swiped across the picture shows the next or the previous item, the way the
|
|
29
|
+
* line of text runs.
|
|
30
|
+
*
|
|
21
31
|
* The chrome hides when there is no input, through `IdleController`, and comes
|
|
22
32
|
* back on a pointer move, a key press, or a focus. It stays while focus is on a
|
|
23
33
|
* control in the header or the footer, so a keyboard reader is never left on
|
|
@@ -42,7 +52,13 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
42
52
|
* @event {ToggleEvent} toggle - Fired when the viewer opens or closes, with `newState` and `oldState`.
|
|
43
53
|
*
|
|
44
54
|
* @csspart dialog - The native dialog element.
|
|
55
|
+
* @csspart dismiss - The close control, drawn with `controls`.
|
|
56
|
+
* @csspart dismiss-mark - The glyph on the close control.
|
|
45
57
|
* @csspart live - The live region that announces which item is shown.
|
|
58
|
+
* @csspart next - The control that shows the next item, drawn with `controls`.
|
|
59
|
+
* @csspart next-mark - The glyph on the next control.
|
|
60
|
+
* @csspart previous - The control that shows the previous item, drawn with `controls`.
|
|
61
|
+
* @csspart previous-mark - The glyph on the previous control.
|
|
46
62
|
* @csspart viewport - The box the current item is shown in.
|
|
47
63
|
*
|
|
48
64
|
* @cssstate fullscreen - While the viewer fills the screen.
|
|
@@ -50,6 +66,20 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
50
66
|
* @cssstate open - While the viewer is open.
|
|
51
67
|
*/
|
|
52
68
|
export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
69
|
+
/**
|
|
70
|
+
* Draws the viewer's own previous, next and close controls over the picture.
|
|
71
|
+
*
|
|
72
|
+
* Off by default, for a viewer whose chrome you compose in the `header` and
|
|
73
|
+
* `footer` slots. The controls hide with the rest of the chrome while the
|
|
74
|
+
* reader is idle, and the previous and next ones say they are unavailable at
|
|
75
|
+
* either end of a set that does not `loop`.
|
|
76
|
+
*/
|
|
77
|
+
controls: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The close control's accessible name. Translate it with the rest of your
|
|
80
|
+
* interface.
|
|
81
|
+
*/
|
|
82
|
+
dismissLabel: string;
|
|
53
83
|
/**
|
|
54
84
|
* How long the user can be idle before the header and footer hide, in
|
|
55
85
|
* milliseconds.
|
|
@@ -67,6 +97,25 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
67
97
|
* Whether moving past the last item returns to the first.
|
|
68
98
|
*/
|
|
69
99
|
loop: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The next control's accessible name.
|
|
102
|
+
*/
|
|
103
|
+
nextLabel: string;
|
|
104
|
+
/**
|
|
105
|
+
* The previous control's accessible name.
|
|
106
|
+
*/
|
|
107
|
+
previousLabel: string;
|
|
108
|
+
/**
|
|
109
|
+
* The name of an item with no `label` of its own, with `{index}` and
|
|
110
|
+
* `{count}` filled in.
|
|
111
|
+
*/
|
|
112
|
+
slideLabel: string;
|
|
113
|
+
/**
|
|
114
|
+
* The word screen readers announce in place of an item's role, set as
|
|
115
|
+
* `aria-roledescription`. Translate it with the rest of your text, or empty
|
|
116
|
+
* it to leave the role as `group`.
|
|
117
|
+
*/
|
|
118
|
+
slideRoleLabel: string;
|
|
70
119
|
/**
|
|
71
120
|
* The status text that says which item is shown, with `{index}`, `{count}`
|
|
72
121
|
* and the item's `{label}` filled in.
|
|
@@ -82,6 +131,7 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
82
131
|
private filled;
|
|
83
132
|
/** What the live region is currently saying. */
|
|
84
133
|
private announcement;
|
|
134
|
+
protected readonly swipes: SwipeController;
|
|
85
135
|
private readonly fullscreen;
|
|
86
136
|
private readonly idle;
|
|
87
137
|
/**
|
|
@@ -176,6 +226,8 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
176
226
|
* every set whose current item has just been removed.
|
|
177
227
|
*/
|
|
178
228
|
private mark;
|
|
229
|
+
/** Whether a step that way would show nothing new, at the end of a set that does not loop. */
|
|
230
|
+
private atEnd;
|
|
179
231
|
/**
|
|
180
232
|
* Says where the reader is, once the reader has moved.
|
|
181
233
|
*
|
|
@@ -185,6 +237,14 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
185
237
|
*/
|
|
186
238
|
private say;
|
|
187
239
|
protected render(): TemplateResult;
|
|
240
|
+
/**
|
|
241
|
+
* The viewer's own controls, behind a seam a tier above can move.
|
|
242
|
+
*
|
|
243
|
+
* After the item in the order, so `Tab` from the viewer reaches the picture's
|
|
244
|
+
* content first. `aria-disabled` at the ends, and never `disabled`, so a
|
|
245
|
+
* control that has just shown the last picture keeps focus.
|
|
246
|
+
*/
|
|
247
|
+
protected renderControls(): TemplateResult;
|
|
188
248
|
}
|
|
189
249
|
declare global {
|
|
190
250
|
interface HTMLElementTagNameMap {
|
|
@@ -4,20 +4,41 @@ 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 { CommandController, customElement, deepActiveElement, deepContains, FullscreenController, fillTemplate, HelixElement, hostAria, IdleController, inlineStep, keyClaimed, lockScroll, MixinControllerActive, MixinControllerOpen, resolveActiveItem, unlockScroll, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CommandController, customElement, deepActiveElement, deepContains, FullscreenController, fillTemplate, HelixElement, hostAria, IdleController, inlineStep, isRtl, keyClaimed, lockScroll, MixinControllerActive, MixinControllerOpen, resolveActiveItem, SwipeController, swipeStep, unlockScroll, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { caretLeft, caretRight, x } from '@fusion.dev/helix-icons';
|
|
8
9
|
import { html, nothing } from 'lit';
|
|
9
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
10
12
|
import { HelixHeadlessLightboxItem } from '../item/lightbox-item.js';
|
|
11
13
|
let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerActive(MixinControllerOpen(HelixElement)) {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
16
|
+
this.controls = false;
|
|
17
|
+
this.dismissLabel = 'Close';
|
|
14
18
|
this.idleDelay = 0;
|
|
15
19
|
this.label = '';
|
|
16
20
|
this.loop = false;
|
|
21
|
+
this.nextLabel = 'Next';
|
|
22
|
+
this.previousLabel = 'Previous';
|
|
23
|
+
this.slideLabel = '{index} of {count}';
|
|
24
|
+
this.slideRoleLabel = 'slide';
|
|
17
25
|
this.statusLabel = '{index} of {count}';
|
|
18
26
|
this.resting = false;
|
|
19
27
|
this.filled = false;
|
|
20
28
|
this.announcement = '';
|
|
29
|
+
this.swipes = new SwipeController(this, {
|
|
30
|
+
axis: () => (this.open ? 'x' : undefined),
|
|
31
|
+
end: (dx, _dy, vx) => {
|
|
32
|
+
const width = this.partNamed('viewport')?.getBoundingClientRect().width ?? 0;
|
|
33
|
+
const step = swipeStep(dx, vx, width, isRtl(this));
|
|
34
|
+
if (step !== 0) {
|
|
35
|
+
this.step(step);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
move: () => this.idle.stir(),
|
|
39
|
+
start: (_target, event) => event.pointerType !== 'mouse',
|
|
40
|
+
surface: () => this.dialog,
|
|
41
|
+
});
|
|
21
42
|
this.fullscreen = new FullscreenController(this, (full) => {
|
|
22
43
|
this.filled = full;
|
|
23
44
|
});
|
|
@@ -84,7 +105,9 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
84
105
|
}
|
|
85
106
|
chromeHasFocus() {
|
|
86
107
|
const active = deepActiveElement();
|
|
87
|
-
|
|
108
|
+
const own = this.shadowRoot?.activeElement?.matches('[part="previous"], [part="next"], [part="dismiss"]');
|
|
109
|
+
return (own === true ||
|
|
110
|
+
this.knownChildren.some((child) => (child.slot === 'header' || child.slot === 'footer') && deepContains(child, active)));
|
|
88
111
|
}
|
|
89
112
|
get items() {
|
|
90
113
|
return this.knownChildren.filter((child) => child instanceof HelixHeadlessLightboxItem);
|
|
@@ -169,9 +192,23 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
169
192
|
mark() {
|
|
170
193
|
const items = this.items;
|
|
171
194
|
const current = resolveActiveItem(this.active, items);
|
|
172
|
-
|
|
195
|
+
items.forEach((item, at) => {
|
|
173
196
|
item.current = item === current;
|
|
174
|
-
|
|
197
|
+
whenHydrated(item, () => {
|
|
198
|
+
item.position = fillTemplate(this.slideLabel, {
|
|
199
|
+
count: items.length,
|
|
200
|
+
index: at + 1,
|
|
201
|
+
label: item.label,
|
|
202
|
+
});
|
|
203
|
+
item.roleLabel = this.slideRoleLabel;
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
atEnd(by) {
|
|
208
|
+
const items = this.items;
|
|
209
|
+
const shown = this.shown;
|
|
210
|
+
const at = shown ? items.indexOf(shown) : 0;
|
|
211
|
+
return !this.loop && (items.length === 0 || (by === 1 ? at >= items.length - 1 : at <= 0));
|
|
175
212
|
}
|
|
176
213
|
say(changed) {
|
|
177
214
|
if (!changed.has('active') && !changed.has('open')) {
|
|
@@ -212,10 +249,51 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
212
249
|
<slot></slot>
|
|
213
250
|
</div>
|
|
214
251
|
<slot name="footer"></slot>
|
|
252
|
+
${this.controls ? this.renderControls() : nothing}
|
|
215
253
|
<span part="live" role="status" aria-live="polite">${this.announcement || nothing}</span>
|
|
216
254
|
</dialog>`;
|
|
217
255
|
}
|
|
256
|
+
renderControls() {
|
|
257
|
+
return html `<button
|
|
258
|
+
part="previous"
|
|
259
|
+
type="button"
|
|
260
|
+
aria-label=${this.previousLabel}
|
|
261
|
+
aria-disabled=${this.atEnd(-1) ? 'true' : nothing}
|
|
262
|
+
@click=${() => this.previous()}
|
|
263
|
+
>
|
|
264
|
+
<svg part="previous-mark" data-mirror fill="currentColor" viewBox=${caretLeft.viewBox} aria-hidden="true">
|
|
265
|
+
${unsafeSVG(caretLeft.content)}
|
|
266
|
+
</svg>
|
|
267
|
+
</button>
|
|
268
|
+
<button
|
|
269
|
+
part="next"
|
|
270
|
+
type="button"
|
|
271
|
+
aria-label=${this.nextLabel}
|
|
272
|
+
aria-disabled=${this.atEnd(1) ? 'true' : nothing}
|
|
273
|
+
@click=${() => this.next()}
|
|
274
|
+
>
|
|
275
|
+
<svg part="next-mark" data-mirror fill="currentColor" viewBox=${caretRight.viewBox} aria-hidden="true">
|
|
276
|
+
${unsafeSVG(caretRight.content)}
|
|
277
|
+
</svg>
|
|
278
|
+
</button>
|
|
279
|
+
<button
|
|
280
|
+
part="dismiss"
|
|
281
|
+
type="button"
|
|
282
|
+
aria-label=${this.dismissLabel}
|
|
283
|
+
@click=${() => this.close()}
|
|
284
|
+
>
|
|
285
|
+
<svg part="dismiss-mark" fill="currentColor" viewBox=${x.viewBox} aria-hidden="true">
|
|
286
|
+
${unsafeSVG(x.content)}
|
|
287
|
+
</svg>
|
|
288
|
+
</button>`;
|
|
289
|
+
}
|
|
218
290
|
};
|
|
291
|
+
__decorate([
|
|
292
|
+
property({ reflect: true, type: Boolean })
|
|
293
|
+
], HelixHeadlessLightbox.prototype, "controls", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
property({ attribute: 'dismiss-label' })
|
|
296
|
+
], HelixHeadlessLightbox.prototype, "dismissLabel", void 0);
|
|
219
297
|
__decorate([
|
|
220
298
|
property({ attribute: 'idle-delay', type: Number })
|
|
221
299
|
], HelixHeadlessLightbox.prototype, "idleDelay", void 0);
|
|
@@ -225,6 +303,18 @@ __decorate([
|
|
|
225
303
|
__decorate([
|
|
226
304
|
property({ reflect: true, type: Boolean })
|
|
227
305
|
], HelixHeadlessLightbox.prototype, "loop", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ attribute: 'next-label' })
|
|
308
|
+
], HelixHeadlessLightbox.prototype, "nextLabel", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ attribute: 'previous-label' })
|
|
311
|
+
], HelixHeadlessLightbox.prototype, "previousLabel", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ attribute: 'slide-label' })
|
|
314
|
+
], HelixHeadlessLightbox.prototype, "slideLabel", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ attribute: 'slide-role-label' })
|
|
317
|
+
], HelixHeadlessLightbox.prototype, "slideRoleLabel", void 0);
|
|
228
318
|
__decorate([
|
|
229
319
|
property({ attribute: 'status-label' })
|
|
230
320
|
], HelixHeadlessLightbox.prototype, "statusLabel", void 0);
|
|
@@ -23,10 +23,16 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
23
23
|
* `<svg>` that fills its box scales with the box, so the same `font-size` can
|
|
24
24
|
* render at 10px in a narrow chart and 43px in a wide one.
|
|
25
25
|
*
|
|
26
|
-
* The table is the accessible representation, and the drawing is
|
|
27
|
-
*
|
|
26
|
+
* The table is the accessible representation, and the drawing is hidden from
|
|
27
|
+
* screen readers, who get the numbers. The `summary` part names the chart, from
|
|
28
28
|
* `label` or the table's caption, and gives each series' latest reading.
|
|
29
29
|
*
|
|
30
|
+
* **The plot is read by key.** It takes focus, named by `label` or the caption.
|
|
31
|
+
* The left and right arrows move from reading to reading, Home and End go to
|
|
32
|
+
* the first and the last, and the up and down arrows move among the series of
|
|
33
|
+
* a reading. The tooltip follows, the `live` part says the reading in words,
|
|
34
|
+
* and Escape puts the tooltip away.
|
|
35
|
+
*
|
|
30
36
|
* @since 0.1.0
|
|
31
37
|
* @status stable
|
|
32
38
|
* @category charts
|
|
@@ -41,8 +47,9 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
41
47
|
* @csspart label - One reading's name.
|
|
42
48
|
* @csspart labels - The row of reading names.
|
|
43
49
|
* @csspart line - The line for one series.
|
|
50
|
+
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
44
51
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
45
|
-
* @csspart plot - The drawing.
|
|
52
|
+
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
46
53
|
* @csspart summary - The chart's name and each series' latest reading, written as a sentence for screen readers. Hide it visually.
|
|
47
54
|
* @csspart svg - The drawing surface the lines and areas sit on.
|
|
48
55
|
* @csspart terminus - The mark on one series' last reading.
|
|
@@ -55,6 +62,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
55
62
|
* @csspart tooltip-arrow-top - The point while the bubble is above the reading, so on its bottom edge, beside `tooltip-arrow`.
|
|
56
63
|
* @csspart tooltip-bottom - The bubble while it is below the reading, beside `tooltip`.
|
|
57
64
|
* @csspart tooltip-cell - One column's name and value inside the tooltip.
|
|
65
|
+
* @csspart tooltip-cell-current - The cell the up and down arrows rest on, while they rest there. Set alongside `tooltip-cell`.
|
|
58
66
|
* @csspart tooltip-label - The reading's own name inside the tooltip.
|
|
59
67
|
* @csspart tooltip-left - The bubble while it is left of the reading, beside `tooltip`.
|
|
60
68
|
* @csspart tooltip-name - A column's name inside the tooltip.
|
|
@@ -21,13 +21,18 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
21
21
|
return this.gridlines === 'both' || this.gridlines === 'category';
|
|
22
22
|
}
|
|
23
23
|
range(series) {
|
|
24
|
-
const values = series
|
|
24
|
+
const values = series
|
|
25
|
+
.filter((one) => this.showsSeries(one.name))
|
|
26
|
+
.flatMap((one) => one.points.map((point) => point.value));
|
|
25
27
|
const [low, high] = extent(values.length > 0 ? values : [0]);
|
|
26
28
|
return this.zero ? [Math.min(0, low), Math.max(0, high)] : [low, high];
|
|
27
29
|
}
|
|
28
30
|
ends(series, x, y) {
|
|
29
31
|
return series.flatMap((one, depth) => {
|
|
30
32
|
const last = one.points.at(-1);
|
|
33
|
+
if (!this.showsSeries(one.name)) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
31
36
|
if (!last || one.points.length < 2) {
|
|
32
37
|
return [];
|
|
33
38
|
}
|
|
@@ -68,7 +73,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
68
73
|
? `${latest[0]?.label ?? ''}: ${latest.map((one) => one.reading).join(', ')}`
|
|
69
74
|
: latest.map((one) => `${one.label}: ${one.reading}`).join('; ');
|
|
70
75
|
const named = this.named ? `${this.named}, ` : '';
|
|
71
|
-
return html `<p part="summary">${named}${body}.</p>`;
|
|
76
|
+
return html `<p id="helix-chart-summary" part="summary">${named}${body}.</p>`;
|
|
72
77
|
}
|
|
73
78
|
renderPlot(series, x, y, domain) {
|
|
74
79
|
const floor = domain[0] <= 0 && domain[1] >= 0 ? y(0) : undefined;
|
|
@@ -79,12 +84,17 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
79
84
|
.join(', ')
|
|
80
85
|
: undefined;
|
|
81
86
|
return html `<div
|
|
82
|
-
aria-
|
|
87
|
+
aria-describedby=${this.named ? 'helix-chart-summary' : nothing}
|
|
88
|
+
aria-label=${this.named || nothing}
|
|
89
|
+
aria-labelledby=${this.named ? nothing : 'helix-chart-summary'}
|
|
83
90
|
id=${CHART_PLOT}
|
|
84
91
|
part="plot"
|
|
92
|
+
role="application"
|
|
93
|
+
tabindex="0"
|
|
85
94
|
style=${holes ? `--_line-chart-holes: ${holes}` : nothing}
|
|
86
95
|
>
|
|
87
96
|
<svg part="svg"
|
|
97
|
+
aria-hidden="true"
|
|
88
98
|
data-mirror
|
|
89
99
|
preserveAspectRatio="none"
|
|
90
100
|
viewBox="0 0 ${PLOT_WIDTH} ${PLOT_HEIGHT}"
|
|
@@ -140,6 +150,9 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
140
150
|
></span>`)}`;
|
|
141
151
|
}
|
|
142
152
|
renderSeries(one, depth, x, y) {
|
|
153
|
+
if (!this.showsSeries(one.name)) {
|
|
154
|
+
return html `${nothing}`;
|
|
155
|
+
}
|
|
143
156
|
const runs = unbroken(one)
|
|
144
157
|
.map((run) => {
|
|
145
158
|
const points = run.map((point) => [x(point.at), y(point.value)]);
|
|
@@ -182,11 +195,12 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
182
195
|
const at = this.pointer.at;
|
|
183
196
|
const series = this.series;
|
|
184
197
|
if (at < 0 || series.length === 0) {
|
|
185
|
-
return drawTooltip(this.sourceRows, at, this.tag('tooltip'));
|
|
198
|
+
return drawTooltip(this.sourceRows, at, this.tag('tooltip'), undefined, undefined, this.pointer);
|
|
186
199
|
}
|
|
187
200
|
const domain = this.range(series);
|
|
188
201
|
const scale = linear(domain, [PLOT_HEIGHT, 0]);
|
|
189
202
|
const tops = series
|
|
203
|
+
.filter((one) => this.showsSeries(one.name))
|
|
190
204
|
.map((one) => byRow(one, this.readings)[at]?.value)
|
|
191
205
|
.filter((one) => one !== undefined)
|
|
192
206
|
.map((one) => scale(one));
|
|
@@ -195,7 +209,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
195
209
|
placement: 'top',
|
|
196
210
|
x: `${at * slot + slot / 2}%`,
|
|
197
211
|
y: `${tops.length > 0 ? Math.min(...tops) : 0}%`,
|
|
198
|
-
}, (cell) => this.seriesOf(cell));
|
|
212
|
+
}, (cell) => this.seriesOf(cell), this.pointer);
|
|
199
213
|
}
|
|
200
214
|
};
|
|
201
215
|
__decorate([
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/** The values `current` takes, which are `aria-current`'s. */
|
|
4
|
+
export type ListItemCurrent = 'date' | 'location' | 'page' | 'step' | 'time' | 'true';
|
|
3
5
|
/**
|
|
4
6
|
* @summary One row of a list.
|
|
5
7
|
*
|
|
@@ -25,6 +27,14 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
25
27
|
* **For a row that holds controls and is not a destination, use
|
|
26
28
|
* `data-list-item`.** With `href` unset, the row is not a link.
|
|
27
29
|
*
|
|
30
|
+
* `current` marks the row a reader is on, such as the page in a list of
|
|
31
|
+
* pages, with `aria-current` on its link, or on the row where it has none.
|
|
32
|
+
*
|
|
33
|
+
* **In a list with `selection-mode`, the row is a row of a grid.** The list
|
|
34
|
+
* gives it its role, its place in the one tab stop and, where the list
|
|
35
|
+
* selects, whether it is selected. Its link leaves the tab order there, and
|
|
36
|
+
* Enter follows it from the row.
|
|
37
|
+
*
|
|
28
38
|
* @since 0.1.0
|
|
29
39
|
* @status stable
|
|
30
40
|
* @aliases Row, Entry
|
|
@@ -35,10 +45,38 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
35
45
|
* @slot end - Trailing content.
|
|
36
46
|
* @slot start - Leading content, usually an icon or an avatar.
|
|
37
47
|
*
|
|
48
|
+
* @event {HelixActionEvent} helix-action - The reader pressed Enter on the row, or pressed the row in a list that selects nothing, in a list with `selection-mode`. Read the row from `target`. A row with `href` follows its link instead.
|
|
49
|
+
*
|
|
38
50
|
* @csspart link - The link, when the row has `href`. It holds every region except `end`.
|
|
39
|
-
* @csspart row - The row's layout. It sits inside the host so the host can carry a list marker.
|
|
51
|
+
* @csspart row - The row's layout. It sits inside the host so the host can carry a list marker. In a list with `selection-mode` it is the grid cell that takes focus.
|
|
52
|
+
* @csspart row-current - Added to `row` while the row is `current`.
|
|
53
|
+
*
|
|
54
|
+
* @cssstate selected - The row is selected, in a list that selects.
|
|
40
55
|
*/
|
|
41
56
|
export declare class HelixHeadlessListItem extends HelixElement {
|
|
57
|
+
/**
|
|
58
|
+
* Marks the row a reader is on: `page` for the page they are reading, `step`,
|
|
59
|
+
* `location`, `date` or `time` for those, and written bare for the current
|
|
60
|
+
* one of a set. It is `aria-current` on the row's link, or on the row where
|
|
61
|
+
* it has none.
|
|
62
|
+
*
|
|
63
|
+
* Not reflected, as a state never is. `row-current` is the part a
|
|
64
|
+
* stylesheet draws it from.
|
|
65
|
+
*/
|
|
66
|
+
current?: ListItemCurrent;
|
|
67
|
+
/**
|
|
68
|
+
* Takes the row out of reach in a list with `selection-mode`: the arrow keys
|
|
69
|
+
* pass over it and it cannot be selected or acted on.
|
|
70
|
+
*/
|
|
71
|
+
disabled: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the row holds its list's tab stop.
|
|
74
|
+
*
|
|
75
|
+
* Written by a list with `selection-mode` on every row it holds, and unset
|
|
76
|
+
* otherwise, which is how a row knows it is a row of a grid. No attribute:
|
|
77
|
+
* it is coordination between elements, as `Tag.focusable` is.
|
|
78
|
+
*/
|
|
79
|
+
focusable?: boolean | undefined;
|
|
42
80
|
/**
|
|
43
81
|
* The URL the row links to. Leave it empty for a row that is not a link.
|
|
44
82
|
*
|
|
@@ -52,10 +90,39 @@ export declare class HelixHeadlessListItem extends HelixElement {
|
|
|
52
90
|
* `target`, for the reason `Tree.Item` gives.
|
|
53
91
|
*/
|
|
54
92
|
rel: string;
|
|
93
|
+
/**
|
|
94
|
+
* Whether the row is selected, in a list that selects.
|
|
95
|
+
*
|
|
96
|
+
* Written by the list from its own `value`, and unset where nothing can be
|
|
97
|
+
* selected, which keeps `aria-selected` off a list that does not select.
|
|
98
|
+
*/
|
|
99
|
+
selected?: boolean | undefined;
|
|
55
100
|
/**
|
|
56
101
|
* Where the link opens. Use it for a row that leaves the site.
|
|
57
102
|
*/
|
|
58
103
|
target: string;
|
|
104
|
+
/**
|
|
105
|
+
* What the row stands for in its list's `value`.
|
|
106
|
+
*
|
|
107
|
+
* Absent is the row's own words.
|
|
108
|
+
*/
|
|
109
|
+
value: string;
|
|
110
|
+
/** The row's words, or none where the children are not known yet. */
|
|
111
|
+
get words(): string;
|
|
112
|
+
/** Whether a list with `selection-mode` holds this row, which makes it a row of a grid. */
|
|
113
|
+
private get grouped();
|
|
114
|
+
/** @internal The cell a list with `selection-mode` moves focus to. */
|
|
115
|
+
get cell(): HTMLElement | null;
|
|
116
|
+
/**
|
|
117
|
+
* @internal The controls in the `end` slot, in order, which Left and Right
|
|
118
|
+
* move between in a list with `selection-mode`. Disabled ones are passed
|
|
119
|
+
* over.
|
|
120
|
+
*/
|
|
121
|
+
get controls(): HTMLElement[];
|
|
122
|
+
/** Moves focus to the row's cell, in a list with `selection-mode`. */
|
|
123
|
+
focusItem(): void;
|
|
124
|
+
/** @internal Follows the row's link, as a press on it would. Called by the list on Enter. */
|
|
125
|
+
follow(): void;
|
|
59
126
|
protected willUpdate(changed: PropertyValues): void;
|
|
60
127
|
/**
|
|
61
128
|
* The cell before the row's content, which this tier leaves empty.
|