@hanifhan1f/vidstack 1.12.33 → 1.12.35

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.
Files changed (210) hide show
  1. package/cdn/with-layouts/chunks/{vidstack-BCLumCST.js → vidstack-BEgmmcDO.js} +56 -52
  2. package/cdn/with-layouts/chunks/{vidstack-DJyGEdCH.js → vidstack-t3PBZMbl.js} +1 -1
  3. package/cdn/with-layouts/vidstack.js +1 -1
  4. package/dev/chunks/{vidstack-B__DfQsT.js → vidstack-BReSQAMt.js} +10 -6
  5. package/dev/define/templates/vidstack-audio-layout.js +1 -1
  6. package/dev/define/templates/vidstack-video-layout.js +7 -5
  7. package/dev/define/vidstack-player-default-layout.js +1 -1
  8. package/dev/define/vidstack-player-layouts.js +1 -1
  9. package/dev/vidstack-elements.js +1 -1
  10. package/dev/vidstack.js +0 -4
  11. package/elements.d.ts +1 -1
  12. package/global/player.d.ts +1 -1
  13. package/global/plyr.d.ts +2 -2
  14. package/index.d.ts +2 -2
  15. package/package.json +1 -1
  16. package/prod/chunks/{vidstack-BnEo_Sla.js → vidstack-B0glDgAI.js} +10 -6
  17. package/prod/define/templates/vidstack-audio-layout.js +1 -1
  18. package/prod/define/templates/vidstack-video-layout.js +7 -5
  19. package/prod/define/vidstack-player-default-layout.js +1 -1
  20. package/prod/define/vidstack-player-layouts.js +1 -1
  21. package/prod/vidstack-elements.js +1 -1
  22. package/server/chunks/{vidstack-BIGdJnUK.js → vidstack-nANS1jfu.js} +16 -10
  23. package/server/define/vidstack-player-default-layout.js +1 -1
  24. package/server/define/vidstack-player-layouts.js +1 -1
  25. package/server/vidstack-elements.js +1 -1
  26. package/types/{vidstack-DYLKXUvI.d.ts → vidstack-CZqFq0VF.d.ts} +13 -1
  27. package/cdn/chunks/vidstack-8JHLDxl5.js +0 -1
  28. package/cdn/chunks/vidstack-BF7lZRtq.js +0 -3
  29. package/cdn/chunks/vidstack-BYgY9wmd.js +0 -1
  30. package/cdn/chunks/vidstack-BYpysj84.js +0 -1
  31. package/cdn/chunks/vidstack-Bjo5esRp.js +0 -1
  32. package/cdn/chunks/vidstack-BkxGdzTJ.js +0 -16
  33. package/cdn/chunks/vidstack-BuL67v3q.js +0 -1
  34. package/cdn/chunks/vidstack-Bzk6lVKb.js +0 -1
  35. package/cdn/chunks/vidstack-C0msPRTd.js +0 -3
  36. package/cdn/chunks/vidstack-C1FlyyzK.js +0 -1
  37. package/cdn/chunks/vidstack-CIjxJCz3.js +0 -1
  38. package/cdn/chunks/vidstack-CioT3Yw2.js +0 -1
  39. package/cdn/chunks/vidstack-Cj0I-Rec.js +0 -1
  40. package/cdn/chunks/vidstack-CmpbA3Yd.js +0 -16
  41. package/cdn/chunks/vidstack-CnWKPIKT.js +0 -16
  42. package/cdn/chunks/vidstack-CrqkytHl.js +0 -1
  43. package/cdn/chunks/vidstack-D0M8R0ZU.js +0 -1
  44. package/cdn/chunks/vidstack-D40FSa5B.js +0 -3
  45. package/cdn/chunks/vidstack-D84Fzc__.js +0 -16
  46. package/cdn/chunks/vidstack-DD2JwFVU.js +0 -1
  47. package/cdn/chunks/vidstack-DQvyz7Mm.js +0 -1
  48. package/cdn/chunks/vidstack-Dd9fqVv6.js +0 -1
  49. package/cdn/chunks/vidstack-DfDZuHNP.js +0 -1
  50. package/cdn/chunks/vidstack-uMxrPflF.js +0 -1
  51. package/cdn/chunks/vidstack-xjJ-ui_l.js +0 -1
  52. package/cdn/chunks/vidstack-zemsqC5d.js +0 -1
  53. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +0 -1
  54. package/cdn/providers/vidstack-audio-BOGYlExy.js +0 -1
  55. package/cdn/providers/vidstack-dash-CUtD4e6q.js +0 -1
  56. package/cdn/providers/vidstack-dash-D4ZARr66.js +0 -1
  57. package/cdn/providers/vidstack-google-cast-BdORATUX.js +0 -1
  58. package/cdn/providers/vidstack-hls-8-552IuX.js +0 -1
  59. package/cdn/providers/vidstack-hls-R25Kb6DP.js +0 -1
  60. package/cdn/providers/vidstack-html-BvVaN2VT.js +0 -1
  61. package/cdn/providers/vidstack-html-DaAUJYsD.js +0 -1
  62. package/cdn/providers/vidstack-video-BnwQZKER.js +0 -1
  63. package/cdn/providers/vidstack-video-Csvox7SO.js +0 -1
  64. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +0 -1
  65. package/cdn/providers/vidstack-vimeo-gJmBqtLK.js +0 -1
  66. package/cdn/providers/vidstack-youtube-Chl_dTAz.js +0 -1
  67. package/cdn/providers/vidstack-youtube-DiND6h3s.js +0 -1
  68. package/cdn/with-layouts/chunks/vidstack-4liSokT6.js +0 -1
  69. package/cdn/with-layouts/chunks/vidstack-B97B8XDc.js +0 -3
  70. package/cdn/with-layouts/chunks/vidstack-BD5YoTt5.js +0 -937
  71. package/cdn/with-layouts/chunks/vidstack-BGhRKayG.js +0 -914
  72. package/cdn/with-layouts/chunks/vidstack-BL_lNyW_.js +0 -1
  73. package/cdn/with-layouts/chunks/vidstack-BMhNagfl.js +0 -1
  74. package/cdn/with-layouts/chunks/vidstack-BP3ybDy9.js +0 -912
  75. package/cdn/with-layouts/chunks/vidstack-BbFHhcVG.js +0 -1
  76. package/cdn/with-layouts/chunks/vidstack-BjOOdDcQ.js +0 -1
  77. package/cdn/with-layouts/chunks/vidstack-C5AP9wid.js +0 -1
  78. package/cdn/with-layouts/chunks/vidstack-CS2aNc61.js +0 -1
  79. package/cdn/with-layouts/chunks/vidstack-CXEcXyBI.js +0 -1
  80. package/cdn/with-layouts/chunks/vidstack-Ciq-n5rg.js +0 -1
  81. package/cdn/with-layouts/chunks/vidstack-CmuGllcj.js +0 -1
  82. package/cdn/with-layouts/chunks/vidstack-CyNByJUW.js +0 -912
  83. package/cdn/with-layouts/chunks/vidstack-D-3_fAsK.js +0 -1
  84. package/cdn/with-layouts/chunks/vidstack-DCaNJN4T.js +0 -1
  85. package/cdn/with-layouts/chunks/vidstack-DKqYI_HJ.js +0 -1
  86. package/cdn/with-layouts/chunks/vidstack-DLGH9jfs.js +0 -1
  87. package/cdn/with-layouts/chunks/vidstack-DLVdcWrK.js +0 -3
  88. package/cdn/with-layouts/chunks/vidstack-DPO7J4-v.js +0 -3
  89. package/cdn/with-layouts/chunks/vidstack-DWjB11vV.js +0 -1
  90. package/cdn/with-layouts/chunks/vidstack-Dd3L-eQj.js +0 -1
  91. package/cdn/with-layouts/chunks/vidstack-Dh2GOjra.js +0 -1
  92. package/cdn/with-layouts/chunks/vidstack-DhNpv7SU.js +0 -1
  93. package/cdn/with-layouts/chunks/vidstack-QW5tTAS4.js +0 -897
  94. package/cdn/with-layouts/chunks/vidstack-T2rZVigk.js +0 -912
  95. package/cdn/with-layouts/chunks/vidstack-Xe_d7ovA.js +0 -1
  96. package/cdn/with-layouts/chunks/vidstack-wt2OT4N7.js +0 -1
  97. package/cdn/with-layouts/providers/vidstack-audio-Bw1csc6N.js +0 -1
  98. package/cdn/with-layouts/providers/vidstack-audio-CwoQJvl2.js +0 -1
  99. package/cdn/with-layouts/providers/vidstack-dash-CJsKJfLI.js +0 -1
  100. package/cdn/with-layouts/providers/vidstack-dash-DHRMFG4Y.js +0 -1
  101. package/cdn/with-layouts/providers/vidstack-google-cast-BSYJYn-o.js +0 -1
  102. package/cdn/with-layouts/providers/vidstack-hls-DG1rTEqu.js +0 -1
  103. package/cdn/with-layouts/providers/vidstack-hls-ji26kFdQ.js +0 -1
  104. package/cdn/with-layouts/providers/vidstack-html-BvHMxtoe.js +0 -1
  105. package/cdn/with-layouts/providers/vidstack-html-CoKFAYW5.js +0 -1
  106. package/cdn/with-layouts/providers/vidstack-video-1Uj5cNP2.js +0 -1
  107. package/cdn/with-layouts/providers/vidstack-video-CIxFJ9Z1.js +0 -1
  108. package/cdn/with-layouts/providers/vidstack-vimeo-CNLKOGMa.js +0 -1
  109. package/cdn/with-layouts/providers/vidstack-vimeo-DACTbJaQ.js +0 -1
  110. package/cdn/with-layouts/providers/vidstack-youtube-D1e-LE-8.js +0 -1
  111. package/cdn/with-layouts/providers/vidstack-youtube-RoLp-I6u.js +0 -1
  112. package/dev/chunks/vidstack-03oQOdB7.js +0 -58
  113. package/dev/chunks/vidstack-0XhA3AD_.js +0 -5181
  114. package/dev/chunks/vidstack-44ILR0Cb.js +0 -1521
  115. package/dev/chunks/vidstack-B4XOm7dP.js +0 -104
  116. package/dev/chunks/vidstack-BJsZjPkB.js +0 -204
  117. package/dev/chunks/vidstack-BXSB7eI9.js +0 -58
  118. package/dev/chunks/vidstack-BaGbgcvz.js +0 -107
  119. package/dev/chunks/vidstack-Blfm1k-4.js +0 -1520
  120. package/dev/chunks/vidstack-Bo8BNFJ2.js +0 -2986
  121. package/dev/chunks/vidstack-Bs54kFSz.js +0 -66
  122. package/dev/chunks/vidstack-C3N4zIuV.js +0 -254
  123. package/dev/chunks/vidstack-C4aPQ7hZ.js +0 -1482
  124. package/dev/chunks/vidstack-C6OqdJO7.js +0 -114
  125. package/dev/chunks/vidstack-CAL4iu_K.js +0 -1482
  126. package/dev/chunks/vidstack-CEjYxSqZ.js +0 -297
  127. package/dev/chunks/vidstack-CJCnHmKE.js +0 -104
  128. package/dev/chunks/vidstack-CQdFhXSo.js +0 -204
  129. package/dev/chunks/vidstack-CSryZFvY.js +0 -1521
  130. package/dev/chunks/vidstack-C_rvOKWp.js +0 -33
  131. package/dev/chunks/vidstack-CaudO1jl.js +0 -109
  132. package/dev/chunks/vidstack-CcQdBWil.js +0 -58
  133. package/dev/chunks/vidstack-Cky9ors4.js +0 -297
  134. package/dev/chunks/vidstack-DAOcbKGP.js +0 -254
  135. package/dev/chunks/vidstack-DD_3HszA.js +0 -1520
  136. package/dev/chunks/vidstack-DKaohJzR.js +0 -5181
  137. package/dev/chunks/vidstack-DLXCqdYV.js +0 -3010
  138. package/dev/chunks/vidstack-DS7nRfge.js +0 -204
  139. package/dev/chunks/vidstack-DWtK42Sh.js +0 -1483
  140. package/dev/chunks/vidstack-D_LvMxPr.js +0 -204
  141. package/dev/chunks/vidstack-Db1-Hg_U.js +0 -297
  142. package/dev/chunks/vidstack-DrczgsqN.js +0 -297
  143. package/dev/chunks/vidstack-EoLRQZbs.js +0 -2986
  144. package/dev/chunks/vidstack-FKkY62Dr.js +0 -104
  145. package/dev/chunks/vidstack-el2dbO0m.js +0 -5181
  146. package/dev/chunks/vidstack-rvhuswgi.js +0 -2986
  147. package/prod/chunks/vidstack-BAqdCFIm.js +0 -4771
  148. package/prod/chunks/vidstack-BHqGlnGz.js +0 -1482
  149. package/prod/chunks/vidstack-BP49Gz0m.js +0 -58
  150. package/prod/chunks/vidstack-BRZe2BNi.js +0 -107
  151. package/prod/chunks/vidstack-BRnfTkxi.js +0 -297
  152. package/prod/chunks/vidstack-BaaRY-9x.js +0 -201
  153. package/prod/chunks/vidstack-BexQYZop.js +0 -2976
  154. package/prod/chunks/vidstack-BpLd9ASW.js +0 -246
  155. package/prod/chunks/vidstack-C-yd_bAJ.js +0 -4771
  156. package/prod/chunks/vidstack-C05ipjAK.js +0 -1520
  157. package/prod/chunks/vidstack-CA4tDJdF.js +0 -33
  158. package/prod/chunks/vidstack-CFXAYpuh.js +0 -1521
  159. package/prod/chunks/vidstack-CIvL96_j.js +0 -297
  160. package/prod/chunks/vidstack-CYVCrFjx.js +0 -201
  161. package/prod/chunks/vidstack-Cs0fH84E.js +0 -1521
  162. package/prod/chunks/vidstack-D7hJcnN-.js +0 -297
  163. package/prod/chunks/vidstack-DDePVDjt.js +0 -2976
  164. package/prod/chunks/vidstack-DESBVLFp.js +0 -104
  165. package/prod/chunks/vidstack-DMDDSV3t.js +0 -104
  166. package/prod/chunks/vidstack-DXfGRhxZ.js +0 -201
  167. package/prod/chunks/vidstack-D_atbNqH.js +0 -3000
  168. package/prod/chunks/vidstack-DcMkaIHJ.js +0 -2976
  169. package/prod/chunks/vidstack-DnRxQoqP.js +0 -104
  170. package/prod/chunks/vidstack-DwenML7x.js +0 -4771
  171. package/prod/chunks/vidstack-IDWYvfna.js +0 -58
  172. package/prod/chunks/vidstack-Ko2EJadT.js +0 -1483
  173. package/prod/chunks/vidstack-MbEMbVfP.js +0 -109
  174. package/prod/chunks/vidstack-ShUhyBfI.js +0 -201
  175. package/prod/chunks/vidstack-SnIdjCkV.js +0 -58
  176. package/prod/chunks/vidstack-V1jwkH0s.js +0 -66
  177. package/prod/chunks/vidstack-V9U6gsde.js +0 -1482
  178. package/prod/chunks/vidstack-XA3zT5W9.js +0 -297
  179. package/prod/chunks/vidstack-bdt7uOlN.js +0 -114
  180. package/prod/chunks/vidstack-kdaDngIm.js +0 -1520
  181. package/prod/chunks/vidstack-oNEzlviH.js +0 -246
  182. package/server/chunks/vidstack-B2Bc9g7_.js +0 -2000
  183. package/server/chunks/vidstack-B4CWj0Hp.js +0 -381
  184. package/server/chunks/vidstack-B8P1aUCK.js +0 -1503
  185. package/server/chunks/vidstack-B8_v1VQn.js +0 -3059
  186. package/server/chunks/vidstack-BGgfNYAH.js +0 -141
  187. package/server/chunks/vidstack-BGmwlunt.js +0 -3035
  188. package/server/chunks/vidstack-BO8FLks6.js +0 -295
  189. package/server/chunks/vidstack-BosyhF3p.js +0 -207
  190. package/server/chunks/vidstack-C19bj3Wq.js +0 -307
  191. package/server/chunks/vidstack-C8F1EUBn.js +0 -104
  192. package/server/chunks/vidstack-CFTkUXGK.js +0 -295
  193. package/server/chunks/vidstack-CQMB7Msg.js +0 -1502
  194. package/server/chunks/vidstack-CWho6PlG.js +0 -141
  195. package/server/chunks/vidstack-CdBfecZT.js +0 -205
  196. package/server/chunks/vidstack-Cv_Art04.js +0 -4635
  197. package/server/chunks/vidstack-DE4b5Bgx.js +0 -2002
  198. package/server/chunks/vidstack-Db22EuE_.js +0 -207
  199. package/server/chunks/vidstack-DbvCOsqU.js +0 -107
  200. package/server/chunks/vidstack-DgHfFDiw.js +0 -1962
  201. package/server/chunks/vidstack-DhF59-Up.js +0 -4635
  202. package/server/chunks/vidstack-DnkB7eGO.js +0 -207
  203. package/server/chunks/vidstack-DoHmOxNm.js +0 -295
  204. package/server/chunks/vidstack-DsnTqzpL.js +0 -29
  205. package/server/chunks/vidstack-DzWvfg1d.js +0 -1503
  206. package/server/chunks/vidstack-FHGkN5xj.js +0 -566
  207. package/server/chunks/vidstack-PnFpou7g.js +0 -3035
  208. package/server/chunks/vidstack-f5-aflD2.js +0 -104
  209. package/server/chunks/vidstack-gEJMQpTE.js +0 -2001
  210. package/server/chunks/vidstack-n4zAyLEV.js +0 -2139
