@mattebox/player 0.6.0 → 0.7.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 (241) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -435
  2. package/dist/controls/airplay.js +28 -44
  3. package/dist/controls/airplay.js.map +1 -1
  4. package/dist/controls/chapters.d.ts +22 -11
  5. package/dist/controls/chapters.d.ts.map +1 -1
  6. package/dist/controls/chapters.js +87 -73
  7. package/dist/controls/chapters.js.map +1 -1
  8. package/dist/controls/cues.d.ts +0 -22
  9. package/dist/controls/cues.d.ts.map +1 -1
  10. package/dist/controls/cues.js +161 -191
  11. package/dist/controls/cues.js.map +1 -1
  12. package/dist/controls/fullscreen.js +52 -70
  13. package/dist/controls/fullscreen.js.map +1 -1
  14. package/dist/controls/icons.d.ts +1 -1
  15. package/dist/controls/icons.d.ts.map +1 -1
  16. package/dist/controls/icons.js +46 -70
  17. package/dist/controls/icons.js.map +1 -1
  18. package/dist/controls/menu.d.ts +7 -4
  19. package/dist/controls/menu.d.ts.map +1 -1
  20. package/dist/controls/menu.js +241 -223
  21. package/dist/controls/menu.js.map +1 -1
  22. package/dist/controls/pip.js +35 -49
  23. package/dist/controls/pip.js.map +1 -1
  24. package/dist/controls/ranges.js +42 -37
  25. package/dist/controls/ranges.js.map +1 -1
  26. package/dist/controls/session.d.ts +6 -1
  27. package/dist/controls/session.d.ts.map +1 -1
  28. package/dist/controls/session.js +41 -26
  29. package/dist/controls/session.js.map +1 -1
  30. package/dist/controls/slider.d.ts +2 -2
  31. package/dist/controls/slider.d.ts.map +1 -1
  32. package/dist/controls/slider.js +151 -159
  33. package/dist/controls/slider.js.map +1 -1
  34. package/dist/controls/time.js +17 -17
  35. package/dist/controls/time.js.map +1 -1
  36. package/dist/dom.d.ts +6 -0
  37. package/dist/dom.d.ts.map +1 -1
  38. package/dist/dom.js +28 -19
  39. package/dist/dom.js.map +1 -1
  40. package/dist/element-entry.js +9 -6
  41. package/dist/element-entry.js.map +1 -1
  42. package/dist/element.d.ts +4 -2
  43. package/dist/element.d.ts.map +1 -1
  44. package/dist/element.js +384 -443
  45. package/dist/element.js.map +1 -1
  46. package/dist/elements/airplay-button.js +51 -53
  47. package/dist/elements/airplay-button.js.map +1 -1
  48. package/dist/elements/audio-menu.js +62 -63
  49. package/dist/elements/audio-menu.js.map +1 -1
  50. package/dist/elements/chapters-menu.d.ts.map +1 -1
  51. package/dist/elements/chapters-menu.js +75 -65
  52. package/dist/elements/chapters-menu.js.map +1 -1
  53. package/dist/elements/component.d.ts +1 -1
  54. package/dist/elements/component.d.ts.map +1 -1
  55. package/dist/elements/component.js +86 -89
  56. package/dist/elements/component.js.map +1 -1
  57. package/dist/elements/control-bar.d.ts +18 -5
  58. package/dist/elements/control-bar.d.ts.map +1 -1
  59. package/dist/elements/control-bar.js +282 -319
  60. package/dist/elements/control-bar.js.map +1 -1
  61. package/dist/elements/current-time.js +26 -25
  62. package/dist/elements/current-time.js.map +1 -1
  63. package/dist/elements/drm-badge.d.ts.map +1 -1
  64. package/dist/elements/drm-badge.js +107 -141
  65. package/dist/elements/drm-badge.js.map +1 -1
  66. package/dist/elements/duration.d.ts.map +1 -1
  67. package/dist/elements/duration.js +24 -21
  68. package/dist/elements/duration.js.map +1 -1
  69. package/dist/elements/error-screen.d.ts.map +1 -1
  70. package/dist/elements/error-screen.js +68 -102
  71. package/dist/elements/error-screen.js.map +1 -1
  72. package/dist/elements/fullscreen-button.js +48 -54
  73. package/dist/elements/fullscreen-button.js.map +1 -1
  74. package/dist/elements/live-button.d.ts.map +1 -1
  75. package/dist/elements/live-button.js +67 -94
  76. package/dist/elements/live-button.js.map +1 -1
  77. package/dist/elements/menu-element.js +31 -28
  78. package/dist/elements/menu-element.js.map +1 -1
  79. package/dist/elements/mute-button.js +58 -59
  80. package/dist/elements/mute-button.js.map +1 -1
  81. package/dist/elements/pip-button.js +54 -54
  82. package/dist/elements/pip-button.js.map +1 -1
  83. package/dist/elements/play-button.d.ts.map +1 -1
  84. package/dist/elements/play-button.js +73 -58
  85. package/dist/elements/play-button.js.map +1 -1
  86. package/dist/elements/quality-menu.js +66 -69
  87. package/dist/elements/quality-menu.js.map +1 -1
  88. package/dist/elements/remaining-time.d.ts.map +1 -1
  89. package/dist/elements/remaining-time.js +27 -24
  90. package/dist/elements/remaining-time.js.map +1 -1
  91. package/dist/elements/scan-button.d.ts +17 -0
  92. package/dist/elements/scan-button.d.ts.map +1 -0
  93. package/dist/elements/scan-button.js +117 -0
  94. package/dist/elements/scan-button.js.map +1 -0
  95. package/dist/elements/seek-bar.d.ts +93 -14
  96. package/dist/elements/seek-bar.d.ts.map +1 -1
  97. package/dist/elements/seek-bar.js +475 -335
  98. package/dist/elements/seek-bar.js.map +1 -1
  99. package/dist/elements/shared.d.ts +3 -11
  100. package/dist/elements/shared.d.ts.map +1 -1
  101. package/dist/elements/shared.js +44 -144
  102. package/dist/elements/shared.js.map +1 -1
  103. package/dist/elements/skip-button.d.ts.map +1 -1
  104. package/dist/elements/skip-button.js +54 -55
  105. package/dist/elements/skip-button.js.map +1 -1
  106. package/dist/elements/spacer.d.ts.map +1 -1
  107. package/dist/elements/spacer.js +12 -7
  108. package/dist/elements/spacer.js.map +1 -1
  109. package/dist/elements/speed-menu.js +60 -55
  110. package/dist/elements/speed-menu.js.map +1 -1
  111. package/dist/elements/spinner.d.ts.map +1 -1
  112. package/dist/elements/spinner.js +52 -78
  113. package/dist/elements/spinner.js.map +1 -1
  114. package/dist/elements/start-button.d.ts.map +1 -1
  115. package/dist/elements/start-button.js +107 -120
  116. package/dist/elements/start-button.js.map +1 -1
  117. package/dist/elements/subtitles-menu.js +95 -103
  118. package/dist/elements/subtitles-menu.js.map +1 -1
  119. package/dist/elements/time-element.d.ts.map +1 -1
  120. package/dist/elements/time-element.js +36 -28
  121. package/dist/elements/time-element.js.map +1 -1
  122. package/dist/elements/title.d.ts.map +1 -1
  123. package/dist/elements/title.js +105 -137
  124. package/dist/elements/title.js.map +1 -1
  125. package/dist/elements/volume-slider.d.ts.map +1 -1
  126. package/dist/elements/volume-slider.js +47 -45
  127. package/dist/elements/volume-slider.js.map +1 -1
  128. package/dist/elements/volume.d.ts.map +1 -1
  129. package/dist/elements/volume.js +42 -50
  130. package/dist/elements/volume.js.map +1 -1
  131. package/dist/entries/airplay-button.js +7 -7
  132. package/dist/entries/airplay-button.js.map +1 -1
  133. package/dist/entries/audio-menu.js +7 -6
  134. package/dist/entries/audio-menu.js.map +1 -1
  135. package/dist/entries/chapters-menu.js +7 -7
  136. package/dist/entries/chapters-menu.js.map +1 -1
  137. package/dist/entries/control-bar.js +7 -6
  138. package/dist/entries/control-bar.js.map +1 -1
  139. package/dist/entries/current-time.js +7 -6
  140. package/dist/entries/current-time.js.map +1 -1
  141. package/dist/entries/drm-badge.js +7 -6
  142. package/dist/entries/drm-badge.js.map +1 -1
  143. package/dist/entries/duration.js +7 -6
  144. package/dist/entries/duration.js.map +1 -1
  145. package/dist/entries/error-screen.js +7 -6
  146. package/dist/entries/error-screen.js.map +1 -1
  147. package/dist/entries/fullscreen-button.js +7 -6
  148. package/dist/entries/fullscreen-button.js.map +1 -1
  149. package/dist/entries/live-button.js +7 -6
  150. package/dist/entries/live-button.js.map +1 -1
  151. package/dist/entries/mute-button.js +7 -6
  152. package/dist/entries/mute-button.js.map +1 -1
  153. package/dist/entries/pip-button.js +7 -6
  154. package/dist/entries/pip-button.js.map +1 -1
  155. package/dist/entries/play-button.js +7 -6
  156. package/dist/entries/play-button.js.map +1 -1
  157. package/dist/entries/quality-menu.js +7 -6
  158. package/dist/entries/quality-menu.js.map +1 -1
  159. package/dist/entries/remaining-time.js +7 -7
  160. package/dist/entries/remaining-time.js.map +1 -1
  161. package/dist/entries/scan-button.d.ts +5 -0
  162. package/dist/entries/scan-button.d.ts.map +1 -0
  163. package/dist/entries/scan-button.js +9 -0
  164. package/dist/entries/scan-button.js.map +1 -0
  165. package/dist/entries/seek-bar.js +7 -6
  166. package/dist/entries/seek-bar.js.map +1 -1
  167. package/dist/entries/skip-button.js +7 -6
  168. package/dist/entries/skip-button.js.map +1 -1
  169. package/dist/entries/spacer.js +7 -6
  170. package/dist/entries/spacer.js.map +1 -1
  171. package/dist/entries/speed-menu.js +7 -6
  172. package/dist/entries/speed-menu.js.map +1 -1
  173. package/dist/entries/spinner.js +7 -7
  174. package/dist/entries/spinner.js.map +1 -1
  175. package/dist/entries/start-button.js +7 -6
  176. package/dist/entries/start-button.js.map +1 -1
  177. package/dist/entries/subtitles-menu.js +7 -6
  178. package/dist/entries/subtitles-menu.js.map +1 -1
  179. package/dist/entries/title.js +7 -7
  180. package/dist/entries/title.js.map +1 -1
  181. package/dist/entries/volume-slider.js +7 -6
  182. package/dist/entries/volume-slider.js.map +1 -1
  183. package/dist/entries/volume.js +9 -8
  184. package/dist/entries/volume.js.map +1 -1
  185. package/dist/es2015/controls/chapters.js +40 -7
  186. package/dist/es2015/controls/cues.js +1 -8
  187. package/dist/es2015/controls/icons.js +3 -1
  188. package/dist/es2015/controls/menu.js +27 -8
  189. package/dist/es2015/controls/session.js +16 -4
  190. package/dist/es2015/controls/slider.js +5 -4
  191. package/dist/es2015/dom.js +10 -1
  192. package/dist/es2015/element.js +23 -7
  193. package/dist/es2015/elements/chapters-menu.js +18 -10
  194. package/dist/es2015/elements/control-bar.js +41 -35
  195. package/dist/es2015/elements/drm-badge.js +1 -25
  196. package/dist/es2015/elements/duration.js +2 -1
  197. package/dist/es2015/elements/error-screen.js +1 -30
  198. package/dist/es2015/elements/live-button.js +1 -29
  199. package/dist/es2015/elements/menu-element.js +2 -2
  200. package/dist/es2015/elements/play-button.js +10 -3
  201. package/dist/es2015/elements/remaining-time.js +2 -1
  202. package/dist/es2015/elements/scan-button.js +118 -0
  203. package/dist/es2015/elements/seek-bar.js +264 -71
  204. package/dist/es2015/elements/shared.js +5 -106
  205. package/dist/es2015/elements/skip-button.js +2 -1
  206. package/dist/es2015/elements/spacer.js +2 -1
  207. package/dist/es2015/elements/spinner.js +1 -32
  208. package/dist/es2015/elements/start-button.js +8 -26
  209. package/dist/es2015/elements/time-element.js +1 -4
  210. package/dist/es2015/elements/title.js +1 -45
  211. package/dist/es2015/elements/volume-slider.js +2 -1
  212. package/dist/es2015/elements/volume.js +1 -11
  213. package/dist/es2015/entries/scan-button.js +7 -0
  214. package/dist/es2015/index.js +3 -1
  215. package/dist/es2015/style.js +1 -101
  216. package/dist/es2015/tags.js +2 -1
  217. package/dist/host.js +19 -17
  218. package/dist/host.js.map +1 -1
  219. package/dist/index.d.ts +3 -0
  220. package/dist/index.d.ts.map +1 -1
  221. package/dist/index.js +55 -27
  222. package/dist/labels.js +13 -9
  223. package/dist/labels.js.map +1 -1
  224. package/dist/namespaces.d.ts +9 -26
  225. package/dist/namespaces.d.ts.map +1 -1
  226. package/dist/namespaces.js +6 -2
  227. package/dist/namespaces.js.map +1 -1
  228. package/dist/presets.js +33 -28
  229. package/dist/presets.js.map +1 -1
  230. package/dist/style.d.ts +1 -20
  231. package/dist/style.d.ts.map +1 -1
  232. package/dist/style.js +4 -100
  233. package/dist/style.js.map +1 -1
  234. package/dist/surface.js +25 -21
  235. package/dist/surface.js.map +1 -1
  236. package/dist/tags.d.ts +1 -0
  237. package/dist/tags.d.ts.map +1 -1
  238. package/dist/tags.js +31 -26
  239. package/dist/tags.js.map +1 -1
  240. package/package.json +4 -4
  241. package/dist/index.js.map +0 -1
