@mattebox/player 0.8.0 → 0.9.1

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 (102) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -3
  2. package/dist/controls/cues.d.ts.map +1 -1
  3. package/dist/controls/cues.js +11 -5
  4. package/dist/controls/cues.js.map +1 -1
  5. package/dist/controls/icons.d.ts +5 -30
  6. package/dist/controls/icons.d.ts.map +1 -1
  7. package/dist/controls/icons.js +38 -29
  8. package/dist/controls/icons.js.map +1 -1
  9. package/dist/controls/menu.d.ts +20 -0
  10. package/dist/controls/menu.d.ts.map +1 -1
  11. package/dist/controls/menu.js +83 -14
  12. package/dist/controls/menu.js.map +1 -1
  13. package/dist/element.d.ts +36 -2
  14. package/dist/element.d.ts.map +1 -1
  15. package/dist/element.js +140 -24
  16. package/dist/element.js.map +1 -1
  17. package/dist/elements/audio-menu.d.ts.map +1 -1
  18. package/dist/elements/audio-menu.js +3 -1
  19. package/dist/elements/audio-menu.js.map +1 -1
  20. package/dist/elements/component.d.ts.map +1 -1
  21. package/dist/elements/component.js +10 -0
  22. package/dist/elements/component.js.map +1 -1
  23. package/dist/elements/control-bar.d.ts +2 -0
  24. package/dist/elements/control-bar.d.ts.map +1 -1
  25. package/dist/elements/control-bar.js +23 -7
  26. package/dist/elements/control-bar.js.map +1 -1
  27. package/dist/elements/current-time.d.ts.map +1 -1
  28. package/dist/elements/current-time.js +1 -1
  29. package/dist/elements/current-time.js.map +1 -1
  30. package/dist/elements/drm-badge.js +1 -1
  31. package/dist/elements/duration.d.ts.map +1 -1
  32. package/dist/elements/duration.js +6 -2
  33. package/dist/elements/duration.js.map +1 -1
  34. package/dist/elements/error-screen.js +1 -1
  35. package/dist/elements/live-button.js +1 -1
  36. package/dist/elements/marker-button.d.ts +3 -3
  37. package/dist/elements/marker-button.d.ts.map +1 -1
  38. package/dist/elements/marker-button.js +18 -22
  39. package/dist/elements/marker-button.js.map +1 -1
  40. package/dist/elements/menu-element.d.ts.map +1 -1
  41. package/dist/elements/menu-element.js +2 -1
  42. package/dist/elements/menu-element.js.map +1 -1
  43. package/dist/elements/quality-menu.js +1 -1
  44. package/dist/elements/quality-menu.js.map +1 -1
  45. package/dist/elements/scan-button.js +1 -1
  46. package/dist/elements/seek-bar.d.ts.map +1 -1
  47. package/dist/elements/seek-bar.js +5 -4
  48. package/dist/elements/seek-bar.js.map +1 -1
  49. package/dist/elements/shared.js +3 -3
  50. package/dist/elements/skip-button.js +2 -2
  51. package/dist/elements/skip-button.js.map +1 -1
  52. package/dist/elements/spinner.js +1 -1
  53. package/dist/elements/start-button.d.ts +8 -0
  54. package/dist/elements/start-button.d.ts.map +1 -1
  55. package/dist/elements/start-button.js +18 -2
  56. package/dist/elements/start-button.js.map +1 -1
  57. package/dist/elements/subtitles-menu.d.ts +5 -1
  58. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  59. package/dist/elements/subtitles-menu.js +29 -11
  60. package/dist/elements/subtitles-menu.js.map +1 -1
  61. package/dist/elements/title.d.ts.map +1 -1
  62. package/dist/elements/title.js +3 -1
  63. package/dist/elements/title.js.map +1 -1
  64. package/dist/elements/volume-slider.js +1 -1
  65. package/dist/elements/volume.js +1 -1
  66. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/asyncToGenerator.js +1 -1
  67. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.js +1 -1
  68. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectSpread2.js +1 -1
  69. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.js +1 -1
  70. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.js +1 -1
  71. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.js +1 -1
  72. package/dist/es2015/controls/chapters.js +1 -1
  73. package/dist/es2015/controls/cues.js +11 -5
  74. package/dist/es2015/controls/icons.js +38 -29
  75. package/dist/es2015/controls/menu.js +89 -17
  76. package/dist/es2015/element.js +144 -30
  77. package/dist/es2015/elements/audio-menu.js +4 -1
  78. package/dist/es2015/elements/component.js +10 -0
  79. package/dist/es2015/elements/control-bar.js +23 -7
  80. package/dist/es2015/elements/current-time.js +1 -1
  81. package/dist/es2015/elements/drm-badge.js +1 -1
  82. package/dist/es2015/elements/duration.js +6 -2
  83. package/dist/es2015/elements/error-screen.js +1 -1
  84. package/dist/es2015/elements/live-button.js +1 -1
  85. package/dist/es2015/elements/marker-button.js +19 -23
  86. package/dist/es2015/elements/menu-element.js +2 -1
  87. package/dist/es2015/elements/quality-menu.js +1 -1
  88. package/dist/es2015/elements/scan-button.js +1 -1
  89. package/dist/es2015/elements/seek-bar.js +5 -4
  90. package/dist/es2015/elements/shared.js +3 -3
  91. package/dist/es2015/elements/skip-button.js +2 -2
  92. package/dist/es2015/elements/spinner.js +1 -1
  93. package/dist/es2015/elements/start-button.js +18 -2
  94. package/dist/es2015/elements/subtitles-menu.js +35 -17
  95. package/dist/es2015/elements/title.js +3 -1
  96. package/dist/es2015/elements/volume-slider.js +1 -1
  97. package/dist/es2015/elements/volume.js +1 -1
  98. package/dist/es2015/presets.js +1 -1
  99. package/dist/es2015/style.js +1 -1
  100. package/dist/style.js +1 -1
  101. package/package.json +4 -5
  102. package/NOTICE +0 -24
@@ -1,37 +1,46 @@
1
1
  //#region src/controls/icons.ts
2
2
  /**
3
3
  * Each glyph's subpaths joined into one `d`. The path is drawn even-odd:
4
- * the gear, the note, the captions and the lock cut holes with a nested
5
- * subpath, and the rest have disjoint subpaths, where the rule is moot.
4
+ * a frame, a ring or a letter cuts its hole with a nested subpath, and no
5
+ * two filled subpaths overlap.
6
6
  */
