@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
|
@@ -11,6 +11,7 @@ import { property, state } from 'lit/decorators.js';
|
|
|
11
11
|
import { html } from 'lit/static-html.js';
|
|
12
12
|
import '../../menu/index.js';
|
|
13
13
|
import { HelixHeadlessMenu } from '../../menu/root/menu-root.js';
|
|
14
|
+
import { relayMedia } from '../media-events.js';
|
|
14
15
|
import { barControls, menuControls, ownFile } from './extra-controls.js';
|
|
15
16
|
import { takeKey } from './keys.js';
|
|
16
17
|
const clock = (seconds) => {
|
|
@@ -53,6 +54,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
53
54
|
this.pauseLabel = 'Pause';
|
|
54
55
|
this.percentLabel = '{percent} percent';
|
|
55
56
|
this.pipLabel = 'Picture in picture';
|
|
57
|
+
this.playerLabel = 'Video';
|
|
56
58
|
this.playLabel = 'Play';
|
|
57
59
|
this.playsInline = true;
|
|
58
60
|
this.poster = '';
|
|
@@ -149,7 +151,6 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
149
151
|
this.claimSession();
|
|
150
152
|
}
|
|
151
153
|
this.session.report(this.playing);
|
|
152
|
-
this.dispatchEvent(new Event(event.type, { bubbles: false, composed: false }));
|
|
153
154
|
};
|
|
154
155
|
this.handleVolume = () => {
|
|
155
156
|
const video = this.video;
|
|
@@ -179,6 +180,10 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
179
180
|
}
|
|
180
181
|
this.toggle();
|
|
181
182
|
};
|
|
183
|
+
this.handleStart = () => {
|
|
184
|
+
this.partNamed('stage')?.focus({ preventScroll: true });
|
|
185
|
+
this.toggle();
|
|
186
|
+
};
|
|
182
187
|
this.handleKeydown = (event) => {
|
|
183
188
|
if (this.controls) {
|
|
184
189
|
return;
|
|
@@ -296,7 +301,14 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
296
301
|
return this.partNamed('video');
|
|
297
302
|
}
|
|
298
303
|
play() {
|
|
299
|
-
|
|
304
|
+
const video = this.video;
|
|
305
|
+
const started = video
|
|
306
|
+
? video.play()
|
|
307
|
+
: this.updateComplete.then(async () => {
|
|
308
|
+
await this.video?.play();
|
|
309
|
+
});
|
|
310
|
+
started.catch(() => { });
|
|
311
|
+
return started;
|
|
300
312
|
}
|
|
301
313
|
pause() {
|
|
302
314
|
this.video?.pause();
|
|
@@ -307,7 +319,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
307
319
|
return;
|
|
308
320
|
}
|
|
309
321
|
if (video.paused) {
|
|
310
|
-
this.play();
|
|
322
|
+
void this.play();
|
|
311
323
|
}
|
|
312
324
|
else {
|
|
313
325
|
this.pause();
|
|
@@ -419,6 +431,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
419
431
|
this.silent = video.muted;
|
|
420
432
|
this.loudness = video.volume;
|
|
421
433
|
void this.remote.attach(video);
|
|
434
|
+
relayMedia(video, (event) => this.relayNativeEvent(event));
|
|
422
435
|
}
|
|
423
436
|
}
|
|
424
437
|
updated(changed) {
|
|
@@ -438,7 +451,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
438
451
|
aria-pressed=${this.remoteConnected ? 'true' : 'false'}
|
|
439
452
|
@click=${() => void this.remote.prompt()}
|
|
440
453
|
>
|
|
441
|
-
|
|
454
|
+
<slot name="remote-icon">${drawIcon(airplay)}</slot>
|
|
442
455
|
</button>`;
|
|
443
456
|
}
|
|
444
457
|
if (one === 'rewind') {
|
|
@@ -448,7 +461,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
448
461
|
aria-label=${fillTemplate(this.rewindLabel, { seconds: SKIP_SECONDS })}
|
|
449
462
|
@click=${() => this.skipBy(-SKIP_SECONDS)}
|
|
450
463
|
>
|
|
451
|
-
|
|
464
|
+
<slot name="rewind-icon">${drawIcon(arrowCounterClockwise)}</slot>
|
|
452
465
|
</button>`;
|
|
453
466
|
}
|
|
454
467
|
if (one === 'forward') {
|
|
@@ -458,7 +471,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
458
471
|
aria-label=${fillTemplate(this.forwardLabel, { seconds: SKIP_SECONDS })}
|
|
459
472
|
@click=${() => this.skipBy(SKIP_SECONDS)}
|
|
460
473
|
>
|
|
461
|
-
|
|
474
|
+
<slot name="forward-icon">${drawIcon(arrowClockwise)}</slot>
|
|
462
475
|
</button>`;
|
|
463
476
|
}
|
|
464
477
|
if (one === 'speed') {
|
|
@@ -478,7 +491,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
478
491
|
aria-label=${this.previousLabel}
|
|
479
492
|
@click=${() => this.skip(true)}
|
|
480
493
|
>
|
|
481
|
-
|
|
494
|
+
<slot name="previous-icon">${drawIcon(skipBack)}</slot>
|
|
482
495
|
</button>`;
|
|
483
496
|
}
|
|
484
497
|
if (one === 'next') {
|
|
@@ -488,7 +501,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
488
501
|
aria-label=${this.nextLabel}
|
|
489
502
|
@click=${() => this.skip(false)}
|
|
490
503
|
>
|
|
491
|
-
|
|
504
|
+
<slot name="next-icon">${drawIcon(skipForward)}</slot>
|
|
492
505
|
</button>`;
|
|
493
506
|
}
|
|
494
507
|
if (one === 'download') {
|
|
@@ -501,7 +514,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
501
514
|
rel=${local ? nothing : 'noreferrer'}
|
|
502
515
|
aria-label=${this.downloadLabel}
|
|
503
516
|
>
|
|
504
|
-
|
|
517
|
+
<slot name="download-icon">${drawIcon(download)}</slot>
|
|
505
518
|
</a>`;
|
|
506
519
|
}
|
|
507
520
|
return html `<button
|
|
@@ -510,7 +523,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
510
523
|
aria-label=${this.pipLabel}
|
|
511
524
|
@click=${() => void this.togglePip()}
|
|
512
525
|
>
|
|
513
|
-
|
|
526
|
+
<slot name="pip-icon">${drawIcon(pictureInPicture)}</slot>
|
|
514
527
|
</button>`;
|
|
515
528
|
}
|
|
516
529
|
renderCaptions() {
|
|
@@ -526,7 +539,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
526
539
|
aria-pressed=${this.captioned ? 'true' : 'false'}
|
|
527
540
|
@click=${() => this.toggleCaptions()}
|
|
528
541
|
>
|
|
529
|
-
|
|
542
|
+
<slot name="captions-icon">${drawIcon(closedCaptioning)}</slot>
|
|
530
543
|
</button>`;
|
|
531
544
|
}
|
|
532
545
|
return html `<${this.tag('menu')} part="captions-menu"
|
|
@@ -542,11 +555,13 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
542
555
|
aria-haspopup="menu"
|
|
543
556
|
aria-expanded=${this.menuOpen === 'captions' ? 'true' : 'false'}
|
|
544
557
|
>
|
|
545
|
-
|
|
558
|
+
<slot name="captions-icon">${drawIcon(closedCaptioning)}</slot>
|
|
546
559
|
</button>
|
|
547
560
|
<${this.tag('menu-item')}
|
|
548
561
|
part="entry"
|
|
549
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
562
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
563
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
564
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
550
565
|
value="off"
|
|
551
566
|
checkable
|
|
552
567
|
exclusive
|
|
@@ -557,7 +572,9 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
557
572
|
${this.captionsOffLabel}
|
|
558
573
|
</${this.tag('menu-item')}>
|
|
559
574
|
${tracks.map((track, at) => html `<${this.tag('menu-item')} part="entry"
|
|
560
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
575
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
576
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
577
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
561
578
|
value=${track.language || String(at)}
|
|
562
579
|
checkable
|
|
563
580
|
exclusive
|
|
@@ -584,63 +601,79 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
584
601
|
renderOverflowItem(one) {
|
|
585
602
|
if (one === 'remote') {
|
|
586
603
|
return html `<${this.tag('menu-item')} part="entry"
|
|
587
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
604
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
605
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
606
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
588
607
|
value="remote"
|
|
589
608
|
@helix-select=${() => void this.remote.prompt()}
|
|
590
609
|
>
|
|
591
|
-
|
|
610
|
+
<slot name="remote-icon" slot="start">${drawIcon(airplay)}</slot>
|
|
592
611
|
${this.remoteLabel}
|
|
593
612
|
</${this.tag('menu-item')}>`;
|
|
594
613
|
}
|
|
595
614
|
if (one === 'speed') {
|
|
596
615
|
return html `<${this.tag('menu-item')} part="entry"
|
|
597
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
598
|
-
|
|
616
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
617
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
618
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start" value="speed" @helix-select=${() => this.cycleSpeed()}>
|
|
619
|
+
<slot name="speed-icon" slot="start">${drawIcon(gauge)}</slot>
|
|
599
620
|
${this.speedLabel}: ${this.rate}x
|
|
600
621
|
</${this.tag('menu-item')}>`;
|
|
601
622
|
}
|
|
602
623
|
if (one === 'rewind' || one === 'forward') {
|
|
603
624
|
const back = one === 'rewind';
|
|
604
625
|
return html `<${this.tag('menu-item')} part="entry"
|
|
605
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
626
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
627
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
628
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
606
629
|
value=${one}
|
|
607
630
|
@helix-select=${() => this.skipBy(back ? -SKIP_SECONDS : SKIP_SECONDS)}
|
|
608
631
|
>
|
|
609
|
-
${
|
|
632
|
+
${back
|
|
633
|
+
? html `<slot name="rewind-icon" slot="start">${drawIcon(arrowCounterClockwise)}</slot>`
|
|
634
|
+
: html `<slot name="forward-icon" slot="start">${drawIcon(arrowClockwise)}</slot>`}
|
|
610
635
|
${fillTemplate(back ? this.rewindLabel : this.forwardLabel, { seconds: SKIP_SECONDS })}
|
|
611
636
|
</${this.tag('menu-item')}>`;
|
|
612
637
|
}
|
|
613
638
|
if (one === 'previous') {
|
|
614
639
|
return html `<${this.tag('menu-item')} part="entry"
|
|
615
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
616
|
-
|
|
640
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
641
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
642
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start" value="previous" @helix-select=${() => this.skip(true)}>
|
|
643
|
+
<slot name="previous-icon" slot="start">${drawIcon(skipBack)}</slot>
|
|
617
644
|
${this.previousLabel}
|
|
618
645
|
</${this.tag('menu-item')}>`;
|
|
619
646
|
}
|
|
620
647
|
if (one === 'next') {
|
|
621
648
|
return html `<${this.tag('menu-item')} part="entry"
|
|
622
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
623
|
-
|
|
649
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
650
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
651
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start" value="next" @helix-select=${() => this.skip(false)}>
|
|
652
|
+
<slot name="next-icon" slot="start">${drawIcon(skipForward)}</slot>
|
|
624
653
|
${this.nextLabel}
|
|
625
654
|
</${this.tag('menu-item')}>`;
|
|
626
655
|
}
|
|
627
656
|
if (one === 'download') {
|
|
628
657
|
const local = ownFile(this.src);
|
|
629
658
|
return html `<${this.tag('menu-item')} part="entry"
|
|
630
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
659
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
660
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
661
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
631
662
|
?download=${local}
|
|
632
663
|
href=${this.src}
|
|
633
664
|
rel=${local ? nothing : 'noreferrer'}
|
|
634
665
|
target=${local ? nothing : '_blank'}
|
|
635
666
|
value="download"
|
|
636
667
|
>
|
|
637
|
-
|
|
668
|
+
<slot name="download-icon" slot="start">${drawIcon(download)}</slot>
|
|
638
669
|
${this.downloadLabel}
|
|
639
670
|
</${this.tag('menu-item')}>`;
|
|
640
671
|
}
|
|
641
672
|
return html `<${this.tag('menu-item')} part="entry"
|
|
642
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
643
|
-
|
|
673
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
674
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
675
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start" value="pip" @helix-select=${() => void this.togglePip()}>
|
|
676
|
+
<slot name="pip-icon" slot="start">${drawIcon(pictureInPicture)}</slot>
|
|
644
677
|
${this.pipLabel}
|
|
645
678
|
</${this.tag('menu-item')}>`;
|
|
646
679
|
}
|
|
@@ -653,7 +686,9 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
653
686
|
aria-label=${this.playing ? this.pauseLabel : this.playLabel}
|
|
654
687
|
@click=${() => this.toggle()}
|
|
655
688
|
>
|
|
656
|
-
${
|
|
689
|
+
${this.playing
|
|
690
|
+
? html `<slot name="pause-icon">${drawIcon(pause)}</slot>`
|
|
691
|
+
: html `<slot name="play-icon">${drawIcon(play)}</slot>`}
|
|
657
692
|
</button>
|
|
658
693
|
<span part="time">${clock(this.position)} / ${clock(this.knownDuration)}</span>
|
|
659
694
|
<!-- Left to right on every page. A player's timeline is a tape running
|
|
@@ -691,7 +726,9 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
691
726
|
}
|
|
692
727
|
}}
|
|
693
728
|
>
|
|
694
|
-
${
|
|
729
|
+
${this.silent || this.loudness === 0
|
|
730
|
+
? html `<slot name="mute-icon">${drawIcon(speakerX)}</slot>`
|
|
731
|
+
: html `<slot name="volume-icon">${drawIcon(speakerHigh)}</slot>`}
|
|
695
732
|
</button>
|
|
696
733
|
<input
|
|
697
734
|
part="volume"
|
|
@@ -725,7 +762,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
725
762
|
aria-haspopup="menu"
|
|
726
763
|
aria-expanded=${this.menuOpen === 'overflow' ? 'true' : 'false'}
|
|
727
764
|
>
|
|
728
|
-
|
|
765
|
+
<slot name="more-icon">${drawIcon(dotsThreeVertical)}</slot>
|
|
729
766
|
</button>
|
|
730
767
|
${this.overflow.map((one) => this.renderOverflowItem(one))}
|
|
731
768
|
</${this.tag('menu')}>`}
|
|
@@ -738,16 +775,35 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
738
775
|
aria-pressed=${this.full ? 'true' : 'false'}
|
|
739
776
|
@click=${() => void this.fullscreen.toggle()}
|
|
740
777
|
>
|
|
741
|
-
${
|
|
778
|
+
${this.full
|
|
779
|
+
? html `<slot name="exit-fullscreen-icon">${drawIcon(cornersIn)}</slot>`
|
|
780
|
+
: html `<slot name="fullscreen-icon">${drawIcon(cornersOut)}</slot>`}
|
|
742
781
|
</button>
|
|
743
782
|
</div>`;
|
|
744
783
|
}
|
|
784
|
+
renderStart() {
|
|
785
|
+
if (this.controls ||
|
|
786
|
+
this.playing ||
|
|
787
|
+
this.buffering ||
|
|
788
|
+
this.failed ||
|
|
789
|
+
this.startControl === 'none') {
|
|
790
|
+
return nothing;
|
|
791
|
+
}
|
|
792
|
+
return html `<button
|
|
793
|
+
part="start"
|
|
794
|
+
type="button"
|
|
795
|
+
tabindex="-1"
|
|
796
|
+
aria-hidden="true"
|
|
797
|
+
aria-label=${this.playLabel}
|
|
798
|
+
@click=${this.handleStart}
|
|
799
|
+
><slot name="start-icon">${drawIcon(play)}</slot></button>`;
|
|
800
|
+
}
|
|
745
801
|
render() {
|
|
746
802
|
return html `<div
|
|
747
803
|
part="stage"
|
|
748
804
|
tabindex=${this.controls ? nothing : '0'}
|
|
749
805
|
role=${this.controls ? nothing : 'group'}
|
|
750
|
-
aria-label=${this.controls ? nothing : this.label ||
|
|
806
|
+
aria-label=${this.controls ? nothing : this.label || this.playerLabel}
|
|
751
807
|
@keydown=${this.handleKeydown}
|
|
752
808
|
@pointermove=${this.idler.stir}
|
|
753
809
|
@pointerleave=${this.idler.leave}
|
|
@@ -820,20 +876,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
|
|
|
820
876
|
${this.errorLabel}
|
|
821
877
|
</div>`
|
|
822
878
|
: nothing}
|
|
823
|
-
${this.
|
|
824
|
-
this.playing ||
|
|
825
|
-
this.buffering ||
|
|
826
|
-
this.failed ||
|
|
827
|
-
this.startControl === 'none'
|
|
828
|
-
? nothing
|
|
829
|
-
: html `<button
|
|
830
|
-
part="start"
|
|
831
|
-
type="button"
|
|
832
|
-
aria-label=${this.playLabel}
|
|
833
|
-
@click=${() => this.toggle()}
|
|
834
|
-
>
|
|
835
|
-
${drawIcon(play)}
|
|
836
|
-
</button>`}
|
|
879
|
+
${this.renderStart()}
|
|
837
880
|
${this.controls ? nothing : this.renderBar()}
|
|
838
881
|
</div>`;
|
|
839
882
|
}
|
|
@@ -910,6 +953,9 @@ __decorate([
|
|
|
910
953
|
__decorate([
|
|
911
954
|
property({ attribute: 'pip-label' })
|
|
912
955
|
], HelixHeadlessVideo.prototype, "pipLabel", void 0);
|
|
956
|
+
__decorate([
|
|
957
|
+
property({ attribute: 'player-label' })
|
|
958
|
+
], HelixHeadlessVideo.prototype, "playerLabel", void 0);
|
|
913
959
|
__decorate([
|
|
914
960
|
property({ attribute: 'play-label' })
|
|
915
961
|
], HelixHeadlessVideo.prototype, "playLabel", void 0);
|
|
@@ -22,8 +22,13 @@ import '../../menu/index.js';
|
|
|
22
22
|
* @event {HelixSelectEvent} helix-select - An entry was chosen. The event carries its value, and the playlist listens for it. Cancelable: cancel it to keep the current entry.
|
|
23
23
|
*
|
|
24
24
|
* @csspart entry - One entry in the menu.
|
|
25
|
+
* @csspart entry-end - The column at the end of an entry, which holds its shortcut. It is always present.
|
|
25
26
|
* @csspart entry-item - The entry's row. It is an `<a>` when `href` is set.
|
|
26
27
|
* @csspart entry-mark - The mark at the end of an entry: a check mark when it is checked, or a caret when it opens a submenu.
|
|
28
|
+
* @csspart entry-shortcut - The key drawn for an entry's shortcut. The playlist's entries set none.
|
|
29
|
+
* @csspart entry-shortcut-kbd - The key inside `entry-shortcut`.
|
|
30
|
+
* @csspart entry-shortcut-key - One key of an entry's shortcut chord, inside `entry-shortcut`. The playlist's entries set none.
|
|
31
|
+
* @csspart entry-shortcut-separator - The `+` between two keys of an entry's shortcut, where the platform writes one.
|
|
27
32
|
* @csspart entry-start - The column at the start of an entry. It is a slot and is always present.
|
|
28
33
|
* @csspart menu - The menu that holds the entries.
|
|
29
34
|
* @csspart menu-back - The button that goes back from a submenu.
|
|
@@ -85,7 +85,9 @@ let HelixHeadlessVideoPlaylistMenu = class HelixHeadlessVideoPlaylistMenu extend
|
|
|
85
85
|
</slot>
|
|
86
86
|
${this.entries.map((entry) => html `<${this.tag('menu-item')}
|
|
87
87
|
part="entry"
|
|
88
|
-
exportparts="item: entry-item, mark: entry-mark,
|
|
88
|
+
exportparts="end: entry-end, item: entry-item, mark: entry-mark, shortcut: entry-shortcut,
|
|
89
|
+
shortcut-kbd: entry-shortcut-kbd, shortcut-key: entry-shortcut-key,
|
|
90
|
+
shortcut-separator: entry-shortcut-separator, start: entry-start"
|
|
89
91
|
value=${entry.value}
|
|
90
92
|
checkable
|
|
91
93
|
?checked=${entry.current}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The order a playlist plays its entries in, and where a step from one lands.
|
|
3
|
+
*
|
|
4
|
+
* Separable because every answer is taken from a list of values and two
|
|
5
|
+
* settings, before anything moves: nothing here reaches a player or an entry.
|
|
6
|
+
* The playlist asks it which value comes next and applies the answer.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* How a playlist goes on at its end. `one` plays the same entry again when it
|
|
10
|
+
* ends, and `all` goes from the last entry back to the first.
|
|
11
|
+
*/
|
|
12
|
+
export type Repeat = 'all' | 'one';
|
|
13
|
+
/**
|
|
14
|
+
* A shuffled copy of a list, with `first` leading where it is in the list.
|
|
15
|
+
*
|
|
16
|
+
* `first` leads because a reader turning shuffle on is watching something, and
|
|
17
|
+
* a shuffle that could put that entry anywhere would bring it round again
|
|
18
|
+
* before the rest have played.
|
|
19
|
+
*
|
|
20
|
+
* Fisher and Yates' shuffle, which gives every order of the rest the same
|
|
21
|
+
* chance. `random` is the source of chance, `Math.random` unless a caller
|
|
22
|
+
* passes one.
|
|
23
|
+
*/
|
|
24
|
+
export declare const shuffled: <T>(items: readonly T[], first?: T, random?: () => number) => T[];
|
|
25
|
+
/**
|
|
26
|
+
* The order to play in.
|
|
27
|
+
*
|
|
28
|
+
* As written without shuffle. With it, the shuffled order already `held` for
|
|
29
|
+
* as long as it covers the same entries, so stepping back retraces what was
|
|
30
|
+
* played; a new one, led by `current`, once an entry arrives or leaves.
|
|
31
|
+
*/
|
|
32
|
+
export declare const playOrder: (values: readonly string[], shuffle: boolean, held: readonly string[] | undefined, current: string | undefined, random?: () => number) => string[];
|
|
33
|
+
/**
|
|
34
|
+
* Where a step of `by` from `current` lands in `order`, or `undefined` past an
|
|
35
|
+
* end.
|
|
36
|
+
*
|
|
37
|
+
* `wrap` goes round instead of stopping, which is what `repeat="all"` asks
|
|
38
|
+
* for. With no current entry, a step forward lands on the first one and a step
|
|
39
|
+
* back on nothing, as a list that has not started has nothing behind it.
|
|
40
|
+
*/
|
|
41
|
+
export declare const stepTo: (order: readonly string[], current: string | undefined, by: number, wrap: boolean) => string | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const shuffled = (items, first, random = Math.random) => {
|
|
2
|
+
const rest = items.filter((one) => one !== first);
|
|
3
|
+
for (let at = rest.length - 1; at > 0; at -= 1) {
|
|
4
|
+
const swap = Math.floor(random() * (at + 1));
|
|
5
|
+
const held = rest[at];
|
|
6
|
+
rest[at] = rest[swap];
|
|
7
|
+
rest[swap] = held;
|
|
8
|
+
}
|
|
9
|
+
return first !== undefined && items.includes(first) ? [first, ...rest] : rest;
|
|
10
|
+
};
|
|
11
|
+
const sameValues = (one, other) => one.length === other.length && one.every((value) => other.includes(value));
|
|
12
|
+
export const playOrder = (values, shuffle, held, current, random = Math.random) => {
|
|
13
|
+
if (!shuffle) {
|
|
14
|
+
return [...values];
|
|
15
|
+
}
|
|
16
|
+
if (held !== undefined && sameValues(held, values)) {
|
|
17
|
+
return [...held];
|
|
18
|
+
}
|
|
19
|
+
return shuffled(values, current, random);
|
|
20
|
+
};
|
|
21
|
+
export const stepTo = (order, current, by, wrap) => {
|
|
22
|
+
const at = current === undefined ? -1 : order.indexOf(current);
|
|
23
|
+
if (at < 0) {
|
|
24
|
+
return by > 0 ? order[0] : undefined;
|
|
25
|
+
}
|
|
26
|
+
const to = at + by;
|
|
27
|
+
if (to >= 0 && to < order.length) {
|
|
28
|
+
return order[to];
|
|
29
|
+
}
|
|
30
|
+
if (!wrap || order.length === 0) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return order[((to % order.length) + order.length) % order.length];
|
|
34
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import { type Repeat } from '../order.js';
|
|
3
4
|
declare const HelixHeadlessVideoPlaylist_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & typeof HelixElement;
|
|
4
5
|
/**
|
|
5
6
|
* @summary A list of video clips that play one after another in a single player.
|
|
@@ -22,7 +23,17 @@ declare const HelixHeadlessVideoPlaylist_base: (new (...args: any[]) => import("
|
|
|
22
23
|
* - the player reaches the end.
|
|
23
24
|
*
|
|
24
25
|
* On `ended` the playlist advances and the next clip starts playing, because
|
|
25
|
-
* the user already pressed play once.
|
|
26
|
+
* the user already pressed play once. `repeat` decides what happens at the
|
|
27
|
+
* end: `one` plays the same entry again, and `all` goes from the last entry
|
|
28
|
+
* back to the first. Without it, the playlist stops on the last entry and
|
|
29
|
+
* sends `helix-end`. `shuffle` plays the entries in a random order, starting
|
|
30
|
+
* from the one that is current, and `previous` retraces that order.
|
|
31
|
+
*
|
|
32
|
+
* **Keyboard.** Each entry is a button in the tab order, and Enter or Space
|
|
33
|
+
* plays it. The current entry carries `aria-current`. While focus is on the
|
|
34
|
+
* player, the player's own keys work, and `Video` lists them. Its previous
|
|
35
|
+
* and next controls move through the entries in the same order the playlist
|
|
36
|
+
* does.
|
|
26
37
|
*
|
|
27
38
|
* @since 0.1.0
|
|
28
39
|
* @status stable
|
|
@@ -33,8 +44,9 @@ declare const HelixHeadlessVideoPlaylist_base: (new (...args: any[]) => import("
|
|
|
33
44
|
* @slot - The entries.
|
|
34
45
|
* @slot player - The player that plays the entries.
|
|
35
46
|
*
|
|
36
|
-
* @event {HelixActivateEvent} helix-activate - The current entry changed. The playlist already holds the new entry when this is sent.
|
|
47
|
+
* @event {HelixActivateEvent} helix-activate - The current entry changed. The playlist already holds the new entry when this is sent, and `detail.previous` is the entry it left.
|
|
37
48
|
* @event {HelixBeforeActivateEvent} helix-before-activate - The current entry is about to change. Cancelable: cancel it to keep the current entry.
|
|
49
|
+
* @event {HelixEndEvent} helix-end - The last entry finished playing, and the playlist stopped there. Not sent while `repeat` is set.
|
|
38
50
|
*
|
|
39
51
|
* @csspart items - The list of entries.
|
|
40
52
|
* @csspart player - The region that holds the player.
|
|
@@ -44,6 +56,30 @@ export declare class HelixHeadlessVideoPlaylist extends HelixHeadlessVideoPlayli
|
|
|
44
56
|
* The list's name, read by screen readers.
|
|
45
57
|
*/
|
|
46
58
|
label: string;
|
|
59
|
+
/**
|
|
60
|
+
* What happens when an entry ends with no next one to go to. `one` plays the
|
|
61
|
+
* same entry again, and `all` goes from the last entry back to the first.
|
|
62
|
+
* Absent, the playlist stops on the last entry and sends `helix-end`.
|
|
63
|
+
*
|
|
64
|
+
* `all` also lets the next and previous controls go round, so next on the
|
|
65
|
+
* last entry is the first. `one` changes only what an ending does: next and
|
|
66
|
+
* previous still move, being a reader asking for another entry.
|
|
67
|
+
*/
|
|
68
|
+
repeat?: Repeat;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the entries play in a random order. The order starts from the
|
|
71
|
+
* entry that is current, and holds until shuffle is turned off or an entry
|
|
72
|
+
* arrives or leaves, so previous goes back through what has played.
|
|
73
|
+
*/
|
|
74
|
+
shuffle: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The shuffled order of the entries' values, while `shuffle` is on.
|
|
77
|
+
*
|
|
78
|
+
* Held rather than drawn on each step, so previous retraces the way next
|
|
79
|
+
* came. Dropped when shuffle turns off, so turning it on again deals a new
|
|
80
|
+
* order from wherever the reader is.
|
|
81
|
+
*/
|
|
82
|
+
private dealt;
|
|
47
83
|
/**
|
|
48
84
|
* The entries, in the order the consumer wrote them.
|
|
49
85
|
*
|
|
@@ -82,14 +118,52 @@ export declare class HelixHeadlessVideoPlaylist extends HelixHeadlessVideoPlayli
|
|
|
82
118
|
* contract.
|
|
83
119
|
*/
|
|
84
120
|
private get player();
|
|
85
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* The entry a step of `by` lands on, in the order the playlist plays in, or
|
|
123
|
+
* `undefined` past an end. Disabled entries are not in the order, so a step
|
|
124
|
+
* passes over them.
|
|
125
|
+
*/
|
|
126
|
+
private following;
|
|
127
|
+
/**
|
|
128
|
+
* Moves by one in the playing order and plays what it lands on. At an end it
|
|
129
|
+
* stays, unless `repeat` is `all`.
|
|
130
|
+
*
|
|
131
|
+
* A move a consumer refuses with `helix-before-activate` plays nothing, and
|
|
132
|
+
* leaves nothing behind to play on a later change.
|
|
133
|
+
*/
|
|
86
134
|
private step;
|
|
135
|
+
/**
|
|
136
|
+
* Plays the current entry again from its start, which is what an ending
|
|
137
|
+
* under `repeat="one"` asks for, and a list of one under `repeat="all"`.
|
|
138
|
+
*/
|
|
139
|
+
private replay;
|
|
140
|
+
/**
|
|
141
|
+
* Moves to the next entry and plays it, as the player's next control does.
|
|
142
|
+
* Follows `shuffle`, goes round under `repeat="all"`, and stays on the last
|
|
143
|
+
* entry otherwise.
|
|
144
|
+
*/
|
|
145
|
+
next(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Moves to the previous entry and plays it, as the player's previous control
|
|
148
|
+
* does. Under `shuffle` it goes back through the order that played.
|
|
149
|
+
*/
|
|
150
|
+
previous(): void;
|
|
87
151
|
private readonly handleSelect;
|
|
88
152
|
private readonly handleNext;
|
|
89
153
|
private readonly handlePrevious;
|
|
154
|
+
/**
|
|
155
|
+
* An entry ended: the same one again under `repeat="one"`, the next one in
|
|
156
|
+
* the order, or, past the last, `helix-end`.
|
|
157
|
+
*
|
|
158
|
+
* **A notification with no class of its own**, sent as a plain event and
|
|
159
|
+
* carrying nothing: the playlist is still on the last entry, and `active`
|
|
160
|
+
* says which. Not sent under `repeat`, where a list never runs out.
|
|
161
|
+
*/
|
|
90
162
|
private readonly handleEnded;
|
|
91
163
|
connectedCallback(): void;
|
|
92
164
|
disconnectedCallback(): void;
|
|
165
|
+
/** A shuffle turned off forgets its order, so the next one is new. */
|
|
166
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
93
167
|
/**
|
|
94
168
|
* Points the player at the current entry, and tells the entries which is on.
|
|
95
169
|
*
|