@@ -1,204 +1,174 @@
1
+ //#region src/controls/cues.ts
1
2
  /**
2
- * Subtitles and the bar. Two things.
3
- *
4
- * The lift: the browser draws native cues at the bottom of the video, under
5
- * the bar. While the bar shows, every active cue the author left
6
- * unpositioned is moved above it, and put back when the bar hides. The
7
- * position is a negative line count, the one form every browser wraps at
8
- * the video's width; a percentage does not wrap in Chromium. Chromium
9
- * anchors the box's top on the count and Gecko its bottom, and their
10
- * overlap avoidance pushes in opposite directions, so nothing is left to
11
- * them: subtitles often show two cues at once, and the cues stack by their
12
- * own measured heights, wrapping included, clear under both readings. A
13
- * cue with a position of its own is the author's and is not touched.
14
- *
15
- * The look: `::cue` can only be styled from the document that holds the
16
- * video, which is the page and not the shadow root, and it takes no custom
17
- * properties. So a small sheet goes into the document, once, with one rule
18
- * per look the host's `subtitle-size` and `subtitle-background` attributes
19
- * can take. Sizes are percentages of the browser's own cue size, which
20
- * already follows the video's height, in the page and in fullscreen alike.
21
- * A page that wants more writes its own `mattebox-player > video::cue`.
22
- */
3
+ * Subtitles and the bar. Two things.
4
+ *
5
+ * The lift: the browser draws native cues at the bottom of the video, under
6
+ * the bar. While the bar shows, every active cue the author left
7
+ * unpositioned is moved above it, and put back when the bar hides. The
8
+ * position is a negative line count, the one form every browser wraps at
9
+ * the video's width; a percentage does not wrap in Chromium. Chromium
10
+ * anchors the box's top on the count and Gecko its bottom, and their
11
+ * overlap avoidance pushes in opposite directions, so nothing is left to
12
+ * them: subtitles often show two cues at once, and the cues stack by their
13
+ * own measured heights, wrapping included, clear under both readings. A
14
+ * cue with a position of its own is the author's and is not touched.
15
+ *
16
+ * The look: `::cue` can only be styled from the document that holds the
17
+ * video, which is the page and not the shadow root, and it takes no custom
18
+ * properties. So a small sheet goes into the document, once, with one rule
19
+ * per look the host's `subtitle-size` and `subtitle-background` attributes
20
+ * can take. Sizes are percentages of the browser's own cue size, which
21
+ * already follows the video's height, in the page and in fullscreen alike.
22
+ * A page that wants more writes its own `mattebox-player > video::cue`.
23
+ */
24
+ const CUE_RULES = "mattebox-player[subtitle-size=small]>video::cue{font-size:75%}mattebox-player[subtitle-size=large]>video::cue{font-size:150%}mattebox-player[subtitle-size=xlarge]>video::cue{font-size:200%}mattebox-player[subtitle-background=none]>video::cue{background-color:#0000}mattebox-player[subtitle-background=solid]>video::cue{background-color:#000}mattebox-player[subtitle-background=none]>video::-webkit-media-text-track-display-backdrop{background-color:#0000}mattebox-player[subtitle-background=solid]>video::-webkit-media-text-track-display-backdrop{background-color:#000}";
23
25
  /** How the sizes scale the browser's own cue size; the lift counts lines by it. */
