@fusion.dev/helix-headless 0.142.1 → 0.144.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 +25381 -1202
- package/dist/accordion/item/accordion-item.d.ts +38 -2
- package/dist/accordion/item/accordion-item.js +38 -6
- package/dist/accordion/root/accordion-root.d.ts +23 -1
- package/dist/accordion/root/accordion-root.js +39 -3
- package/dist/announcement/root/announcement-root.d.ts +11 -7
- package/dist/announcement/root/announcement-root.js +1 -1
- package/dist/app-header/root/app-header-root.d.ts +21 -0
- package/dist/app-header/root/app-header-root.js +31 -5
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +39 -11
- package/dist/avatar/group/avatar-group.d.ts +24 -3
- package/dist/avatar/group/avatar-group.js +34 -2
- package/dist/avatar/root/avatar-root.d.ts +17 -1
- package/dist/avatar/root/avatar-root.js +31 -10
- package/dist/badge/root/badge-root.d.ts +12 -0
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +30 -5
- package/dist/bar-chart/root/bar-chart-root.js +58 -21
- package/dist/blockquote/root/blockquote-root.d.ts +12 -7
- package/dist/blockquote/root/blockquote-root.js +6 -4
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -3
- package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -1
- package/dist/button/root/button-root.d.ts +84 -1
- package/dist/button/root/button-root.js +81 -3
- package/dist/callout/root/callout-root.d.ts +32 -6
- package/dist/callout/root/callout-root.js +26 -7
- package/dist/canvas/root/canvas-root.d.ts +1 -0
- package/dist/canvas/root/canvas-root.js +10 -1
- 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 +47 -5
- package/dist/carousel/root/carousel-root.js +53 -21
- package/dist/chat/composer/chat-composer.d.ts +13 -11
- package/dist/chat/composer/chat-composer.js +6 -12
- package/dist/chat/message/chat-message.js +8 -1
- package/dist/chat/root/chat-root.d.ts +1 -0
- package/dist/chat/root/chat-root.js +2 -1
- package/dist/checkbox/root/checkbox-root.d.ts +7 -0
- package/dist/checkbox/root/checkbox-root.js +9 -3
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +116 -33
- package/dist/checkbox-group/root/checkbox-group-root.js +141 -44
- package/dist/code/root/code-root.d.ts +1 -1
- 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 +49 -0
- package/dist/code-block/root/code-block-root.js +44 -3
- package/dist/color-input/root/color-input-root.d.ts +60 -2
- package/dist/color-input/root/color-input-root.js +55 -7
- 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 +118 -12
- package/dist/color-picker/root/color-picker-root.js +183 -13
- package/dist/combobox/root/combobox-root.d.ts +126 -3
- package/dist/combobox/root/combobox-root.js +224 -21
- package/dist/command/root/command-root.d.ts +47 -10
- package/dist/command/root/command-root.js +45 -4
- 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 +48 -7
- package/dist/copy-button/root/copy-button-root.js +54 -8
- package/dist/data-table/root/data-table-root.d.ts +164 -10
- package/dist/data-table/root/data-table-root.js +488 -57
- package/dist/date-input/root/date-input-root.d.ts +123 -9
- package/dist/date-input/root/date-input-root.js +147 -45
- package/dist/date-picker/root/date-picker-root.d.ts +229 -18
- package/dist/date-picker/root/date-picker-root.js +342 -46
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +101 -10
- package/dist/dialog/root/dialog-root.js +83 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +61 -16
- package/dist/donut-chart/root/donut-chart-root.js +48 -13
- package/dist/drawer/root/drawer-root.d.ts +93 -7
- package/dist/drawer/root/drawer-root.js +126 -5
- 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 +16 -13
- package/dist/drilldown/item/drilldown-item.js +6 -2
- package/dist/drilldown/root/drilldown-root.d.ts +21 -5
- package/dist/drilldown/root/drilldown-root.js +26 -10
- package/dist/element-events.generated.js +42 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +65 -1
- package/dist/file-input/root/file-input-root.js +76 -12
- 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 +9 -0
- package/dist/filter-input/menu/filter-menu.js +8 -0
- package/dist/filter-input/root/filter-input-root.d.ts +43 -6
- package/dist/filter-input/root/filter-input-root.js +89 -10
- 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 +62 -3
- package/dist/format-date/root/format-date-root.js +78 -37
- package/dist/graph/root/graph-root.d.ts +24 -3
- package/dist/graph/root/graph-root.js +66 -12
- package/dist/heatmap/root/buckets.d.ts +2 -1
- package/dist/heatmap/root/buckets.js +5 -1
- package/dist/heatmap/root/heatmap-root.d.ts +47 -9
- package/dist/heatmap/root/heatmap-root.js +46 -18
- 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 +53 -6
- package/dist/icon/root/icon-root.js +72 -4
- 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/icon-button/root/icon-button-root.d.ts +1 -1
- package/dist/image/root/image-root.d.ts +23 -2
- package/dist/image/root/image-root.js +23 -4
- package/dist/input/root/input-root.d.ts +62 -9
- package/dist/input/root/input-root.js +61 -5
- package/dist/kbd/root/kbd-root.d.ts +26 -11
- package/dist/kbd/root/kbd-root.js +35 -38
- 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 +63 -0
- package/dist/legend/root/legend-root.js +61 -7
- package/dist/lightbox/item/lightbox-item.d.ts +17 -1
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +77 -6
- package/dist/lightbox/root/lightbox-root.js +116 -5
- package/dist/line-chart/root/line-chart-root.d.ts +29 -4
- package/dist/line-chart/root/line-chart-root.js +58 -17
- package/dist/list/item/list-item.d.ts +11 -5
- package/dist/list/item/list-item.js +5 -6
- package/dist/listbox/range.d.ts +17 -0
- package/dist/listbox/range.js +5 -0
- package/dist/listbox/root/listbox-root.d.ts +184 -4
- package/dist/listbox/root/listbox-root.js +229 -23
- 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 +19 -4
- package/dist/map/root/map-root.js +36 -7
- package/dist/megamenu/root/megamenu-root.d.ts +10 -1
- package/dist/megamenu/root/megamenu-root.js +10 -1
- package/dist/menu/item/menu-item.d.ts +41 -12
- package/dist/menu/item/menu-item.js +46 -3
- package/dist/menu/root/menu-root.d.ts +32 -2
- package/dist/menu/root/menu-root.js +48 -8
- package/dist/meter/root/meter-root.d.ts +13 -0
- package/dist/meter/root/meter-root.js +24 -5
- package/dist/navigation/root/navigation-root.d.ts +10 -2
- package/dist/navigation/root/navigation-root.js +13 -2
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/group/notification-group.d.ts +1 -0
- package/dist/notifications/notification/notification.d.ts +29 -0
- package/dist/notifications/notification/notification.js +51 -3
- package/dist/notifications/root/notifications-root.d.ts +49 -0
- package/dist/notifications/root/notifications-root.js +76 -2
- package/dist/number-input/root/number-input-root.d.ts +109 -7
- package/dist/number-input/root/number-input-root.js +109 -21
- package/dist/object-inspector/root/object-inspector-root.d.ts +49 -5
- package/dist/object-inspector/root/object-inspector-root.js +92 -12
- package/dist/option/root/option-root.d.ts +58 -6
- package/dist/option/root/option-root.js +35 -5
- package/dist/outline/root/outline-root.d.ts +13 -2
- package/dist/outline/root/outline-root.js +4 -2
- package/dist/pagination/root/pagination-root.d.ts +19 -1
- package/dist/pagination/root/pagination-root.js +49 -9
- package/dist/pagination/size/pagination-size.d.ts +13 -3
- package/dist/pagination/size/pagination-size.js +7 -0
- 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 +37 -0
- package/dist/pin-input/root/pin-input-root.js +48 -7
- package/dist/popover/root/popover-root.d.ts +78 -3
- package/dist/popover/root/popover-root.js +74 -5
- package/dist/progress/root/progress-root.d.ts +23 -1
- package/dist/progress/root/progress-root.js +40 -10
- 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 +45 -0
- package/dist/qr-code/root/qr-code-root.js +78 -3
- package/dist/radio/group/radio-group.d.ts +64 -0
- package/dist/radio/group/radio-group.js +66 -12
- package/dist/radio/root/radio-root.d.ts +8 -5
- package/dist/radio/root/radio-root.js +1 -2
- package/dist/rating/root/rating-root.d.ts +49 -1
- package/dist/rating/root/rating-root.js +69 -10
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +40 -14
- package/dist/select/root/select-root.d.ts +93 -3
- package/dist/select/root/select-root.js +111 -13
- package/dist/skeleton/root/skeleton-root.d.ts +39 -3
- package/dist/skeleton/root/skeleton-root.js +33 -4
- package/dist/skip-link/root/skip-link-root.d.ts +10 -0
- package/dist/skip-link/root/skip-link-root.js +15 -1
- package/dist/slider/root/slider-root.d.ts +59 -2
- package/dist/slider/root/slider-root.js +82 -8
- package/dist/sparkline/root/sparkline-root.d.ts +9 -10
- package/dist/speed-dial/item/speed-dial-item.d.ts +11 -5
- package/dist/speed-dial/item/speed-dial-item.js +7 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +15 -4
- package/dist/speed-dial/root/speed-dial-root.js +19 -5
- package/dist/splitter/root/splitter-root.d.ts +28 -6
- package/dist/splitter/root/splitter-root.js +35 -1
- package/dist/stat/root/stat-root.d.ts +9 -1
- package/dist/stat/root/stat-root.js +15 -2
- package/dist/steps/root/steps-root.js +1 -1
- package/dist/steps/step/step.d.ts +1 -0
- package/dist/steps/step/step.js +1 -1
- package/dist/switch/root/switch-root.d.ts +14 -2
- package/dist/switch/root/switch-root.js +7 -1
- package/dist/table/cell/table-cell.d.ts +24 -4
- package/dist/table/cell/table-cell.js +21 -1
- package/dist/table/column/table-column.d.ts +32 -6
- package/dist/table/column/table-column.js +36 -6
- package/dist/table/root/table-root.d.ts +94 -3
- package/dist/table/root/table-root.js +128 -5
- package/dist/table/row/table-row.d.ts +7 -0
- package/dist/table/row/table-row.js +9 -1
- package/dist/tabs/root/tabs-root.d.ts +6 -1
- package/dist/tabs/root/tabs-root.js +6 -2
- 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 +83 -1
- package/dist/tag/root/tag-root.js +87 -17
- 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 +13 -0
- package/dist/textarea/root/textarea-root.js +10 -2
- package/dist/time-input/root/time-input-root.d.ts +71 -6
- package/dist/time-input/root/time-input-root.js +110 -44
- package/dist/time-picker/root/time-picker-root.d.ts +155 -26
- package/dist/time-picker/root/time-picker-root.js +192 -63
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +16 -1
- package/dist/toast/item/toast-item.js +41 -13
- package/dist/toast/root/toast-root.d.ts +105 -8
- package/dist/toast/root/toast-root.js +209 -4
- package/dist/toggle/group/toggle-group.d.ts +95 -16
- package/dist/toggle/group/toggle-group.js +99 -13
- package/dist/toggle/root/toggle-root.d.ts +26 -11
- package/dist/toggle/root/toggle-root.js +14 -6
- package/dist/toolbar/root/toolbar-root.d.ts +55 -15
- package/dist/toolbar/root/toolbar-root.js +99 -16
- 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 +73 -15
- package/dist/tooltip/root/tooltip-root.js +96 -7
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +67 -3
- package/dist/tour/root/tour-root.js +105 -17
- package/dist/tour/stop/tour-stop.d.ts +65 -3
- package/dist/tour/stop/tour-stop.js +61 -11
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +21 -5
- package/dist/tree/item/tree-item.js +14 -4
- package/dist/tree/root/tree-root.d.ts +29 -5
- package/dist/tree/root/tree-root.js +64 -8
- package/dist/trend/root/trend-root.d.ts +36 -1
- package/dist/trend/root/trend-root.js +41 -15
- package/dist/video/root/keys.d.ts +5 -0
- package/dist/video/root/keys.js +13 -1
- package/dist/video/root/video-root.d.ts +19 -0
- package/dist/video/root/video-root.js +48 -4
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +20 -2
- package/dist/video-playlist/menu/video-playlist-menu.js +27 -5
- package/dist/video-playlist/root/video-playlist-root.js +6 -3
- package/dist/virtual-list/root/virtual-list-root.d.ts +52 -4
- package/dist/virtual-list/root/virtual-list-root.js +103 -21
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +9140 -1149
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +2089 -267
|
@@ -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,9 +18,21 @@ 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
|
-
* back on a pointer move or a focus.
|
|
23
|
-
*
|
|
32
|
+
* back on a pointer move, a key press, or a focus. It stays while focus is on a
|
|
33
|
+
* control in the header or the footer, so a keyboard reader is never left on
|
|
34
|
+
* a control that has gone. `fullscreen` uses `FullscreenController`, as `Video`
|
|
35
|
+
* does. While the viewer is open, the page behind it does not scroll.
|
|
24
36
|
*
|
|
25
37
|
* @since 0.100.0
|
|
26
38
|
* @status stable
|
|
@@ -37,10 +49,16 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
37
49
|
* @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the shown item changes. Cancelable: cancel it to keep the current item. It is the only way to stop the change.
|
|
38
50
|
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before the viewer closes. Cancelable.
|
|
39
51
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before the viewer opens. Cancelable.
|
|
40
|
-
* @event {
|
|
52
|
+
* @event {ToggleEvent} toggle - Fired when the viewer opens or closes, with `newState` and `oldState`.
|
|
41
53
|
*
|
|
42
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.
|
|
43
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.
|
|
44
62
|
* @csspart viewport - The box the current item is shown in.
|
|
45
63
|
*
|
|
46
64
|
* @cssstate fullscreen - While the viewer fills the screen.
|
|
@@ -48,6 +66,20 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
48
66
|
* @cssstate open - While the viewer is open.
|
|
49
67
|
*/
|
|
50
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;
|
|
51
83
|
/**
|
|
52
84
|
* How long the user can be idle before the header and footer hide, in
|
|
53
85
|
* milliseconds.
|
|
@@ -66,8 +98,27 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
66
98
|
*/
|
|
67
99
|
loop: boolean;
|
|
68
100
|
/**
|
|
69
|
-
* The
|
|
70
|
-
|
|
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;
|
|
119
|
+
/**
|
|
120
|
+
* The status text that says which item is shown, with `{index}`, `{count}`
|
|
121
|
+
* and the item's `{label}` filled in.
|
|
71
122
|
*
|
|
72
123
|
* Announced rather than only drawn, because the picture changing under a
|
|
73
124
|
* reader who cannot see it is otherwise silent. A consumer who has their own
|
|
@@ -80,8 +131,17 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
80
131
|
private filled;
|
|
81
132
|
/** What the live region is currently saying. */
|
|
82
133
|
private announcement;
|
|
134
|
+
protected readonly swipes: SwipeController;
|
|
83
135
|
private readonly fullscreen;
|
|
84
136
|
private readonly idle;
|
|
137
|
+
/**
|
|
138
|
+
* Whether focus is on something in the header or the footer.
|
|
139
|
+
*
|
|
140
|
+
* The styled tier hides both with `visibility: hidden` while idle, which
|
|
141
|
+
* takes focus off a control in them and drops it on the body, where the
|
|
142
|
+
* arrow keys no longer reach this element.
|
|
143
|
+
*/
|
|
144
|
+
private chromeHasFocus;
|
|
85
145
|
protected readonly commands: CommandController;
|
|
86
146
|
/**
|
|
87
147
|
* The items, read from the host.
|
|
@@ -156,6 +216,7 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
156
216
|
*/
|
|
157
217
|
private readonly handleBackdrop;
|
|
158
218
|
protected willUpdate(changed: PropertyValues): void;
|
|
219
|
+
disconnectedCallback(): void;
|
|
159
220
|
protected updated(changed: PropertyValues): void;
|
|
160
221
|
/**
|
|
161
222
|
* Tells each item whether it is the one being shown.
|
|
@@ -165,6 +226,8 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
165
226
|
* every set whose current item has just been removed.
|
|
166
227
|
*/
|
|
167
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;
|
|
168
231
|
/**
|
|
169
232
|
* Says where the reader is, once the reader has moved.
|
|
170
233
|
*
|
|
@@ -174,6 +237,14 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
174
237
|
*/
|
|
175
238
|
private say;
|
|
176
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;
|
|
177
248
|
}
|
|
178
249
|
declare global {
|
|
179
250
|
interface HTMLElementTagNameMap {
|
|
@@ -4,25 +4,46 @@ 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, FullscreenController, fillTemplate, HelixElement, hostAria, IdleController, inlineStep, keyClaimed, MixinControllerActive, MixinControllerOpen, resolveActiveItem, } 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
|
});
|
|
24
45
|
this.idle = new IdleController(this, () => this.idleDelay, (resting) => {
|
|
25
|
-
this.resting = resting;
|
|
46
|
+
this.resting = resting && !this.chromeHasFocus();
|
|
26
47
|
});
|
|
27
48
|
this.commands = new CommandController(this, {
|
|
28
49
|
commands: {
|
|
@@ -45,6 +66,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
45
66
|
this.relayNativeEvent(event);
|
|
46
67
|
};
|
|
47
68
|
this.handleKeydown = (event) => {
|
|
69
|
+
this.idle.stir();
|
|
48
70
|
if (keyClaimed(event) || event.altKey || event.ctrlKey || event.metaKey) {
|
|
49
71
|
return;
|
|
50
72
|
}
|
|
@@ -81,6 +103,12 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
81
103
|
this.requestOpen(false);
|
|
82
104
|
};
|
|
83
105
|
}
|
|
106
|
+
chromeHasFocus() {
|
|
107
|
+
const active = deepActiveElement();
|
|
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)));
|
|
111
|
+
}
|
|
84
112
|
get items() {
|
|
85
113
|
return this.knownChildren.filter((child) => child instanceof HelixHeadlessLightboxItem);
|
|
86
114
|
}
|
|
@@ -135,9 +163,19 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
135
163
|
this.toggleState('idle', this.resting);
|
|
136
164
|
this.say(changed);
|
|
137
165
|
}
|
|
166
|
+
disconnectedCallback() {
|
|
167
|
+
super.disconnectedCallback();
|
|
168
|
+
unlockScroll(this);
|
|
169
|
+
}
|
|
138
170
|
updated(changed) {
|
|
139
171
|
super.updated(changed);
|
|
140
172
|
this.mark();
|
|
173
|
+
if (this.open) {
|
|
174
|
+
lockScroll(this);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
unlockScroll(this);
|
|
178
|
+
}
|
|
141
179
|
const dialog = this.dialog;
|
|
142
180
|
if (!dialog) {
|
|
143
181
|
return;
|
|
@@ -154,9 +192,23 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
154
192
|
mark() {
|
|
155
193
|
const items = this.items;
|
|
156
194
|
const current = resolveActiveItem(this.active, items);
|
|
157
|
-
|
|
195
|
+
items.forEach((item, at) => {
|
|
158
196
|
item.current = item === current;
|
|
159
|
-
|
|
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));
|
|
160
212
|
}
|
|
161
213
|
say(changed) {
|
|
162
214
|
if (!changed.has('active') && !changed.has('open')) {
|
|
@@ -170,7 +222,13 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
170
222
|
const current = resolveActiveItem(this.active, items);
|
|
171
223
|
const at = current ? items.indexOf(current) : -1;
|
|
172
224
|
this.announcement =
|
|
173
|
-
at === -1
|
|
225
|
+
at === -1 || !current
|
|
226
|
+
? ''
|
|
227
|
+
: fillTemplate(this.statusLabel, {
|
|
228
|
+
count: items.length,
|
|
229
|
+
index: at + 1,
|
|
230
|
+
label: current.label,
|
|
231
|
+
});
|
|
174
232
|
}
|
|
175
233
|
render() {
|
|
176
234
|
return html `<dialog
|
|
@@ -191,10 +249,51 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
191
249
|
<slot></slot>
|
|
192
250
|
</div>
|
|
193
251
|
<slot name="footer"></slot>
|
|
252
|
+
${this.controls ? this.renderControls() : nothing}
|
|
194
253
|
<span part="live" role="status" aria-live="polite">${this.announcement || nothing}</span>
|
|
195
254
|
</dialog>`;
|
|
196
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
|
+
}
|
|
197
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);
|
|
198
297
|
__decorate([
|
|
199
298
|
property({ attribute: 'idle-delay', type: Number })
|
|
200
299
|
], HelixHeadlessLightbox.prototype, "idleDelay", void 0);
|
|
@@ -204,6 +303,18 @@ __decorate([
|
|
|
204
303
|
__decorate([
|
|
205
304
|
property({ reflect: true, type: Boolean })
|
|
206
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);
|
|
207
318
|
__decorate([
|
|
208
319
|
property({ attribute: 'status-label' })
|
|
209
320
|
], HelixHeadlessLightbox.prototype, "statusLabel", void 0);
|
|
@@ -23,8 +23,15 @@ 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
|
+
* `label` or the table's caption, and gives each series' latest reading.
|
|
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.
|
|
28
35
|
*
|
|
29
36
|
* @since 0.1.0
|
|
30
37
|
* @status stable
|
|
@@ -40,8 +47,10 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
40
47
|
* @csspart label - One reading's name.
|
|
41
48
|
* @csspart labels - The row of reading names.
|
|
42
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.
|
|
43
51
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
44
|
-
* @csspart plot - The drawing.
|
|
52
|
+
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
53
|
+
* @csspart summary - The chart's name and each series' latest reading, written as a sentence for screen readers. Hide it visually.
|
|
45
54
|
* @csspart svg - The drawing surface the lines and areas sit on.
|
|
46
55
|
* @csspart terminus - The mark on one series' last reading.
|
|
47
56
|
* @csspart tooltip - The bubble, forwarded from `Tooltip`.
|
|
@@ -53,6 +62,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
53
62
|
* @csspart tooltip-arrow-top - The point while the bubble is above the reading, so on its bottom edge, beside `tooltip-arrow`.
|
|
54
63
|
* @csspart tooltip-bottom - The bubble while it is below the reading, beside `tooltip`.
|
|
55
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`.
|
|
56
66
|
* @csspart tooltip-label - The reading's own name inside the tooltip.
|
|
57
67
|
* @csspart tooltip-left - The bubble while it is left of the reading, beside `tooltip`.
|
|
58
68
|
* @csspart tooltip-name - A column's name inside the tooltip.
|
|
@@ -183,6 +193,16 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
|
|
|
183
193
|
*/
|
|
184
194
|
private ends;
|
|
185
195
|
protected render(): TemplateResult;
|
|
196
|
+
/**
|
|
197
|
+
* What a reader who cannot see the lines is told: the chart's name and the
|
|
198
|
+
* latest reading of each series.
|
|
199
|
+
*
|
|
200
|
+
* The latest, because where a series ended is the question a line over time
|
|
201
|
+
* is asked first, which is what `AreaChart` gives too. Each series' own last
|
|
202
|
+
* reading, so a series with a blank in the last row still says where it was.
|
|
203
|
+
* Written the way the table writes it, such as `$128k` for `128000`.
|
|
204
|
+
*/
|
|
205
|
+
protected renderSummary(series: Series[]): TemplateResult;
|
|
186
206
|
/**
|
|
187
207
|
* The lines themselves, behind a seam the styled tier can move.
|
|
188
208
|
*
|
|
@@ -235,7 +255,12 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
|
|
|
235
255
|
x: number;
|
|
236
256
|
y: number;
|
|
237
257
|
}>): TemplateResult | typeof nothing;
|
|
238
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* One series, its wash first so the line is drawn over its own fill.
|
|
260
|
+
*
|
|
261
|
+
* Each reading sits at its own row, and the line breaks where a row has no
|
|
262
|
+
* reading: a line drawn across a blank claims a value nobody measured.
|
|
263
|
+
*/
|
|
239
264
|
protected renderSeries(one: Series, depth: number, x: (value: number) => number, y: (value: number) => number): TemplateResult;
|
|
240
265
|
/**
|
|
241
266
|
* The reading names, as HTML beside the drawing rather than inside it.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { CHART_PLOT, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { byRow, CHART_PLOT, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, unbroken, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -21,20 +21,25 @@ 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
|
}
|
|
34
39
|
return [
|
|
35
40
|
{
|
|
36
41
|
index: seriesIndex(depth),
|
|
37
|
-
x: (x(
|
|
42
|
+
x: (x(last.at) / PLOT_WIDTH) * 100,
|
|
38
43
|
y: (y(last.value) / PLOT_HEIGHT) * 100,
|
|
39
44
|
},
|
|
40
45
|
];
|
|
@@ -42,7 +47,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
42
47
|
}
|
|
43
48
|
render() {
|
|
44
49
|
const series = this.series;
|
|
45
|
-
const readings = series[
|
|
50
|
+
const readings = series.length === 0 ? [] : this.sourceRows.map((row) => row.label);
|
|
46
51
|
if (readings.length === 0) {
|
|
47
52
|
return html `<div id=${CHART_PLOT} part="plot"></div>`;
|
|
48
53
|
}
|
|
@@ -50,7 +55,25 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
50
55
|
const y = linear(domain, [PLOT_HEIGHT, 0]);
|
|
51
56
|
const slot = PLOT_WIDTH / readings.length;
|
|
52
57
|
const x = linear([0, Math.max(readings.length - 1, 1)], [slot / 2, PLOT_WIDTH - slot / 2]);
|
|
53
|
-
return html `${this.renderPlot(series, x, y, domain)} ${this.renderLabels(readings)}`;
|
|
58
|
+
return html `${this.renderPlot(series, x, y, domain)} ${this.renderLabels(readings)}${this.renderSummary(series)}`;
|
|
59
|
+
}
|
|
60
|
+
renderSummary(series) {
|
|
61
|
+
const rows = this.sourceRows;
|
|
62
|
+
const columns = this.plottedColumns;
|
|
63
|
+
const latest = series.flatMap((one, depth) => {
|
|
64
|
+
const last = one.points.at(-1);
|
|
65
|
+
if (last === undefined) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
const text = rows[last.at]?.cells[columns[depth] ?? -1]?.text ?? String(last.value);
|
|
69
|
+
return [{ label: last.label, reading: `${one.name} ${text}` }];
|
|
70
|
+
});
|
|
71
|
+
const shared = latest.every((one) => one.label === latest[0]?.label);
|
|
72
|
+
const body = shared
|
|
73
|
+
? `${latest[0]?.label ?? ''}: ${latest.map((one) => one.reading).join(', ')}`
|
|
74
|
+
: latest.map((one) => `${one.label}: ${one.reading}`).join('; ');
|
|
75
|
+
const named = this.named ? `${this.named}, ` : '';
|
|
76
|
+
return html `<p id="helix-chart-summary" part="summary">${named}${body}.</p>`;
|
|
54
77
|
}
|
|
55
78
|
renderPlot(series, x, y, domain) {
|
|
56
79
|
const floor = domain[0] <= 0 && domain[1] >= 0 ? y(0) : undefined;
|
|
@@ -61,22 +84,27 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
61
84
|
.join(', ')
|
|
62
85
|
: undefined;
|
|
63
86
|
return html `<div
|
|
64
|
-
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'}
|
|
65
90
|
id=${CHART_PLOT}
|
|
66
91
|
part="plot"
|
|
92
|
+
role="application"
|
|
93
|
+
tabindex="0"
|
|
67
94
|
style=${holes ? `--_line-chart-holes: ${holes}` : nothing}
|
|
68
95
|
>
|
|
69
96
|
<svg part="svg"
|
|
97
|
+
aria-hidden="true"
|
|
70
98
|
data-mirror
|
|
71
99
|
preserveAspectRatio="none"
|
|
72
100
|
viewBox="0 0 ${PLOT_WIDTH} ${PLOT_HEIGHT}"
|
|
73
101
|
xmlns="http://www.w3.org/2000/svg"
|
|
74
102
|
>
|
|
75
|
-
${this.renderGridlines(x, y, domain,
|
|
103
|
+
${this.renderGridlines(x, y, domain, this.readings)}
|
|
76
104
|
${floor === undefined
|
|
77
105
|
? nothing
|
|
78
106
|
: svg `<line part="baseline" x1="0" x2=${PLOT_WIDTH} y1=${floor} y2=${floor} />`}
|
|
79
|
-
${this.renderBand(
|
|
107
|
+
${this.renderBand(this.readings)}
|
|
80
108
|
${this.renderGuide(x)}
|
|
81
109
|
${series.map((one, depth) => this.renderSeries(one, depth, x, y))}
|
|
82
110
|
</svg>
|
|
@@ -122,15 +150,27 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
122
150
|
></span>`)}`;
|
|
123
151
|
}
|
|
124
152
|
renderSeries(one, depth, x, y) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
153
|
+
if (!this.showsSeries(one.name)) {
|
|
154
|
+
return html `${nothing}`;
|
|
155
|
+
}
|
|
156
|
+
const runs = unbroken(one)
|
|
157
|
+
.map((run) => {
|
|
158
|
+
const points = run.map((point) => [x(point.at), y(point.value)]);
|
|
159
|
+
return { path: linePath(points, this.curve ?? 'smooth'), points };
|
|
160
|
+
})
|
|
161
|
+
.filter((run) => run.path !== '');
|
|
162
|
+
if (runs.length === 0) {
|
|
128
163
|
return html `${nothing}`;
|
|
129
164
|
}
|
|
130
165
|
const index = seriesIndex(depth);
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
166
|
+
const path = runs.map((run) => run.path).join('');
|
|
167
|
+
const wash = runs
|
|
168
|
+
.map((run) => {
|
|
169
|
+
const first = run.points[0];
|
|
170
|
+
const last = run.points.at(-1);
|
|
171
|
+
return `${run.path}L${last[0]},${PLOT_HEIGHT}L${first[0]},${PLOT_HEIGHT}Z`;
|
|
172
|
+
})
|
|
173
|
+
.join('');
|
|
134
174
|
return svg `${this.area
|
|
135
175
|
? svg `<path
|
|
136
176
|
d=${wash}
|
|
@@ -155,12 +195,13 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
155
195
|
const at = this.pointer.at;
|
|
156
196
|
const series = this.series;
|
|
157
197
|
if (at < 0 || series.length === 0) {
|
|
158
|
-
return drawTooltip(this.sourceRows, at, this.tag('tooltip'));
|
|
198
|
+
return drawTooltip(this.sourceRows, at, this.tag('tooltip'), undefined, undefined, this.pointer);
|
|
159
199
|
}
|
|
160
200
|
const domain = this.range(series);
|
|
161
201
|
const scale = linear(domain, [PLOT_HEIGHT, 0]);
|
|
162
202
|
const tops = series
|
|
163
|
-
.
|
|
203
|
+
.filter((one) => this.showsSeries(one.name))
|
|
204
|
+
.map((one) => byRow(one, this.readings)[at]?.value)
|
|
164
205
|
.filter((one) => one !== undefined)
|
|
165
206
|
.map((one) => scale(one));
|
|
166
207
|
const slot = 100 / this.readings;
|
|
@@ -168,7 +209,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
168
209
|
placement: 'top',
|
|
169
210
|
x: `${at * slot + slot / 2}%`,
|
|
170
211
|
y: `${tops.length > 0 ? Math.min(...tops) : 0}%`,
|
|
171
|
-
}, (cell) => this.seriesOf(cell));
|
|
212
|
+
}, (cell) => this.seriesOf(cell), this.pointer);
|
|
172
213
|
}
|
|
173
214
|
};
|
|
174
215
|
__decorate([
|
|
@@ -6,11 +6,16 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
6
6
|
* @description
|
|
7
7
|
* Provides layout and semantics. The row is a target only when you set `href`.
|
|
8
8
|
*
|
|
9
|
-
* **`href` makes the
|
|
10
|
-
* an `<a part="
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* destination, and all of it works before
|
|
9
|
+
* **`href` makes the row a link.** The component wraps the leading content,
|
|
10
|
+
* the label, and the description in an `<a part="link">` inside the row, as
|
|
11
|
+
* `Tree.Item` does. An anchor of your own cannot wrap slots it does not own.
|
|
12
|
+
* With the anchor, the row is a target, Enter follows it, middle click opens a
|
|
13
|
+
* new tab, the status bar shows the destination, and all of it works before
|
|
14
|
+
* JavaScript runs.
|
|
15
|
+
*
|
|
16
|
+
* **The `end` slot sits beside the link, outside it**, so a button or a menu
|
|
17
|
+
* there is a control of its own: a click on it does not follow the link, and
|
|
18
|
+
* its name is not part of the link's.
|
|
14
19
|
*
|
|
15
20
|
* Client-side routing needs your own handling. A router cannot render its
|
|
16
21
|
* anchor inside the shadow root, so to navigate without a page load, intercept
|
|
@@ -30,6 +35,7 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
30
35
|
* @slot end - Trailing content.
|
|
31
36
|
* @slot start - Leading content, usually an icon or an avatar.
|
|
32
37
|
*
|
|
38
|
+
* @csspart link - The link, when the row has `href`. It holds every region except `end`.
|
|
33
39
|
* @csspart row - The row's layout. It sits inside the host so the host can carry a list marker.
|
|
34
40
|
*/
|
|
35
41
|
export declare class HelixHeadlessListItem extends HelixElement {
|
|
@@ -24,17 +24,16 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
24
24
|
render() {
|
|
25
25
|
const content = html `${this.renderRail()}<slot name="start"></slot>
|
|
26
26
|
<slot></slot>
|
|
27
|
-
<slot name="description"></slot
|
|
28
|
-
<slot name="end"></slot>`;
|
|
27
|
+
<slot name="description"></slot>`;
|
|
29
28
|
return this.href === ''
|
|
30
|
-
? html `<div part="row">${content}
|
|
31
|
-
: html `<a
|
|
32
|
-
part="
|
|
29
|
+
? html `<div part="row">${content}<slot name="end"></slot></div>`
|
|
30
|
+
: html `<div part="row"><a
|
|
31
|
+
part="link"
|
|
33
32
|
href=${this.href}
|
|
34
33
|
target=${this.target || nothing}
|
|
35
34
|
rel=${this.rel || nothing}
|
|
36
35
|
>${content}</a
|
|
37
|
-
>`;
|
|
36
|
+
><slot name="end"></slot></div>`;
|
|
38
37
|
}
|
|
39
38
|
};
|
|
40
39
|
__decorate([
|