@mattebox/player 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/dist/announcer.d.ts +6 -3
  2. package/dist/announcer.d.ts.map +1 -1
  3. package/dist/announcer.js +17 -14
  4. package/dist/announcer.js.map +1 -1
  5. package/dist/cdn/mattebox-player.min.js +3 -3
  6. package/dist/controls/airplay.js +1 -2
  7. package/dist/controls/breaks.d.ts +24 -0
  8. package/dist/controls/breaks.d.ts.map +1 -0
  9. package/dist/controls/breaks.js +20 -0
  10. package/dist/controls/breaks.js.map +1 -0
  11. package/dist/controls/chapters.js +1 -2
  12. package/dist/controls/cues.js +1 -2
  13. package/dist/controls/fullscreen.js +1 -2
  14. package/dist/controls/icons.js +1 -2
  15. package/dist/controls/markers.d.ts +2 -15
  16. package/dist/controls/markers.d.ts.map +1 -1
  17. package/dist/controls/markers.js +1 -2
  18. package/dist/controls/markers.js.map +1 -1
  19. package/dist/controls/menu.js +1 -2
  20. package/dist/controls/native-tracks.js +1 -2
  21. package/dist/controls/pip.js +1 -2
  22. package/dist/controls/quality-names.js +1 -2
  23. package/dist/controls/ranges.js +1 -2
  24. package/dist/controls/session.js +1 -2
  25. package/dist/controls/slider.js +1 -2
  26. package/dist/controls/time.js +1 -2
  27. package/dist/controls/track-names.d.ts +3 -2
  28. package/dist/controls/track-names.d.ts.map +1 -1
  29. package/dist/controls/track-names.js +5 -5
  30. package/dist/controls/track-names.js.map +1 -1
  31. package/dist/dom.js +1 -2
  32. package/dist/element-entry.d.ts +4 -1
  33. package/dist/element-entry.d.ts.map +1 -1
  34. package/dist/element-entry.js +1 -2
  35. package/dist/element-entry.js.map +1 -1
  36. package/dist/element.d.ts +135 -6
  37. package/dist/element.d.ts.map +1 -1
  38. package/dist/element.js +300 -35
  39. package/dist/element.js.map +1 -1
  40. package/dist/elements/airplay-button.js +2 -3
  41. package/dist/elements/airplay-button.js.map +1 -1
  42. package/dist/elements/audio-menu.d.ts +3 -2
  43. package/dist/elements/audio-menu.d.ts.map +1 -1
  44. package/dist/elements/audio-menu.js +18 -12
  45. package/dist/elements/audio-menu.js.map +1 -1
  46. package/dist/elements/chapters-menu.d.ts +2 -1
  47. package/dist/elements/chapters-menu.d.ts.map +1 -1
  48. package/dist/elements/chapters-menu.js +2 -3
  49. package/dist/elements/chapters-menu.js.map +1 -1
  50. package/dist/elements/component.d.ts +9 -0
  51. package/dist/elements/component.d.ts.map +1 -1
  52. package/dist/elements/component.js +16 -2
  53. package/dist/elements/component.js.map +1 -1
  54. package/dist/elements/control-bar.js +1 -2
  55. package/dist/elements/current-time.js +1 -2
  56. package/dist/elements/drm-badge.js +4 -5
  57. package/dist/elements/drm-badge.js.map +1 -1
  58. package/dist/elements/duration.js +1 -2
  59. package/dist/elements/error-screen.d.ts +9 -0
  60. package/dist/elements/error-screen.d.ts.map +1 -1
  61. package/dist/elements/error-screen.js +54 -12
  62. package/dist/elements/error-screen.js.map +1 -1
  63. package/dist/elements/fullscreen-button.js +2 -3
  64. package/dist/elements/fullscreen-button.js.map +1 -1
  65. package/dist/elements/live-button.js +3 -4
  66. package/dist/elements/live-button.js.map +1 -1
  67. package/dist/elements/marker-button.d.ts +1 -0
  68. package/dist/elements/marker-button.d.ts.map +1 -1
  69. package/dist/elements/marker-button.js +18 -13
  70. package/dist/elements/marker-button.js.map +1 -1
  71. package/dist/elements/menu-element.d.ts +3 -2
  72. package/dist/elements/menu-element.d.ts.map +1 -1
  73. package/dist/elements/menu-element.js +3 -4
  74. package/dist/elements/menu-element.js.map +1 -1
  75. package/dist/elements/mute-button.js +2 -3
  76. package/dist/elements/mute-button.js.map +1 -1
  77. package/dist/elements/pip-button.js +2 -3
  78. package/dist/elements/pip-button.js.map +1 -1
  79. package/dist/elements/play-button.js +2 -3
  80. package/dist/elements/play-button.js.map +1 -1
  81. package/dist/elements/quality-menu.d.ts +2 -1
  82. package/dist/elements/quality-menu.d.ts.map +1 -1
  83. package/dist/elements/quality-menu.js +3 -4
  84. package/dist/elements/quality-menu.js.map +1 -1
  85. package/dist/elements/remaining-time.js +1 -2
  86. package/dist/elements/scan-button.d.ts.map +1 -1
  87. package/dist/elements/scan-button.js +2 -3
  88. package/dist/elements/scan-button.js.map +1 -1
  89. package/dist/elements/seek-bar.d.ts +6 -0
  90. package/dist/elements/seek-bar.d.ts.map +1 -1
  91. package/dist/elements/seek-bar.js +29 -10
  92. package/dist/elements/seek-bar.js.map +1 -1
  93. package/dist/elements/shared.js +1 -2
  94. package/dist/elements/skip-button.d.ts.map +1 -1
  95. package/dist/elements/skip-button.js +2 -3
  96. package/dist/elements/skip-button.js.map +1 -1
  97. package/dist/elements/spacer.js +1 -2
  98. package/dist/elements/speed-menu.d.ts +2 -1
  99. package/dist/elements/speed-menu.d.ts.map +1 -1
  100. package/dist/elements/speed-menu.js +3 -4
  101. package/dist/elements/speed-menu.js.map +1 -1
  102. package/dist/elements/spinner.d.ts +1 -1
  103. package/dist/elements/spinner.js +2 -4
  104. package/dist/elements/spinner.js.map +1 -1
  105. package/dist/elements/start-button.d.ts.map +1 -1
  106. package/dist/elements/start-button.js +2 -4
  107. package/dist/elements/start-button.js.map +1 -1
  108. package/dist/elements/subtitles-menu.d.ts +2 -1
  109. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  110. package/dist/elements/subtitles-menu.js +51 -22
  111. package/dist/elements/subtitles-menu.js.map +1 -1
  112. package/dist/elements/time-element.js +1 -2
  113. package/dist/elements/title.d.ts.map +1 -1
  114. package/dist/elements/title.js +11 -5
  115. package/dist/elements/title.js.map +1 -1
  116. package/dist/elements/video-menu.d.ts +2 -1
  117. package/dist/elements/video-menu.d.ts.map +1 -1
  118. package/dist/elements/video-menu.js +12 -12
  119. package/dist/elements/video-menu.js.map +1 -1
  120. package/dist/elements/volume-slider.js +2 -3
  121. package/dist/elements/volume-slider.js.map +1 -1
  122. package/dist/elements/volume.js +1 -2
  123. package/dist/entries/airplay-button.js +1 -2
  124. package/dist/entries/audio-menu.js +1 -2
  125. package/dist/entries/chapters-menu.js +1 -2
  126. package/dist/entries/control-bar.js +1 -2
  127. package/dist/entries/current-time.js +1 -2
  128. package/dist/entries/drm-badge.js +1 -2
  129. package/dist/entries/duration.js +1 -2
  130. package/dist/entries/error-screen.js +1 -2
  131. package/dist/entries/fullscreen-button.js +1 -2
  132. package/dist/entries/live-button.js +1 -2
  133. package/dist/entries/marker-button.js +1 -2
  134. package/dist/entries/mute-button.js +1 -2
  135. package/dist/entries/pip-button.js +1 -2
  136. package/dist/entries/play-button.js +1 -2
  137. package/dist/entries/quality-menu.js +1 -2
  138. package/dist/entries/remaining-time.js +1 -2
  139. package/dist/entries/scan-button.js +1 -2
  140. package/dist/entries/seek-bar.js +1 -2
  141. package/dist/entries/skip-button.js +1 -2
  142. package/dist/entries/spacer.js +1 -2
  143. package/dist/entries/speed-menu.js +1 -2
  144. package/dist/entries/spinner.js +1 -2
  145. package/dist/entries/start-button.js +1 -2
  146. package/dist/entries/subtitles-menu.js +1 -2
  147. package/dist/entries/title.js +1 -2
  148. package/dist/entries/video-menu.js +1 -2
  149. package/dist/entries/volume-slider.js +1 -2
  150. package/dist/entries/volume.js +1 -2
  151. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/asyncToGenerator.js +1 -2
  152. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.js +1 -2
  153. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectSpread2.js +1 -2
  154. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.js +1 -2
  155. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.js +1 -2
  156. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.js +1 -2
  157. package/dist/es2015/announcer.js +18 -15
  158. package/dist/es2015/controls/airplay.js +1 -2
  159. package/dist/es2015/controls/breaks.js +18 -0
  160. package/dist/es2015/controls/chapters.js +2 -3
  161. package/dist/es2015/controls/cues.js +1 -2
  162. package/dist/es2015/controls/fullscreen.js +1 -2
  163. package/dist/es2015/controls/icons.js +1 -2
  164. package/dist/es2015/controls/markers.js +1 -2
  165. package/dist/es2015/controls/menu.js +2 -3
  166. package/dist/es2015/controls/native-tracks.js +1 -2
  167. package/dist/es2015/controls/pip.js +1 -2
  168. package/dist/es2015/controls/quality-names.js +1 -2
  169. package/dist/es2015/controls/ranges.js +1 -2
  170. package/dist/es2015/controls/session.js +1 -2
  171. package/dist/es2015/controls/slider.js +1 -2
  172. package/dist/es2015/controls/time.js +1 -2
  173. package/dist/es2015/controls/track-names.js +5 -5
  174. package/dist/es2015/dom.js +1 -2
  175. package/dist/es2015/element-entry.js +1 -2
  176. package/dist/es2015/element.js +378 -94
  177. package/dist/es2015/elements/airplay-button.js +2 -4
  178. package/dist/es2015/elements/audio-menu.js +18 -16
  179. package/dist/es2015/elements/chapters-menu.js +2 -3
  180. package/dist/es2015/elements/component.js +18 -2
  181. package/dist/es2015/elements/control-bar.js +1 -2
  182. package/dist/es2015/elements/current-time.js +1 -2
  183. package/dist/es2015/elements/drm-badge.js +5 -7
  184. package/dist/es2015/elements/duration.js +1 -2
  185. package/dist/es2015/elements/error-screen.js +56 -13
  186. package/dist/es2015/elements/fullscreen-button.js +2 -4
  187. package/dist/es2015/elements/live-button.js +3 -5
  188. package/dist/es2015/elements/marker-button.js +19 -14
  189. package/dist/es2015/elements/menu-element.js +3 -8
  190. package/dist/es2015/elements/mute-button.js +3 -4
  191. package/dist/es2015/elements/pip-button.js +2 -4
  192. package/dist/es2015/elements/play-button.js +2 -4
  193. package/dist/es2015/elements/quality-menu.js +4 -5
  194. package/dist/es2015/elements/remaining-time.js +1 -2
  195. package/dist/es2015/elements/scan-button.js +3 -4
  196. package/dist/es2015/elements/seek-bar.js +36 -17
  197. package/dist/es2015/elements/shared.js +1 -2
  198. package/dist/es2015/elements/skip-button.js +2 -4
  199. package/dist/es2015/elements/spacer.js +1 -2
  200. package/dist/es2015/elements/speed-menu.js +4 -5
  201. package/dist/es2015/elements/spinner.js +2 -5
  202. package/dist/es2015/elements/start-button.js +3 -5
  203. package/dist/es2015/elements/subtitles-menu.js +53 -31
  204. package/dist/es2015/elements/time-element.js +1 -2
  205. package/dist/es2015/elements/title.js +12 -6
  206. package/dist/es2015/elements/video-menu.js +12 -12
  207. package/dist/es2015/elements/volume-slider.js +3 -4
  208. package/dist/es2015/elements/volume.js +1 -2
  209. package/dist/es2015/entries/airplay-button.js +1 -2
  210. package/dist/es2015/entries/audio-menu.js +1 -2
  211. package/dist/es2015/entries/chapters-menu.js +1 -2
  212. package/dist/es2015/entries/control-bar.js +1 -2
  213. package/dist/es2015/entries/current-time.js +1 -2
  214. package/dist/es2015/entries/drm-badge.js +1 -2
  215. package/dist/es2015/entries/duration.js +1 -2
  216. package/dist/es2015/entries/error-screen.js +1 -2
  217. package/dist/es2015/entries/fullscreen-button.js +1 -2
  218. package/dist/es2015/entries/live-button.js +1 -2
  219. package/dist/es2015/entries/marker-button.js +1 -2
  220. package/dist/es2015/entries/mute-button.js +1 -2
  221. package/dist/es2015/entries/pip-button.js +1 -2
  222. package/dist/es2015/entries/play-button.js +1 -2
  223. package/dist/es2015/entries/quality-menu.js +1 -2
  224. package/dist/es2015/entries/remaining-time.js +1 -2
  225. package/dist/es2015/entries/scan-button.js +1 -2
  226. package/dist/es2015/entries/seek-bar.js +1 -2
  227. package/dist/es2015/entries/skip-button.js +1 -2
  228. package/dist/es2015/entries/spacer.js +1 -2
  229. package/dist/es2015/entries/speed-menu.js +1 -2
  230. package/dist/es2015/entries/spinner.js +1 -2
  231. package/dist/es2015/entries/start-button.js +1 -2
  232. package/dist/es2015/entries/subtitles-menu.js +1 -2
  233. package/dist/es2015/entries/title.js +1 -2
  234. package/dist/es2015/entries/video-menu.js +1 -2
  235. package/dist/es2015/entries/volume-slider.js +1 -2
  236. package/dist/es2015/entries/volume.js +1 -2
  237. package/dist/es2015/host.js +1 -2
  238. package/dist/es2015/ids.js +33 -0
  239. package/dist/es2015/index.js +2 -1
  240. package/dist/es2015/labels.js +1 -2
  241. package/dist/es2015/locales/ar.js +75 -0
  242. package/dist/es2015/locales/ca.js +75 -0
  243. package/dist/es2015/locales/de.js +75 -0
  244. package/dist/es2015/locales/es.js +75 -0
  245. package/dist/es2015/locales/fr.js +75 -0
  246. package/dist/es2015/locales/hi.js +75 -0
  247. package/dist/es2015/locales/it.js +75 -0
  248. package/dist/es2015/locales/ja.js +75 -0
  249. package/dist/es2015/locales/ko.js +75 -0
  250. package/dist/es2015/locales/pt.js +75 -0
  251. package/dist/es2015/locales/zh.js +75 -0
  252. package/dist/es2015/locales.js +61 -0
  253. package/dist/es2015/namespaces.js +1 -2
  254. package/dist/es2015/presets.js +2 -3
  255. package/dist/es2015/style.js +1 -2
  256. package/dist/es2015/surface.js +12 -4
  257. package/dist/es2015/tags.js +1 -2
  258. package/dist/es2015/text.js +15 -0
  259. package/dist/es2015/trackers.js +43 -0
  260. package/dist/es2015/video-sources.js +2 -3
  261. package/dist/host.d.ts +71 -2
  262. package/dist/host.d.ts.map +1 -1
  263. package/dist/host.js +1 -2
  264. package/dist/host.js.map +1 -1
  265. package/dist/ids.d.ts +19 -0
  266. package/dist/ids.d.ts.map +1 -0
  267. package/dist/ids.js +34 -0
  268. package/dist/ids.js.map +1 -0
  269. package/dist/index.d.ts +9 -1
  270. package/dist/index.d.ts.map +1 -1
  271. package/dist/index.js +2 -1
  272. package/dist/labels.js +1 -2
  273. package/dist/locales/ar.d.ts +75 -0
  274. package/dist/locales/ar.d.ts.map +1 -0
  275. package/dist/locales/ar.js +77 -0
  276. package/dist/locales/ar.js.map +1 -0
  277. package/dist/locales/ca.d.ts +75 -0
  278. package/dist/locales/ca.d.ts.map +1 -0
  279. package/dist/locales/ca.js +77 -0
  280. package/dist/locales/ca.js.map +1 -0
  281. package/dist/locales/de.d.ts +75 -0
  282. package/dist/locales/de.d.ts.map +1 -0
  283. package/dist/locales/de.js +77 -0
  284. package/dist/locales/de.js.map +1 -0
  285. package/dist/locales/es.d.ts +75 -0
  286. package/dist/locales/es.d.ts.map +1 -0
  287. package/dist/locales/es.js +77 -0
  288. package/dist/locales/es.js.map +1 -0
  289. package/dist/locales/fr.d.ts +75 -0
  290. package/dist/locales/fr.d.ts.map +1 -0
  291. package/dist/locales/fr.js +77 -0
  292. package/dist/locales/fr.js.map +1 -0
  293. package/dist/locales/hi.d.ts +75 -0
  294. package/dist/locales/hi.d.ts.map +1 -0
  295. package/dist/locales/hi.js +77 -0
  296. package/dist/locales/hi.js.map +1 -0
  297. package/dist/locales/it.d.ts +75 -0
  298. package/dist/locales/it.d.ts.map +1 -0
  299. package/dist/locales/it.js +77 -0
  300. package/dist/locales/it.js.map +1 -0
  301. package/dist/locales/ja.d.ts +75 -0
  302. package/dist/locales/ja.d.ts.map +1 -0
  303. package/dist/locales/ja.js +77 -0
  304. package/dist/locales/ja.js.map +1 -0
  305. package/dist/locales/ko.d.ts +75 -0
  306. package/dist/locales/ko.d.ts.map +1 -0
  307. package/dist/locales/ko.js +77 -0
  308. package/dist/locales/ko.js.map +1 -0
  309. package/dist/locales/pt.d.ts +75 -0
  310. package/dist/locales/pt.d.ts.map +1 -0
  311. package/dist/locales/pt.js +77 -0
  312. package/dist/locales/pt.js.map +1 -0
  313. package/dist/locales/zh.d.ts +75 -0
  314. package/dist/locales/zh.d.ts.map +1 -0
  315. package/dist/locales/zh.js +77 -0
  316. package/dist/locales/zh.js.map +1 -0
  317. package/dist/locales.d.ts +27 -0
  318. package/dist/locales.d.ts.map +1 -0
  319. package/dist/locales.js +48 -0
  320. package/dist/locales.js.map +1 -0
  321. package/dist/messages.d.ts +167 -0
  322. package/dist/messages.d.ts.map +1 -0
  323. package/dist/namespaces.js +1 -2
  324. package/dist/presets.js +1 -2
  325. package/dist/style.js +1 -2
  326. package/dist/surface.d.ts +4 -1
  327. package/dist/surface.d.ts.map +1 -1
  328. package/dist/surface.js +12 -4
  329. package/dist/surface.js.map +1 -1
  330. package/dist/tags.js +1 -2
  331. package/dist/text.d.ts +14 -0
  332. package/dist/text.d.ts.map +1 -0
  333. package/dist/text.js +16 -0
  334. package/dist/text.js.map +1 -0
  335. package/dist/trackers.d.ts +18 -0
  336. package/dist/trackers.d.ts.map +1 -0
  337. package/dist/trackers.js +45 -0
  338. package/dist/trackers.js.map +1 -0
  339. package/dist/video-sources.js +1 -2
  340. package/package.json +11 -3
