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