@vonage/vivid 3.57.0 → 3.59.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/appearance-ui/index.cjs +1 -1
- package/appearance-ui/index.js +1 -1
- package/custom-elements.json +1264 -328
- package/lib/audio-player/audio-player.d.ts +20 -0
- package/lib/combobox/combobox.d.ts +3 -0
- package/lib/combobox/definition.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +23 -8
- package/lib/number-field/number-field.form-associated.d.ts +10 -0
- package/lib/video-player/video-player.d.ts +1 -0
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +1 -1
- package/package.json +1 -1
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition16.cjs +11 -2
- package/shared/definition16.js +11 -2
- package/shared/definition20.cjs +13 -13
- package/shared/definition20.js +13 -13
- package/shared/definition29.cjs +1 -0
- package/shared/definition29.js +1 -1
- package/shared/definition3.cjs +1 -1
- package/shared/definition3.js +1 -1
- package/shared/definition31.cjs +1 -1
- package/shared/definition31.js +1 -1
- package/shared/definition32.cjs +1 -1
- package/shared/definition32.js +1 -1
- package/shared/definition35.cjs +240 -331
- package/shared/definition35.js +241 -332
- package/shared/definition38.cjs +1 -1
- package/shared/definition38.js +1 -1
- package/shared/definition42.cjs +1 -1
- package/shared/definition42.js +2 -2
- package/shared/definition43.cjs +2 -2
- package/shared/definition43.js +2 -2
- package/shared/definition46.cjs +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition47.cjs +1 -1
- package/shared/definition47.js +1 -1
- package/shared/definition5.cjs +209 -128
- package/shared/definition5.js +203 -122
- package/shared/definition50.cjs +1 -1
- package/shared/definition50.js +1 -1
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition54.cjs +1 -1
- package/shared/definition54.js +1 -1
- package/shared/definition58.cjs +1 -1
- package/shared/definition58.js +1 -1
- package/shared/definition59.cjs +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition61.cjs +10 -65853
- package/shared/definition61.js +10 -65853
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +1 -1
- package/shared/definition8.js +1 -1
- package/shared/icon.cjs +1 -1
- package/shared/icon.js +1 -1
- package/shared/key-codes2.js +1 -1
- package/shared/patterns/anchored.d.ts +4 -4
- package/shared/slider.template.cjs +3 -3
- package/shared/slider.template.js +3 -3
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/video-player.cjs +65864 -0
- package/shared/video-player.js +65861 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +5 -5
- package/styles/tokens/theme-light.css +5 -5
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +58 -0
package/shared/definition5.cjs
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const definition = require('./definition11.cjs');
|
|
5
|
-
const definition$
|
|
4
|
+
const definition$1 = require('./definition11.cjs');
|
|
5
|
+
const definition$2 = require('./definition46.cjs');
|
|
6
|
+
const definition$3 = require('./definition30.cjs');
|
|
6
7
|
const enums = require('./enums.cjs');
|
|
7
8
|
require('./affix.cjs');
|
|
8
9
|
require('./index2.cjs');
|
|
9
10
|
const localized = require('./localized.cjs');
|
|
10
11
|
const applyMixins = require('./apply-mixins.cjs');
|
|
12
|
+
const videoPlayer = require('./video-player.cjs');
|
|
13
|
+
const definition = require('./definition29.cjs');
|
|
11
14
|
const when = require('./when.cjs');
|
|
12
|
-
const
|
|
15
|
+
const repeat = require('./repeat.cjs');
|
|
13
16
|
const classNames = require('./class-names.cjs');
|
|
14
17
|
|
|
15
|
-
const styles = ":host{display:block;max-inline-size:350px}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base .slider{flex:1;grid-area:slider;min-inline-size:var(--audio-player-min-inline-size, 200px)}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
18
|
+
const styles = ":host{display:block;max-inline-size:350px}.wrapper{container-type:inline-size}.base{display:inline-flex;box-sizing:border-box;align-items:center;padding:8px;color:var(--vvd-color-canvas-text);gap:16px;inline-size:100%;user-select:none}.base .slider{flex:1;grid-area:slider;min-inline-size:var(--audio-player-min-inline-size, 200px)}.base .controls{display:flex;align-items:center;justify-content:center;gap:8px;grid-area:controls}.base .time-stamp{display:inline-flex}.base .time-stamp .current-time,.base .time-stamp .total-time{margin-inline:6px;min-inline-size:32px}.base .playback-button{grid-area:playback}@container (max-width: 500px){.base.two-lines{display:inline-grid;grid-template:auto auto/1fr;grid-template-areas:\"slider\" \"controls\";inline-size:100%;row-gap:4px}.base.two-lines .time-stamp{margin-inline:auto 2px}.base.two-lines.playback{grid-template-areas:\"slider slider\" \"controls playback\";grid-template-columns:1fr auto}.base.two-lines.playback .time-stamp{margin-inline:auto}.base .slider{box-sizing:border-box;min-inline-size:auto;padding-inline:2px}}";
|
|
16
19
|
|
|
17
20
|
var __defProp = Object.defineProperty;
|
|
18
21
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -24,6 +27,20 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
24
27
|
__defProp(target, key, result);
|
|
25
28
|
return result;
|
|
26
29
|
};
|
|
30
|
+
const SKIP_DIRECTIONS = {
|
|
31
|
+
FORWARD: 1,
|
|
32
|
+
BACKWARD: -1
|
|
33
|
+
};
|
|
34
|
+
function formatTime(time) {
|
|
35
|
+
if (!time || Number.isNaN(time)) {
|
|
36
|
+
return "0:00";
|
|
37
|
+
}
|
|
38
|
+
const min = Math.floor(time / 60);
|
|
39
|
+
const sec = Math.floor(time % 60);
|
|
40
|
+
return min + ":" + (sec < 10 ? "0" + sec : sec);
|
|
41
|
+
}
|
|
42
|
+
const PAUSE = true;
|
|
43
|
+
const PLAY = false;
|
|
27
44
|
const validSkipByConverter = {
|
|
28
45
|
toView(value) {
|
|
29
46
|
return value;
|
|
@@ -34,7 +51,7 @@ const validSkipByConverter = {
|
|
|
34
51
|
};
|
|
35
52
|
class AudioPlayer extends index.FoundationElement {
|
|
36
53
|
constructor() {
|
|
37
|
-
super(
|
|
54
|
+
super();
|
|
38
55
|
this.playButtonAriaLabel = null;
|
|
39
56
|
this.pauseButtonAriaLabel = null;
|
|
40
57
|
this.sliderAriaLabel = null;
|
|
@@ -42,106 +59,118 @@ class AudioPlayer extends index.FoundationElement {
|
|
|
42
59
|
this.skipBackwardButtonAriaLabel = null;
|
|
43
60
|
this.disabled = false;
|
|
44
61
|
this.notime = false;
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
this.playbackRates = null;
|
|
63
|
+
this.#playerEl = new Audio();
|
|
64
|
+
this.#pausedChanged = (pausing) => {
|
|
65
|
+
if (pausing === this.paused) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!this.paused) {
|
|
69
|
+
this.#playerEl.pause();
|
|
70
|
+
} else {
|
|
71
|
+
this.#updateProgress();
|
|
72
|
+
this.#playerEl.play();
|
|
73
|
+
}
|
|
74
|
+
this.#setPausedState();
|
|
75
|
+
};
|
|
76
|
+
this.#updateProgress = () => {
|
|
77
|
+
index.Observable.notify(this, "currentTime");
|
|
78
|
+
const percent = this.currentTime / this.duration * 100;
|
|
79
|
+
if (percent === 100) {
|
|
80
|
+
this.pause();
|
|
52
81
|
}
|
|
53
82
|
};
|
|
83
|
+
this.#updateTotalTime = () => {
|
|
84
|
+
index.Observable.notify(this, "duration");
|
|
85
|
+
};
|
|
86
|
+
this.#rewind = () => {
|
|
87
|
+
if (this.#playerEl) {
|
|
88
|
+
this.currentTime = this.duration * Number(this.#sliderEl.value) / 100;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
this.#handleSliderEvent = (event) => {
|
|
92
|
+
if (event.target === this.#sliderEl) {
|
|
93
|
+
this.pause();
|
|
94
|
+
this.#rewind();
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
};
|
|
98
|
+
this.#setPausedState = () => {
|
|
99
|
+
index.Observable.notify(this, "paused");
|
|
100
|
+
};
|
|
101
|
+
this.#playerEl.addEventListener("timeupdate", this.#updateProgress);
|
|
102
|
+
this.#playerEl.addEventListener("loadedmetadata", this.#updateTotalTime);
|
|
54
103
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
104
|
+
get playbackRate() {
|
|
105
|
+
index.Observable.track(this, "playbackRate");
|
|
106
|
+
return this.#playerEl.playbackRate;
|
|
58
107
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
108
|
+
set playbackRate(value) {
|
|
109
|
+
this.#playerEl.playbackRate = value;
|
|
110
|
+
index.Observable.notify(this, "playbackRate");
|
|
62
111
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_togglePlay() {
|
|
67
|
-
if (this.paused) {
|
|
68
|
-
this._updateProgress();
|
|
69
|
-
this._playerEl.play();
|
|
112
|
+
srcChanged() {
|
|
113
|
+
if (this.src === void 0) {
|
|
114
|
+
this.#playerEl.removeAttribute("src");
|
|
70
115
|
} else {
|
|
71
|
-
this.
|
|
116
|
+
this.#playerEl.src = this.src;
|
|
72
117
|
}
|
|
73
|
-
this.paused = !this.paused;
|
|
74
118
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_onSkipButtonClick(isForward) {
|
|
79
|
-
if (this._playerEl) {
|
|
80
|
-
const currentTime = this._playerEl.currentTime;
|
|
81
|
-
const skipDirection = isForward ? 1 : -1;
|
|
82
|
-
const skipValue = parseInt(this.skipBy) * skipDirection;
|
|
83
|
-
const newTime = currentTime + skipValue;
|
|
84
|
-
this._playerEl.currentTime = Math.max(
|
|
85
|
-
0,
|
|
86
|
-
Math.min(this._playerEl.duration, newTime)
|
|
87
|
-
);
|
|
88
|
-
this._updateProgress();
|
|
89
|
-
}
|
|
119
|
+
get paused() {
|
|
120
|
+
index.Observable.track(this, "paused");
|
|
121
|
+
return this.#playerEl.paused;
|
|
90
122
|
}
|
|
91
|
-
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
94
|
-
_updateProgress() {
|
|
95
|
-
let currentTime;
|
|
96
|
-
const current = this._playerEl.currentTime;
|
|
97
|
-
const percent = current / this._playerEl.duration * 100;
|
|
98
|
-
if (this._sliderEl) {
|
|
99
|
-
this._sliderEl.value = percent.toString();
|
|
100
|
-
this._sliderEl.ariaValuetext = this._formatTime(current);
|
|
101
|
-
}
|
|
102
|
-
if (percent === 100) {
|
|
103
|
-
this.paused = true;
|
|
104
|
-
}
|
|
105
|
-
if (this._timeStampEl) {
|
|
106
|
-
currentTime = this._timeStampEl.querySelector(".current-time");
|
|
107
|
-
if (currentTime)
|
|
108
|
-
currentTime.textContent = this._formatTime(current);
|
|
109
|
-
}
|
|
123
|
+
set paused(_) {
|
|
110
124
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_updateTotalTime() {
|
|
115
|
-
let totalTime;
|
|
116
|
-
if (this._playerEl)
|
|
117
|
-
this.duration = this._playerEl.duration;
|
|
118
|
-
if (this._timeStampEl) {
|
|
119
|
-
totalTime = this._timeStampEl.querySelector(".total-time");
|
|
120
|
-
if (totalTime)
|
|
121
|
-
totalTime.textContent = this._formatTime(this._playerEl.duration);
|
|
122
|
-
}
|
|
125
|
+
get duration() {
|
|
126
|
+
index.Observable.track(this, "duration");
|
|
127
|
+
return this.#playerEl.duration;
|
|
123
128
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.paused = true;
|
|
130
|
-
if (this._playerEl) {
|
|
131
|
-
this._playerEl.pause();
|
|
132
|
-
}
|
|
133
|
-
this._rewind();
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
129
|
+
set duration(_) {
|
|
130
|
+
}
|
|
131
|
+
get currentTime() {
|
|
132
|
+
index.Observable.track(this, "currentTime");
|
|
133
|
+
return this.#playerEl.currentTime;
|
|
136
134
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*/
|
|
140
|
-
_formatTime(time) {
|
|
141
|
-
const min = Math.floor(time / 60);
|
|
142
|
-
const sec = Math.floor(time % 60);
|
|
143
|
-
return min + ":" + (sec < 10 ? "0" + sec : sec);
|
|
135
|
+
set currentTime(value) {
|
|
136
|
+
this.#playerEl.currentTime = value;
|
|
144
137
|
}
|
|
138
|
+
get #sliderEl() {
|
|
139
|
+
return this.shadowRoot.querySelector(".slider");
|
|
140
|
+
}
|
|
141
|
+
#playerEl;
|
|
142
|
+
get #baseElement() {
|
|
143
|
+
return this.shadowRoot.querySelector(".base");
|
|
144
|
+
}
|
|
145
|
+
connectedCallback() {
|
|
146
|
+
super.connectedCallback();
|
|
147
|
+
document.addEventListener("mouseup", this.#rewind);
|
|
148
|
+
this.#setInteractionListeners();
|
|
149
|
+
this.#setPausedState();
|
|
150
|
+
}
|
|
151
|
+
disconnectedCallback() {
|
|
152
|
+
super.disconnectedCallback();
|
|
153
|
+
document.addEventListener("mouseup", this.#rewind);
|
|
154
|
+
this.#setInteractionListeners(false);
|
|
155
|
+
}
|
|
156
|
+
play() {
|
|
157
|
+
this.#pausedChanged(PLAY);
|
|
158
|
+
}
|
|
159
|
+
pause() {
|
|
160
|
+
this.#pausedChanged(PAUSE);
|
|
161
|
+
}
|
|
162
|
+
#setInteractionListeners(add = true) {
|
|
163
|
+
const action = add ? "addEventListener" : "removeEventListener";
|
|
164
|
+
this.#baseElement[action]("keyup", this.#handleSliderEvent);
|
|
165
|
+
this.#baseElement[action]("keydown", this.#handleSliderEvent);
|
|
166
|
+
this.#baseElement[action]("mousedown", this.#handleSliderEvent);
|
|
167
|
+
}
|
|
168
|
+
#pausedChanged;
|
|
169
|
+
#updateProgress;
|
|
170
|
+
#updateTotalTime;
|
|
171
|
+
#rewind;
|
|
172
|
+
#handleSliderEvent;
|
|
173
|
+
#setPausedState;
|
|
145
174
|
}
|
|
146
175
|
__decorateClass([
|
|
147
176
|
index.attr({ attribute: "play-button-aria-label" })
|
|
@@ -177,17 +206,45 @@ __decorateClass([
|
|
|
177
206
|
})
|
|
178
207
|
], AudioPlayer.prototype, "skipBy");
|
|
179
208
|
__decorateClass([
|
|
180
|
-
index.
|
|
181
|
-
], AudioPlayer.prototype, "
|
|
182
|
-
__decorateClass([
|
|
183
|
-
index.observable
|
|
184
|
-
], AudioPlayer.prototype, "duration");
|
|
209
|
+
index.attr({ attribute: "playback-rates" })
|
|
210
|
+
], AudioPlayer.prototype, "playbackRates");
|
|
185
211
|
applyMixins.applyMixins(AudioPlayer, localized.Localized);
|
|
186
212
|
|
|
187
|
-
|
|
213
|
+
function getCurrentTimePercentage(x) {
|
|
214
|
+
if (Number.isNaN(x.currentTime) || Number.isNaN(x.duration)) {
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
return x.currentTime / x.duration * 100;
|
|
218
|
+
}
|
|
219
|
+
function skip(audioElement, skipDirection) {
|
|
220
|
+
const currentTime = audioElement.currentTime;
|
|
221
|
+
const skipValue = parseInt(audioElement.skipBy) * skipDirection;
|
|
222
|
+
const newTime = currentTime + skipValue;
|
|
223
|
+
audioElement.currentTime = Math.max(
|
|
224
|
+
0,
|
|
225
|
+
Math.min(audioElement.duration, newTime)
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
const getClasses = ({
|
|
229
|
+
notime,
|
|
230
|
+
disabled,
|
|
231
|
+
duration,
|
|
232
|
+
skipBy,
|
|
233
|
+
playbackRates
|
|
234
|
+
}) => classNames.classNames(
|
|
235
|
+
["disabled", Boolean(disabled) || !duration],
|
|
236
|
+
[
|
|
237
|
+
"two-lines",
|
|
238
|
+
!notime && (Boolean(Number(skipBy)) || Boolean(playbackRates))
|
|
239
|
+
],
|
|
240
|
+
["playback", Boolean(playbackRates)]
|
|
241
|
+
);
|
|
242
|
+
const isMenuItemChekced = (playbackRate, { parent }) => {
|
|
243
|
+
return playbackRate === parent.playbackRate;
|
|
244
|
+
};
|
|
188
245
|
function renderButton(context) {
|
|
189
|
-
const buttonTag = context.tagFor(definition.Button);
|
|
190
|
-
return index.html`<${buttonTag} class="pause" @click="${(x) => x.
|
|
246
|
+
const buttonTag = context.tagFor(definition$1.Button);
|
|
247
|
+
return index.html`<${buttonTag} class="pause" @click="${(x) => x.paused ? x.play() : x.pause()}"
|
|
191
248
|
icon="${(x) => x.paused ? "play-solid" : "pause-solid"}"
|
|
192
249
|
aria-label="${(x) => x.paused ? x.playButtonAriaLabel || x.locale.audioPlayer.playButtonLabel : x.pauseButtonAriaLabel || x.locale.audioPlayer.pauseButtonLabel}"
|
|
193
250
|
size='condensed'
|
|
@@ -196,9 +253,10 @@ function renderButton(context) {
|
|
|
196
253
|
></${buttonTag}>`;
|
|
197
254
|
}
|
|
198
255
|
function renderBackwardSkipButtons(context) {
|
|
199
|
-
const buttonTag = context.tagFor(definition.Button);
|
|
256
|
+
const buttonTag = context.tagFor(definition$1.Button);
|
|
200
257
|
return index.html`
|
|
201
|
-
<${buttonTag} class="skip backward"
|
|
258
|
+
<${buttonTag} class="skip backward"
|
|
259
|
+
@click="${(element) => skip(element, SKIP_DIRECTIONS.BACKWARD)}"
|
|
202
260
|
icon="${(x) => x.skipBy == enums.MediaSkipBy.Five ? "5-sec-backward-line" : x.skipBy == enums.MediaSkipBy.Thirty ? "30-sec-backward-line" : "10-sec-backward-line"}"
|
|
203
261
|
size='condensed'
|
|
204
262
|
aria-label="${(x) => x.skipBackwardButtonAriaLabel || x.locale.audioPlayer.skipBackwardButton}"
|
|
@@ -208,9 +266,10 @@ function renderBackwardSkipButtons(context) {
|
|
|
208
266
|
`;
|
|
209
267
|
}
|
|
210
268
|
function renderForwardSkipButtons(context) {
|
|
211
|
-
const buttonTag = context.tagFor(definition.Button);
|
|
269
|
+
const buttonTag = context.tagFor(definition$1.Button);
|
|
212
270
|
return index.html`
|
|
213
|
-
<${buttonTag} class="skip forward"
|
|
271
|
+
<${buttonTag} class="skip forward"
|
|
272
|
+
@click="${(element) => skip(element, SKIP_DIRECTIONS.FORWARD)}"
|
|
214
273
|
icon="${(x) => x.skipBy == enums.MediaSkipBy.Five ? "5-sec-forward-line" : x.skipBy == enums.MediaSkipBy.Thirty ? "30-sec-forward-line" : "10-sec-forward-line"}"
|
|
215
274
|
size='condensed'
|
|
216
275
|
aria-label="${(x) => x.skipForwardButtonAriaLabel || x.locale.audioPlayer.skipForwardButton}"
|
|
@@ -220,30 +279,34 @@ function renderForwardSkipButtons(context) {
|
|
|
220
279
|
`;
|
|
221
280
|
}
|
|
222
281
|
function renderSlider(context) {
|
|
223
|
-
const sliderTag = context.tagFor(definition$
|
|
224
|
-
return index.html
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
282
|
+
const sliderTag = context.tagFor(definition$2.Slider);
|
|
283
|
+
return index.html`
|
|
284
|
+
<${sliderTag}
|
|
285
|
+
class="slider"
|
|
286
|
+
aria-label="${(x) => x.sliderAriaLabel || x.locale.audioPlayer.sliderLabel}"
|
|
287
|
+
current-value="${getCurrentTimePercentage}" max="100"
|
|
288
|
+
ariaValuetext="${(x) => formatTime(x.currentTime)}"
|
|
289
|
+
connotation="${(x) => x.connotation}"
|
|
290
|
+
?disabled="${(x) => x.disabled || !x.duration}">
|
|
230
291
|
</${sliderTag}>`;
|
|
231
292
|
}
|
|
232
293
|
function renderTimestamp() {
|
|
233
|
-
return index.html` <div class="time-stamp"
|
|
234
|
-
<span class="current-time"
|
|
294
|
+
return index.html` <div class="time-stamp">
|
|
295
|
+
<span class="current-time">${(x) => formatTime(x.currentTime)}</span>
|
|
235
296
|
<span>/</span>
|
|
236
|
-
<span class="total-time"
|
|
297
|
+
<span class="total-time">${(x) => formatTime(x.duration)}</span>
|
|
237
298
|
</div>`;
|
|
238
299
|
}
|
|
300
|
+
function handlePlaybackRateClick(playbackRate, context) {
|
|
301
|
+
context.parent.playbackRate = playbackRate;
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
239
304
|
const AudioPlayerTemplate = (context) => {
|
|
305
|
+
const menuTag = context.tagFor(definition.Menu);
|
|
306
|
+
const buttonTag = context.tagFor(definition$1.Button);
|
|
307
|
+
const menuItemTag = context.tagFor(definition.MenuItem);
|
|
240
308
|
return index.html` <div class="wrapper">
|
|
241
|
-
<div
|
|
242
|
-
class="base ${getClasses}"
|
|
243
|
-
@keyup="${(x, c) => x._handleSliderEvent(c.event)}"
|
|
244
|
-
@keydown="${(x, c) => x._handleSliderEvent(c.event)}"
|
|
245
|
-
@mousedown="${(x, c) => x._handleSliderEvent(c.event)}"
|
|
246
|
-
>
|
|
309
|
+
<div class="base ${getClasses}">
|
|
247
310
|
<div class="controls">
|
|
248
311
|
${when.when(
|
|
249
312
|
(x) => x.skipBy && x.skipBy != enums.MediaSkipBy.Zero,
|
|
@@ -257,12 +320,29 @@ const AudioPlayerTemplate = (context) => {
|
|
|
257
320
|
${when.when((x) => !x.notime, renderTimestamp())}
|
|
258
321
|
</div>
|
|
259
322
|
${renderSlider(context)}
|
|
260
|
-
|
|
261
|
-
${
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
323
|
+
<${menuTag} class="playback-rates" trigger="auto" placement="top-start" auto-dismiss>
|
|
324
|
+
${when.when(
|
|
325
|
+
(x) => Boolean(x.playbackRates),
|
|
326
|
+
index.html`<${buttonTag} id="playback-open-button"
|
|
327
|
+
class="playback-button"
|
|
328
|
+
slot="anchor"
|
|
329
|
+
icon="playback-speed-line"
|
|
330
|
+
aria-label="play back rates"
|
|
331
|
+
size='condensed'
|
|
332
|
+
connotation="${(x) => x.connotation}"
|
|
333
|
+
?disabled="${(x) => x.disabled || !x.duration}"
|
|
334
|
+
></${buttonTag}>`
|
|
335
|
+
)}
|
|
336
|
+
${repeat.repeat(
|
|
337
|
+
(x) => x.playbackRates ? videoPlayer.getPlaybackRatesArray(x.playbackRates) : [],
|
|
338
|
+
index.html`<${menuItemTag} @click="${handlePlaybackRateClick}"
|
|
339
|
+
role="menuitemradio"
|
|
340
|
+
class="playback-rate"
|
|
341
|
+
text="${(x) => x}"
|
|
342
|
+
check-appearance="tick-only"
|
|
343
|
+
?checked="${isMenuItemChekced}"></${menuItemTag}>`
|
|
344
|
+
)}
|
|
345
|
+
</${menuTag}>
|
|
266
346
|
</div>
|
|
267
347
|
</div>`;
|
|
268
348
|
};
|
|
@@ -274,8 +354,9 @@ const audioPlayerDefinition = AudioPlayer.compose({
|
|
|
274
354
|
});
|
|
275
355
|
const audioPlayerRegistries = [
|
|
276
356
|
audioPlayerDefinition(),
|
|
277
|
-
...definition.buttonRegistries,
|
|
278
|
-
...definition$
|
|
357
|
+
...definition$1.buttonRegistries,
|
|
358
|
+
...definition$2.sliderRegistries,
|
|
359
|
+
...definition$3.menuRegistries
|
|
279
360
|
];
|
|
280
361
|
const registerAudioPlayer = index.registerFactory(audioPlayerRegistries);
|
|
281
362
|
|