@@ -1,7 +1,7 @@
1
1
  import { icon } from "../controls/icons.js";
2
2
  import { Component } from "./component.js";
3
3
  import { BUTTON_STYLE, HELD, iconSlots, show, shownPaused, style } from "./shared.js";
4
- //#region src/elements/play-button.ts
4
+ // src/elements/play-button.ts
5
5
  /**
6
6
  * <mbx-play-button>: play, pause, or replay once the media has ended. It
7
7
  * reads the video on the events the video already fires and writes one
@@ -61,13 +61,11 @@ var MbxPlayButton = class extends Component {
61
61
  this.render();
62
62
  }
63
63
  render() {
64
- var _this$getAttribute;
65
64
  const player = this.player;
66
65
  if (player === null) return;
67
66
  const state = player.video.ended ? "replay" : shownPaused(player) ? "play" : "pause";
68
67
  show(this.slots, state);
69
- this.button.setAttribute("aria-label", (_this$getAttribute = this.getAttribute(`label-${state}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : LABELS[state]);
68
+ this.button.setAttribute("aria-label", this.word(`label-${state}`, state, LABELS[state]));
70
69
  }
71
70
  };
72
- //#endregion
73
71
  export { MbxPlayButton };
@@ -1,7 +1,7 @@
1
1
  import { show } from "./shared.js";
2
2
  import { MenuElement, single } from "./menu-element.js";
3
3
  import { qualityLabels, qualityNames } from "../controls/quality-names.js";
4
- //#region src/elements/quality-menu.ts
4
+ // src/elements/quality-menu.ts
5
5
  const AUTO = "auto";
6
6
  var MbxQualityMenu = class extends MenuElement {
7
7
  static get observedAttributes() {
@@ -18,7 +18,7 @@ var MbxQualityMenu = class extends MenuElement {
18
18
  show(this.slots, "default");
19
19
  }
20
20
  name() {
21
- return "Quality";
21
+ return ["quality", "Quality"];
22
22
  }
23
23
  attach(player) {
24
24
  this.follow(player, (engine) => {
@@ -44,7 +44,7 @@ var MbxQualityMenu = class extends MenuElement {
44
44
  });
45
45
  }
46
46
  render() {
47
- var _this$getAttribute, _quality$pinned;
47
+ var _quality$pinned;
48
48
  super.render();
49
49
  const engine = this.engine;
50
50
  if (engine === null) {
@@ -55,7 +55,7 @@ var MbxQualityMenu = class extends MenuElement {
55
55
  this.playing = this.playingName();
56
56
  const items = [[
57
57
  AUTO,
58
- (_this$getAttribute = this.getAttribute("label-auto")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Auto",
58
+ this.word("label-auto", "qualityAuto", "Auto"),
59
59
  this.playing
60
60
  ], ...qualityNames(quality.selectable)];
61
61
  this.menu.fill([{
@@ -79,5 +79,4 @@ var MbxQualityMenu = class extends MenuElement {
79
79
  return (_qualityLabels$find = qualityLabels(quality.selectable).find(([candidate]) => candidate === id)) === null || _qualityLabels$find === void 0 ? void 0 : _qualityLabels$find[1];
80
80
  }
81
81
  };
82
- //#endregion
83
82
  export { MbxQualityMenu };
@@ -1,7 +1,7 @@
1
1
  import { format } from "../controls/time.js";
2
2
  import { live, span } from "../controls/session.js";
3
3
  import { TimeElement } from "./time-element.js";
4
- //#region src/elements/remaining-time.ts
4
+ // src/elements/remaining-time.ts
5
5
  /**
6
6
  * <mbx-remaining-time>: what is left, "-4:53", once the metadata is in. A
7
7
  * bar that shows one number shows this one: a viewer asks how much is
@@ -23,5 +23,4 @@ var MbxRemainingTime = class extends TimeElement {
23
23
  if (!on) this.text.data = `-${format(Math.max(0, span(video, engine).end - video.currentTime))}`;
24
24
  }
25
25
  };
26
- //#endregion
27
26
  export { MbxRemainingTime };
@@ -3,7 +3,7 @@ import { icon } from "../controls/icons.js";
3
3
  import { Component } from "./component.js";
4
4
  import { BUTTON_STYLE, style } from "./shared.js";
5
5
  import { optional } from "../controls/session.js";
6
- //#region src/elements/scan-button.ts
6
+ // src/elements/scan-button.ts
7
7
  /**
8
8
  * <mbx-scan-button>: fast forward, or rewind with `direction="backward"`,
9
9
  * through the I-frame track: `engine.trick.setRate`, see the engine guide's
@@ -97,7 +97,7 @@ var MbxScanButton = class extends Component {
97
97
  });
98
98
  }
99
99
  render() {
100
- var _this$player$engine2, _this$player2, _trick$rate, _this$getAttribute2;
100
+ var _this$player$engine2, _this$player2, _trick$rate;
101
101
  const trick = optional((_this$player$engine2 = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine2 !== void 0 ? _this$player$engine2 : null).trick;
102
102
  const backward = this.backward();
103
103
  const player = this.player;
@@ -110,9 +110,8 @@ var MbxScanButton = class extends Component {
110
110
  this.badge.hidden = !on;
111
111
  this.badge.textContent = on ? `${Math.abs(rate)}×` : "";
112
112
  setChildren(this.glyph, icon(backward ? "fast-backward" : "fast-forward"));
113
- const name = (_this$getAttribute2 = this.getAttribute("label")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : backward ? "Rewind" : "Fast forward";
113
+ const name = backward ? this.word("label", "rewind", "Rewind") : this.word("label", "fastForward", "Fast forward");
114
114
  this.button.setAttribute("aria-label", name);
115
115
  }
116
116
  };
117
- //#endregion
118
117
  export { MbxScanButton };
@@ -7,8 +7,8 @@ import { format } from "../controls/time.js";
7
7
  import { bufferGoal, live, optional, span, wall } from "../controls/session.js";
8
8
  import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
9
9
  import { slider } from "../controls/slider.js";
10
- //#region src/elements/seek-bar.ts
11
- const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:1em;height:1em;margin:-.5em 0 0 -.5em;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked]{pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked-range]{background:var(--mbx-blocked,#000000bf);position:absolute;top:0;bottom:0}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:.3077em;padding:.1538em;font-size:.8125em;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:.125em}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 .3077em}[part~=preview-title]{text-overflow:ellipsis;max-width:18.4615em;padding:0 .3077em;overflow:hidden}[hidden]{display:none}";
10
+ // src/elements/seek-bar.ts
11
+ const STYLE_CSS = ":host,[part~=slider]{flex:1}[part~=thumb]{width:1em;height:1em;margin:-.5em 0 0 -.5em;box-shadow:0 1px 3px #0006}[part~=buffered]{position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked]{pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0}[part~=blocked-range]{background:var(--mbx-blocked,#000000bf);position:absolute;top:0;bottom:0}[part~=break]{background:var(--mbx-ad,#f5c518);width:.25em;margin-left:-.125em;position:absolute;top:0;bottom:0}[part~=break][part~=span]{margin-left:0}[part~=break][part~=played]{opacity:.4}[part~=buffered-range]{background:#ffffff4d;position:absolute;top:0;bottom:0}[part~=hover]{background:var(--mbx-text);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=edge]{background:var(--mbx-live);width:.125em;margin-left:-1px;position:absolute;top:0;bottom:0}[part~=preview]{background:var(--mbx-surface);border-radius:var(--mbx-radius);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;flex-direction:column;align-items:center;margin-bottom:.3077em;padding:.1538em;font-size:.8125em;display:flex;position:absolute;bottom:100%;transform:translate(-50%)}[part~=preview]>:not([hidden])~:not([hidden]){margin-top:.125em}[part~=preview-image]{border-radius:2px;position:relative;overflow:hidden}[part~=preview-frame]{border-radius:2px;display:block}[part~=preview-tile]{transform-origin:0 0;background-repeat:no-repeat;position:absolute;top:0;left:0}[part~=preview-time]{padding:0 .3077em}[part~=preview-title]{text-overflow:ellipsis;max-width:18.4615em;padding:0 .3077em;overflow:hidden}[hidden]{display:none}";
12
12
  const STEP = 5;
13
13
  /** Under `key-mode="preview"`, a target seeks this long after the last key. */
