@mattebox/player 0.1.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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +24 -0
  3. package/README.md +22 -0
  4. package/dist/cdn/mattebox-player.min.js +340 -0
  5. package/dist/controls/bar.d.ts +56 -0
  6. package/dist/controls/bar.d.ts.map +1 -0
  7. package/dist/controls/bar.js +245 -0
  8. package/dist/controls/bar.js.map +1 -0
  9. package/dist/controls/buttons.d.ts +13 -0
  10. package/dist/controls/buttons.d.ts.map +1 -0
  11. package/dist/controls/buttons.js +157 -0
  12. package/dist/controls/buttons.js.map +1 -0
  13. package/dist/controls/control.d.ts +12 -0
  14. package/dist/controls/control.d.ts.map +1 -0
  15. package/dist/controls/control.js +2 -0
  16. package/dist/controls/control.js.map +1 -0
  17. package/dist/controls/cues.d.ts +33 -0
  18. package/dist/controls/cues.d.ts.map +1 -0
  19. package/dist/controls/cues.js +170 -0
  20. package/dist/controls/cues.js.map +1 -0
  21. package/dist/controls/fullscreen.d.ts +21 -0
  22. package/dist/controls/fullscreen.d.ts.map +1 -0
  23. package/dist/controls/fullscreen.js +78 -0
  24. package/dist/controls/fullscreen.js.map +1 -0
  25. package/dist/controls/icons.d.ts +35 -0
  26. package/dist/controls/icons.d.ts.map +1 -0
  27. package/dist/controls/icons.js +76 -0
  28. package/dist/controls/icons.js.map +1 -0
  29. package/dist/controls/keys.d.ts +26 -0
  30. package/dist/controls/keys.d.ts.map +1 -0
  31. package/dist/controls/keys.js +66 -0
  32. package/dist/controls/keys.js.map +1 -0
  33. package/dist/controls/live.d.ts +10 -0
  34. package/dist/controls/live.d.ts.map +1 -0
  35. package/dist/controls/live.js +59 -0
  36. package/dist/controls/live.js.map +1 -0
  37. package/dist/controls/menu.d.ts +34 -0
  38. package/dist/controls/menu.d.ts.map +1 -0
  39. package/dist/controls/menu.js +225 -0
  40. package/dist/controls/menu.js.map +1 -0
  41. package/dist/controls/menus.d.ts +43 -0
  42. package/dist/controls/menus.d.ts.map +1 -0
  43. package/dist/controls/menus.js +262 -0
  44. package/dist/controls/menus.js.map +1 -0
  45. package/dist/controls/options.d.ts +44 -0
  46. package/dist/controls/options.d.ts.map +1 -0
  47. package/dist/controls/options.js +54 -0
  48. package/dist/controls/options.js.map +1 -0
  49. package/dist/controls/pip.d.ts +16 -0
  50. package/dist/controls/pip.d.ts.map +1 -0
  51. package/dist/controls/pip.js +53 -0
  52. package/dist/controls/pip.js.map +1 -0
  53. package/dist/controls/ranges.d.ts +24 -0
  54. package/dist/controls/ranges.d.ts.map +1 -0
  55. package/dist/controls/ranges.js +48 -0
  56. package/dist/controls/ranges.js.map +1 -0
  57. package/dist/controls/screens.d.ts +22 -0
  58. package/dist/controls/screens.d.ts.map +1 -0
  59. package/dist/controls/screens.js +69 -0
  60. package/dist/controls/screens.js.map +1 -0
  61. package/dist/controls/seek.d.ts +52 -0
  62. package/dist/controls/seek.d.ts.map +1 -0
  63. package/dist/controls/seek.js +215 -0
  64. package/dist/controls/seek.js.map +1 -0
  65. package/dist/controls/slider.d.ts +28 -0
  66. package/dist/controls/slider.d.ts.map +1 -0
  67. package/dist/controls/slider.js +145 -0
  68. package/dist/controls/slider.js.map +1 -0
  69. package/dist/controls/speed.d.ts +8 -0
  70. package/dist/controls/speed.d.ts.map +1 -0
  71. package/dist/controls/speed.js +34 -0
  72. package/dist/controls/speed.js.map +1 -0
  73. package/dist/controls/time.d.ts +8 -0
  74. package/dist/controls/time.d.ts.map +1 -0
  75. package/dist/controls/time.js +25 -0
  76. package/dist/controls/time.js.map +1 -0
  77. package/dist/controls/volume.d.ts +8 -0
  78. package/dist/controls/volume.d.ts.map +1 -0
  79. package/dist/controls/volume.js +29 -0
  80. package/dist/controls/volume.js.map +1 -0
  81. package/dist/dom.d.ts +18 -0
  82. package/dist/dom.d.ts.map +1 -0
  83. package/dist/dom.js +45 -0
  84. package/dist/dom.js.map +1 -0
  85. package/dist/element.d.ts +101 -0
  86. package/dist/element.d.ts.map +1 -0
  87. package/dist/element.js +327 -0
  88. package/dist/element.js.map +1 -0
  89. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/asyncToGenerator.js +27 -0
  90. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/defineProperty.js +12 -0
  91. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/objectSpread2.js +25 -0
  92. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/toPrimitive.js +14 -0
  93. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/toPropertyKey.js +9 -0
  94. package/dist/es2015/_virtual/_@oxc-project_runtime@0.148.0/helpers/esm/typeof.js +11 -0
  95. package/dist/es2015/controls/bar.js +227 -0
  96. package/dist/es2015/controls/buttons.js +146 -0
  97. package/dist/es2015/controls/cues.js +153 -0
  98. package/dist/es2015/controls/fullscreen.js +54 -0
  99. package/dist/es2015/controls/icons.js +50 -0
  100. package/dist/es2015/controls/keys.js +60 -0
  101. package/dist/es2015/controls/live.js +60 -0
  102. package/dist/es2015/controls/menu.js +226 -0
  103. package/dist/es2015/controls/menus.js +258 -0
  104. package/dist/es2015/controls/options.js +46 -0
  105. package/dist/es2015/controls/pip.js +39 -0
  106. package/dist/es2015/controls/ranges.js +51 -0
  107. package/dist/es2015/controls/screens.js +74 -0
  108. package/dist/es2015/controls/seek.js +203 -0
  109. package/dist/es2015/controls/slider.js +136 -0
  110. package/dist/es2015/controls/speed.js +41 -0
  111. package/dist/es2015/controls/time.js +27 -0
  112. package/dist/es2015/controls/volume.js +30 -0
  113. package/dist/es2015/dom.js +43 -0
  114. package/dist/es2015/element.js +311 -0
  115. package/dist/es2015/index.js +10 -0
  116. package/dist/es2015/namespaces.js +7 -0
  117. package/dist/es2015/panels/drm.js +29 -0
  118. package/dist/es2015/panels/error.js +25 -0
  119. package/dist/es2015/panels/live.js +48 -0
  120. package/dist/es2015/panels/quality.js +52 -0
  121. package/dist/es2015/panels/tracks.js +47 -0
  122. package/dist/es2015/presets.js +46 -0
  123. package/dist/es2015/style.js +347 -0
  124. package/dist/index.d.ts +4 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +9 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/namespaces.d.ts +45 -0
  129. package/dist/namespaces.d.ts.map +1 -0
  130. package/dist/namespaces.js +5 -0
  131. package/dist/namespaces.js.map +1 -0
  132. package/dist/panels/drm.d.ts +8 -0
  133. package/dist/panels/drm.d.ts.map +1 -0
  134. package/dist/panels/drm.js +36 -0
  135. package/dist/panels/drm.js.map +1 -0
  136. package/dist/panels/error.d.ts +13 -0
  137. package/dist/panels/error.d.ts.map +1 -0
  138. package/dist/panels/error.js +23 -0
  139. package/dist/panels/error.js.map +1 -0
  140. package/dist/panels/live.d.ts +3 -0
  141. package/dist/panels/live.d.ts.map +1 -0
  142. package/dist/panels/live.js +56 -0
  143. package/dist/panels/live.js.map +1 -0
  144. package/dist/panels/panel.d.ts +13 -0
  145. package/dist/panels/panel.d.ts.map +1 -0
  146. package/dist/panels/panel.js +2 -0
  147. package/dist/panels/panel.js.map +1 -0
  148. package/dist/panels/quality.d.ts +3 -0
  149. package/dist/panels/quality.d.ts.map +1 -0
  150. package/dist/panels/quality.js +59 -0
  151. package/dist/panels/quality.js.map +1 -0
  152. package/dist/panels/tracks.d.ts +3 -0
  153. package/dist/panels/tracks.d.ts.map +1 -0
  154. package/dist/panels/tracks.js +49 -0
  155. package/dist/panels/tracks.js.map +1 -0
  156. package/dist/presets.d.ts +23 -0
  157. package/dist/presets.d.ts.map +1 -0
  158. package/dist/presets.js +36 -0
  159. package/dist/presets.js.map +1 -0
  160. package/dist/style.d.ts +13 -0
  161. package/dist/style.d.ts.map +1 -0
  162. package/dist/style.js +345 -0
  163. package/dist/style.js.map +1 -0
  164. package/package.json +58 -0