7
7
  const PATHS = {
8
- play: "M10.667 6.655a.667.667 0 0 1 1.063-.536l12.647 9.344c.36.267.36.806 0 1.073L11.73 25.88a.667.667 0 0 1-1.063-.536z",
9
- pause: "M8.667 6.667A.667.667 0 0 0 8 7.333v17.334c0 .368.298.666.667.666h4a.667.667 0 0 0 .666-.666V7.333a.667.667 0 0 0-.666-.666zm10.666 0a.667.667 0 0 0-.666.666v17.334c0 .368.298.666.666.666h4a.667.667 0 0 0 .667-.666V7.333a.667.667 0 0 0-.667-.666z",
10
- replay: "M15.604 12.215a.667.667 0 0 0 1.063-.536v-1.5c0-.079.068-.14.146-.131a6.669 6.669 0 1 1-7.448 7.284c-.036-.367-.331-.666-.7-.666H6.667c-.369 0-.67.3-.645.667.343 5.212 4.68 9.334 9.978 9.334 5.523 0 10-4.478 10-10 0-5.257-4.056-9.566-9.208-9.97a.135.135 0 0 1-.125-.133V4.988a.667.667 0 0 0-1.063-.536l-4.527 3.345a.667.667 0 0 0 0 1.073z",
11
- mute: "M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.333v-6.667c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm11.352-11.018a.667.667 0 0 0 0-.943l-.943-.942a.667.667 0 0 0-.942 0l-2.264 2.263a.134.134 0 0 1-.188 0l-2.263-2.263a.667.667 0 0 0-.943 0l-.943.943a.667.667 0 0 0 0 .942l2.263 2.263a.133.133 0 0 1 0 .189l-2.262 2.262a.667.667 0 0 0 0 .943l.943.943c.26.26.682.26.942 0l2.263-2.262a.133.133 0 0 1 .188 0l2.263 2.262c.26.26.683.26.943 0l.943-.943a.667.667 0 0 0 0-.943l-2.263-2.262a.133.133 0 0 1 0-.189z",
12
- "volume-low": "M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.332v-6.666c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm5.332-11.993a.667.667 0 0 0-.666-.667h-1.334a.667.667 0 0 0-.666.667v6.666c0 .369.298.667.666.667h1.334a.667.667 0 0 0 .666-.667z",
13
- "volume-high": "M17.51 24.66a.667.667 0 0 1-1.064.536l-6.998-5.17a.13.13 0 0 0-.079-.027H4.667A.667.667 0 0 1 4 19.333v-6.667c0-.368.298-.667.667-.667H9.37q.044 0 .08-.026l6.995-5.17a.667.667 0 0 1 1.063.537zm10-15.327c.367 0 .666.299.666.667v12a.667.667 0 0 1-.667.667h-1.333a.667.667 0 0 1-.667-.667V10c0-.368.299-.667.667-.667zM22.175 12c.368 0 .666.299.666.667v6.666a.667.667 0 0 1-.666.667h-1.334a.667.667 0 0 1-.666-.667v-6.666c0-.368.298-.667.666-.667z",
14
- fullscreen: "M25.33 7.265a.667.667 0 0 0-.663-.598h-5.334a.667.667 0 0 0-.666.666v2c0 .369.298.667.666.667h2.534c.073 0 .133.06.133.133v2.534c0 .368.299.666.667.666h2a.667.667 0 0 0 .666-.666V7.333zM22 21.867c0 .073-.06.133-.133.133h-2.534a.667.667 0 0 0-.666.667v2c0 .368.298.666.666.666h5.334a.667.667 0 0 0 .666-.666v-5.334a.667.667 0 0 0-.666-.666h-2a.667.667 0 0 0-.667.666zM12.667 22h-2.534a.133.133 0 0 1-.133-.133v-2.534a.667.667 0 0 0-.667-.666h-2a.667.667 0 0 0-.666.666v5.334c0 .368.298.666.666.666h5.334a.667.667 0 0 0 .666-.666v-2a.667.667 0 0 0-.666-.667M10 12.667v-2.534c0-.073.06-.133.133-.133h2.534a.667.667 0 0 0 .666-.667v-2a.667.667 0 0 0-.666-.666H7.333a.667.667 0 0 0-.666.666v5.334c0 .368.298.666.666.666h2a.667.667 0 0 0 .667-.666",
15
- "fullscreen-exit": "M19.333 13.333a.667.667 0 0 1-.666-.666V7.333c0-.368.298-.666.666-.666h2c.369 0 .667.298.667.666v2.534c0 .073.06.133.133.133h2.534c.368 0 .666.299.666.667v2a.667.667 0 0 1-.666.666zm-6 6a.667.667 0 0 0-.666-.666H7.333a.667.667 0 0 0-.666.666v2c0 .369.298.667.666.667h2.534c.073 0 .133.06.133.133v2.534c0 .368.299.666.667.666h2a.667.667 0 0 0 .666-.666zm5.334 5.334c0 .368.298.666.666.666h2a.667.667 0 0 0 .667-.666v-2.534c0-.073.06-.133.133-.133h2.534a.667.667 0 0 0 .666-.667v-2a.667.667 0 0 0-.666-.666h-5.334a.667.667 0 0 0-.666.666zm-8-11.334h2a.667.667 0 0 0 .666-.666V7.333a.667.667 0 0 0-.666-.666h-2a.667.667 0 0 0-.667.666v2.534c0 .073-.06.133-.133.133H7.333a.667.667 0 0 0-.666.667v2c0 .368.298.666.666.666z",
16
- settings: "M13.572 5.333c-.33 0-.61.24-.659.566l-.507 3.32a.13.13 0 0 1-.068.098q-.15.08-.294.17a.14.14 0 0 1-.119.01l-3.13-1.22a.67.67 0 0 0-.819.288L5.55 12.769a.67.67 0 0 0 .16.853l2.624 2.1a.14.14 0 0 1 .05.109 8 8 0 0 0 0 .337.14.14 0 0 1-.05.108L5.71 18.379a.67.67 0 0 0-.16.853l2.427 4.204a.67.67 0 0 0 .82.288l3.129-1.221a.14.14 0 0 1 .119.01q.144.088.293.17c.037.02.062.056.068.097l.507 3.32c.05.326.33.566.66.566h4.853c.33 0 .61-.24.66-.566l.507-3.319a.14.14 0 0 1 .069-.098q.15-.08.294-.17a.14.14 0 0 1 .12-.01l3.127 1.22a.67.67 0 0 0 .82-.287l2.427-4.204a.67.67 0 0 0-.16-.854l-2.622-2.1a.14.14 0 0 1-.05-.108 7 7 0 0 0 0-.338.14.14 0 0 1 .05-.109l2.622-2.099a.67.67 0 0 0 .161-.854l-2.427-4.204a.67.67 0 0 0-.82-.287l-3.128 1.22a.14.14 0 0 1-.12-.011 8 8 0 0 0-.294-.171.14.14 0 0 1-.069-.098L19.085 5.9a.67.67 0 0 0-.659-.566zM16 20.285a4.286 4.286 0 1 0 0-8.572 4.286 4.286 0 0 0 0 8.572",
17
- music: "M26.667 6A.667.667 0 0 0 26 5.333H11.333a.667.667 0 0 0-.666.667v11.571a.138.138 0 0 1-.193.125A4.667 4.667 0 1 0 13.334 22V8.667c0-.369.298-.667.666-.667h9.333c.369 0 .667.298.667.667v6.238a.138.138 0 0 1-.192.125 4.667 4.667 0 1 0 2.86 4.304zM22 21.333a2 2 0 1 0 0-4 2 2 0 0 0 0 4M8.667 24a2 2 0 1 0 0-4 2 2 0 0 0 0 4",
18
- "closed-captions": "M4.666 6.667A.667.667 0 0 0 4 7.334v17.333c0 .368.299.667.667.667h22.667a.667.667 0 0 0 .666-.667V7.334a.667.667 0 0 0-.666-.667zm4 14.666A.667.667 0 0 1 8 20.667v-9.334c0-.368.298-.666.667-.666H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666zm9.334 0a.667.667 0 0 1-.667-.666v-9.334c0-.368.299-.666.667-.666h5.333c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134h3.2c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666z",
19
- "closed-captions-on": "M8 28c0-.368.298-.666.667-.666h14.666c.369 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666H8.667A.667.667 0 0 1 8 29.334zM4.666 6.667a.667.667 0 0 0-.667.667v17.333c0 .368.299.667.667.667h22.667a.667.667 0 0 0 .666-.667V7.334a.667.667 0 0 0-.666-.667zm4 14.666A.667.667 0 0 1 8 20.667v-9.334c0-.368.298-.666.667-.666H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134H14c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666zm9.334 0a.667.667 0 0 1-.667-.666v-9.334c0-.368.299-.666.667-.666h5.333c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666h-3.2a.133.133 0 0 0-.133.134v5.066c0 .074.06.134.133.134h3.2c.368 0 .667.298.667.666v1.334a.667.667 0 0 1-.667.666z",
20
- "lock-closed": "M16 4a6.667 6.667 0 0 1 6.665 6.533.136.136 0 0 0 .135.134h1.867c.368 0 .666.298.666.666V26a.667.667 0 0 1-.666.667H7.333A.667.667 0 0 1 6.667 26V11.333c0-.368.298-.666.666-.666H9.2c.074 0 .133-.06.135-.134A6.667 6.667 0 0 1 16 4m-3.998 6.533a.13.13 0 0 0 .131.134h7.734a.13.13 0 0 0 .13-.134 4 4 0 0 0-7.995 0M9.333 14c0-.368.299-.667.667-.667h12c.368 0 .667.299.667.667v9.333A.667.667 0 0 1 22 24H10a.667.667 0 0 1-.667-.667z",
21
- "seek-backward": "M15.604 12.215a.667.667 0 0 0 1.063-.536v-1.5c0-.079.068-.14.146-.131a6.669 6.669 0 1 1-7.448 7.284c-.036-.367-.331-.666-.7-.666H6.667c-.369 0-.67.3-.645.667.343 5.212 4.68 9.334 9.978 9.334 5.523 0 10-4.478 10-10 0-5.257-4.056-9.566-9.208-9.97a.135.135 0 0 1-.125-.133V4.988a.667.667 0 0 0-1.063-.536l-4.527 3.345a.667.667 0 0 0 0 1.073z",
22
- "seek-forward": "M16.417 12.215a.667.667 0 0 1-1.063-.536v-1.5a.13.13 0 0 0-.147-.131 6.668 6.668 0 1 0 7.448 7.284c.037-.367.332-.666.7-.666h1.999c.368 0 .669.3.645.667-.343 5.212-4.68 9.334-9.978 9.334-5.523 0-10-4.478-10-10 0-5.257 4.055-9.566 9.208-9.97a.135.135 0 0 0 .125-.133V4.988a.667.667 0 0 1 1.063-.536l4.527 3.345c.36.267.36.806 0 1.073z",
23
- "seek-backward-10": "M16.667 10.345a.667.667 0 0 1-1.063.536l-4.527-3.345a.667.667 0 0 1 0-1.072l4.527-3.345a.667.667 0 0 1 1.063.536v1.572c0 .07.055.129.126.134 5.89.407 10.54 5.313 10.54 11.306C27.333 22.926 22.26 28 16 28 9.965 28 5.031 23.283 4.686 17.334a.64.64 0 0 1 .647-.667h2c.369 0 .664.3.694.667a8 8 0 1 0 8.784-8.627.132.132 0 0 0-.144.132zm.42 9.334q.552.36 1.313.36.765 0 1.313-.357.55-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02Q19.163 14 18.4 14q-.761 0-1.312.352-.549.35-.847 1.02-.295.668-.298 1.625t.295 1.64q.3.678.85 1.042m2.05-1.253q-.282.463-.737.463a.78.78 0 0 1-.53-.204q-.231-.208-.359-.628-.125-.42-.122-1.06.003-.943.281-1.397.28-.458.73-.458.304 0 .532.202.227.201.355.613.128.41.128 1.04.003.963-.279 1.43m-5.362 1.472c.073 0 .133-.06.133-.134v-5.551a.133.133 0 0 0-.133-.133h-1.133a.13.13 0 0 0-.07.02l-1.34.832a.13.13 0 0 0-.063.114v.904c0 .104.114.168.203.114l1.092-.668a.027.027 0 0 1 .04.023v4.345c0 .074.06.134.134.134z",
24
- "seek-forward-10": "M15.333 10.345c0 .547.623.862 1.063.536l4.527-3.345a.667.667 0 0 0 0-1.072l-4.527-3.345a.667.667 0 0 0-1.063.536v1.572c0 .07-.055.129-.126.134-5.89.407-10.54 5.313-10.54 11.306C4.667 22.926 9.74 28 16 28c6.035 0 10.969-4.717 11.314-10.666a.64.64 0 0 0-.647-.667h-2c-.369 0-.664.3-.694.667a8 8 0 1 1-8.784-8.627.132.132 0 0 1 .144.132zm1.755 9.334q.551.36 1.312.36.765 0 1.313-.357.55-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02Q19.163 14 18.4 14q-.761 0-1.312.352-.549.35-.847 1.02-.295.668-.298 1.625t.295 1.64q.3.678.85 1.042m2.048-1.253q-.281.463-.736.463a.78.78 0 0 1-.53-.204q-.231-.208-.359-.628-.125-.42-.122-1.06.003-.943.281-1.397.28-.458.73-.458.304 0 .532.202.227.201.355.613.128.41.128 1.04.003.963-.279 1.43m-5.361 1.472c.073 0 .133-.06.133-.134v-5.551a.133.133 0 0 0-.133-.133h-1.133a.13.13 0 0 0-.07.02l-1.34.832a.13.13 0 0 0-.063.114v.904c0 .104.114.168.203.114l1.092-.668a.027.027 0 0 1 .04.023v4.345c0 .074.06.134.134.134z",
25
- "seek-backward-30": "M16.667 10.345a.667.667 0 0 1-1.063.536l-4.527-3.345a.667.667 0 0 1 0-1.072l4.527-3.345a.667.667 0 0 1 1.063.536v1.572c0 .07.055.129.126.134 5.89.407 10.54 5.313 10.54 11.306C27.333 22.926 22.26 28 16 28 9.965 28 5.031 23.283 4.686 17.334a.64.64 0 0 1 .647-.667h2c.369 0 .664.3.694.667a8 8 0 1 0 8.784-8.627.132.132 0 0 0-.144.132zm-5.083 9.405a2.9 2.9 0 0 0 1.18.227q.681 0 1.207-.221.528-.225.824-.614.298-.391.298-.898a1.23 1.23 0 0 0-.344-.895q-.337-.351-.997-.434a.026.026 0 0 1-.023-.026q.002-.021.023-.026.49-.078.804-.389.324-.318.321-.81 0-.474-.264-.849a1.8 1.8 0 0 0-.739-.596 2.6 2.6 0 0 0-1.1-.219q-.626 0-1.118.225-.49.225-.773.622a1.53 1.53 0 0 0-.284.78.126.126 0 0 0 .129.134h1.08c.071 0 .129-.058.145-.128a.6.6 0 0 1 .1-.221.7.7 0 0 1 .299-.233q.19-.082.423-.082.221 0 .39.082a.62.62 0 0 1 .357.577.6.6 0 0 1-.108.358.7.7 0 0 1-.31.238q-.196.085-.454.085h-.432a.133.133 0 0 0-.133.134v.733c0 .074.06.134.133.134h.432q.295 0 .511.088a.77.77 0 0 1 .338.247q.12.159.117.363a.6.6 0 0 1-.105.364.74.74 0 0 1-.301.247 1 1 0 0 1-.44.088q-.251 0-.447-.082a.76.76 0 0 1-.31-.227.6.6 0 0 1-.103-.212c-.018-.07-.075-.127-.146-.127H10.61a.126.126 0 0 0-.128.135q.037.444.295.794.296.404.806.634m6.196-.071q.552.36 1.313.36.765 0 1.312-.357.551-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02-.55-.352-1.311-.352t-1.313.352q-.548.35-.847 1.02-.295.668-.298 1.625t.296 1.64q.298.678.85 1.042m2.048-1.253q-.28.463-.735.463a.78.78 0 0 1-.532-.204q-.23-.208-.358-.628-.125-.42-.122-1.06.003-.943.282-1.397.277-.458.73-.458.304 0 .53.202.227.201.356.613.128.41.128 1.04.003.963-.279 1.43",
26
- "seek-forward-30": "M15.333 10.345c0 .547.623.862 1.063.536l4.528-3.345a.667.667 0 0 0 0-1.072l-4.528-3.345a.667.667 0 0 0-1.063.536v1.572c0 .07-.055.129-.126.134-5.89.407-10.54 5.313-10.54 11.306C4.667 22.926 9.74 28 16 28c6.035 0 10.969-4.717 11.314-10.666a.64.64 0 0 0-.647-.667h-2c-.369 0-.664.3-.694.667a8 8 0 1 1-8.784-8.627.132.132 0 0 1 .144.132zm-3.748 9.405a2.9 2.9 0 0 0 1.178.227q.682 0 1.208-.221.528-.225.824-.614.298-.391.298-.898a1.23 1.23 0 0 0-.344-.895q-.337-.351-.997-.434a.026.026 0 0 1-.023-.026q.002-.021.023-.026.49-.078.804-.389.324-.318.321-.81 0-.474-.264-.849a1.8 1.8 0 0 0-.739-.596 2.6 2.6 0 0 0-1.1-.219q-.626 0-1.118.225-.49.225-.773.622a1.53 1.53 0 0 0-.284.78.126.126 0 0 0 .129.134h1.08c.071 0 .129-.058.145-.128a.6.6 0 0 1 .1-.221.7.7 0 0 1 .299-.233q.19-.082.423-.082.221 0 .39.082a.62.62 0 0 1 .357.577.6.6 0 0 1-.108.358.7.7 0 0 1-.31.238q-.196.085-.454.085h-.432a.133.133 0 0 0-.133.134v.733c0 .074.06.134.133.134h.432q.295 0 .511.088a.77.77 0 0 1 .338.247q.12.159.117.363a.6.6 0 0 1-.105.364.74.74 0 0 1-.301.247 1 1 0 0 1-.44.088q-.251 0-.447-.082a.76.76 0 0 1-.31-.227.6.6 0 0 1-.103-.212c-.018-.07-.075-.127-.146-.127H10.61a.126.126 0 0 0-.128.135q.037.444.295.794.296.404.806.634m6.195-.071q.552.36 1.313.36.765 0 1.312-.357.551-.36.85-1.043.297-.681.298-1.642.003-.954-.296-1.625-.299-.67-.852-1.02-.549-.352-1.31-.352t-1.313.352q-.548.35-.847 1.02-.295.668-.298 1.625t.296 1.64q.298.678.85 1.042m2.048-1.253q-.28.463-.735.463a.78.78 0 0 1-.532-.204q-.23-.208-.358-.628-.125-.42-.122-1.06.003-.943.282-1.397.277-.458.73-.458.304 0 .53.202.227.201.356.613.128.41.128 1.04.003.963-.279 1.43",
27
- "playback-speed": "M13.921 5.536c.394-.078.746.234.746.635v1.401c0 .326-.236.6-.553.677a8 8 0 0 0-3.905 2.257.71.71 0 0 1-.862.14l-1.206-.697c-.347-.2-.441-.661-.177-.963a10.66 10.66 0 0 1 5.957-3.45M5.89 12.59c.128-.38.575-.53.923-.33l1.199.693a.71.71 0 0 1 .31.816A8 8 0 0 0 8 16.026c0 .783.113 1.54.322 2.255a.71.71 0 0 1-.31.817l-1.185.684c-.346.2-.792.052-.922-.327A10.7 10.7 0 0 1 5.333 16c0-1.192.196-2.339.557-3.41m2.281 9.494c-.348.201-.442.664-.176.965a10.66 10.66 0 0 0 5.926 3.414c.394.078.746-.234.746-.635v-1.35c0-.325-.236-.6-.553-.677a8 8 0 0 1-3.905-2.257.71.71 0 0 0-.862-.139zm9.162 3.744c0 .401.353.713.746.635 4.896-.967 8.588-5.284 8.588-10.464s-3.692-9.497-8.588-10.464c-.393-.078-.746.234-.746.635v1.401c0 .326.237.6.553.677a8.003 8.003 0 0 1 0 15.553.71.71 0 0 0-.553.677zm-2.937-15.413a.667.667 0 0 0-1.063.537v10.094c0 .548.623.862 1.063.537l6.831-5.048a.667.667 0 0 0 0-1.073z",
28
- "picture-in-picture": "M16 15.333a.667.667 0 0 0-.667.667v4c0 .368.299.667.667.667h5.333A.667.667 0 0 0 22 20v-4a.667.667 0 0 0-.667-.667zm-10.667-8c0-.368.299-.666.667-.666h20c.368 0 .667.298.667.666v17.334a.667.667 0 0 1-.667.666H6a.667.667 0 0 1-.667-.666zM8 10c0-.368.298-.667.667-.667h14.666c.369 0 .667.299.667.667v12a.667.667 0 0 1-.667.667H8.667A.667.667 0 0 1 8 22z",
29
- "picture-in-picture-exit": "M5.333 26v-6.533c0-.074.06-.134.134-.134h2.4c.073 0 .133.06.133.134v3.866c0 .369.298.667.667.667h14.666a.667.667 0 0 0 .667-.667V8.667A.667.667 0 0 0 23.333 8h-3.866a.133.133 0 0 1-.134-.133v-2.4c0-.074.06-.134.134-.134H26c.368 0 .667.299.667.667v20a.667.667 0 0 1-.667.667H6A.667.667 0 0 1 5.333 26M14.01 8.424h-3.204a.133.133 0 0 0-.094.227l5.837 5.838c.26.26.26.682 0 .942l-1.226 1.226a.667.667 0 0 1-.942 0l-5.744-5.743a.133.133 0 0 0-.227.094v3.016a.667.667 0 0 1-.667.666H6.01a.667.667 0 0 1-.667-.666v-8c0-.369.299-.667.667-.667h8c.368 0 .666.298.666.667v1.733a.667.667 0 0 1-.666.667",
30
- airplay: "M5.333 6c0-.368.299-.667.667-.667h20c.368 0 .667.299.667.667v14.667a.667.667 0 0 1-.667.666h-2.293c-.211 0-.41-.1-.536-.27l-.985-1.333a.667.667 0 0 1 .536-1.063h.611A.667.667 0 0 0 24 18V8.667A.667.667 0 0 0 23.333 8H8.667A.667.667 0 0 0 8 8.667V18c0 .368.298.667.667.667h.627c.547 0 .86.622.536 1.063l-.985 1.333a.67.67 0 0 1-.537.27H6a.667.667 0 0 1-.667-.666zm3.452 19.604a.667.667 0 0 0 .536 1.063H22.68a.667.667 0 0 0 .536-1.063l-6.68-9.039a.667.667 0 0 0-1.072 0z",
31
- "airplay-active": "M5.333 6c0-.368.299-.667.667-.667h20c.368 0 .667.299.667.667v14.667a.667.667 0 0 1-.667.666H6a.667.667 0 0 1-.667-.666zm3.452 19.604a.667.667 0 0 0 .536 1.063H22.68a.667.667 0 0 0 .536-1.063l-6.68-9.039a.667.667 0 0 0-1.072 0z",
32
- chapters: "M16.693 25.335a.667.667 0 0 1-.667-.667V7.335c0-.369.299-.667.667-.667h2c.368 0 .666.298.666.667v17.333a.667.667 0 0 1-.666.667zm7.333 0a.667.667 0 0 1-.667-.667V7.335c0-.369.299-.667.667-.667h2c.368 0 .667.298.667.667v17.333a.667.667 0 0 1-.667.667zM5.481 23.94a.667.667 0 0 0 .472.816l1.931.518a.667.667 0 0 0 .817-.472L13.187 8.06a.667.667 0 0 0-.471-.817l-1.932-.517a.667.667 0 0 0-.817.47z",
33
- "fast-forward": "M16.125 8.119a.667.667 0 0 0-1.062.536v5.603a.134.134 0 0 1-.213.107L6.396 8.119a.667.667 0 0 0-1.063.536v14.69c0 .547.623.861 1.063.536l8.454-6.246a.133.133 0 0 1 .213.107v5.603c0 .547.622.861 1.062.536l9.941-7.345a.667.667 0 0 0 0-1.073z",
34
- "fast-backward": "M15.875 8.119a.667.667 0 0 1 1.063.536v5.603c0 .109.124.172.212.107l8.454-6.246a.667.667 0 0 1 1.063.536v14.69a.667.667 0 0 1-1.063.536l-8.454-6.246a.133.133 0 0 0-.212.107v5.603a.667.667 0 0 1-1.063.536l-9.941-7.345a.667.667 0 0 1 0-1.073z"
8
+ play: "M9 5L26 16L9 27z",
9
+ pause: "M8 6h5.5v20h-5.5zM18.5 6h5.5v20h-5.5z",
10
+ replay: "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z",
11
+ mute: "M4 12L9 12L16 6L16 26L9 20L4 20zM24 17.77L20.99 20.77L19.23 19.01L22.23 16L19.23 12.99L20.99 11.23L24 14.23L27.01 11.23L28.77 12.99L25.77 16L28.77 19.01L27.01 20.77z",
12
+ "volume-low": "M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64z",
13
+ "volume-high": "M4 12L9 12L16 6L16 26L9 20L4 20zM21.13 10.87A7.25 7.25 0 0 1 21.13 21.13L19.36 19.36A4.75 4.75 0 0 0 19.36 12.64zM24.31 7.69A11.75 11.75 0 0 1 24.31 24.31L22.54 22.54A9.25 9.25 0 0 0 22.54 9.46z",
14
+ fullscreen: "M5 5L14 5L11 8L8 8L8 11L5 14zM18 5L27 5L27 14L24 11L24 8L21 8zM5 18L8 21L8 24L11 24L14 27L5 27zM27 18L27 27L18 27L21 24L24 24L24 21z",
15
+ "fullscreen-exit": "M13 4L13 13L4 13L7 10L10 10L10 7zM19 4L22 7L22 10L25 10L28 13L19 13zM4 19L13 19L13 28L10 25L10 22L7 22zM19 19L28 19L25 22L22 22L22 25L19 28z",
16
+ quality: "M5 22L10 18.1L10 27L5 27zM13.5 15.4L18.5 11.6L18.5 27L13.5 27zM22 8.9L27 5L27 27L22 27z",
17
+ audio: "M4.75 13h2.5v6h-2.5zM9.75 9h2.5v14h-2.5zM14.75 5h2.5v22h-2.5zM19.75 10.5h2.5v11h-2.5zM24.75 13.5h2.5v5h-2.5z",
18
+ subtitles: "M4 6h20l4 4v16H4zM6.5 8.5H22.96L25.5 11.04V23.5H6.5zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z",
19
+ "subtitles-on": "M4 6h20l4 4v16H4zM9 14h8v2.5h-8zM19 14h4v2.5h-4zM9 18.5h4v2.5h-4zM15 18.5h8v2.5h-8z",
20
+ "lock-closed": "M7 14h18v13H7zM14.75 18.5v4.5h2.5v-4.5zM9.75 14V11A6.25 6.25 0 0 1 22.25 11V14H19.75V11A3.75 3.75 0 0 0 12.25 11V14z",
21
+ "seek-backward": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8z",
22
+ "seek-forward": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5z",
23
+ "seek-backward-5": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z",
24
+ "seek-forward-5": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h6v2h-6zM13 15.5h2v0.5h-2zM13 16h6v2h-6zM17 18h2v0.5h-2zM13 18.5h6v2h-6z",
25
+ "seek-backward-10": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z",
26
+ "seek-forward-10": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM11.5 13.5h2.2v7h-2.2zM15.5 13.5h5.5v7h-5.5zM17.6 15.6v2.8h1.3v-2.8z",
27
+ "seek-backward-15": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z",
28
+ "seek-forward-15": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM10.5 13.5h2.2v7h-2.2zM14.7 13.5h5.8v2h-5.8zM14.7 15.5h2v0.5h-2zM14.7 16h5.8v2h-5.8zM18.5 18h2v0.5h-2zM14.7 18.5h5.8v2h-5.8z",
29
+ "seek-backward-30": "M16 6.75A10.25 10.25 0 1 1 7.12 11.88L9.29 13.12A7.75 7.75 0 1 0 16 9.25zM16 3.5L16 12.5L10 8zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z",
30
+ "seek-forward-30": "M24.88 11.88A10.25 10.25 0 1 1 16 6.75L16 9.25A7.75 7.75 0 1 0 22.71 13.12zM16 3.5L22 8L16 12.5zM13 13.5h2v7h-2zM10 13.5h3v2h-3zM11 16h2v2h-2zM10 18.5h3v2h-3zM16.5 13.5h5.5v7h-5.5zM18.6 15.6v2.8h1.3v-2.8z",
31
+ "playback-speed": "M7.69 26.31A11.75 11.75 0 1 1 24.31 26.31L22.54 24.54A9.25 9.25 0 1 0 9.46 24.54zM16.41 20.31L21.14 11.87L13.66 17.99z",
32
+ "picture-in-picture": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM15 15h8v6h-8z",
33
+ "picture-in-picture-exit": "M4 6h24v20H4zM6.5 8.5v15h19v-15zM9.5 11.5L16 11.5L9.5 18zM13.63 13.87L19.29 19.52L17.52 21.29L11.87 15.63z",
34
+ airplay: "M4 6H28V23.25H23V20.75H25.5V8.5H6.5V20.75H9V23.25H4zM16 17.5L23.5 27L8.5 27z",
35
+ "airplay-active": "M4 6H28V23.25H22.1L16 15.5L9.9 23.25H4zM16 17.5L23.5 27L8.5 27z",
36
+ chapters: "M5 6.5h4v4h-4zM12 7.25h15v2.5h-15zM5 14h4v4h-4zM12 14.75h15v2.5h-15zM5 21.5h4v4h-4zM12 22.25h15v2.5h-15z",
37
+ "fast-forward": "M4 7L15 16L4 25zM16 7L27 16L16 25z",
38
+ "fast-backward": "M28 7L17 16L28 25zM16 7L5 16L16 25z",
39
+ "audio-description": "M1.5 23L4.8 9h2.6L10.7 23H8.4l-.75-3.2H4.55L3.8 23zM5.1 17.4h2L6.1 12.9zM12.2 9h2.8a7 7 0 0 1 0 14h-2.8zM14.6 11.4v9.2h.4a4.6 4.6 0 0 0 0-9.2zM24.2 9.96A9.4 9.4 0 0 1 24.2 22.04L22.82 20.89A7.6 7.6 0 0 0 22.82 11.11zM27.11 7.52A13.2 13.2 0 0 1 27.11 24.48L25.73 23.33A11.4 11.4 0 0 0 25.73 8.67z",
40
+ sdh: "M9.7 13.2L10.3 10.4L11.6 8.5L13.6 7.2L16 6.8L18.7 7.3L20.8 8.6L22.2 10.6L22.7 13L22.5 14.9L21.8 16.3L20.8 17.5L19.6 18.7L18.5 19.9L17.9 21.3L17.5 22.5L17.1 23.5L16.7 24.5L16 25.2L15.2 25.6L14.3 25.7L13.3 25.6L12.6 25.1L12 24.4L11.7 23.4L9.3 24.2L9.8 25.7L10.9 27L12.5 27.9L14.3 28.3L16 28L17.6 27.2L18.7 26L19.5 24.5L19.8 23.3L20.2 22.2L20.6 21.3L21.4 20.3L22.6 19.2L23.9 17.7L24.9 15.7L25.3 13L24.6 9.5L22.6 6.7L19.6 4.9L16 4.2L12.7 4.9L9.9 6.6L7.9 9.4L7.3 12.8zM13.7 13.2L13.9 12.1L14.4 11.4L15.1 10.9L16 10.8L16.9 10.9L17.6 11.4L18.1 12.1L18.3 13.2L20.7 12.8L20.4 11.1L19.4 9.6L17.9 8.6L16 8.2L14.1 8.6L12.6 9.6L11.6 11.1L11.3 12.8z",
41
+ "closed-captions": "M14.24 20.24A6 6 0 1 1 14.24 11.76L12.47 13.53A3.5 3.5 0 1 0 12.47 18.47zM26.24 20.24A6 6 0 1 1 26.24 11.76L24.47 13.53A3.5 3.5 0 1 0 24.47 18.47z",
42
+ "text-size": "M2.5 23L5.9 13L8.1 13L11.5 23zM7 16.53L7.64 18.4L6.36 18.4zM5.65 20.5L8.35 20.5L9.2 23L4.8 23zM12.5 23L19.5 6L22.5 6L29.5 23zM21 9.64L23.45 15.6L18.55 15.6zM17.48 18.2L24.52 18.2L26.5 23L15.5 23z",
43
+ "text-background": "M4 6h24v20h-24zM9 22.5L14.6 9.5L17.4 9.5L23 22.5zM16 12.75L17.66 16.6L14.34 16.6zM13.35 18.9L18.65 18.9L20.2 22.5L11.8 22.5z"
35
44
  };
