@fusion.dev/helix-headless 0.145.0 → 0.147.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 +12286 -4281
- package/dist/accordion/item/accordion-item.d.ts +51 -18
- package/dist/accordion/item/accordion-item.js +45 -13
- package/dist/accordion/root/accordion-root.d.ts +16 -7
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +16 -6
- package/dist/announcement/root/announcement-root.js +37 -7
- package/dist/app-header/root/app-header-root.d.ts +7 -2
- package/dist/app-header/root/app-header-root.js +9 -1
- package/dist/app-header/sectioning.d.ts +3 -1
- package/dist/app-header/sectioning.js +3 -2
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +11 -3
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +60 -7
- package/dist/badge/root/badge-root.js +89 -6
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +48 -20
- package/dist/bar-chart/stack.d.ts +25 -0
- package/dist/bar-chart/stack.js +27 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
- package/dist/button/root/button-root.d.ts +50 -38
- package/dist/button/root/button-root.js +42 -53
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.js +2 -2
- package/dist/card/root/card-root.d.ts +36 -4
- package/dist/card/root/card-root.js +29 -10
- package/dist/carousel/root/carousel-root.d.ts +43 -4
- package/dist/carousel/root/carousel-root.js +40 -12
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/message/chat-message.js +5 -4
- package/dist/chat/naming.d.ts +5 -1
- package/dist/chat/naming.js +4 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +32 -6
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +18 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
- package/dist/checkbox-group/select-all.d.ts +21 -0
- package/dist/checkbox-group/select-all.js +7 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +79 -10
- package/dist/code-block/root/code-block-root.js +74 -5
- package/dist/color-input/root/color-input-root.d.ts +14 -0
- package/dist/color-input/root/color-input-root.js +17 -7
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +53 -16
- package/dist/color-picker/root/color-picker-root.js +155 -46
- package/dist/color-picker/wheel.d.ts +17 -0
- package/dist/color-picker/wheel.js +6 -0
- package/dist/combobox/root/combobox-root.d.ts +56 -0
- package/dist/combobox/root/combobox-root.js +92 -15
- package/dist/command/root/command-root.d.ts +19 -2
- package/dist/command/root/command-root.js +24 -23
- package/dist/copy-button/root/copy-button-root.d.ts +21 -1
- package/dist/copy-button/root/copy-button-root.js +16 -4
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +6 -0
- package/dist/data-table/keys.js +14 -0
- package/dist/data-table/root/data-table-root.d.ts +27 -18
- package/dist/data-table/root/data-table-root.js +31 -57
- package/dist/data-table/tree.d.ts +16 -1
- package/dist/data-table/tree.js +2 -3
- package/dist/date-input/root/date-input-root.d.ts +11 -2
- package/dist/date-input/root/date-input-root.js +26 -12
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +33 -22
- package/dist/description-list/item/description-list-item.d.ts +18 -4
- package/dist/description-list/item/description-list-item.js +8 -4
- package/dist/dialog/description.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +55 -1
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +75 -4
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +40 -5
- package/dist/drilldown/root/drilldown-root.d.ts +21 -3
- package/dist/drilldown/root/drilldown-root.js +22 -3
- package/dist/element-events.generated.js +35 -6
- package/dist/empty/root/empty-root.d.ts +34 -2
- package/dist/empty/root/empty-root.js +26 -4
- package/dist/file-input/root/file-input-root.d.ts +99 -8
- package/dist/file-input/root/file-input-root.js +120 -22
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +10 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +11 -2
- package/dist/filter-input/menu/filter-menu.d.ts +2 -0
- package/dist/filter-input/menu/filter-menu.js +12 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -6
- package/dist/filter-input/root/filter-input-root.js +18 -28
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/options.d.ts +3 -4
- package/dist/format-date/options.js +2 -2
- package/dist/format-date/root/format-date-root.d.ts +27 -17
- package/dist/format-date/root/format-date-root.js +27 -48
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +83 -11
- package/dist/heatmap/root/heatmap-root.js +104 -12
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +25 -1
- package/dist/icon/root/icon-root.js +44 -12
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +14 -1
- package/dist/image/root/image-root.js +7 -2
- package/dist/input/root/input-root.d.ts +34 -3
- package/dist/input/root/input-root.js +17 -4
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +52 -1
- package/dist/kbd/root/kbd-root.js +40 -47
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +77 -12
- package/dist/legend/root/legend-root.js +71 -17
- package/dist/lightbox/root/lightbox-root.d.ts +98 -10
- package/dist/lightbox/root/lightbox-root.js +153 -18
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +24 -0
- package/dist/lightbox/zoom.js +18 -0
- package/dist/line-chart/root/line-chart-root.d.ts +38 -1
- package/dist/line-chart/root/line-chart-root.js +31 -3
- package/dist/list/item/list-item.d.ts +2 -0
- package/dist/list/item/list-item.js +11 -2
- package/dist/list/root/list-root.d.ts +70 -13
- package/dist/list/root/list-root.js +91 -13
- package/dist/list/selection.d.ts +54 -7
- package/dist/list/selection.js +32 -7
- package/dist/listbox/root/listbox-root.d.ts +44 -4
- package/dist/listbox/root/listbox-root.js +72 -34
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -3
- package/dist/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +80 -15
- package/dist/megamenu/root/megamenu-root.js +76 -19
- package/dist/menu/item/menu-item.d.ts +51 -2
- package/dist/menu/item/menu-item.js +50 -26
- package/dist/menu/root/menu-root.d.ts +17 -0
- package/dist/menu/root/menu-root.js +2 -2
- package/dist/meter/root/meter-root.d.ts +62 -1
- package/dist/meter/root/meter-root.js +38 -16
- package/dist/navigation/root/navigation-root.d.ts +2 -1
- package/dist/navigation/root/navigation-root.js +2 -2
- package/dist/notifications/root/notifications-root.d.ts +20 -4
- package/dist/notifications/root/notifications-root.js +30 -8
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +34 -9
- package/dist/number-input/root/number-input-root.js +31 -25
- package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
- package/dist/object-inspector/root/object-inspector-root.js +134 -92
- package/dist/object-inspector/rows.d.ts +18 -0
- package/dist/object-inspector/rows.js +33 -0
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +30 -0
- package/dist/outline/root/outline-root.js +17 -13
- package/dist/pagination/size/pagination-size.d.ts +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +37 -0
- package/dist/pin-input/code.js +25 -0
- package/dist/pin-input/root/pin-input-root.d.ts +116 -115
- package/dist/pin-input/root/pin-input-root.js +163 -155
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +34 -0
- package/dist/popover/root/popover-root.d.ts +64 -8
- package/dist/popover/root/popover-root.js +67 -4
- package/dist/progress/root/progress-root.d.ts +47 -0
- package/dist/progress/root/progress-root.js +34 -16
- package/dist/qr-code/export.d.ts +45 -1
- package/dist/qr-code/export.js +28 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +36 -11
- package/dist/qr-code/root/qr-code-root.js +58 -11
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +15 -0
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +7 -2
- package/dist/rating/root/rating-root.d.ts +30 -12
- package/dist/rating/root/rating-root.js +27 -27
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +51 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
- package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
- package/dist/scroll-area/root/scroll-area-root.js +57 -173
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +27 -8
- package/dist/scroll-area/scrollbar.js +10 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +71 -0
- package/dist/select/root/select-root.js +78 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +59 -5
- package/dist/slider/root/slider-root.js +45 -3
- package/dist/sparkline/readings.d.ts +36 -0
- package/dist/sparkline/readings.js +36 -0
- package/dist/sparkline/root/sparkline-root.d.ts +121 -7
- package/dist/sparkline/root/sparkline-root.js +160 -26
- package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
- package/dist/speed-dial/item/speed-dial-item.js +2 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
- package/dist/speed-dial/root/speed-dial-root.js +11 -3
- package/dist/splitter/root/splitter-root.d.ts +10 -12
- package/dist/splitter/root/splitter-root.js +211 -204
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +5 -0
- package/dist/steps/reach.js +3 -0
- package/dist/steps/root/steps-root.d.ts +56 -3
- package/dist/steps/root/steps-root.js +50 -6
- package/dist/steps/step/step.d.ts +8 -0
- package/dist/steps/step/step.js +8 -3
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +6 -10
- package/dist/table/column/table-column.js +8 -20
- package/dist/table/root/table-root.d.ts +31 -10
- package/dist/table/root/table-root.js +14 -18
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/panel/tab-panel.d.ts +16 -3
- package/dist/tabs/panel/tab-panel.js +34 -5
- package/dist/tabs/root/tabs-root.d.ts +17 -3
- package/dist/tabs/root/tabs-root.js +1 -1
- package/dist/tabs/tab/tab.d.ts +5 -0
- package/dist/tabs/tab/tab.js +5 -2
- package/dist/tag/group/tag-group.d.ts +44 -5
- package/dist/tag/group/tag-group.js +60 -9
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +41 -2
- package/dist/textarea/root/textarea-root.js +39 -1
- package/dist/time-input/root/time-input-root.d.ts +10 -2
- package/dist/time-input/root/time-input-root.js +24 -13
- package/dist/time-picker/root/time-picker-root.d.ts +28 -17
- package/dist/time-picker/root/time-picker-root.js +18 -29
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- package/dist/timeline/group/timeline-group.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -3
- package/dist/toast/item/toast-item.js +22 -6
- package/dist/toast/root/toast-root.d.ts +34 -4
- package/dist/toast/root/toast-root.js +74 -13
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +52 -7
- package/dist/toggle/group/toggle-group.js +58 -44
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +21 -5
- package/dist/toolbar/root/toolbar-root.js +52 -8
- package/dist/tooltip/root/tooltip-root.d.ts +20 -3
- package/dist/tooltip/root/tooltip-root.js +18 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +45 -2
- package/dist/tour/root/tour-root.js +53 -8
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/item/tree-item.d.ts +7 -3
- package/dist/tree/item/tree-item.js +3 -0
- package/dist/tree/root/tree-root.d.ts +24 -3
- package/dist/tree/root/tree-root.js +32 -13
- package/dist/tree/selection.js +2 -15
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +83 -19
- package/dist/trend/root/trend-root.js +59 -8
- package/dist/video/media-events.d.ts +13 -18
- package/dist/video/media-events.js +1 -5
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +23 -6
- package/dist/video/root/video-root.js +19 -10
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -8
- package/dist/virtual-list/fill.js +10 -17
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +65 -0
- package/dist/virtual-list/plan.js +27 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
- package/dist/virtual-list/root/virtual-list-root.js +218 -51
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +7441 -1458
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1501 -326
- package/dist/chat/relative-clock.d.ts +0 -39
- package/dist/chat/relative-clock.js +0 -31
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -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 { byRow, CHART_PLOT, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, unbroken, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, 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';
|
|
@@ -12,6 +12,8 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
this.area = false;
|
|
15
|
+
this.dashed = '';
|
|
16
|
+
this.markers = false;
|
|
15
17
|
this.zero = false;
|
|
16
18
|
}
|
|
17
19
|
get rulesValue() {
|
|
@@ -62,7 +64,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
62
64
|
const columns = this.plottedColumns;
|
|
63
65
|
const latest = series.flatMap((one, depth) => {
|
|
64
66
|
const last = one.points.at(-1);
|
|
65
|
-
if (last === undefined) {
|
|
67
|
+
if (last === undefined || !this.showsSeries(one.name)) {
|
|
66
68
|
return [];
|
|
67
69
|
}
|
|
68
70
|
const text = rows[last.at]?.cells[columns[depth] ?? -1]?.text ?? String(last.value);
|
|
@@ -109,6 +111,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
109
111
|
${series.map((one, depth) => this.renderSeries(one, depth, x, y))}
|
|
110
112
|
</svg>
|
|
111
113
|
${this.renderTermini(ends)}
|
|
114
|
+
${this.renderMarkers(series, x, y)}
|
|
112
115
|
${this.renderTooltip()}
|
|
113
116
|
</div>`;
|
|
114
117
|
}
|
|
@@ -149,6 +152,25 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
149
152
|
style=${`--chart-series: var(--chart-series-${end.index}); --chart-terminus-x: ${end.x}%; --chart-terminus-y: ${end.y}%`}
|
|
150
153
|
></span>`)}`;
|
|
151
154
|
}
|
|
155
|
+
renderMarkers(series, x, y) {
|
|
156
|
+
const marks = series.flatMap((one, depth) => this.showsSeries(one.name)
|
|
157
|
+
? unbroken(one).flatMap((run) => run.length > 1 && !this.markers
|
|
158
|
+
? []
|
|
159
|
+
: run.map((point) => ({ depth, lone: run.length === 1, point })))
|
|
160
|
+
: []);
|
|
161
|
+
if (marks.length === 0) {
|
|
162
|
+
return nothing;
|
|
163
|
+
}
|
|
164
|
+
return html `${marks.map(({ depth, lone, point }) => html `<span
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
part="marker${lone ? ' marker-lone' : ''}"
|
|
167
|
+
style=${`--chart-series: var(--chart-series-${seriesIndex(depth)}); inset-inline-start: ${(x(point.at) / PLOT_WIDTH) * 100}%; inset-block-start: ${(y(point.value) / PLOT_HEIGHT) * 100}%`}
|
|
168
|
+
></span>`)}`;
|
|
169
|
+
}
|
|
170
|
+
dashes(name) {
|
|
171
|
+
const key = seriesKey(name);
|
|
172
|
+
return this.dashed !== '' && commaList(this.dashed).some((one) => seriesKey(one) === key);
|
|
173
|
+
}
|
|
152
174
|
renderSeries(one, depth, x, y) {
|
|
153
175
|
if (!this.showsSeries(one.name)) {
|
|
154
176
|
return html `${nothing}`;
|
|
@@ -182,7 +204,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
182
204
|
d=${path}
|
|
183
205
|
data-series=${index}
|
|
184
206
|
fill="none"
|
|
185
|
-
part="line"
|
|
207
|
+
part="line${this.dashes(one.name) ? ' line-dashed' : ''}"
|
|
186
208
|
style="--chart-series: var(--chart-series-${index})"
|
|
187
209
|
/>`;
|
|
188
210
|
}
|
|
@@ -218,9 +240,15 @@ __decorate([
|
|
|
218
240
|
__decorate([
|
|
219
241
|
property({ reflect: true })
|
|
220
242
|
], HelixHeadlessLineChart.prototype, "curve", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property()
|
|
245
|
+
], HelixHeadlessLineChart.prototype, "dashed", void 0);
|
|
221
246
|
__decorate([
|
|
222
247
|
property()
|
|
223
248
|
], HelixHeadlessLineChart.prototype, "gridlines", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
property({ reflect: true, type: Boolean })
|
|
251
|
+
], HelixHeadlessLineChart.prototype, "markers", void 0);
|
|
224
252
|
__decorate([
|
|
225
253
|
property({ reflect: true })
|
|
226
254
|
], HelixHeadlessLineChart.prototype, "terminus", void 0);
|
|
@@ -109,6 +109,8 @@ export declare class HelixHeadlessListItem extends HelixElement {
|
|
|
109
109
|
value: string;
|
|
110
110
|
/** The row's words, or none where the children are not known yet. */
|
|
111
111
|
get words(): string;
|
|
112
|
+
/** Whether something is slotted into `description`, or false where the children are not known yet. */
|
|
113
|
+
private get described();
|
|
112
114
|
/** Whether a list with `selection-mode` holds this row, which makes it a row of a grid. */
|
|
113
115
|
private get grouped();
|
|
114
116
|
/** @internal The cell a list with `selection-mode` moves focus to. */
|
|
@@ -20,6 +20,9 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
20
20
|
get words() {
|
|
21
21
|
return this.childrenKnown ? slottedWords(this, ['']) : '';
|
|
22
22
|
}
|
|
23
|
+
get described() {
|
|
24
|
+
return this.childrenKnown && this.knownChildren.some((child) => child.slot === 'description');
|
|
25
|
+
}
|
|
23
26
|
get grouped() {
|
|
24
27
|
return this.focusable !== undefined;
|
|
25
28
|
}
|
|
@@ -54,20 +57,26 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
54
57
|
}
|
|
55
58
|
render() {
|
|
56
59
|
const content = html `${this.renderRail()}<slot name="start"></slot>
|
|
57
|
-
<slot></slot>
|
|
58
|
-
<slot name="description"></slot>`;
|
|
60
|
+
<slot id="label"></slot>
|
|
61
|
+
<slot name="description" id="description"></slot>`;
|
|
59
62
|
const role = this.grouped ? 'gridcell' : nothing;
|
|
60
63
|
const tabindex = this.grouped ? (this.focusable ? '0' : '-1') : nothing;
|
|
64
|
+
const labelledby = this.grouped && this.words !== '' ? 'label' : nothing;
|
|
65
|
+
const describedby = this.grouped && this.described ? 'description' : nothing;
|
|
61
66
|
return this.href === ''
|
|
62
67
|
? html `<div
|
|
63
68
|
part="row${this.current === undefined ? '' : ' row-current'}"
|
|
64
69
|
role=${role}
|
|
65
70
|
tabindex=${tabindex}
|
|
71
|
+
aria-labelledby=${labelledby}
|
|
72
|
+
aria-describedby=${describedby}
|
|
66
73
|
>${content}<slot name="end"></slot></div>`
|
|
67
74
|
: html `<div
|
|
68
75
|
part="row${this.current === undefined ? '' : ' row-current'}"
|
|
69
76
|
role=${role}
|
|
70
77
|
tabindex=${tabindex}
|
|
78
|
+
aria-labelledby=${labelledby}
|
|
79
|
+
aria-describedby=${describedby}
|
|
71
80
|
><a
|
|
72
81
|
part="link"
|
|
73
82
|
href=${this.href}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HelixElement, KeyboardNavigationController } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import { HelixHeadlessListItem } from '../item/list-item.js';
|
|
4
|
-
import { type ListSelectionMode } from '../selection.js';
|
|
4
|
+
import { type ListSelectionBehavior, type ListSelectionMode } from '../selection.js';
|
|
5
5
|
/**
|
|
6
6
|
* @summary A set of rows, announced as a list.
|
|
7
7
|
*
|
|
@@ -10,15 +10,35 @@ import { type ListSelectionMode } from '../selection.js';
|
|
|
10
10
|
* announces each one's position, such as "1 of 7".
|
|
11
11
|
*
|
|
12
12
|
* **`selection-mode` makes the list interactive**, in the way of a grid list:
|
|
13
|
-
* a grid of rows that is one tab stop.
|
|
14
|
-
*
|
|
15
|
-
* row starting with it. Left and Right move between the row and the controls
|
|
16
|
-
* in its `end` slot. `single` selects one row at a time and `multiple` any
|
|
17
|
-
* number, with Space or a press, and `value` holds the selected rows' values,
|
|
13
|
+
* a grid of rows that is one tab stop. `single` selects one row at a time and
|
|
14
|
+
* `multiple` any number, and `value` holds the selected rows' values,
|
|
18
15
|
* separated by commas. A change asks with `helix-before-change` and tells
|
|
19
|
-
* with `change`.
|
|
20
|
-
* `
|
|
21
|
-
* `
|
|
16
|
+
* with `change`. `none` selects nothing, so a press acts on the row. A
|
|
17
|
+
* `disabled` row is passed over. Each row is named by its label and described
|
|
18
|
+
* by its description, so the words of the controls in `end` are not read as
|
|
19
|
+
* part of its name.
|
|
20
|
+
*
|
|
21
|
+
* `selection-behavior` says what a press does to the rows already selected.
|
|
22
|
+
* `toggle`, the default, adds or takes out the row. `replace` selects the row
|
|
23
|
+
* alone, as a file list does, and the arrow keys carry the selection with
|
|
24
|
+
* them. Control or Command with a press then adds or takes out one row.
|
|
25
|
+
*
|
|
26
|
+
* | Key | What it does |
|
|
27
|
+
* |---|---|
|
|
28
|
+
* | Down, Up | Moves to the next or the previous row. Under `replace`, selects it. |
|
|
29
|
+
* | Home, End | Moves to the first or the last row. Under `replace`, selects it. |
|
|
30
|
+
* | Page Down, Page Up | Moves a box's height of rows, so the row at one edge lands at the other. Under `replace`, selects the row it lands on. |
|
|
31
|
+
* | A letter or a word | Moves to the next row whose words start with what you typed. |
|
|
32
|
+
* | Left, Right | Moves between the row and the controls in its `end` slot. |
|
|
33
|
+
* | Space | Selects the row, or lets it go. |
|
|
34
|
+
* | Shift with Down, Up, Home, End, Page Down, Page Up or Space | Selects every row from the last one pressed, in `multiple`. |
|
|
35
|
+
* | Control or Command with Down, Up, Home, End, Page Down or Page Up | Moves without selecting, under `replace`. |
|
|
36
|
+
* | Control or Command with A | Selects every row, in `multiple`. |
|
|
37
|
+
* | Escape | Lets go of every selected row, asking first, and keeps the key from the dialog or menu around the list. With nothing selected, the key goes on to them. |
|
|
38
|
+
* | Enter | Acts on the row: follows its link, or sends `helix-action` from it. |
|
|
39
|
+
*
|
|
40
|
+
* A press with Shift selects every row from the last one pressed, and a press
|
|
41
|
+
* with Control or Command adds or takes out one row under `replace`.
|
|
22
42
|
*
|
|
23
43
|
* **Leave `selection-mode` unset for a list a reader reads**, and set it for
|
|
24
44
|
* one a reader chooses from or acts on. The rows of an interactive list are
|
|
@@ -80,6 +100,12 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
80
100
|
* its last row, as `<ol reversed>` does.
|
|
81
101
|
*/
|
|
82
102
|
reversed: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* What a press does to the rows already selected, in a list that selects:
|
|
105
|
+
* `toggle` adds or takes out the row, and `replace` selects it alone and
|
|
106
|
+
* lets the arrow keys carry the selection.
|
|
107
|
+
*/
|
|
108
|
+
selectionBehavior: ListSelectionBehavior;
|
|
83
109
|
/**
|
|
84
110
|
* Makes the list interactive: `single` selects one row, `multiple` any
|
|
85
111
|
* number, and `none` moves and acts without selecting. Unset is a list a
|
|
@@ -112,6 +138,13 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
112
138
|
value: string;
|
|
113
139
|
/** The row the reader was last on, which keeps the tab stop. */
|
|
114
140
|
private last;
|
|
141
|
+
/** The value of the row a Shift range runs from: the last row pressed. */
|
|
142
|
+
private anchor;
|
|
143
|
+
/**
|
|
144
|
+
* Shift and Control or Command on the key that is moving focus, read when
|
|
145
|
+
* focus arrives on a row and cleared once the key has been answered.
|
|
146
|
+
*/
|
|
147
|
+
private moving;
|
|
115
148
|
/**
|
|
116
149
|
* Up, Down, Home, End and typed letters, moving focus and choosing nothing,
|
|
117
150
|
* from the focused row and without wrapping. Left and Right are the row's.
|
|
@@ -136,15 +169,39 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
136
169
|
/** The row a press or a key came from, read off the event's path. */
|
|
137
170
|
private rowOf;
|
|
138
171
|
/**
|
|
139
|
-
* Selects
|
|
140
|
-
* carries the `value`
|
|
141
|
-
* has moved.
|
|
172
|
+
* Selects what a press or a key leaves, asking first. `helix-before-change`
|
|
173
|
+
* carries the `value` it would leave, and `change` follows once it has moved.
|
|
142
174
|
*/
|
|
143
|
-
|
|
175
|
+
private choose;
|
|
176
|
+
/** What `choiceValue` needs of this list for a row. */
|
|
177
|
+
private choice;
|
|
178
|
+
/**
|
|
179
|
+
* Selects the row, or lets it go, by `selection-behavior`: Shift takes in
|
|
180
|
+
* the rows from the last one pressed, and Control or Command toggles one row
|
|
181
|
+
* under `replace`. The row is where the next range runs from.
|
|
182
|
+
*/
|
|
183
|
+
protected press(row: HelixHeadlessListItem, extend?: boolean, toggle?: boolean): void;
|
|
184
|
+
/**
|
|
185
|
+
* A key moved focus onto the row: under `replace` it is selected alone, and
|
|
186
|
+
* with Shift the rows from the anchor are taken in, from `from` where
|
|
187
|
+
* nothing was pressed yet.
|
|
188
|
+
*/
|
|
189
|
+
private arrive;
|
|
190
|
+
/**
|
|
191
|
+
* Page Down or Page Up from the row: focus moves a box's height of rows, the
|
|
192
|
+
* list's own where it scrolls and the window's where it does not, and lands
|
|
193
|
+
* the way an arrow does, so `replace` and Shift choose as they do there.
|
|
194
|
+
*/
|
|
195
|
+
private page;
|
|
144
196
|
/** Acts on the row: follows its link, or says it was acted on. */
|
|
145
197
|
protected act(row: HelixHeadlessListItem): void;
|
|
146
198
|
/** Left and Right inside a row: the cell, then each control in `end`, and back. */
|
|
147
199
|
private moveInRow;
|
|
200
|
+
/**
|
|
201
|
+
* Notes the modifiers of a key before the keyboard controller moves focus
|
|
202
|
+
* with it, which happens first, in the same dispatch.
|
|
203
|
+
*/
|
|
204
|
+
private readonly handleKeyCapture;
|
|
148
205
|
private readonly handleKeydown;
|
|
149
206
|
private readonly handleClick;
|
|
150
207
|
private readonly handleFocusin;
|
|
@@ -4,46 +4,66 @@ 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 { commaList, customElement, HelixActionEvent, HelixBeforeChangeEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, requestChange, rovingStop, whenHydrated, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { commaList, customElement, HelixActionEvent, HelixBeforeChangeEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, requestChange, rovingStop, selectsAll, typeaheadByWords, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessListItem } from '../item/list-item.js';
|
|
11
11
|
import { numbering } from '../numbering.js';
|
|
12
|
-
import {
|
|
12
|
+
import { choiceValue, pageReach, rowStop, } from '../selection.js';
|
|
13
13
|
const PRESSABLE = 'a[href], button, input, label, select, textarea, [tabindex]';
|
|
14
14
|
let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
17
|
this.label = '';
|
|
18
18
|
this.reversed = false;
|
|
19
|
+
this.selectionBehavior = 'toggle';
|
|
19
20
|
this.value = '';
|
|
20
21
|
this.keys = new KeyboardNavigationController(this, {
|
|
21
22
|
items: () => this.reachable.map((row) => this.navigable(row)),
|
|
22
23
|
origin: 'focus',
|
|
23
24
|
reserved: () => ['ArrowLeft', 'ArrowRight'],
|
|
24
25
|
selects: () => false,
|
|
25
|
-
typeahead: (
|
|
26
|
+
typeahead: typeaheadByWords(),
|
|
26
27
|
wrap: false,
|
|
27
28
|
});
|
|
29
|
+
this.handleKeyCapture = (event) => {
|
|
30
|
+
this.moving = { extend: event.shiftKey, toggle: event.ctrlKey || event.metaKey };
|
|
31
|
+
};
|
|
28
32
|
this.handleKeydown = (event) => {
|
|
29
33
|
const row = this.interactive ? this.rowOf(event) : undefined;
|
|
30
|
-
if (
|
|
34
|
+
if (row && !row.disabled && !event.altKey && /^Page(Down|Up)$/.test(event.key)) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
this.page(row, event.key === 'PageDown' ? 1 : -1);
|
|
37
|
+
}
|
|
38
|
+
this.moving = undefined;
|
|
39
|
+
if (!row || row.disabled || event.altKey) {
|
|
31
40
|
return;
|
|
32
41
|
}
|
|
33
|
-
|
|
42
|
+
const toggle = event.ctrlKey || event.metaKey;
|
|
43
|
+
if (!toggle && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
34
44
|
this.moveInRow(row, event);
|
|
35
45
|
return;
|
|
36
46
|
}
|
|
37
47
|
if (event.composedPath()[0] !== row.cell) {
|
|
38
48
|
return;
|
|
39
49
|
}
|
|
40
|
-
if (event.
|
|
50
|
+
if (selectsAll(event) && this.selectionMode === 'multiple') {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
const every = this.reachable.map((one) => this.valueFor(one)).join(', ');
|
|
53
|
+
this.choose(every === this.value ? null : every);
|
|
54
|
+
}
|
|
55
|
+
else if (event.key === 'Escape' && this.value !== '' && this.selectionMode !== 'none') {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
this.choose('');
|
|
59
|
+
}
|
|
60
|
+
else if (event.key === 'Enter' && !toggle) {
|
|
41
61
|
event.preventDefault();
|
|
42
62
|
this.act(row);
|
|
43
63
|
}
|
|
44
|
-
else if (event.key === ' ') {
|
|
64
|
+
else if (event.key === ' ' && !event.defaultPrevented) {
|
|
45
65
|
event.preventDefault();
|
|
46
|
-
this.press(row);
|
|
66
|
+
this.press(row, event.shiftKey, toggle);
|
|
47
67
|
}
|
|
48
68
|
};
|
|
49
69
|
this.handleClick = (event) => {
|
|
@@ -62,13 +82,17 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
62
82
|
this.act(row);
|
|
63
83
|
}
|
|
64
84
|
else {
|
|
65
|
-
this.press(row);
|
|
85
|
+
this.press(row, event.shiftKey, event.ctrlKey || event.metaKey);
|
|
66
86
|
}
|
|
67
87
|
};
|
|
68
88
|
this.handleFocusin = (event) => {
|
|
69
89
|
const row = this.interactive ? this.rowOf(event) : undefined;
|
|
70
90
|
if (row && row !== this.last) {
|
|
91
|
+
const from = this.last;
|
|
71
92
|
this.last = row;
|
|
93
|
+
if (event.composedPath()[0] === row.cell) {
|
|
94
|
+
this.arrive(row, from);
|
|
95
|
+
}
|
|
72
96
|
this.sync();
|
|
73
97
|
}
|
|
74
98
|
};
|
|
@@ -121,9 +145,8 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
121
145
|
.composedPath()
|
|
122
146
|
.find((node) => node instanceof HelixHeadlessListItem && node.parentElement === this);
|
|
123
147
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (mode === undefined || mode === 'none' || row.disabled) {
|
|
148
|
+
choose(next) {
|
|
149
|
+
if (next === null) {
|
|
127
150
|
return;
|
|
128
151
|
}
|
|
129
152
|
requestChange({
|
|
@@ -133,9 +156,59 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
133
156
|
},
|
|
134
157
|
event: (value) => new HelixBeforeChangeEvent({ value }),
|
|
135
158
|
host: this,
|
|
136
|
-
next
|
|
159
|
+
next,
|
|
137
160
|
});
|
|
138
161
|
}
|
|
162
|
+
choice(row, extend, toggle, arrived) {
|
|
163
|
+
return {
|
|
164
|
+
anchor: this.anchor,
|
|
165
|
+
arrived,
|
|
166
|
+
behavior: this.selectionBehavior,
|
|
167
|
+
extend,
|
|
168
|
+
mode: this.selectionMode ?? 'none',
|
|
169
|
+
pressed: this.valueFor(row),
|
|
170
|
+
shown: this.reachable.map((one) => this.valueFor(one)),
|
|
171
|
+
toggle,
|
|
172
|
+
value: this.value,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
press(row, extend = false, toggle = false) {
|
|
176
|
+
const mode = this.selectionMode;
|
|
177
|
+
if (mode === undefined || mode === 'none' || row.disabled) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const next = choiceValue(this.choice(row, extend, toggle, false));
|
|
181
|
+
if (!extend) {
|
|
182
|
+
this.anchor = this.valueFor(row);
|
|
183
|
+
}
|
|
184
|
+
this.choose(next);
|
|
185
|
+
}
|
|
186
|
+
arrive(row, from) {
|
|
187
|
+
const moving = this.moving;
|
|
188
|
+
if (!moving || this.selectionMode === undefined || this.selectionMode === 'none') {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (moving.extend && this.anchor === undefined && from) {
|
|
192
|
+
this.anchor = this.valueFor(from);
|
|
193
|
+
}
|
|
194
|
+
const next = choiceValue(this.choice(row, moving.extend, moving.toggle, true));
|
|
195
|
+
if (!moving.extend && next !== null) {
|
|
196
|
+
this.anchor = this.valueFor(row);
|
|
197
|
+
}
|
|
198
|
+
this.choose(next);
|
|
199
|
+
}
|
|
200
|
+
page(row, step) {
|
|
201
|
+
const rows = this.reachable;
|
|
202
|
+
const edges = rows.map((one) => {
|
|
203
|
+
const box = one.getBoundingClientRect();
|
|
204
|
+
return { bottom: box.bottom, top: box.top };
|
|
205
|
+
});
|
|
206
|
+
const room = this.scrollHeight > this.clientHeight + 1 ? this.clientHeight : window.innerHeight;
|
|
207
|
+
const target = rows[pageReach(edges, rows.indexOf(row), room, step)];
|
|
208
|
+
if (target && target !== row) {
|
|
209
|
+
target.focusItem();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
139
212
|
act(row) {
|
|
140
213
|
if (row.disabled) {
|
|
141
214
|
return;
|
|
@@ -160,12 +233,14 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
160
233
|
}
|
|
161
234
|
connectedCallback() {
|
|
162
235
|
super.connectedCallback();
|
|
236
|
+
this.addEventListener('keydown', this.handleKeyCapture, true);
|
|
163
237
|
this.addEventListener('keydown', this.handleKeydown);
|
|
164
238
|
this.addEventListener('click', this.handleClick);
|
|
165
239
|
this.addEventListener('focusin', this.handleFocusin);
|
|
166
240
|
}
|
|
167
241
|
disconnectedCallback() {
|
|
168
242
|
super.disconnectedCallback();
|
|
243
|
+
this.removeEventListener('keydown', this.handleKeyCapture, true);
|
|
169
244
|
this.removeEventListener('keydown', this.handleKeydown);
|
|
170
245
|
this.removeEventListener('click', this.handleClick);
|
|
171
246
|
this.removeEventListener('focusin', this.handleFocusin);
|
|
@@ -202,6 +277,9 @@ __decorate([
|
|
|
202
277
|
__decorate([
|
|
203
278
|
property({ type: Boolean })
|
|
204
279
|
], HelixHeadlessList.prototype, "reversed", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
property({ attribute: 'selection-behavior' })
|
|
282
|
+
], HelixHeadlessList.prototype, "selectionBehavior", void 0);
|
|
205
283
|
__decorate([
|
|
206
284
|
property({ attribute: 'selection-mode' })
|
|
207
285
|
], HelixHeadlessList.prototype, "selectionMode", void 0);
|
package/dist/list/selection.d.ts
CHANGED
|
@@ -1,13 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type SelectionMode } from '@fusion.dev/helix-core';
|
|
2
|
+
/** How many rows a reader can select in an interactive list: core's `SelectionMode`. */
|
|
3
|
+
export type ListSelectionMode = SelectionMode;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* What a press does to the rows already selected: `toggle` adds or takes out
|
|
6
|
+
* the row, and `replace` selects it alone, as a file list does.
|
|
7
|
+
*/
|
|
8
|
+
export type ListSelectionBehavior = 'replace' | 'toggle';
|
|
9
|
+
/** A press on a row, or a key arriving on one, and what the list held then. */
|
|
10
|
+
export interface ListChoice {
|
|
11
|
+
/** The list's `selection-mode`. */
|
|
12
|
+
mode: ListSelectionMode;
|
|
13
|
+
/** The list's `selection-behavior`. */
|
|
14
|
+
behavior: ListSelectionBehavior;
|
|
15
|
+
/** The list's `value`, before the press. */
|
|
16
|
+
value: string;
|
|
17
|
+
/** The value of the row pressed or arrived on. */
|
|
18
|
+
pressed: string;
|
|
19
|
+
/** The values of the rows a reader can reach, in order. */
|
|
20
|
+
shown: readonly string[];
|
|
21
|
+
/** The value of the row a range runs from, where there is one. */
|
|
22
|
+
anchor?: string | undefined;
|
|
23
|
+
/** Whether Shift was held, which takes in the rows from the anchor. */
|
|
24
|
+
extend?: boolean;
|
|
25
|
+
/** Whether Control or Command was held, which toggles under `replace` and moves without choosing. */
|
|
26
|
+
toggle?: boolean;
|
|
27
|
+
/** Whether a key moved focus onto the row, where a press is false. */
|
|
28
|
+
arrived?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The `value` a press or an arrival leaves, or `null` where it changes nothing.
|
|
5
32
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
33
|
+
* - With Shift, in a list that selects many, every row from the anchor to this
|
|
34
|
+
* one is added, as Data Table and Listbox add a range.
|
|
35
|
+
* - Under `replace`, the row is selected alone, by a press or by a key moving
|
|
36
|
+
* onto it. Control or Command toggles it under a press, and moves without
|
|
37
|
+
* choosing under a key.
|
|
38
|
+
* - Under `toggle`, a press adds or takes out the row, and a key only moves.
|
|
9
39
|
*/
|
|
10
|
-
export declare const
|
|
40
|
+
export declare const choiceValue: ({ anchor, arrived, behavior, extend, mode, pressed, shown, toggle, value, }: ListChoice) => string | null;
|
|
11
41
|
/**
|
|
12
42
|
* Where Left or Right goes inside a row: `at` is the row's place among its
|
|
13
43
|
* `count` stops, the cell first and its controls after it, and `step` is the
|
|
@@ -17,3 +47,20 @@ export declare const pressedValue: (mode: ListSelectionMode, value: string, pres
|
|
|
17
47
|
* and from the cell going back reaches the last control.
|
|
18
48
|
*/
|
|
19
49
|
export declare const rowStop: (count: number, at: number, step: -1 | 1) => number;
|
|
50
|
+
/** Where a row sits along the list, in pixels, as the page keys measure it. */
|
|
51
|
+
export interface RowEdges {
|
|
52
|
+
/** The row's top edge. */
|
|
53
|
+
top: number;
|
|
54
|
+
/** The row's bottom edge. */
|
|
55
|
+
bottom: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Where Page Down (`step` 1) or Page Up (`step` -1) goes from row `at`: the
|
|
59
|
+
* farthest row that fits whole in `room` pixels together with row `at`, so the
|
|
60
|
+
* row at one edge of the box lands at the other, and at least the next row.
|
|
61
|
+
*
|
|
62
|
+
* Measured rather than counted, because a list's rows differ in height. Rows of
|
|
63
|
+
* one height `h` move `floor(room / h) - 1` rows, which is what Data Table and
|
|
64
|
+
* Virtual List move. At either end it stays on row `at`.
|
|
65
|
+
*/
|
|
66
|
+
export declare const pageReach: (rows: readonly RowEdges[], at: number, room: number, step: -1 | 1) => number;
|
package/dist/list/selection.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { commaList,
|
|
2
|
-
export const
|
|
1
|
+
import { commaList, pressedValue, rangeAdd } from '@fusion.dev/helix-core';
|
|
2
|
+
export const choiceValue = ({ anchor, arrived = false, behavior, extend = false, mode, pressed, shown, toggle = false, value, }) => {
|
|
3
|
+
if (mode === 'none') {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
3
6
|
const now = commaList(value);
|
|
4
|
-
if (mode === '
|
|
5
|
-
|
|
7
|
+
if (extend && mode === 'multiple') {
|
|
8
|
+
const from = anchor === undefined ? -1 : shown.indexOf(anchor);
|
|
9
|
+
const range = rangeAdd(now, shown, from, shown.indexOf(pressed));
|
|
10
|
+
return range ? range.join(', ') : null;
|
|
11
|
+
}
|
|
12
|
+
if (behavior === 'replace' && !toggle) {
|
|
13
|
+
return now.length === 1 && now[0] === pressed ? null : pressed;
|
|
6
14
|
}
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
15
|
+
if (arrived) {
|
|
16
|
+
return null;
|
|
9
17
|
}
|
|
10
|
-
|
|
18
|
+
const next = pressedValue(mode, value, pressed);
|
|
19
|
+
return next === value ? null : next;
|
|
11
20
|
};
|
|
12
21
|
export const rowStop = (count, at, step) => {
|
|
13
22
|
if (count <= 1) {
|
|
@@ -19,3 +28,19 @@ export const rowStop = (count, at, step) => {
|
|
|
19
28
|
}
|
|
20
29
|
return next < 0 ? count - 1 : next;
|
|
21
30
|
};
|
|
31
|
+
export const pageReach = (rows, at, room, step) => {
|
|
32
|
+
const from = rows[at];
|
|
33
|
+
if (!from) {
|
|
34
|
+
return at;
|
|
35
|
+
}
|
|
36
|
+
let reach = at;
|
|
37
|
+
for (let next = at + step; next >= 0 && next < rows.length; next += step) {
|
|
38
|
+
const row = rows[next];
|
|
39
|
+
const span = step === 1 ? row.bottom - from.top : from.bottom - row.top;
|
|
40
|
+
if (span > room && next !== at + step) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
reach = next;
|
|
44
|
+
}
|
|
45
|
+
return reach;
|
|
46
|
+
};
|