24
- export const SCALES = {
25
- small: 0.75,
26
- medium: 1,
27
- large: 1.5,
28
- xlarge: 2,
26
+ const SCALES = {
27
+ small: .75,
28
+ medium: 1,
29
+ large: 1.5,
30
+ xlarge: 2
29
31
  };
30
- const BACKDROP = 'video::-webkit-media-text-track-display-backdrop';
31
32
  /**
32
- * The sheet in the document. `mattebox-player` is the element's tag. The
33
- * background goes on `::cue` and on the backdrop pseudo-element Chromium
34
- * and WebKit have, both: which of the two paints it differs by browser and
35
- * version, and a selector a browser does not know only voids its own rule.
36
- */
37
- const CUE_RULES = `mattebox-player[subtitle-size="small"] > video::cue { font-size: 75%; }
38
- mattebox-player[subtitle-size="large"] > video::cue { font-size: 150%; }
39
- mattebox-player[subtitle-size="xlarge"] > video::cue { font-size: 200%; }
40
- mattebox-player[subtitle-background="none"] > video::cue { background-color: transparent; }
41
- mattebox-player[subtitle-background="solid"] > video::cue { background-color: #000; }
42
- mattebox-player[subtitle-background="none"] > ${BACKDROP} { background-color: transparent; }
43
- mattebox-player[subtitle-background="solid"] > ${BACKDROP} { background-color: #000; }`;
44
- const MARK = 'data-mattebox-cue';
33
+ * The sheet in the document. `mattebox-player` is the element's tag. The
34
+ * background goes on `::cue` and on the backdrop pseudo-element Chromium
35
+ * and WebKit have, both: which of the two paints it differs by browser and
36
+ * version, and a selector a browser does not know only voids its own rule.
37
+ */
38
+ const MARK = "data-mattebox-cue";
45
39
  /** The browser's cue size against the video's height, per WebVTT, and its line against the size. */
46
- const CUE_SIZE = 0.05;
40
+ const CUE_SIZE = .05;
47
41
  const LINE_HEIGHT = 1.2;
48
42
  /** What a cue box spans of the video's width by default, so wrapping is measured against it. */
49
- const CUE_WIDTH = 0.96;
43
+ const CUE_WIDTH = .96;
50
44
  /** Pixels of air between the bar and the cue above it, before rounding up to a line. */
51
45
  const AIR = 6;
52
46
  /** Puts the cue rules in the document, once. */
53
- export function cueStyle() {
54
- if (document.head.querySelector(`style[${MARK}]`) !== null)
55
- return;
56
- const style = document.createElement('style');
57
- style.setAttribute(MARK, '');
58
- style.textContent = CUE_RULES;
59
- document.head.append(style);
47
+ function cueStyle() {
48
+ if (document.head.querySelector(`style[${MARK}]`) !== null) return;
49
+ const style = document.createElement("style");
50
+ style.setAttribute(MARK, "");
51
+ style.textContent = CUE_RULES;
52
+ document.head.append(style);
60
53
  }
61
- export function cueLift(video, host, covered) {
62
- /** The cues moved, with what they were, so they and only they are put back. */
63
- const lifted = new Map();
64
- let on = false;
65
- let canvas;
66
- function showing() {
67
- const out = [];
68
- for (const track of video.textTracks)
69
- if (track.mode === 'showing')
70
- out.push(track);
71
- return out;
72
- }
73
- /** The browser's cue font size, in pixels, from the video's height and the host's scale. */
74
- function fontSize(height) {
75
- const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;
76
- return height * CUE_SIZE * scale;
77
- }
78
- /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */
79
- function measure() {
80
- if (canvas === undefined)
81
- canvas = document.createElement('canvas').getContext('2d');
82
- return canvas;
83
- }
84
- /**
85
- * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the
86
- * timestamps and their closers. Brackets are counted, so a tag inside
87
- * another's brackets goes with it.
88
- */
89
- function plain(text) {
90
- let out = '';
91
- let depth = 0;
92
- for (const char of text) {
93
- if (char === '<')
94
- depth += 1;
95
- else if (char === '>')
96
- depth = Math.max(0, depth - 1);
97
- else if (depth === 0)
98
- out += char;
99
- }
100
- return out;
101
- }
102
- /** The lines a cue takes: its own, each wrapped at the cue box's width. */
103
- function lines(cue, font, width) {
104
- const context = measure();
105
- let total = 0;
106
- for (const line of plain(cue.text).split('\n')) {
107
- if (context === null) {
108
- total += 1;
109
- continue;
110
- }
111
- context.font = `${font}px sans-serif`;
112
- total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));
113
- }
114
- return total;
115
- }
116
- function apply() {
117
- const box = video.getBoundingClientRect();
118
- const height = box.height;
119
- const span = covered();
120
- const pixels = span.bottom - span.top;
121
- const lift = on && height > 0 && pixels > 0 && pixels < height;
122
- const font = fontSize(height);
123
- const unit = font * LINE_HEIGHT;
124
- // The lines the bar covers, with a little air, rounded up to whole lines.
125
- const base = Math.ceil((pixels + AIR) / unit);
126
- for (const track of showing()) {
127
- // Earliest first, the order the browser stacks them in, so the first
128
- // sits lowest and the rest climb.
129
- const active = [...(track.activeCues ?? [])]
130
- .filter((cue) => cue instanceof VTTCue)
131
- .sort((a, b) => a.startTime - b.startTime);
132
- let previous = null;
133
- let changed = false;
134
- for (const cue of active) {
135
- const was = lifted.get(cue);
136
- if (!lift) {
137
- if (was === undefined)
138
- continue;
139
- cue.line = was.line;
140
- cue.snapToLines = was.snapToLines;
141
- cue.lineAlign = was.lineAlign;
142
- lifted.delete(cue);
143
- changed = true;
144
- continue;
145
- }
146
- // The author's own placement is the author's.
147
- if (was === undefined && cue.line !== 'auto')
148
- continue;
149
- if (was === undefined) {
150
- lifted.set(cue, {
151
- line: cue.line,
152
- snapToLines: cue.snapToLines,
153
- lineAlign: cue.lineAlign,
154
- });
155
- }
156
- // A negative line count, which every browser wraps at the video's
157
- // width, unlike a percentage. Chromium anchors the box's top on it
158
- // and Gecko its bottom, so the count clears the bar and the cue
159
- // below under both readings, with a little air to spare in one.
160
- const own = lines(cue, font, box.width);
161
- const line = previous === null ? base + own : previous.line + Math.max(own, previous.height);
162
- if (cue.line !== -line || !cue.snapToLines)
163
- changed = true;
164
- cue.snapToLines = true;
165
- cue.line = -line;
166
- previous = { line, height: own };
167
- }
168
- // Chromium lays a changed line out again only when the track's display
169
- // is rebuilt, which neither time nor a seek does for a cue already
170
- // showing; the mode flipped off and on in one task rebuilds it with no
171
- // paint in between. Only on a change, so the change event this fires
172
- // finds nothing to do and the loop ends there.
173
- if (changed) {
174
- track.mode = 'hidden';
175
- track.mode = 'showing';
176
- }
177
- }
178
- }
179
- function watch() {
180
- for (const track of video.textTracks) {
181
- track.removeEventListener('cuechange', apply);
182
- track.addEventListener('cuechange', apply);
183
- }
184
- apply();
185
- }
186
- video.textTracks.addEventListener('change', watch);
187
- video.textTracks.addEventListener('addtrack', watch);
188
- watch();
189
- return {
190
- lifted(next) {
191
- on = next;
192
- apply();
193
- },
194
- dispose() {
195
- on = false;
196
- apply();
197
- video.textTracks.removeEventListener('change', watch);
198
- video.textTracks.removeEventListener('addtrack', watch);
199
- for (const track of video.textTracks)
200
- track.removeEventListener('cuechange', apply);
201
- },
202
- };
54
+ function cueLift(video, host, covered) {
55
+ /** The cues moved, with what they were, so they and only they are put back. */
56
+ const lifted = /* @__PURE__ */ new Map();
57
+ let on = false;
58
+ let canvas;
59
+ function showing() {
60
+ const out = [];
61
+ for (const track of video.textTracks) if (track.mode === "showing") out.push(track);
62
+ return out;
63
+ }
64
+ /** The browser's cue font size, in pixels, from the video's height and the host's scale. */
65
+ function fontSize(height) {
66
+ const scale = SCALES[host.getAttribute("subtitle-size") ?? ""] ?? 1;
67
+ return height * CUE_SIZE * scale;
68
+ }
69
+ /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */
70
+ function measure() {
71
+ if (canvas === void 0) canvas = document.createElement("canvas").getContext("2d");
72
+ return canvas;
73
+ }
74
+ /**
75
+ * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the
76
+ * timestamps and their closers. Brackets are counted, so a tag inside
77
+ * another's brackets goes with it.
78
+ */
79
+ function plain(text) {
80
+ let out = "";
81
+ let depth = 0;
82
+ for (const char of text) if (char === "<") depth += 1;
83
+ else if (char === ">") depth = Math.max(0, depth - 1);
84
+ else if (depth === 0) out += char;
85
+ return out;
86
+ }
87
+ /** The lines a cue takes: its own, each wrapped at the cue box's width. */
88
+ function lines(cue, font, width) {
89
+ const context = measure();
90
+ let total = 0;
91
+ for (const line of plain(cue.text).split("\n")) {
92
+ if (context === null) {
93
+ total += 1;
94
+ continue;
95
+ }
96
+ context.font = `${font}px sans-serif`;
97
+ total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));
98
+ }
99
+ return total;
100
+ }
101
+ function apply() {
102
+ const box = video.getBoundingClientRect();
103
+ const height = box.height;
104
+ const span = covered();
105
+ const pixels = span.bottom - span.top;
106
+ const lift = on && height > 0 && pixels > 0 && pixels < height;
107
+ const font = fontSize(height);
108
+ const unit = font * LINE_HEIGHT;
109
+ const base = Math.ceil((pixels + AIR) / unit);
110
+ for (const track of showing()) {
111
+ const active = [...track.activeCues ?? []].filter((cue) => cue instanceof VTTCue).sort((a, b) => a.startTime - b.startTime);
112
+ let previous = null;
113
+ let changed = false;
114
+ for (const cue of active) {
115
+ const was = lifted.get(cue);
116
+ if (!lift) {
117
+ if (was === void 0) continue;
118
+ cue.line = was.line;
119
+ cue.snapToLines = was.snapToLines;
120
+ cue.lineAlign = was.lineAlign;
121
+ lifted.delete(cue);
122
+ changed = true;
123
+ continue;
124
+ }
125
+ if (was === void 0 && cue.line !== "auto") continue;
126
+ if (was === void 0) lifted.set(cue, {
127
+ line: cue.line,
128
+ snapToLines: cue.snapToLines,
129
+ lineAlign: cue.lineAlign
130
+ });
131
+ const own = lines(cue, font, box.width);
132
+ const line = previous === null ? base + own : previous.line + Math.max(own, previous.height);
133
+ if (cue.line !== -line || !cue.snapToLines) changed = true;
134
+ cue.snapToLines = true;
135
+ cue.line = -line;
136
+ previous = {
137
+ line,
138
+ height: own
139
+ };
140
+ }
141
+ if (changed) {
142
+ track.mode = "hidden";
143
+ track.mode = "showing";
144
+ }
145
+ }
146
+ }
147
+ function watch() {
148
+ for (const track of video.textTracks) {
149
+ track.removeEventListener("cuechange", apply);
150
+ track.addEventListener("cuechange", apply);
151
+ }
152
+ apply();
153
+ }
154
+ video.textTracks.addEventListener("change", watch);
155
+ video.textTracks.addEventListener("addtrack", watch);
156
+ watch();
157
+ return {
158
+ lifted(next) {
159
+ on = next;
160
+ apply();
161
+ },
162
+ dispose() {
163
+ on = false;
164
+ apply();
165
+ video.textTracks.removeEventListener("change", watch);
166
+ video.textTracks.removeEventListener("addtrack", watch);
167
+ for (const track of video.textTracks) track.removeEventListener("cuechange", apply);
168
+ }
169
+ };
203
170
  }