36
45
  const SVG = "http://www.w3.org/2000/svg";
37
46
  /** A glyph, hidden from the accessibility tree: the button it sits in carries the name. */
@@ -1,5 +1,5 @@
1
1
  import { el, setChildren, state } from "../dom.js";
2
- import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
3
3
  //#region src/controls/menu.ts
4
4
  /**
5
5
  * The menu primitive the quality, audio, subtitles and speed menus share: a
@@ -26,11 +26,11 @@ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/es
26
26
  /** Air between the popup's top and the picture's. */
27
27
  const AIR = 8;
28
28
  /**
29
- * The tallest a popup grows, in pixels: about seven and a half rows, so
29
+ * The tallest a popup grows, in pixels: the title and about seven and a half rows, so
30
30
  * the half row at the foot says the list goes on. A page sets its own
31
31
  * with `--mbx-menu-max-height`.
32
32
  */
33
- const MAX_HEIGHT = 264;
33
+ const MAX_HEIGHT = 22;
34
34
  /** An item's picture. Decorative: the item's text names it. Loaded when the popup first shows it. */
35
35
  function picture(url) {
36
36
  const node = el("img", "item-image");
@@ -50,12 +50,31 @@ function menu(options) {
50
50
  button.setAttribute("aria-haspopup", "menu");
51
51
  button.setAttribute("aria-expanded", "false");
52
52
  const popup = el("div", "popup");
53
- popup.addEventListener("scroll", () => {
54
- more();
55
- });
56
53
  popup.setAttribute("role", "menu");
57
54
  popup.hidden = true;
55
+ const backdrop = el("div", "backdrop");
56
+ backdrop.hidden = true;
57
+ backdrop.addEventListener("click", () => {
58
+ close();
59
+ });
58
60
  let open = false;
61
+ /**
62
+ * While the menu is open it follows its player: a change of tier draws
63
+ * the page again, as a popup or as a sheet, and a change of size places
64
+ * it again. A page that resizes with a menu open sees it keep up.
65
+ */
66
+ const tiers = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
67
+ var _ref, _checked;
68
+ if (!open) return;
69
+ const held = popup.contains(focused());
70
+ render();
71
+ if (held) (_ref = (_checked = checked()) !== null && _checked !== void 0 ? _checked : items()[0]) === null || _ref === void 0 || _ref.focus();
72
+ });
73
+ const sizes = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
74
+ if (open) fit();
75
+ });
76
+ /** Whether the page drawn last was drawn for a compact player. */
77
+ let drawnCompact = false;
59
78
  let name = "";
