@mattebox/player 0.1.0 → 0.2.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 (410) hide show
  1. package/README.md +4 -3
  2. package/dist/cdn/mattebox-player.min.js +200 -196
  3. package/dist/compose.d.ts +5 -0
  4. package/dist/compose.d.ts.map +1 -0
  5. package/dist/compose.js +31 -0
  6. package/dist/compose.js.map +1 -0
  7. package/dist/controls/chapters.d.ts +29 -0
  8. package/dist/controls/chapters.d.ts.map +1 -0
  9. package/dist/controls/chapters.js +81 -0
  10. package/dist/controls/chapters.js.map +1 -0
  11. package/dist/controls/cues.d.ts +8 -3
  12. package/dist/controls/cues.d.ts.map +1 -1
  13. package/dist/controls/cues.js +44 -10
  14. package/dist/controls/cues.js.map +1 -1
  15. package/dist/controls/fullscreen.d.ts +9 -9
  16. package/dist/controls/fullscreen.d.ts.map +1 -1
  17. package/dist/controls/fullscreen.js +17 -21
  18. package/dist/controls/fullscreen.js.map +1 -1
  19. package/dist/controls/icons.d.ts +1 -3
  20. package/dist/controls/icons.d.ts.map +1 -1
  21. package/dist/controls/icons.js +3 -6
  22. package/dist/controls/icons.js.map +1 -1
  23. package/dist/controls/menu.d.ts +14 -11
  24. package/dist/controls/menu.d.ts.map +1 -1
  25. package/dist/controls/menu.js +39 -34
  26. package/dist/controls/menu.js.map +1 -1
  27. package/dist/controls/session.d.ts +27 -0
  28. package/dist/controls/session.d.ts.map +1 -0
  29. package/dist/controls/session.js +36 -0
  30. package/dist/controls/session.js.map +1 -0
  31. package/dist/controls/slider.d.ts +6 -6
  32. package/dist/controls/slider.d.ts.map +1 -1
  33. package/dist/controls/slider.js +18 -13
  34. package/dist/controls/slider.js.map +1 -1
  35. package/dist/dom.d.ts +4 -10
  36. package/dist/dom.d.ts.map +1 -1
  37. package/dist/dom.js +4 -24
  38. package/dist/dom.js.map +1 -1
  39. package/dist/element-entry.d.ts +4 -0
  40. package/dist/element-entry.d.ts.map +1 -0
  41. package/dist/element-entry.js +9 -0
  42. package/dist/element-entry.js.map +1 -0
  43. package/dist/element.d.ts +54 -14
  44. package/dist/element.d.ts.map +1 -1
  45. package/dist/element.js +154 -73
  46. package/dist/element.js.map +1 -1
  47. package/dist/elements/audio-menu.d.ts +24 -0
  48. package/dist/elements/audio-menu.d.ts.map +1 -0
  49. package/dist/elements/audio-menu.js +70 -0
  50. package/dist/elements/audio-menu.js.map +1 -0
  51. package/dist/elements/chapters-menu.d.ts +12 -0
  52. package/dist/elements/chapters-menu.d.ts.map +1 -0
  53. package/dist/elements/chapters-menu.js +67 -0
  54. package/dist/elements/chapters-menu.js.map +1 -0
  55. package/dist/elements/component.d.ts +45 -0
  56. package/dist/elements/component.d.ts.map +1 -0
  57. package/dist/elements/component.js +90 -0
  58. package/dist/elements/component.js.map +1 -0
  59. package/dist/elements/control-bar.d.ts +46 -0
  60. package/dist/elements/control-bar.d.ts.map +1 -0
  61. package/dist/elements/control-bar.js +207 -0
  62. package/dist/elements/control-bar.js.map +1 -0
  63. package/dist/elements/current-time.d.ts +5 -0
  64. package/dist/elements/current-time.d.ts.map +1 -0
  65. package/dist/elements/current-time.js +27 -0
  66. package/dist/elements/current-time.js.map +1 -0
  67. package/dist/elements/drm-badge.d.ts +29 -0
  68. package/dist/elements/drm-badge.d.ts.map +1 -0
  69. package/dist/elements/drm-badge.js +145 -0
  70. package/dist/elements/drm-badge.js.map +1 -0
  71. package/dist/elements/duration.d.ts +6 -0
  72. package/dist/elements/duration.d.ts.map +1 -0
  73. package/dist/elements/duration.js +23 -0
  74. package/dist/elements/duration.js.map +1 -0
  75. package/dist/elements/error-screen.d.ts +17 -0
  76. package/dist/elements/error-screen.d.ts.map +1 -0
  77. package/dist/elements/error-screen.js +103 -0
  78. package/dist/elements/error-screen.js.map +1 -0
  79. package/dist/elements/fullscreen-button.d.ts +19 -0
  80. package/dist/elements/fullscreen-button.d.ts.map +1 -0
  81. package/dist/elements/fullscreen-button.js +55 -0
  82. package/dist/elements/fullscreen-button.js.map +1 -0
  83. package/dist/elements/live-button.d.ts +12 -0
  84. package/dist/elements/live-button.d.ts.map +1 -0
  85. package/dist/elements/live-button.js +96 -0
  86. package/dist/elements/live-button.js.map +1 -0
  87. package/dist/elements/menu-element.d.ts +22 -0
  88. package/dist/elements/menu-element.d.ts.map +1 -0
  89. package/dist/elements/menu-element.js +31 -0
  90. package/dist/elements/menu-element.js.map +1 -0
  91. package/dist/elements/mute-button.d.ts +12 -0
  92. package/dist/elements/mute-button.d.ts.map +1 -0
  93. package/dist/elements/mute-button.js +61 -0
  94. package/dist/elements/mute-button.js.map +1 -0
  95. package/dist/elements/panels.d.ts +15 -0
  96. package/dist/elements/panels.d.ts.map +1 -0
  97. package/dist/elements/panels.js +55 -0
  98. package/dist/elements/panels.js.map +1 -0
  99. package/dist/elements/pip-button.d.ts +13 -0
  100. package/dist/elements/pip-button.d.ts.map +1 -0
  101. package/dist/elements/pip-button.js +56 -0
  102. package/dist/elements/pip-button.js.map +1 -0
  103. package/dist/elements/play-button.d.ts +12 -0
  104. package/dist/elements/play-button.d.ts.map +1 -0
  105. package/dist/elements/play-button.js +60 -0
  106. package/dist/elements/play-button.js.map +1 -0
  107. package/dist/elements/quality-menu.d.ts +11 -0
  108. package/dist/elements/quality-menu.d.ts.map +1 -0
  109. package/dist/elements/quality-menu.js +72 -0
  110. package/dist/elements/quality-menu.js.map +1 -0
  111. package/dist/elements/seek-bar.d.ts +83 -0
  112. package/dist/elements/seek-bar.d.ts.map +1 -0
  113. package/dist/elements/seek-bar.js +352 -0
  114. package/dist/elements/seek-bar.js.map +1 -0
  115. package/dist/elements/shared.d.ts +27 -0
  116. package/dist/elements/shared.d.ts.map +1 -0
  117. package/dist/elements/shared.js +155 -0
  118. package/dist/elements/shared.js.map +1 -0
  119. package/dist/elements/skip-button.d.ts +14 -0
  120. package/dist/elements/skip-button.d.ts.map +1 -0
  121. package/dist/elements/skip-button.js +60 -0
  122. package/dist/elements/skip-button.js.map +1 -0
  123. package/dist/elements/spacer.d.ts +4 -0
  124. package/dist/elements/spacer.d.ts.map +1 -0
  125. package/dist/elements/spacer.js +9 -0
  126. package/dist/elements/spacer.js.map +1 -0
  127. package/dist/elements/speed-menu.d.ts +18 -0
  128. package/dist/elements/speed-menu.d.ts.map +1 -0
  129. package/dist/elements/speed-menu.js +56 -0
  130. package/dist/elements/speed-menu.js.map +1 -0
  131. package/dist/elements/start-button.d.ts +13 -0
  132. package/dist/elements/start-button.d.ts.map +1 -0
  133. package/dist/elements/start-button.js +83 -0
  134. package/dist/elements/start-button.js.map +1 -0
  135. package/dist/elements/subtitles-menu.d.ts +17 -0
  136. package/dist/elements/subtitles-menu.d.ts.map +1 -0
  137. package/dist/elements/subtitles-menu.js +108 -0
  138. package/dist/elements/subtitles-menu.js.map +1 -0
  139. package/dist/elements/time-element.d.ts +14 -0
  140. package/dist/elements/time-element.d.ts.map +1 -0
  141. package/dist/elements/time-element.js +29 -0
  142. package/dist/elements/time-element.js.map +1 -0
  143. package/dist/elements/volume-slider.d.ts +10 -0
  144. package/dist/elements/volume-slider.d.ts.map +1 -0
  145. package/dist/elements/volume-slider.js +46 -0
  146. package/dist/elements/volume-slider.js.map +1 -0
  147. package/dist/elements/volume.d.ts +9 -0
  148. package/dist/elements/volume.d.ts.map +1 -0
  149. package/dist/elements/volume.js +50 -0
  150. package/dist/elements/volume.js.map +1 -0
  151. package/dist/entries/audio-menu.d.ts +5 -0
  152. package/dist/entries/audio-menu.d.ts.map +1 -0
  153. package/dist/entries/audio-menu.js +8 -0
  154. package/dist/entries/audio-menu.js.map +1 -0
  155. package/dist/entries/chapters-menu.d.ts +5 -0
  156. package/dist/entries/chapters-menu.d.ts.map +1 -0
  157. package/dist/entries/chapters-menu.js +9 -0
  158. package/dist/entries/chapters-menu.js.map +1 -0
  159. package/dist/entries/control-bar.d.ts +5 -0
  160. package/dist/entries/control-bar.d.ts.map +1 -0
  161. package/dist/entries/control-bar.js +8 -0
  162. package/dist/entries/control-bar.js.map +1 -0
  163. package/dist/entries/current-time.d.ts +5 -0
  164. package/dist/entries/current-time.d.ts.map +1 -0
  165. package/dist/entries/current-time.js +8 -0
  166. package/dist/entries/current-time.js.map +1 -0
  167. package/dist/entries/drm-badge.d.ts +5 -0
  168. package/dist/entries/drm-badge.d.ts.map +1 -0
  169. package/dist/entries/drm-badge.js +8 -0
  170. package/dist/entries/drm-badge.js.map +1 -0
  171. package/dist/entries/duration.d.ts +5 -0
  172. package/dist/entries/duration.d.ts.map +1 -0
  173. package/dist/entries/duration.js +8 -0
  174. package/dist/entries/duration.js.map +1 -0
  175. package/dist/entries/error-screen.d.ts +5 -0
  176. package/dist/entries/error-screen.d.ts.map +1 -0
  177. package/dist/entries/error-screen.js +8 -0
  178. package/dist/entries/error-screen.js.map +1 -0
  179. package/dist/entries/fullscreen-button.d.ts +5 -0
  180. package/dist/entries/fullscreen-button.d.ts.map +1 -0
  181. package/dist/entries/fullscreen-button.js +8 -0
  182. package/dist/entries/fullscreen-button.js.map +1 -0
  183. package/dist/entries/live-button.d.ts +5 -0
  184. package/dist/entries/live-button.d.ts.map +1 -0
  185. package/dist/entries/live-button.js +8 -0
  186. package/dist/entries/live-button.js.map +1 -0
  187. package/dist/entries/mute-button.d.ts +5 -0
  188. package/dist/entries/mute-button.d.ts.map +1 -0
  189. package/dist/entries/mute-button.js +8 -0
  190. package/dist/entries/mute-button.js.map +1 -0
  191. package/dist/entries/panels.d.ts +5 -0
  192. package/dist/entries/panels.d.ts.map +1 -0
  193. package/dist/entries/panels.js +8 -0
  194. package/dist/entries/panels.js.map +1 -0
  195. package/dist/entries/pip-button.d.ts +5 -0
  196. package/dist/entries/pip-button.d.ts.map +1 -0
  197. package/dist/entries/pip-button.js +8 -0
  198. package/dist/entries/pip-button.js.map +1 -0
  199. package/dist/entries/play-button.d.ts +5 -0
  200. package/dist/entries/play-button.d.ts.map +1 -0
  201. package/dist/entries/play-button.js +8 -0
  202. package/dist/entries/play-button.js.map +1 -0
  203. package/dist/entries/quality-menu.d.ts +5 -0
  204. package/dist/entries/quality-menu.d.ts.map +1 -0
  205. package/dist/entries/quality-menu.js +8 -0
  206. package/dist/entries/quality-menu.js.map +1 -0
  207. package/dist/entries/seek-bar.d.ts +5 -0
  208. package/dist/entries/seek-bar.d.ts.map +1 -0
  209. package/dist/entries/seek-bar.js +8 -0
  210. package/dist/entries/seek-bar.js.map +1 -0
  211. package/dist/entries/skip-button.d.ts +5 -0
  212. package/dist/entries/skip-button.d.ts.map +1 -0
  213. package/dist/entries/skip-button.js +8 -0
  214. package/dist/entries/skip-button.js.map +1 -0
  215. package/dist/entries/spacer.d.ts +5 -0
  216. package/dist/entries/spacer.d.ts.map +1 -0
  217. package/dist/entries/spacer.js +8 -0
  218. package/dist/entries/spacer.js.map +1 -0
  219. package/dist/entries/speed-menu.d.ts +5 -0
  220. package/dist/entries/speed-menu.d.ts.map +1 -0
  221. package/dist/entries/speed-menu.js +8 -0
  222. package/dist/entries/speed-menu.js.map +1 -0
  223. package/dist/entries/start-button.d.ts +5 -0
  224. package/dist/entries/start-button.d.ts.map +1 -0
  225. package/dist/entries/start-button.js +8 -0
  226. package/dist/entries/start-button.js.map +1 -0
  227. package/dist/entries/subtitles-menu.d.ts +5 -0
  228. package/dist/entries/subtitles-menu.d.ts.map +1 -0
  229. package/dist/entries/subtitles-menu.js +8 -0
  230. package/dist/entries/subtitles-menu.js.map +1 -0
  231. package/dist/entries/volume-slider.d.ts +5 -0
  232. package/dist/entries/volume-slider.d.ts.map +1 -0
  233. package/dist/entries/volume-slider.js +8 -0
  234. package/dist/entries/volume-slider.js.map +1 -0
  235. package/dist/entries/volume.d.ts +7 -0
  236. package/dist/entries/volume.d.ts.map +1 -0
  237. package/dist/entries/volume.js +10 -0
  238. package/dist/entries/volume.js.map +1 -0
  239. package/dist/es2015/compose.js +33 -0
  240. package/dist/es2015/controls/chapters.js +61 -0
  241. package/dist/es2015/controls/cues.js +39 -11
  242. package/dist/es2015/controls/fullscreen.js +25 -23
  243. package/dist/es2015/controls/icons.js +5 -9
  244. package/dist/es2015/controls/menu.js +39 -35
  245. package/dist/es2015/controls/session.js +40 -0
  246. package/dist/es2015/controls/slider.js +18 -13
  247. package/dist/es2015/controls/time.js +1 -5
  248. package/dist/es2015/dom.js +5 -25
  249. package/dist/es2015/element-entry.js +10 -0
  250. package/dist/es2015/element.js +118 -65
  251. package/dist/es2015/elements/audio-menu.js +68 -0
  252. package/dist/es2015/elements/chapters-menu.js +68 -0
  253. package/dist/es2015/elements/component.js +84 -0
  254. package/dist/es2015/elements/control-bar.js +178 -0
  255. package/dist/es2015/elements/current-time.js +27 -0
  256. package/dist/es2015/elements/drm-badge.js +138 -0
  257. package/dist/es2015/elements/duration.js +23 -0
  258. package/dist/es2015/elements/error-screen.js +97 -0
  259. package/dist/es2015/elements/fullscreen-button.js +49 -0
  260. package/dist/es2015/elements/live-button.js +97 -0
  261. package/dist/es2015/elements/menu-element.js +39 -0
  262. package/dist/es2015/elements/mute-button.js +60 -0
  263. package/dist/es2015/elements/panels.js +52 -0
  264. package/dist/es2015/elements/pip-button.js +56 -0
  265. package/dist/es2015/elements/play-button.js +68 -0
  266. package/dist/es2015/elements/quality-menu.js +68 -0
  267. package/dist/es2015/elements/seek-bar.js +314 -0
  268. package/dist/es2015/elements/shared.js +155 -0
  269. package/dist/es2015/elements/skip-button.js +59 -0
  270. package/dist/es2015/elements/spacer.js +11 -0
  271. package/dist/es2015/elements/speed-menu.js +60 -0
  272. package/dist/es2015/elements/start-button.js +87 -0
  273. package/dist/es2015/elements/subtitles-menu.js +103 -0
  274. package/dist/es2015/elements/time-element.js +38 -0
  275. package/dist/es2015/elements/volume-slider.js +47 -0
  276. package/dist/es2015/elements/volume.js +50 -0
  277. package/dist/es2015/entries/audio-menu.js +7 -0
  278. package/dist/es2015/entries/chapters-menu.js +7 -0
  279. package/dist/es2015/entries/control-bar.js +7 -0
  280. package/dist/es2015/entries/current-time.js +7 -0
  281. package/dist/es2015/entries/drm-badge.js +7 -0
  282. package/dist/es2015/entries/duration.js +7 -0
  283. package/dist/es2015/entries/error-screen.js +7 -0
  284. package/dist/es2015/entries/fullscreen-button.js +7 -0
  285. package/dist/es2015/entries/live-button.js +7 -0
  286. package/dist/es2015/entries/mute-button.js +7 -0
  287. package/dist/es2015/entries/panels.js +7 -0
  288. package/dist/es2015/entries/pip-button.js +7 -0
  289. package/dist/es2015/entries/play-button.js +7 -0
  290. package/dist/es2015/entries/quality-menu.js +7 -0
  291. package/dist/es2015/entries/seek-bar.js +7 -0
  292. package/dist/es2015/entries/skip-button.js +7 -0
  293. package/dist/es2015/entries/spacer.js +7 -0
  294. package/dist/es2015/entries/speed-menu.js +7 -0
  295. package/dist/es2015/entries/start-button.js +7 -0
  296. package/dist/es2015/entries/subtitles-menu.js +7 -0
  297. package/dist/es2015/entries/volume-slider.js +7 -0
  298. package/dist/es2015/entries/volume.js +9 -0
  299. package/dist/es2015/host.js +23 -0
  300. package/dist/es2015/index.js +46 -9
  301. package/dist/es2015/labels.js +14 -0
  302. package/dist/es2015/style.js +21 -294
  303. package/dist/es2015/{panels/error.js → surface.js} +3 -3
  304. package/dist/es2015/tags.js +27 -0
  305. package/dist/host.d.ts +26 -0
  306. package/dist/host.d.ts.map +1 -0
  307. package/dist/host.js +23 -0
  308. package/dist/host.js.map +1 -0
  309. package/dist/index.d.ts +81 -3
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +23 -8
  312. package/dist/index.js.map +1 -1
  313. package/dist/labels.d.ts +7 -0
  314. package/dist/labels.d.ts.map +1 -0
  315. package/dist/labels.js +12 -0
  316. package/dist/labels.js.map +1 -0
  317. package/dist/style.d.ts +4 -2
  318. package/dist/style.d.ts.map +1 -1
  319. package/dist/style.js +21 -294
  320. package/dist/style.js.map +1 -1
  321. package/dist/surface.d.ts +15 -0
  322. package/dist/surface.d.ts.map +1 -0
  323. package/dist/{panels/error.js → surface.js} +3 -3
  324. package/dist/surface.js.map +1 -0
  325. package/dist/tags.d.ts +25 -0
  326. package/dist/tags.d.ts.map +1 -0
  327. package/dist/tags.js +25 -0
  328. package/dist/tags.js.map +1 -0
  329. package/package.json +22 -2
  330. package/dist/controls/bar.d.ts +0 -56
  331. package/dist/controls/bar.d.ts.map +0 -1
  332. package/dist/controls/bar.js +0 -245
  333. package/dist/controls/bar.js.map +0 -1
  334. package/dist/controls/buttons.d.ts +0 -13
  335. package/dist/controls/buttons.d.ts.map +0 -1
  336. package/dist/controls/buttons.js +0 -157
  337. package/dist/controls/buttons.js.map +0 -1
  338. package/dist/controls/control.d.ts +0 -12
  339. package/dist/controls/control.d.ts.map +0 -1
  340. package/dist/controls/control.js +0 -2
  341. package/dist/controls/control.js.map +0 -1
  342. package/dist/controls/keys.d.ts +0 -26
  343. package/dist/controls/keys.d.ts.map +0 -1
  344. package/dist/controls/keys.js +0 -66
  345. package/dist/controls/keys.js.map +0 -1
  346. package/dist/controls/live.d.ts +0 -10
  347. package/dist/controls/live.d.ts.map +0 -1
  348. package/dist/controls/live.js +0 -59
  349. package/dist/controls/live.js.map +0 -1
  350. package/dist/controls/menus.d.ts +0 -43
  351. package/dist/controls/menus.d.ts.map +0 -1
  352. package/dist/controls/menus.js +0 -262
  353. package/dist/controls/menus.js.map +0 -1
  354. package/dist/controls/options.d.ts +0 -44
  355. package/dist/controls/options.d.ts.map +0 -1
  356. package/dist/controls/options.js +0 -54
  357. package/dist/controls/options.js.map +0 -1
  358. package/dist/controls/screens.d.ts +0 -22
  359. package/dist/controls/screens.d.ts.map +0 -1
  360. package/dist/controls/screens.js +0 -69
  361. package/dist/controls/screens.js.map +0 -1
  362. package/dist/controls/seek.d.ts +0 -52
  363. package/dist/controls/seek.d.ts.map +0 -1
  364. package/dist/controls/seek.js +0 -215
  365. package/dist/controls/seek.js.map +0 -1
  366. package/dist/controls/speed.d.ts +0 -8
  367. package/dist/controls/speed.d.ts.map +0 -1
  368. package/dist/controls/speed.js +0 -34
  369. package/dist/controls/speed.js.map +0 -1
  370. package/dist/controls/volume.d.ts +0 -8
  371. package/dist/controls/volume.d.ts.map +0 -1
  372. package/dist/controls/volume.js +0 -29
  373. package/dist/controls/volume.js.map +0 -1
  374. package/dist/es2015/controls/bar.js +0 -227
  375. package/dist/es2015/controls/buttons.js +0 -146
  376. package/dist/es2015/controls/keys.js +0 -60
  377. package/dist/es2015/controls/live.js +0 -60
  378. package/dist/es2015/controls/menus.js +0 -258
  379. package/dist/es2015/controls/options.js +0 -46
  380. package/dist/es2015/controls/screens.js +0 -74
  381. package/dist/es2015/controls/seek.js +0 -203
  382. package/dist/es2015/controls/speed.js +0 -41
  383. package/dist/es2015/controls/volume.js +0 -30
  384. package/dist/es2015/panels/drm.js +0 -29
  385. package/dist/es2015/panels/live.js +0 -48
  386. package/dist/es2015/panels/quality.js +0 -52
  387. package/dist/es2015/panels/tracks.js +0 -47
  388. package/dist/panels/drm.d.ts +0 -8
  389. package/dist/panels/drm.d.ts.map +0 -1
  390. package/dist/panels/drm.js +0 -36
  391. package/dist/panels/drm.js.map +0 -1
  392. package/dist/panels/error.d.ts +0 -13
  393. package/dist/panels/error.d.ts.map +0 -1
  394. package/dist/panels/error.js.map +0 -1
  395. package/dist/panels/live.d.ts +0 -3
  396. package/dist/panels/live.d.ts.map +0 -1
  397. package/dist/panels/live.js +0 -56
  398. package/dist/panels/live.js.map +0 -1
  399. package/dist/panels/panel.d.ts +0 -13
  400. package/dist/panels/panel.d.ts.map +0 -1
  401. package/dist/panels/panel.js +0 -2
  402. package/dist/panels/panel.js.map +0 -1
  403. package/dist/panels/quality.d.ts +0 -3
  404. package/dist/panels/quality.d.ts.map +0 -1
  405. package/dist/panels/quality.js +0 -59
  406. package/dist/panels/quality.js.map +0 -1
  407. package/dist/panels/tracks.d.ts +0 -3
  408. package/dist/panels/tracks.d.ts.map +0 -1
  409. package/dist/panels/tracks.js +0 -49
  410. package/dist/panels/tracks.js.map +0 -1