171
+ //#endregion
172
+ export { SCALES, cueLift, cueStyle };
173
+
204
174
  //# sourceMappingURL=cues.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cues.js","sourceRoot":"","sources":["../../src/controls/cues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mFAAmF;AACnF,MAAM,CAAC,MAAM,MAAM,GAAqC;IACtD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,QAAQ,GAAG,kDAAkD,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,SAAS,GAAG;;;;;gDAK8B,QAAQ;iDACP,QAAQ,8BAA8B,CAAC;AAExF,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,oGAAoG;AACpG,MAAM,QAAQ,GAAG,IAAI,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,gGAAgG;AAChG,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,wFAAwF;AACxF,MAAM,GAAG,GAAG,CAAC,CAAC;AAEd,gDAAgD;AAChD,MAAM,UAAU,QAAQ;IACtB,IAAI,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,IAAI,GAAG,CAAC,KAAK,IAAI;QAAE,OAAO;IACnE,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7B,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAkBD,MAAM,UAAU,OAAO,CAAC,KAAuB,EAAE,IAAiB,EAAE,OAAgB;IAClF,+EAA+E;IAC/E,MAAM,MAAM,GA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AG,IAAI,CAAC;YACV,KAAK,EAAE,CAAC;QACV,CAAC;QACD,OAAO;YACL,EAAE,GAAG,KAAK,CAAC;YACX,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YACtD,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACxD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,UAAU;gBAAE,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"cues.js","names":[],"sources":["../../src/controls/cues.ts"],"sourcesContent":["/**\n * Subtitles and the bar. Two things.\n *\n * The lift: the browser draws native cues at the bottom of the video, under\n * the bar. While the bar shows, every active cue the author left\n * unpositioned is moved above it, and put back when the bar hides. The\n * position is a negative line count, the one form every browser wraps at\n * the video's width; a percentage does not wrap in Chromium. Chromium\n * anchors the box's top on the count and Gecko its bottom, and their\n * overlap avoidance pushes in opposite directions, so nothing is left to\n * them: subtitles often show two cues at once, and the cues stack by their\n * own measured heights, wrapping included, clear under both readings. A\n * cue with a position of its own is the author's and is not touched.\n *\n * The look: `::cue` can only be styled from the document that holds the\n * video, which is the page and not the shadow root, and it takes no custom\n * properties. So a small sheet goes into the document, once, with one rule\n * per look the host's `subtitle-size` and `subtitle-background` attributes\n * can take. Sizes are percentages of the browser's own cue size, which\n * already follows the video's height, in the page and in fullscreen alike.\n * A page that wants more writes its own `mattebox-player > video::cue`.\n */\nimport CUE_RULES from './cues.css?inline';\n/** How the sizes scale the browser's own cue size; the lift counts lines by it. */\nexport const SCALES: Readonly<Record<string, number>> = {\n small: 0.75,\n medium: 1,\n large: 1.5,\n xlarge: 2,\n};\n\n/**\n * The sheet in the document. `mattebox-player` is the element's tag. The\n * background goes on `::cue` and on the backdrop pseudo-element Chromium\n * and WebKit have, both: which of the two paints it differs by browser and\n * version, and a selector a browser does not know only voids its own rule.\n */\n\nconst MARK = 'data-mattebox-cue';\n\n/** The browser's cue size against the video's height, per WebVTT, and its line against the size. */\nconst CUE_SIZE = 0.05;\nconst LINE_HEIGHT = 1.2;\n/** What a cue box spans of the video's width by default, so wrapping is measured against it. */\nconst CUE_WIDTH = 0.96;\n/** Pixels of air between the bar and the cue above it, before rounding up to a line. */\nconst AIR = 6;\n\n/** Puts the cue rules in the document, once. */\nexport function cueStyle(): void {\n if (document.head.querySelector(`style[${MARK}]`) !== null) return;\n const style = document.createElement('style');\n style.setAttribute(MARK, '');\n style.textContent = CUE_RULES;\n document.head.append(style);\n}\n\n/** What a lifted cue looked like before, to put back. */\ninterface Placed {\n readonly line: number | 'auto';\n readonly snapToLines: boolean;\n readonly lineAlign: LineAlignSetting;\n}\n\nexport interface CueLift {\n /** Whether the bar is showing, so the cues move above it or back. */\n lifted(on: boolean): void;\n dispose(): void;\n}\n\n/** What the bar covers of the picture: from its first row's top, not its gradient run-in, to its bottom. */\nexport type Covered = () => { readonly top: number; readonly bottom: number };\n\nexport function cueLift(video: HTMLVideoElement, host: HTMLElement, covered: Covered): CueLift {\n /** The cues moved, with what they were, so they and only they are put back. */\n const lifted = new Map<VTTCue, Placed>();\n let on = false;\n let canvas: CanvasRenderingContext2D | null | undefined;\n\n function showing(): TextTrack[] {\n const out: TextTrack[] = [];\n for (const track of video.textTracks) if (track.mode === 'showing') out.push(track);\n return out;\n }\n\n /** The browser's cue font size, in pixels, from the video's height and the host's scale. */\n function fontSize(height: number): number {\n const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;\n return height * CUE_SIZE * scale;\n }\n\n /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */\n function measure(): CanvasRenderingContext2D | null {\n if (canvas === undefined) canvas = document.createElement('canvas').getContext('2d');\n return canvas;\n }\n\n /**\n * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the\n * timestamps and their closers. Brackets are counted, so a tag inside\n * another's brackets goes with it.\n */\n function plain(text: string): string {\n let out = '';\n let depth = 0;\n for (const char of text) {\n if (char === '<') depth += 1;\n else if (char === '>') depth = Math.max(0, depth - 1);\n else if (depth === 0) out += char;\n }\n return out;\n }\n\n /** The lines a cue takes: its own, each wrapped at the cue box's width. */\n function lines(cue: VTTCue, font: number, width: number): number {\n const context = measure();\n let total = 0;\n for (const line of plain(cue.text).split('\\n')) {\n if (context === null) {\n total += 1;\n continue;\n }\n context.font = `${font}px sans-serif`;\n total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));\n }\n return total;\n }\n\n function apply(): void {\n const box = video.getBoundingClientRect();\n const height = box.height;\n const span = covered();\n const pixels = span.bottom - span.top;\n const lift = on && height > 0 && pixels > 0 && pixels < height;\n const font = fontSize(height);\n const unit = font * LINE_HEIGHT;\n // The lines the bar covers, with a little air, rounded up to whole lines.\n const base = Math.ceil((pixels + AIR) / unit);\n for (const track of showing()) {\n // Earliest first, the order the browser stacks them in, so the first\n // sits lowest and the rest climb.\n const active = [...(track.activeCues ?? [])]\n .filter((cue): cue is VTTCue => cue instanceof VTTCue)\n .sort((a, b) => a.startTime - b.startTime);\n let previous: { line: number; height: number } | null = null;\n let changed = false;\n for (const cue of active) {\n const was = lifted.get(cue);\n if (!lift) {\n if (was === undefined) continue;\n cue.line = was.line;\n cue.snapToLines = was.snapToLines;\n cue.lineAlign = was.lineAlign;\n lifted.delete(cue);\n changed = true;\n continue;\n }\n // The author's own placement is the author's.\n if (was === undefined && cue.line !== 'auto') continue;\n if (was === undefined) {\n lifted.set(cue, {\n line: cue.line,\n snapToLines: cue.snapToLines,\n lineAlign: cue.lineAlign,\n });\n }\n // A negative line count, which every browser wraps at the video's\n // width, unlike a percentage. Chromium anchors the box's top on it\n // and Gecko its bottom, so the count clears the bar and the cue\n // below under both readings, with a little air to spare in one.\n const own = lines(cue, font, box.width);\n const line: number =\n previous === null ? base + own : previous.line + Math.max(own, previous.height);\n if (cue.line !== -line || !cue.snapToLines) changed = true;\n cue.snapToLines = true;\n cue.line = -line;\n previous = { line, height: own };\n }\n // Chromium lays a changed line out again only when the track's display\n // is rebuilt, which neither time nor a seek does for a cue already\n // showing; the mode flipped off and on in one task rebuilds it with no\n // paint in between. Only on a change, so the change event this fires\n // finds nothing to do and the loop ends there.\n if (changed) {\n track.mode = 'hidden';\n track.mode = 'showing';\n }\n }\n }\n\n function watch(): void {\n for (const track of video.textTracks) {\n track.removeEventListener('cuechange', apply);\n track.addEventListener('cuechange', apply);\n }\n apply();\n }\n\n video.textTracks.addEventListener('change', watch);\n video.textTracks.addEventListener('addtrack', watch);\n watch();\n\n return {\n lifted(next: boolean): void {\n on = next;\n apply();\n },\n dispose(): void {\n on = false;\n apply();\n video.textTracks.removeEventListener('change', watch);\n video.textTracks.removeEventListener('addtrack', watch);\n for (const track of video.textTracks) track.removeEventListener('cuechange', apply);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAA,YAAA;;AAEA,MAAA,SAAA;CACA,OAAA;CACA,QAAA;CACA,OAAA;CACA,QAAA;AACA;;;;;;;AASA,MAAA,OAAA;;AAGA,MAAA,WAAA;AACA,MAAA,cAAA;;AAEA,MAAA,YAAA;;AAEA,MAAA,MAAA;;AAGA,SAAA,WAAA;CACA,IAAA,SAAA,KAAA,cAAA,SAAA,KAAA,EAAA,MAAA,MAAA;CACA,MAAA,QAAA,SAAA,cAAA,OAAA;CACA,MAAA,aAAA,MAAA,EAAA;CACA,MAAA,cAAA;CACA,SAAA,KAAA,OAAA,KAAA;AACA;AAkBA,SAAA,QAAA,OAAA,MAAA,SAAA;;CAEA,MAAA,yBAAA,IAAA,IAAA;CACA,IAAA,KAAA;CACA,IAAA;CAEA,SAAA,UAAA;EACA,MAAA,MAAA,CAAA;EACA,KAAA,MAAA,SAAA,MAAA,YAAA,IAAA,MAAA,SAAA,WAAA,IAAA,KAAA,KAAA;EACA,OAAA;CACA;;CAGA,SAAA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on the player itself, so the video and every control in it