14
14
  const KEY_COMMIT_MS = 1e3;
@@ -79,6 +79,7 @@ var MbxSeekBar = class extends Component {
79
79
  super();
80
80
  this.range = EMPTY;
81
81
  this.pending = null;
82
+ this.written = null;
82
83
  this.frame = 0;
83
84
  this.divided = "";
84
85
  this.list = [];
@@ -107,12 +108,13 @@ var MbxSeekBar = class extends Component {
107
108
  });
108
109
  this.buffered = el("div", "buffered");
109
110
  this.blocked = el("div", "blocked");
111
+ this.breaks = el("div", "breaks");
110
112
  this.hover = el("div", "hover");
111
113
  this.edge = el("div", "edge");
112
114
  this.hover.hidden = true;
113
115
  this.edge.hidden = true;
114
116
  this.bar.track.prepend(this.buffered);
115
- this.bar.track.append(this.blocked, this.hover, this.edge);
117
+ this.bar.track.append(this.blocked, this.breaks, this.hover, this.edge);
116
118
  this.preview = el("div", "preview");
117
119
  this.image = el("div", "preview-image");
118
120
  this.tile = el("div", "preview-tile");
@@ -165,17 +167,16 @@ var MbxSeekBar = class extends Component {
165
167
  }
166
168
  /** What a screen reader hears at a time. */