@@ -0,0 +1,178 @@
1
+ import { Component } from "./component.js";
2
+ import { number, style } from "./shared.js";
3
+ import { cueLift, cueStyle } from "../controls/cues.js";
4
+ import { fullscreen } from "../controls/fullscreen.js";
5
+ //#region src/elements/control-bar.ts
6
+ const IDLE_MS = 3e3;
7
+ const SEEK_STEP = 5;
8
+ const STYLE = `
9
+ :host {
10
+ position: absolute;
11
+ inset: auto 0 0 0;
12
+ box-sizing: border-box;
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 4px;
16
+ padding: 40px 16px 12px;
17
+ color: var(--mbx-text);
18
+ background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
19
+ font: 500 16px/1.2 var(--mbx-font);
20
+ transition: opacity 0.2s;
21
+ }
22
+ :host([idle]) { opacity: 0; pointer-events: none; }
23
+ [part~="row"] { display: flex; align-items: center; gap: 8px; }
24
+ [part~="seek-row"] { gap: 16px; }
25
+ @media (prefers-reduced-motion: reduce) {
26
+ :host { transition: none; }
27
+ }
28
+ `;
29
+ function end(video) {
30
+ if (Number.isFinite(video.duration)) return video.duration;
31
+ const ranges = video.seekable;
32
+ return ranges.length > 0 ? ranges.end(ranges.length - 1) : video.currentTime;
33
+ }
34
+ function toggle(video) {
35
+ if (video.paused) video.play().catch(() => void 0);
36
+ else video.pause();
37
+ }
38
+ var MbxControlBar = class extends Component {
39
+ static get observedAttributes() {
40
+ return ["idle-ms", "seek-step"];
41
+ }
42
+ constructor() {
43
+ super();
44
+ this.timer = void 0;
45
+ this.keyboard = false;
46
+ this.cues = null;
47
+ this.screen = null;
48
+ const root = this.attachShadow({ mode: "open" });
49
+ this.seekRow = document.createElement("div");
50
+ this.seekRow.setAttribute("part", "row seek-row");
51
+ const seek = document.createElement("slot");
52
+ seek.name = "seek";
53
+ this.seekRow.append(seek);
54
+ const buttons = document.createElement("div");
55
+ buttons.setAttribute("part", "row buttons-row");
56
+ buttons.append(document.createElement("slot"));
57
+ root.append(style(STYLE), this.seekRow, buttons);
58
+ }
59
+ /** From the first row's top to the bar's bottom: what the bar covers of the picture. */
60
+ covered() {
61
+ return {
62
+ top: this.seekRow.getBoundingClientRect().top,
63
+ bottom: this.getBoundingClientRect().bottom
64
+ };
65
+ }
66
+ held(player) {
67
+ if (player.video.paused) return true;
68
+ if (this.querySelector("[open]") !== null) return true;
69
+ if (!this.keyboard) return false;
70
+ const active = this.getRootNode().activeElement;
71
+ return active !== null && this.contains(active);
72
+ }
73
+ idle(player, on) {
74
+ var _this$cues;
75
+ if (this.hasAttribute("idle") === on) return;
76
+ this.toggleAttribute("idle", on);
77
+ player.toggleAttribute("idle", on);
78
+ (_this$cues = this.cues) === null || _this$cues === void 0 || _this$cues.lifted(!on);
79
+ }
80
+ sleep(player) {
81
+ this.timer = void 0;
82
+ if (this.held(player)) {
83
+ this.timer = setTimeout(() => this.sleep(player), number(this, "idle-ms", IDLE_MS));
84
+ return;
85
+ }
86
+ this.idle(player, true);
87
+ }
88
+ wake(player) {
89
+ clearTimeout(this.timer);
90
+ this.idle(player, false);
91
+ this.timer = setTimeout(() => this.sleep(player), number(this, "idle-ms", IDLE_MS));
92
+ }
93
+ key(player, event) {
94
+ this.keyboard = true;
95
+ this.wake(player);
96
+ if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;
97
+ const video = player.video;
98
+ const onButton = event.composedPath()[0] instanceof HTMLButtonElement;
99
+ switch (event.key) {
100
+ case " ":
101
+ if (onButton) return;
102
+ toggle(video);
103
+ break;
104
+ case "k":
105
+ case "K":
106
+ toggle(video);
107
+ break;
108
+ case "m":
109
+ case "M":
110
+ video.muted = !video.muted;
111
+ break;
112
+ case "f":
113
+ case "F":
114
+ var _this$screen;
115
+ (_this$screen = this.screen) === null || _this$screen === void 0 || _this$screen.toggle();
116
+ break;
117
+ case "ArrowLeft":
118
+ video.currentTime = Math.max(0, video.currentTime - number(this, "seek-step", SEEK_STEP));
119
+ break;
120
+ case "ArrowRight":
121
+ video.currentTime = Math.min(end(video), video.currentTime + number(this, "seek-step", SEEK_STEP));
122
+ break;
123
+ default: return;
124
+ }
125
+ event.preventDefault();
126
+ }
127
+ attach(player) {
128
+ const video = player.video;
129
+ cueStyle();
130
+ this.cues = cueLift(video, player, () => this.covered());
131
+ const screen = fullscreen(player, video);
132
+ this.screen = screen;
133
+ const reflect = () => {
134
+ player.toggleAttribute("fullscreen", screen.active());
135
+ };
136
+ this.keep(screen.watch(reflect));
137
+ reflect();
138
+ const pointer = () => {
139
+ this.keyboard = false;
140
+ this.wake(player);
141
+ };
142
+ const key = (event) => {
143
+ this.key(player, event);
144
+ };
145
+ const click = (event) => {
146
+ if (event.composedPath()[0] === video) toggle(video);
147
+ };
148
+ this.listen(player, ["pointermove", "pointerdown"], pointer);
149
+ player.addEventListener("keydown", key);
150
+ player.addEventListener("click", click);
151
+ this.keep(() => {
152
+ player.removeEventListener("keydown", key);
153
+ player.removeEventListener("click", click);
154
+ });
155
+ this.listen(video, [
156
+ "play",
157
+ "pause",
158
+ "ended"
159
+ ], () => {
160
+ this.wake(player);
161
+ });
162
+ this.wake(player);
163
+ this.cues.lifted(true);
164
+ }
165
+ detach(player) {
166
+ var _this$cues2;
167
+ clearTimeout(this.timer);
168
+ this.timer = void 0;
169
+ (_this$cues2 = this.cues) === null || _this$cues2 === void 0 || _this$cues2.dispose();
170
+ this.cues = null;
171
+ this.screen = null;
172
+ this.removeAttribute("idle");
173
+ player.removeAttribute("idle");
174
+ player.removeAttribute("fullscreen");
175
+ }
176
+ };
177
+ //#endregion
178
+ export { MbxControlBar };
@@ -0,0 +1,27 @@
1
+ import { format } from "../controls/time.js";
2
+ import { live, span, wall } from "../controls/session.js";
3
+ import { TimeElement } from "./time-element.js";
4
+ //#region src/elements/current-time.ts
5
+ /**
6
+ * <mbx-current-time>: the position, "1:23". On a live stream it reads the
7
+ * wall clock when `engine.pdt` can say it, "14:23:05", which is what a
8
+ * viewer of a broadcast wants to know, and the distance behind the edge
9
+ * otherwise, "-0:10". While the player says the stream is live but not
10
+ * seekable, which the seek bar decides, there is no position to show and
11
+ * the element hides.
12
+ */
13
+ var MbxCurrentTime = class extends TimeElement {
14
+ render() {
15
+ var _wall;
16
+ const player = this.player;
17
+ if (player === null) return;
18
+ const video = player.video;
19
+ const engine = player.engine;
20
+ const on = live(engine) !== void 0;
21
+ const time = video.currentTime;
22
+ this.text.data = on ? (_wall = wall(engine, time)) !== null && _wall !== void 0 ? _wall : `-${format(span(video, engine).end - time)}` : format(time);
23
+ this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable");
24
+ }
25
+ };
26
+ //#endregion
27
+ export { MbxCurrentTime };
@@ -0,0 +1,138 @@
1
+ import { namespaces } from "../namespaces.js";
2
+ import { el } from "../dom.js";
3
+ import { icon } from "../controls/icons.js";
4
+ import { fill } from "../labels.js";
5
+ import { Component } from "./component.js";
6
+ import { style } from "./shared.js";
7
+ //#region src/elements/drm-badge.ts
8
+ const STYLE = `
9
+ :host { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: var(--mbx-muted); border-radius: var(--mbx-radius); cursor: default; }
10
+ :host([hidden]) { display: none; }
11
+ :host(:focus-visible) { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
12
+ [part~="icon"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }
13
+ [part~="tooltip"] {
14
+ position: absolute;
15
+ right: 0;
16
+ bottom: 100%;
17
+ margin-bottom: 8px;
18
+ padding: 8px 10px;
19
+ background: rgba(16, 17, 20, 0.95);
20
+ border-radius: var(--mbx-radius);
21
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
22
+ color: var(--mbx-text);
23
+ font-size: 13px;
24
+ line-height: 1.4;
25
+ text-align: left;
26
+ white-space: nowrap;
27
+ pointer-events: none;
28
+ }
29
+ [part~="tooltip"][hidden] { display: none; }
30
+ [part~="tooltip-title"] { font-weight: 600; }
31
+ [part~="tooltip-text"] { color: var(--mbx-muted); }
32
+ `;
33
+ /** The name a viewer knows a key system by. */
34
+ function keySystemName(id) {
35
+ if (id.startsWith("com.widevine")) return "Widevine";
36
+ if (id.startsWith("com.microsoft.playready")) return "PlayReady";
37
+ if (id.startsWith("com.apple.fps")) return "FairPlay";
38
+ return id;
39
+ }
40
+ var MbxDrmBadge = class extends Component {
41
+ static get observedAttributes() {
42
+ return [
43
+ "label",
44
+ "label-key",
45
+ "label-keys",
46
+ "label-no-key"
47
+ ];
48
+ }
49
+ constructor() {
50
+ super();
51
+ this.engine = null;
52
+ const root = this.attachShadow({ mode: "open" });
53
+ const slot = document.createElement("slot");
54
+ slot.name = "icon";
55
+ slot.append(icon("lock-closed"));
56
+ this.tooltip = el("div", "tooltip");
57
+ this.tooltip.setAttribute("role", "tooltip");
58
+ this.system = el("div", "tooltip-title");
59
+ this.system_id = el("div", "tooltip-text");
60
+ this.keys = el("div", "tooltip-text");
61
+ this.tooltip.append(this.system, this.system_id, this.keys);
62
+ this.tooltip.hidden = true;
63
+ root.append(style(STYLE), slot, this.tooltip);
64
+ const show = () => {
65
+ this.tooltip.hidden = false;
66
+ };
67
+ const hide = () => {
68
+ this.tooltip.hidden = true;
69
+ };
70
+ this.addEventListener("pointerenter", show);
71
+ this.addEventListener("pointerleave", hide);
72
+ this.addEventListener("focus", show);
73
+ this.addEventListener("blur", hide);
74
+ }
75
+ /** Named and focusable before attaching: a constructor must not add attributes. */
76
+ connectedCallback() {
77
+ if (!this.hasAttribute("role")) this.setAttribute("role", "img");
78
+ if (!this.hasAttribute("tabindex")) this.tabIndex = 0;
79
+ if (this.player === null) this.hidden = true;
80
+ super.connectedCallback();
81
+ }
82
+ /** "3 keys: usable ×2, expired", or "no key yet". */
83
+ sessionsText(sessions) {
84
+ var _this$getAttribute, _this$getAttribute2, _this$getAttribute3;
85
+ if (sessions.length === 0) return (_this$getAttribute = this.getAttribute("label-no-key")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "no key yet";
86
+ const counts = /* @__PURE__ */ new Map();
87
+ for (const session of sessions) {
88
+ var _counts$get;
89
+ counts.set(session.status, ((_counts$get = counts.get(session.status)) !== null && _counts$get !== void 0 ? _counts$get : 0) + 1);
90
+ }
91
+ const parts = [];
92
+ for (const [status, count] of counts) parts.push(count > 1 ? `${status} ×${count}` : status);
93
+ const template = sessions.length === 1 ? (_this$getAttribute2 = this.getAttribute("label-key")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "{count} key: {statuses}" : (_this$getAttribute3 = this.getAttribute("label-keys")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "{count} keys: {statuses}";
94
+ return fill(template, {
95
+ count: sessions.length,
96
+ statuses: parts.join(", ")
97
+ });
98
+ }
99
+ attach(player) {
100
+ this.follow(player, (engine) => {
101
+ this.engine = engine;
102
+ this.render();
103
+ if (engine === null || namespaces(engine).drm === void 0) return void 0;
104
+ const tick = () => {
105
+ this.render();
106
+ };
107
+ const offs = [
108
+ engine.on("drm:keysystem", tick),
109
+ engine.on("drm:keystatus", tick),
110
+ engine.on("drm:encrypted", tick)
111
+ ];
112
+ return () => {
113
+ for (const off of offs) off();
114
+ };
115
+ });
116
+ }
117
+ detach() {
118
+ this.tooltip.hidden = true;
119
+ }
120
+ render() {
121
+ var _drm$keySystem, _this$getAttribute4;
122
+ const drm = this.engine === null ? void 0 : namespaces(this.engine).drm;
123
+ const name = (_drm$keySystem = drm === null || drm === void 0 ? void 0 : drm.keySystem) !== null && _drm$keySystem !== void 0 ? _drm$keySystem : null;
124
+ this.hidden = name === null;
125
+ if (drm === void 0 || name === null) return;
126
+ const keys = this.sessionsText(drm.sessions);
127
+ const system = keySystemName(name);
128
+ this.system.textContent = system;
129
+ this.system_id.textContent = name;
130
+ this.keys.textContent = keys;
131
+ this.setAttribute("aria-label", fill((_this$getAttribute4 = this.getAttribute("label")) !== null && _this$getAttribute4 !== void 0 ? _this$getAttribute4 : "Protected by {system}, {keys}", {
132
+ system,
133
+ keys
134
+ }));
135
+ }
136
+ };
137
+ //#endregion
138
+ export { MbxDrmBadge };
@@ -0,0 +1,23 @@
1
+ import { format } from "../controls/time.js";
2
+ import { live, span } from "../controls/session.js";
3
+ import { TimeElement } from "./time-element.js";
4
+ //#region src/elements/duration.ts
5
+ /**
6
+ * <mbx-duration>: the duration, "4:56", once the metadata is in. A live
7
+ * stream has none, so the element hides while the stream is live.
8
+ */
9
+ var MbxDuration = class extends TimeElement {
10
+ constructor() {
11
+ super(":host { text-align: right; }");
12
+ }
13
+ render() {
14
+ const player = this.player;
15
+ if (player === null) return;
16
+ const engine = player.engine;
17
+ const on = live(engine) !== void 0;
18
+ this.hidden = on;
19
+ if (!on) this.text.data = format(span(player.video, engine).end);
20
+ }
21
+ };
22
+ //#endregion
23
+ export { MbxDuration };
@@ -0,0 +1,97 @@
1
+ import { el } from "../dom.js";
2
+ import { Component } from "./component.js";
3
+ import { style } from "./shared.js";
4
+ //#region src/elements/error-screen.ts
5
+ const STYLE = `
6
+ :host {
7
+ position: absolute;
8
+ inset: 0;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ padding: 16px;
13
+ background: rgba(0, 0, 0, 0.75);
14
+ color: var(--mbx-text);
15
+ font: 400 15px/1.4 var(--mbx-font);
16
+ text-align: center;
17
+ }
18
+ :host([hidden]) { display: none; }
19
+ [part~="box"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
20
+ [part~="title"] { font-size: 18px; font-weight: 600; }
21
+ [part~="detail"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }
22
+ [part~="retry"] {
23
+ height: 36px;
24
+ padding: 0 16px;
25
+ font: inherit;
26
+ font-weight: 600;
27
+ color: inherit;
28
+ background: transparent;
29
+ border: 1px solid currentColor;
30
+ border-radius: var(--mbx-radius);
31
+ cursor: pointer;
32
+ }
33
+ [part~="retry"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
34
+ `;
35
+ var MbxErrorScreen = class extends Component {
36
+ static get observedAttributes() {
37
+ return ["label-title", "label-retry"];
38
+ }
39
+ constructor() {
40
+ super();
41
+ const root = this.attachShadow({ mode: "open" });
42
+ const box = el("div", "box");
43
+ this.title_ = el("div", "title");
44
+ this.category = el("span", "category");
45
+ this.code = el("span", "code");
46
+ const detail = el("div", "detail");
47
+ detail.append(this.category, el("span", "separator", " · "), this.code);
48
+ this.retry = el("button", "retry");
49
+ this.retry.type = "button";
50
+ this.retry.addEventListener("click", () => {
51
+ const player = this.player;
52
+ const src = player === null || player === void 0 ? void 0 : player.getAttribute("src");
53
+ if (player !== null && player !== void 0 && src !== null && src !== void 0) player.setAttribute("src", src);
54
+ });
55
+ box.append(this.title_, detail, this.retry);
56
+ root.append(style(STYLE), box);
57
+ }
58
+ /** Hidden and named before attaching: a constructor must not add attributes. */
59
+ connectedCallback() {
60
+ if (this.player === null) this.hidden = true;
61
+ if (!this.hasAttribute("role")) this.setAttribute("role", "alert");
62
+ super.connectedCallback();
63
+ }
64
+ show(error) {
65
+ this.category.textContent = error.category;
66
+ this.code.textContent = error.code;
67
+ this.hidden = false;
68
+ }
69
+ attach(player) {
70
+ const failure = (event) => {
71
+ const error = event.detail;
72
+ if (error.fatal) this.show(error);
73
+ };
74
+ player.addEventListener("error", failure);
75
+ this.keep(() => {
76
+ player.removeEventListener("error", failure);
77
+ });
78
+ this.listen(player.video, ["playing", "loadstart"], () => {
79
+ this.hidden = true;
80
+ });
81
+ this.listen(player, ["sourcechange"], () => {
82
+ this.hidden = true;
83
+ });
84
+ if (player.error !== null) this.show(player.error);
85
+ this.render();
86
+ }
87
+ detach() {
88
+ this.hidden = true;
89
+ }
90
+ render() {
91
+ var _this$getAttribute, _this$getAttribute2;
92
+ this.title_.textContent = (_this$getAttribute = this.getAttribute("label-title")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Playback failed";
93
+ this.retry.textContent = (_this$getAttribute2 = this.getAttribute("label-retry")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "Retry";
94
+ }
95
+ };
96
+ //#endregion
97
+ export { MbxErrorScreen };
@@ -0,0 +1,49 @@
1
+ import { icon } from "../controls/icons.js";
2
+ import { Component } from "./component.js";
3
+ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
+ import { fullscreen } from "../controls/fullscreen.js";
5
+ //#region src/elements/fullscreen-button.ts
6
+ const STATES = ["enter", "exit"];
7
+ var MbxFullscreenButton = class extends Component {
8
+ static get observedAttributes() {
9
+ return ["label-enter", "label-exit"];
10
+ }
11
+ constructor() {
12
+ super();
13
+ this.api = null;
14
+ const root = this.attachShadow({ mode: "open" });
15
+ this.button = document.createElement("button");
16
+ this.button.type = "button";
17
+ this.button.setAttribute("part", "button");
18
+ this.slots = iconSlots(STATES, (state) => icon(state === "enter" ? "fullscreen" : "fullscreen-exit"));
19
+ for (const state of STATES) this.button.append(this.slots[state]);
20
+ this.button.addEventListener("click", () => {
21
+ var _this$api;
22
+ (_this$api = this.api) === null || _this$api === void 0 || _this$api.toggle();
23
+ });
24
+ root.append(style(BUTTON_STYLE), this.button);
25
+ }
26
+ attach(player) {
27
+ const api = fullscreen(player, player.video);
28
+ this.api = api;
29
+ this.hidden = !api.supported;
30
+ this.keep(api.watch(() => {
31
+ this.render();
32
+ }));
33
+ this.render();
34
+ }
35
+ detach() {
36
+ this.api = null;
37
+ }
38
+ render() {
39
+ var _this$getAttribute, _this$getAttribute2;
40
+ const player = this.player;
41
+ if (player === null || this.api === null) return;
42
+ const active = this.api.active();
43
+ show(this.slots, active ? "exit" : "enter");
44
+ this.button.setAttribute("aria-label", active ? (_this$getAttribute = this.getAttribute("label-exit")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Exit fullscreen" : (_this$getAttribute2 = this.getAttribute("label-enter")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "Enter fullscreen");
45
+ player.toggleAttribute("fullscreen", active);
46
+ }
47
+ };
48
+ //#endregion
49
+ export { MbxFullscreenButton };
@@ -0,0 +1,97 @@
1
+ import { el } from "../dom.js";
2
+ import { Component } from "./component.js";
3
+ import { seekRow, style } from "./shared.js";
4
+ import { live } from "../controls/session.js";
5
+ //#region src/elements/live-button.ts
6
+ /**
7
+ * <mbx-live-button>: a dot and the word, the dot red at the edge and grey
8
+ * behind it, the way viewers read it everywhere. Shown once the stream has
9
+ * an availability window, which is what makes it live; disabled at the
10
+ * edge, where there is nowhere to go; a click seeks to the edge, the one
11
+ * engine write the row makes. The element carries `at-edge` meanwhile.
12
+ *
13
+ * Without a seek bar, when the player says the stream is not seekable,
14
+ * there is nowhere to come back from either: the dot stays red and the
15
+ * button stays inert, whatever the playhead does. The word comes from
16
+ * `text`, the name from `label-live` and `label-at-edge`. It sits in the
17
+ * bar's seek row unless the page says otherwise.
18
+ */
19
+ const STYLE = `
20
+ :host { display: inline-flex; }
21
+ :host([hidden]) { display: none; }
22
+ [part~="button"] {
23
+ display: inline-flex;
24
+ align-items: center;
25
+ gap: 6px;
26
+ height: 40px;
27
+ padding: 0 8px;
28
+ font: inherit;
29
+ font-size: 12px;
30
+ font-weight: 700;
31
+ letter-spacing: 0.06em;
32
+ color: inherit;
33
+ background: transparent;
34
+ border: 0;
35
+ border-radius: var(--mbx-radius);
36
+ cursor: pointer;
37
+ opacity: 0.9;
38
+ }
39
+ [part~="button"]:hover { opacity: 1; }
40
+ [part~="button"]:disabled { cursor: default; opacity: 1; }
41
+ [part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
42
+ [part~="dot"] { width: 10px; height: 10px; border-radius: 50%; background: var(--mbx-muted); transition: background 0.2s; }
43
+ :host([at-edge]) [part~="dot"] { background: var(--mbx-live); box-shadow: 0 0 6px var(--mbx-live); }
44
+ @media (prefers-reduced-motion: reduce) {
45
+ [part~="dot"] { transition: none; }
46
+ }
47
+ `;
48
+ var MbxLiveButton = class extends Component {
49
+ static get observedAttributes() {
50
+ return [
51
+ "text",
52
+ "label-live",
53
+ "label-at-edge"
54
+ ];
55
+ }
56
+ constructor() {
57
+ super();
58
+ const root = this.attachShadow({ mode: "open" });
59
+ this.button = el("button", "button");
60
+ this.button.type = "button";
61
+ this.text = el("span", "text");
62
+ this.button.append(el("span", "dot"), this.text);
63
+ this.button.addEventListener("click", () => {
64
+ var _live, _this$player$engine, _this$player;
65
+ (_live = live((_this$player$engine = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.engine) !== null && _this$player$engine !== void 0 ? _this$player$engine : null)) === null || _live === void 0 || _live.seekToEdge();
66
+ });
67
+ root.append(style(STYLE), this.button);
68
+ }
69
+ connectedCallback() {
70
+ seekRow(this);
71
+ super.connectedCallback();
72
+ }
73
+ attach(player) {
74
+ const tick = () => {
75
+ this.render();
76
+ };
77
+ this.listen(player.video, ["timeupdate", "emptied"], tick);
78
+ this.listen(player, ["sourcechange"], tick);
79
+ this.observe(player, ["live", "seekable"], tick);
80
+ this.render();
81
+ }
82
+ render() {
83
+ var _this$getAttribute, _this$getAttribute2, _this$getAttribute3;
84
+ const player = this.player;
85
+ if (player === null) return;
86
+ const api = live(player.engine);
87
+ this.hidden = api === void 0;
88
+ this.text.textContent = (_this$getAttribute = this.getAttribute("text")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "LIVE";
89
+ if (api === void 0) return;
90
+ const atEdge = player.hasAttribute("live") && !player.hasAttribute("seekable") || api.atEdge;
91
+ this.button.disabled = atEdge;
92
+ this.toggleAttribute("at-edge", atEdge);
93
+ this.button.setAttribute("aria-label", atEdge ? (_this$getAttribute2 = this.getAttribute("label-at-edge")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "At the live edge" : (_this$getAttribute3 = this.getAttribute("label-live")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Go to the live edge");
94
+ }
95
+ };
96
+ //#endregion
97
+ export { MbxLiveButton };
@@ -0,0 +1,39 @@
1
+ import { icon } from "../controls/icons.js";
2
+ import { menu } from "../controls/menu.js";
3
+ import { fill } from "../labels.js";
4
+ import { Component } from "./component.js";
5
+ import { MENU_STYLE, iconSlots, style } from "./shared.js";
6
+ //#region src/elements/menu-element.ts
7
+ var MenuElement = class extends Component {
8
+ constructor(states, glyphs) {
9
+ super();
10
+ const root = this.attachShadow({ mode: "open" });
11
+ this.menu = menu({
12
+ host: this,
13
+ ceiling: () => {
14
+ var _this$player$video$ge, _this$player;
15
+ return (_this$player$video$ge = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video.getBoundingClientRect().top) !== null && _this$player$video$ge !== void 0 ? _this$player$video$ge : null;
16
+ },
17
+ back: (page) => {
18
+ var _this$getAttribute;
19
+ return fill((_this$getAttribute = this.getAttribute("label-back")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Back from {page}", { page });
20
+ }
21
+ });
22
+ this.slots = iconSlots(states, glyphs);
23
+ for (const state of states) this.menu.button.append(this.slots[state]);
24
+ root.append(style(MENU_STYLE), this.menu.button, this.menu.popup);
25
+ }
26
+ detach() {
27
+ this.menu.close();
28
+ }
29
+ render() {
30
+ var _this$getAttribute2;
31
+ this.menu.label((_this$getAttribute2 = this.getAttribute("label")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : this.name());
32
+ }
33
+ };
34
+ /** A glyph that never changes, for a menu of one state. */
35
+ function single(name) {
36
+ return [["default"], () => icon(name)];
37
+ }
38
+ //#endregion
39
+ export { MenuElement, single };