3
- * come along, through whichever API the browser has. Three shapes, tried
4
- * in order: the standard one; the `webkit` prefix on elements, which
5
- * Safari kept until 16.4; and the iPhone, which has fullscreen on the
6
- * video alone. None of them means no button.
7
- *
8
- * "Active" is whether the host is the fullscreen element, which `:fullscreen`
9
- * answers whatever tree the host is in: `document.fullscreenElement` is
10
- * retargeted when the host sits in a shadow root, and the pseudo-class is not.
11
- */
1
+ //#region src/controls/fullscreen.ts
12
2
  function watching(target, names) {
13
- return (fn) => {
14
- for (const name of names)
15
- target.addEventListener(name, fn);
16
- return () => {
17
- for (const name of names)
18
- target.removeEventListener(name, fn);
19
- };
20
- };
3
+ return (fn) => {
4
+ for (const name of names) target.addEventListener(name, fn);
5
+ return () => {
6
+ for (const name of names) target.removeEventListener(name, fn);
7
+ };
8
+ };
21
9
  }
22
- export function fullscreen(host, video) {
23
- const doc = document;
24
- const prefixed = host;
25
- const phone = video;
26
- if (typeof host.requestFullscreen === 'function') {
27
- const active = () => host.matches(':fullscreen');
28
- return {
29
- supported: true,
30
- active,
31
- toggle() {
32
- // Both return promises that reject outside a user gesture or where
33
- // the page forbids it; there is nothing to do with that but drop it.
34
- const request = active() ? document.exitFullscreen() : host.requestFullscreen();
35
- request.catch(() => undefined);
36
- },
37
- watch: watching(document, ['fullscreenchange']),
38
- };
39
- }
40
- if (typeof prefixed.webkitRequestFullscreen === 'function') {
41
- const active = () => doc.webkitFullscreenElement === host;
42
- return {
43
- supported: true,
44
- active,
45
- toggle() {
46
- if (active())
47
- doc.webkitExitFullscreen?.();
48
- else
49
- prefixed.webkitRequestFullscreen?.();
50
- },
51
- watch: watching(document, ['webkitfullscreenchange']),
52
- };
53
- }
54
- if (typeof phone.webkitEnterFullscreen === 'function') {
55
- return {
56
- supported: true,
57
- active: () => phone.webkitDisplayingFullscreen === true,
58
- toggle() {
59
- if (phone.webkitDisplayingFullscreen === true)
60
- phone.webkitExitFullscreen?.();
61
- else
62
- phone.webkitEnterFullscreen?.();
63
- },
64
- watch: watching(video, ['webkitbeginfullscreen', 'webkitendfullscreen']),
65
- };
66
- }
67
- return {
68
- supported: false,
69
- active: () => false,
70
- toggle() { },
71
- watch: () => () => { },
72
- };
10
+ function fullscreen(host, video) {
11
+ const doc = document;
12
+ const prefixed = host;
13
+ const phone = video;
14
+ if (typeof host.requestFullscreen === "function") {
15
+ const active = () => host.matches(":fullscreen");
16
+ return {
17
+ supported: true,
18
+ active,
19
+ toggle() {
20
+ (active() ? document.exitFullscreen() : host.requestFullscreen()).catch(() => void 0);
21
+ },
22
+ watch: watching(document, ["fullscreenchange"])
23
+ };
24
+ }
25
+ if (typeof prefixed.webkitRequestFullscreen === "function") {
26
+ const active = () => doc.webkitFullscreenElement === host;
27
+ return {
28
+ supported: true,
29
+ active,
30
+ toggle() {
31
+ if (active()) doc.webkitExitFullscreen?.();
32
+ else prefixed.webkitRequestFullscreen?.();
33
+ },
34
+ watch: watching(document, ["webkitfullscreenchange"])
35
+ };
36
+ }
37
+ if (typeof phone.webkitEnterFullscreen === "function") return {
38
+ supported: true,
39
+ active: () => phone.webkitDisplayingFullscreen === true,
40
+ toggle() {
41
+ if (phone.webkitDisplayingFullscreen === true) phone.webkitExitFullscreen?.();
42
+ else phone.webkitEnterFullscreen?.();
43
+ },
44
+ watch: watching(video, ["webkitbeginfullscreen", "webkitendfullscreen"])
45
+ };
46
+ return {
47
+ supported: false,
48
+ active: () => false,
49
+ toggle() {},
50
+ watch: () => () => {}
51
+ };
73
52
  }
53
+ //#endregion
54
+ export { fullscreen };
55
+
74
56
  //# sourceMappingURL=fullscreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fullscreen.js","sourceRoot":"","sources":["../../src/controls/fullscreen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA0BH,SAAS,QAAQ,CAAC,MAAmB,EAAE,KAAwB;IAC7D,OAAO,CAAC,EAAc,EAAgB,EAAE;QACtC,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,MAAM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E,EAAE,CAAC;YAC5C,CAAC;YACD,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,wBAAwB,CAAC,CAAC;SACtD,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,KAAK,CAAC,qBAAqB,KAAK,UAAU,EAAE,CAAC;QACtD,OAAO;YACL,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,0BAA0B,KAAK,IAAI;YACvD,MAAM;gBACJ,IAAI,KAAK,CAAC,0BAA0B,KAAK,IAAI;oBAAE,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;;oBACzE,KAAK,CAAC,qBAAqB,EAAE,EAAE,CAAC;YACvC,CAAC;YACD,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;SACzE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;QACnB,MAAM,KAAU,CAAC;QACjB,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;KACtB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"fullscreen.js","names":[],"sources":["../../src/controls/fullscreen.ts"],"sourcesContent":["/**\n * Fullscreen on the player itself, so the video and every control in it\n * come along, through whichever API the browser has. Three shapes, tried\n * in order: the standard one; the `webkit` prefix on elements, which\n * Safari kept until 16.4; and the iPhone, which has fullscreen on the\n * video alone. None of them means no button.\n *\n * \"Active\" is whether the host is the fullscreen element, which `:fullscreen`\n * answers whatever tree the host is in: `document.fullscreenElement` is\n * retargeted when the host sits in a shadow root, and the pseudo-class is not.\n */\n\ninterface PrefixedElement {\n webkitRequestFullscreen?: () => void;\n}\n\ninterface PrefixedVideo {\n webkitEnterFullscreen?: () => void;\n webkitExitFullscreen?: () => void;\n readonly webkitDisplayingFullscreen?: boolean;\n}\n\ninterface PrefixedDocument {\n readonly webkitFullscreenElement?: Element | null;\n webkitExitFullscreen?: () => void;\n}\n\nexport interface Fullscreen {\n /** Whether any API exists. Without one the button is hidden. */\n readonly supported: boolean;\n active(): boolean;\n toggle(): void;\n /** Runs `fn` on every change. Returns the unsubscribe. */\n watch(fn: () => void): () => void;\n}\n\nfunction watching(target: EventTarget, names: readonly string[]) {\n return (fn: () => void): (() => void) => {\n for (const name of names) target.addEventListener(name, fn);\n return () => {\n for (const name of names) target.removeEventListener(name, fn);\n };\n };\n}\n\nexport function fullscreen(host: HTMLElement, video: HTMLVideoElement): Fullscreen {\n const doc = document as Document & PrefixedDocument;\n const prefixed = host as HTMLElement & PrefixedElement;\n const phone = video as HTMLVideoElement & PrefixedVideo;\n\n if (typeof host.requestFullscreen === 'function') {\n const active = (): boolean => host.matches(':fullscreen');\n return {\n supported: true,\n active,\n toggle(): void {\n // Both return promises that reject outside a user gesture or where\n // the page forbids it; there is nothing to do with that but drop it.\n const request = active() ? document.exitFullscreen() : host.requestFullscreen();\n request.catch(() => undefined);\n },\n watch: watching(document, ['fullscreenchange']),\n };\n }\n\n if (typeof prefixed.webkitRequestFullscreen === 'function') {\n const active = (): boolean => doc.webkitFullscreenElement === host;\n return {\n supported: true,\n active,\n toggle(): void {\n if (active()) doc.webkitExitFullscreen?.();\n else prefixed.webkitRequestFullscreen?.();\n },\n watch: watching(document, ['webkitfullscreenchange']),\n };\n }\n\n if (typeof phone.webkitEnterFullscreen === 'function') {\n return {\n supported: true,\n active: () => phone.webkitDisplayingFullscreen === true,\n toggle(): void {\n if (phone.webkitDisplayingFullscreen === true) phone.webkitExitFullscreen?.();\n else phone.webkitEnterFullscreen?.();\n },\n watch: watching(video, ['webkitbeginfullscreen', 'webkitendfullscreen']),\n };\n }\n\n return {\n supported: false,\n active: () => false,\n toggle(): void {},\n watch: () => () => {},\n };\n}\n"],"mappings":";AAoCA,SAAS,SAAS,QAAqB,OAA0B;CAC/D,QAAQ,OAAiC;EACvC,KAAK,MAAM,QAAQ,OAAO,OAAO,iBAAiB,MAAM,EAAE;EAC1D,aAAa;GACX,KAAK,MAAM,QAAQ,OAAO,OAAO,oBAAoB,MAAM,EAAE;EAC/D;CACF;AACF;AAEA,SAAgB,WAAW,MAAmB,OAAqC;CACjF,MAAM,MAAM;CACZ,MAAM,WAAW;CACjB,MAAM,QAAQ;CAEd,IAAI,OAAO,KAAK,sBAAsB,YAAY;EAChD,MAAM,eAAwB,KAAK,QAAQ,aAAa;EACxD,OAAO;GACL,WAAW;GACX;GACA,SAAe;IAIb,CADgB,OAAO,IAAI,SAAS,eAAe,IAAI,KAAK,kBAAkB,EAAA,CACtE,YAAY,KAAA,CAAS;GAC/B;GACA,OAAO,SAAS,UAAU,CAAC,kBAAkB,CAAC;EAChD;CACF;CAEA,IAAI,OAAO,SAAS,4BAA4B,YAAY;EAC1D,MAAM,eAAwB,IAAI,4BAA4B;EAC9D,OAAO;GACL,WAAW;GACX;GACA,SAAe;IACb,IAAI,OAAO,GAAG,IAAI,uBAAuB;SACpC,SAAS,0BAA0B;GAC1C;GACA,OAAO,SAAS,UAAU,CAAC,wBAAwB,CAAC;EACtD;CACF;CAEA,IAAI,OAAO,MAAM,0BAA0B,YACzC,OAAO;EACL,WAAW;EACX,cAAc,MAAM,+BAA+B;EACnD,SAAe;GACb,IAAI,MAAM,+BAA+B,MAAM,MAAM,uBAAuB;QACvE,MAAM,wBAAwB;EACrC;EACA,OAAO,SAAS,OAAO,CAAC,yBAAyB,qBAAqB,CAAC;CACzE;CAGF,OAAO;EACL,WAAW;EACX,cAAc;EACd,SAAe,CAAC;EAChB,mBAAmB,CAAC;CACtB;AACF"}
@@ -27,7 +27,7 @@
27
27
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
28
  * SOFTWARE.
29
29
  */
30
- export type IconName = 'play' | 'pause' | 'replay' | 'mute' | 'volume-low' | 'volume-high' | 'fullscreen' | 'fullscreen-exit' | 'settings' | 'music' | 'closed-captions' | 'closed-captions-on' | 'lock-closed' | 'seek-backward' | 'seek-forward' | 'seek-backward-10' | 'seek-forward-10' | 'seek-backward-30' | 'seek-forward-30' | 'playback-speed' | 'picture-in-picture' | 'picture-in-picture-exit' | 'airplay' | 'airplay-active' | 'chapters';
30
+ export type IconName = 'play' | 'pause' | 'replay' | 'mute' | 'volume-low' | 'volume-high' | 'fullscreen' | 'fullscreen-exit' | 'settings' | 'music' | 'closed-captions' | 'closed-captions-on' | 'lock-closed' | 'seek-backward' | 'seek-forward' | 'seek-backward-10' | 'seek-forward-10' | 'seek-backward-30' | 'seek-forward-30' | 'playback-speed' | 'picture-in-picture' | 'picture-in-picture-exit' | 'airplay' | 'airplay-active' | 'chapters' | 'fast-forward' | 'fast-backward';
31
31
  /** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */
32
32
  export declare function icon(name: IconName): SVGSVGElement;
33
33
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/controls/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,iBAAiB,GACjB,oBAAoB,GACpB,aAAa,GACb,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,GACpB,yBAAyB,GACzB,SAAS,GACT,gBAAgB,GAChB,UAAU,CAAC;AA6Df,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,CAUlD"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/controls/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,iBAAiB,GACjB,oBAAoB,GACpB,aAAa,GACb,eAAe,GACf,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,oBAAoB,GACpB,yBAAyB,GACzB,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,cAAc,GACd,eAAe,CAAC;AAiEpB,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,CAUlD"}