@locpd/vidstack 1.12.14

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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/analyze.json.d.ts +8 -0
  4. package/bundle.d.ts +1 -0
  5. package/cdn/chunks/vidstack-2f5gzOW6.js +1 -0
  6. package/cdn/chunks/vidstack-BYgY9wmd.js +1 -0
  7. package/cdn/chunks/vidstack-BfBBPhXV.js +1 -0
  8. package/cdn/chunks/vidstack-Bjo5esRp.js +1 -0
  9. package/cdn/chunks/vidstack-BuL67v3q.js +1 -0
  10. package/cdn/chunks/vidstack-C0msPRTd.js +3 -0
  11. package/cdn/chunks/vidstack-CJNLoJPa.js +1 -0
  12. package/cdn/chunks/vidstack-CQSpZ7X8.js +16 -0
  13. package/cdn/chunks/vidstack-C_AxqLKV.js +1 -0
  14. package/cdn/chunks/vidstack-CioT3Yw2.js +1 -0
  15. package/cdn/chunks/vidstack-CrqkytHl.js +1 -0
  16. package/cdn/chunks/vidstack-D0M8R0ZU.js +1 -0
  17. package/cdn/chunks/vidstack-D40FSa5B.js +3 -0
  18. package/cdn/chunks/vidstack-DD2JwFVU.js +1 -0
  19. package/cdn/chunks/vidstack-DRH_1tFW.js +1 -0
  20. package/cdn/chunks/vidstack-DfDZuHNP.js +1 -0
  21. package/cdn/chunks/vidstack-DiNS2Vx5.js +1 -0
  22. package/cdn/chunks/vidstack-xjJ-ui_l.js +1 -0
  23. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +1 -0
  24. package/cdn/providers/vidstack-dash-CUtD4e6q.js +1 -0
  25. package/cdn/providers/vidstack-google-cast-BdORATUX.js +1 -0
  26. package/cdn/providers/vidstack-hls-R25Kb6DP.js +1 -0
  27. package/cdn/providers/vidstack-html-DaAUJYsD.js +1 -0
  28. package/cdn/providers/vidstack-video-Csvox7SO.js +1 -0
  29. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +1 -0
  30. package/cdn/providers/vidstack-youtube-DiND6h3s.js +1 -0
  31. package/cdn/vidstack.js +1 -0
  32. package/cdn/with-layouts/chunks/vidstack-2f5gzOW6.js +1 -0
  33. package/cdn/with-layouts/chunks/vidstack-45yH5los.js +1 -0
  34. package/cdn/with-layouts/chunks/vidstack-BBVMdOnf.js +1 -0
  35. package/cdn/with-layouts/chunks/vidstack-BB_ulI_T.js +1 -0
  36. package/cdn/with-layouts/chunks/vidstack-BcAewM33.js +1 -0
  37. package/cdn/with-layouts/chunks/vidstack-BfBBPhXV.js +1 -0
  38. package/cdn/with-layouts/chunks/vidstack-Bxv1Qnxe.js +1 -0
  39. package/cdn/with-layouts/chunks/vidstack-C2ZbG62f.js +3 -0
  40. package/cdn/with-layouts/chunks/vidstack-CCYIOKgL.js +1 -0
  41. package/cdn/with-layouts/chunks/vidstack-CL6PeIO1.js +1 -0
  42. package/cdn/with-layouts/chunks/vidstack-C_AxqLKV.js +1 -0
  43. package/cdn/with-layouts/chunks/vidstack-CifDkwDH.js +795 -0
  44. package/cdn/with-layouts/chunks/vidstack-Cry7aD59.js +3 -0
  45. package/cdn/with-layouts/chunks/vidstack-D065okCn.js +1 -0
  46. package/cdn/with-layouts/chunks/vidstack-DGuMoXmI.js +1 -0
  47. package/cdn/with-layouts/chunks/vidstack-DRH_1tFW.js +1 -0
  48. package/cdn/with-layouts/chunks/vidstack-DVBs1XoQ.js +1 -0
  49. package/cdn/with-layouts/chunks/vidstack-Dge3KT8k.js +1 -0
  50. package/cdn/with-layouts/chunks/vidstack-DiNS2Vx5.js +1 -0
  51. package/cdn/with-layouts/chunks/vidstack-HvYfJoen.js +1 -0
  52. package/cdn/with-layouts/providers/vidstack-audio-DE5vKIzW.js +1 -0
  53. package/cdn/with-layouts/providers/vidstack-dash-CA2agUuZ.js +1 -0
  54. package/cdn/with-layouts/providers/vidstack-google-cast-CGs-t8HM.js +1 -0
  55. package/cdn/with-layouts/providers/vidstack-hls-BHMbMFFR.js +1 -0
  56. package/cdn/with-layouts/providers/vidstack-html-Dm9gmNk6.js +1 -0
  57. package/cdn/with-layouts/providers/vidstack-video-C5it_Lbl.js +1 -0
  58. package/cdn/with-layouts/providers/vidstack-vimeo-BabLn9sy.js +1 -0
  59. package/cdn/with-layouts/providers/vidstack-youtube-D8UlccUL.js +1 -0
  60. package/cdn/with-layouts/vidstack.js +1 -0
  61. package/dev/chunks/vidstack-B7Zi3v_O.js +104 -0
  62. package/dev/chunks/vidstack-BFg1ZqiG.js +91 -0
  63. package/dev/chunks/vidstack-BGB2pa9s.js +58 -0
  64. package/dev/chunks/vidstack-BaIbHZE3.js +1519 -0
  65. package/dev/chunks/vidstack-Bb2rASIc.js +5188 -0
  66. package/dev/chunks/vidstack-Bcmx8pmK.js +224 -0
  67. package/dev/chunks/vidstack-Bl4b0Nen.js +29 -0
  68. package/dev/chunks/vidstack-Bo5OTJ06.js +58 -0
  69. package/dev/chunks/vidstack-BoAGnlRt.js +58 -0
  70. package/dev/chunks/vidstack-Bpr4fI4n.js +7 -0
  71. package/dev/chunks/vidstack-Bt8MP2DK.js +204 -0
  72. package/dev/chunks/vidstack-Bu2kfzUd.js +1637 -0
  73. package/dev/chunks/vidstack-C-ffXlSV.js +2995 -0
  74. package/dev/chunks/vidstack-C-ztJq-f.js +109 -0
  75. package/dev/chunks/vidstack-CFNlaVTR.js +55 -0
  76. package/dev/chunks/vidstack-C_l97D5j.js +254 -0
  77. package/dev/chunks/vidstack-CjhKISI0.js +114 -0
  78. package/dev/chunks/vidstack-CofXIJAy.js +57 -0
  79. package/dev/chunks/vidstack-CwTj4H1w.js +18 -0
  80. package/dev/chunks/vidstack-DDwbYVHV.js +66 -0
  81. package/dev/chunks/vidstack-DFImIcIL.js +11 -0
  82. package/dev/chunks/vidstack-DGDvUbvO.js +33 -0
  83. package/dev/chunks/vidstack-DO0kqA99.js +107 -0
  84. package/dev/chunks/vidstack-DXxIKXmd.js +50 -0
  85. package/dev/chunks/vidstack-DajrMUR0.js +297 -0
  86. package/dev/chunks/vidstack-DbBJlz7I.js +10 -0
  87. package/dev/chunks/vidstack-Dihypf8P.js +11 -0
  88. package/dev/chunks/vidstack-DlAhl87f.js +1193 -0
  89. package/dev/chunks/vidstack-Dm1xEU9Q.js +34 -0
  90. package/dev/chunks/vidstack-Dv_LIPFu.js +14 -0
  91. package/dev/chunks/vidstack-igYn0Apa.js +254 -0
  92. package/dev/chunks/vidstack-krOAtKMi.js +32 -0
  93. package/dev/chunks/vidstack-qh1N5_f_.js +26 -0
  94. package/dev/chunks/vidstack-rB-wqXw1.js +107 -0
  95. package/dev/chunks/vidstack-zG6PIeGg.js +66 -0
  96. package/dev/define/plyr-layout.js +51 -0
  97. package/dev/define/templates/plyr-layout.js +571 -0
  98. package/dev/define/templates/vidstack-audio-layout.js +167 -0
  99. package/dev/define/templates/vidstack-video-layout.js +390 -0
  100. package/dev/define/vidstack-icons.js +1 -0
  101. package/dev/define/vidstack-player-default-layout.js +21 -0
  102. package/dev/define/vidstack-player-layouts.js +25 -0
  103. package/dev/define/vidstack-player-ui.js +70 -0
  104. package/dev/define/vidstack-player.js +19 -0
  105. package/dev/global/plyr.js +501 -0
  106. package/dev/global/vidstack-player.js +129 -0
  107. package/dev/providers/vidstack-audio.js +35 -0
  108. package/dev/providers/vidstack-dash.js +516 -0
  109. package/dev/providers/vidstack-google-cast.js +474 -0
  110. package/dev/providers/vidstack-hls.js +408 -0
  111. package/dev/providers/vidstack-html.js +567 -0
  112. package/dev/providers/vidstack-video.js +207 -0
  113. package/dev/providers/vidstack-vimeo.js +554 -0
  114. package/dev/providers/vidstack-youtube.js +286 -0
  115. package/dev/vidstack-elements.js +36 -0
  116. package/dev/vidstack.js +91 -0
  117. package/dom.d.ts +91 -0
  118. package/elements.d.ts +1433 -0
  119. package/empty.vtt +1 -0
  120. package/global/player.d.ts +52 -0
  121. package/global/plyr.d.ts +343 -0
  122. package/google-cast.d.ts +1422 -0
  123. package/icons.d.ts +1 -0
  124. package/index.d.ts +402 -0
  125. package/package.json +199 -0
  126. package/player/index.d.ts +3 -0
  127. package/player/layouts/default.d.ts +3 -0
  128. package/player/layouts/index.d.ts +3 -0
  129. package/player/layouts/plyr.d.ts +3 -0
  130. package/player/styles/base.css +153 -0
  131. package/player/styles/default/buffering.css +55 -0
  132. package/player/styles/default/buttons.css +175 -0
  133. package/player/styles/default/captions.css +181 -0
  134. package/player/styles/default/chapter-title.css +26 -0
  135. package/player/styles/default/controls.css +56 -0
  136. package/player/styles/default/gestures.css +19 -0
  137. package/player/styles/default/icons.css +6 -0
  138. package/player/styles/default/keyboard.css +148 -0
  139. package/player/styles/default/layouts/audio.css +417 -0
  140. package/player/styles/default/layouts/video.css +590 -0
  141. package/player/styles/default/menus.css +959 -0
  142. package/player/styles/default/poster.css +52 -0
  143. package/player/styles/default/sliders.css +391 -0
  144. package/player/styles/default/theme.css +2461 -0
  145. package/player/styles/default/thumbnail.css +40 -0
  146. package/player/styles/default/time.css +45 -0
  147. package/player/styles/default/tooltips.css +141 -0
  148. package/player/styles/plyr/theme.css +1237 -0
  149. package/player/ui.d.ts +3 -0
  150. package/plugins.d.ts +19 -0
  151. package/plugins.js +13 -0
  152. package/prod/chunks/vidstack-B01xzxC4.js +7 -0
  153. package/prod/chunks/vidstack-BCeb7ryV.js +201 -0
  154. package/prod/chunks/vidstack-BGSTndAW.js +1590 -0
  155. package/prod/chunks/vidstack-BPitBBjh.js +1519 -0
  156. package/prod/chunks/vidstack-BQlOPwOu.js +45 -0
  157. package/prod/chunks/vidstack-BSDzlwxO.js +4778 -0
  158. package/prod/chunks/vidstack-BT0m6zEi.js +109 -0
  159. package/prod/chunks/vidstack-BTigPj2h.js +55 -0
  160. package/prod/chunks/vidstack-BiyXcJ_M.js +107 -0
  161. package/prod/chunks/vidstack-BoVf5n1M.js +2985 -0
  162. package/prod/chunks/vidstack-Bq6c3Bam.js +58 -0
  163. package/prod/chunks/vidstack-ByLCIBtB.js +297 -0
  164. package/prod/chunks/vidstack-C2US-gSO.js +248 -0
  165. package/prod/chunks/vidstack-C9vIqaYT.js +10 -0
  166. package/prod/chunks/vidstack-CF6fixCQ.js +1193 -0
  167. package/prod/chunks/vidstack-CTojmhKq.js +66 -0
  168. package/prod/chunks/vidstack-ChQTHmIQ.js +77 -0
  169. package/prod/chunks/vidstack-Cm6_unwd.js +246 -0
  170. package/prod/chunks/vidstack-CwTj4H1w.js +18 -0
  171. package/prod/chunks/vidstack-D3ltXc3a.js +33 -0
  172. package/prod/chunks/vidstack-D5EzK014.js +14 -0
  173. package/prod/chunks/vidstack-DDXt6fpN.js +58 -0
  174. package/prod/chunks/vidstack-DJDnh4xT.js +11 -0
  175. package/prod/chunks/vidstack-DXxIKXmd.js +50 -0
  176. package/prod/chunks/vidstack-D_-9AA6_.js +29 -0
  177. package/prod/chunks/vidstack-DbkZGjSn.js +107 -0
  178. package/prod/chunks/vidstack-Dihypf8P.js +11 -0
  179. package/prod/chunks/vidstack-Dm1xEU9Q.js +34 -0
  180. package/prod/chunks/vidstack-Dq5Yu0Vr.js +205 -0
  181. package/prod/chunks/vidstack-DqAw8m9J.js +26 -0
  182. package/prod/chunks/vidstack-DsPOyKtl.js +57 -0
  183. package/prod/chunks/vidstack-krOAtKMi.js +32 -0
  184. package/prod/chunks/vidstack-nLyr4NEP.js +58 -0
  185. package/prod/chunks/vidstack-xMS8dnYq.js +114 -0
  186. package/prod/chunks/vidstack-yEGTpgeA.js +104 -0
  187. package/prod/define/plyr-layout.js +51 -0
  188. package/prod/define/templates/plyr-layout.js +571 -0
  189. package/prod/define/templates/vidstack-audio-layout.js +167 -0
  190. package/prod/define/templates/vidstack-video-layout.js +390 -0
  191. package/prod/define/vidstack-icons.js +1 -0
  192. package/prod/define/vidstack-player-default-layout.js +21 -0
  193. package/prod/define/vidstack-player-layouts.js +25 -0
  194. package/prod/define/vidstack-player-ui.js +70 -0
  195. package/prod/define/vidstack-player.js +19 -0
  196. package/prod/global/plyr.js +493 -0
  197. package/prod/global/vidstack-player.js +129 -0
  198. package/prod/providers/vidstack-audio.js +35 -0
  199. package/prod/providers/vidstack-dash.js +501 -0
  200. package/prod/providers/vidstack-google-cast.js +468 -0
  201. package/prod/providers/vidstack-hls.js +393 -0
  202. package/prod/providers/vidstack-html.js +555 -0
  203. package/prod/providers/vidstack-video.js +204 -0
  204. package/prod/providers/vidstack-vimeo.js +548 -0
  205. package/prod/providers/vidstack-youtube.js +286 -0
  206. package/prod/vidstack-elements.js +36 -0
  207. package/prod/vidstack.js +158 -0
  208. package/server/chunks/vidstack-6juFdkKy.js +29 -0
  209. package/server/chunks/vidstack-B7iHmv7_.js +307 -0
  210. package/server/chunks/vidstack-BmxyML9v.js +1619 -0
  211. package/server/chunks/vidstack-BskfxwD3.js +566 -0
  212. package/server/chunks/vidstack-BvLV0SMz.js +4642 -0
  213. package/server/chunks/vidstack-BvWwluXZ.js +205 -0
  214. package/server/chunks/vidstack-C-413dj2.js +8 -0
  215. package/server/chunks/vidstack-C26K8z_-.js +55 -0
  216. package/server/chunks/vidstack-CJJiksDz.js +107 -0
  217. package/server/chunks/vidstack-CUNv52x1.js +141 -0
  218. package/server/chunks/vidstack-CqyBCODe.js +295 -0
  219. package/server/chunks/vidstack-CwTj4H1w.js +18 -0
  220. package/server/chunks/vidstack-DHAyGSOl.js +1502 -0
  221. package/server/chunks/vidstack-DLU3cjcp.js +381 -0
  222. package/server/chunks/vidstack-DXxIKXmd.js +50 -0
  223. package/server/chunks/vidstack-DbtDXDS2.js +104 -0
  224. package/server/chunks/vidstack-Dm1xEU9Q.js +34 -0
  225. package/server/chunks/vidstack-DzTHw_bw.js +207 -0
  226. package/server/chunks/vidstack-Wn3NH5Sg.js +1566 -0
  227. package/server/chunks/vidstack-krOAtKMi.js +32 -0
  228. package/server/chunks/vidstack-wNViAkr4.js +3045 -0
  229. package/server/define/plyr-layout.js +16 -0
  230. package/server/define/vidstack-icons.js +1 -0
  231. package/server/define/vidstack-player-default-layout.js +13 -0
  232. package/server/define/vidstack-player-layouts.js +16 -0
  233. package/server/define/vidstack-player-ui.js +11 -0
  234. package/server/define/vidstack-player.js +6 -0
  235. package/server/global/plyr.js +322 -0
  236. package/server/global/vidstack-player.js +58 -0
  237. package/server/vidstack-elements.js +46 -0
  238. package/server/vidstack.js +148 -0
  239. package/tailwind.cjs +101 -0
  240. package/tailwind.d.cts +15 -0
  241. package/types/vidstack-BOvzfZjK.d.ts +1269 -0
  242. package/types/vidstack-Cttpg6GU.d.ts +7474 -0