@@ -1,1482 +0,0 @@
1
- import { createContext, useContext, prop, Component, computed, provideContext, signal, isBoolean, effect, setAttribute, uppercaseFirstChar, isNil, isString, noop, isFunction, unwrap, camelToKebabCase, onDispose, scoped, keysOf, isArray, tick, peek, isKeyboardClick } from './vidstack-BNpgCJJ1.js';
2
- import { useMediaContext, useMediaState } from './vidstack-tt3O1zL6.js';
3
- import { watchColorScheme, $ariaBool, useResizeObserver, useActive } from './vidstack-DB9WDRL5.js';
4
- import { html } from 'lit-html';
5
- import { $signal, LayoutIconsLoader, Icon } from './vidstack-zfCm-GM5.js';
6
- import { watchActiveTextTrack } from './vidstack-BP49Gz0m.js';
7
- import { sortVideoQualities } from './vidstack-BTM4ERc7.js';
8
- import { ifDefined } from 'lit-html/directives/if-defined.js';
9
- import { ref } from 'lit-html/directives/ref.js';
10
- import { getDownloadFile, appendParamsToURL } from './vidstack-KShKSmYu.js';
11
-
12
- const defaultLayoutContext = createContext();
13
- function useDefaultLayoutContext() {
14
- return useContext(defaultLayoutContext);
15
- }
16
-
17
- const defaultLayoutProps = {
18
- colorScheme: "system",
19
- download: null,
20
- customIcons: false,
21
- disableTimeSlider: false,
22
- menuContainer: null,
23
- menuGroup: "bottom",
24
- noAudioGain: false,
25
- noGestures: false,
26
- noKeyboardAnimations: false,
27
- noModal: false,
28
- noScrubGesture: false,
29
- playbackRates: { min: 0, max: 2, step: 0.25 },
30
- audioGains: { min: 0, max: 300, step: 25 },
31
- seekStep: 5,
32
- sliderChaptersMinWidth: 325,
33
- hideQualityBitrate: false,
34
- episodes: null,
35
- episodesTitle: "Episodes",
36
- smallWhen: false,
37
- thumbnails: null,
38
- translations: null,
39
- when: false
40
- };
41
-
42
- class DefaultLayout extends Component {
43
- static props = defaultLayoutProps;
44
- #media;
45
- #when = computed(() => {
46
- const when = this.$props.when();
47
- return this.#matches(when);
48
- });
49
- #smallWhen = computed(() => {
50
- const when = this.$props.smallWhen();
51
- return this.#matches(when);
52
- });
53
- get isMatch() {
54
- return this.#when();
55
- }
56
- get isSmallLayout() {
57
- return this.#smallWhen();
58
- }
59
- onSetup() {
60
- this.#media = useMediaContext();
61
- this.setAttributes({
62
- "data-match": this.#when,
63
- "data-sm": () => this.#smallWhen() ? "" : null,
64
- "data-lg": () => !this.#smallWhen() ? "" : null,
65
- "data-size": () => this.#smallWhen() ? "sm" : "lg",
66
- "data-no-scrub-gesture": this.$props.noScrubGesture
67
- });
68
- provideContext(defaultLayoutContext, {
69
- ...this.$props,
70
- when: this.#when,
71
- smallWhen: this.#smallWhen,
72
- userPrefersAnnouncements: signal(true),
73
- userPrefersKeyboardAnimations: signal(true),
74
- menuPortal: signal(null)
75
- });
76
- }
77
- onAttach(el) {
78
- watchColorScheme(el, this.$props.colorScheme);
79
- }
80
- #matches(query) {
81
- return query !== "never" && (isBoolean(query) ? query : computed(() => query(this.#media.player.state))());
82
- }
83
- }
84
- const defaultlayout__proto = DefaultLayout.prototype;
85
- prop(defaultlayout__proto, "isMatch");
86
- prop(defaultlayout__proto, "isSmallLayout");
87
-
88
- function setLayoutName(name, isMatch) {
89
- effect(() => {
90
- const { player } = useMediaContext(), el = player.el;
91
- el && setAttribute(el, "data-layout", isMatch() && name);
92
- return () => el?.removeAttribute("data-layout");
93
- });
94
- }
95
-
96
- function i18n(translations, word) {
97
- return translations()?.[word] ?? word;
98
- }
99
-
100
- function DefaultAnnouncer() {
101
- return $signal(() => {
102
- const { translations, userPrefersAnnouncements } = useDefaultLayoutContext();
103
- if (!userPrefersAnnouncements()) return null;
104
- return html`<media-announcer .translations=${$signal(translations)}></media-announcer>`;
105
- });
106
- }
107
-
108
- function IconSlot(name, classes = "") {
109
- return html`<slot
110
- name=${`${name}-icon`}
111
- data-class=${`vds-icon vds-${name}-icon${classes ? ` ${classes}` : ""}`}
112
- ></slot>`;
113
- }
114
- function IconSlots(names) {
115
- return names.map((name) => IconSlot(name));
116
- }
117
-
118
- function $i18n(translations, word) {
119
- return $signal(() => i18n(translations, word));
120
- }
121
-
122
- function DefaultAirPlayButton({ tooltip }) {
123
- const { translations } = useDefaultLayoutContext(), { remotePlaybackState } = useMediaState(), $label = $signal(() => {
124
- const airPlayText = i18n(translations, "AirPlay"), stateText = uppercaseFirstChar(remotePlaybackState());
125
- return `${airPlayText} ${stateText}`;
126
- }), $airPlayText = $i18n(translations, "AirPlay");
127
- return html`
128
- <media-tooltip class="vds-airplay-tooltip vds-tooltip">
129
- <media-tooltip-trigger>
130
- <media-airplay-button class="vds-airplay-button vds-button" aria-label=${$label}>
131
- ${IconSlot("airplay")}
132
- </media-airplay-button>
133
- </media-tooltip-trigger>
134
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
135
- <span class="vds-airplay-tooltip-text">${$airPlayText}</span>
136
- </media-tooltip-content>
137
- </media-tooltip>
138
- `;
139
- }
140
- function DefaultPlayButton({ tooltip }) {
141
- const { translations } = useDefaultLayoutContext(), $playText = $i18n(translations, "Play"), $pauseText = $i18n(translations, "Pause");
142
- return html`
143
- <media-tooltip class="vds-play-tooltip vds-tooltip">
144
- <media-tooltip-trigger>
145
- <media-play-button
146
- class="vds-play-button vds-button"
147
- aria-label=${$i18n(translations, "Play")}
148
- >
149
- ${IconSlots(["play", "pause", "replay"])}
150
- </media-play-button>
151
- </media-tooltip-trigger>
152
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
153
- <span class="vds-play-tooltip-text">${$playText}</span>
154
- <span class="vds-pause-tooltip-text">${$pauseText}</span>
155
- </media-tooltip-content>
156
- </media-tooltip>
157
- `;
158
- }
159
- function DefaultMuteButton({
160
- tooltip,
161
- ref: ref$1 = noop
162
- }) {
163
- const { translations } = useDefaultLayoutContext(), $muteText = $i18n(translations, "Mute"), $unmuteText = $i18n(translations, "Unmute");
164
- return html`
165
- <media-tooltip class="vds-mute-tooltip vds-tooltip">
166
- <media-tooltip-trigger>
167
- <media-mute-button
168
- class="vds-mute-button vds-button"
169
- aria-label=${$i18n(translations, "Mute")}
170
- ${ref(ref$1)}
171
- >
172
- ${IconSlots(["mute", "volume-low", "volume-high"])}
173
- </media-mute-button>
174
- </media-tooltip-trigger>
175
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
176
- <span class="vds-mute-tooltip-text">${$unmuteText}</span>
177
- <span class="vds-unmute-tooltip-text">${$muteText}</span>
178
- </media-tooltip-content>
179
- </media-tooltip>
180
- `;
181
- }
182
- function DefaultCaptionButton({ tooltip }) {
183
- const { translations } = useDefaultLayoutContext(), $ccOnText = $i18n(translations, "Closed-Captions On"), $ccOffText = $i18n(translations, "Closed-Captions Off");
184
- return html`
185
- <media-tooltip class="vds-caption-tooltip vds-tooltip">
186
- <media-tooltip-trigger>
187
- <media-caption-button
188
- class="vds-caption-button vds-button"
189
- aria-label=${$i18n(translations, "Captions")}
190
- >
191
- ${IconSlots(["cc-on", "cc-off"])}
192
- </media-caption-button>
193
- </media-tooltip-trigger>
194
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
195
- <span class="vds-cc-on-tooltip-text">${$ccOffText}</span>
196
- <span class="vds-cc-off-tooltip-text">${$ccOnText}</span>
197
- </media-tooltip-content>
198
- </media-tooltip>
199
- `;
200
- }
201
- function DefaultPIPButton() {
202
- const { translations } = useDefaultLayoutContext(), $enterText = $i18n(translations, "Enter PiP"), $exitText = $i18n(translations, "Exit PiP");
203
- return html`
204
- <media-tooltip class="vds-pip-tooltip vds-tooltip">
205
- <media-tooltip-trigger>
206
- <media-pip-button
207
- class="vds-pip-button vds-button"
208
- aria-label=${$i18n(translations, "PiP")}
209
- >
210
- ${IconSlots(["pip-enter", "pip-exit"])}
211
- </media-pip-button>
212
- </media-tooltip-trigger>
213
- <media-tooltip-content class="vds-tooltip-content">
214
- <span class="vds-pip-enter-tooltip-text">${$enterText}</span>
215
- <span class="vds-pip-exit-tooltip-text">${$exitText}</span>
216
- </media-tooltip-content>
217
- </media-tooltip>
218
- `;
219
- }
220
- function DefaultFullscreenButton({ tooltip }) {
221
- const { translations } = useDefaultLayoutContext(), $enterText = $i18n(translations, "Enter Fullscreen"), $exitText = $i18n(translations, "Exit Fullscreen");
222
- return html`
223
- <media-tooltip class="vds-fullscreen-tooltip vds-tooltip">
224
- <media-tooltip-trigger>
225
- <media-fullscreen-button
226
- class="vds-fullscreen-button vds-button"
227
- aria-label=${$i18n(translations, "Fullscreen")}
228
- >
229
- ${IconSlots(["fs-enter", "fs-exit"])}
230
- </media-fullscreen-button>
231
- </media-tooltip-trigger>
232
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
233
- <span class="vds-fs-enter-tooltip-text">${$enterText}</span>
234
- <span class="vds-fs-exit-tooltip-text">${$exitText}</span>
235
- </media-tooltip-content>
236
- </media-tooltip>
237
- `;
238
- }
239
- function DefaultSeekButton({
240
- backward,
241
- tooltip
242
- }) {
243
- const { translations, seekStep } = useDefaultLayoutContext(), seekText = !backward ? "Seek Forward" : "Seek Backward", $label = $i18n(translations, seekText), $seconds = () => (backward ? -1 : 1) * seekStep();
244
- return html`
245
- <media-tooltip class="vds-seek-tooltip vds-tooltip">
246
- <media-tooltip-trigger>
247
- <media-seek-button
248
- class="vds-seek-button vds-button"
249
- seconds=${$signal($seconds)}
250
- aria-label=${$label}
251
- >
252
- ${!backward ? IconSlot("seek-forward") : IconSlot("seek-backward")}
253
- </media-seek-button>
254
- </media-tooltip-trigger>
255
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
256
- ${$i18n(translations, seekText)}
257
- </media-tooltip-content>
258
- </media-tooltip>
259
- `;
260
- }
261
- function DefaultLiveButton() {
262
- const { translations } = useDefaultLayoutContext(), { live } = useMediaState(), $label = $i18n(translations, "Skip To Live"), $liveText = $i18n(translations, "LIVE");
263
- return live() ? html`
264
- <media-live-button class="vds-live-button" aria-label=${$label}>
265
- <span class="vds-live-button-text">${$liveText}</span>
266
- </media-live-button>
267
- ` : null;
268
- }
269
- function DefaultDownloadButton() {
270
- return $signal(() => {
271
- const { download, translations } = useDefaultLayoutContext(), $download = download();
272
- if (isNil($download)) return null;
273
- const { source, title } = useMediaState(), $src = source(), file = getDownloadFile({
274
- title: title(),
275
- src: $src,
276
- download: $download
277
- });
278
- return isString(file?.url) ? html`
279
- <media-tooltip class="vds-download-tooltip vds-tooltip">
280
- <media-tooltip-trigger>
281
- <a
282
- role="button"
283
- class="vds-download-button vds-button"
284
- aria-label=${$i18n(translations, "Download")}
285
- href=${appendParamsToURL(file.url, { download: file.name })}
286
- download=${file.name}
287
- target="_blank"
288
- >
289
- <slot name="download-icon" data-class="vds-icon" />
290
- </a>
291
- </media-tooltip-trigger>
292
- <media-tooltip-content class="vds-tooltip-content" placement="top">
293
- ${$i18n(translations, "Download")}
294
- </media-tooltip-content>
295
- </media-tooltip>
296
- ` : null;
297
- });
298
- }
299
- function DefaultEpisodeButton({ tooltip } = {}) {
300
- const $label = "Episodes", $episodesText = "Episodes";
301
- function openEpisodes(e) {
302
- e.stopPropagation();
303
- e.currentTarget?.dispatchEvent(
304
- new CustomEvent("vds-episodes-open", { bubbles: true, composed: true })
305
- );
306
- }
307
- const content = html`
308
- <button
309
- type="button"
310
- class="vds-episode-button vds-button"
311
- aria-label=${$label}
312
- @pointerup=${openEpisodes}
313
- >
314
- ${IconSlot("menu-episodes")}
315
- </button>
316
- `;
317
- if (!tooltip) return content;
318
- return html`
319
- <media-tooltip class="vds-episode-tooltip vds-tooltip">
320
- <media-tooltip-trigger> ${content} </media-tooltip-trigger>
321
- <media-tooltip-content class="vds-tooltip-content" placement=${tooltip}>
322
- <span class="vds-episode-tooltip-text">${$episodesText}</span>
323
- </media-tooltip-content>
324
- </media-tooltip>
325
- `;
326
- }
327
-
328
- function DefaultCaptions() {
329
- const { translations } = useDefaultLayoutContext();
330
- return html`
331
- <media-captions
332
- class="vds-captions"
333
- .exampleText=${$i18n(translations, "Captions look like this")}
334
- ></media-captions>
335
- `;
336
- }
337
-
338
- function DefaultControlsSpacer() {
339
- return html`<div class="vds-controls-spacer"></div>`;
340
- }
341
-
342
- function MenuPortal(container, template) {
343
- return html`
344
- <media-menu-portal .container=${$signal(container)} disabled="fullscreen">
345
- ${template}
346
- </media-menu-portal>
347
- `;
348
- }
349
- function createMenuContainer(layoutEl, rootSelector, className, isSmallLayout) {
350
- let root = isString(rootSelector) ? document.querySelector(rootSelector) : rootSelector;
351
- if (!root) root = layoutEl?.closest("dialog");
352
- if (!root) root = document.body;
353
- const container = document.createElement("div");
354
- container.style.display = "contents";
355
- container.classList.add(className);
356
- root.append(container);
357
- effect(() => {
358
- if (!container) return;
359
- const { viewType } = useMediaState(), isSmall = isSmallLayout();
360
- setAttribute(container, "data-view-type", viewType());
361
- setAttribute(container, "data-sm", isSmall);
362
- setAttribute(container, "data-lg", !isSmall);
363
- setAttribute(container, "data-size", isSmall ? "sm" : "lg");
364
- });
365
- const { colorScheme } = useDefaultLayoutContext();
366
- watchColorScheme(container, colorScheme);
367
- return container;
368
- }
369
-
370
- function DefaultChaptersMenu({
371
- placement,
372
- tooltip,
373
- portal
374
- }) {
375
- const { textTracks } = useMediaContext(), { viewType, seekableStart, seekableEnd } = useMediaState(), {
376
- translations,
377
- thumbnails,
378
- menuPortal,
379
- noModal,
380
- menuGroup,
381
- smallWhen: smWhen
382
- } = useDefaultLayoutContext(), $disabled = computed(() => {
383
- const $startTime = seekableStart(), $endTime = seekableEnd(), $track = signal(null);
384
- watchActiveTextTrack(textTracks, "chapters", $track.set);
385
- const cues = $track()?.cues.filter(
386
- (cue) => cue.startTime <= $endTime && cue.endTime >= $startTime
387
- );
388
- return !cues?.length;
389
- });
390
- if ($disabled()) return null;
391
- const $placement = computed(
392
- () => noModal() ? unwrap(placement) : !smWhen() ? unwrap(placement) : null
393
- ), $offset = computed(
394
- () => !smWhen() && menuGroup() === "bottom" && viewType() === "video" ? 26 : 0
395
- ), $isOpen = signal(false);
396
- function onOpen() {
397
- $isOpen.set(true);
398
- }
399
- function onClose() {
400
- $isOpen.set(false);
401
- }
402
- const items = html`
403
- <media-menu-items
404
- class="vds-chapters-menu-items vds-menu-items"
405
- placement=${$signal($placement)}
406
- offset=${$signal($offset)}
407
- >
408
- ${$signal(() => {
409
- if (!$isOpen()) return null;
410
- return html`
411
- <media-chapters-radio-group
412
- class="vds-chapters-radio-group vds-radio-group"
413
- .thumbnails=${$signal(thumbnails)}
414
- >
415
- <template>
416
- <media-radio class="vds-chapter-radio vds-radio">
417
- <media-thumbnail class="vds-thumbnail"></media-thumbnail>
418
- <div class="vds-chapter-radio-content">
419
- <span class="vds-chapter-radio-label" data-part="label"></span>
420
- <span class="vds-chapter-radio-start-time" data-part="start-time"></span>
421
- <span class="vds-chapter-radio-duration" data-part="duration"></span>
422
- </div>
423
- </media-radio>
424
- </template>
425
- </media-chapters-radio-group>
426
- `;
427
- })}
428
- </media-menu-items>
429
- `;
430
- return html`
431
- <media-menu class="vds-chapters-menu vds-menu" @open=${onOpen} @close=${onClose}>
432
- <media-tooltip class="vds-tooltip">
433
- <media-tooltip-trigger>
434
- <media-menu-button
435
- class="vds-menu-button vds-button"
436
- aria-label=${$i18n(translations, "Chapters")}
437
- >
438
- ${IconSlot("menu-chapters")}
439
- </media-menu-button>
440
- </media-tooltip-trigger>
441
- <media-tooltip-content
442
- class="vds-tooltip-content"
443
- placement=${isFunction(tooltip) ? $signal(tooltip) : tooltip}
444
- >
445
- ${$i18n(translations, "Chapters")}
446
- </media-tooltip-content>
447
- </media-tooltip>
448
- ${MenuPortal(menuPortal, items) }
449
- </media-menu>
450
- `;
451
- }
452
-
453
- function hexToRgb(hex) {
454
- const { style } = new Option();
455
- style.color = hex;
456
- return style.color.match(/\((.*?)\)/)[1].replace(/,/g, " ");
457
- }
458
-
459
- const FONT_COLOR_OPTION = {
460
- type: "color"
461
- };
462
- const FONT_FAMILY_OPTION = {
463
- type: "radio",
464
- values: {
465
- "Monospaced Serif": "mono-serif",
466
- "Proportional Serif": "pro-serif",
467
- "Monospaced Sans-Serif": "mono-sans",
468
- "Proportional Sans-Serif": "pro-sans",
469
- Casual: "casual",
470
- Cursive: "cursive",
471
- "Small Capitals": "capitals"
472
- }
473
- };
474
- const FONT_SIZE_OPTION = {
475
- type: "slider",
476
- min: 0,
477
- max: 400,
478
- step: 25,
479
- upIcon: null,
480
- downIcon: null
481
- };
482
- const FONT_OPACITY_OPTION = {
483
- type: "slider",
484
- min: 0,
485
- max: 100,
486
- step: 5,
487
- upIcon: null,
488
- downIcon: null
489
- };
490
- const FONT_TEXT_SHADOW_OPTION = {
491
- type: "radio",
492
- values: ["None", "Drop Shadow", "Raised", "Depressed", "Outline"]
493
- };
494
- const FONT_DEFAULTS = {
495
- fontFamily: "pro-sans",
496
- fontSize: "100%",
497
- textColor: "#ffffff",
498
- textOpacity: "100%",
499
- textShadow: "none",
500
- textBg: "#000000",
501
- textBgOpacity: "100%",
502
- displayBg: "#000000",
503
- displayBgOpacity: "0%"
504
- };
505
- const FONT_SIGNALS = Object.keys(FONT_DEFAULTS).reduce(
506
- (prev, type) => ({
507
- ...prev,
508
- [type]: signal(FONT_DEFAULTS[type])
509
- }),
510
- {}
511
- );
512
- {
513
- for (const type of Object.keys(FONT_SIGNALS)) {
514
- const value = localStorage.getItem(`vds-player:${camelToKebabCase(type)}`);
515
- if (isString(value)) FONT_SIGNALS[type].set(value);
516
- }
517
- }
518
- function onFontReset() {
519
- for (const type of Object.keys(FONT_SIGNALS)) {
520
- const defaultValue = FONT_DEFAULTS[type];
521
- FONT_SIGNALS[type].set(defaultValue);
522
- }
523
- }
524
-
525
- let isWatchingVars = false, players = /* @__PURE__ */ new Set();
526
- function updateFontCssVars() {
527
- const { player } = useMediaContext();
528
- players.add(player);
529
- onDispose(() => players.delete(player));
530
- if (!isWatchingVars) {
531
- scoped(() => {
532
- for (const type of keysOf(FONT_SIGNALS)) {
533
- const $value = FONT_SIGNALS[type], defaultValue = FONT_DEFAULTS[type], varName = `--media-user-${camelToKebabCase(type)}`, storageKey = `vds-player:${camelToKebabCase(type)}`;
534
- effect(() => {
535
- const value = $value(), isDefaultVarValue = value === defaultValue, varValue = !isDefaultVarValue ? getCssVarValue(player, type, value) : null;
536
- for (const player2 of players) {
537
- player2.el?.style.setProperty(varName, varValue);
538
- }
539
- if (isDefaultVarValue) {
540
- localStorage.removeItem(storageKey);
541
- } else {
542
- localStorage.setItem(storageKey, value);
543
- }
544
- });
545
- }
546
- }, null);
547
- isWatchingVars = true;
548
- }
549
- }
550
- function getCssVarValue(player, type, value) {
551
- switch (type) {
552
- case "fontFamily":
553
- const fontVariant = value === "capitals" ? "small-caps" : "";
554
- player.el?.style.setProperty("--media-user-font-variant", fontVariant);
555
- return getFontFamilyCSSVarValue(value);
556
- case "fontSize":
557
- case "textOpacity":
558
- case "textBgOpacity":
559
- case "displayBgOpacity":
560
- return percentToRatio(value);
561
- case "textColor":
562
- return `rgb(${hexToRgb(value)} / var(--media-user-text-opacity, 1))`;
563
- case "textShadow":
564
- return getTextShadowCssVarValue(value);
565
- case "textBg":
566
- return `rgb(${hexToRgb(value)} / var(--media-user-text-bg-opacity, 1))`;
567
- case "displayBg":
568
- return `rgb(${hexToRgb(value)} / var(--media-user-display-bg-opacity, 1))`;
569
- }
570
- }
571
- function percentToRatio(value) {
572
- return (parseInt(value) / 100).toString();
573
- }
574
- function getFontFamilyCSSVarValue(value) {
575
- switch (value) {
576
- case "mono-serif":
577
- return '"Courier New", Courier, "Nimbus Mono L", "Cutive Mono", monospace';
578
- case "mono-sans":
579
- return '"Deja Vu Sans Mono", "Lucida Console", Monaco, Consolas, "PT Mono", monospace';
580
- case "pro-sans":
581
- return 'Roboto, "Arial Unicode Ms", Arial, Helvetica, Verdana, "PT Sans Caption", sans-serif';
582
- case "casual":
583
- return '"Comic Sans MS", Impact, Handlee, fantasy';
584
- case "cursive":
585
- return '"Monotype Corsiva", "URW Chancery L", "Apple Chancery", "Dancing Script", cursive';
586
- case "capitals":
587
- return '"Arial Unicode Ms", Arial, Helvetica, Verdana, "Marcellus SC", sans-serif + font-variant=small-caps';
588
- default:
589
- return '"Times New Roman", Times, Georgia, Cambria, "PT Serif Caption", serif';
590
- }
591
- }
592
- function getTextShadowCssVarValue(value) {
593
- switch (value) {
594
- case "drop shadow":
595
- return "rgb(34, 34, 34) 1.86389px 1.86389px 2.79583px, rgb(34, 34, 34) 1.86389px 1.86389px 3.72778px, rgb(34, 34, 34) 1.86389px 1.86389px 4.65972px";
596
- case "raised":
597
- return "rgb(34, 34, 34) 1px 1px, rgb(34, 34, 34) 2px 2px";
598
- case "depressed":
599
- return "rgb(204, 204, 204) 1px 1px, rgb(34, 34, 34) -1px -1px";
600
- case "outline":
601
- return "rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px";
602
- default:
603
- return "";
604
- }
605
- }
606
-
607
- let sectionId = 0;
608
- function DefaultMenuSection({ label = "", value = "", children }) {
609
- if (!label) {
610
- return html`
611
- <div class="vds-menu-section">
612
- <div class="vds-menu-section-body">${children}</div>
613
- </div>
614
- `;
615
- }
616
- const id = `vds-menu-section-${++sectionId}`;
617
- return html`
618
- <section class="vds-menu-section" role="group" aria-labelledby=${id}>
619
- <div class="vds-menu-section-title">
620
- <header id=${id}>${label}</header>
621
- ${value ? html`<div class="vds-menu-section-value">${value}</div>` : null}
622
- </div>
623
- <div class="vds-menu-section-body">${children}</div>
624
- </section>
625
- `;
626
- }
627
- function DefaultMenuItem({ label, children }) {
628
- return html`
629
- <div class="vds-menu-item">
630
- <div class="vds-menu-item-label">${label}</div>
631
- ${children}
632
- </div>
633
- `;
634
- }
635
- function DefaultMenuButton({
636
- label,
637
- icon,
638
- hint
639
- }) {
640
- return html`
641
- <media-menu-button class="vds-menu-item">
642
- ${IconSlot("menu-arrow-left", "vds-menu-close-icon")}
643
- ${icon ? IconSlot(icon, "vds-menu-item-icon") : null}
644
- <span class="vds-menu-item-label">${$signal(label)}</span>
645
- <span class="vds-menu-item-hint" data-part="hint">${hint ? $signal(hint) : null} </span>
646
- ${IconSlot("menu-arrow-right", "vds-menu-open-icon")}
647
- </media-menu-button>
648
- `;
649
- }
650
- function DefaultRadioGroup({
651
- value = null,
652
- options,
653
- hideLabel = false,
654
- children = null,
655
- onChange = null
656
- }) {
657
- function renderRadio(option) {
658
- const { value: value2, label: content } = option;
659
- return html`
660
- <media-radio class="vds-radio" value=${value2}>
661
- ${IconSlot("menu-radio-check")}
662
- ${!hideLabel ? html`
663
- <span class="vds-radio-label" data-part="label">
664
- ${isString(content) ? content : $signal(content)}
665
- </span>
666
- ` : null}
667
- ${isFunction(children) ? children(option) : children}
668
- </media-radio>
669
- `;
670
- }
671
- return html`
672
- <media-radio-group
673
- class="vds-radio-group"
674
- value=${isString(value) ? value : value ? $signal(value) : ""}
675
- @change=${onChange}
676
- >
677
- ${isArray(options) ? options.map(renderRadio) : $signal(() => options().map(renderRadio))}
678
- </media-radio-group>
679
- `;
680
- }
681
- function createRadioOptions(entries) {
682
- return isArray(entries) ? entries.map((entry) => ({ label: entry, value: entry.toLowerCase() })) : Object.keys(entries).map((label) => ({ label, value: entries[label] }));
683
- }
684
-
685
- function DefaultSliderParts() {
686
- return html`
687
- <div class="vds-slider-track"></div>
688
- <div class="vds-slider-track-fill vds-slider-track"></div>
689
- <div class="vds-slider-thumb"></div>
690
- `;
691
- }
692
- function DefaultSliderSteps() {
693
- return html`
694
- <media-slider-steps class="vds-slider-steps">
695
- <template>
696
- <div class="vds-slider-step"></div>
697
- </template>
698
- </media-slider-steps>
699
- `;
700
- }
701
- function DefaultMenuSliderItem({
702
- label = null,
703
- value = null,
704
- upIcon = "",
705
- downIcon = "",
706
- children,
707
- isMin,
708
- isMax
709
- }) {
710
- const hasTitle = label || value, content = [
711
- downIcon ? IconSlot(downIcon, "down") : null,
712
- children,
713
- upIcon ? IconSlot(upIcon, "up") : null
714
- ];
715
- return html`
716
- <div
717
- class=${`vds-menu-item vds-menu-slider-item${hasTitle ? " group" : ""}`}
718
- data-min=${$signal(() => isMin() ? "" : null)}
719
- data-max=${$signal(() => isMax() ? "" : null)}
720
- >
721
- ${hasTitle ? html`
722
- <div class="vds-menu-slider-title">
723
- ${[
724
- label ? html`<div>${label}</div>` : null,
725
- value ? html`<div>${value}</div>` : null
726
- ]}
727
- </div>
728
- <div class="vds-menu-slider-body">${content}</div>
729
- ` : content}
730
- </div>
731
- `;
732
- }
733
-
734
- const FONT_SIZE_OPTION_WITH_ICONS = {
735
- ...FONT_SIZE_OPTION,
736
- upIcon: "menu-opacity-up",
737
- downIcon: "menu-opacity-down"
738
- };
739
- const FONT_OPACITY_OPTION_WITH_ICONS = {
740
- ...FONT_OPACITY_OPTION,
741
- upIcon: "menu-opacity-up",
742
- downIcon: "menu-opacity-down"
743
- };
744
- function DefaultFontMenu() {
745
- return $signal(() => {
746
- const { hasCaptions } = useMediaState(), { translations } = useDefaultLayoutContext();
747
- if (!hasCaptions()) return null;
748
- return html`
749
- <media-menu class="vds-font-menu vds-menu">
750
- ${DefaultMenuButton({
751
- label: () => i18n(translations, "Caption Styles")
752
- })}
753
- <media-menu-items class="vds-menu-items">
754
- ${[
755
- DefaultMenuSection({
756
- label: $i18n(translations, "Font"),
757
- children: [DefaultFontFamilyMenu(), DefaultFontSizeSlider()]
758
- }),
759
- DefaultMenuSection({
760
- label: $i18n(translations, "Text"),
761
- children: [
762
- DefaultTextColorInput(),
763
- DefaultTextShadowMenu(),
764
- DefaultTextOpacitySlider()
765
- ]
766
- }),
767
- DefaultMenuSection({
768
- label: $i18n(translations, "Text Background"),
769
- children: [DefaultTextBgInput(), DefaultTextBgOpacitySlider()]
770
- }),
771
- DefaultMenuSection({
772
- label: $i18n(translations, "Display Background"),
773
- children: [DefaultDisplayBgInput(), DefaultDisplayOpacitySlider()]
774
- }),
775
- DefaultMenuSection({
776
- children: [DefaultResetMenuItem()]
777
- })
778
- ]}
779
- </media-menu-items>
780
- </media-menu>
781
- `;
782
- });
783
- }
784
- function DefaultFontFamilyMenu() {
785
- return DefaultFontSetting({
786
- label: "Family",
787
- option: FONT_FAMILY_OPTION,
788
- type: "fontFamily"
789
- });
790
- }
791
- function DefaultFontSizeSlider() {
792
- return DefaultFontSetting({
793
- label: "Size",
794
- option: FONT_SIZE_OPTION_WITH_ICONS,
795
- type: "fontSize"
796
- });
797
- }
798
- function DefaultTextColorInput() {
799
- return DefaultFontSetting({
800
- label: "Color",
801
- option: FONT_COLOR_OPTION,
802
- type: "textColor"
803
- });
804
- }
805
- function DefaultTextOpacitySlider() {
806
- return DefaultFontSetting({
807
- label: "Opacity",
808
- option: FONT_OPACITY_OPTION_WITH_ICONS,
809
- type: "textOpacity"
810
- });
811
- }
812
- function DefaultTextShadowMenu() {
813
- return DefaultFontSetting({
814
- label: "Shadow",
815
- option: FONT_TEXT_SHADOW_OPTION,
816
- type: "textShadow"
817
- });
818
- }
819
- function DefaultTextBgInput() {
820
- return DefaultFontSetting({
821
- label: "Color",
822
- option: FONT_COLOR_OPTION,
823
- type: "textBg"
824
- });
825
- }
826
- function DefaultTextBgOpacitySlider() {
827
- return DefaultFontSetting({
828
- label: "Opacity",
829
- option: FONT_OPACITY_OPTION_WITH_ICONS,
830
- type: "textBgOpacity"
831
- });
832
- }
833
- function DefaultDisplayBgInput() {
834
- return DefaultFontSetting({
835
- label: "Color",
836
- option: FONT_COLOR_OPTION,
837
- type: "displayBg"
838
- });
839
- }
840
- function DefaultDisplayOpacitySlider() {
841
- return DefaultFontSetting({
842
- label: "Opacity",
843
- option: FONT_OPACITY_OPTION_WITH_ICONS,
844
- type: "displayBgOpacity"
845
- });
846
- }
847
- function DefaultResetMenuItem() {
848
- const { translations } = useDefaultLayoutContext(), $label = () => i18n(translations, "Reset");
849
- return html`
850
- <button class="vds-menu-item" role="menuitem" @click=${onFontReset}>
851
- <span class="vds-menu-item-label">${$signal($label)}</span>
852
- </button>
853
- `;
854
- }
855
- function DefaultFontSetting({ label, option, type }) {
856
- const { player } = useMediaContext(), { translations } = useDefaultLayoutContext(), $currentValue = FONT_SIGNALS[type], $label = () => i18n(translations, label);
857
- function notify() {
858
- tick();
859
- player.dispatchEvent(new Event("vds-font-change"));
860
- }
861
- if (option.type === "color") {
862
- let onColorChange2 = function(event) {
863
- $currentValue.set(event.target.value);
864
- notify();
865
- };
866
- return DefaultMenuItem({
867
- label: $signal($label),
868
- children: html`
869
- <input
870
- class="vds-color-picker"
871
- type="color"
872
- .value=${$signal($currentValue)}
873
- @input=${onColorChange2}
874
- />
875
- `
876
- });
877
- }
878
- if (option.type === "slider") {
879
- let onSliderValueChange2 = function(event) {
880
- $currentValue.set(event.detail + "%");
881
- notify();
882
- };
883
- const { min, max, step, upIcon, downIcon } = option;
884
- return DefaultMenuSliderItem({
885
- label: $signal($label),
886
- value: $signal($currentValue),
887
- upIcon,
888
- downIcon,
889
- isMin: () => $currentValue() === min + "%",
890
- isMax: () => $currentValue() === max + "%",
891
- children: html`
892
- <media-slider
893
- class="vds-slider"
894
- min=${min}
895
- max=${max}
896
- step=${step}
897
- key-step=${step}
898
- .value=${$signal(() => parseInt($currentValue()))}
899
- aria-label=${$signal($label)}
900
- @value-change=${onSliderValueChange2}
901
- @drag-value-change=${onSliderValueChange2}
902
- >
903
- ${DefaultSliderParts()}${DefaultSliderSteps()}
904
- </media-slider>
905
- `
906
- });
907
- }
908
- const radioOptions = createRadioOptions(option.values), $hint = () => {
909
- const value = $currentValue(), label2 = radioOptions.find((radio) => radio.value === value)?.label || "";
910
- return i18n(translations, isString(label2) ? label2 : label2());
911
- };
912
- return html`
913
- <media-menu class=${`vds-${camelToKebabCase(type)}-menu vds-menu`}>
914
- ${DefaultMenuButton({ label: $label, hint: $hint })}
915
- <media-menu-items class="vds-menu-items">
916
- ${DefaultRadioGroup({
917
- value: $currentValue,
918
- options: radioOptions,
919
- onChange({ detail: value }) {
920
- $currentValue.set(value);
921
- notify();
922
- }
923
- })}
924
- </media-menu-items>
925
- </media-menu>
926
- `;
927
- }
928
-
929
- function DefaultMenuCheckbox({
930
- label,
931
- checked,
932
- defaultChecked = false,
933
- storageKey,
934
- onChange
935
- }) {
936
- const { translations } = useDefaultLayoutContext(), savedValue = storageKey ? localStorage.getItem(storageKey) : null, $checked = signal(!!(savedValue ?? defaultChecked)), $active = signal(false), $ariaChecked = $signal($ariaBool($checked)), $label = $i18n(translations, label);
937
- if (storageKey) onChange(peek($checked));
938
- if (checked) {
939
- effect(() => void $checked.set(checked()));
940
- }
941
- function onPress(event) {
942
- if (event?.button === 1) return;
943
- $checked.set((checked2) => !checked2);
944
- if (storageKey) localStorage.setItem(storageKey, $checked() ? "1" : "");
945
- onChange($checked(), event);
946
- $active.set(false);
947
- }
948
- function onKeyDown(event) {
949
- if (isKeyboardClick(event)) onPress();
950
- }
951
- function onActive(event) {
952
- if (event.button !== 0) return;
953
- $active.set(true);
954
- }
955
- return html`
956
- <div
957
- class="vds-menu-checkbox"
958
- role="menuitemcheckbox"
959
- tabindex="0"
960
- aria-label=${$label}
961
- aria-checked=${$ariaChecked}
962
- data-active=${$signal(() => $active() ? "" : null)}
963
- @pointerup=${onPress}
964
- @pointerdown=${onActive}
965
- @keydown=${onKeyDown}
966
- ></div>
967
- `;
968
- }
969
-
970
- function DefaultAccessibilityMenu() {
971
- return $signal(() => {
972
- const { translations } = useDefaultLayoutContext();
973
- return html`
974
- <media-menu class="vds-accessibility-menu vds-menu">
975
- ${DefaultMenuButton({
976
- label: () => i18n(translations, "Accessibility"),
977
- icon: "menu-accessibility"
978
- })}
979
- <media-menu-items class="vds-menu-items">
980
- ${[
981
- DefaultMenuSection({
982
- children: [
983
- DefaultAnnouncementsMenuCheckbox(),
984
- DefaultKeyboardAnimationsMenuCheckbox()
985
- ]
986
- }),
987
- DefaultMenuSection({
988
- children: [DefaultFontMenu()]
989
- })
990
- ]}
991
- </media-menu-items>
992
- </media-menu>
993
- `;
994
- });
995
- }
996
- function DefaultAnnouncementsMenuCheckbox() {
997
- const { userPrefersAnnouncements, translations } = useDefaultLayoutContext(), label = "Announcements";
998
- return DefaultMenuItem({
999
- label: $i18n(translations, label),
1000
- children: DefaultMenuCheckbox({
1001
- label,
1002
- storageKey: "vds-player::announcements",
1003
- onChange(checked) {
1004
- userPrefersAnnouncements.set(checked);
1005
- }
1006
- })
1007
- });
1008
- }
1009
- function DefaultKeyboardAnimationsMenuCheckbox() {
1010
- return $signal(() => {
1011
- const { translations, userPrefersKeyboardAnimations, noKeyboardAnimations } = useDefaultLayoutContext(), { viewType } = useMediaState(), $disabled = computed(() => viewType() !== "video" || noKeyboardAnimations());
1012
- if ($disabled()) return null;
1013
- const label = "Keyboard Animations";
1014
- return DefaultMenuItem({
1015
- label: $i18n(translations, label),
1016
- children: DefaultMenuCheckbox({
1017
- label,
1018
- defaultChecked: true,
1019
- storageKey: "vds-player::keyboard-animations",
1020
- onChange(checked) {
1021
- userPrefersKeyboardAnimations.set(checked);
1022
- }
1023
- })
1024
- });
1025
- });
1026
- }
1027
-
1028
- function DefaultAudioMenu() {
1029
- return $signal(() => {
1030
- const { noAudioGain, translations } = useDefaultLayoutContext(), { audioTracks, canSetAudioGain } = useMediaState(), $disabled = computed(() => {
1031
- const hasGainSlider = canSetAudioGain() && !noAudioGain();
1032
- return !hasGainSlider && audioTracks().length <= 1;
1033
- });
1034
- if ($disabled()) return null;
1035
- return html`
1036
- <media-menu class="vds-audio-menu vds-menu">
1037
- ${DefaultMenuButton({
1038
- label: () => i18n(translations, "Audio"),
1039
- icon: "menu-audio"
1040
- })}
1041
- <media-menu-items class="vds-menu-items">
1042
- ${[DefaultAudioTracksMenu(), DefaultAudioBoostSection()]}
1043
- </media-menu-items>
1044
- </media-menu>
1045
- `;
1046
- });
1047
- }
1048
- function DefaultAudioTracksMenu() {
1049
- return $signal(() => {
1050
- const { translations } = useDefaultLayoutContext(), { audioTracks } = useMediaState(), $defaultText = $i18n(translations, "Default"), $disabled = computed(() => audioTracks().length <= 1);
1051
- if ($disabled()) return null;
1052
- return DefaultMenuSection({
1053
- children: html`
1054
- <media-menu class="vds-audio-tracks-menu vds-menu">
1055
- ${DefaultMenuButton({
1056
- label: () => i18n(translations, "Track")
1057
- })}
1058
- <media-menu-items class="vds-menu-items">
1059
- <media-audio-radio-group
1060
- class="vds-audio-track-radio-group vds-radio-group"
1061
- empty-label=${$defaultText}
1062
- >
1063
- <template>
1064
- <media-radio class="vds-audio-track-radio vds-radio">
1065
- <slot name="menu-radio-check-icon" data-class="vds-icon"></slot>
1066
- <span class="vds-radio-label" data-part="label"></span>
1067
- </media-radio>
1068
- </template>
1069
- </media-audio-radio-group>
1070
- </media-menu-items>
1071
- </media-menu>
1072
- `
1073
- });
1074
- });
1075
- }
1076
- function DefaultAudioBoostSection() {
1077
- return $signal(() => {
1078
- const { noAudioGain, translations } = useDefaultLayoutContext(), { canSetAudioGain } = useMediaState(), $disabled = computed(() => !canSetAudioGain() || noAudioGain());
1079
- if ($disabled()) return null;
1080
- const { audioGain } = useMediaState();
1081
- return DefaultMenuSection({
1082
- label: $i18n(translations, "Boost"),
1083
- value: $signal(() => Math.round(((audioGain() ?? 1) - 1) * 100) + "%"),
1084
- children: [
1085
- DefaultMenuSliderItem({
1086
- upIcon: "menu-audio-boost-up",
1087
- downIcon: "menu-audio-boost-down",
1088
- children: DefaultAudioGainSlider(),
1089
- isMin: () => ((audioGain() ?? 1) - 1) * 100 <= getGainMin(),
1090
- isMax: () => ((audioGain() ?? 1) - 1) * 100 === getGainMax()
1091
- })
1092
- ]
1093
- });
1094
- });
1095
- }
1096
- function DefaultAudioGainSlider() {
1097
- const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Boost"), $min = getGainMin, $max = getGainMax, $step = getGainStep;
1098
- return html`
1099
- <media-audio-gain-slider
1100
- class="vds-audio-gain-slider vds-slider"
1101
- aria-label=${$label}
1102
- min=${$signal($min)}
1103
- max=${$signal($max)}
1104
- step=${$signal($step)}
1105
- key-step=${$signal($step)}
1106
- >
1107
- ${DefaultSliderParts()}${DefaultSliderSteps()}
1108
- </media-audio-gain-slider>
1109
- `;
1110
- }
1111
- function getGainMin() {
1112
- const { audioGains } = useDefaultLayoutContext(), gains = audioGains();
1113
- return isArray(gains) ? gains[0] ?? 0 : gains.min;
1114
- }
1115
- function getGainMax() {
1116
- const { audioGains } = useDefaultLayoutContext(), gains = audioGains();
1117
- return isArray(gains) ? gains[gains.length - 1] ?? 300 : gains.max;
1118
- }
1119
- function getGainStep() {
1120
- const { audioGains } = useDefaultLayoutContext(), gains = audioGains();
1121
- return isArray(gains) ? gains[1] - gains[0] || 25 : gains.step;
1122
- }
1123
-
1124
- function DefaultCaptionsMenu() {
1125
- return $signal(() => {
1126
- const { translations } = useDefaultLayoutContext(), { hasCaptions, textTracks } = useMediaState(), $offText = $i18n(translations, "Off");
1127
- if (!hasCaptions()) return null;
1128
- return html`
1129
- <media-menu class="vds-captions-menu vds-menu">
1130
- ${DefaultMenuButton({
1131
- label: () => i18n(translations, "Captions"),
1132
- icon: "menu-captions"
1133
- })}
1134
- <media-menu-items class="vds-menu-items">
1135
- <media-captions-radio-group
1136
- class="vds-captions-radio-group vds-radio-group"
1137
- off-label=${$offText}
1138
- >
1139
- <template>
1140
- <media-radio class="vds-caption-radio vds-radio">
1141
- <slot name="menu-radio-check-icon" data-class="vds-icon"></slot>
1142
- <span class="vds-caption-flag" data-part="flag"></span>
1143
- <span class="vds-radio-label" data-part="label"></span>
1144
- </media-radio>
1145
- </template>
1146
- </media-captions-radio-group>
1147
- </media-menu-items>
1148
- </media-menu>
1149
- `;
1150
- });
1151
- }
1152
-
1153
- function DefaultPlaybackMenu() {
1154
- return $signal(() => {
1155
- const { translations } = useDefaultLayoutContext();
1156
- return html`
1157
- <media-menu class="vds-playback-menu vds-menu">
1158
- ${DefaultMenuButton({
1159
- label: () => i18n(translations, "Playback"),
1160
- icon: "menu-playback"
1161
- })}
1162
- <media-menu-items class="vds-menu-items">
1163
- ${[
1164
- DefaultMenuSection({
1165
- children: DefaultLoopCheckbox()
1166
- }),
1167
- DefaultSpeedMenuSection(),
1168
- DefaultQualityMenuSection()
1169
- ]}
1170
- </media-menu-items>
1171
- </media-menu>
1172
- `;
1173
- });
1174
- }
1175
- function DefaultLoopCheckbox() {
1176
- const { remote } = useMediaContext(), { translations } = useDefaultLayoutContext(), label = "Loop";
1177
- return DefaultMenuItem({
1178
- label: $i18n(translations, label),
1179
- children: DefaultMenuCheckbox({
1180
- label,
1181
- storageKey: "vds-player::user-loop",
1182
- onChange(checked, trigger) {
1183
- remote.userPrefersLoopChange(checked, trigger);
1184
- }
1185
- })
1186
- });
1187
- }
1188
- function DefaultSpeedMenuSection() {
1189
- return $signal(() => {
1190
- const { translations } = useDefaultLayoutContext(), { canSetPlaybackRate, playbackRate } = useMediaState();
1191
- if (!canSetPlaybackRate()) return null;
1192
- return DefaultMenuSection({
1193
- label: $i18n(translations, "Speed"),
1194
- value: $signal(
1195
- () => playbackRate() === 1 ? i18n(translations, "Normal") : playbackRate() + "x"
1196
- ),
1197
- children: [
1198
- DefaultMenuSliderItem({
1199
- upIcon: "menu-speed-up",
1200
- downIcon: "menu-speed-down",
1201
- children: DefaultSpeedSlider(),
1202
- isMin: () => playbackRate() === getSpeedMin(),
1203
- isMax: () => playbackRate() === getSpeedMax()
1204
- })
1205
- ]
1206
- });
1207
- });
1208
- }
1209
- function getSpeedMin() {
1210
- const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
1211
- return isArray(rates) ? rates[0] ?? 0 : rates.min;
1212
- }
1213
- function getSpeedMax() {
1214
- const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
1215
- return isArray(rates) ? rates[rates.length - 1] ?? 2 : rates.max;
1216
- }
1217
- function getSpeedStep() {
1218
- const { playbackRates } = useDefaultLayoutContext(), rates = playbackRates();
1219
- return isArray(rates) ? rates[1] - rates[0] || 0.25 : rates.step;
1220
- }
1221
- function DefaultSpeedSlider() {
1222
- const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Speed"), $min = getSpeedMin, $max = getSpeedMax, $step = getSpeedStep;
1223
- return html`
1224
- <media-speed-slider
1225
- class="vds-speed-slider vds-slider"
1226
- aria-label=${$label}
1227
- min=${$signal($min)}
1228
- max=${$signal($max)}
1229
- step=${$signal($step)}
1230
- key-step=${$signal($step)}
1231
- >
1232
- ${DefaultSliderParts()}${DefaultSliderSteps()}
1233
- </media-speed-slider>
1234
- `;
1235
- }
1236
- function DefaultAutoQualityCheckbox() {
1237
- const { remote, qualities } = useMediaContext(), { autoQuality, canSetQuality, qualities: $qualities } = useMediaState(), { translations } = useDefaultLayoutContext(), label = "Auto", $disabled = computed(() => !canSetQuality() || $qualities().length <= 1);
1238
- if ($disabled()) return null;
1239
- return DefaultMenuItem({
1240
- label: $i18n(translations, label),
1241
- children: DefaultMenuCheckbox({
1242
- label,
1243
- checked: autoQuality,
1244
- onChange(checked, trigger) {
1245
- if (checked) {
1246
- remote.requestAutoQuality(trigger);
1247
- } else {
1248
- remote.changeQuality(qualities.selectedIndex, trigger);
1249
- }
1250
- }
1251
- })
1252
- });
1253
- }
1254
- function DefaultQualityMenuSection() {
1255
- return $signal(() => {
1256
- const { hideQualityBitrate, translations } = useDefaultLayoutContext(), { canSetQuality, qualities, quality } = useMediaState(), $disabled = computed(() => !canSetQuality() || qualities().length <= 1), $sortedQualities = computed(() => sortVideoQualities(qualities()));
1257
- if ($disabled()) return null;
1258
- return DefaultMenuSection({
1259
- label: $i18n(translations, "Quality"),
1260
- value: $signal(() => {
1261
- const height = quality()?.height, bitrate = !hideQualityBitrate() ? quality()?.bitrate : null, bitrateText = bitrate && bitrate > 0 ? `${(bitrate / 1e6).toFixed(2)} Mbps` : null, autoText = i18n(translations, "Auto");
1262
- return height ? `${height}p${bitrateText ? ` (${bitrateText})` : ""}` : autoText;
1263
- }),
1264
- children: [
1265
- DefaultMenuSliderItem({
1266
- upIcon: "menu-quality-up",
1267
- downIcon: "menu-quality-down",
1268
- children: DefaultQualitySlider(),
1269
- isMin: () => $sortedQualities()[0] === quality(),
1270
- isMax: () => $sortedQualities().at(-1) === quality()
1271
- }),
1272
- DefaultAutoQualityCheckbox()
1273
- ]
1274
- });
1275
- });
1276
- }
1277
- function DefaultQualitySlider() {
1278
- const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Quality");
1279
- return html`
1280
- <media-quality-slider class="vds-quality-slider vds-slider" aria-label=${$label}>
1281
- ${DefaultSliderParts()}${DefaultSliderSteps()}
1282
- </media-quality-slider>
1283
- `;
1284
- }
1285
-
1286
- function DefaultSettingsMenu({
1287
- placement,
1288
- portal,
1289
- tooltip
1290
- }) {
1291
- return $signal(() => {
1292
- const { viewType } = useMediaState(), {
1293
- translations,
1294
- menuPortal,
1295
- noModal,
1296
- menuGroup,
1297
- smallWhen: smWhen
1298
- } = useDefaultLayoutContext(), $placement = computed(
1299
- () => noModal() ? unwrap(placement) : !smWhen() ? unwrap(placement) : null
1300
- ), $offset = computed(
1301
- () => !smWhen() && menuGroup() === "bottom" && viewType() === "video" ? 26 : 0
1302
- ), $isOpen = signal(false);
1303
- updateFontCssVars();
1304
- function onOpen() {
1305
- $isOpen.set(true);
1306
- }
1307
- function onClose() {
1308
- $isOpen.set(false);
1309
- }
1310
- const items = html`
1311
- <media-menu-items
1312
- class="vds-settings-menu-items vds-menu-items"
1313
- placement=${$signal($placement)}
1314
- offset=${$signal($offset)}
1315
- >
1316
- ${$signal(() => {
1317
- if (!$isOpen()) {
1318
- return null;
1319
- }
1320
- return [
1321
- DefaultPlaybackMenu(),
1322
- DefaultAccessibilityMenu(),
1323
- DefaultAudioMenu(),
1324
- DefaultCaptionsMenu()
1325
- ];
1326
- })}
1327
- </media-menu-items>
1328
- `;
1329
- return html`
1330
- <media-menu class="vds-settings-menu vds-menu" @open=${onOpen} @close=${onClose}>
1331
- <media-tooltip class="vds-tooltip">
1332
- <media-tooltip-trigger>
1333
- <media-menu-button
1334
- class="vds-menu-button vds-button"
1335
- aria-label=${$i18n(translations, "Settings")}
1336
- >
1337
- ${IconSlot("menu-settings", "vds-rotate-icon")}
1338
- </media-menu-button>
1339
- </media-tooltip-trigger>
1340
- <media-tooltip-content
1341
- class="vds-tooltip-content"
1342
- placement=${isFunction(tooltip) ? $signal(tooltip) : tooltip}
1343
- >
1344
- ${$i18n(translations, "Settings")}
1345
- </media-tooltip-content>
1346
- </media-tooltip>
1347
- ${MenuPortal(menuPortal, items) }
1348
- </media-menu>
1349
- `;
1350
- });
1351
- }
1352
-
1353
- function DefaultVolumePopup({
1354
- orientation,
1355
- tooltip
1356
- }) {
1357
- return $signal(() => {
1358
- const { pointer, muted, canSetVolume } = useMediaState();
1359
- if (pointer() === "coarse" && !muted()) return null;
1360
- if (!canSetVolume()) {
1361
- return DefaultMuteButton({ tooltip });
1362
- }
1363
- const $rootRef = signal(void 0), $isRootActive = useActive($rootRef);
1364
- return html`
1365
- <div class="vds-volume" ?data-active=${$signal($isRootActive)} ${ref($rootRef.set)}>
1366
- ${DefaultMuteButton({ tooltip })}
1367
- <div class="vds-volume-popup">${DefaultVolumeSlider({ orientation })}</div>
1368
- </div>
1369
- `;
1370
- });
1371
- }
1372
- function DefaultVolumeSlider({ orientation } = {}) {
1373
- const { translations } = useDefaultLayoutContext(), $label = $i18n(translations, "Volume");
1374
- return html`
1375
- <media-volume-slider
1376
- class="vds-volume-slider vds-slider"
1377
- aria-label=${$label}
1378
- orientation=${ifDefined(orientation)}
1379
- >
1380
- <div class="vds-slider-track"></div>
1381
- <div class="vds-slider-track-fill vds-slider-track"></div>
1382
- <media-slider-preview class="vds-slider-preview" no-clamp>
1383
- <media-slider-value class="vds-slider-value"></media-slider-value>
1384
- </media-slider-preview>
1385
- <div class="vds-slider-thumb"></div>
1386
- </media-volume-slider>
1387
- `;
1388
- }
1389
- function DefaultTimeSlider() {
1390
- const $ref = signal(void 0), $width = signal(0), {
1391
- thumbnails,
1392
- translations,
1393
- sliderChaptersMinWidth,
1394
- disableTimeSlider,
1395
- seekStep,
1396
- noScrubGesture
1397
- } = useDefaultLayoutContext(), $label = $i18n(translations, "Seek"), $isDisabled = $signal(disableTimeSlider), $isChaptersDisabled = $signal(() => $width() < sliderChaptersMinWidth()), $thumbnails = $signal(thumbnails);
1398
- useResizeObserver($ref, () => {
1399
- const el = $ref();
1400
- el && $width.set(el.clientWidth);
1401
- });
1402
- return html`
1403
- <media-time-slider
1404
- class="vds-time-slider vds-slider"
1405
- aria-label=${$label}
1406
- key-step=${$signal(seekStep)}
1407
- ?disabled=${$isDisabled}
1408
- ?no-swipe-gesture=${$signal(noScrubGesture)}
1409
- ${ref($ref.set)}
1410
- >
1411
- <media-slider-chapters class="vds-slider-chapters" ?disabled=${$isChaptersDisabled}>
1412
- <template>
1413
- <div class="vds-slider-chapter">
1414
- <div class="vds-slider-track"></div>
1415
- <div class="vds-slider-track-fill vds-slider-track"></div>
1416
- <div class="vds-slider-progress vds-slider-track"></div>
1417
- </div>
1418
- </template>
1419
- </media-slider-chapters>
1420
- <div class="vds-slider-thumb"></div>
1421
- <media-slider-preview class="vds-slider-preview">
1422
- <media-slider-thumbnail
1423
- class="vds-slider-thumbnail vds-thumbnail"
1424
- .src=${$thumbnails}
1425
- ></media-slider-thumbnail>
1426
- <div class="vds-slider-chapter-title" data-part="chapter-title"></div>
1427
- <media-slider-value class="vds-slider-value"></media-slider-value>
1428
- </media-slider-preview>
1429
- </media-time-slider>
1430
- `;
1431
- }
1432
-
1433
- function DefaultTimeGroup() {
1434
- return html`
1435
- <div class="vds-time-group">
1436
- ${$signal(() => {
1437
- const { duration } = useMediaState();
1438
- if (!duration()) return null;
1439
- return [
1440
- html`<media-time class="vds-time" type="current"></media-time>`,
1441
- html`<div class="vds-time-divider">/</div>`,
1442
- html`<media-time class="vds-time" type="duration"></media-time>`
1443
- ];
1444
- })}
1445
- </div>
1446
- `;
1447
- }
1448
- function DefaultTimeInvert() {
1449
- return $signal(() => {
1450
- const { live, duration } = useMediaState();
1451
- return live() ? DefaultLiveButton() : duration() ? html`<media-time class="vds-time" type="current" toggle remainder></media-time>` : null;
1452
- });
1453
- }
1454
- function DefaultTimeInfo() {
1455
- return $signal(() => {
1456
- const { live } = useMediaState();
1457
- return live() ? DefaultLiveButton() : DefaultTimeGroup();
1458
- });
1459
- }
1460
-
1461
- function DefaultTitle() {
1462
- return $signal(() => {
1463
- const { textTracks } = useMediaContext(), { title, started } = useMediaState(), $hasChapters = signal(null);
1464
- watchActiveTextTrack(textTracks, "chapters", $hasChapters.set);
1465
- return $hasChapters() && (started() || !title()) ? DefaultChapterTitle() : html`<media-title class="vds-chapter-title"></media-title>`;
1466
- });
1467
- }
1468
- function DefaultChapterTitle() {
1469
- return html`<media-chapter-title class="vds-chapter-title"></media-chapter-title>`;
1470
- }
1471
-
1472
- class DefaultLayoutIconsLoader extends LayoutIconsLoader {
1473
- async loadIcons() {
1474
- const paths = (await import('./vidstack-mxJIo4Sg.js')).icons, icons = {};
1475
- for (const iconName of Object.keys(paths)) {
1476
- icons[iconName] = Icon({ name: iconName, paths: paths[iconName] });
1477
- }
1478
- return icons;
1479
- }
1480
- }
1481
-
1482
- export { DefaultAirPlayButton, DefaultAnnouncer, DefaultCaptionButton, DefaultCaptions, DefaultChapterTitle, DefaultChaptersMenu, DefaultControlsSpacer, DefaultDownloadButton, DefaultEpisodeButton, DefaultFullscreenButton, DefaultLayout, DefaultLayoutIconsLoader, DefaultPIPButton, DefaultPlayButton, DefaultSeekButton, DefaultSettingsMenu, DefaultTimeInfo, DefaultTimeInvert, DefaultTimeSlider, DefaultTitle, DefaultVolumePopup, createMenuContainer, i18n, setLayoutName, useDefaultLayoutContext };