@mattebox/player 0.10.0 → 0.12.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 (355) 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/chapters.js +1 -2
  8. package/dist/controls/cues.js +1 -2
  9. package/dist/controls/fullscreen.js +1 -2
  10. package/dist/controls/icons.d.ts +1 -1
  11. package/dist/controls/icons.d.ts.map +1 -1
  12. package/dist/controls/icons.js +2 -2
  13. package/dist/controls/icons.js.map +1 -1
  14. package/dist/controls/markers.d.ts +2 -15
  15. package/dist/controls/markers.d.ts.map +1 -1
  16. package/dist/controls/markers.js +1 -2
  17. package/dist/controls/markers.js.map +1 -1
  18. package/dist/controls/menu.js +1 -2
  19. package/dist/controls/native-tracks.d.ts +8 -7
  20. package/dist/controls/native-tracks.d.ts.map +1 -1
  21. package/dist/controls/native-tracks.js +1 -2
  22. package/dist/controls/native-tracks.js.map +1 -1
  23. package/dist/controls/pip.js +1 -2
  24. package/dist/controls/quality-names.js +1 -2
  25. package/dist/controls/ranges.js +1 -2
  26. package/dist/controls/session.js +1 -2
  27. package/dist/controls/slider.js +1 -2
  28. package/dist/controls/time.js +1 -2
  29. package/dist/controls/track-names.d.ts +3 -2
  30. package/dist/controls/track-names.d.ts.map +1 -1
  31. package/dist/controls/track-names.js +5 -5
  32. package/dist/controls/track-names.js.map +1 -1
  33. package/dist/dom.js +1 -2
  34. package/dist/element-entry.d.ts +4 -1
  35. package/dist/element-entry.d.ts.map +1 -1
  36. package/dist/element-entry.js +1 -2
  37. package/dist/element-entry.js.map +1 -1
  38. package/dist/element.d.ts +134 -5
  39. package/dist/element.d.ts.map +1 -1
  40. package/dist/element.js +346 -35
  41. package/dist/element.js.map +1 -1
  42. package/dist/elements/airplay-button.js +2 -3
  43. package/dist/elements/airplay-button.js.map +1 -1
  44. package/dist/elements/audio-menu.d.ts +3 -2
  45. package/dist/elements/audio-menu.d.ts.map +1 -1
  46. package/dist/elements/audio-menu.js +18 -12
  47. package/dist/elements/audio-menu.js.map +1 -1
  48. package/dist/elements/chapters-menu.d.ts +2 -1
  49. package/dist/elements/chapters-menu.d.ts.map +1 -1
  50. package/dist/elements/chapters-menu.js +2 -3
  51. package/dist/elements/chapters-menu.js.map +1 -1
  52. package/dist/elements/component.d.ts +9 -0
  53. package/dist/elements/component.d.ts.map +1 -1
  54. package/dist/elements/component.js +16 -2
  55. package/dist/elements/component.js.map +1 -1
  56. package/dist/elements/control-bar.d.ts.map +1 -1
  57. package/dist/elements/control-bar.js +9 -8
  58. package/dist/elements/control-bar.js.map +1 -1
  59. package/dist/elements/current-time.js +1 -2
  60. package/dist/elements/drm-badge.js +4 -5
  61. package/dist/elements/drm-badge.js.map +1 -1
  62. package/dist/elements/duration.js +1 -2
  63. package/dist/elements/error-screen.d.ts +9 -0
  64. package/dist/elements/error-screen.d.ts.map +1 -1
  65. package/dist/elements/error-screen.js +55 -15
  66. package/dist/elements/error-screen.js.map +1 -1
  67. package/dist/elements/fullscreen-button.js +2 -3
  68. package/dist/elements/fullscreen-button.js.map +1 -1
  69. package/dist/elements/live-button.js +3 -4
  70. package/dist/elements/live-button.js.map +1 -1
  71. package/dist/elements/marker-button.d.ts.map +1 -1
  72. package/dist/elements/marker-button.js +7 -6
  73. package/dist/elements/marker-button.js.map +1 -1
  74. package/dist/elements/menu-element.d.ts +3 -2
  75. package/dist/elements/menu-element.d.ts.map +1 -1
  76. package/dist/elements/menu-element.js +3 -4
  77. package/dist/elements/menu-element.js.map +1 -1
  78. package/dist/elements/mute-button.js +2 -3
  79. package/dist/elements/mute-button.js.map +1 -1
  80. package/dist/elements/pip-button.js +2 -3
  81. package/dist/elements/pip-button.js.map +1 -1
  82. package/dist/elements/play-button.d.ts.map +1 -1
  83. package/dist/elements/play-button.js +9 -12
  84. package/dist/elements/play-button.js.map +1 -1
  85. package/dist/elements/quality-menu.d.ts +2 -1
  86. package/dist/elements/quality-menu.d.ts.map +1 -1
  87. package/dist/elements/quality-menu.js +3 -4
  88. package/dist/elements/quality-menu.js.map +1 -1
  89. package/dist/elements/remaining-time.js +1 -2
  90. package/dist/elements/scan-button.d.ts.map +1 -1
  91. package/dist/elements/scan-button.js +2 -3
  92. package/dist/elements/scan-button.js.map +1 -1
  93. package/dist/elements/seek-bar.d.ts +2 -0
  94. package/dist/elements/seek-bar.d.ts.map +1 -1
  95. package/dist/elements/seek-bar.js +10 -7
  96. package/dist/elements/seek-bar.js.map +1 -1
  97. package/dist/elements/shared.d.ts +18 -0
  98. package/dist/elements/shared.d.ts.map +1 -1
  99. package/dist/elements/shared.js +17 -11
  100. package/dist/elements/shared.js.map +1 -1
  101. package/dist/elements/skip-button.d.ts.map +1 -1
  102. package/dist/elements/skip-button.js +2 -3
  103. package/dist/elements/skip-button.js.map +1 -1
  104. package/dist/elements/spacer.js +1 -2
  105. package/dist/elements/speed-menu.d.ts +2 -1
  106. package/dist/elements/speed-menu.d.ts.map +1 -1
  107. package/dist/elements/speed-menu.js +3 -4
  108. package/dist/elements/speed-menu.js.map +1 -1
  109. package/dist/elements/spinner.d.ts +1 -1
  110. package/dist/elements/spinner.js +2 -4
  111. package/dist/elements/spinner.js.map +1 -1
  112. package/dist/elements/start-button.d.ts.map +1 -1
  113. package/dist/elements/start-button.js +5 -7
  114. package/dist/elements/start-button.js.map +1 -1
  115. package/dist/elements/subtitles-menu.d.ts +2 -1
  116. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  117. package/dist/elements/subtitles-menu.js +51 -22
  118. package/dist/elements/subtitles-menu.js.map +1 -1
  119. package/dist/elements/time-element.js +1 -2
  120. package/dist/elements/title.d.ts.map +1 -1
  121. package/dist/elements/title.js +16 -7
  122. package/dist/elements/title.js.map +1 -1
  123. package/dist/elements/video-menu.d.ts +24 -0
  124. package/dist/elements/video-menu.d.ts.map +1 -0
  125. package/dist/elements/video-menu.js +146 -0
  126. package/dist/elements/video-menu.js.map +1 -0
  127. package/dist/elements/volume-slider.js +2 -3
  128. package/dist/elements/volume-slider.js.map +1 -1
  129. package/dist/elements/volume.js +1 -2
  130. package/dist/entries/airplay-button.js +1 -2
  131. package/dist/entries/audio-menu.js +1 -2
  132. package/dist/entries/chapters-menu.js +1 -2
  133. package/dist/entries/control-bar.js +1 -2
  134. package/dist/entries/current-time.js +1 -2
  135. package/dist/entries/drm-badge.js +1 -2
  136. package/dist/entries/duration.js +1 -2
  137. package/dist/entries/error-screen.js +1 -2
  138. package/dist/entries/fullscreen-button.js +1 -2
  139. package/dist/entries/live-button.js +1 -2
  140. package/dist/entries/marker-button.js +1 -2
  141. package/dist/entries/mute-button.js +1 -2
  142. package/dist/entries/pip-button.js +1 -2
  143. package/dist/entries/play-button.js +1 -2
  144. package/dist/entries/quality-menu.js +1 -2
  145. package/dist/entries/remaining-time.js +1 -2
  146. package/dist/entries/scan-button.js +1 -2
  147. package/dist/entries/seek-bar.js +1 -2
  148. package/dist/entries/skip-button.js +1 -2
  149. package/dist/entries/spacer.js +1 -2
  150. package/dist/entries/speed-menu.js +1 -2
  151. package/dist/entries/spinner.js +1 -2
  152. package/dist/entries/start-button.js +1 -2
  153. package/dist/entries/subtitles-menu.js +1 -2
  154. package/dist/entries/title.js +1 -2
  155. package/dist/entries/video-menu.d.ts +5 -0
  156. package/dist/entries/video-menu.d.ts.map +1 -0
  157. package/dist/entries/video-menu.js +8 -0
  158. package/dist/entries/video-menu.js.map +1 -0
  159. package/dist/entries/volume-slider.js +1 -2
  160. package/dist/entries/volume.js +1 -2
  161. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/asyncToGenerator.js +1 -2
  162. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.js +1 -2
  163. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectSpread2.js +1 -2
  164. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.js +1 -2
  165. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.js +1 -2
  166. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.js +1 -2
  167. package/dist/es2015/announcer.js +18 -15
  168. package/dist/es2015/controls/airplay.js +1 -2
  169. package/dist/es2015/controls/chapters.js +2 -3
  170. package/dist/es2015/controls/cues.js +1 -2
  171. package/dist/es2015/controls/fullscreen.js +1 -2
  172. package/dist/es2015/controls/icons.js +2 -2
  173. package/dist/es2015/controls/markers.js +1 -2
  174. package/dist/es2015/controls/menu.js +2 -3
  175. package/dist/es2015/controls/native-tracks.js +1 -2
  176. package/dist/es2015/controls/pip.js +1 -2
  177. package/dist/es2015/controls/quality-names.js +1 -2
  178. package/dist/es2015/controls/ranges.js +1 -2
  179. package/dist/es2015/controls/session.js +1 -2
  180. package/dist/es2015/controls/slider.js +1 -2
  181. package/dist/es2015/controls/time.js +1 -2
  182. package/dist/es2015/controls/track-names.js +5 -5
  183. package/dist/es2015/dom.js +1 -2
  184. package/dist/es2015/element-entry.js +1 -2
  185. package/dist/es2015/element.js +402 -85
  186. package/dist/es2015/elements/airplay-button.js +2 -4
  187. package/dist/es2015/elements/audio-menu.js +18 -16
  188. package/dist/es2015/elements/chapters-menu.js +2 -3
  189. package/dist/es2015/elements/component.js +18 -2
  190. package/dist/es2015/elements/control-bar.js +9 -8
  191. package/dist/es2015/elements/current-time.js +1 -2
  192. package/dist/es2015/elements/drm-badge.js +5 -7
  193. package/dist/es2015/elements/duration.js +1 -2
  194. package/dist/es2015/elements/error-screen.js +58 -16
  195. package/dist/es2015/elements/fullscreen-button.js +2 -4
  196. package/dist/es2015/elements/live-button.js +3 -5
  197. package/dist/es2015/elements/marker-button.js +8 -7
  198. package/dist/es2015/elements/menu-element.js +3 -8
  199. package/dist/es2015/elements/mute-button.js +3 -4
  200. package/dist/es2015/elements/pip-button.js +2 -4
  201. package/dist/es2015/elements/play-button.js +9 -13
  202. package/dist/es2015/elements/quality-menu.js +4 -5
  203. package/dist/es2015/elements/remaining-time.js +1 -2
  204. package/dist/es2015/elements/scan-button.js +3 -4
  205. package/dist/es2015/elements/seek-bar.js +12 -11
  206. package/dist/es2015/elements/shared.js +17 -11
  207. package/dist/es2015/elements/skip-button.js +2 -4
  208. package/dist/es2015/elements/spacer.js +1 -2
  209. package/dist/es2015/elements/speed-menu.js +4 -5
  210. package/dist/es2015/elements/spinner.js +2 -5
  211. package/dist/es2015/elements/start-button.js +6 -8
  212. package/dist/es2015/elements/subtitles-menu.js +53 -31
  213. package/dist/es2015/elements/time-element.js +1 -2
  214. package/dist/es2015/elements/title.js +17 -8
  215. package/dist/es2015/elements/video-menu.js +152 -0
  216. package/dist/es2015/elements/volume-slider.js +3 -4
  217. package/dist/es2015/elements/volume.js +1 -2
  218. package/dist/es2015/entries/airplay-button.js +1 -2
  219. package/dist/es2015/entries/audio-menu.js +1 -2
  220. package/dist/es2015/entries/chapters-menu.js +1 -2
  221. package/dist/es2015/entries/control-bar.js +1 -2
  222. package/dist/es2015/entries/current-time.js +1 -2
  223. package/dist/es2015/entries/drm-badge.js +1 -2
  224. package/dist/es2015/entries/duration.js +1 -2
  225. package/dist/es2015/entries/error-screen.js +1 -2
  226. package/dist/es2015/entries/fullscreen-button.js +1 -2
  227. package/dist/es2015/entries/live-button.js +1 -2
  228. package/dist/es2015/entries/marker-button.js +1 -2
  229. package/dist/es2015/entries/mute-button.js +1 -2
  230. package/dist/es2015/entries/pip-button.js +1 -2
  231. package/dist/es2015/entries/play-button.js +1 -2
  232. package/dist/es2015/entries/quality-menu.js +1 -2
  233. package/dist/es2015/entries/remaining-time.js +1 -2
  234. package/dist/es2015/entries/scan-button.js +1 -2
  235. package/dist/es2015/entries/seek-bar.js +1 -2
  236. package/dist/es2015/entries/skip-button.js +1 -2
  237. package/dist/es2015/entries/spacer.js +1 -2
  238. package/dist/es2015/entries/speed-menu.js +1 -2
  239. package/dist/es2015/entries/spinner.js +1 -2
  240. package/dist/es2015/entries/start-button.js +1 -2
  241. package/dist/es2015/entries/subtitles-menu.js +1 -2
  242. package/dist/es2015/entries/title.js +1 -2
  243. package/dist/es2015/entries/video-menu.js +6 -0
  244. package/dist/es2015/entries/volume-slider.js +1 -2
  245. package/dist/es2015/entries/volume.js +1 -2
  246. package/dist/es2015/host.js +1 -2
  247. package/dist/es2015/ids.js +33 -0
  248. package/dist/es2015/index.js +4 -1
  249. package/dist/es2015/labels.js +1 -2
  250. package/dist/es2015/locales/ar.js +75 -0
  251. package/dist/es2015/locales/ca.js +75 -0
  252. package/dist/es2015/locales/de.js +75 -0
  253. package/dist/es2015/locales/es.js +75 -0
  254. package/dist/es2015/locales/fr.js +75 -0
  255. package/dist/es2015/locales/hi.js +75 -0
  256. package/dist/es2015/locales/it.js +75 -0
  257. package/dist/es2015/locales/ja.js +75 -0
  258. package/dist/es2015/locales/ko.js +75 -0
  259. package/dist/es2015/locales/pt.js +75 -0
  260. package/dist/es2015/locales/zh.js +75 -0
  261. package/dist/es2015/locales.js +61 -0
  262. package/dist/es2015/namespaces.js +1 -2
  263. package/dist/es2015/presets.js +2 -3
  264. package/dist/es2015/style.js +1 -2
  265. package/dist/es2015/surface.js +12 -4
  266. package/dist/es2015/tags.js +3 -3
  267. package/dist/es2015/text.js +15 -0
  268. package/dist/es2015/trackers.js +43 -0
  269. package/dist/es2015/video-sources.js +127 -0
  270. package/dist/host.d.ts +49 -1
  271. package/dist/host.d.ts.map +1 -1
  272. package/dist/host.js +1 -2
  273. package/dist/host.js.map +1 -1
  274. package/dist/ids.d.ts +19 -0
  275. package/dist/ids.d.ts.map +1 -0
  276. package/dist/ids.js +34 -0
  277. package/dist/ids.js.map +1 -0
  278. package/dist/index.d.ts +11 -1
  279. package/dist/index.d.ts.map +1 -1
  280. package/dist/index.js +4 -1
  281. package/dist/labels.js +1 -2
  282. package/dist/locales/ar.d.ts +75 -0
  283. package/dist/locales/ar.d.ts.map +1 -0
  284. package/dist/locales/ar.js +77 -0
  285. package/dist/locales/ar.js.map +1 -0
  286. package/dist/locales/ca.d.ts +75 -0
  287. package/dist/locales/ca.d.ts.map +1 -0
  288. package/dist/locales/ca.js +77 -0
  289. package/dist/locales/ca.js.map +1 -0
  290. package/dist/locales/de.d.ts +75 -0
  291. package/dist/locales/de.d.ts.map +1 -0
  292. package/dist/locales/de.js +77 -0
  293. package/dist/locales/de.js.map +1 -0
  294. package/dist/locales/es.d.ts +75 -0
  295. package/dist/locales/es.d.ts.map +1 -0
  296. package/dist/locales/es.js +77 -0
  297. package/dist/locales/es.js.map +1 -0
  298. package/dist/locales/fr.d.ts +75 -0
  299. package/dist/locales/fr.d.ts.map +1 -0
  300. package/dist/locales/fr.js +77 -0
  301. package/dist/locales/fr.js.map +1 -0
  302. package/dist/locales/hi.d.ts +75 -0
  303. package/dist/locales/hi.d.ts.map +1 -0
  304. package/dist/locales/hi.js +77 -0
  305. package/dist/locales/hi.js.map +1 -0
  306. package/dist/locales/it.d.ts +75 -0
  307. package/dist/locales/it.d.ts.map +1 -0
  308. package/dist/locales/it.js +77 -0
  309. package/dist/locales/it.js.map +1 -0
  310. package/dist/locales/ja.d.ts +75 -0
  311. package/dist/locales/ja.d.ts.map +1 -0
  312. package/dist/locales/ja.js +77 -0
  313. package/dist/locales/ja.js.map +1 -0
  314. package/dist/locales/ko.d.ts +75 -0
  315. package/dist/locales/ko.d.ts.map +1 -0
  316. package/dist/locales/ko.js +77 -0
  317. package/dist/locales/ko.js.map +1 -0
  318. package/dist/locales/pt.d.ts +75 -0
  319. package/dist/locales/pt.d.ts.map +1 -0
  320. package/dist/locales/pt.js +77 -0
  321. package/dist/locales/pt.js.map +1 -0
  322. package/dist/locales/zh.d.ts +75 -0
  323. package/dist/locales/zh.d.ts.map +1 -0
  324. package/dist/locales/zh.js +77 -0
  325. package/dist/locales/zh.js.map +1 -0
  326. package/dist/locales.d.ts +27 -0
  327. package/dist/locales.d.ts.map +1 -0
  328. package/dist/locales.js +48 -0
  329. package/dist/locales.js.map +1 -0
  330. package/dist/messages.d.ts +167 -0
  331. package/dist/messages.d.ts.map +1 -0
  332. package/dist/namespaces.js +1 -2
  333. package/dist/presets.js +1 -2
  334. package/dist/style.js +1 -2
  335. package/dist/surface.d.ts +4 -1
  336. package/dist/surface.d.ts.map +1 -1
  337. package/dist/surface.js +12 -4
  338. package/dist/surface.js.map +1 -1
  339. package/dist/tags.d.ts +1 -0
  340. package/dist/tags.d.ts.map +1 -1
  341. package/dist/tags.js +3 -3
  342. package/dist/tags.js.map +1 -1
  343. package/dist/text.d.ts +14 -0
  344. package/dist/text.d.ts.map +1 -0
  345. package/dist/text.js +16 -0
  346. package/dist/text.js.map +1 -0
  347. package/dist/trackers.d.ts +18 -0
  348. package/dist/trackers.d.ts.map +1 -0
  349. package/dist/trackers.js +45 -0
  350. package/dist/trackers.js.map +1 -0
  351. package/dist/video-sources.d.ts +48 -0
  352. package/dist/video-sources.d.ts.map +1 -0
  353. package/dist/video-sources.js +133 -0
  354. package/dist/video-sources.js.map +1 -0
  355. 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