@@ -0,0 +1,571 @@
1
+ import { html } from 'lit-html';
2
+ import { computed, signal, effect, listenEvent, peek, isString, isKeyboardEvent, isKeyboardClick, Host, onDispose } from '../../chunks/vidstack-Bu2kfzUd.js';
3
+ import { usePlyrLayoutContext, PlyrLayout, usePlyrLayoutClasses } from '../../chunks/vidstack-DO0kqA99.js';
4
+ import { useMediaContext } from '../../chunks/vidstack-DFImIcIL.js';
5
+ import { LayoutIconsLoader, Icon, $signal, SlotManager } from '../../chunks/vidstack-Bcmx8pmK.js';
6
+ import { LitElement } from '../../chunks/vidstack-CwTj4H1w.js';
7
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
8
+ import { getDownloadFile, appendParamsToURL } from '../../chunks/vidstack-zG6PIeGg.js';
9
+ import 'lit-html/directives/if-defined.js';
10
+ import 'lit-html/directives/unsafe-svg.js';
11
+ import 'lit-html/async-directive.js';
12
+ import '../../chunks/vidstack-CjhKISI0.js';
13
+
14
+ class PlyrLayoutIconsLoader extends LayoutIconsLoader {
15
+ async loadIcons() {
16
+ const paths = (await import('../../chunks/vidstack-DXxIKXmd.js')).icons, icons = {};
17
+ for (const iconName of Object.keys(paths)) {
18
+ icons[iconName] = Icon({
19
+ name: iconName,
20
+ paths: paths[iconName],
21
+ viewBox: "0 0 18 18"
22
+ });
23
+ }
24
+ return icons;
25
+ }
26
+ }
27
+
28
+ function i18n(translations, word) {
29
+ return translations()?.[word] ?? word;
30
+ }
31
+
32
+ function PlyrAudioLayout() {
33
+ return AudioControls();
34
+ }
35
+ function PlyrVideoLayout() {
36
+ const media = useMediaContext(), { load } = media.$props, { canLoad } = media.$state, showLoadScreen = computed(() => load() === "play" && !canLoad());
37
+ if (showLoadScreen()) {
38
+ return [PlayLargeButton(), Poster()];
39
+ }
40
+ return [
41
+ OptionalPlayLarge(),
42
+ PreviewScrubbing(),
43
+ Poster(),
44
+ VideoControls(),
45
+ Gestures(),
46
+ Captions()
47
+ ];
48
+ }
49
+ function PlayLargeButton() {
50
+ const media = useMediaContext(), { translations } = usePlyrLayoutContext(), { title } = media.$state, $label = $signal(() => `${i18n(translations, "Play")}, ${title()}`);
51
+ return html`
52
+ <media-play-button
53
+ class="plyr__control plyr__control--overlaid"
54
+ aria-label=${$label}
55
+ data-plyr="play"
56
+ >
57
+ <slot name="play-icon"></slot>
58
+ </button>
59
+ `;
60
+ }
61
+ function OptionalPlayLarge() {
62
+ const { controls } = usePlyrLayoutContext();
63
+ return $signal(() => controls().includes("play-large") ? PlayLargeButton() : null);
64
+ }
65
+ function PreviewScrubbing() {
66
+ const { thumbnails, previewTime } = usePlyrLayoutContext();
67
+ return html`
68
+ <media-thumbnail
69
+ .src=${$signal(thumbnails)}
70
+ class="plyr__preview-scrubbing"
71
+ time=${$signal(() => previewTime())}
72
+ ></media-thumbnail>
73
+ `;
74
+ }
75
+ function Poster() {
76
+ const media = useMediaContext(), { poster } = media.$state, $style = $signal(() => `background-image: url("${poster()}");`);
77
+ return html`<div class="plyr__poster" style=${$style}></div>`;
78
+ }
79
+ function AudioControls() {
80
+ const ignore = /* @__PURE__ */ new Set(["captions", "pip", "airplay", "fullscreen"]), { controls } = usePlyrLayoutContext(), $controls = $signal(
81
+ () => controls().filter((type) => !ignore.has(type)).map(Control)
82
+ );
83
+ return html`<div class="plyr__controls">${$controls}</div>`;
84
+ }
85
+ function VideoControls() {
86
+ const { controls } = usePlyrLayoutContext(), $controls = $signal(() => controls().map(Control));
87
+ return html`<div class="plyr__controls">${$controls}</div>`;
88
+ }
89
+ function Control(type) {
90
+ switch (type) {
91
+ case "airplay":
92
+ return AirPlayButton();
93
+ case "captions":
94
+ return CaptionsButton();
95
+ case "current-time":
96
+ return CurrentTime();
97
+ case "download":
98
+ return DownloadButton();
99
+ case "duration":
100
+ return Duration();
101
+ case "fast-forward":
102
+ return FastForwardButton();
103
+ case "fullscreen":
104
+ return FullscreenButton();
105
+ case "mute":
106
+ case "volume":
107
+ case "mute+volume":
108
+ return Volume(type);
109
+ case "pip":
110
+ return PIPButton();
111
+ case "play":
112
+ return PlayButton();
113
+ case "progress":
114
+ return TimeSlider();
115
+ case "restart":
116
+ return RestartButton();
117
+ case "rewind":
118
+ return RewindButton();
119
+ case "settings":
120
+ return Settings();
121
+ default:
122
+ return null;
123
+ }
124
+ }
125
+ function AirPlayButton() {
126
+ const { translations } = usePlyrLayoutContext();
127
+ return html`
128
+ <media-airplay-button class="plyr__controls__item plyr__control" data-plyr="airplay">
129
+ <slot name="airplay-icon"></slot>
130
+ <span class="plyr__tooltip">${$i18n(translations, "AirPlay")}</span>
131
+ </media-airplay-button>
132
+ `;
133
+ }
134
+ function CaptionsButton() {
135
+ const { translations } = usePlyrLayoutContext(), $disableText = $i18n(translations, "Disable captions"), $enableText = $i18n(translations, "Enable captions");
136
+ return html`
137
+ <media-caption-button
138
+ class="plyr__controls__item plyr__control"
139
+ data-no-label
140
+ data-plyr="captions"
141
+ >
142
+ <slot name="captions-on-icon" data-class="icon--pressed"></slot>
143
+ <slot name="captions-off-icon" data-class="icon--not-pressed"></slot>
144
+ <span class="label--pressed plyr__tooltip">${$disableText}</span>
145
+ <span class="label--not-pressed plyr__tooltip">${$enableText}</span>
146
+ </media-caption-button>
147
+ `;
148
+ }
149
+ function FullscreenButton() {
150
+ const { translations } = usePlyrLayoutContext(), $enterText = $i18n(translations, "Enter Fullscreen"), $exitText = $i18n(translations, "Exit Fullscreen");
151
+ return html`
152
+ <media-fullscreen-button
153
+ class="plyr__controls__item plyr__control"
154
+ data-no-label
155
+ data-plyr="fullscreen"
156
+ >
157
+ <slot name="enter-fullscreen-icon" data-class="icon--pressed"></slot>
158
+ <slot name="exit-fullscreen-icon" data-class="icon--not-pressed"></slot>
159
+ <span class="label--pressed plyr__tooltip">${$exitText}</span>
160
+ <span class="label--not-pressed plyr__tooltip">${$enterText}</span>
161
+ </media-fullscreen-button>
162
+ `;
163
+ }
164
+ function MuteButton() {
165
+ const { translations } = usePlyrLayoutContext(), $muteText = $i18n(translations, "Mute"), $unmuteText = $i18n(translations, "Unmute");
166
+ return html`
167
+ <media-mute-button class="plyr__control" data-no-label data-plyr="mute">
168
+ <slot name="muted-icon" data-class="icon--pressed"></slot>
169
+ <slot name="volume-icon" data-class="icon--not-pressed"></slot>
170
+ <span class="label--pressed plyr__tooltip">${$unmuteText}</span>
171
+ <span class="label--not-pressed plyr__tooltip">${$muteText}</span>
172
+ </media-mute-button>
173
+ `;
174
+ }
175
+ function PIPButton() {
176
+ const { translations } = usePlyrLayoutContext(), $enterText = $i18n(translations, "Enter PiP"), $exitText = $i18n(translations, "Exit PiP");
177
+ return html`
178
+ <media-pip-button class="plyr__controls__item plyr__control" data-no-label data-plyr="pip">
179
+ <slot name="pip-icon"></slot>
180
+ <slot name="enter-pip-icon" data-class="icon--pressed"></slot>
181
+ <slot name="exit-pip-icon" data-class="icon--not-pressed"></slot>
182
+ <span class="label--pressed plyr__tooltip">${$exitText}</span>
183
+ <span class="label--not-pressed plyr__tooltip">${$enterText}</span>
184
+ </media-pip-button>
185
+ `;
186
+ }
187
+ function PlayButton() {
188
+ const { translations } = usePlyrLayoutContext(), $playText = $i18n(translations, "Play"), $pauseText = $i18n(translations, "Pause");
189
+ return html`
190
+ <media-play-button class="plyr__controls__item plyr__control" data-no-label data-plyr="play">
191
+ <slot name="pause-icon" data-class="icon--pressed"></slot>
192
+ <slot name="play-icon" data-class="icon--not-pressed"></slot>
193
+ <span class="label--pressed plyr__tooltip">${$pauseText}</span>
194
+ <span class="label--not-pressed plyr__tooltip">${$playText}</span>
195
+ </media-play-button>
196
+ `;
197
+ }
198
+ function RestartButton() {
199
+ const { translations } = usePlyrLayoutContext(), { remote } = useMediaContext(), $restartText = $i18n(translations, "Restart");
200
+ function onPress(event) {
201
+ if (isKeyboardEvent(event) && !isKeyboardClick(event)) return;
202
+ remote.seek(0, event);
203
+ }
204
+ return html`
205
+ <button
206
+ type="button"
207
+ class="plyr__control"
208
+ data-plyr="restart"
209
+ @pointerup=${onPress}
210
+ @keydown=${onPress}
211
+ >
212
+ <slot name="restart-icon"></slot>
213
+ <span class="plyr__tooltip">${$restartText}</span>
214
+ </button>
215
+ `;
216
+ }
217
+ function RewindButton() {
218
+ const { translations, seekTime } = usePlyrLayoutContext(), $label = $signal(() => `${i18n(translations, "Rewind")} ${seekTime()}s`), $seconds = $signal(() => -1 * seekTime());
219
+ return html`
220
+ <media-seek-button
221
+ class="plyr__controls__item plyr__control"
222
+ seconds=${$seconds}
223
+ data-no-label
224
+ data-plyr="rewind"
225
+ >
226
+ <slot name="rewind-icon"></slot>
227
+ <span class="plyr__tooltip">${$label}</span>
228
+ </media-seek-button>
229
+ `;
230
+ }
231
+ function FastForwardButton() {
232
+ const { translations, seekTime } = usePlyrLayoutContext(), $label = $signal(() => `${i18n(translations, "Forward")} ${seekTime()}s`), $seconds = $signal(seekTime);
233
+ return html`
234
+ <media-seek-button
235
+ class="plyr__controls__item plyr__control"
236
+ seconds=${$seconds}
237
+ data-no-label
238
+ data-plyr="fast-forward"
239
+ >
240
+ <slot name="fast-forward-icon"></slot>
241
+ <span class="plyr__tooltip">${$label}</span>
242
+ </media-seek-button>
243
+ `;
244
+ }
245
+ function TimeSlider() {
246
+ let media = useMediaContext(), { duration, viewType } = media.$state, { translations, markers, thumbnails, seekTime, previewTime } = usePlyrLayoutContext(), $seekText = $i18n(translations, "Seek"), activeMarker = signal(null), $markerLabel = $signal(() => {
247
+ const marker = activeMarker();
248
+ return marker ? html`<span class="plyr__progress__marker-label">${unsafeHTML(marker.label)}<br /></span>` : null;
249
+ });
250
+ function onSeekingRequest(event) {
251
+ previewTime.set(event.detail);
252
+ }
253
+ function onMarkerEnter() {
254
+ activeMarker.set(this);
255
+ }
256
+ function onMarkerLeave() {
257
+ activeMarker.set(null);
258
+ }
259
+ function Preview() {
260
+ const src = thumbnails(), $noClamp = $signal(() => viewType() === "audio");
261
+ return !src ? html`
262
+ <span class="plyr__tooltip">
263
+ ${$markerLabel}
264
+ <media-slider-value></media-slider-value>
265
+ </span>
266
+ ` : html`
267
+ <media-slider-preview class="plyr__slider__preview" ?no-clamp=${$noClamp}>
268
+ <media-slider-thumbnail .src=${src} class="plyr__slider__preview__thumbnail">
269
+ <span class="plyr__slider__preview__time-container">
270
+ ${$markerLabel}
271
+ <media-slider-value class="plyr__slider__preview__time"></media-slider-value>
272
+ </span>
273
+ </media-slider-thumbnail>
274
+ </media-slider-preview>
275
+ `;
276
+ }
277
+ function Markers() {
278
+ const endTime = duration();
279
+ if (!Number.isFinite(endTime)) return null;
280
+ return markers()?.map(
281
+ (marker) => html`
282
+ <span
283
+ class="plyr__progress__marker"
284
+ @mouseenter=${onMarkerEnter.bind(marker)}
285
+ @mouseleave=${onMarkerLeave}
286
+ style=${`left: ${marker.time / endTime * 100}%;`}
287
+ ></span>
288
+ `
289
+ );
290
+ }
291
+ return html`
292
+ <div class="plyr__controls__item plyr__progress__container">
293
+ <div class="plyr__progress">
294
+ <media-time-slider
295
+ class="plyr__slider"
296
+ data-plyr="seek"
297
+ pause-while-dragging
298
+ key-step=${$signal(seekTime)}
299
+ aria-label=${$seekText}
300
+ @media-seeking-request=${onSeekingRequest}
301
+ >
302
+ <div class="plyr__slider__track"></div>
303
+ <div class="plyr__slider__thumb"></div>
304
+ <div class="plyr__slider__buffer"></div>
305
+ ${$signal(Preview)}${$signal(Markers)}
306
+ </media-time-slider>
307
+ </div>
308
+ </div>
309
+ `;
310
+ }
311
+ function Volume(type) {
312
+ return $signal(() => {
313
+ const hasMuteButton = type === "mute" || type === "mute+volume", hasVolumeSlider = type === "volume" || type === "mute+volume";
314
+ return html`
315
+ <div class="plyr__controls__item plyr__volume">
316
+ ${[hasMuteButton ? MuteButton() : null, hasVolumeSlider ? VolumeSlider() : null]}
317
+ </div>
318
+ `;
319
+ });
320
+ }
321
+ function VolumeSlider() {
322
+ const { translations } = usePlyrLayoutContext(), $volumeText = $i18n(translations, "Volume");
323
+ return html`
324
+ <media-volume-slider class="plyr__slider" data-plyr="volume" aria-label=${$volumeText}>
325
+ <div class="plyr__slider__track"></div>
326
+ <div class="plyr__slider__thumb"></div>
327
+ </media-volume-slider>
328
+ `;
329
+ }
330
+ function CurrentTime() {
331
+ const media = useMediaContext(), { translations, invertTime, toggleTime, displayDuration } = usePlyrLayoutContext(), invert = signal(peek(invertTime));
332
+ function onPress(event) {
333
+ if (!toggleTime() || displayDuration() || isKeyboardEvent(event) && !isKeyboardClick(event)) {
334
+ return;
335
+ }
336
+ invert.set((n) => !n);
337
+ }
338
+ function MaybeDuration() {
339
+ return $signal(() => displayDuration() ? Duration() : null);
340
+ }
341
+ return $signal(() => {
342
+ const { streamType } = media.$state, $liveText = $i18n(translations, "LIVE"), $currentTimeText = $i18n(translations, "Current time"), $remainder = $signal(() => !displayDuration() && invert());
343
+ return streamType() === "live" || streamType() === "ll-live" ? html`
344
+ <media-live-button
345
+ class="plyr__controls__item plyr__control plyr__live-button"
346
+ data-plyr="live"
347
+ >
348
+ <span class="plyr__live-button__text">${$liveText}</span>
349
+ </media-live-button>
350
+ ` : html`
351
+ <media-time
352
+ type="current"
353
+ class="plyr__controls__item plyr__time plyr__time--current"
354
+ tabindex="0"
355
+ role="timer"
356
+ aria-label=${$currentTimeText}
357
+ ?remainder=${$remainder}
358
+ @pointerup=${onPress}
359
+ @keydown=${onPress}
360
+ ></media-time>
361
+ ${MaybeDuration()}
362
+ `;
363
+ });
364
+ }
365
+ function Duration() {
366
+ const { translations } = usePlyrLayoutContext(), $durationText = $i18n(translations, "Duration");
367
+ return html`
368
+ <media-time
369
+ type="duration"
370
+ class="plyr__controls__item plyr__time plyr__time--duration"
371
+ role="timer"
372
+ tabindex="0"
373
+ aria-label=${$durationText}
374
+ ></media-time>
375
+ `;
376
+ }
377
+ function DownloadButton() {
378
+ return $signal(() => {
379
+ const media = useMediaContext(), { translations, download } = usePlyrLayoutContext(), { title, source } = media.$state, $src = source(), $download = download(), file = getDownloadFile({
380
+ title: title(),
381
+ src: $src,
382
+ download: $download
383
+ }), $downloadText = $i18n(translations, "Download");
384
+ return isString(file?.url) ? html`
385
+ <a
386
+ class="plyr__controls__item plyr__control"
387
+ href=${appendParamsToURL(file.url, { download: file.name })}
388
+ download=${file.name}
389
+ target="_blank"
390
+ >
391
+ <slot name="download-icon" />
392
+ <span class="plyr__tooltip">${$downloadText}</span>
393
+ </a>
394
+ ` : null;
395
+ });
396
+ }
397
+ function Gestures() {
398
+ return $signal(() => {
399
+ const { clickToPlay, clickToFullscreen } = usePlyrLayoutContext();
400
+ return [
401
+ clickToPlay() ? html`
402
+ <media-gesture
403
+ class="plyr__gesture"
404
+ event="pointerup"
405
+ action="toggle:paused"
406
+ ></media-gesture>
407
+ ` : null,
408
+ clickToFullscreen() ? html`
409
+ <media-gesture
410
+ class="plyr__gesture"
411
+ event="dblpointerup"
412
+ action="toggle:fullscreen"
413
+ ></media-gesture>
414
+ ` : null
415
+ ];
416
+ });
417
+ }
418
+ function Captions() {
419
+ const media = useMediaContext(), activeCue = signal(void 0), $cueText = $signal(() => unsafeHTML(activeCue()?.text));
420
+ effect(() => {
421
+ const track = media.$state.textTrack();
422
+ if (!track) return;
423
+ function onCueChange() {
424
+ activeCue.set(track?.activeCues[0]);
425
+ }
426
+ onCueChange();
427
+ return listenEvent(track, "cue-change", onCueChange);
428
+ });
429
+ return html`
430
+ <div class="plyr__captions" dir="auto">
431
+ <span class="plyr__caption">${$cueText}</span>
432
+ </div>
433
+ `;
434
+ }
435
+ function Settings() {
436
+ const { translations } = usePlyrLayoutContext(), $settingsText = $i18n(translations, "Settings");
437
+ return html`
438
+ <div class="plyr__controls__item plyr__menu">
439
+ <media-menu>
440
+ <media-menu-button class="plyr__control" data-plyr="settings">
441
+ <slot name="settings-icon" />
442
+ <span class="plyr__tooltip">${$settingsText}</span>
443
+ </media-menu-button>
444
+ <media-menu-items class="plyr__menu__container" placement="top end">
445
+ <div><div>${[AudioMenu(), CaptionsMenu(), QualityMenu(), SpeedMenu()]}</div></div>
446
+ </media-menu-items>
447
+ </media-menu>
448
+ </div>
449
+ `;
450
+ }
451
+ function Menu({ label, children }) {
452
+ const open = signal(false), onOpen = () => open.set(true), onClose = () => open.set(false);
453
+ return html`
454
+ <media-menu @open=${onOpen} @close=${onClose}>
455
+ ${MenuButton({ label, open })}
456
+ <media-menu-items>${children}</media-menu-items>
457
+ </media-menu>
458
+ `;
459
+ }
460
+ function MenuButton({ open, label }) {
461
+ const { translations } = usePlyrLayoutContext(), $class = $signal(() => `plyr__control plyr__control--${open() ? "back" : "forward"}`);
462
+ function GoBackText() {
463
+ const $text = $i18n(translations, "Go back to previous menu");
464
+ return $signal(() => open() ? html`<span class="plyr__sr-only">${$text}</span>` : null);
465
+ }
466
+ return html`
467
+ <media-menu-button class=${$class} data-plyr="settings">
468
+ <span class="plyr__menu__label" aria-hidden=${$aria(open)}>
469
+ ${$i18n(translations, label)}
470
+ </span>
471
+ <span class="plyr__menu__value" data-part="hint"></span>
472
+ ${GoBackText()}
473
+ </media-menu-button>
474
+ `;
475
+ }
476
+ function AudioMenu() {
477
+ return Menu({ label: "Audio", children: AudioRadioGroup() });
478
+ }
479
+ function AudioRadioGroup() {
480
+ const { translations } = usePlyrLayoutContext();
481
+ return html`
482
+ <media-audio-radio-group empty-label=${$i18n(translations, "Default")}>
483
+ <template>
484
+ <media-radio class="plyr__control" data-plyr="audio">
485
+ <span data-part="label"></span>
486
+ </media-radio>
487
+ </template>
488
+ </media-audio-radio-group>
489
+ `;
490
+ }
491
+ function SpeedMenu() {
492
+ return Menu({ label: "Speed", children: SpeedRadioGroup() });
493
+ }
494
+ function SpeedRadioGroup() {
495
+ const { translations, speed } = usePlyrLayoutContext();
496
+ return html`
497
+ <media-speed-radio-group .rates=${speed} normal-label=${$i18n(translations, "Normal")}>
498
+ <template>
499
+ <media-radio class="plyr__control" data-plyr="speed">
500
+ <span data-part="label"></span>
501
+ </media-radio>
502
+ </template>
503
+ </media-speed-radio-group>
504
+ `;
505
+ }
506
+ function CaptionsMenu() {
507
+ return Menu({ label: "Captions", children: CaptionsRadioGroup() });
508
+ }
509
+ function CaptionsRadioGroup() {
510
+ const { translations } = usePlyrLayoutContext();
511
+ return html`
512
+ <media-captions-radio-group off-label=${$i18n(translations, "Disabled")}>
513
+ <template>
514
+ <media-radio class="plyr__control" data-plyr="captions">
515
+ <span data-part="label"></span>
516
+ </media-radio>
517
+ </template>
518
+ </media-captions-radio-group>
519
+ `;
520
+ }
521
+ function QualityMenu() {
522
+ return Menu({ label: "Quality", children: QualityRadioGroup() });
523
+ }
524
+ function QualityRadioGroup() {
525
+ const { translations } = usePlyrLayoutContext();
526
+ return html`
527
+ <media-quality-radio-group auto-label=${$i18n(translations, "Auto")}>
528
+ <template>
529
+ <media-radio class="plyr__control" data-plyr="quality">
530
+ <span data-part="label"></span>
531
+ </media-radio>
532
+ </template>
533
+ </media-quality-radio-group>
534
+ `;
535
+ }
536
+ function $aria(signal2) {
537
+ return $signal(() => signal2() ? "true" : "false");
538
+ }
539
+ function $i18n(translations, word) {
540
+ return $signal(() => i18n(translations, word));
541
+ }
542
+
543
+ class MediaPlyrLayoutElement extends Host(LitElement, PlyrLayout) {
544
+ static tagName = "media-plyr-layout";
545
+ #media;
546
+ onSetup() {
547
+ this.forwardKeepAlive = false;
548
+ this.#media = useMediaContext();
549
+ }
550
+ onConnect() {
551
+ this.#media.player.el?.setAttribute("data-layout", "plyr");
552
+ onDispose(() => this.#media.player.el?.removeAttribute("data-layout"));
553
+ usePlyrLayoutClasses(this, this.#media);
554
+ effect(() => {
555
+ if (this.$props.customIcons()) {
556
+ new SlotManager([this]).connect();
557
+ } else {
558
+ new PlyrLayoutIconsLoader([this]).connect();
559
+ }
560
+ });
561
+ }
562
+ render() {
563
+ return $signal(this.#render.bind(this));
564
+ }
565
+ #render() {
566
+ const { viewType } = this.#media.$state;
567
+ return viewType() === "audio" ? PlyrAudioLayout() : viewType() === "video" ? PlyrVideoLayout() : null;
568
+ }
569
+ }
570
+
571
+ export { MediaPlyrLayoutElement };