60
79
  let first = [];
61
80
  /** The pages opened, the first being the menu itself. */
@@ -80,19 +99,31 @@ function menu(options) {
80
99
  * left of its right edge.
81
100
  */
82
101
  function fit() {
83
- const picture = options.picture();
102
+ var _options$frame$getBou, _options$frame;
103
+ const compact = host.getAttribute("layout") === "compact";
104
+ const picture = compact ? (_options$frame$getBou = (_options$frame = options.frame()) === null || _options$frame === void 0 ? void 0 : _options$frame.getBoundingClientRect()) !== null && _options$frame$getBou !== void 0 ? _options$frame$getBou : null : options.picture();
105
+ backdrop.hidden = !(open && compact && picture !== null);
106
+ for (const node of [popup, backdrop]) node.style.left = node.style.bottom = node.style.width = "";
107
+ backdrop.style.height = "";
84
108
  if (picture === null) return;
109
+ if (compact) {
110
+ const box = host.getBoundingClientRect();
111
+ for (const node of [popup, backdrop]) {
112
+ node.style.left = `${picture.left - box.left}px`;
113
+ node.style.bottom = `${box.bottom - picture.bottom}px`;
114
+ node.style.width = `${picture.width}px`;
115
+ }
116
+ backdrop.style.height = `${picture.height}px`;
117
+ popup.style.maxHeight = `${Math.max(0, Math.floor(picture.height - AIR))}px`;
118
+ popup.style.maxWidth = "";
119
+ return;
120
+ }
85
121
  const room = button.getBoundingClientRect().top - picture.top - AIR;
86
- const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT;
122
+ const most = Number.parseFloat(getComputedStyle(host).getPropertyValue("--mbx-menu-max-height")) || MAX_HEIGHT * (Number.parseFloat(getComputedStyle(host).fontSize) || 16);
87
123
  popup.style.maxHeight = `${Math.max(0, Math.floor(Math.min(most, room)))}px`;
88
- more();
89
124
  const wide = host.getBoundingClientRect().right - picture.left - AIR;
90
125
  popup.style.maxWidth = `${Math.max(0, Math.floor(wide))}px`;
91
126
  }
92
- /** `more` on the popup while rows wait below its foot, which then fades out. */
93
- function more() {
94
- popup.toggleAttribute("more", popup.scrollTop + popup.clientHeight < popup.scrollHeight - 1);
95
- }
96
127
  function clear() {
97
128
  for (const item of items()) {
98
129
  const handler = handlers.get(item);
@@ -114,6 +145,20 @@ function menu(options) {
114
145
  const page = stack[stack.length - 1];
115
146
  if (page === void 0) return;
116
147
  let tab = true;
148
+ drawnCompact = host.getAttribute("layout") === "compact";
149
+ if (stack.length === 1 && name !== "" && drawnCompact) {
150
+ const leave = item("item back-item", name, () => {
151
+ close();
152
+ button.focus();
153
+ });
154
+ leave.setAttribute("role", "menuitem");
155
+ leave.setAttribute("aria-label", options.back(name));
156
+ popup.append(leave);
157
+ } else if (stack.length === 1 && name !== "") {
158
+ const title = el("div", "title", name);
159
+ title.setAttribute("aria-hidden", "true");
160
+ popup.append(title);
161
+ }
117
162
  if (stack.length > 1) {
118
163
  const back = item("item back-item", page.label, () => {
119
164
  var _items$;
@@ -135,6 +180,11 @@ function menu(options) {
135
180
  });
136
181
  link.setAttribute("role", "menuitem");
137
182
  link.setAttribute("aria-haspopup", "menu");
183
+ if (entry.glyph !== void 0) {
184
+ link.prepend(entry.glyph());
185
+ state(link, `item page-item ${entry.name}-item`, { "glyph-item": true });
186
+ }
187
+ if (entry.detail !== void 0) link.append(el("span", "item-detail", entry.detail));
138
188
  popup.append(link);
139
189
  continue;
140
190
  }
@@ -142,7 +192,7 @@ function menu(options) {
142
192
  section.setAttribute("role", "group");
143
193
  if (entry.label !== void 0) {
144
194
  section.setAttribute("aria-label", entry.label);
145
- section.append(el("div", `section-label ${entry.name}-label`, entry.label));
195
+ if (entry.hideLabel !== true) section.append(el("div", `section-label ${entry.name}-label`, entry.label));
146
196
  }
147
197
  for (const [id, text, detail, image, badges] of entry.items) {
148
198
  const choice = item(`item ${entry.name}-item`, text, () => {
@@ -150,7 +200,18 @@ function menu(options) {
150
200
  button.focus();
151
201
  entry.onSelect(id);
152
202
  });
153
- for (const badge of badges !== null && badges !== void 0 ? badges : []) choice.append(el("span", "item-badge", badge));
203
+ for (const badge of badges !== null && badges !== void 0 ? badges : []) {
204
+ var _entry$badgeGlyphs;
205
+ const glyph = (_entry$badgeGlyphs = entry.badgeGlyphs) === null || _entry$badgeGlyphs === void 0 ? void 0 : _entry$badgeGlyphs[badge];
206
+ if (glyph === void 0) {
207
+ choice.append(el("span", "item-badge", badge));
208
+ continue;
209
+ }
210
+ const drawn = el("span", "item-badge item-glyph");
211
+ drawn.title = badge;
212
+ drawn.append(glyph(), el("span", "badge-text", badge));
213
+ choice.append(drawn);
214
+ }
154
215
  if (detail !== void 0) choice.append(el("span", "item-detail", detail));
155
216
  if (image !== void 0) {
156
217
  const [, ...rest] = choice.childNodes;
@@ -175,7 +236,10 @@ function menu(options) {
175
236
  function close() {
176
237
  if (!open) return;
177
238
  open = false;
239
+ tiers === null || tiers === void 0 || tiers.disconnect();
240
+ sizes === null || sizes === void 0 || sizes.disconnect();
178
241
  popup.hidden = true;
242
+ backdrop.hidden = true;
179
243
  button.setAttribute("aria-expanded", "false");
180
244
  host.removeAttribute("open");
181
245
  document.removeEventListener("pointerdown", outside, true);
@@ -185,15 +249,22 @@ function menu(options) {
185
249
  }
186
250
  }
187
251
  function show() {
188
- var _ref, _checked;
252
+ var _ref2, _checked2;
189
253
  if (open) return;
190
254
  open = true;
255
+ if (host.getAttribute("layout") === "compact" !== drawnCompact) render();
191
256
  popup.hidden = false;
192
257
  button.setAttribute("aria-expanded", "true");
193
258
  host.setAttribute("open", "");
194
259
  document.addEventListener("pointerdown", outside, true);
260
+ tiers === null || tiers === void 0 || tiers.observe(host, {
261
+ attributes: true,
262
+ attributeFilter: ["layout"]
263
+ });
264
+ const frame = options.frame();
265
+ if (frame !== null) sizes === null || sizes === void 0 || sizes.observe(frame);
195
266
  fit();
196
- (_ref = (_checked = checked()) !== null && _checked !== void 0 ? _checked : items()[0]) === null || _ref === void 0 || _ref.focus();
267
+ (_ref2 = (_checked2 = checked()) !== null && _checked2 !== void 0 ? _checked2 : items()[0]) === null || _ref2 === void 0 || _ref2.focus();
197
268
  }
198
269
  function toggle() {
199
270
  if (open) close();
@@ -240,6 +311,7 @@ function menu(options) {
240
311
  return {
241
312
  button,
242
313
  popup,
314
+ backdrop,
243
315
  label(text) {
244
316
  name = text;
245
317
  button.setAttribute("aria-label", text);
@@ -1,11 +1,11 @@
1
1
  import { createMarkers } from "./controls/markers.js";
2
2
  import { namespaces } from "./namespaces.js";
3
- import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
3
+ import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/asyncToGenerator.js";
4
4
  import { drmGuard, resolvePreset } from "./presets.js";
5
5
  import { STYLE } from "./style.js";
6
6
  import { errorSurface } from "./surface.js";
7
7
  import { PLAYER } from "./tags.js";
8
- import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
8
+ import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
9
9
  import { createPlayer, inferType, matteboxHandler, nativeHandler, preferNativeHls } from "@mattebox/player-core";
10
10
  //#region src/element.ts
11
11
  /**
@@ -21,13 +21,15 @@ const FORWARDED = [
21
21
  "poster",
22
22
  "crossorigin"
23
23
  ];
24
+ const LICENSE_URL = "license-url";
25
+ const CERTIFICATE_URL = "certificate-url";
24
26
  /** Everything else the element watches. Changing any of them reloads. */
25
27
  const OWN = [
26
28
  "src",
27
29
  "type",
28
30
  "preset",
29
- "license-url",
30
- "certificate-url",
31
+ LICENSE_URL,
32
+ CERTIFICATE_URL,
31
33
  "thumbnails",
32
34
  NATIVE_HLS
33
35
  ];
@@ -55,6 +57,27 @@ const CONTROLS = "controls";
55
57
  * control the page placed shows. Changing it never reloads.
56
58
  */
57
59
  const PLAYSINLINE = "playsinline";
60
+ /**
61
+ * The size tier the controls draw for: `compact` on a small player, such
62
+ * as a phone held upright, `wide` on a large one, such as a TV or
63
+ * fullscreen, and `regular` between. The element measures itself and sets
64
+ * the attribute, so a stylesheet matches `mattebox-player[layout="compact"]`.
65
+ * A page that writes one of the three values fixes it, and removing the
66
+ * attribute hands it back. The player's own box decides, not the screen:
67
+ * a small embed on a desktop is compact, and a phone in fullscreen is not.
68
+ */
69
+ const LAYOUT = "layout";
70
+ const LAYOUTS = [
71
+ "compact",
72
+ "regular",
73
+ "wide"
74
+ ];
75
+ /** Under either, the player is compact. */
76
+ const COMPACT_WIDTH = 480;
77
+ const COMPACT_HEIGHT = 320;
78
+ /** From both, the player is wide. */
79
+ const WIDE_WIDTH = 1280;
80
+ const WIDE_HEIGHT = 700;
58
81
  /** The video's state, as attributes on the element, read on the events the video fires for it. */
59
82
  const STATE_EVENTS = [
60
83
  "play",
@@ -93,7 +116,8 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
93
116
  ...OWN,
94
117
  CONTROLS,
95
118
  CHAPTERS,
96
- PLAYSINLINE
119
+ PLAYSINLINE,
120
+ LAYOUT
97
121
  ];
98
122
  }
99
123
  /**
@@ -108,14 +132,18 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
108
132
  }
109
133
  constructor(options) {
110
134
  super();
111
- this.options = options !== null && options !== void 0 ? options : defaults;
135
+ this.own = options !== null && options !== void 0 ? options : null;
112
136
  this.focusable = false;
113
137
  this.track = null;
114
138
  this.given = null;
139
+ this.list = null;
140
+ this.tried = "";
115
141
  this.core = null;
116
142
  this.current = null;
117
143
  this.failure = null;
118
144
  this.reflecting = false;
145
+ this.sizes = null;
146
+ this.fixed = false;
119
147
  this.started = false;
120
148
  this.waiting = false;
121
149
  this.offs = [];
@@ -134,7 +162,11 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
134
162
  this.marks = createMarkers(this.media, (name, detail) => this.emit(name, detail));
135
163
  this.stage = document.createElement("div");
136
164
  this.stage.setAttribute("part", "stage");
137
- this.stage.append(document.createElement("slot"));
165
+ const slot = document.createElement("slot");
166
+ slot.addEventListener("slotchange", () => {
167
+ if (this.current === null && JSON.stringify(this.wanted()) !== this.tried) this.reload();
168
+ });
169
+ this.stage.append(slot);
138
170
  this.surface = errorSurface(() => {
139
171
  this.reload();
140
172
  });
@@ -151,6 +183,19 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
151
183
  get markers() {
152
184
  return this.marks;
153
185
  }
186
+ /**
187
+ * The sources to try in order, set from script. The `src` attribute wins
188
+ * over them, and they win over the `<source>` children. Setting them
189
+ * loads, and null returns to the children.
190
+ */
191
+ get sources() {
192
+ return this.list;
193
+ }
194
+ set sources(value) {
195
+ this.list = value;
196
+ if (this.marks.list.length > 0) this.marks.set([]);
197
+ this.reload();
198
+ }
154
199
  /** The core, or null until the first source has been set up: resolving a preset is asynchronous. */
155
200
  get player() {
156
201
  return this.core;
@@ -173,8 +218,28 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
173
218
  if (this.media.parentNode !== this) this.append(this.media);
174
219
  for (const name of FORWARDED) this.forward(name);
175
220
  this.reflect();
221
+ if (typeof ResizeObserver !== "undefined") {
222
+ this.sizes = new ResizeObserver(() => {
223
+ this.measure();
224
+ });
225
+ this.sizes.observe(this);
226
+ }
227
+ this.measure();
176
228
  this.reload();
177
229
  }
230
+ /** Sets `layout` from the element's box, unless the page fixed it. */
231
+ measure() {
232
+ if (this.fixed) return;
233
+ const width = this.clientWidth;
234
+ const height = this.clientHeight;
235
+ if (width === 0 || height === 0) return;
236
+ const layout = width < COMPACT_WIDTH || height < COMPACT_HEIGHT ? "compact" : width >= WIDE_WIDTH && height >= WIDE_HEIGHT ? "wide" : "regular";
237
+ if (this.getAttribute(LAYOUT) === layout) return;
238
+ this.reflecting = true;
239
+ this.setAttribute(LAYOUT, layout);
240
+ this.reflecting = false;
241
+ this.emit("layoutchange", layout);
242
+ }
178
243
  /** The two states the video does not hold: whether it has played once, and whether it waits for data. */
179
244
  note(event) {
180
245
  if (event === "playing") {
@@ -216,6 +281,9 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
216
281
  return (type === null || type === void 0 ? void 0 : type.startsWith("audio/")) === true;
217
282
  }
218
283
  disconnectedCallback() {
284
+ var _this$sizes;
285
+ (_this$sizes = this.sizes) === null || _this$sizes === void 0 || _this$sizes.disconnect();
286
+ this.sizes = null;
219
287
  this.enqueue(() => this.teardown());
220
288
  }
221
289
  attributeChangedCallback(name) {
@@ -231,6 +299,14 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
231
299
  this.chapters();
232
300
  return;
233
301
  }
302
+ if (name === LAYOUT) {
303
+ if (this.reflecting) return;
304
+ const value = this.getAttribute(LAYOUT);
305
+ this.fixed = value !== null && LAYOUTS.includes(value);
306
+ if (this.fixed) this.emit("layoutchange", value);
307
+ else this.measure();
308
+ return;
309
+ }
234
310
  if (name === PLAYSINLINE) {
235
311
  this.media.toggleAttribute(PLAYSINLINE, this.getAttribute(PLAYSINLINE) !== "false");
236
312
  return;
@@ -331,32 +407,56 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
331
407
  return _asyncToGenerator(function* () {
332
408
  _this.unmount();
333
409
  if (!_this.isConnected) return;
334
- const url = _this.getAttribute("src");
335
- if (url === null) return;
410
+ const sources = _this.wanted();
411
+ _this.tried = JSON.stringify(sources);
412
+ if (sources.length === 0) return;
336
413
  const core = yield _this.ensure();
337
- const type = _this.getAttribute("type");
338
- const source = type === null ? { url } : {
339
- url,
340
- type
341
- };
342
414
  _this.failure = null;
343
415
  _this.surface.clear();
344
- let session;
345
416
  try {
346
- session = yield core.load(source);
417
+ yield core.load(sources);
347
418
  } catch (_unused) {
348
419
  return;
349
420
  }
350
- if (!_this.isConnected) {
351
- yield core.unload();
352
- return;
353
- }
354
- _this.current = session;
355
- _this.given = null;
356
- _this.configure(session);
357
- _this.chapters();
421
+ if (!_this.isConnected) yield core.unload();
358
422
  })();
359
423
  }
424
+ /**
425
+ * What to load, ranked as a video ranks them: the `src` attribute, then
426
+ * the `sources` property, then the `<source>` children in their order.
427
+ * A child carries its own `license-url` and `certificate-url`.
428
+ */
429
+ wanted() {
430
+ const url = this.getAttribute("src");
431
+ if (url !== null) {
432
+ const type = this.getAttribute("type");
433
+ return [type === null ? { url } : {
434
+ url,
435
+ type
436
+ }];
437
+ }
438
+ const eme = drmGuard().without === void 0;
439
+ if (this.list !== null) return eme ? this.list : this.list.map(({ url, type }) => type === void 0 ? { url } : {
440
+ url,
441
+ type
442
+ });
443
+ const found = [];
444
+ for (const child of Array.from(this.children)) {
445
+ const src = child.localName === "source" ? child.getAttribute("src") : null;
446
+ if (src === null) continue;
447
+ const type = child.getAttribute("type");
448
+ const license = child.getAttribute(LICENSE_URL);
449
+ const certificate = child.getAttribute(CERTIFICATE_URL);
450
+ found.push(_objectSpread2(_objectSpread2({ url: src }, type === null ? {} : { type }), !eme || license === null && certificate === null ? {} : { drm: _objectSpread2(_objectSpread2({}, license === null ? {} : { licenseUrl: license }), certificate === null ? {} : { certificateUrl: certificate }) }));
451
+ }
452
+ return found;
453
+ }
454
+ /** Sets a session up. It runs for every session, the one that replaces a failed source included. */
455
+ adopt(session) {
456
+ this.given = null;
457
+ this.configure(session);
458
+ this.chapters();
459
+ }
360
460
  ensure() {
361
461
  var _this2 = this;
362
462
  return _asyncToGenerator(function* () {
@@ -364,6 +464,7 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
364
464
  const core = createPlayer(_this2.media, { handlers: yield _this2.chain() });
365
465
  _this2.offs.push(core.on("sourcechange", (session) => {
366
466
  _this2.current = session;
467
+ if (session !== null && _this2.isConnected) _this2.adopt(session);
367
468
  _this2.emit("sourcechange", session);
368
469
  }), core.on("error", (error) => {
369
470
  _this2.report(error);
@@ -372,6 +473,15 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
372
473
  return core;
373
474
  })();
374
475
  }
476
+ /**
477
+ * Read at each use, not once in the constructor. Importing the package
478
+ * registers the element, and the parser's elements are constructed then,
479
+ * before the page's own `define()` call can run.
480
+ */
481
+ get options() {
482
+ var _this$own;
483
+ return (_this$own = this.own) !== null && _this$own !== void 0 ? _this$own : defaults;
484
+ }
375
485
  chain() {
376
486
  var _this3 = this;
377
487
  return _asyncToGenerator(function* () {
@@ -410,8 +520,8 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
410
520
  drm(stages) {
411
521
  if (drmGuard().without !== void 0) return void 0;
412
522
  const keySystems = stages().filter((stage) => KEY_SYSTEMS.includes(stage.name));
413
- const license = this.getAttribute("license-url");
414
- const certificate = this.getAttribute("certificate-url");
523
+ const license = this.getAttribute(LICENSE_URL);
524
+ const certificate = this.getAttribute(CERTIFICATE_URL);
415
525
  const page = this.options.drm;
416
526
  if (keySystems.length === 0 && license === null && page === void 0) return void 0;
417
527
  return _objectSpread2(_objectSpread2(_objectSpread2({ keySystems }, page), license === null ? {} : { licenseUrl: license }), certificate === null ? {} : { certificateUrl: certificate });
@@ -422,10 +532,14 @@ var MatteboxPlayerElement = class MatteboxPlayerElement extends HTMLElement {
422
532
  const engine = session.engine;
423
533
  if (engine === null) return;
424
534
  const optional = namespaces(engine);
425
- const license = this.getAttribute("license-url");
426
- if (license !== null && optional.drm !== void 0) optional.drm.setLicenseUrl(license);
427
- const certificate = this.getAttribute("certificate-url");
428
- if (certificate !== null) (_optional$drm = optional.drm) === null || _optional$drm === void 0 || _optional$drm.setCertificateUrl(certificate);
535
+ const own = session.source.drm;
536
+ const license = this.getAttribute(LICENSE_URL);
537
+ if (license !== null && (own === null || own === void 0 ? void 0 : own.licenseUrl) === void 0) (_optional$drm = optional.drm) === null || _optional$drm === void 0 || _optional$drm.setLicenseUrl(license);
538
+ const certificate = this.getAttribute(CERTIFICATE_URL);
539
+ if (certificate !== null && (own === null || own === void 0 ? void 0 : own.certificateUrl) === void 0) {
540
+ var _optional$drm2;
541
+ (_optional$drm2 = optional.drm) === null || _optional$drm2 === void 0 || _optional$drm2.setCertificateUrl(certificate);
542
+ }
429
543
  const track = this.getAttribute("thumbnails");
430
544
  if (track !== null && optional.thumbnails !== void 0) optional.thumbnails.load(track).catch(() => void 0);
431
545
  }