@@ -0,0 +1,59 @@
1
+ import { el, fill, menu } from '../dom.js';
2
+ const AUTO = 'auto';
3
+ /** A rendition's height when the manifest declared one, its bitrate otherwise. */
4
+ function label(rendition) {
5
+ if (rendition.height !== undefined)
6
+ return `${rendition.height}p`;
7
+ return `${Math.round(rendition.bitrate / 1000)} kbps`;
8
+ }
9
+ export const qualityPanel = (session, video) => {
10
+ const engine = session.engine;
11
+ if (engine === null)
12
+ return null;
13
+ const quality = engine.quality;
14
+ const root = el('div', 'panel quality');
15
+ const [wrapper, select] = menu('quality', 'Quality');
16
+ const playing = el('span', 'value quality-playing');
17
+ root.append(wrapper, playing);
18
+ let shown = '';
19
+ function render() {
20
+ const items = [[AUTO, 'Auto']];
21
+ for (const rendition of quality.renditions)
22
+ items.push([rendition.id, label(rendition)]);
23
+ fill(select, items, quality.pinned ?? AUTO);
24
+ root.hidden = quality.renditions.length === 0;
25
+ }
26
+ function tick() {
27
+ const current = quality.playing === null ? '' : label(quality.playing);
28
+ if (current === shown)
29
+ return;
30
+ shown = current;
31
+ playing.textContent = current;
32
+ }
33
+ select.addEventListener('change', () => {
34
+ if (select.value === AUTO)
35
+ quality.auto();
36
+ else
37
+ quality.pin(select.value);
38
+ });
39
+ const offs = [
40
+ engine.on('tracks:changed', render),
41
+ engine.on('quality:constraints-unsatisfiable', render),
42
+ engine.on('quality:pin-unsatisfiable', render),
43
+ ];
44
+ // No event reports the playing rendition: it is derived from currentTime
45
+ // against the append log, so the element reads it on the clock the video
46
+ // already ticks.
47
+ video.addEventListener('timeupdate', tick);
48
+ render();
49
+ tick();
50
+ return {
51
+ root,
52
+ dispose() {
53
+ for (const off of offs)
54
+ off();
55
+ video.removeEventListener('timeupdate', tick);
56
+ },
57
+ };
58
+ };
59
+ //# sourceMappingURL=quality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality.js","sourceRoot":"","sources":["../../src/panels/quality.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG3C,M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IAED,SAAS,IAAI;QACX,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvE,IAAI,OAAO,KAAK,KAAK;YAAE,OAAO;QAC9B,KAAK,GAAG,OAAO,CAAC;QAChB,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;QACrC,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI;YAAE,OAAO,CAAC,IAAI,EAAE,CAAC;;YACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG;QACX,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC;QACnC,MAAM,CAAC,EAAE,CAAC,mCAAmC,EAAE,MAAM,CAAC;QACtD,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,MAAM,CAAC;KAC/C,CAAC;IACF,yEAAyE;IACzE,yEAAyE;IACzE,iBAAiB;IACjB,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,OAAO;YACL,KAAK,MAAM,GAAG,IAAI,IAAI;gBAAE,GAAG,EAAE,CAAC;YAC9B,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PanelFactory } from './panel.js';
2
+ export declare const tracksPanel: PanelFactory;
3
+ //# sourceMappingURL=tracks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracks.d.ts","sourceRoot":"","sources":["../../src/panels/tracks.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAS,YAAY,EAAE,MAAM,YAAY,CAAC;AAUtD,eAAO,MAAM,WAAW,EAAE,YA+CzB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { el, fill, menu } from '../dom.js';
2
+ const OFF = 'off';
3
+ /** The language, then the role, then the id: whichever the manifest gave. */
4
+ function label(track) {
5
+ const parts = [track.lang, track.role].filter((part) => part !== undefined);
6
+ return parts.length === 0 ? track.id : parts.join(' · ');
7
+ }
8
+ export const tracksPanel = (session) => {
9
+ const engine = session.engine;
10
+ if (engine === null)
11
+ return null;
12
+ const tracks = engine.tracks;
13
+ const root = el('div', 'panel tracks');
14
+ const [audioLabel, audio] = menu('audio', 'Audio');
15
+ const [textLabel, text] = menu('text', 'Subtitles');
16
+ root.append(audioLabel, textLabel);
17
+ function renderOne(select, wrapper, contentType, off) {
18
+ const available = tracks.available.filter((track) => track.contentType === contentType);
19
+ const items = off ? [[OFF, 'Off']] : [];
20
+ for (const track of available)
21
+ items.push([track.id, label(track)]);
22
+ fill(select, items, tracks.active(contentType)?.id ?? OFF);
23
+ wrapper.hidden = available.length === 0;
24
+ return available.length;
25
+ }
26
+ function render() {
27
+ const count = renderOne(audio, audioLabel, 'audio', false) + renderOne(text, textLabel, 'text', true);
28
+ root.hidden = count === 0;
29
+ }
30
+ audio.addEventListener('change', () => {
31
+ tracks.select(audio.value);
32
+ });
33
+ text.addEventListener('change', () => {
34
+ if (text.value === OFF)
35
+ tracks.deselect('text');
36
+ else
37
+ tracks.select(text.value);
38
+ });
39
+ const offs = [engine.on('tracks:changed', render), engine.on('tracks:selected', render)];
40
+ render();
41
+ return {
42
+ root,
43
+ dispose() {
44
+ for (const off of offs)
45
+ off();
46
+ },
47
+ };
48
+ };
49
+ //# sourceMappingURL=tracks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracks.js","sourceRoot":"","sources":["../../src/panels/tracks.ts"],"names":[],"mappings":"AASA,OAAO,E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AAO;QACL,IAAI;QACJ,OAAO;YACL,KAAK,MAAM,GAAG,IAAI,IAAI;gBAAE,GAAG,EAAE,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Resolving the `preset` attribute to a preset factory without bundling one.
3
+ * The size story is the engine's, and an element that statically imported a
4
+ * preset would undo it.
5
+ *
6
+ * Two routes, in order. A page on the CDN path has no module resolver, and
7
+ * its engine bundle carries exactly one preset behind `mattebox.preset`.
8
+ * Everywhere else the table below answers.
9
+ *
10
+ * The table is explicit because a computed specifier is not a portable
11
+ * dynamic import: no bundler can analyze `import('mattebox/presets/' + name)`,
12
+ * so it survives the build as a bare specifier the browser cannot resolve.
13
+ * Twelve literal imports are twelve chunks a bundler can split, and the page
14
+ * downloads only the one it names. An unknown name is an error the element
15
+ * reports, not a failed request.
16
+ */
17
+ import type { Preset } from 'mattebox/presets/full';
18
+ export declare function resolvePreset(name: string): Promise<Preset | null>;
19
+ /** The DRM stages to leave out of a preset on a browser that cannot use them. */
20
+ export declare function drmGuard(): {
21
+ without?: readonly string[];
22
+ };
23
+ //# sourceMappingURL=presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AA4BpD,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUxE;AAED,iFAAiF;AACjF,wBAAgB,QAAQ,IAAI;IAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAE1D"}
@@ -0,0 +1,36 @@
1
+ /** eme-core's teardown calls `element.setMediaKeys(null)` unguarded, so a build without EME throws out of `detach`. */
2
+ const DRM_STAGES = ['eme-core', 'eme-cenc', 'eme-fairplay'];
3
+ /** The engine's preset matrix: a protocol line, a `-ts` tier, a `-drm` tier, plus `full` and `kernel`. */
4
+ const PRESETS = {
5
+ dash: () => import('mattebox/presets/dash'),
6
+ 'dash-drm': () => import('mattebox/presets/dash-drm'),
7
+ dual: () => import('mattebox/presets/dual'),
8
+ 'dual-drm': () => import('mattebox/presets/dual-drm'),
9
+ 'dual-ts': () => import('mattebox/presets/dual-ts'),
10
+ 'dual-ts-drm': () => import('mattebox/presets/dual-ts-drm'),
11
+ full: () => import('mattebox/presets/full'),
12
+ hls: () => import('mattebox/presets/hls'),
13
+ 'hls-drm': () => import('mattebox/presets/hls-drm'),
14
+ 'hls-ts': () => import('mattebox/presets/hls-ts'),
15
+ 'hls-ts-drm': () => import('mattebox/presets/hls-ts-drm'),
16
+ kernel: () => import('mattebox/presets/kernel'),
17
+ };
18
+ export async function resolvePreset(name) {
19
+ const engine = globalThis.mattebox;
20
+ if (engine?.preset !== undefined)
21
+ return engine.preset;
22
+ const load = PRESETS[name];
23
+ if (load === undefined)
24
+ return null;
25
+ try {
26
+ return (await load()).default;
27
+ }
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ /** The DRM stages to leave out of a preset on a browser that cannot use them. */
33
+ export function drmGuard() {
34
+ return 'setMediaKeys' in HTMLMediaElement.prototype ? {} : { without: DRM_STAGES };
35
+ }
36
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sourceRoot":"","sources":["../src/presets.ts"],"names":[],"mappings":"AAuBA,uHAAuH;AACvH,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAI5D,0GAA0G;AAC1G,MAAM,OAAO,GAAmC;IAC9C,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC;IAC3C,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC;IACrD,IAAI,EAAE,GAAG,EAAE,CAAC,M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,13 @@
1
+ /**
2
+ * The default styles. Two rules govern them.
3
+ *
4
+ * Nothing carries `!important`. For normal declarations the outer tree wins
5
+ * over the shadow tree, so any `::part()` rule the page writes beats these
6
+ * whatever its specificity; an `!important` here would invert that and make
7
+ * a part unstylable.
8
+ *
9
+ * Selectors stay at one attribute, and every element is reached through its
10
+ * `part`, so the names in the stylesheet are the names the page uses.
11
+ */
12
+ export declare const STYLE = "\n:host {\n display: block;\n position: relative;\n outline: none;\n --mbx-surface: #101114;\n --mbx-text: #f2f3f5;\n --mbx-muted: #9aa0a6;\n --mbx-accent: #5b8cff;\n --mbx-error: #ffb4ab;\n --mbx-live: #ff4d4d;\n --mbx-radius: 4px;\n --mbx-gap: 10px;\n --mbx-pad: 8px;\n --mbx-font: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n}\n[part~=\"stage\"] { position: relative; }\n/* 16:9 until the media says otherwise: a bare video measures 300 by 150 and\n would jump to its size on metadata. Auto first, so the natural ratio wins\n once it is known. */\n::slotted(video) { display: block; width: 100%; aspect-ratio: auto 16 / 9; }\n[part~=\"controls\"] {\n position: absolute;\n inset: auto 0 0 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 40px 16px 12px;\n color: var(--mbx-text);\n background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));\n font: 500 16px/1.2 var(--mbx-font);\n transition: opacity 0.2s;\n}\n[part~=\"idle\"] { opacity: 0; pointer-events: none; }\n[part~=\"error-screen\"] {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n background: rgba(0, 0, 0, 0.75);\n color: var(--mbx-text);\n font: 400 15px/1.4 var(--mbx-font);\n text-align: center;\n}\n[part~=\"error-box\"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }\n[part~=\"error-title\"] { font-size: 18px; font-weight: 600; }\n[part~=\"error-detail\"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }\n[part~=\"error-retry\"] { width: auto; height: 36px; padding: 0 16px; border: 1px solid currentColor; font-weight: 600; }\n[part~=\"row\"] { display: flex; align-items: center; gap: 8px; }\n[part~=\"seek-row\"] { gap: 16px; }\n[part~=\"current-time\"], [part~=\"duration\"] { min-width: 3ch; font-variant-numeric: tabular-nums; white-space: nowrap; }\n[part~=\"duration\"] { text-align: right; }\n[part~=\"control\"] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 40px;\n height: 40px;\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n opacity: 0.9;\n}\n[part~=\"control\"]:hover { opacity: 1; }\n[part~=\"start-button\"] {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 96px;\n height: 96px;\n margin: -48px 0 0 -48px;\n color: var(--mbx-text);\n opacity: 0.92;\n filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));\n transition: opacity 0.15s;\n}\n[part~=\"start-button\"]:hover { opacity: 1; }\n[part~=\"start-button\"] [part~=\"icon\"] { width: 72px; height: 72px; }\n[part~=\"error-screen\"] {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n background: rgba(0, 0, 0, 0.75);\n color: var(--mbx-text);\n font: 400 15px/1.4 var(--mbx-font);\n text-align: center;\n}\n[part~=\"error-box\"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }\n[part~=\"error-title\"] { font-size: 18px; font-weight: 600; }\n[part~=\"error-detail\"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }\n[part~=\"error-retry\"] { width: auto; height: 36px; padding: 0 16px; border: 1px solid currentColor; font-weight: 600; }\n[part~=\"row\"] { display: flex; align-items: center; gap: 8px; }\n[part~=\"seek-row\"] { gap: 16px; }\n[part~=\"current-time\"], [part~=\"duration\"] { min-width: 3ch; font-variant-numeric: tabular-nums; white-space: nowrap; }\n[part~=\"duration\"] { text-align: right; }\n[part~=\"control\"] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 40px;\n height: 40px;\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n opacity: 0.9;\n}\n[part~=\"control\"]:hover { opacity: 1; }\n[part~=\"start-button\"] {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 104px;\n height: 64px;\n margin: -32px 0 0 -52px;\n border: 1px solid rgba(255, 255, 255, 0.18);\n border-radius: var(--mbx-radius);\n background: rgba(0, 0, 0, 0.45);\n color: var(--mbx-text);\n opacity: 0.9;\n transition: opacity 0.15s, background 0.15s;\n}\n[part~=\"start-button\"]:hover { opacity: 1; background: rgba(0, 0, 0, 0.6); }\n[part~=\"start-button\"] [part~=\"icon\"] { width: 40px; height: 40px; margin-left: 2px; }\n[part~=\"icon\"] { width: 1.75em; height: 1.75em; fill: currentColor; }\n[part~=\"slider\"] {\n position: relative;\n flex: none;\n height: 40px;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n touch-action: none;\n}\n[part~=\"rail\"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }\n[part~=\"seek\"] { flex: 1; }\n[part~=\"track\"] {\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n height: 4px;\n transform: translateY(-50%);\n background: rgba(255, 255, 255, 0.35);\n border-radius: 2px;\n overflow: hidden;\n}\n[part~=\"fill\"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }\n[part~=\"thumb\"] {\n position: absolute;\n top: 50%;\n width: 16px;\n height: 16px;\n margin: -8px 0 0 -8px;\n border-radius: 50%;\n background: var(--mbx-text);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n pointer-events: none;\n}\n[part~=\"buffered\"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }\n[part~=\"buffered-range\"] { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.3); }\n[part~=\"hover\"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-text); }\n[part~=\"edge\"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-live); }\n[part~=\"preview\"] {\n position: absolute;\n bottom: 100%;\n margin-bottom: 4px;\n transform: translateX(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 2px;\n padding: 2px;\n background: var(--mbx-surface);\n border-radius: var(--mbx-radius);\n font-size: 13px;\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n pointer-events: none;\n}\n[part~=\"preview-image\"] { position: relative; overflow: hidden; border-radius: 2px; }\n[part~=\"preview-tile\"] { position: absolute; top: 0; left: 0; transform-origin: top left; background-repeat: no-repeat; }\n[part~=\"preview-time\"] { padding: 0 4px; }\n[part~=\"volume-group\"] { display: flex; align-items: center; }\n[part~=\"volume\"] { width: 0; opacity: 0; transition: width 0.2s ease, opacity 0.2s ease; }\n/* Two attributes in one selector, the one place: the slider unfolds from\n its group under the pointer or focus, and a page reaches it through\n ::part(volume) all the same. */\n[part~=\"volume-group\"]:hover [part~=\"volume\"] { width: 80px; opacity: 1; }\n[part~=\"volume-group\"]:focus-within [part~=\"volume\"] { width: 80px; opacity: 1; }\n[part~=\"cluster\"] { display: flex; align-items: center; gap: 4px; margin-left: auto; }\n[part~=\"live-button\"] { width: auto; gap: 6px; padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }\n[part~=\"live-button\"]:disabled { cursor: default; opacity: 1; }\n[part~=\"live-dot\"] { width: 10px; height: 10px; border-radius: 50%; background: var(--mbx-muted); transition: background 0.2s; }\n/* Two attributes, as with the volume: the dot reads the button's state. */\n[part~=\"live-dot\"][part~=\"at-edge\"] { background: var(--mbx-live); box-shadow: 0 0 6px var(--mbx-live); }\n[part~=\"slot\"] { display: contents; }\n[part~=\"menu\"] { position: relative; }\n[part~=\"popup\"] {\n position: absolute;\n right: 0;\n bottom: 100%;\n margin-bottom: 8px;\n min-width: 160px;\n padding: 6px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overscroll-behavior: contain;\n background: rgba(16, 17, 20, 0.95);\n border-radius: var(--mbx-radius);\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);\n font-size: 14px;\n}\n[part~=\"section\"] { display: flex; flex-direction: column; }\n[part~=\"section\"] + [part~=\"section\"] { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }\n[part~=\"section-label\"] { padding: 4px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mbx-muted); }\n[part~=\"item\"] {\n display: block;\n width: 100%;\n padding: 8px 12px 8px 28px;\n font: inherit;\n color: inherit;\n text-align: left;\n white-space: nowrap;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n}\n[part~=\"item\"]:hover { background: rgba(255, 255, 255, 0.12); }\n[part~=\"item\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"page-item\"] { position: relative; padding-right: 28px; }\n[part~=\"page-item\"]::after { content: \"\"; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.7; }\n[part~=\"back-item\"] { position: relative; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0; margin-bottom: 6px; }\n[part~=\"back-item\"]::before { content: \"\"; position: absolute; left: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(-45deg); opacity: 0.7; }\n[part~=\"checked\"] { position: relative; }\n[part~=\"checked\"]::before { content: \"\"; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--mbx-accent); }\n[part~=\"drm-badge\"] { 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; }\n[part~=\"drm-badge\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"tooltip\"] {\n position: absolute;\n right: 0;\n bottom: 100%;\n margin-bottom: 8px;\n padding: 8px 10px;\n background: rgba(16, 17, 20, 0.95);\n border-radius: var(--mbx-radius);\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);\n color: var(--mbx-text);\n font-size: 13px;\n line-height: 1.4;\n text-align: left;\n white-space: nowrap;\n pointer-events: none;\n}\n[part~=\"tooltip-title\"] { font-weight: 600; }\n[part~=\"tooltip-text\"] { color: var(--mbx-muted); }\n[part~=\"track\"] {\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n height: 4px;\n transform: translateY(-50%);\n background: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\n overflow: hidden;\n}\n[part~=\"fill\"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }\n[part~=\"thumb\"] {\n position: absolute;\n top: 50%;\n width: 12px;\n height: 12px;\n margin: -6px 0 0 -6px;\n border-radius: 50%;\n background: var(--mbx-text);\n pointer-events: none;\n}\n:host(:focus-visible) [part~=\"stage\"] { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"control\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"slider\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"stage\"]:fullscreen { display: flex; background: #000; }\n[part~=\"stage\"]:fullscreen ::slotted(video) { height: 100%; object-fit: contain; }\n[part~=\"stage\"]:-webkit-full-screen { display: flex; background: #000; }\n[part~=\"stage\"]:-webkit-full-screen ::slotted(video) { height: 100%; object-fit: contain; }\n@media (prefers-reduced-motion: reduce) {\n [part~=\"controls\"] { transition: none; }\n [part~=\"volume\"] { transition: none; }\n [part~=\"live-dot\"] { transition: none; }\n [part~=\"start-button\"] { transition: none; }\n}\n[part~=\"panels\"], [part~=\"error\"] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--mbx-gap);\n padding: var(--mbx-pad);\n background: var(--mbx-surface);\n color: var(--mbx-text);\n font: 400 13px/1.4 var(--mbx-font);\n}\n[part~=\"panels\"]:empty { display: none; }\n[part~=\"panel\"] { display: flex; align-items: center; gap: 6px; }\n[part~=\"label\"] { display: flex; align-items: center; gap: 6px; }\n[part~=\"text\"] { color: var(--mbx-muted); }\n[part~=\"value\"] { color: var(--mbx-accent); }\n[part~=\"select\"], [part~=\"button\"] {\n font: inherit;\n color: inherit;\n background: transparent;\n border: 1px solid currentColor;\n border-radius: var(--mbx-radius);\n padding: 2px 6px;\n}\n[part~=\"button\"][disabled] { opacity: 0.5; }\n[part~=\"error\"] { color: var(--mbx-error); }\n[hidden] { display: none; }\n";
13
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,umZA4UjB,CAAC"}
package/dist/style.js ADDED
@@ -0,0 +1,345 @@
1
+ /**
2
+ * The default styles. Two rules govern them.
3
+ *
4
+ * Nothing carries `!important`. For normal declarations the outer tree wins
5
+ * over the shadow tree, so any `::part()` rule the page writes beats these
6
+ * whatever its specificity; an `!important` here would invert that and make
7
+ * a part unstylable.
8
+ *
9
+ * Selectors stay at one attribute, and every element is reached through its
10
+ * `part`, so the names in the stylesheet are the names the page uses.
11
+ */
12
+ export const STYLE = `
13
+ :host {
14
+ display: block;
15
+ position: relative;
16
+ outline: none;
17
+ --mbx-surface: #101114;
18
+ --mbx-text: #f2f3f5;
19
+ --mbx-muted: #9aa0a6;
20
+ --mbx-accent: #5b8cff;
21
+ --mbx-error: #ffb4ab;
22
+ --mbx-live: #ff4d4d;
23
+ --mbx-radius: 4px;
24
+ --mbx-gap: 10px;
25
+ --mbx-pad: 8px;
26
+ --mbx-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
27
+ }
28
+ [part~="stage"] { position: relative; }
29
+ /* 16:9 until the media says otherwise: a bare video measures 300 by 150 and
30
+ would jump to its size on metadata. Auto first, so the natural ratio wins
31
+ once it is known. */
32
+ ::slotted(video) { display: block; width: 100%; aspect-ratio: auto 16 / 9; }
33
+ [part~="controls"] {
34
+ position: absolute;
35
+ inset: auto 0 0 0;
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 4px;
39
+ padding: 40px 16px 12px;
40
+ color: var(--mbx-text);
41
+ background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
42
+ font: 500 16px/1.2 var(--mbx-font);
43
+ transition: opacity 0.2s;
44
+ }
45
+ [part~="idle"] { opacity: 0; pointer-events: none; }
46
+ [part~="error-screen"] {
47
+ position: absolute;
48
+ inset: 0;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ padding: 16px;
53
+ background: rgba(0, 0, 0, 0.75);
54
+ color: var(--mbx-text);
55
+ font: 400 15px/1.4 var(--mbx-font);
56
+ text-align: center;
57
+ }
58
+ [part~="error-box"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
59
+ [part~="error-title"] { font-size: 18px; font-weight: 600; }
60
+ [part~="error-detail"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }
61
+ [part~="error-retry"] { width: auto; height: 36px; padding: 0 16px; border: 1px solid currentColor; font-weight: 600; }
62
+ [part~="row"] { display: flex; align-items: center; gap: 8px; }
63
+ [part~="seek-row"] { gap: 16px; }
64
+ [part~="current-time"], [part~="duration"] { min-width: 3ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
65
+ [part~="duration"] { text-align: right; }
66
+ [part~="control"] {
67
+ display: inline-flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ flex: none;
71
+ width: 40px;
72
+ height: 40px;
73
+ padding: 0;
74
+ font: inherit;
75
+ color: inherit;
76
+ background: transparent;
77
+ border: 0;
78
+ border-radius: var(--mbx-radius);
79
+ cursor: pointer;
80
+ opacity: 0.9;
81
+ }
82
+ [part~="control"]:hover { opacity: 1; }
83
+ [part~="start-button"] {
84
+ position: absolute;
85
+ top: 50%;
86
+ left: 50%;
87
+ width: 96px;
88
+ height: 96px;
89
+ margin: -48px 0 0 -48px;
90
+ color: var(--mbx-text);
91
+ opacity: 0.92;
92
+ filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
93
+ transition: opacity 0.15s;
94
+ }
95
+ [part~="start-button"]:hover { opacity: 1; }
96
+ [part~="start-button"] [part~="icon"] { width: 72px; height: 72px; }
97
+ [part~="error-screen"] {
98
+ position: absolute;
99
+ inset: 0;
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ padding: 16px;
104
+ background: rgba(0, 0, 0, 0.75);
105
+ color: var(--mbx-text);
106
+ font: 400 15px/1.4 var(--mbx-font);
107
+ text-align: center;
108
+ }
109
+ [part~="error-box"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
110
+ [part~="error-title"] { font-size: 18px; font-weight: 600; }
111
+ [part~="error-detail"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }
112
+ [part~="error-retry"] { width: auto; height: 36px; padding: 0 16px; border: 1px solid currentColor; font-weight: 600; }
113
+ [part~="row"] { display: flex; align-items: center; gap: 8px; }
114
+ [part~="seek-row"] { gap: 16px; }
115
+ [part~="current-time"], [part~="duration"] { min-width: 3ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
116
+ [part~="duration"] { text-align: right; }
117
+ [part~="control"] {
118
+ display: inline-flex;
119
+ align-items: center;
120
+ justify-content: center;
121
+ flex: none;
122
+ width: 40px;
123
+ height: 40px;
124
+ padding: 0;
125
+ font: inherit;
126
+ color: inherit;
127
+ background: transparent;
128
+ border: 0;
129
+ border-radius: var(--mbx-radius);
130
+ cursor: pointer;
131
+ opacity: 0.9;
132
+ }
133
+ [part~="control"]:hover { opacity: 1; }
134
+ [part~="start-button"] {
135
+ position: absolute;
136
+ top: 50%;
137
+ left: 50%;
138
+ width: 104px;
139
+ height: 64px;
140
+ margin: -32px 0 0 -52px;
141
+ border: 1px solid rgba(255, 255, 255, 0.18);
142
+ border-radius: var(--mbx-radius);
143
+ background: rgba(0, 0, 0, 0.45);
144
+ color: var(--mbx-text);
145
+ opacity: 0.9;
146
+ transition: opacity 0.15s, background 0.15s;
147
+ }
148
+ [part~="start-button"]:hover { opacity: 1; background: rgba(0, 0, 0, 0.6); }
149
+ [part~="start-button"] [part~="icon"] { width: 40px; height: 40px; margin-left: 2px; }
150
+ [part~="icon"] { width: 1.75em; height: 1.75em; fill: currentColor; }
151
+ [part~="slider"] {
152
+ position: relative;
153
+ flex: none;
154
+ height: 40px;
155
+ border-radius: var(--mbx-radius);
156
+ cursor: pointer;
157
+ touch-action: none;
158
+ }
159
+ [part~="rail"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }
160
+ [part~="seek"] { flex: 1; }
161
+ [part~="track"] {
162
+ position: absolute;
163
+ top: 50%;
164
+ left: 0;
165
+ right: 0;
166
+ height: 4px;
167
+ transform: translateY(-50%);
168
+ background: rgba(255, 255, 255, 0.35);
169
+ border-radius: 2px;
170
+ overflow: hidden;
171
+ }
172
+ [part~="fill"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }
173
+ [part~="thumb"] {
174
+ position: absolute;
175
+ top: 50%;
176
+ width: 16px;
177
+ height: 16px;
178
+ margin: -8px 0 0 -8px;
179
+ border-radius: 50%;
180
+ background: var(--mbx-text);
181
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
182
+ pointer-events: none;
183
+ }
184
+ [part~="buffered"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
185
+ [part~="buffered-range"] { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.3); }
186
+ [part~="hover"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-text); }
187
+ [part~="edge"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-live); }
188
+ [part~="preview"] {
189
+ position: absolute;
190
+ bottom: 100%;
191
+ margin-bottom: 4px;
192
+ transform: translateX(-50%);
193
+ display: flex;
194
+ flex-direction: column;
195
+ align-items: center;
196
+ gap: 2px;
197
+ padding: 2px;
198
+ background: var(--mbx-surface);
199
+ border-radius: var(--mbx-radius);
200
+ font-size: 13px;
201
+ font-variant-numeric: tabular-nums;
202
+ white-space: nowrap;
203
+ pointer-events: none;
204
+ }
205
+ [part~="preview-image"] { position: relative; overflow: hidden; border-radius: 2px; }
206
+ [part~="preview-tile"] { position: absolute; top: 0; left: 0; transform-origin: top left; background-repeat: no-repeat; }
207
+ [part~="preview-time"] { padding: 0 4px; }
208
+ [part~="volume-group"] { display: flex; align-items: center; }
209
+ [part~="volume"] { width: 0; opacity: 0; transition: width 0.2s ease, opacity 0.2s ease; }
210
+ /* Two attributes in one selector, the one place: the slider unfolds from
211
+ its group under the pointer or focus, and a page reaches it through
212
+ ::part(volume) all the same. */
213
+ [part~="volume-group"]:hover [part~="volume"] { width: 80px; opacity: 1; }
214
+ [part~="volume-group"]:focus-within [part~="volume"] { width: 80px; opacity: 1; }
215
+ [part~="cluster"] { display: flex; align-items: center; gap: 4px; margin-left: auto; }
216
+ [part~="live-button"] { width: auto; gap: 6px; padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
217
+ [part~="live-button"]:disabled { cursor: default; opacity: 1; }
218
+ [part~="live-dot"] { width: 10px; height: 10px; border-radius: 50%; background: var(--mbx-muted); transition: background 0.2s; }
219
+ /* Two attributes, as with the volume: the dot reads the button's state. */
220
+ [part~="live-dot"][part~="at-edge"] { background: var(--mbx-live); box-shadow: 0 0 6px var(--mbx-live); }
221
+ [part~="slot"] { display: contents; }
222
+ [part~="menu"] { position: relative; }
223
+ [part~="popup"] {
224
+ position: absolute;
225
+ right: 0;
226
+ bottom: 100%;
227
+ margin-bottom: 8px;
228
+ min-width: 160px;
229
+ padding: 6px;
230
+ display: flex;
231
+ flex-direction: column;
232
+ overflow-y: auto;
233
+ overscroll-behavior: contain;
234
+ background: rgba(16, 17, 20, 0.95);
235
+ border-radius: var(--mbx-radius);
236
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
237
+ font-size: 14px;
238
+ }
239
+ [part~="section"] { display: flex; flex-direction: column; }
240
+ [part~="section"] + [part~="section"] { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
241
+ [part~="section-label"] { padding: 4px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mbx-muted); }
242
+ [part~="item"] {
243
+ display: block;
244
+ width: 100%;
245
+ padding: 8px 12px 8px 28px;
246
+ font: inherit;
247
+ color: inherit;
248
+ text-align: left;
249
+ white-space: nowrap;
250
+ background: transparent;
251
+ border: 0;
252
+ border-radius: var(--mbx-radius);
253
+ cursor: pointer;
254
+ }
255
+ [part~="item"]:hover { background: rgba(255, 255, 255, 0.12); }
256
+ [part~="item"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
257
+ [part~="page-item"] { position: relative; padding-right: 28px; }
258
+ [part~="page-item"]::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.7; }
259
+ [part~="back-item"] { position: relative; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0; margin-bottom: 6px; }
260
+ [part~="back-item"]::before { content: ""; position: absolute; left: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(-45deg); opacity: 0.7; }
261
+ [part~="checked"] { position: relative; }
262
+ [part~="checked"]::before { content: ""; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--mbx-accent); }
263
+ [part~="drm-badge"] { 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; }
264
+ [part~="drm-badge"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
265
+ [part~="tooltip"] {
266
+ position: absolute;
267
+ right: 0;
268
+ bottom: 100%;
269
+ margin-bottom: 8px;
270
+ padding: 8px 10px;
271
+ background: rgba(16, 17, 20, 0.95);
272
+ border-radius: var(--mbx-radius);
273
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
274
+ color: var(--mbx-text);
275
+ font-size: 13px;
276
+ line-height: 1.4;
277
+ text-align: left;
278
+ white-space: nowrap;
279
+ pointer-events: none;
280
+ }
281
+ [part~="tooltip-title"] { font-weight: 600; }
282
+ [part~="tooltip-text"] { color: var(--mbx-muted); }
283
+ [part~="track"] {
284
+ position: absolute;
285
+ top: 50%;
286
+ left: 0;
287
+ right: 0;
288
+ height: 4px;
289
+ transform: translateY(-50%);
290
+ background: rgba(255, 255, 255, 0.3);
291
+ border-radius: 2px;
292
+ overflow: hidden;
293
+ }
294
+ [part~="fill"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }
295
+ [part~="thumb"] {
296
+ position: absolute;
297
+ top: 50%;
298
+ width: 12px;
299
+ height: 12px;
300
+ margin: -6px 0 0 -6px;
301
+ border-radius: 50%;
302
+ background: var(--mbx-text);
303
+ pointer-events: none;
304
+ }
305
+ :host(:focus-visible) [part~="stage"] { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
306
+ [part~="control"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
307
+ [part~="slider"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
308
+ [part~="stage"]:fullscreen { display: flex; background: #000; }
309
+ [part~="stage"]:fullscreen ::slotted(video) { height: 100%; object-fit: contain; }
310
+ [part~="stage"]:-webkit-full-screen { display: flex; background: #000; }
311
+ [part~="stage"]:-webkit-full-screen ::slotted(video) { height: 100%; object-fit: contain; }
312
+ @media (prefers-reduced-motion: reduce) {
313
+ [part~="controls"] { transition: none; }
314
+ [part~="volume"] { transition: none; }
315
+ [part~="live-dot"] { transition: none; }
316
+ [part~="start-button"] { transition: none; }
317
+ }
318
+ [part~="panels"], [part~="error"] {
319
+ display: flex;
320
+ flex-wrap: wrap;
321
+ align-items: center;
322
+ gap: var(--mbx-gap);
323
+ padding: var(--mbx-pad);
324
+ background: var(--mbx-surface);
325
+ color: var(--mbx-text);
326
+ font: 400 13px/1.4 var(--mbx-font);
327
+ }
328
+ [part~="panels"]:empty { display: none; }
329
+ [part~="panel"] { display: flex; align-items: center; gap: 6px; }
330
+ [part~="label"] { display: flex; align-items: center; gap: 6px; }
331
+ [part~="text"] { color: var(--mbx-muted); }
332
+ [part~="value"] { color: var(--mbx-accent); }
333
+ [part~="select"], [part~="button"] {
334
+ font: inherit;
335
+ color: inherit;
336
+ background: transparent;
337
+ border: 1px solid currentColor;
338
+ border-radius: var(--mbx-radius);
339
+ padding: 2px 6px;
340
+ }
341
+ [part~="button"][disabled] { opacity: 0.5; }
342
+ [part~="error"] { color: var(--mbx-error); }
343
+ [hidden] { display: none; }
344
+ `;
345
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4UpB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@mattebox/player",
3
+ "version": "0.1.0",
4
+ "description": "A <mattebox-player> custom element over @mattebox/player-core.",
5
+ "author": "Josep Boix Requesens",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/jboix/mattebox-player.git",
9
+ "directory": "packages/player"
10
+ },
11
+ "homepage": "https://github.com/jboix/mattebox-player#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/jboix/mattebox-player/issues"
14
+ },
15
+ "keywords": [
16
+ "mattebox",
17
+ "player",
18
+ "custom-element",
19
+ "hls",
20
+ "dash",
21
+ "video"
22
+ ],
23
+ "license": "MIT",
24
+ "type": "module",
25
+ "sideEffects": true,
26
+ "engines": {
27
+ "node": ">=20.19"
28
+ },
29
+ "main": "./dist/es2015/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "modern": "./dist/index.js",
35
+ "default": "./dist/es2015/index.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "NOTICE"
42
+ ],
43
+ "scripts": {
44
+ "clean": "rm -rf dist",
45
+ "build": "npm run clean && npm run build:modern && npm run build:es2015 && npm run build:cdn",
46
+ "build:modern": "tsc -p tsconfig.build.json",
47
+ "build:es2015": "rolldown -c rolldown.dist.config.mjs",
48
+ "build:cdn": "rolldown -c rolldown.cdn.config.mjs",
49
+ "check:package": "publint && attw --pack . --format table --no-emoji",
50
+ "release:ci": "semantic-release"
51
+ },
52
+ "dependencies": {
53
+ "@mattebox/player-core": "^0.1.0"
54
+ },
55
+ "peerDependencies": {
56
+ "mattebox": "^0.2.1"
57
+ }
58
+ }