@fusion.dev/helix-headless 0.144.0 → 0.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- 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.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -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 +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.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 +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- 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 +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- 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/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- 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 +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- 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 +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- 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 +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -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 +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- 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 +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- 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.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -4,14 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, HelixElement, MixinControllerActive } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, HelixEndEvent, MixinControllerActive, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessVideoPlaylistItem } from '../item/video-playlist-item.js';
|
|
11
|
+
import { playOrder, stepTo } from '../order.js';
|
|
11
12
|
let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinControllerActive(HelixElement) {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
15
|
this.label = 'Playlist';
|
|
16
|
+
this.shuffle = false;
|
|
15
17
|
this.chased = false;
|
|
16
18
|
this.handleSelect = (event) => {
|
|
17
19
|
event.stopImmediatePropagation();
|
|
@@ -22,18 +24,23 @@ let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinC
|
|
|
22
24
|
this.requestActive(event.detail.value);
|
|
23
25
|
};
|
|
24
26
|
this.handleNext = () => {
|
|
25
|
-
this.
|
|
26
|
-
this.step(1);
|
|
27
|
+
this.next();
|
|
27
28
|
};
|
|
28
29
|
this.handlePrevious = () => {
|
|
29
|
-
this.
|
|
30
|
-
this.step(-1);
|
|
30
|
+
this.previous();
|
|
31
31
|
};
|
|
32
32
|
this.handleEnded = (event) => {
|
|
33
33
|
if (event.target !== this.player) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
this.
|
|
36
|
+
if (this.repeat === 'one') {
|
|
37
|
+
this.replay();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (this.following(1).next === undefined) {
|
|
41
|
+
this.dispatchEvent(new HelixEndEvent());
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
37
44
|
this.step(1);
|
|
38
45
|
};
|
|
39
46
|
}
|
|
@@ -42,17 +49,44 @@ let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinC
|
|
|
42
49
|
}
|
|
43
50
|
get player() {
|
|
44
51
|
const slot = this.renderRoot?.querySelector('slot[name="player"]');
|
|
45
|
-
|
|
46
|
-
return (first ?? null);
|
|
52
|
+
return slot?.assignedElements()[0] ?? null;
|
|
47
53
|
}
|
|
48
|
-
|
|
54
|
+
following(by) {
|
|
49
55
|
const items = this.items.filter((one) => !one.disabled);
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
const values = items.map((one) => one.value);
|
|
57
|
+
const current = this.resolveActive(items)?.value;
|
|
58
|
+
this.dealt = this.shuffle ? playOrder(values, true, this.dealt, current) : undefined;
|
|
59
|
+
const order = this.dealt ?? values;
|
|
60
|
+
return { current, next: stepTo(order, current, by, this.repeat === 'all') };
|
|
61
|
+
}
|
|
62
|
+
step(by) {
|
|
63
|
+
const { current, next } = this.following(by);
|
|
64
|
+
if (next === undefined) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (next === current) {
|
|
68
|
+
this.replay();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.chased = true;
|
|
72
|
+
if (!this.requestActive(next)) {
|
|
73
|
+
this.chased = false;
|
|
54
74
|
}
|
|
55
75
|
}
|
|
76
|
+
replay() {
|
|
77
|
+
const player = this.player;
|
|
78
|
+
if (!player) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
player.currentTime = 0;
|
|
82
|
+
void Promise.resolve(player.play()).catch(() => { });
|
|
83
|
+
}
|
|
84
|
+
next() {
|
|
85
|
+
this.step(1);
|
|
86
|
+
}
|
|
87
|
+
previous() {
|
|
88
|
+
this.step(-1);
|
|
89
|
+
}
|
|
56
90
|
connectedCallback() {
|
|
57
91
|
super.connectedCallback();
|
|
58
92
|
this.addEventListener('helix-select', this.handleSelect);
|
|
@@ -67,6 +101,12 @@ let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinC
|
|
|
67
101
|
this.removeEventListener('helix-previous', this.handlePrevious);
|
|
68
102
|
this.removeEventListener('ended', this.handleEnded, true);
|
|
69
103
|
}
|
|
104
|
+
willUpdate(changed) {
|
|
105
|
+
super.willUpdate(changed);
|
|
106
|
+
if (changed.has('shuffle') && !this.shuffle) {
|
|
107
|
+
this.dealt = undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
70
110
|
updated(changed) {
|
|
71
111
|
super.updated?.(changed);
|
|
72
112
|
const items = this.items;
|
|
@@ -83,9 +123,7 @@ let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinC
|
|
|
83
123
|
player.poster = current.poster;
|
|
84
124
|
player.label = current.text;
|
|
85
125
|
if (this.chased) {
|
|
86
|
-
void player.updateComplete?.then(() => {
|
|
87
|
-
player.play();
|
|
88
|
-
});
|
|
126
|
+
void player.updateComplete?.then(() => player.play()).catch(() => { });
|
|
89
127
|
}
|
|
90
128
|
}
|
|
91
129
|
this.chased = false;
|
|
@@ -100,6 +138,12 @@ let HelixHeadlessVideoPlaylist = class HelixHeadlessVideoPlaylist extends MixinC
|
|
|
100
138
|
__decorate([
|
|
101
139
|
property()
|
|
102
140
|
], HelixHeadlessVideoPlaylist.prototype, "label", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property()
|
|
143
|
+
], HelixHeadlessVideoPlaylist.prototype, "repeat", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
property({ type: Boolean })
|
|
146
|
+
], HelixHeadlessVideoPlaylist.prototype, "shuffle", void 0);
|
|
103
147
|
HelixHeadlessVideoPlaylist = __decorate([
|
|
104
148
|
customElement('helix-headless-video-playlist')
|
|
105
149
|
], HelixHeadlessVideoPlaylist);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { focusableElements } from '@fusion.dev/helix-core';
|
|
2
|
+
const held = new WeakMap();
|
|
3
|
+
export const holdControls = (rows) => {
|
|
4
|
+
for (const row of rows) {
|
|
5
|
+
if (!(row instanceof HTMLElement)) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
for (const control of focusableElements(row)) {
|
|
9
|
+
held.set(control, control.getAttribute('tabindex'));
|
|
10
|
+
control.setAttribute('tabindex', '-1');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export const releaseControls = (rows) => {
|
|
15
|
+
for (const row of rows) {
|
|
16
|
+
for (const control of row.querySelectorAll('[tabindex]')) {
|
|
17
|
+
if (!held.has(control)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const was = held.get(control);
|
|
21
|
+
held.delete(control);
|
|
22
|
+
if (was === null || was === undefined) {
|
|
23
|
+
control.removeAttribute('tabindex');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
control.setAttribute('tabindex', was);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filling a row from an item, for a list whose rows come from a `<template>`.
|
|
3
|
+
*
|
|
4
|
+
* A row template marks its holes with data attributes, so it stays markup a
|
|
5
|
+
* server can send and a framework can write as a string:
|
|
6
|
+
*
|
|
7
|
+
* - `data-field="name"` takes the item's `name` as its text.
|
|
8
|
+
* - `data-field-href="url"` takes the item's `url` as its `href`, and the same
|
|
9
|
+
* for any attribute: `data-field-aria-label`, `data-field-src`,
|
|
10
|
+
* `data-field-title`.
|
|
11
|
+
*
|
|
12
|
+
* A field is a key, or a path of keys joined by dots (`author.name`).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The text a value takes in a row.
|
|
16
|
+
*
|
|
17
|
+
* Nothing for a missing value, so a hole whose field is absent is empty and
|
|
18
|
+
* does not read "undefined".
|
|
19
|
+
*/
|
|
20
|
+
export declare const textOf: (value: unknown) => string;
|
|
21
|
+
/** Fills one element's holes, its own and those below it, from an item. */
|
|
22
|
+
export declare const fillHoles: (root: Element, item: unknown) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { valueAt } from '@fusion.dev/helix-core';
|
|
2
|
+
export const textOf = (value) => value === undefined || value === null || typeof value === 'object' ? '' : String(value);
|
|
3
|
+
const ATTRIBUTE = 'data-field-';
|
|
4
|
+
const writeAttribute = (element, name, value) => {
|
|
5
|
+
if (value === undefined || value === null || value === false) {
|
|
6
|
+
element.removeAttribute(name);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
element.setAttribute(name, value === true ? '' : textOf(value));
|
|
10
|
+
};
|
|
11
|
+
export const fillHoles = (root, item) => {
|
|
12
|
+
const holes = [...(root.matches('[data-field]') ? [root] : []), ...root.querySelectorAll('*')];
|
|
13
|
+
for (const hole of holes) {
|
|
14
|
+
for (const { name, value } of [...hole.attributes]) {
|
|
15
|
+
if (name === 'data-field') {
|
|
16
|
+
hole.textContent = textOf(valueAt(item, value));
|
|
17
|
+
}
|
|
18
|
+
else if (name.startsWith(ATTRIBUTE)) {
|
|
19
|
+
writeAttribute(hole, name.slice(ATTRIBUTE.length), valueAt(item, value));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which item a key moves to in a vertical list of `count` items, from `at`.
|
|
3
|
+
*
|
|
4
|
+
* Index arithmetic, because most of the items are not drawn: the list moves to
|
|
5
|
+
* an index, scrolls it into view, and focuses the row once it is there. The
|
|
6
|
+
* keys are the ones a listbox answers:
|
|
7
|
+
*
|
|
8
|
+
* - Up and Down move one item.
|
|
9
|
+
* - Home and End move to the first and the last.
|
|
10
|
+
* - Page Up and Page Down move by `page`, the number of items on screen less
|
|
11
|
+
* one, so the item at one edge of the box lands at the other.
|
|
12
|
+
*
|
|
13
|
+
* `undefined` for a key the list does not take, and for an empty list.
|
|
14
|
+
*/
|
|
15
|
+
export declare const stepIndex: (key: string, at: number, count: number, page: number) => number | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const stepIndex = (key, at, count, page) => {
|
|
2
|
+
if (count <= 0) {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
const last = count - 1;
|
|
6
|
+
const from = Math.max(0, Math.min(at, last));
|
|
7
|
+
const jump = Math.max(1, page);
|
|
8
|
+
switch (key) {
|
|
9
|
+
case 'ArrowDown':
|
|
10
|
+
return Math.min(last, from + 1);
|
|
11
|
+
case 'ArrowUp':
|
|
12
|
+
return Math.max(0, from - 1);
|
|
13
|
+
case 'End':
|
|
14
|
+
return last;
|
|
15
|
+
case 'Home':
|
|
16
|
+
return 0;
|
|
17
|
+
case 'PageDown':
|
|
18
|
+
return Math.min(last, from + jump);
|
|
19
|
+
case 'PageUp':
|
|
20
|
+
return Math.max(0, from - jump);
|
|
21
|
+
default:
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one pass of a virtual list draws, worked out before any element moves.
|
|
3
|
+
*
|
|
4
|
+
* The list keeps the element of a row that stays in the window, so a pass
|
|
5
|
+
* compares what is drawn with what is wanted and changes only the difference.
|
|
6
|
+
* These are that comparison and the tab-stop rule that follows it, as
|
|
7
|
+
* arithmetic over item indices.
|
|
8
|
+
*/
|
|
9
|
+
/** What a pass does to the rows in the tree. */
|
|
10
|
+
export interface DrawPlan {
|
|
11
|
+
/** The items the pass draws, in order: the window, and a kept item outside it. */
|
|
12
|
+
wanted: number[];
|
|
13
|
+
/** The items whose rows leave the tree. */
|
|
14
|
+
remove: Set<number>;
|
|
15
|
+
}
|
|
16
|
+
/** The window, the set's length, the item kept outside the window, and the rows drawn. */
|
|
17
|
+
export interface DrawInput {
|
|
18
|
+
/** The first item of the window. */
|
|
19
|
+
first: number;
|
|
20
|
+
/** One past the last item of the window. */
|
|
21
|
+
last: number;
|
|
22
|
+
/** How many items the set holds. */
|
|
23
|
+
count: number;
|
|
24
|
+
/** The item drawn outside the window to keep or take focus, where there is one. */
|
|
25
|
+
kept?: number | undefined;
|
|
26
|
+
/** The item each drawn row element holds, `NaN` for an element that holds none. */
|
|
27
|
+
drawn: readonly number[];
|
|
28
|
+
/** Whether every drawn row is drawn again from nothing, as for a new way of drawing. */
|
|
29
|
+
redraw?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Which items a pass draws, and which drawn rows leave.
|
|
33
|
+
*
|
|
34
|
+
* A drawn row leaves when its item is not wanted, when it holds no item, or
|
|
35
|
+
* when everything is drawn again. A wanted item with no row left is drawn new.
|
|
36
|
+
*/
|
|
37
|
+
export declare const drawPlan: ({ count, drawn, first, kept, last, redraw, }: DrawInput) => DrawPlan;
|
|
38
|
+
/**
|
|
39
|
+
* Which item holds the list's tab stop after a pass.
|
|
40
|
+
*
|
|
41
|
+
* The item that held it, while its row is drawn. Otherwise the first item on
|
|
42
|
+
* screen, held inside the window and the set.
|
|
43
|
+
*/
|
|
44
|
+
export declare const stopAfter: (active: number, wanted: readonly number[], { count, first, last, onScreen, }: {
|
|
45
|
+
count: number;
|
|
46
|
+
first: number;
|
|
47
|
+
last: number;
|
|
48
|
+
onScreen: number;
|
|
49
|
+
}) => number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const drawPlan = ({ count, drawn, first, kept, last, redraw = false, }) => {
|
|
2
|
+
const wanted = [];
|
|
3
|
+
for (let at = first; at < Math.min(last, count); at += 1) {
|
|
4
|
+
wanted.push(at);
|
|
5
|
+
}
|
|
6
|
+
if (kept !== undefined && !wanted.includes(kept)) {
|
|
7
|
+
wanted.push(kept);
|
|
8
|
+
wanted.sort((a, b) => a - b);
|
|
9
|
+
}
|
|
10
|
+
const keep = new Set(wanted);
|
|
11
|
+
const remove = new Set(drawn.filter((index) => redraw || !Number.isInteger(index) || !keep.has(index)));
|
|
12
|
+
return { remove, wanted };
|
|
13
|
+
};
|
|
14
|
+
export const stopAfter = (active, wanted, { count, first, last, onScreen, }) => wanted.includes(active)
|
|
15
|
+
? active
|
|
16
|
+
: Math.max(Math.min(onScreen, Math.min(last, count) - 1), first, 0);
|