- import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
- //#region src/elements/play-button.ts
3
+ import { BUTTON_STYLE, HELD, iconSlots, show, shownPaused, style } from "./shared.js";
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
@@ -9,8 +9,8 @@ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
9
9
  * own SVG into `icon-play`, `icon-pause` or `icon-replay`; the name is on
10
10
  * the button, from `label-play`, `label-pause` and `label-replay`, where a
11
11
  * screen reader reads it. While the seek bar holds the video paused for a
12
- * drag, the button shows the state from before the drag, which the player
13
- * carries as `scrubbing`.
12
+ * drag, or a switch loads another source, the button shows the state from
13
+ * before, which the player carries as `scrubbing` or `switching`.
14
14
  */
15
15
  const STATES = [
16
16
  "play",
@@ -55,21 +55,17 @@ var MbxPlayButton = class extends Component {
55
55
  ], () => {
56
56
  this.render();
57
57
  });
58
- this.observe(player, ["scrubbing"], () => {
58
+ this.observe(player, HELD, () => {
59
59
  this.render();
60
60
  });
61
61
  this.render();
62
62
  }
63
63
  render() {
64
- var _this$player2, _this$player$getAttri, _this$player3, _this$getAttribute;
65
- const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
66
- if (video === void 0) return;
67
- const held = (_this$player$getAttri = (_this$player3 = this.player) === null || _this$player3 === void 0 ? void 0 : _this$player3.getAttribute("scrubbing")) !== null && _this$player$getAttri !== void 0 ? _this$player$getAttri : null;
68
- const paused = held === null ? video.paused : held === "paused";
69
- const state = video.ended ? "replay" : paused ? "play" : "pause";
64
+ const player = this.player;
65
+ if (player === null) return;
66
+ const state = player.video.ended ? "replay" : shownPaused(player) ? "play" : "pause";
70
67
  show(this.slots, state);
71
- 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]));
72
69
  }