167
169
  say(time) {
168
- var _this$player$engine2, _this$player2, _this$getAttribute2;
170
+ var _this$player$engine2, _this$player2;
169
171
  const engine = (_this$player$engine2 = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine2 !== void 0 ? _this$player$engine2 : null;
170
172
  if (!this.isLive()) {
171
- var _this$getAttribute;
172
- const template = (_this$getAttribute = this.getAttribute("label-of")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "{current} of {duration}";
173
+ const template = this.word("label-of", "seekOf", "{current} of {duration}");
173
174
  return Number.isFinite(this.range.end) && this.range.end > 0 ? fill(template, {
174
175
  current: format(time),
175
176
  duration: format(this.range.end)
176
177
  }) : format(time);
177
178
  }
178
- const behind = fill((_this$getAttribute2 = this.getAttribute("label-behind")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "{time} behind live", { time: format(this.range.end - time) });
179
+ const behind = fill(this.word("label-behind", "behindLive", "{time} behind live"), { time: format(this.range.end - time) });
179
180
  const clock = wall(engine, time);
180
181
  return clock === null ? behind : `${clock}, ${behind}`;
181
182
  }
@@ -218,6 +219,8 @@ var MbxSeekBar = class extends Component {
218
219
  const drag = this.drag;
219
220
  this.drag = "none";
220
221
  this.dragged = null;
222
+ const written = this.written;
223
+ this.written = null;
221
224
  const player = this.player;
222
225
  if (player === null) return;
223
226
  if (drag === "scrub") {
@@ -225,7 +228,7 @@ var MbxSeekBar = class extends Component {
225
228
  if (value === null) trick === null || trick === void 0 || trick.scrubEnd();
226
229
  else trick === null || trick === void 0 || trick.scrubEnd(value);
227
230
  } else {
228
- if (value !== null) player.video.currentTime = value;
231
+ if (value !== null && value !== written) player.video.currentTime = value;
229
232
  if (this.resume) player.video.play().catch(() => void 0);
230
233
  this.resume = false;
231
234
  }
@@ -316,6 +319,7 @@ var MbxSeekBar = class extends Component {
316
319
  const video = (_this$player11 = this.player) === null || _this$player11 === void 0 ? void 0 : _this$player11.video;
317
320
  if (this.pending === null || video === void 0) return;
318
321
  video.currentTime = this.pending;
322
+ if (this.drag === "seek") this.written = this.pending;
319
323
  this.pending = null;
320
324
  }
321
325
  /** The width the page asked for through the token, or the default. */
@@ -409,12 +413,28 @@ var MbxSeekBar = class extends Component {
409
413
  node.style.width = percent(part[1] - part[0]);
410
414
  }
411
415
  }
416
+ /** The ad breaks inside the bar's range: a tick at each start, a span where one replaces a part. */
417
+ paintBreaks() {
418
+ var _this$player$breaks$l, _this$player14, _this$breaks$lastElem;
419
+ const { start, end } = this.range;
420
+ const marks = ((_this$player$breaks$l = (_this$player14 = this.player) === null || _this$player14 === void 0 ? void 0 : _this$player14.breaks.list) !== null && _this$player$breaks$l !== void 0 ? _this$player$breaks$l : []).filter((mark) => mark.start >= start && mark.start <= end);
421
+ while (this.breaks.childElementCount > marks.length) (_this$breaks$lastElem = this.breaks.lastElementChild) === null || _this$breaks$lastElem === void 0 || _this$breaks$lastElem.remove();
422
+ while (this.breaks.childElementCount < marks.length) this.breaks.append(el("div", "break"));
423
+ marks.forEach((mark, i) => {
424
+ var _mark$end;
425
+ const node = this.breaks.children[i];
426
+ const span = mark.end !== void 0 && mark.end > mark.start;
427
+ node.setAttribute("part", `break${span ? " span" : ""}${mark.played === true ? " played" : ""}`);
428
+ node.style.left = percent(fraction(mark.start, this.range));
429
+ node.style.width = span ? percent(fraction(Math.min((_mark$end = mark.end) !== null && _mark$end !== void 0 ? _mark$end : end, end), this.range) - fraction(mark.start, this.range)) : "";
430
+ });
431
+ }
412
432
  /** Whether a live window is wide enough to be worth a bar. */
413
433
  worthSeeking() {
414
- var _bufferGoal, _this$player$engine7, _this$player14;
434
+ var _bufferGoal, _this$player$engine7, _this$player15;
415
435
  const goals = number(this, "live-window", LIVE_WINDOW);
416
436
  if (goals === 0) return true;
417
- const goal = (_bufferGoal = bufferGoal((_this$player$engine7 = (_this$player14 = this.player) === null || _this$player14 === void 0 ? void 0 : _this$player14.engine) !== null && _this$player$engine7 !== void 0 ? _this$player$engine7 : null)) !== null && _bufferGoal !== void 0 ? _bufferGoal : BUFFER_GOAL;
437
+ const goal = (_bufferGoal = bufferGoal((_this$player$engine7 = (_this$player15 = this.player) === null || _this$player15 === void 0 ? void 0 : _this$player15.engine) !== null && _this$player$engine7 !== void 0 ? _this$player$engine7 : null)) !== null && _bufferGoal !== void 0 ? _bufferGoal : BUFFER_GOAL;
418
438
  return this.range.end - this.range.start >= goals * goal;
419
439
  }
420
440
  /** The hover marker and the preview follow the pointer, clamped to the bar. */
@@ -428,15 +448,15 @@ var MbxSeekBar = class extends Component {
428
448
  }
429
449
  /** The preview over `part` of the bar: the time, the chapter, and the picture. */
430
450
  previewAt(part) {
431
- var _this$player15, _ref, _blocked$label, _chapter$title;
451
+ var _this$player16, _chapter$title;
432
452
  const rect = this.bar.rail.getBoundingClientRect();
433
453
  if (rect.width === 0 || this.range.end <= this.range.start) return;
434
454
  this.preview.hidden = false;
435
455
  const when = at(part, this.range);
436
456
  this.time.textContent = this.label(when);
437
457
  const chapter = this.chaptered("titles") ? this.list[chapterAt(this.list, when)] : void 0;
438
- const blocked = (_this$player15 = this.player) === null || _this$player15 === void 0 ? void 0 : _this$player15.markers.within(when).find((marker) => marker.kind === "blocked");
439
- const title = blocked ? (_ref = (_blocked$label = blocked.label) !== null && _blocked$label !== void 0 ? _blocked$label : this.getAttribute("label-blocked")) !== null && _ref !== void 0 ? _ref : "Not available" : (_chapter$title = chapter === null || chapter === void 0 ? void 0 : chapter.title) !== null && _chapter$title !== void 0 ? _chapter$title : "";
458
+ const blocked = (_this$player16 = this.player) === null || _this$player16 === void 0 ? void 0 : _this$player16.markers.within(when).find((marker) => marker.kind === "blocked");
459
+ const title = blocked ? blocked.label === void 0 ? this.word("label-blocked", "blocked", "Not available") : this.pageText(blocked.label) : (_chapter$title = chapter === null || chapter === void 0 ? void 0 : chapter.title) !== null && _chapter$title !== void 0 ? _chapter$title : "";
440
460
  this.caption.hidden = title === "";
441
461
  this.caption.textContent = title;
442
462
  if (blocked) {
@@ -459,7 +479,7 @@ var MbxSeekBar = class extends Component {
459
479
  };
460
480
  this.listen(player.video, EVENTS, tick);
461
481
  this.keep(followChapters(player, tick));
462
- this.listen(player, ["markerschange"], tick);
482
+ this.listen(player, ["markerschange", "breakschange"], tick);
463
483
  this.listen(player, ["sourcechange"], () => {
464
484
  this.drag = "none";
465
485
  this.stopAiming();
@@ -493,7 +513,6 @@ var MbxSeekBar = class extends Component {
493
513
  player.removeAttribute("scrubbing");
494
514
  }
495
515
  render() {
496
- var _this$getAttribute3;
497
516
  const player = this.player;
498
517
  if (player === null) return;
499
518
  const video = player.video;
@@ -502,10 +521,11 @@ var MbxSeekBar = class extends Component {
502
521
  const on = api !== void 0;
503
522
  this.range = span(video, engine);
504
523
  this.list = chapters(video, engine);
505
- this.bar.label((_this$getAttribute3 = this.getAttribute("label")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Seek");
524
+ this.bar.label(this.word("label", "seek", "Seek"));
506
525
  this.bar.range(this.range.start, this.range.end);
507
526
  this.paintRanges(this.buffered, spans(video.buffered), "buffered-range");
508
527
  this.paintRanges(this.blocked, this.blockedRanges(), "blocked-range");
528
+ this.paintBreaks();
509
529
  this.paintChapters();
510
530
  this.edge.hidden = !on;
511
531
  if (api !== void 0 && api.edge !== null) this.edge.style.left = percent(fraction(api.edge, this.range));
@@ -516,5 +536,4 @@ var MbxSeekBar = class extends Component {
516
536
  if (!this.bar.dragging() && this.target === null) this.bar.set(video.currentTime, this.say(video.currentTime));
517
537
  }
518
538
  };
519
- //#endregion
520
539
  export { MbxSeekBar };
@@ -1,4 +1,4 @@
1
- //#region src/elements/shared.ts
1
+ // src/elements/shared.ts
2
2
  const BUTTON_STYLE_CSS = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{width:2.5em;height:2.5em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[part~=button][aria-label]:after{content:attr(aria-label);display:var(--mbx-tooltip,block);background:var(--mbx-surface);border-radius:var(--mbx-radius);white-space:nowrap;pointer-events:none;opacity:0;margin-bottom:.4615em;padding:.3077em .6154em;font-size:.8125em;transition:opacity .1s;position:absolute;bottom:100%;left:50%;transform:translate(-50%)}[part~=button][aria-label]:focus:after{opacity:1;transition-delay:.4s}[part~=button][aria-label]:focus:not(:focus-visible):after{opacity:0;transition-delay:0s}@media (hover:hover){[part~=button][aria-label]:hover:after{opacity:1;transition-delay:.4s}}:host(:last-child) [part~=button][aria-label]:after{left:auto;right:0;transform:none}[part~=button]:hover{opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}slot[hidden]{display:none}";
3
3
  const SLIDER_STYLE_CSS = ":host{display:block}:host([hidden]){display:none}[part~=slider]{border-radius:var(--mbx-radius);cursor:pointer;touch-action:none;height:2.5em;position:relative}[part~=slider]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=slider]:focus:not(:focus-visible){outline:none}[part~=rail]{position:absolute;top:0;bottom:0;left:.5em;right:.5em}[part~=track]{background:#ffffff59;border-radius:2px;height:.25em;position:absolute;top:50%;left:0;right:0;overflow:hidden;transform:translateY(-50%)}[part~=fill]{background:var(--mbx-accent);position:absolute;top:0;bottom:0;left:0}[part~=thumb]{background:var(--mbx-text);pointer-events:none;border-radius:50%;width:.75em;height:.75em;margin:-.375em 0 0 -.375em;position:absolute;top:50%}";
4
4
  const BUTTON_STYLE = BUTTON_STYLE_CSS;
@@ -57,5 +57,4 @@ function shownPaused(player, names = HELD) {
57
57
  }
58
58
  return player.video.paused;
59
59
  }
60
- //#endregion
61
60
  export { BUTTON_STYLE, HELD, MENU_STYLE, SLIDER_STYLE, iconSlots, number, seekRow, show, shownPaused, style };
@@ -3,7 +3,7 @@ import { fill } from "../labels.js";
3
3
  import { icon } from "../controls/icons.js";
4
4
  import { Component } from "./component.js";
5
5
  import { BUTTON_STYLE, style } from "./shared.js";
6
- //#region src/elements/skip-button.ts
6
+ // src/elements/skip-button.ts
7
7
  const SECONDS = 10;
8
8
  /** The glyph for a skip amount: the set draws 5, 10, 15 and 30, and a plain arrow says the rest. */
9
9
  function glyphFor(back, amount) {
@@ -47,14 +47,12 @@ var MbxSkipButton = class extends Component {
47
47
  this.render();
48
48
  }
49
49
  render() {
50
- var _this$getAttribute2;
51
50
  const seconds = this.seconds();
52
51
  const back = seconds < 0;
53
52
  const amount = Math.abs(seconds);
54
53
  setChildren(this.glyph, icon(glyphFor(back, amount)));
55
- const template = (_this$getAttribute2 = this.getAttribute("label")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : back ? "Back {seconds} seconds" : "Forward {seconds} seconds";
54
+ const template = back ? this.word("label", "skipBack", "Back {seconds} seconds") : this.word("label", "skipForward", "Forward {seconds} seconds");
56
55
  this.button.setAttribute("aria-label", fill(template, { seconds: amount }));
57
56
  }
58
57
  };
59
- //#endregion
60
58
  export { MbxSkipButton };
@@ -1,5 +1,5 @@
1
1
  import { style } from "./shared.js";
2
- //#region src/elements/spacer.ts
2
+ // src/elements/spacer.ts
3
3
  /** <mbx-spacer>: takes the room in a row, so what follows sits at the far end. */
4
4
  const STYLE = ":host{flex:auto;display:block}";
5
5
  var MbxSpacer = class extends HTMLElement {
@@ -8,5 +8,4 @@ var MbxSpacer = class extends HTMLElement {
8
8
  this.attachShadow({ mode: "open" }).append(style(STYLE));
9
9
  }
10
10
  };
11
- //#endregion
12
11
  export { MbxSpacer };
@@ -1,6 +1,6 @@
1
1
  import { show } from "./shared.js";
2
2
  import { MenuElement, single } from "./menu-element.js";
3
- //#region src/elements/speed-menu.ts
3
+ // src/elements/speed-menu.ts
4
4
  const RATES = [
5
5
  .5,
6
6
  .75,
@@ -23,7 +23,7 @@ var MbxSpeedMenu = class extends MenuElement {
23
23
  show(this.slots, "default");
24
24
  }
25
25
  name() {
26
- return "Playback speed";
26
+ return ["speed", "Playback speed"];
27
27
  }
28
28
  rates() {
29
29
  const raw = this.getAttribute("rates");
@@ -38,11 +38,11 @@ var MbxSpeedMenu = class extends MenuElement {
38
38
  this.render();
39
39
  }
40
40
  render() {
41
- var _this$player, _this$getAttribute;
41
+ var _this$player;
42
42
  super.render();
43
43
  const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
44
44
  if (video === void 0) return;
45
- const normal = (_this$getAttribute = this.getAttribute("label-normal")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Normal";
45
+ const normal = this.word("label-normal", "speedNormal", "Normal");
46
46
  const items = this.rates().map((rate) => [String(rate), rate === 1 ? normal : `${rate}×`]);
47
47
  const current = String(video.playbackRate);
48
48
  if (!items.some(([id]) => id === current)) items.push([current, `${current}×`]);
@@ -56,5 +56,4 @@ var MbxSpeedMenu = class extends MenuElement {
56
56
  }]);
57
57
  }
58
58
  };
59
- //#endregion
60
59
  export { MbxSpeedMenu };
@@ -1,11 +1,10 @@
1
1
  import { Component } from "./component.js";
2
2
  import { style } from "./shared.js";
3
- //#region src/elements/spinner.ts
3
+ // src/elements/spinner.ts
4
4
  const STYLE = ":host{pointer-events:none;width:2.75em;height:2.75em;color:var(--mbx-text);filter:drop-shadow(0 1px 3px #00000080);margin:-1.375em 0 0 -1.375em;display:none;position:absolute;top:50%;left:50%}:host([waiting]){display:block}:host([hidden]){display:none}[part~=ring]{box-sizing:border-box;border:3px solid #ffffff38;border-top-color:currentColor;border-radius:50%;width:100%;height:100%;animation:.8s linear infinite mbx-turn}[part~=ring][hidden],slot[hidden]{display:none}::slotted(*){width:100%;height:100%}@keyframes mbx-turn{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[part~=ring]{animation:none}}";
5
5
  /** What the video fires as it waits and as it goes on. */
6
6
  const EVENTS = [
7
7
  "waiting",
8
- "stalled",
9
8
  "playing",
10
9
  "canplay",
11
10
  "emptied"
@@ -42,12 +41,10 @@ var MbxSpinner = class extends Component {
42
41
  this.removeAttribute("waiting");
43
42
  }
44
43
  render() {
45
- var _this$getAttribute;
46
44
  const player = this.player;
47
45
  if (player === null) return;
48
- this.setAttribute("aria-label", (_this$getAttribute = this.getAttribute("label")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Loading");
46
+ this.setAttribute("aria-label", this.word("label", "loading", "Loading"));
49
47
  this.toggleAttribute("waiting", player.hasAttribute("waiting"));
50
48
  }
51
49
  };
52
- //#endregion
53
50
  export { MbxSpinner };
@@ -1,7 +1,7 @@
1
1
  import { icon } from "../controls/icons.js";
2
2
  import { Component } from "./component.js";
3
3
  import { BUTTON_STYLE, HELD, iconSlots, show, shownPaused, style } from "./shared.js";
4
- //#region src/elements/start-button.ts
4
+ // src/elements/start-button.ts
5
5
  const STYLE_CSS = ":host{--mbx-tooltip:none;top:var(--mbx-start-top,50%);margin:-2.5em 0 0 -2.5em;position:absolute;left:50%}[part~=button]{z-index:0;width:5em;height:5em;color:var(--mbx-text);background:0 0;border:0;transition:color .15s;position:relative}[part~=button]:before{content:\"\";z-index:-1;background:var(--mbx-surface);opacity:.88;clip-path:polygon(0 0,79% 0,100% 21%,100% 100%,21% 100%,0 79%);transition:opacity .15s,background .15s;position:absolute;top:0;bottom:0;left:0;right:0}[part~=button]:hover{color:var(--mbx-surface)}[part~=button]:hover:before{background:var(--mbx-accent);opacity:1}:host([cramped]){display:none}[part~=icon],::slotted(*){width:3em;height:3em}slot[name=icon-play]>[part~=icon]{margin-left:.125em}@media (prefers-reduced-motion:reduce){[part~=button],[part~=button]:before{transition:none}}";
6
6
  const STATES = ["play", "replay"];
7
7
  const STYLE = BUTTON_STYLE + STYLE_CSS;
@@ -32,7 +32,6 @@ var MbxStartButton = class extends Component {
32
32
  "pause",
33
33
  "ended",
34
34
  "waiting",
35
- "stalled",
36
35
  "canplay"
37
36
  ], () => {
38
37
  this.render();
@@ -111,15 +110,14 @@ var MbxStartButton = class extends Component {
111
110
  if (cramped !== wasCramped) this.render();
112
111
  }
113
112
  render() {
114
- var _this$player2, _this$getAttribute;
113
+ var _this$player2;
115
114
  const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
116
115
  if (video === void 0) return;
117
116
  const state = video.ended ? "replay" : "play";
118
117
  show(this.slots, state);
119
- this.button.setAttribute("aria-label", (_this$getAttribute = this.getAttribute(`label-${state}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : state === "play" ? "Play" : "Replay");
118
+ this.button.setAttribute("aria-label", state === "play" ? this.word("label-play", "play", "Play") : this.word("label-replay", "replay", "Replay"));
120
119
  const player = this.player;
121
120
  this.hidden = this.failed || player !== null && !shownPaused(player, ["switching"]) || (player === null || player === void 0 ? void 0 : player.hasAttribute("waiting")) === true || (player === null || player === void 0 ? void 0 : player.hasAttribute("scrubbing")) === true;
122
121
  }
123
122
  };
124
- //#endregion
125
123
  export { MbxStartButton };
@@ -5,20 +5,48 @@ import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
5
5
  import { MenuElement } from "./menu-element.js";
6
6
  import { onTracks, trackItems } from "./audio-menu.js";
7
7
  import { isSdh } from "mattebox";
8
- //#region src/elements/subtitles-menu.ts
8
+ // src/elements/subtitles-menu.ts
9
9
  const OFF = "off";
10
10
  const SUBTITLE_SIZE = "subtitle-size";
11
11
  const SUBTITLE_BACKGROUND = "subtitle-background";
12
12
  const SIZES = [
13
- ["small", "Small"],
14
- ["medium", "Medium"],
15
- ["large", "Large"],
16
- ["xlarge", "Extra large"]
13
+ [
14
+ "small",
15
+ "sizeSmall",
16
+ "Small"
17
+ ],
18
+ [
19
+ "medium",
20
+ "sizeMedium",
21
+ "Medium"
22
+ ],
23
+ [
24
+ "large",
25
+ "sizeLarge",
26
+ "Large"
27
+ ],
28
+ [
29
+ "xlarge",
30
+ "sizeExtraLarge",
31
+ "Extra large"
32
+ ]
17
33
  ];
18
34
  const BACKGROUNDS = [
19
- ["none", "None"],
20
- ["dark", "Dark"],
21
- ["solid", "Solid"]
35
+ [
36
+ "none",
37
+ "backgroundNone",
38
+ "None"
39
+ ],
40
+ [
41
+ "dark",
42
+ "backgroundDark",
43
+ "Dark"
44
+ ],
45
+ [
46
+ "solid",
47
+ "backgroundSolid",
48
+ "Solid"
49
+ ]
22
50
  ];
23
51
  const STATES = ["off", "on"];
24
52
  var MbxSubtitlesMenu = class extends MenuElement {
@@ -43,22 +71,19 @@ var MbxSubtitlesMenu = class extends MenuElement {
43
71
  show(this.slots, "off");
44
72
  }
45
73
  name() {
46
- return "Subtitles";
74
+ return ["subtitles", "Subtitles"];
47
75
  }
48
76
  /**
49
77
  * A look's page: an item with the look's glyph, its name and the value
50
78
  * chosen, which opens the choices. They are named from the attributes,
51
79
  * and the value is the player's.
52
80
  */
53
- looks(player, attribute, name, fallback, choices, initial, glyph) {
54
- var _this$getAttribute, _items$find$, _items$find;
81
+ looks(player, attribute, name, id, fallback, choices, initial, glyph) {
82
+ var _items$find$, _items$find;
55
83
  const set = player.getAttribute(attribute);
56
84
  const value = set !== null && choices.some(([id]) => id === set) ? set : initial;
57
- const label = (_this$getAttribute = this.getAttribute(`label-${name}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : fallback;
58
- const items = choices.map(([id, text]) => {
59
- var _this$getAttribute2;
60
- return [id, (_this$getAttribute2 = this.getAttribute(`label-${id}`)) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : text];
61
- });
85
+ const label = this.word(`label-${name}`, id, fallback);
86
+ const items = choices.map(([value, word, english]) => [value, this.word(`label-${value}`, word, english)]);
62
87
  return {
63
88
  name,
64
89
  label,
@@ -89,8 +114,7 @@ var MbxSubtitlesMenu = class extends MenuElement {
89
114
  }
90
115
  /** The native session's subtitle tracks as entries, and the showing one's. */
91
116
  native(tracks) {
92
- var _this$getAttribute3;
93
- const sdh = (_this$getAttribute3 = this.getAttribute("label-sdh")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "SDH";
117
+ const sdh = this.word("label-sdh", "sdh", "SDH");
94
118
  const entries = tracks.map((track, index) => [
95
119
  String(index),
96
120
  track.label,
@@ -102,7 +126,7 @@ var MbxSubtitlesMenu = class extends MenuElement {
102
126
  return [entries, on === -1 ? null : String(on)];
103
127
  }
104
128
  render() {
105
- var _nativeTracks, _this$getAttribute6, _this$getAttribute7, _this$getAttribute8, _this$getAttribute9;
129
+ var _nativeTracks;
106
130
  super.render();
107
131
  const engine = this.engine;
108
132
  const player = this.player;
@@ -111,20 +135,19 @@ var MbxSubtitlesMenu = class extends MenuElement {
111
135
  this.hidden = true;
112
136
  return;
113
137
  }
114
- const [tracks, active] = listed !== void 0 ? this.native(listed) : trackItems(engine, "text", (track) => {
115
- var _this$getAttribute4, _this$getAttribute5;
116
- return [...track.instreamId !== void 0 ? [(_this$getAttribute4 = this.getAttribute("label-cc")) !== null && _this$getAttribute4 !== void 0 ? _this$getAttribute4 : "CC"] : [], ...isSdh(track) ? [(_this$getAttribute5 = this.getAttribute("label-sdh")) !== null && _this$getAttribute5 !== void 0 ? _this$getAttribute5 : "SDH"] : []];
117
- }, (track) => track.forced !== true);
118
- const word = this.getAttribute("label-track");
119
- const items = [[OFF, (_this$getAttribute6 = this.getAttribute("label-off")) !== null && _this$getAttribute6 !== void 0 ? _this$getAttribute6 : "Off"], ...trackNames(tracks, word)];
138
+ const cc = this.word("label-cc", "closedCaptions", "CC");
139
+ const sdh = this.word("label-sdh", "sdh", "SDH");
140
+ const [tracks, active] = listed !== void 0 ? this.native(listed) : trackItems(engine, "text", (track) => [...track.instreamId !== void 0 ? [cc] : [], ...isSdh(track) ? [sdh] : []], (track) => track.forced !== true);
141
+ const word = this.word("label-track", "track", "Track");
142
+ const items = [[OFF, this.word("label-off", "subtitlesOff", "Off")], ...trackNames(tracks, word, player.locale || void 0)];
120
143
  this.menu.fill([{
121
144
  name: "track",
122
- label: word !== null && word !== void 0 ? word : "Track",
145
+ label: word,
123
146
  hideLabel: true,
124
147
  items,
125
148
  badgeGlyphs: {
126
- [(_this$getAttribute7 = this.getAttribute("label-cc")) !== null && _this$getAttribute7 !== void 0 ? _this$getAttribute7 : "CC"]: () => icon("closed-captions"),
127
- [(_this$getAttribute8 = this.getAttribute("label-sdh")) !== null && _this$getAttribute8 !== void 0 ? _this$getAttribute8 : "SDH"]: () => icon("sdh")
149
+ [cc]: () => icon("closed-captions"),
150
+ [sdh]: () => icon("sdh")
128
151
  },
129
152
  value: active !== null && active !== void 0 ? active : OFF,
130
153
  onSelect: (value) => {
@@ -138,12 +161,11 @@ var MbxSubtitlesMenu = class extends MenuElement {
138
161
  }
139
162
  }, {
140
163
  name: "settings",
141
- label: (_this$getAttribute9 = this.getAttribute("label-settings")) !== null && _this$getAttribute9 !== void 0 ? _this$getAttribute9 : "Settings",
142
- entries: [this.looks(player, SUBTITLE_SIZE, "size", "Size", SIZES, "medium", "text-size"), this.looks(player, SUBTITLE_BACKGROUND, "background", "Background", BACKGROUNDS, "dark", "text-background")]
164
+ label: this.word("label-settings", "subtitleSettings", "Settings"),
165
+ entries: [this.looks(player, SUBTITLE_SIZE, "size", "subtitleSize", "Size", SIZES, "medium", "text-size"), this.looks(player, SUBTITLE_BACKGROUND, "background", "subtitleBackground", "Background", BACKGROUNDS, "dark", "text-background")]
143
166
  }]);
144
167
  show(this.slots, active === null ? "off" : "on");
145
168
  this.hidden = tracks.length === 0;
146
169
  }
147
170
  };
148
- //#endregion
149
171
  export { MbxSubtitlesMenu, SUBTITLE_BACKGROUND, SUBTITLE_SIZE };
@@ -1,6 +1,6 @@
1
1
  import { Component } from "./component.js";
2
2
  import { seekRow, style } from "./shared.js";
3
- //#region src/elements/time-element.ts
3
+ // src/elements/time-element.ts
4
4
  const STYLE = ":host{white-space:nowrap;font-variant-numeric:tabular-nums;min-width:3ch;display:inline-block}:host([hidden]){display:none}";
5
5
  const EVENTS = [
6
6
  "timeupdate",
@@ -31,5 +31,4 @@ var TimeElement = class extends Component {
31
31
  this.render();
32
32
  }
33
33
  };
34
- //#endregion
35
34
  export { TimeElement };