73
70
  };
74
- //#endregion
75
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,7 +7,7 @@ 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
10
+ // src/elements/seek-bar.ts
11
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}";
12
12
  const STEP = 5;
13
13
  /** Under `key-mode="preview"`, a target seeks this long after the last key. */
@@ -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 = [];
@@ -165,17 +166,16 @@ var MbxSeekBar = class extends Component {
165
166
  }
166
167
  /** What a screen reader hears at a time. */
167
168
  say(time) {
168
- var _this$player$engine2, _this$player2, _this$getAttribute2;
169
+ var _this$player$engine2, _this$player2;
169
170
  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
171
  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}";
172
+ const template = this.word("label-of", "seekOf", "{current} of {duration}");
173
173
  return Number.isFinite(this.range.end) && this.range.end > 0 ? fill(template, {
174
174
  current: format(time),
175
175
  duration: format(this.range.end)
176
176
  }) : format(time);
177
177
  }
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) });
178
+ const behind = fill(this.word("label-behind", "behindLive", "{time} behind live"), { time: format(this.range.end - time) });
179
179
  const clock = wall(engine, time);
180
180
  return clock === null ? behind : `${clock}, ${behind}`;
181
181
  }
@@ -218,6 +218,8 @@ var MbxSeekBar = class extends Component {
218
218
  const drag = this.drag;
219
219
  this.drag = "none";
220
220
  this.dragged = null;
221
+ const written = this.written;
222
+ this.written = null;
221
223
  const player = this.player;
222
224
  if (player === null) return;
223
225
  if (drag === "scrub") {
@@ -225,7 +227,7 @@ var MbxSeekBar = class extends Component {
225
227
  if (value === null) trick === null || trick === void 0 || trick.scrubEnd();
226
228
  else trick === null || trick === void 0 || trick.scrubEnd(value);
227
229
  } else {
228
- if (value !== null) player.video.currentTime = value;
230
+ if (value !== null && value !== written) player.video.currentTime = value;
229
231
  if (this.resume) player.video.play().catch(() => void 0);
230
232
  this.resume = false;
231
233
  }
@@ -316,6 +318,7 @@ var MbxSeekBar = class extends Component {
316
318
  const video = (_this$player11 = this.player) === null || _this$player11 === void 0 ? void 0 : _this$player11.video;
317
319
  if (this.pending === null || video === void 0) return;
318
320
  video.currentTime = this.pending;
321
+ if (this.drag === "seek") this.written = this.pending;
319
322
  this.pending = null;
320
323
  }
321
324
  /** The width the page asked for through the token, or the default. */
@@ -428,7 +431,7 @@ var MbxSeekBar = class extends Component {
428
431
  }
429
432
  /** The preview over `part` of the bar: the time, the chapter, and the picture. */
430
433
  previewAt(part) {
431
- var _this$player15, _ref, _blocked$label, _chapter$title;
434
+ var _this$player15, _chapter$title;
432
435
  const rect = this.bar.rail.getBoundingClientRect();
433
436
  if (rect.width === 0 || this.range.end <= this.range.start) return;
434
437
  this.preview.hidden = false;
@@ -436,7 +439,7 @@ var MbxSeekBar = class extends Component {
436
439
  this.time.textContent = this.label(when);
437
440
  const chapter = this.chaptered("titles") ? this.list[chapterAt(this.list, when)] : void 0;
438
441
  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 : "";
442
+ 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
443
  this.caption.hidden = title === "";
441
444
  this.caption.textContent = title;
442
445
  if (blocked) {
@@ -493,7 +496,6 @@ var MbxSeekBar = class extends Component {
493
496
  player.removeAttribute("scrubbing");
494
497
  }
495
498
  render() {
496
- var _this$getAttribute3;
497
499
  const player = this.player;
498
500
  if (player === null) return;
499
501
  const video = player.video;
@@ -502,7 +504,7 @@ var MbxSeekBar = class extends Component {
502
504
  const on = api !== void 0;
503
505
  this.range = span(video, engine);
504
506
  this.list = chapters(video, engine);
505
- this.bar.label((_this$getAttribute3 = this.getAttribute("label")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Seek");
507
+ this.bar.label(this.word("label", "seek", "Seek"));
506
508
  this.bar.range(this.range.start, this.range.end);
507
509
  this.paintRanges(this.buffered, spans(video.buffered), "buffered-range");
508
510
  this.paintRanges(this.blocked, this.blockedRanges(), "blocked-range");
@@ -516,5 +518,4 @@ var MbxSeekBar = class extends Component {
516
518
  if (!this.bar.dragging() && this.target === null) this.bar.set(video.currentTime, this.say(video.currentTime));
517
519
  }
518
520
  };
519
- //#endregion
520
521
  export { MbxSeekBar };
@@ -1,12 +1,4 @@
1
- //#region src/elements/shared.ts
2
- /**
3
- * The style every button control shares. Each element carries its own
4
- * copy in its shadow root, so the rules are short and the tokens come
5
- * through the `--mbx-*` custom properties the player sets, which inherit
6
- * through light DOM into every control.
7
- *
8
- * Nothing carries `!important`: a page's `::part()` rule must win.
9
- */
1
+ // src/elements/shared.ts
10
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}";
11
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%}";
12
4
  const BUTTON_STYLE = BUTTON_STYLE_CSS;
@@ -50,5 +42,19 @@ function iconSlots(states, fallback) {
50
42
  function show(slots, state) {
51
43
  for (const key of Object.keys(slots)) slots[key].hidden = key !== state;
52
44
  }
53
- //#endregion
54
- export { BUTTON_STYLE, MENU_STYLE, SLIDER_STYLE, iconSlots, number, seekRow, show, style };
45
+ /**
46
+ * The attributes the player carries while it holds the video in another
47
+ * state than the one shown: `scrubbing` through a drag, `switching` through
48
+ * the load of `switchSource` or a version. Each holds the state from
49
+ * before, `playing` or `paused`.
50
+ */
51
+ const HELD = ["scrubbing", "switching"];
52
+ /** Whether the controls show the video as paused: the held state, if one of `names` holds it. */
53
+ function shownPaused(player, names = HELD) {
54
+ for (const name of names) {
55
+ const held = player.getAttribute(name);
56
+ if (held !== null) return held === "paused";
57
+ }
58
+ return player.video.paused;
59
+ }
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
- import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
- //#region src/elements/start-button.ts
3
+ import { BUTTON_STYLE, HELD, iconSlots, show, shownPaused, style } from "./shared.js";
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();
@@ -45,7 +44,7 @@ var MbxStartButton = class extends Component {
45
44
  this.failed = false;
46
45
  this.render();
47
46
  });
48
- this.observe(player, ["scrubbing"], () => {
47
+ this.observe(player, HELD, () => {
49
48
  this.render();
50
49
  });
51
50
  const failure = (event) => {
@@ -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
- this.hidden = this.failed || !video.paused || (player === null || player === void 0 ? void 0 : player.hasAttribute("waiting")) === true || (player === null || player === void 0 ? void 0 : player.hasAttribute("scrubbing")) === true;
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 };