@videojs/html 10.0.0-beta.5 → 10.0.0-beta.7
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.
- package/cdn/audio-minimal.css +1 -1
- package/cdn/audio-minimal.dev.d.ts +1 -0
- package/cdn/audio-minimal.dev.js +9 -5328
- package/cdn/audio-minimal.dev.js.map +1 -1
- package/cdn/audio-minimal.js +1 -24
- package/cdn/audio-minimal.js.map +1 -1
- package/cdn/audio.css +1 -1
- package/cdn/audio.dev.d.ts +1 -0
- package/cdn/audio.dev.js +9 -5328
- package/cdn/audio.dev.js.map +1 -1
- package/cdn/audio.js +1 -24
- package/cdn/audio.js.map +1 -1
- package/cdn/background.css +1 -1
- package/cdn/background.dev.d.ts +1 -0
- package/cdn/background.dev.js +100 -2026
- package/cdn/background.dev.js.map +1 -1
- package/cdn/background.js +1 -18
- package/cdn/background.js.map +1 -1
- package/cdn/context-C_e06fGU.js +13 -0
- package/cdn/context-C_e06fGU.js.map +1 -0
- package/cdn/context-DTY0nOpS.js +98 -0
- package/cdn/context-DTY0nOpS.js.map +1 -0
- package/cdn/create-player-Dv7K1Ezk.js +3214 -0
- package/cdn/create-player-Dv7K1Ezk.js.map +1 -0
- package/cdn/create-player-QjiNZlh7.js +7 -0
- package/cdn/create-player-QjiNZlh7.js.map +1 -0
- package/cdn/default-GgKND7a8.js +2 -0
- package/cdn/default-GgKND7a8.js.map +1 -0
- package/cdn/default-cLso8BHO.js +28 -0
- package/cdn/default-cLso8BHO.js.map +1 -0
- package/cdn/listen-BXAYCbZA.js +9 -0
- package/cdn/listen-BXAYCbZA.js.map +1 -0
- package/cdn/listen-DX5vU4s4.js +2 -0
- package/cdn/listen-DX5vU4s4.js.map +1 -0
- package/cdn/media/dash-video.dev.d.ts +1 -0
- package/cdn/media/dash-video.dev.js +39165 -0
- package/cdn/media/dash-video.dev.js.map +1 -0
- package/cdn/media/dash-video.js +21 -0
- package/cdn/media/dash-video.js.map +1 -0
- package/cdn/media/hls-video.dev.d.ts +1 -0
- package/cdn/media/hls-video.dev.js +6 -376
- package/cdn/media/hls-video.dev.js.map +1 -1
- package/cdn/media/hls-video.js +21 -63
- package/cdn/media/hls-video.js.map +1 -1
- package/cdn/media/simple-hls-video.dev.d.ts +1 -0
- package/cdn/media/simple-hls-video.dev.js +6 -375
- package/cdn/media/simple-hls-video.dev.js.map +1 -1
- package/cdn/media/simple-hls-video.js +1 -43
- package/cdn/media/simple-hls-video.js.map +1 -1
- package/cdn/media-attach-mixin-ChyNp2eK.js +44 -0
- package/cdn/media-attach-mixin-ChyNp2eK.js.map +1 -0
- package/cdn/media-attach-mixin-tFNcHnvo.js +2 -0
- package/cdn/media-attach-mixin-tFNcHnvo.js.map +1 -0
- package/cdn/minimal-BJfleQcQ.js +2 -0
- package/cdn/minimal-BJfleQcQ.js.map +1 -0
- package/cdn/minimal-DBMdC_0I.js +28 -0
- package/cdn/minimal-DBMdC_0I.js.map +1 -0
- package/cdn/player-CztIlNio.js +2 -0
- package/cdn/player-CztIlNio.js.map +1 -0
- package/cdn/player-Dvj38jlr.js +15 -0
- package/cdn/player-Dvj38jlr.js.map +1 -0
- package/cdn/poster-C4WHg3BH.js +2 -0
- package/cdn/poster-C4WHg3BH.js.map +1 -0
- package/cdn/poster-O0SI05LC.js +195 -0
- package/cdn/poster-O0SI05LC.js.map +1 -0
- package/cdn/predicate-BG-dj_kF.js +26 -0
- package/cdn/predicate-BG-dj_kF.js.map +1 -0
- package/cdn/predicate-Y9jDHLpX.js +2 -0
- package/cdn/predicate-Y9jDHLpX.js.map +1 -0
- package/cdn/proxy-2oO2ph3m.js +47 -0
- package/cdn/proxy-2oO2ph3m.js.map +1 -0
- package/cdn/proxy-6KS6wy69.js +2 -0
- package/cdn/proxy-6KS6wy69.js.map +1 -0
- package/cdn/proxy-XzDf9gyk.js +66 -0
- package/cdn/proxy-XzDf9gyk.js.map +1 -0
- package/cdn/proxy-dR7IDk37.js +349 -0
- package/cdn/proxy-dR7IDk37.js.map +1 -0
- package/cdn/safe-define-B8lHgj_K.js +9 -0
- package/cdn/safe-define-B8lHgj_K.js.map +1 -0
- package/cdn/safe-define-GrHW3P9e.js +2 -0
- package/cdn/safe-define-GrHW3P9e.js.map +1 -0
- package/cdn/video-minimal.css +1 -1
- package/cdn/video-minimal.dev.d.ts +1 -0
- package/cdn/video-minimal.dev.js +24 -5642
- package/cdn/video-minimal.dev.js.map +1 -1
- package/cdn/video-minimal.js +1 -24
- package/cdn/video-minimal.js.map +1 -1
- package/cdn/video.css +1 -1
- package/cdn/video.dev.d.ts +1 -0
- package/cdn/video.dev.js +30 -5701
- package/cdn/video.dev.js.map +1 -1
- package/cdn/video.js +1 -24
- package/cdn/video.js.map +1 -1
- package/cdn/volume-slider-BqzTytgB.js +8 -0
- package/cdn/volume-slider-BqzTytgB.js.map +1 -0
- package/cdn/volume-slider-CfhOO9RM.js +2453 -0
- package/cdn/volume-slider-CfhOO9RM.js.map +1 -0
- package/dist/default/_virtual/inline-css_src/define/audio/minimal-skin.js +1 -1
- package/dist/default/_virtual/inline-css_src/define/audio/minimal-skin.js.map +1 -1
- package/dist/default/_virtual/inline-css_src/define/audio/skin.js +1 -1
- package/dist/default/_virtual/inline-css_src/define/audio/skin.js.map +1 -1
- package/dist/default/_virtual/inline-css_src/define/base.js +1 -1
- package/dist/default/_virtual/inline-css_src/define/base.js.map +1 -1
- package/dist/default/_virtual/inline-css_src/define/shared.js +6 -0
- package/dist/default/_virtual/inline-css_src/define/shared.js.map +1 -0
- package/dist/default/_virtual/inline-css_src/define/video/minimal-skin.js +1 -1
- package/dist/default/_virtual/inline-css_src/define/video/minimal-skin.js.map +1 -1
- package/dist/default/_virtual/inline-css_src/define/video/skin.js +1 -1
- package/dist/default/_virtual/inline-css_src/define/video/skin.js.map +1 -1
- package/dist/default/define/audio/minimal-skin.css +77 -24
- package/dist/default/define/audio/minimal-skin.js +1 -1
- package/dist/default/define/audio/minimal-skin.js.map +1 -1
- package/dist/default/define/audio/minimal-skin.tailwind.js +1 -1
- package/dist/default/define/audio/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/define/audio/skin.css +74 -28
- package/dist/default/define/audio/skin.js +1 -1
- package/dist/default/define/audio/skin.js.map +1 -1
- package/dist/default/define/audio/skin.tailwind.js +3 -4
- package/dist/default/define/audio/skin.tailwind.js.map +1 -1
- package/dist/default/define/background/skin.css +1 -1
- package/dist/default/define/background/skin.js +1 -1
- package/dist/default/define/background/skin.js.map +1 -1
- package/dist/default/define/base.css +10 -12
- package/dist/default/define/media/dash-video.js +14 -0
- package/dist/default/define/media/dash-video.js.map +1 -0
- package/dist/default/define/shared.css +10 -0
- package/dist/default/define/skin-mixin.js +8 -3
- package/dist/default/define/skin-mixin.js.map +1 -1
- package/dist/default/define/video/minimal-skin.css +257 -79
- package/dist/default/define/video/minimal-skin.js +2 -1
- package/dist/default/define/video/minimal-skin.js.map +1 -1
- package/dist/default/define/video/minimal-skin.tailwind.js +5 -3
- package/dist/default/define/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/define/video/skin.css +242 -74
- package/dist/default/define/video/skin.js +2 -1
- package/dist/default/define/video/skin.js.map +1 -1
- package/dist/default/define/video/skin.tailwind.js +5 -3
- package/dist/default/define/video/skin.tailwind.js.map +1 -1
- package/dist/default/icons/dist/render/default/index.js +2 -1
- package/dist/default/icons/dist/render/default/index.js.map +1 -1
- package/dist/default/icons/dist/render/minimal/index.js +2 -1
- package/dist/default/icons/dist/render/minimal/index.js.map +1 -1
- package/dist/default/index.js +3 -2
- package/dist/default/media/background-video/index.js +5 -1
- package/dist/default/media/background-video/index.js.map +1 -1
- package/dist/default/media/container-element.js +5 -2
- package/dist/default/media/container-element.js.map +1 -1
- package/dist/default/media/dash-video/index.js +26 -0
- package/dist/default/media/dash-video/index.js.map +1 -0
- package/dist/default/media/hls-video/index.js +2 -1
- package/dist/default/media/hls-video/index.js.map +1 -1
- package/dist/default/media/simple-hls-video/index.js +2 -1
- package/dist/default/media/simple-hls-video/index.js.map +1 -1
- package/dist/default/player/context.js +6 -2
- package/dist/default/player/context.js.map +1 -1
- package/dist/default/player/create-player.js +11 -3
- package/dist/default/player/create-player.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/audio.tailwind.js +6 -5
- package/dist/default/skins/dist/default/default/tailwind/audio.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/button.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/button.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/error.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/error.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/popup.js +3 -3
- package/dist/default/skins/dist/default/default/tailwind/components/popup.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/poster.js +16 -0
- package/dist/default/skins/dist/default/default/tailwind/components/poster.js.map +1 -0
- package/dist/default/skins/dist/default/default/tailwind/components/preview.js +13 -0
- package/dist/default/skins/dist/default/default/tailwind/components/preview.js.map +1 -0
- package/dist/default/skins/dist/default/default/tailwind/components/root.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/root.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/slider.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/slider.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/surface.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/surface.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/video.tailwind.js +21 -15
- package/dist/default/skins/dist/default/default/tailwind/video.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/audio.tailwind.js +2 -2
- package/dist/default/skins/dist/default/minimal/tailwind/audio.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/button.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/button.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/playback-rate.js +6 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/playback-rate.js.map +1 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/popup.js +4 -3
- package/dist/default/skins/dist/default/minimal/tailwind/components/popup.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/poster.js +16 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/poster.js.map +1 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/preview.js +14 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/preview.js.map +1 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/root.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/root.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/slider.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/slider.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/video.tailwind.js +23 -15
- package/dist/default/skins/dist/default/minimal/tailwind/video.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/shared/tailwind/icon-state.js +5 -0
- package/dist/default/skins/dist/default/shared/tailwind/icon-state.js.map +1 -1
- package/dist/default/store/container-mixin.js +16 -72
- package/dist/default/store/container-mixin.js.map +1 -1
- package/dist/default/store/media-attach-mixin.js +45 -0
- package/dist/default/store/media-attach-mixin.js.map +1 -0
- package/dist/default/store/provider-mixin.js +99 -9
- package/dist/default/store/provider-mixin.js.map +1 -1
- package/dist/default/ui/popover/popover-element.js +54 -3
- package/dist/default/ui/popover/popover-element.js.map +1 -1
- package/dist/default/ui/time-slider/time-slider-element.js +1 -1
- package/dist/default/ui/time-slider/time-slider-element.js.map +1 -1
- package/dist/default/ui/tooltip/tooltip-element.js +53 -3
- package/dist/default/ui/tooltip/tooltip-element.js.map +1 -1
- package/dist/default/ui/volume-slider/volume-slider-element.js +3 -3
- package/dist/default/ui/volume-slider/volume-slider-element.js.map +1 -1
- package/dist/dev/_virtual/inline-css_src/define/audio/minimal-skin.js +1 -1
- package/dist/dev/_virtual/inline-css_src/define/audio/minimal-skin.js.map +1 -1
- package/dist/dev/_virtual/inline-css_src/define/audio/skin.js +1 -1
- package/dist/dev/_virtual/inline-css_src/define/audio/skin.js.map +1 -1
- package/dist/dev/_virtual/inline-css_src/define/base.js +1 -1
- package/dist/dev/_virtual/inline-css_src/define/base.js.map +1 -1
- package/dist/dev/_virtual/inline-css_src/define/shared.js +6 -0
- package/dist/dev/_virtual/inline-css_src/define/shared.js.map +1 -0
- package/dist/dev/_virtual/inline-css_src/define/video/minimal-skin.js +1 -1
- package/dist/dev/_virtual/inline-css_src/define/video/minimal-skin.js.map +1 -1
- package/dist/dev/_virtual/inline-css_src/define/video/skin.js +1 -1
- package/dist/dev/_virtual/inline-css_src/define/video/skin.js.map +1 -1
- package/dist/dev/define/audio/minimal-skin.css +77 -24
- package/dist/dev/define/audio/minimal-skin.d.ts.map +1 -1
- package/dist/dev/define/audio/minimal-skin.js +2 -0
- package/dist/dev/define/audio/minimal-skin.js.map +1 -1
- package/dist/dev/define/audio/minimal-skin.tailwind.d.ts.map +1 -1
- package/dist/dev/define/audio/minimal-skin.tailwind.js +3 -1
- package/dist/dev/define/audio/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/define/audio/skin.css +74 -28
- package/dist/dev/define/audio/skin.d.ts.map +1 -1
- package/dist/dev/define/audio/skin.js +2 -0
- package/dist/dev/define/audio/skin.js.map +1 -1
- package/dist/dev/define/audio/skin.tailwind.d.ts.map +1 -1
- package/dist/dev/define/audio/skin.tailwind.js +5 -4
- package/dist/dev/define/audio/skin.tailwind.js.map +1 -1
- package/dist/dev/define/background/skin.css +1 -1
- package/dist/dev/define/background/skin.d.ts.map +1 -1
- package/dist/dev/define/background/skin.js +3 -1
- package/dist/dev/define/background/skin.js.map +1 -1
- package/dist/dev/define/base.css +10 -12
- package/dist/dev/define/media/dash-video.d.ts +14 -0
- package/dist/dev/define/media/dash-video.d.ts.map +1 -0
- package/dist/dev/define/media/dash-video.js +14 -0
- package/dist/dev/define/media/dash-video.js.map +1 -0
- package/dist/dev/define/shared.css +10 -0
- package/dist/dev/define/skin-mixin.d.ts.map +1 -1
- package/dist/dev/define/skin-mixin.js +8 -3
- package/dist/dev/define/skin-mixin.js.map +1 -1
- package/dist/dev/define/video/minimal-skin.css +257 -79
- package/dist/dev/define/video/minimal-skin.d.ts.map +1 -1
- package/dist/dev/define/video/minimal-skin.js +18 -2
- package/dist/dev/define/video/minimal-skin.js.map +1 -1
- package/dist/dev/define/video/minimal-skin.tailwind.d.ts.map +1 -1
- package/dist/dev/define/video/minimal-skin.tailwind.js +22 -5
- package/dist/dev/define/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/define/video/skin.css +242 -74
- package/dist/dev/define/video/skin.d.ts.map +1 -1
- package/dist/dev/define/video/skin.js +15 -1
- package/dist/dev/define/video/skin.js.map +1 -1
- package/dist/dev/define/video/skin.tailwind.d.ts.map +1 -1
- package/dist/dev/define/video/skin.tailwind.js +20 -5
- package/dist/dev/define/video/skin.tailwind.js.map +1 -1
- package/dist/dev/icons/dist/render/default/index.js +2 -1
- package/dist/dev/icons/dist/render/default/index.js.map +1 -1
- package/dist/dev/icons/dist/render/minimal/index.js +2 -1
- package/dist/dev/icons/dist/render/minimal/index.js.map +1 -1
- package/dist/dev/index.d.ts +5 -4
- package/dist/dev/index.js +3 -2
- package/dist/dev/media/background-video/index.d.ts +8 -1
- package/dist/dev/media/background-video/index.d.ts.map +1 -1
- package/dist/dev/media/background-video/index.js +5 -1
- package/dist/dev/media/background-video/index.js.map +1 -1
- package/dist/dev/media/container-element.js +5 -2
- package/dist/dev/media/container-element.js.map +1 -1
- package/dist/dev/media/dash-video/index.d.ts +13 -0
- package/dist/dev/media/dash-video/index.d.ts.map +1 -0
- package/dist/dev/media/dash-video/index.js +26 -0
- package/dist/dev/media/dash-video/index.js.map +1 -0
- package/dist/dev/media/hls-video/index.d.ts +2 -1
- package/dist/dev/media/hls-video/index.d.ts.map +1 -1
- package/dist/dev/media/hls-video/index.js +2 -1
- package/dist/dev/media/hls-video/index.js.map +1 -1
- package/dist/dev/media/simple-hls-video/index.d.ts +2 -1
- package/dist/dev/media/simple-hls-video/index.d.ts.map +1 -1
- package/dist/dev/media/simple-hls-video/index.js +2 -1
- package/dist/dev/media/simple-hls-video/index.js.map +1 -1
- package/dist/dev/player/context.d.ts +16 -2
- package/dist/dev/player/context.d.ts.map +1 -1
- package/dist/dev/player/context.js +6 -2
- package/dist/dev/player/context.js.map +1 -1
- package/dist/dev/player/create-player.d.ts +1 -1
- package/dist/dev/player/create-player.js +11 -3
- package/dist/dev/player/create-player.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/audio.tailwind.js +6 -5
- package/dist/dev/skins/dist/default/default/tailwind/audio.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/button.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/button.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/error.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/error.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/popup.js +3 -3
- package/dist/dev/skins/dist/default/default/tailwind/components/popup.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/poster.js +16 -0
- package/dist/dev/skins/dist/default/default/tailwind/components/poster.js.map +1 -0
- package/dist/dev/skins/dist/default/default/tailwind/components/preview.js +13 -0
- package/dist/dev/skins/dist/default/default/tailwind/components/preview.js.map +1 -0
- package/dist/dev/skins/dist/default/default/tailwind/components/root.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/root.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/slider.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/slider.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/surface.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/surface.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/video.tailwind.js +21 -15
- package/dist/dev/skins/dist/default/default/tailwind/video.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/audio.tailwind.js +2 -2
- package/dist/dev/skins/dist/default/minimal/tailwind/audio.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/button.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/button.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/playback-rate.js +6 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/playback-rate.js.map +1 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/popup.js +4 -3
- package/dist/dev/skins/dist/default/minimal/tailwind/components/popup.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/poster.js +16 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/poster.js.map +1 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/preview.js +14 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/preview.js.map +1 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/root.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/root.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/slider.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/slider.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/video.tailwind.js +23 -15
- package/dist/dev/skins/dist/default/minimal/tailwind/video.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/shared/tailwind/icon-state.js +5 -0
- package/dist/dev/skins/dist/default/shared/tailwind/icon-state.js.map +1 -1
- package/dist/dev/store/container-mixin.d.ts +10 -5
- package/dist/dev/store/container-mixin.d.ts.map +1 -1
- package/dist/dev/store/container-mixin.js +16 -72
- package/dist/dev/store/container-mixin.js.map +1 -1
- package/dist/dev/store/media-attach-mixin.d.ts +19 -0
- package/dist/dev/store/media-attach-mixin.d.ts.map +1 -0
- package/dist/dev/store/media-attach-mixin.js +45 -0
- package/dist/dev/store/media-attach-mixin.js.map +1 -0
- package/dist/dev/store/provider-mixin.d.ts +19 -6
- package/dist/dev/store/provider-mixin.d.ts.map +1 -1
- package/dist/dev/store/provider-mixin.js +99 -9
- package/dist/dev/store/provider-mixin.js.map +1 -1
- package/dist/dev/ui/popover/popover-element.d.ts.map +1 -1
- package/dist/dev/ui/popover/popover-element.js +54 -3
- package/dist/dev/ui/popover/popover-element.js.map +1 -1
- package/dist/dev/ui/time-slider/time-slider-element.js +1 -1
- package/dist/dev/ui/time-slider/time-slider-element.js.map +1 -1
- package/dist/dev/ui/tooltip/tooltip-element.d.ts.map +1 -1
- package/dist/dev/ui/tooltip/tooltip-element.js +53 -3
- package/dist/dev/ui/tooltip/tooltip-element.js.map +1 -1
- package/dist/dev/ui/volume-slider/volume-slider-element.js +3 -3
- package/dist/dev/ui/volume-slider/volume-slider-element.js.map +1 -1
- package/package.json +20 -9
|
@@ -0,0 +1,2453 @@
|
|
|
1
|
+
import { B as applyStyles, C as getAnchorPositionStyle, D as createButton, E as createPopover, F as selectTime, H as tryShowPopover, I as selectVolume, M as selectPlayback, N as selectPlaybackRate, O as selectBuffer, P as selectTextTrack, S as getAnchorNameStyle, T as resolveOffsets, U as supportsAnchorPositioning, V as tryHidePopover, W as createState, _ as getSliderPreviewStyle, a as MediaElement, b as clamp, c as ContextConsumer, d as applyElementProps, f as createTransition, g as getSliderCSSVars, h as ThumbnailCore, i as MediaContainerElement, l as applyStateDataAttrs, m as createThumbnail, n as PlayerController, p as createTooltip, r as SnapshotController, s as ContextProvider, u as logMissingFeature, v as getTimeSliderCSSVars, w as getPopupPositionRect, x as roundToStep, y as createSlider } from "./create-player-Dv7K1Ezk.js";
|
|
2
|
+
import { i as isNumber, o as isUndefined, t as isFunction } from "./predicate-BG-dj_kF.js";
|
|
3
|
+
import { i as createContext, r as playerContext } from "./context-DTY0nOpS.js";
|
|
4
|
+
import { t as safeDefine } from "./safe-define-B8lHgj_K.js";
|
|
5
|
+
|
|
6
|
+
//#region ../utils/dist/object/defaults.js
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new object with default values filled in for undefined properties.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const props = { label: undefined, disabled: true };
|
|
13
|
+
* const defaultProps = { label: '', disabled: false };
|
|
14
|
+
* defaults(props, defaultProps); // { label: '', disabled: true }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function defaults(object, defaultValues) {
|
|
18
|
+
const result = { ...defaultValues };
|
|
19
|
+
for (const key in object) if (!isUndefined(object[key])) result[key] = object[key];
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../utils/dist/dom/direction.js
|
|
25
|
+
/** Check whether an element's text direction is right-to-left. */
|
|
26
|
+
function isRTL(element) {
|
|
27
|
+
const dir = element.closest("[dir]")?.getAttribute("dir");
|
|
28
|
+
if (dir) return dir.toLowerCase() === "rtl";
|
|
29
|
+
return getComputedStyle(element).direction === "rtl";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region inline-css:src/define/base.js
|
|
34
|
+
var base_default = "video-player {\n display: contents;\n}\n\n/*\nRequired to override any default video and image styles (such as\nTailwind's CSS reset) and ensure they fill the container as expected.\n*/\nvideo-player video,\nvideo-player [slot=\"poster\"] {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nvideo-player video::-webkit-media-text-track-container {\n transition: translate var(--media-caption-track-duration, 0) ease-out;\n transition-delay: var(--media-caption-track-delay, 0);\n translate: 0 var(--media-caption-track-y, 0);\n scale: 0.98;\n z-index: 1;\n font-family: inherit;\n}\n";
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region inline-css:src/define/shared.js
|
|
38
|
+
var shared_default = "media-tooltip-group {\n display: contents;\n}\n\n/* Fixes a weird issue with Safari when setting aspect-ratio */\n:host {\n display: grid;\n}\n\n/* Hide volume popover when volume control is unsupported (e.g., iOS Safari). */\n.media-popover--volume:has(media-volume-slider[data-availability=\"unsupported\"]) {\n display: none;\n}\n";
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/define/skin-mixin.ts
|
|
42
|
+
const STYLES_ID = "__media-styles";
|
|
43
|
+
function ensureRootStyles() {
|
|
44
|
+
if (document.getElementById(STYLES_ID)) return;
|
|
45
|
+
const style = document.createElement("style");
|
|
46
|
+
style.id = STYLES_ID;
|
|
47
|
+
style.textContent = base_default;
|
|
48
|
+
document.head.appendChild(style);
|
|
49
|
+
}
|
|
50
|
+
const sharedSheet = new CSSStyleSheet();
|
|
51
|
+
sharedSheet.replaceSync(shared_default);
|
|
52
|
+
/**
|
|
53
|
+
* Mixin for skin elements that renders the template from a static
|
|
54
|
+
* `getTemplateHTML` method into a shadow root. Native `<slot>` elements
|
|
55
|
+
* handle light DOM projection automatically.
|
|
56
|
+
*
|
|
57
|
+
* When `static styles` is set, the stylesheet is adopted into the
|
|
58
|
+
* shadow root via `adoptedStyleSheets`.
|
|
59
|
+
*/
|
|
60
|
+
function SkinMixin(BaseClass) {
|
|
61
|
+
class SkinElement extends BaseClass {
|
|
62
|
+
static {
|
|
63
|
+
this.shadowRootOptions = { mode: "open" };
|
|
64
|
+
}
|
|
65
|
+
constructor(...args) {
|
|
66
|
+
super(...args);
|
|
67
|
+
ensureRootStyles();
|
|
68
|
+
if (!this.shadowRoot) {
|
|
69
|
+
const ctor = this.constructor;
|
|
70
|
+
this.attachShadow(ctor.shadowRootOptions);
|
|
71
|
+
const sheets = [sharedSheet];
|
|
72
|
+
if (ctor.styles) sheets.push(ctor.styles);
|
|
73
|
+
this.shadowRoot.adoptedStyleSheets = sheets;
|
|
74
|
+
if (ctor.getTemplateHTML) this.shadowRoot.innerHTML = ctor.getTemplateHTML();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return SkinElement;
|
|
79
|
+
}
|
|
80
|
+
/** Create a shared `CSSStyleSheet` from a CSS string. */
|
|
81
|
+
function createStyles(css) {
|
|
82
|
+
const sheet = new CSSStyleSheet();
|
|
83
|
+
sheet.replaceSync(css);
|
|
84
|
+
return sheet;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/define/media/container.ts
|
|
89
|
+
safeDefine(MediaContainerElement);
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../core/dist/dev/core/ui/transition.js
|
|
93
|
+
function getTransitionFlags(status) {
|
|
94
|
+
return {
|
|
95
|
+
transitionStarting: status === "starting",
|
|
96
|
+
transitionEnding: status === "ending"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../core/dist/dev/core/ui/buffering-indicator/buffering-indicator-core.js
|
|
102
|
+
var BufferingIndicatorCore = class BufferingIndicatorCore {
|
|
103
|
+
static defaultProps = { delay: 500 };
|
|
104
|
+
state = createState({ visible: false });
|
|
105
|
+
#props = { ...BufferingIndicatorCore.defaultProps };
|
|
106
|
+
#timer = null;
|
|
107
|
+
setProps(props) {
|
|
108
|
+
this.#props = defaults(props, BufferingIndicatorCore.defaultProps);
|
|
109
|
+
}
|
|
110
|
+
update(media) {
|
|
111
|
+
const buffering = media.waiting && !media.paused;
|
|
112
|
+
if (buffering && !this.state.current.visible && !this.#timer) this.#timer = setTimeout(() => {
|
|
113
|
+
this.#timer = null;
|
|
114
|
+
this.state.patch({ visible: true });
|
|
115
|
+
}, this.#props.delay);
|
|
116
|
+
else if (!buffering) {
|
|
117
|
+
if (this.#timer !== null) {
|
|
118
|
+
clearTimeout(this.#timer);
|
|
119
|
+
this.#timer = null;
|
|
120
|
+
}
|
|
121
|
+
this.state.patch({ visible: false });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region ../core/dist/dev/core/ui/buffering-indicator/buffering-indicator-data-attrs.js
|
|
128
|
+
const BufferingIndicatorDataAttrs = { visible: "data-visible" };
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region ../core/dist/dev/core/ui/captions-button/captions-button-core.js
|
|
132
|
+
var CaptionsButtonCore = class CaptionsButtonCore {
|
|
133
|
+
static defaultProps = {
|
|
134
|
+
label: "",
|
|
135
|
+
disabled: false
|
|
136
|
+
};
|
|
137
|
+
#props = { ...CaptionsButtonCore.defaultProps };
|
|
138
|
+
#media = null;
|
|
139
|
+
constructor(props) {
|
|
140
|
+
if (props) this.setProps(props);
|
|
141
|
+
}
|
|
142
|
+
setProps(props) {
|
|
143
|
+
this.#props = defaults(props, CaptionsButtonCore.defaultProps);
|
|
144
|
+
}
|
|
145
|
+
getLabel(state) {
|
|
146
|
+
const { label } = this.#props;
|
|
147
|
+
if (isFunction(label)) {
|
|
148
|
+
const customLabel = label(state);
|
|
149
|
+
if (customLabel) return customLabel;
|
|
150
|
+
} else if (label) return label;
|
|
151
|
+
return state.subtitlesShowing ? "Disable captions" : "Enable captions";
|
|
152
|
+
}
|
|
153
|
+
getAttrs(state) {
|
|
154
|
+
return {
|
|
155
|
+
"aria-label": this.getLabel(state),
|
|
156
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
setMedia(media) {
|
|
160
|
+
this.#media = media;
|
|
161
|
+
}
|
|
162
|
+
getState() {
|
|
163
|
+
const media = this.#media;
|
|
164
|
+
return {
|
|
165
|
+
subtitlesShowing: media.subtitlesShowing,
|
|
166
|
+
availability: media.textTrackList.some((t) => t.kind === "captions" || t.kind === "subtitles") ? "available" : "unavailable"
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
toggle(media) {
|
|
170
|
+
if (this.#props.disabled) return;
|
|
171
|
+
media.toggleSubtitles();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../core/dist/dev/core/ui/captions-button/captions-button-data-attrs.js
|
|
177
|
+
const CaptionsButtonDataAttrs = {
|
|
178
|
+
subtitlesShowing: "data-active",
|
|
179
|
+
availability: "data-availability"
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region ../core/dist/dev/core/ui/controls/controls-core.js
|
|
184
|
+
var ControlsCore = class {
|
|
185
|
+
#media = null;
|
|
186
|
+
setMedia(media) {
|
|
187
|
+
this.#media = media;
|
|
188
|
+
}
|
|
189
|
+
getState() {
|
|
190
|
+
const media = this.#media;
|
|
191
|
+
return {
|
|
192
|
+
visible: media.controlsVisible,
|
|
193
|
+
userActive: media.userActive
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region ../core/dist/dev/core/ui/controls/controls-data-attrs.js
|
|
200
|
+
const ControlsDataAttrs = {
|
|
201
|
+
visible: "data-visible",
|
|
202
|
+
userActive: "data-user-active"
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region ../core/dist/dev/core/ui/fullscreen-button/fullscreen-button-core.js
|
|
207
|
+
var FullscreenButtonCore = class FullscreenButtonCore {
|
|
208
|
+
static defaultProps = {
|
|
209
|
+
label: "",
|
|
210
|
+
disabled: false
|
|
211
|
+
};
|
|
212
|
+
#props = { ...FullscreenButtonCore.defaultProps };
|
|
213
|
+
#media = null;
|
|
214
|
+
constructor(props) {
|
|
215
|
+
if (props) this.setProps(props);
|
|
216
|
+
}
|
|
217
|
+
setProps(props) {
|
|
218
|
+
this.#props = defaults(props, FullscreenButtonCore.defaultProps);
|
|
219
|
+
}
|
|
220
|
+
getLabel(state) {
|
|
221
|
+
const { label } = this.#props;
|
|
222
|
+
if (isFunction(label)) {
|
|
223
|
+
const customLabel = label(state);
|
|
224
|
+
if (customLabel) return customLabel;
|
|
225
|
+
} else if (label) return label;
|
|
226
|
+
return state.fullscreen ? "Exit fullscreen" : "Enter fullscreen";
|
|
227
|
+
}
|
|
228
|
+
getAttrs(state) {
|
|
229
|
+
return {
|
|
230
|
+
"aria-label": this.getLabel(state),
|
|
231
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
setMedia(media) {
|
|
235
|
+
this.#media = media;
|
|
236
|
+
}
|
|
237
|
+
getState() {
|
|
238
|
+
const media = this.#media;
|
|
239
|
+
return {
|
|
240
|
+
fullscreen: media.fullscreen,
|
|
241
|
+
availability: media.fullscreenAvailability
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
async toggle(media) {
|
|
245
|
+
if (this.#props.disabled) return;
|
|
246
|
+
if (media.fullscreenAvailability !== "available") return;
|
|
247
|
+
try {
|
|
248
|
+
if (media.fullscreen) await media.exitFullscreen();
|
|
249
|
+
else await media.requestFullscreen();
|
|
250
|
+
} catch {}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region ../core/dist/dev/core/ui/fullscreen-button/fullscreen-button-data-attrs.js
|
|
256
|
+
const FullscreenButtonDataAttrs = {
|
|
257
|
+
fullscreen: "data-fullscreen",
|
|
258
|
+
availability: "data-availability"
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region ../core/dist/dev/core/ui/mute-button/mute-button-core.js
|
|
263
|
+
var MuteButtonCore = class MuteButtonCore {
|
|
264
|
+
static defaultProps = {
|
|
265
|
+
label: "",
|
|
266
|
+
disabled: false
|
|
267
|
+
};
|
|
268
|
+
#props = { ...MuteButtonCore.defaultProps };
|
|
269
|
+
#media = null;
|
|
270
|
+
constructor(props) {
|
|
271
|
+
if (props) this.setProps(props);
|
|
272
|
+
}
|
|
273
|
+
setProps(props) {
|
|
274
|
+
this.#props = defaults(props, MuteButtonCore.defaultProps);
|
|
275
|
+
}
|
|
276
|
+
getLabel(state) {
|
|
277
|
+
const { label } = this.#props;
|
|
278
|
+
if (isFunction(label)) {
|
|
279
|
+
const customLabel = label(state);
|
|
280
|
+
if (customLabel) return customLabel;
|
|
281
|
+
} else if (label) return label;
|
|
282
|
+
return state.muted ? "Unmute" : "Mute";
|
|
283
|
+
}
|
|
284
|
+
getAttrs(state) {
|
|
285
|
+
return {
|
|
286
|
+
"aria-label": this.getLabel(state),
|
|
287
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
setMedia(media) {
|
|
291
|
+
this.#media = media;
|
|
292
|
+
}
|
|
293
|
+
getState() {
|
|
294
|
+
const media = this.#media;
|
|
295
|
+
return {
|
|
296
|
+
muted: media.muted || media.volume === 0,
|
|
297
|
+
volumeLevel: getVolumeLevel(media)
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
toggle(media) {
|
|
301
|
+
if (this.#props.disabled) return;
|
|
302
|
+
media.toggleMuted();
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
function getVolumeLevel(media) {
|
|
306
|
+
if (media.muted || media.volume === 0) return "off";
|
|
307
|
+
if (media.volume < .5) return "low";
|
|
308
|
+
if (media.volume < .75) return "medium";
|
|
309
|
+
return "high";
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region ../core/dist/dev/core/ui/mute-button/mute-button-data-attrs.js
|
|
314
|
+
const MuteButtonDataAttrs = {
|
|
315
|
+
muted: "data-muted",
|
|
316
|
+
volumeLevel: "data-volume-level"
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region ../core/dist/dev/core/ui/pip-button/pip-button-core.js
|
|
321
|
+
var PiPButtonCore = class PiPButtonCore {
|
|
322
|
+
static defaultProps = {
|
|
323
|
+
label: "",
|
|
324
|
+
disabled: false
|
|
325
|
+
};
|
|
326
|
+
#props = { ...PiPButtonCore.defaultProps };
|
|
327
|
+
#media = null;
|
|
328
|
+
constructor(props) {
|
|
329
|
+
if (props) this.setProps(props);
|
|
330
|
+
}
|
|
331
|
+
setProps(props) {
|
|
332
|
+
this.#props = defaults(props, PiPButtonCore.defaultProps);
|
|
333
|
+
}
|
|
334
|
+
getLabel(state) {
|
|
335
|
+
const { label } = this.#props;
|
|
336
|
+
if (isFunction(label)) {
|
|
337
|
+
const customLabel = label(state);
|
|
338
|
+
if (customLabel) return customLabel;
|
|
339
|
+
} else if (label) return label;
|
|
340
|
+
return state.pip ? "Exit picture-in-picture" : "Enter picture-in-picture";
|
|
341
|
+
}
|
|
342
|
+
getAttrs(state) {
|
|
343
|
+
return {
|
|
344
|
+
"aria-label": this.getLabel(state),
|
|
345
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
setMedia(media) {
|
|
349
|
+
this.#media = media;
|
|
350
|
+
}
|
|
351
|
+
getState() {
|
|
352
|
+
const media = this.#media;
|
|
353
|
+
return {
|
|
354
|
+
pip: media.pip,
|
|
355
|
+
availability: media.pipAvailability
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
async toggle(media) {
|
|
359
|
+
if (this.#props.disabled) return;
|
|
360
|
+
if (media.pipAvailability !== "available") return;
|
|
361
|
+
try {
|
|
362
|
+
if (media.pip) await media.exitPictureInPicture();
|
|
363
|
+
else await media.requestPictureInPicture();
|
|
364
|
+
} catch {}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region ../core/dist/dev/core/ui/pip-button/pip-button-data-attrs.js
|
|
370
|
+
const PiPButtonDataAttrs = {
|
|
371
|
+
pip: "data-pip",
|
|
372
|
+
availability: "data-availability"
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region ../core/dist/dev/core/ui/play-button/play-button-core.js
|
|
377
|
+
var PlayButtonCore = class PlayButtonCore {
|
|
378
|
+
static defaultProps = {
|
|
379
|
+
label: "",
|
|
380
|
+
disabled: false
|
|
381
|
+
};
|
|
382
|
+
#props = { ...PlayButtonCore.defaultProps };
|
|
383
|
+
#media = null;
|
|
384
|
+
constructor(props) {
|
|
385
|
+
if (props) this.setProps(props);
|
|
386
|
+
}
|
|
387
|
+
setProps(props) {
|
|
388
|
+
this.#props = defaults(props, PlayButtonCore.defaultProps);
|
|
389
|
+
}
|
|
390
|
+
getLabel(state) {
|
|
391
|
+
const { label } = this.#props;
|
|
392
|
+
if (isFunction(label)) {
|
|
393
|
+
const customLabel = label(state);
|
|
394
|
+
if (customLabel) return customLabel;
|
|
395
|
+
} else if (label) return label;
|
|
396
|
+
if (state.ended) return "Replay";
|
|
397
|
+
return state.paused ? "Play" : "Pause";
|
|
398
|
+
}
|
|
399
|
+
getAttrs(state) {
|
|
400
|
+
return {
|
|
401
|
+
"aria-label": this.getLabel(state),
|
|
402
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
setMedia(media) {
|
|
406
|
+
this.#media = media;
|
|
407
|
+
}
|
|
408
|
+
getState() {
|
|
409
|
+
const media = this.#media;
|
|
410
|
+
return {
|
|
411
|
+
paused: media.paused,
|
|
412
|
+
ended: media.ended,
|
|
413
|
+
started: media.started
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
async toggle(media) {
|
|
417
|
+
if (this.#props.disabled) return;
|
|
418
|
+
if (media.paused || media.ended) return media.play();
|
|
419
|
+
media.pause();
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region ../core/dist/dev/core/ui/play-button/play-button-data-attrs.js
|
|
425
|
+
const PlayButtonDataAttrs = {
|
|
426
|
+
paused: "data-paused",
|
|
427
|
+
ended: "data-ended",
|
|
428
|
+
started: "data-started"
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region ../core/dist/dev/core/ui/playback-rate-button/playback-rate-button-core.js
|
|
433
|
+
var PlaybackRateButtonCore = class PlaybackRateButtonCore {
|
|
434
|
+
static defaultProps = {
|
|
435
|
+
label: "",
|
|
436
|
+
disabled: false
|
|
437
|
+
};
|
|
438
|
+
#props = { ...PlaybackRateButtonCore.defaultProps };
|
|
439
|
+
#media = null;
|
|
440
|
+
constructor(props) {
|
|
441
|
+
if (props) this.setProps(props);
|
|
442
|
+
}
|
|
443
|
+
setProps(props) {
|
|
444
|
+
this.#props = defaults(props, PlaybackRateButtonCore.defaultProps);
|
|
445
|
+
}
|
|
446
|
+
getLabel(state) {
|
|
447
|
+
const { label } = this.#props;
|
|
448
|
+
if (isFunction(label)) {
|
|
449
|
+
const customLabel = label(state);
|
|
450
|
+
if (customLabel) return customLabel;
|
|
451
|
+
} else if (label) return label;
|
|
452
|
+
return `Playback rate ${state.rate}`;
|
|
453
|
+
}
|
|
454
|
+
getAttrs(state) {
|
|
455
|
+
return {
|
|
456
|
+
"aria-label": this.getLabel(state),
|
|
457
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
setMedia(media) {
|
|
461
|
+
this.#media = media;
|
|
462
|
+
}
|
|
463
|
+
getState() {
|
|
464
|
+
return { rate: this.#media.playbackRate };
|
|
465
|
+
}
|
|
466
|
+
cycle(media) {
|
|
467
|
+
if (this.#props.disabled) return;
|
|
468
|
+
const { playbackRates, playbackRate } = media;
|
|
469
|
+
if (playbackRates.length === 0) return;
|
|
470
|
+
const idx = playbackRates.indexOf(playbackRate);
|
|
471
|
+
const next = idx === -1 ? playbackRates.find((r) => r > playbackRate) ?? playbackRates[0] : playbackRates[(idx + 1) % playbackRates.length];
|
|
472
|
+
media.setPlaybackRate(next);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region ../core/dist/dev/core/ui/playback-rate-button/playback-rate-button-data-attrs.js
|
|
478
|
+
const PlaybackRateButtonDataAttrs = { rate: "data-rate" };
|
|
479
|
+
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region ../core/dist/dev/core/ui/popover/popover-core.js
|
|
482
|
+
var PopoverCore = class PopoverCore {
|
|
483
|
+
static defaultProps = {
|
|
484
|
+
side: "top",
|
|
485
|
+
align: "center",
|
|
486
|
+
modal: false,
|
|
487
|
+
closeOnEscape: true,
|
|
488
|
+
closeOnOutsideClick: true,
|
|
489
|
+
open: false,
|
|
490
|
+
defaultOpen: false,
|
|
491
|
+
openOnHover: false,
|
|
492
|
+
delay: 300,
|
|
493
|
+
closeDelay: 0
|
|
494
|
+
};
|
|
495
|
+
#props = { ...PopoverCore.defaultProps };
|
|
496
|
+
constructor(props) {
|
|
497
|
+
if (props) this.setProps(props);
|
|
498
|
+
}
|
|
499
|
+
setProps(props) {
|
|
500
|
+
this.#props = defaults(props, PopoverCore.defaultProps);
|
|
501
|
+
}
|
|
502
|
+
#input = null;
|
|
503
|
+
setInput(input) {
|
|
504
|
+
this.#input = input;
|
|
505
|
+
}
|
|
506
|
+
getState() {
|
|
507
|
+
const input = this.#input;
|
|
508
|
+
return {
|
|
509
|
+
open: input.active,
|
|
510
|
+
status: input.status,
|
|
511
|
+
side: this.#props.side,
|
|
512
|
+
align: this.#props.align,
|
|
513
|
+
modal: this.#props.modal,
|
|
514
|
+
...getTransitionFlags(input.status)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
getTriggerAttrs(state, popupId) {
|
|
518
|
+
return {
|
|
519
|
+
"aria-expanded": state.open ? "true" : "false",
|
|
520
|
+
"aria-haspopup": "dialog",
|
|
521
|
+
"aria-controls": popupId
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
getPopupAttrs(state) {
|
|
525
|
+
return {
|
|
526
|
+
popover: "manual",
|
|
527
|
+
role: "dialog",
|
|
528
|
+
"aria-modal": state.modal === true ? "true" : void 0
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region ../core/dist/dev/core/ui/popover/popover-data-attrs.js
|
|
535
|
+
const PopoverDataAttrs = {
|
|
536
|
+
open: "data-open",
|
|
537
|
+
side: "data-side",
|
|
538
|
+
align: "data-align",
|
|
539
|
+
transitionStarting: "data-starting-style",
|
|
540
|
+
transitionEnding: "data-ending-style"
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region ../core/dist/dev/core/ui/poster/poster-core.js
|
|
545
|
+
var PosterCore = class {
|
|
546
|
+
#media = null;
|
|
547
|
+
setMedia(media) {
|
|
548
|
+
this.#media = media;
|
|
549
|
+
}
|
|
550
|
+
getState() {
|
|
551
|
+
return { visible: !this.#media.started };
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region ../core/dist/dev/core/ui/poster/poster-data-attrs.js
|
|
557
|
+
const PosterDataAttrs = { visible: "data-visible" };
|
|
558
|
+
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region ../core/dist/dev/core/ui/seek-button/seek-button-core.js
|
|
561
|
+
var SeekButtonCore = class SeekButtonCore {
|
|
562
|
+
static defaultProps = {
|
|
563
|
+
seconds: 30,
|
|
564
|
+
label: "",
|
|
565
|
+
disabled: false
|
|
566
|
+
};
|
|
567
|
+
#props = { ...SeekButtonCore.defaultProps };
|
|
568
|
+
#media = null;
|
|
569
|
+
constructor(props) {
|
|
570
|
+
if (props) this.setProps(props);
|
|
571
|
+
}
|
|
572
|
+
setProps(props) {
|
|
573
|
+
this.#props = defaults(props, SeekButtonCore.defaultProps);
|
|
574
|
+
}
|
|
575
|
+
getLabel(state) {
|
|
576
|
+
const { label } = this.#props;
|
|
577
|
+
if (isFunction(label)) {
|
|
578
|
+
const customLabel = label(state);
|
|
579
|
+
if (customLabel) return customLabel;
|
|
580
|
+
} else if (label) return label;
|
|
581
|
+
const abs = Math.abs(this.#props.seconds);
|
|
582
|
+
return state.direction === "backward" ? `Seek backward ${abs} seconds` : `Seek forward ${abs} seconds`;
|
|
583
|
+
}
|
|
584
|
+
getAttrs(state) {
|
|
585
|
+
return {
|
|
586
|
+
"aria-label": this.getLabel(state),
|
|
587
|
+
"aria-disabled": this.#props.disabled ? "true" : void 0
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
setMedia(media) {
|
|
591
|
+
this.#media = media;
|
|
592
|
+
}
|
|
593
|
+
getState() {
|
|
594
|
+
return {
|
|
595
|
+
seeking: this.#media.seeking,
|
|
596
|
+
direction: this.#props.seconds < 0 ? "backward" : "forward"
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
async seek(media) {
|
|
600
|
+
if (this.#props.disabled) return;
|
|
601
|
+
await media.seek(media.currentTime + this.#props.seconds);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region ../core/dist/dev/core/ui/seek-button/seek-button-data-attrs.js
|
|
607
|
+
const SeekButtonDataAttrs = {
|
|
608
|
+
seeking: "data-seeking",
|
|
609
|
+
direction: "data-direction"
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region ../core/dist/dev/core/ui/slider/slider-core.js
|
|
614
|
+
/** Base slider logic: value mapping, ARIA attrs, and step calculations. */
|
|
615
|
+
var SliderCore = class SliderCore {
|
|
616
|
+
static defaultProps = {
|
|
617
|
+
label: "",
|
|
618
|
+
step: 1,
|
|
619
|
+
largeStep: 10,
|
|
620
|
+
orientation: "horizontal",
|
|
621
|
+
disabled: false,
|
|
622
|
+
thumbAlignment: "center",
|
|
623
|
+
value: 0,
|
|
624
|
+
min: 0,
|
|
625
|
+
max: 100
|
|
626
|
+
};
|
|
627
|
+
static defaultInput = {
|
|
628
|
+
pointerPercent: 0,
|
|
629
|
+
dragPercent: 0,
|
|
630
|
+
dragging: false,
|
|
631
|
+
pointing: false,
|
|
632
|
+
focused: false
|
|
633
|
+
};
|
|
634
|
+
#props = { ...SliderCore.defaultProps };
|
|
635
|
+
#input = { ...SliderCore.defaultInput };
|
|
636
|
+
get props() {
|
|
637
|
+
return this.#props;
|
|
638
|
+
}
|
|
639
|
+
get input() {
|
|
640
|
+
return this.#input;
|
|
641
|
+
}
|
|
642
|
+
constructor(props) {
|
|
643
|
+
if (props) this.setProps(props);
|
|
644
|
+
}
|
|
645
|
+
setProps(props) {
|
|
646
|
+
this.#props = defaults(props, SliderCore.defaultProps);
|
|
647
|
+
}
|
|
648
|
+
setInput(input) {
|
|
649
|
+
this.#input = input;
|
|
650
|
+
}
|
|
651
|
+
getSliderState(value) {
|
|
652
|
+
const { orientation, disabled, thumbAlignment } = this.#props;
|
|
653
|
+
const { pointerPercent, dragging, pointing, focused } = this.#input;
|
|
654
|
+
return {
|
|
655
|
+
value,
|
|
656
|
+
fillPercent: this.percentFromValue(value),
|
|
657
|
+
pointerPercent,
|
|
658
|
+
dragging,
|
|
659
|
+
pointing,
|
|
660
|
+
interactive: dragging || pointing || focused,
|
|
661
|
+
orientation,
|
|
662
|
+
disabled,
|
|
663
|
+
thumbAlignment
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
getLabel(state) {
|
|
667
|
+
const { label } = this.#props;
|
|
668
|
+
if (isFunction(label)) {
|
|
669
|
+
const customLabel = label(state);
|
|
670
|
+
if (customLabel) return customLabel;
|
|
671
|
+
} else if (label) return label;
|
|
672
|
+
return "";
|
|
673
|
+
}
|
|
674
|
+
getAttrs(state) {
|
|
675
|
+
return {
|
|
676
|
+
role: "slider",
|
|
677
|
+
tabIndex: state.disabled ? -1 : 0,
|
|
678
|
+
autoComplete: "off",
|
|
679
|
+
"aria-label": this.getLabel(state),
|
|
680
|
+
"aria-valuemin": this.#props.min,
|
|
681
|
+
"aria-valuemax": this.#props.max,
|
|
682
|
+
"aria-valuenow": state.value,
|
|
683
|
+
"aria-orientation": state.orientation,
|
|
684
|
+
"aria-disabled": state.disabled ? "true" : void 0
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
valueFromPercent(percent) {
|
|
688
|
+
const { min, max, step } = this.#props;
|
|
689
|
+
return roundToStep(clamp(min + percent / 100 * (max - min), min, max), step, min);
|
|
690
|
+
}
|
|
691
|
+
/** Convert percent to a clamped value without applying step rounding. */
|
|
692
|
+
rawValueFromPercent(percent) {
|
|
693
|
+
const { min, max } = this.#props;
|
|
694
|
+
return clamp(min + percent / 100 * (max - min), min, max);
|
|
695
|
+
}
|
|
696
|
+
percentFromValue(value) {
|
|
697
|
+
const { min, max } = this.#props;
|
|
698
|
+
if (max === min) return 0;
|
|
699
|
+
return (value - min) / (max - min) * 100;
|
|
700
|
+
}
|
|
701
|
+
/** Step as a percentage of the slider range. */
|
|
702
|
+
getStepPercent() {
|
|
703
|
+
const { step, min, max } = this.#props;
|
|
704
|
+
const range = max - min;
|
|
705
|
+
return range > 0 ? step / range * 100 : 0;
|
|
706
|
+
}
|
|
707
|
+
/** Large step as a percentage of the slider range. */
|
|
708
|
+
getLargeStepPercent() {
|
|
709
|
+
const { largeStep, min, max } = this.#props;
|
|
710
|
+
const range = max - min;
|
|
711
|
+
return range > 0 ? largeStep / range * 100 : 0;
|
|
712
|
+
}
|
|
713
|
+
adjustPercentForAlignment(rawPercent, thumbSize, trackSize) {
|
|
714
|
+
if (this.#props.thumbAlignment === "center" || trackSize === 0) return rawPercent;
|
|
715
|
+
const thumbHalf = thumbSize / trackSize * 100 / 2;
|
|
716
|
+
const minPercent = thumbHalf;
|
|
717
|
+
const maxPercent = 100 - thumbHalf;
|
|
718
|
+
return minPercent + rawPercent / 100 * (maxPercent - minPercent);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region ../core/dist/dev/core/ui/slider/slider-data-attrs.js
|
|
724
|
+
const SliderDataAttrs = {
|
|
725
|
+
dragging: "data-dragging",
|
|
726
|
+
pointing: "data-pointing",
|
|
727
|
+
interactive: "data-interactive",
|
|
728
|
+
orientation: "data-orientation",
|
|
729
|
+
disabled: "data-disabled"
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region ../core/dist/dev/core/ui/thumbnail/thumbnail-data-attrs.js
|
|
734
|
+
const ThumbnailDataAttrs = {
|
|
735
|
+
loading: "data-loading",
|
|
736
|
+
error: "data-error",
|
|
737
|
+
hidden: "data-hidden"
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region ../core/dist/dev/core/ui/thumbnail/thumbnail-media-fragment.js
|
|
742
|
+
/** Parse `url#xywh=x,y,w,h` into a URL and optional sprite coordinates. */
|
|
743
|
+
function parseMediaFragment(text, baseURL) {
|
|
744
|
+
const parts = text.trim().split("#");
|
|
745
|
+
const rawURL = parts[0] ?? "";
|
|
746
|
+
const hash = parts[1];
|
|
747
|
+
const url = baseURL ? new URL(rawURL, baseURL).href : rawURL;
|
|
748
|
+
if (!hash) return { url };
|
|
749
|
+
const eqIndex = hash.indexOf("=");
|
|
750
|
+
if (eqIndex === -1) return { url };
|
|
751
|
+
const keys = hash.slice(0, eqIndex);
|
|
752
|
+
const values = hash.slice(eqIndex + 1).split(",").map(Number);
|
|
753
|
+
const data = {};
|
|
754
|
+
for (let i = 0; i < keys.length; i++) {
|
|
755
|
+
const key = keys[i];
|
|
756
|
+
const value = values[i];
|
|
757
|
+
if (key && isNumber(value) && !Number.isNaN(value)) data[key] = value;
|
|
758
|
+
}
|
|
759
|
+
const result = { url };
|
|
760
|
+
if (isNumber(data.w)) result.width = data.w;
|
|
761
|
+
if (isNumber(data.h)) result.height = data.h;
|
|
762
|
+
if (isNumber(data.x) && isNumber(data.y)) result.coords = {
|
|
763
|
+
x: data.x,
|
|
764
|
+
y: data.y
|
|
765
|
+
};
|
|
766
|
+
return result;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Convert an array of text cues (e.g. `VTTCue` from a `<track>` element)
|
|
770
|
+
* into {@link ThumbnailImage} entries by parsing the media-fragment in
|
|
771
|
+
* each cue's text.
|
|
772
|
+
*/
|
|
773
|
+
function mapCuesToThumbnails(cues, baseURL) {
|
|
774
|
+
const images = [];
|
|
775
|
+
for (const cue of cues) {
|
|
776
|
+
const fragment = parseMediaFragment(cue.text, baseURL);
|
|
777
|
+
const image = {
|
|
778
|
+
url: fragment.url,
|
|
779
|
+
startTime: cue.startTime,
|
|
780
|
+
endTime: cue.endTime
|
|
781
|
+
};
|
|
782
|
+
if (fragment.width) image.width = fragment.width;
|
|
783
|
+
if (fragment.height) image.height = fragment.height;
|
|
784
|
+
if (fragment.coords) image.coords = fragment.coords;
|
|
785
|
+
images.push(image);
|
|
786
|
+
}
|
|
787
|
+
return images;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region ../utils/dist/time/format.js
|
|
792
|
+
const UNIT_LABELS = [
|
|
793
|
+
{
|
|
794
|
+
singular: "hour",
|
|
795
|
+
plural: "hours"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
singular: "minute",
|
|
799
|
+
plural: "minutes"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
singular: "second",
|
|
803
|
+
plural: "seconds"
|
|
804
|
+
}
|
|
805
|
+
];
|
|
806
|
+
function isValidTime(value) {
|
|
807
|
+
return isNumber(value) && Number.isFinite(value);
|
|
808
|
+
}
|
|
809
|
+
function toTimeUnitPhrase(value, unitIndex) {
|
|
810
|
+
return `${value} ${value === 1 ? UNIT_LABELS[unitIndex]?.singular : UNIT_LABELS[unitIndex]?.plural}`;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Format seconds to digital display string.
|
|
814
|
+
*
|
|
815
|
+
* @param seconds - Time in seconds (can be negative)
|
|
816
|
+
* @param guide - Guide time (typically duration) to determine display format
|
|
817
|
+
* @returns Formatted string like "1:30" or "1:05:30"
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* formatTime(90) // "1:30"
|
|
821
|
+
* formatTime(3661) // "1:01:01"
|
|
822
|
+
* formatTime(35, 3600) // "0:00:35" (guided by 1-hour duration)
|
|
823
|
+
* formatTime(35, 600) // "00:35" (guided by 10-minute duration)
|
|
824
|
+
*/
|
|
825
|
+
function formatTime(seconds, guide) {
|
|
826
|
+
if (!isValidTime(seconds)) return "0:00";
|
|
827
|
+
const negative = seconds < 0;
|
|
828
|
+
const positiveSeconds = Math.abs(seconds);
|
|
829
|
+
const h = Math.floor(positiveSeconds / 3600);
|
|
830
|
+
const m = Math.floor(positiveSeconds / 60 % 60);
|
|
831
|
+
const s = Math.floor(positiveSeconds % 60);
|
|
832
|
+
const guideAbs = guide ? Math.abs(guide) : 0;
|
|
833
|
+
const gh = Math.floor(guideAbs / 3600);
|
|
834
|
+
const gm = Math.floor(guideAbs / 60 % 60);
|
|
835
|
+
const showHours = h > 0 || gh > 0;
|
|
836
|
+
const padMinutes = showHours || gm >= 10;
|
|
837
|
+
const hoursStr = showHours ? `${h}:` : "";
|
|
838
|
+
const minutesStr = `${padMinutes && m < 10 ? "0" : ""}${m}:`;
|
|
839
|
+
const secondsStr = s < 10 ? `0${s}` : `${s}`;
|
|
840
|
+
return `${negative ? "-" : ""}${hoursStr}${minutesStr}${secondsStr}`;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Format seconds to human-readable phrase for screen readers.
|
|
844
|
+
*
|
|
845
|
+
* @param seconds - Time in seconds (negative indicates remaining)
|
|
846
|
+
* @returns Human-readable phrase like "1 minute, 30 seconds"
|
|
847
|
+
*
|
|
848
|
+
* @example
|
|
849
|
+
* formatTimeAsPhrase(90) // "1 minute, 30 seconds"
|
|
850
|
+
* formatTimeAsPhrase(3661) // "1 hour, 1 minute, 1 second"
|
|
851
|
+
* formatTimeAsPhrase(-270) // "4 minutes, 30 seconds remaining"
|
|
852
|
+
*/
|
|
853
|
+
function formatTimeAsPhrase(seconds) {
|
|
854
|
+
if (!isValidTime(seconds)) return "";
|
|
855
|
+
const negative = seconds < 0;
|
|
856
|
+
const positiveSeconds = Math.abs(seconds);
|
|
857
|
+
const h = Math.floor(positiveSeconds / 3600);
|
|
858
|
+
const m = Math.floor(positiveSeconds / 60 % 60);
|
|
859
|
+
const s = Math.floor(positiveSeconds % 60);
|
|
860
|
+
if (positiveSeconds === 0) return `${toTimeUnitPhrase(0, 2)}${negative ? " remaining" : ""}`;
|
|
861
|
+
return `${[
|
|
862
|
+
h,
|
|
863
|
+
m,
|
|
864
|
+
s
|
|
865
|
+
].map((value, index) => value > 0 ? toTimeUnitPhrase(value, index) : null).filter(Boolean).join(", ")}${negative ? " remaining" : ""}`;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Convert seconds to ISO 8601 duration for datetime attribute.
|
|
869
|
+
*
|
|
870
|
+
* @param seconds - Time in seconds
|
|
871
|
+
* @returns ISO 8601 duration string like "PT1M30S"
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* secondsToIsoDuration(90) // "PT1M30S"
|
|
875
|
+
* secondsToIsoDuration(3661) // "PT1H1M1S"
|
|
876
|
+
*/
|
|
877
|
+
function secondsToIsoDuration(seconds) {
|
|
878
|
+
if (!isValidTime(seconds)) return "PT0S";
|
|
879
|
+
const positiveSeconds = Math.abs(seconds);
|
|
880
|
+
const h = Math.floor(positiveSeconds / 3600);
|
|
881
|
+
const m = Math.floor(positiveSeconds / 60 % 60);
|
|
882
|
+
const s = Math.floor(positiveSeconds % 60);
|
|
883
|
+
let duration = "PT";
|
|
884
|
+
if (h > 0) duration += `${h}H`;
|
|
885
|
+
if (m > 0) duration += `${m}M`;
|
|
886
|
+
if (s > 0 || duration === "PT") duration += `${s}S`;
|
|
887
|
+
return duration;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region ../core/dist/dev/core/ui/time/time-core.js
|
|
892
|
+
const DEFAULT_LABELS = {
|
|
893
|
+
current: "Current time",
|
|
894
|
+
duration: "Duration",
|
|
895
|
+
remaining: "Remaining"
|
|
896
|
+
};
|
|
897
|
+
var TimeCore = class TimeCore {
|
|
898
|
+
static defaultProps = {
|
|
899
|
+
type: "current",
|
|
900
|
+
negativeSign: "-",
|
|
901
|
+
label: ""
|
|
902
|
+
};
|
|
903
|
+
#props = { ...TimeCore.defaultProps };
|
|
904
|
+
#media = null;
|
|
905
|
+
constructor(props) {
|
|
906
|
+
if (props) this.setProps(props);
|
|
907
|
+
}
|
|
908
|
+
setProps(props) {
|
|
909
|
+
this.#props = defaults(props, TimeCore.defaultProps);
|
|
910
|
+
}
|
|
911
|
+
setMedia(media) {
|
|
912
|
+
this.#media = media;
|
|
913
|
+
}
|
|
914
|
+
#getSeconds() {
|
|
915
|
+
const media = this.#media;
|
|
916
|
+
const { type } = this.#props;
|
|
917
|
+
switch (type) {
|
|
918
|
+
case "current": return media.currentTime;
|
|
919
|
+
case "duration": return media.duration;
|
|
920
|
+
case "remaining": return media.currentTime - media.duration;
|
|
921
|
+
default: return 0;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
#getText() {
|
|
925
|
+
const media = this.#media;
|
|
926
|
+
const seconds = this.#getSeconds();
|
|
927
|
+
return formatTime(Math.abs(seconds), media.duration);
|
|
928
|
+
}
|
|
929
|
+
#getPhrase() {
|
|
930
|
+
const { type } = this.#props;
|
|
931
|
+
const seconds = this.#getSeconds();
|
|
932
|
+
if (type === "remaining") return formatTimeAsPhrase(seconds < 0 ? seconds : -Math.abs(seconds));
|
|
933
|
+
return formatTimeAsPhrase(seconds);
|
|
934
|
+
}
|
|
935
|
+
#getDatetime() {
|
|
936
|
+
const seconds = this.#getSeconds();
|
|
937
|
+
return secondsToIsoDuration(Math.abs(seconds));
|
|
938
|
+
}
|
|
939
|
+
getLabel(state) {
|
|
940
|
+
const { label } = this.#props;
|
|
941
|
+
if (isFunction(label)) {
|
|
942
|
+
const customLabel = label(state);
|
|
943
|
+
if (customLabel) return customLabel;
|
|
944
|
+
} else if (label) return label;
|
|
945
|
+
return DEFAULT_LABELS[this.#props.type];
|
|
946
|
+
}
|
|
947
|
+
getAttrs(state) {
|
|
948
|
+
return {
|
|
949
|
+
"aria-label": this.getLabel(state),
|
|
950
|
+
"aria-valuetext": state.phrase
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
getState() {
|
|
954
|
+
const seconds = this.#getSeconds();
|
|
955
|
+
return {
|
|
956
|
+
type: this.#props.type,
|
|
957
|
+
seconds,
|
|
958
|
+
negative: this.#props.type === "remaining" && seconds < 0,
|
|
959
|
+
text: this.#getText(),
|
|
960
|
+
phrase: this.#getPhrase(),
|
|
961
|
+
datetime: this.#getDatetime()
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region ../core/dist/dev/core/ui/time/time-data-attrs.js
|
|
968
|
+
const TimeDataAttrs = { type: "data-type" };
|
|
969
|
+
|
|
970
|
+
//#endregion
|
|
971
|
+
//#region ../core/dist/dev/core/ui/time-slider/time-slider-core.js
|
|
972
|
+
/** Time-domain slider: maps media time/buffer state to slider state. */
|
|
973
|
+
var TimeSliderCore = class TimeSliderCore extends SliderCore {
|
|
974
|
+
static defaultProps = {
|
|
975
|
+
...SliderCore.defaultProps,
|
|
976
|
+
label: "Seek",
|
|
977
|
+
commitThrottle: 100
|
|
978
|
+
};
|
|
979
|
+
#props = { ...TimeSliderCore.defaultProps };
|
|
980
|
+
#media = null;
|
|
981
|
+
constructor(props) {
|
|
982
|
+
super();
|
|
983
|
+
if (props) this.setProps(props);
|
|
984
|
+
}
|
|
985
|
+
setProps(props) {
|
|
986
|
+
this.#props = defaults(props, TimeSliderCore.defaultProps);
|
|
987
|
+
super.setProps({
|
|
988
|
+
...props,
|
|
989
|
+
min: 0
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
setMedia(media) {
|
|
993
|
+
this.#media = media;
|
|
994
|
+
}
|
|
995
|
+
getState() {
|
|
996
|
+
const { duration, currentTime, seeking, buffered } = this.#media;
|
|
997
|
+
const { dragging, dragPercent } = this.input;
|
|
998
|
+
super.setProps({
|
|
999
|
+
...this.#props,
|
|
1000
|
+
min: 0,
|
|
1001
|
+
max: duration
|
|
1002
|
+
});
|
|
1003
|
+
const value = dragging ? clamp(dragPercent / 100 * duration, 0, duration) : currentTime;
|
|
1004
|
+
const base = super.getSliderState(value);
|
|
1005
|
+
const bufferedEnd = buffered.length > 0 ? buffered[buffered.length - 1][1] : 0;
|
|
1006
|
+
const bufferPercent = duration > 0 ? bufferedEnd / duration * 100 : 0;
|
|
1007
|
+
return {
|
|
1008
|
+
...base,
|
|
1009
|
+
currentTime,
|
|
1010
|
+
duration,
|
|
1011
|
+
seeking,
|
|
1012
|
+
bufferPercent
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
getLabel(state) {
|
|
1016
|
+
return super.getLabel(state) || "Seek";
|
|
1017
|
+
}
|
|
1018
|
+
getAttrs(state) {
|
|
1019
|
+
const base = super.getAttrs(state);
|
|
1020
|
+
const currentPhrase = formatTimeAsPhrase(state.value);
|
|
1021
|
+
const durationPhrase = formatTimeAsPhrase(state.duration);
|
|
1022
|
+
const valuetext = durationPhrase ? `${currentPhrase} of ${durationPhrase}` : currentPhrase;
|
|
1023
|
+
return {
|
|
1024
|
+
...base,
|
|
1025
|
+
"aria-valuetext": valuetext
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region ../core/dist/dev/core/ui/time-slider/time-slider-data-attrs.js
|
|
1032
|
+
const TimeSliderDataAttrs = {
|
|
1033
|
+
...SliderDataAttrs,
|
|
1034
|
+
seeking: "data-seeking"
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
//#endregion
|
|
1038
|
+
//#region ../core/dist/dev/core/ui/tooltip/tooltip-core.js
|
|
1039
|
+
var TooltipCore = class TooltipCore {
|
|
1040
|
+
static defaultProps = {
|
|
1041
|
+
side: "top",
|
|
1042
|
+
align: "center",
|
|
1043
|
+
open: false,
|
|
1044
|
+
defaultOpen: false,
|
|
1045
|
+
delay: 600,
|
|
1046
|
+
closeDelay: 0,
|
|
1047
|
+
disableHoverablePopup: true,
|
|
1048
|
+
disabled: false
|
|
1049
|
+
};
|
|
1050
|
+
#props = { ...TooltipCore.defaultProps };
|
|
1051
|
+
constructor(props) {
|
|
1052
|
+
if (props) this.setProps(props);
|
|
1053
|
+
}
|
|
1054
|
+
setProps(props) {
|
|
1055
|
+
this.#props = defaults(props, TooltipCore.defaultProps);
|
|
1056
|
+
}
|
|
1057
|
+
#input = null;
|
|
1058
|
+
setInput(input) {
|
|
1059
|
+
this.#input = input;
|
|
1060
|
+
}
|
|
1061
|
+
getState() {
|
|
1062
|
+
const input = this.#input;
|
|
1063
|
+
return {
|
|
1064
|
+
open: input.active,
|
|
1065
|
+
status: input.status,
|
|
1066
|
+
side: this.#props.side,
|
|
1067
|
+
align: this.#props.align,
|
|
1068
|
+
...getTransitionFlags(input.status)
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
getTriggerAttrs(state, popupId) {
|
|
1072
|
+
return { "aria-describedby": state.open ? popupId : void 0 };
|
|
1073
|
+
}
|
|
1074
|
+
getPopupAttrs(_state) {
|
|
1075
|
+
return {
|
|
1076
|
+
popover: "manual",
|
|
1077
|
+
role: "tooltip"
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region ../core/dist/dev/core/ui/tooltip/tooltip-css-vars.js
|
|
1084
|
+
const TooltipCSSVars = {
|
|
1085
|
+
sideOffset: "--media-tooltip-side-offset",
|
|
1086
|
+
alignOffset: "--media-tooltip-align-offset",
|
|
1087
|
+
anchorWidth: "--media-tooltip-anchor-width",
|
|
1088
|
+
anchorHeight: "--media-tooltip-anchor-height",
|
|
1089
|
+
availableWidth: "--media-tooltip-available-width",
|
|
1090
|
+
availableHeight: "--media-tooltip-available-height"
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region ../core/dist/dev/core/ui/tooltip/tooltip-data-attrs.js
|
|
1095
|
+
const TooltipDataAttrs = {
|
|
1096
|
+
open: "data-open",
|
|
1097
|
+
side: "data-side",
|
|
1098
|
+
align: "data-align",
|
|
1099
|
+
transitionStarting: "data-starting-style",
|
|
1100
|
+
transitionEnding: "data-ending-style"
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region ../core/dist/dev/core/ui/tooltip/tooltip-group-core.js
|
|
1105
|
+
var TooltipGroupCore = class TooltipGroupCore {
|
|
1106
|
+
static defaultProps = {
|
|
1107
|
+
delay: 600,
|
|
1108
|
+
closeDelay: 0,
|
|
1109
|
+
timeout: 400
|
|
1110
|
+
};
|
|
1111
|
+
#props = { ...TooltipGroupCore.defaultProps };
|
|
1112
|
+
#lastCloseTime = 0;
|
|
1113
|
+
#isOpen = false;
|
|
1114
|
+
constructor(props) {
|
|
1115
|
+
if (props) this.setProps(props);
|
|
1116
|
+
}
|
|
1117
|
+
setProps(props) {
|
|
1118
|
+
this.#props = defaults(props, TooltipGroupCore.defaultProps);
|
|
1119
|
+
}
|
|
1120
|
+
get delay() {
|
|
1121
|
+
return this.#props.delay;
|
|
1122
|
+
}
|
|
1123
|
+
get closeDelay() {
|
|
1124
|
+
return this.#props.closeDelay;
|
|
1125
|
+
}
|
|
1126
|
+
shouldSkipDelay() {
|
|
1127
|
+
if (this.#isOpen) return true;
|
|
1128
|
+
return Date.now() - this.#lastCloseTime < this.#props.timeout;
|
|
1129
|
+
}
|
|
1130
|
+
notifyOpen() {
|
|
1131
|
+
this.#isOpen = true;
|
|
1132
|
+
}
|
|
1133
|
+
notifyClose() {
|
|
1134
|
+
this.#isOpen = false;
|
|
1135
|
+
this.#lastCloseTime = Date.now();
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region ../core/dist/dev/core/ui/volume-slider/volume-slider-core.js
|
|
1141
|
+
/** Volume-domain slider: maps media volume/mute state to slider state. */
|
|
1142
|
+
var VolumeSliderCore = class VolumeSliderCore extends SliderCore {
|
|
1143
|
+
static defaultProps = {
|
|
1144
|
+
...SliderCore.defaultProps,
|
|
1145
|
+
label: "Volume"
|
|
1146
|
+
};
|
|
1147
|
+
#media = null;
|
|
1148
|
+
constructor(props) {
|
|
1149
|
+
super();
|
|
1150
|
+
if (props) this.setProps(props);
|
|
1151
|
+
}
|
|
1152
|
+
setProps(props) {
|
|
1153
|
+
super.setProps(defaults(props, VolumeSliderCore.defaultProps));
|
|
1154
|
+
}
|
|
1155
|
+
setMedia(media) {
|
|
1156
|
+
this.#media = media;
|
|
1157
|
+
}
|
|
1158
|
+
getState() {
|
|
1159
|
+
const media = this.#media;
|
|
1160
|
+
const { volume, muted } = media;
|
|
1161
|
+
const effectivelyMuted = muted || volume === 0;
|
|
1162
|
+
const { dragging, dragPercent } = this.input;
|
|
1163
|
+
const volumePercent = volume * 100;
|
|
1164
|
+
const value = dragging ? this.valueFromPercent(dragPercent) : volumePercent;
|
|
1165
|
+
const base = super.getSliderState(value);
|
|
1166
|
+
return {
|
|
1167
|
+
...base,
|
|
1168
|
+
fillPercent: effectivelyMuted ? 0 : base.fillPercent,
|
|
1169
|
+
volume,
|
|
1170
|
+
muted: effectivelyMuted,
|
|
1171
|
+
availability: media.volumeAvailability
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
getLabel(state) {
|
|
1175
|
+
return super.getLabel(state) || "Volume";
|
|
1176
|
+
}
|
|
1177
|
+
getAttrs(state) {
|
|
1178
|
+
const base = super.getAttrs(state);
|
|
1179
|
+
const valuetext = `${Math.round(state.value)} percent${state.muted ? ", muted" : ""}`;
|
|
1180
|
+
return {
|
|
1181
|
+
...base,
|
|
1182
|
+
"aria-valuetext": valuetext
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region ../core/dist/dev/core/ui/volume-slider/volume-slider-data-attrs.js
|
|
1189
|
+
const VolumeSliderDataAttrs = {
|
|
1190
|
+
...SliderDataAttrs,
|
|
1191
|
+
availability: "data-availability"
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/ui/media-button-element.ts
|
|
1196
|
+
/** Abstract base for HTML custom elements that render a media-control button. */
|
|
1197
|
+
var MediaButtonElement = class extends MediaElement {
|
|
1198
|
+
constructor(..._args) {
|
|
1199
|
+
super(..._args);
|
|
1200
|
+
this.disabled = false;
|
|
1201
|
+
this.label = "";
|
|
1202
|
+
}
|
|
1203
|
+
static {
|
|
1204
|
+
this.properties = {
|
|
1205
|
+
label: { type: String },
|
|
1206
|
+
disabled: { type: Boolean }
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
#disconnect = null;
|
|
1210
|
+
connectedCallback() {
|
|
1211
|
+
super.connectedCallback();
|
|
1212
|
+
this.#disconnect = new AbortController();
|
|
1213
|
+
const buttonProps = createButton({
|
|
1214
|
+
onActivate: () => this.activate(this.mediaState.value),
|
|
1215
|
+
isDisabled: () => this.disabled || !this.mediaState.value
|
|
1216
|
+
});
|
|
1217
|
+
applyElementProps(this, buttonProps, { signal: this.#disconnect.signal });
|
|
1218
|
+
if (!this.mediaState.value && this.mediaState.displayName) logMissingFeature(this.localName, this.mediaState.displayName);
|
|
1219
|
+
}
|
|
1220
|
+
disconnectedCallback() {
|
|
1221
|
+
super.disconnectedCallback();
|
|
1222
|
+
this.#disconnect?.abort();
|
|
1223
|
+
this.#disconnect = null;
|
|
1224
|
+
}
|
|
1225
|
+
willUpdate(changed) {
|
|
1226
|
+
super.willUpdate(changed);
|
|
1227
|
+
this.core.setProps?.(this);
|
|
1228
|
+
}
|
|
1229
|
+
update(changed) {
|
|
1230
|
+
super.update(changed);
|
|
1231
|
+
const media = this.mediaState.value;
|
|
1232
|
+
if (!media) return;
|
|
1233
|
+
this.core.setMedia(media);
|
|
1234
|
+
const state = this.core.getState();
|
|
1235
|
+
applyElementProps(this, this.core.getAttrs?.(state) ?? {});
|
|
1236
|
+
applyStateDataAttrs(this, state, this.stateAttrMap);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/ui/context-part-element.ts
|
|
1242
|
+
/**
|
|
1243
|
+
* Abstract base for compound-component part elements that consume a parent
|
|
1244
|
+
* context and apply data attributes from `ctx.state` + `ctx.stateAttrMap`.
|
|
1245
|
+
*
|
|
1246
|
+
* Subclasses only need to declare the `consumer` property:
|
|
1247
|
+
*
|
|
1248
|
+
* ```ts
|
|
1249
|
+
* export class SliderTrackElement extends ContextPartElement<SliderState> {
|
|
1250
|
+
* static readonly tagName = 'media-slider-track';
|
|
1251
|
+
* protected readonly consumer = new ContextConsumer(this, { context: sliderContext, subscribe: true });
|
|
1252
|
+
* }
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
var ContextPartElement = class extends MediaElement {
|
|
1256
|
+
update(_changed) {
|
|
1257
|
+
super.update(_changed);
|
|
1258
|
+
const ctx = this.consumer.value;
|
|
1259
|
+
if (ctx) applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
//#endregion
|
|
1264
|
+
//#region src/ui/mute-button/mute-button-element.ts
|
|
1265
|
+
var MuteButtonElement = class extends MediaButtonElement {
|
|
1266
|
+
constructor(..._args) {
|
|
1267
|
+
super(..._args);
|
|
1268
|
+
this.core = new MuteButtonCore();
|
|
1269
|
+
this.stateAttrMap = MuteButtonDataAttrs;
|
|
1270
|
+
this.mediaState = new PlayerController(this, playerContext, selectVolume);
|
|
1271
|
+
}
|
|
1272
|
+
static {
|
|
1273
|
+
this.tagName = "media-mute-button";
|
|
1274
|
+
}
|
|
1275
|
+
activate(state) {
|
|
1276
|
+
this.core.toggle(state);
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/define/ui/mute-button.ts
|
|
1282
|
+
safeDefine(MuteButtonElement);
|
|
1283
|
+
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region src/ui/play-button/play-button-element.ts
|
|
1286
|
+
var PlayButtonElement = class extends MediaButtonElement {
|
|
1287
|
+
constructor(..._args) {
|
|
1288
|
+
super(..._args);
|
|
1289
|
+
this.core = new PlayButtonCore();
|
|
1290
|
+
this.stateAttrMap = PlayButtonDataAttrs;
|
|
1291
|
+
this.mediaState = new PlayerController(this, playerContext, selectPlayback);
|
|
1292
|
+
}
|
|
1293
|
+
static {
|
|
1294
|
+
this.tagName = "media-play-button";
|
|
1295
|
+
}
|
|
1296
|
+
activate(state) {
|
|
1297
|
+
this.core.toggle(state);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region src/define/ui/play-button.ts
|
|
1303
|
+
safeDefine(PlayButtonElement);
|
|
1304
|
+
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/ui/playback-rate-button/playback-rate-button-element.ts
|
|
1307
|
+
var PlaybackRateButtonElement = class extends MediaButtonElement {
|
|
1308
|
+
constructor(..._args) {
|
|
1309
|
+
super(..._args);
|
|
1310
|
+
this.core = new PlaybackRateButtonCore();
|
|
1311
|
+
this.stateAttrMap = PlaybackRateButtonDataAttrs;
|
|
1312
|
+
this.mediaState = new PlayerController(this, playerContext, selectPlaybackRate);
|
|
1313
|
+
}
|
|
1314
|
+
static {
|
|
1315
|
+
this.tagName = "media-playback-rate-button";
|
|
1316
|
+
}
|
|
1317
|
+
activate(state) {
|
|
1318
|
+
this.core.cycle(state);
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region src/define/ui/playback-rate-button.ts
|
|
1324
|
+
safeDefine(PlaybackRateButtonElement);
|
|
1325
|
+
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region src/ui/popover/popover-element.ts
|
|
1328
|
+
var PopoverElement = class extends MediaElement {
|
|
1329
|
+
constructor(..._args) {
|
|
1330
|
+
super(..._args);
|
|
1331
|
+
this.open = PopoverCore.defaultProps.open;
|
|
1332
|
+
this.defaultOpen = PopoverCore.defaultProps.defaultOpen;
|
|
1333
|
+
this.side = PopoverCore.defaultProps.side;
|
|
1334
|
+
this.align = PopoverCore.defaultProps.align;
|
|
1335
|
+
this.modal = PopoverCore.defaultProps.modal;
|
|
1336
|
+
this.closeOnEscape = PopoverCore.defaultProps.closeOnEscape;
|
|
1337
|
+
this.closeOnOutsideClick = PopoverCore.defaultProps.closeOnOutsideClick;
|
|
1338
|
+
this.openOnHover = PopoverCore.defaultProps.openOnHover;
|
|
1339
|
+
this.delay = PopoverCore.defaultProps.delay;
|
|
1340
|
+
this.closeDelay = PopoverCore.defaultProps.closeDelay;
|
|
1341
|
+
}
|
|
1342
|
+
static {
|
|
1343
|
+
this.tagName = "media-popover";
|
|
1344
|
+
}
|
|
1345
|
+
static {
|
|
1346
|
+
this.properties = {
|
|
1347
|
+
open: { type: Boolean },
|
|
1348
|
+
defaultOpen: {
|
|
1349
|
+
type: Boolean,
|
|
1350
|
+
attribute: "default-open"
|
|
1351
|
+
},
|
|
1352
|
+
side: { type: String },
|
|
1353
|
+
align: { type: String },
|
|
1354
|
+
modal: { type: Boolean },
|
|
1355
|
+
closeOnEscape: {
|
|
1356
|
+
type: Boolean,
|
|
1357
|
+
attribute: "close-on-escape"
|
|
1358
|
+
},
|
|
1359
|
+
closeOnOutsideClick: {
|
|
1360
|
+
type: Boolean,
|
|
1361
|
+
attribute: "close-on-outside-click"
|
|
1362
|
+
},
|
|
1363
|
+
openOnHover: {
|
|
1364
|
+
type: Boolean,
|
|
1365
|
+
attribute: "open-on-hover"
|
|
1366
|
+
},
|
|
1367
|
+
delay: { type: Number },
|
|
1368
|
+
closeDelay: {
|
|
1369
|
+
type: Number,
|
|
1370
|
+
attribute: "close-delay"
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
#core = new PopoverCore();
|
|
1375
|
+
#popover = null;
|
|
1376
|
+
#snapshot = null;
|
|
1377
|
+
#disconnect = null;
|
|
1378
|
+
#triggerAbort = null;
|
|
1379
|
+
#currentTrigger = null;
|
|
1380
|
+
#positionAbort = null;
|
|
1381
|
+
#positionFrame = 0;
|
|
1382
|
+
#resizeObserver = null;
|
|
1383
|
+
#positionTrigger = null;
|
|
1384
|
+
connectedCallback() {
|
|
1385
|
+
super.connectedCallback();
|
|
1386
|
+
if (this.destroyed) return;
|
|
1387
|
+
this.#disconnect = new AbortController();
|
|
1388
|
+
this.#popover = createPopover({
|
|
1389
|
+
transition: createTransition(),
|
|
1390
|
+
onOpenChange: (nextOpen, details) => {
|
|
1391
|
+
this.open = nextOpen;
|
|
1392
|
+
this.dispatchEvent(new CustomEvent("open-change", { detail: {
|
|
1393
|
+
open: nextOpen,
|
|
1394
|
+
...details
|
|
1395
|
+
} }));
|
|
1396
|
+
},
|
|
1397
|
+
closeOnEscape: () => this.closeOnEscape,
|
|
1398
|
+
closeOnOutsideClick: () => this.closeOnOutsideClick,
|
|
1399
|
+
openOnHover: () => this.openOnHover,
|
|
1400
|
+
delay: () => this.delay,
|
|
1401
|
+
closeDelay: () => this.closeDelay
|
|
1402
|
+
});
|
|
1403
|
+
this.#popover.setPopupElement(this);
|
|
1404
|
+
applyElementProps(this, this.#popover.popupProps, { signal: this.#disconnect.signal });
|
|
1405
|
+
if (this.#snapshot) this.#snapshot.track(this.#popover.input);
|
|
1406
|
+
else this.#snapshot = new SnapshotController(this, this.#popover.input);
|
|
1407
|
+
}
|
|
1408
|
+
firstUpdated(changed) {
|
|
1409
|
+
super.firstUpdated(changed);
|
|
1410
|
+
if (this.defaultOpen && !this.open) this.#popover?.open();
|
|
1411
|
+
}
|
|
1412
|
+
disconnectedCallback() {
|
|
1413
|
+
super.disconnectedCallback();
|
|
1414
|
+
this.#cleanupPositioning();
|
|
1415
|
+
this.#disconnect?.abort();
|
|
1416
|
+
this.#disconnect = null;
|
|
1417
|
+
}
|
|
1418
|
+
destroyCallback() {
|
|
1419
|
+
this.#cleanupPositioning();
|
|
1420
|
+
this.#cleanupTrigger();
|
|
1421
|
+
this.#popover?.destroy();
|
|
1422
|
+
super.destroyCallback();
|
|
1423
|
+
}
|
|
1424
|
+
willUpdate(changed) {
|
|
1425
|
+
super.willUpdate(changed);
|
|
1426
|
+
this.#core.setProps(this);
|
|
1427
|
+
if (this.#popover && changed.has("open")) {
|
|
1428
|
+
const { active: interactionOpen } = this.#popover.input.current;
|
|
1429
|
+
if (this.open !== interactionOpen) if (this.open) this.#popover.open();
|
|
1430
|
+
else this.#popover.close();
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
update(_changed) {
|
|
1434
|
+
super.update(_changed);
|
|
1435
|
+
if (!this.#popover) return;
|
|
1436
|
+
const triggerEl = this.#findTrigger();
|
|
1437
|
+
this.#syncTrigger(triggerEl);
|
|
1438
|
+
const input = this.#popover.input.current;
|
|
1439
|
+
this.#core.setInput(input);
|
|
1440
|
+
const state = this.#core.getState();
|
|
1441
|
+
applyElementProps(this, this.#core.getPopupAttrs(state));
|
|
1442
|
+
applyStateDataAttrs(this, state, PopoverDataAttrs);
|
|
1443
|
+
if (state.open) tryShowPopover(this);
|
|
1444
|
+
else tryHidePopover(this);
|
|
1445
|
+
if (this.#currentTrigger) {
|
|
1446
|
+
applyElementProps(this.#currentTrigger, this.#core.getTriggerAttrs(state, this.id));
|
|
1447
|
+
applyStyles(this.#currentTrigger, getAnchorNameStyle(this.id));
|
|
1448
|
+
}
|
|
1449
|
+
if (!state.open) {
|
|
1450
|
+
this.#cleanupPositioning();
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
const posOpts = {
|
|
1454
|
+
side: state.side,
|
|
1455
|
+
align: state.align
|
|
1456
|
+
};
|
|
1457
|
+
if (supportsAnchorPositioning()) applyStyles(this, getAnchorPositionStyle(this.id, posOpts));
|
|
1458
|
+
else {
|
|
1459
|
+
const triggerRect = this.#currentTrigger?.getBoundingClientRect();
|
|
1460
|
+
const selfRect = getPopupPositionRect(this);
|
|
1461
|
+
const boundaryRect = document.documentElement.getBoundingClientRect();
|
|
1462
|
+
const offsets = resolveOffsets(this);
|
|
1463
|
+
applyStyles(this, getAnchorPositionStyle(this.id, posOpts, triggerRect, selfRect, boundaryRect, offsets));
|
|
1464
|
+
}
|
|
1465
|
+
this.#syncPositioning();
|
|
1466
|
+
}
|
|
1467
|
+
#findTrigger() {
|
|
1468
|
+
if (!this.id) return null;
|
|
1469
|
+
return this.getRootNode().querySelector(`[commandfor="${this.id}"]`);
|
|
1470
|
+
}
|
|
1471
|
+
#syncTrigger(triggerEl) {
|
|
1472
|
+
if (triggerEl === this.#currentTrigger) return;
|
|
1473
|
+
this.#cleanupPositioning();
|
|
1474
|
+
this.#cleanupTrigger();
|
|
1475
|
+
this.#currentTrigger = triggerEl;
|
|
1476
|
+
this.#popover?.setTriggerElement(triggerEl);
|
|
1477
|
+
if (triggerEl && this.#popover) {
|
|
1478
|
+
this.#triggerAbort = new AbortController();
|
|
1479
|
+
applyElementProps(triggerEl, this.#popover.triggerProps, { signal: this.#triggerAbort.signal });
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
#cleanupTrigger() {
|
|
1483
|
+
if (this.#currentTrigger) {
|
|
1484
|
+
applyElementProps(this.#currentTrigger, {
|
|
1485
|
+
"aria-expanded": void 0,
|
|
1486
|
+
"aria-haspopup": void 0,
|
|
1487
|
+
"aria-controls": void 0
|
|
1488
|
+
});
|
|
1489
|
+
this.#currentTrigger.style.removeProperty("anchor-name");
|
|
1490
|
+
}
|
|
1491
|
+
this.#triggerAbort?.abort();
|
|
1492
|
+
this.#triggerAbort = null;
|
|
1493
|
+
this.#currentTrigger = null;
|
|
1494
|
+
}
|
|
1495
|
+
#syncPositioning() {
|
|
1496
|
+
if (supportsAnchorPositioning()) return;
|
|
1497
|
+
const triggerEl = this.#currentTrigger;
|
|
1498
|
+
if (!triggerEl) return;
|
|
1499
|
+
if (this.#positionAbort && this.#positionTrigger === triggerEl) return;
|
|
1500
|
+
this.#cleanupPositioning();
|
|
1501
|
+
this.#positionAbort = new AbortController();
|
|
1502
|
+
this.#positionTrigger = triggerEl;
|
|
1503
|
+
const { signal } = this.#positionAbort;
|
|
1504
|
+
const reposition = () => {
|
|
1505
|
+
cancelAnimationFrame(this.#positionFrame);
|
|
1506
|
+
this.#positionFrame = requestAnimationFrame(() => {
|
|
1507
|
+
if (signal.aborted) return;
|
|
1508
|
+
this.requestUpdate();
|
|
1509
|
+
});
|
|
1510
|
+
};
|
|
1511
|
+
window.addEventListener("scroll", reposition, {
|
|
1512
|
+
capture: true,
|
|
1513
|
+
passive: true,
|
|
1514
|
+
signal
|
|
1515
|
+
});
|
|
1516
|
+
window.addEventListener("resize", reposition, { signal });
|
|
1517
|
+
if (typeof ResizeObserver === "function") {
|
|
1518
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
1519
|
+
reposition();
|
|
1520
|
+
});
|
|
1521
|
+
this.#resizeObserver.observe(triggerEl);
|
|
1522
|
+
this.#resizeObserver.observe(this);
|
|
1523
|
+
}
|
|
1524
|
+
reposition();
|
|
1525
|
+
}
|
|
1526
|
+
#cleanupPositioning() {
|
|
1527
|
+
this.#positionAbort?.abort();
|
|
1528
|
+
this.#positionAbort = null;
|
|
1529
|
+
this.#positionTrigger = null;
|
|
1530
|
+
cancelAnimationFrame(this.#positionFrame);
|
|
1531
|
+
this.#positionFrame = 0;
|
|
1532
|
+
this.#resizeObserver?.disconnect();
|
|
1533
|
+
this.#resizeObserver = null;
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
//#endregion
|
|
1538
|
+
//#region src/define/ui/popover.ts
|
|
1539
|
+
safeDefine(PopoverElement);
|
|
1540
|
+
|
|
1541
|
+
//#endregion
|
|
1542
|
+
//#region src/ui/seek-button/seek-button-element.ts
|
|
1543
|
+
var SeekButtonElement = class extends MediaButtonElement {
|
|
1544
|
+
constructor(..._args) {
|
|
1545
|
+
super(..._args);
|
|
1546
|
+
this.seconds = SeekButtonCore.defaultProps.seconds;
|
|
1547
|
+
this.core = new SeekButtonCore();
|
|
1548
|
+
this.stateAttrMap = SeekButtonDataAttrs;
|
|
1549
|
+
this.mediaState = new PlayerController(this, playerContext, selectTime);
|
|
1550
|
+
}
|
|
1551
|
+
static {
|
|
1552
|
+
this.tagName = "media-seek-button";
|
|
1553
|
+
}
|
|
1554
|
+
static {
|
|
1555
|
+
this.properties = {
|
|
1556
|
+
...MediaButtonElement.properties,
|
|
1557
|
+
seconds: { type: Number }
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
activate(state) {
|
|
1561
|
+
this.core.seek(state);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/define/ui/seek-button.ts
|
|
1567
|
+
safeDefine(SeekButtonElement);
|
|
1568
|
+
|
|
1569
|
+
//#endregion
|
|
1570
|
+
//#region src/ui/time/time-element.ts
|
|
1571
|
+
var TimeElement = class extends MediaElement {
|
|
1572
|
+
static {
|
|
1573
|
+
this.tagName = "media-time";
|
|
1574
|
+
}
|
|
1575
|
+
static {
|
|
1576
|
+
this.properties = {
|
|
1577
|
+
type: { type: String },
|
|
1578
|
+
negativeSign: {
|
|
1579
|
+
type: String,
|
|
1580
|
+
attribute: "negative-sign"
|
|
1581
|
+
},
|
|
1582
|
+
label: { type: String }
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
#core = new TimeCore();
|
|
1586
|
+
#state = new PlayerController(this, playerContext, selectTime);
|
|
1587
|
+
#signSpan = document.createElement("span");
|
|
1588
|
+
#textNode = document.createTextNode("");
|
|
1589
|
+
constructor() {
|
|
1590
|
+
super();
|
|
1591
|
+
this.type = TimeCore.defaultProps.type;
|
|
1592
|
+
this.negativeSign = TimeCore.defaultProps.negativeSign;
|
|
1593
|
+
this.label = TimeCore.defaultProps.label;
|
|
1594
|
+
this.#signSpan.setAttribute("aria-hidden", "true");
|
|
1595
|
+
this.#signSpan.hidden = true;
|
|
1596
|
+
this.appendChild(this.#signSpan);
|
|
1597
|
+
this.appendChild(this.#textNode);
|
|
1598
|
+
}
|
|
1599
|
+
connectedCallback() {
|
|
1600
|
+
super.connectedCallback();
|
|
1601
|
+
if (!this.#state.value) logMissingFeature(this.localName, this.#state.displayName);
|
|
1602
|
+
}
|
|
1603
|
+
willUpdate(changed) {
|
|
1604
|
+
super.willUpdate(changed);
|
|
1605
|
+
this.#core.setProps(this);
|
|
1606
|
+
}
|
|
1607
|
+
update(changed) {
|
|
1608
|
+
super.update(changed);
|
|
1609
|
+
const media = this.#state.value;
|
|
1610
|
+
if (!media) return;
|
|
1611
|
+
this.#core.setMedia(media);
|
|
1612
|
+
const state = this.#core.getState();
|
|
1613
|
+
this.#signSpan.hidden = !state.negative;
|
|
1614
|
+
this.#signSpan.textContent = state.negative ? this.negativeSign : "";
|
|
1615
|
+
this.#textNode.textContent = state.text;
|
|
1616
|
+
applyElementProps(this, this.#core.getAttrs(state));
|
|
1617
|
+
applyStateDataAttrs(this, state, TimeDataAttrs);
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
//#endregion
|
|
1622
|
+
//#region src/ui/time/time-group-element.ts
|
|
1623
|
+
var TimeGroupElement = class extends MediaElement {
|
|
1624
|
+
static {
|
|
1625
|
+
this.tagName = "media-time-group";
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region src/ui/time/time-separator-element.ts
|
|
1631
|
+
var TimeSeparatorElement = class extends MediaElement {
|
|
1632
|
+
static {
|
|
1633
|
+
this.tagName = "media-time-separator";
|
|
1634
|
+
}
|
|
1635
|
+
connectedCallback() {
|
|
1636
|
+
super.connectedCallback();
|
|
1637
|
+
this.setAttribute("aria-hidden", "true");
|
|
1638
|
+
if (!this.textContent?.trim()) this.textContent = "/";
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region src/define/ui/time.ts
|
|
1644
|
+
safeDefine(TimeElement);
|
|
1645
|
+
safeDefine(TimeGroupElement);
|
|
1646
|
+
safeDefine(TimeSeparatorElement);
|
|
1647
|
+
|
|
1648
|
+
//#endregion
|
|
1649
|
+
//#region src/ui/slider/context.ts
|
|
1650
|
+
const SLIDER_CONTEXT_KEY = Symbol("@videojs/slider");
|
|
1651
|
+
const sliderContext = createContext(SLIDER_CONTEXT_KEY);
|
|
1652
|
+
|
|
1653
|
+
//#endregion
|
|
1654
|
+
//#region src/ui/slider/slider-buffer-element.ts
|
|
1655
|
+
var SliderBufferElement = class extends ContextPartElement {
|
|
1656
|
+
constructor(..._args) {
|
|
1657
|
+
super(..._args);
|
|
1658
|
+
this.consumer = new ContextConsumer(this, {
|
|
1659
|
+
context: sliderContext,
|
|
1660
|
+
subscribe: true
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
static {
|
|
1664
|
+
this.tagName = "media-slider-buffer";
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
//#endregion
|
|
1669
|
+
//#region src/ui/slider/slider-fill-element.ts
|
|
1670
|
+
var SliderFillElement = class extends ContextPartElement {
|
|
1671
|
+
constructor(..._args) {
|
|
1672
|
+
super(..._args);
|
|
1673
|
+
this.consumer = new ContextConsumer(this, {
|
|
1674
|
+
context: sliderContext,
|
|
1675
|
+
subscribe: true
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
static {
|
|
1679
|
+
this.tagName = "media-slider-fill";
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
//#endregion
|
|
1684
|
+
//#region src/ui/slider/slider-preview-element.ts
|
|
1685
|
+
var SliderPreviewElement = class extends MediaElement {
|
|
1686
|
+
constructor(..._args) {
|
|
1687
|
+
super(..._args);
|
|
1688
|
+
this.overflow = "clamp";
|
|
1689
|
+
}
|
|
1690
|
+
static {
|
|
1691
|
+
this.tagName = "media-slider-preview";
|
|
1692
|
+
}
|
|
1693
|
+
static {
|
|
1694
|
+
this.properties = { overflow: { type: String } };
|
|
1695
|
+
}
|
|
1696
|
+
#ctx = new ContextConsumer(this, {
|
|
1697
|
+
context: sliderContext,
|
|
1698
|
+
subscribe: true
|
|
1699
|
+
});
|
|
1700
|
+
#resizeObserver = null;
|
|
1701
|
+
#width = 0;
|
|
1702
|
+
connectedCallback() {
|
|
1703
|
+
super.connectedCallback();
|
|
1704
|
+
this.#resizeObserver = new ResizeObserver(([entry]) => {
|
|
1705
|
+
this.#width = entry.contentRect.width;
|
|
1706
|
+
this.#applyPosition();
|
|
1707
|
+
});
|
|
1708
|
+
this.#resizeObserver.observe(this);
|
|
1709
|
+
}
|
|
1710
|
+
disconnectedCallback() {
|
|
1711
|
+
super.disconnectedCallback();
|
|
1712
|
+
this.#resizeObserver?.disconnect();
|
|
1713
|
+
this.#resizeObserver = null;
|
|
1714
|
+
}
|
|
1715
|
+
#applyPosition() {
|
|
1716
|
+
applyStyles(this, getSliderPreviewStyle(this.#width, this.overflow));
|
|
1717
|
+
}
|
|
1718
|
+
update(_changed) {
|
|
1719
|
+
super.update(_changed);
|
|
1720
|
+
const ctx = this.#ctx.value;
|
|
1721
|
+
if (ctx) applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
|
|
1722
|
+
this.#applyPosition();
|
|
1723
|
+
}
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
//#endregion
|
|
1727
|
+
//#region src/ui/slider/slider-thumb-element.ts
|
|
1728
|
+
var SliderThumbElement = class extends MediaElement {
|
|
1729
|
+
static {
|
|
1730
|
+
this.tagName = "media-slider-thumb";
|
|
1731
|
+
}
|
|
1732
|
+
#ctx = new ContextConsumer(this, {
|
|
1733
|
+
context: sliderContext,
|
|
1734
|
+
subscribe: true
|
|
1735
|
+
});
|
|
1736
|
+
#disconnect = null;
|
|
1737
|
+
#thumbPropsApplied = false;
|
|
1738
|
+
connectedCallback() {
|
|
1739
|
+
super.connectedCallback();
|
|
1740
|
+
this.#disconnect = new AbortController();
|
|
1741
|
+
this.#thumbPropsApplied = false;
|
|
1742
|
+
}
|
|
1743
|
+
disconnectedCallback() {
|
|
1744
|
+
super.disconnectedCallback();
|
|
1745
|
+
this.#disconnect?.abort();
|
|
1746
|
+
this.#disconnect = null;
|
|
1747
|
+
this.#thumbPropsApplied = false;
|
|
1748
|
+
}
|
|
1749
|
+
update(_changed) {
|
|
1750
|
+
super.update(_changed);
|
|
1751
|
+
const ctx = this.#ctx.value;
|
|
1752
|
+
if (!ctx) return;
|
|
1753
|
+
if (!this.#thumbPropsApplied && this.#disconnect) {
|
|
1754
|
+
applyElementProps(this, ctx.thumbProps, { signal: this.#disconnect.signal });
|
|
1755
|
+
this.#thumbPropsApplied = true;
|
|
1756
|
+
}
|
|
1757
|
+
applyElementProps(this, ctx.thumbAttrs);
|
|
1758
|
+
applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1762
|
+
//#endregion
|
|
1763
|
+
//#region src/ui/thumbnail/thumbnail-element.ts
|
|
1764
|
+
const SHADOW_CSS = `\
|
|
1765
|
+
:host {
|
|
1766
|
+
display: inline-block;
|
|
1767
|
+
overflow: hidden;
|
|
1768
|
+
}
|
|
1769
|
+
img {
|
|
1770
|
+
display: block;
|
|
1771
|
+
}`;
|
|
1772
|
+
var ThumbnailElement = class extends MediaElement {
|
|
1773
|
+
static {
|
|
1774
|
+
this.tagName = "media-thumbnail";
|
|
1775
|
+
}
|
|
1776
|
+
static {
|
|
1777
|
+
this.properties = {
|
|
1778
|
+
time: { type: Number },
|
|
1779
|
+
crossOrigin: {
|
|
1780
|
+
type: String,
|
|
1781
|
+
attribute: "crossorigin"
|
|
1782
|
+
},
|
|
1783
|
+
loading: { type: String },
|
|
1784
|
+
fetchPriority: {
|
|
1785
|
+
type: String,
|
|
1786
|
+
attribute: "fetchpriority"
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
#core = new ThumbnailCore();
|
|
1791
|
+
#img = document.createElement("img");
|
|
1792
|
+
#textTracks = new PlayerController(this, playerContext, selectTextTrack);
|
|
1793
|
+
#thumbnails = [];
|
|
1794
|
+
#externalThumbnails;
|
|
1795
|
+
#lastTextTrack;
|
|
1796
|
+
#api = null;
|
|
1797
|
+
constructor() {
|
|
1798
|
+
super();
|
|
1799
|
+
this.time = 0;
|
|
1800
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
1801
|
+
const style = document.createElement("style");
|
|
1802
|
+
style.textContent = SHADOW_CSS;
|
|
1803
|
+
shadow.appendChild(style);
|
|
1804
|
+
this.#img.alt = "";
|
|
1805
|
+
this.#img.setAttribute("part", "img");
|
|
1806
|
+
this.#img.setAttribute("aria-hidden", "true");
|
|
1807
|
+
this.#img.setAttribute("decoding", "async");
|
|
1808
|
+
shadow.appendChild(this.#img);
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Set thumbnail images directly, bypassing the automatic `<track>` detection.
|
|
1812
|
+
* When set, this takes priority over the text track path.
|
|
1813
|
+
*/
|
|
1814
|
+
get thumbnails() {
|
|
1815
|
+
return this.#externalThumbnails;
|
|
1816
|
+
}
|
|
1817
|
+
set thumbnails(value) {
|
|
1818
|
+
this.#externalThumbnails = value;
|
|
1819
|
+
this.requestUpdate();
|
|
1820
|
+
}
|
|
1821
|
+
connectedCallback() {
|
|
1822
|
+
super.connectedCallback();
|
|
1823
|
+
if (this.destroyed) return;
|
|
1824
|
+
this.#api = createThumbnail({
|
|
1825
|
+
getContainer: () => this,
|
|
1826
|
+
getImg: () => this.#img,
|
|
1827
|
+
onStateChange: () => this.requestUpdate()
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
disconnectedCallback() {
|
|
1831
|
+
super.disconnectedCallback();
|
|
1832
|
+
}
|
|
1833
|
+
destroyCallback() {
|
|
1834
|
+
this.#api?.destroy();
|
|
1835
|
+
super.destroyCallback();
|
|
1836
|
+
}
|
|
1837
|
+
update(changed) {
|
|
1838
|
+
super.update(changed);
|
|
1839
|
+
if (this.#externalThumbnails) this.#thumbnails = this.#externalThumbnails;
|
|
1840
|
+
else {
|
|
1841
|
+
const textTrack = this.#textTracks.value;
|
|
1842
|
+
if (textTrack !== this.#lastTextTrack) {
|
|
1843
|
+
this.#lastTextTrack = textTrack;
|
|
1844
|
+
this.#thumbnails = textTrack && textTrack.thumbnailCues.length > 0 ? mapCuesToThumbnails(textTrack.thumbnailCues, textTrack.thumbnailTrackSrc ?? void 0) : [];
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
const thumbnail = this.#core.findActiveThumbnail(this.#thumbnails, this.time);
|
|
1848
|
+
applyElementProps(this.#img, {
|
|
1849
|
+
crossorigin: this.crossOrigin || void 0,
|
|
1850
|
+
loading: this.loading,
|
|
1851
|
+
fetchpriority: this.fetchPriority
|
|
1852
|
+
});
|
|
1853
|
+
this.#api?.updateSrc(thumbnail?.url);
|
|
1854
|
+
if (!thumbnail) {
|
|
1855
|
+
this.#img.removeAttribute("src");
|
|
1856
|
+
this.#resetStyles();
|
|
1857
|
+
const state = this.#core.getState(false, false, void 0);
|
|
1858
|
+
applyElementProps(this, this.#core.getAttrs(state));
|
|
1859
|
+
applyStateDataAttrs(this, state, ThumbnailDataAttrs);
|
|
1860
|
+
return;
|
|
1861
|
+
}
|
|
1862
|
+
if (this.#img.getAttribute("src") !== thumbnail.url) this.#img.src = thumbnail.url;
|
|
1863
|
+
const api = this.#api;
|
|
1864
|
+
const state = this.#core.getState(api?.loading ?? false, api?.error ?? false, thumbnail);
|
|
1865
|
+
applyElementProps(this, this.#core.getAttrs(state));
|
|
1866
|
+
applyStateDataAttrs(this, state, ThumbnailDataAttrs);
|
|
1867
|
+
if (api?.naturalWidth && api.naturalHeight) {
|
|
1868
|
+
const constraints = api.readConstraints();
|
|
1869
|
+
const result = this.#core.resize(thumbnail, api.naturalWidth, api.naturalHeight, constraints);
|
|
1870
|
+
if (result) this.#applyResize(result);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
#applyResize(result) {
|
|
1874
|
+
this.style.width = `${result.containerWidth}px`;
|
|
1875
|
+
this.style.height = `${result.containerHeight}px`;
|
|
1876
|
+
const imgStyle = this.#img.style;
|
|
1877
|
+
imgStyle.width = `${result.imageWidth}px`;
|
|
1878
|
+
imgStyle.height = `${result.imageHeight}px`;
|
|
1879
|
+
imgStyle.maxWidth = "none";
|
|
1880
|
+
imgStyle.transform = result.offsetX || result.offsetY ? `translate(-${result.offsetX}px, -${result.offsetY}px)` : "";
|
|
1881
|
+
}
|
|
1882
|
+
#resetStyles() {
|
|
1883
|
+
this.style.width = "";
|
|
1884
|
+
this.style.height = "";
|
|
1885
|
+
const imgStyle = this.#img.style;
|
|
1886
|
+
imgStyle.width = "";
|
|
1887
|
+
imgStyle.height = "";
|
|
1888
|
+
imgStyle.maxWidth = "";
|
|
1889
|
+
imgStyle.transform = "";
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
|
|
1893
|
+
//#endregion
|
|
1894
|
+
//#region src/ui/slider/slider-thumbnail-element.ts
|
|
1895
|
+
var SliderThumbnailElement = class extends ThumbnailElement {
|
|
1896
|
+
static {
|
|
1897
|
+
this.tagName = "media-slider-thumbnail";
|
|
1898
|
+
}
|
|
1899
|
+
#ctx = new ContextConsumer(this, {
|
|
1900
|
+
context: sliderContext,
|
|
1901
|
+
subscribe: true
|
|
1902
|
+
});
|
|
1903
|
+
update(changed) {
|
|
1904
|
+
const ctx = this.#ctx.value;
|
|
1905
|
+
if (ctx) this.time = ctx.pointerValue;
|
|
1906
|
+
super.update(changed);
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
//#endregion
|
|
1911
|
+
//#region src/ui/slider/slider-track-element.ts
|
|
1912
|
+
var SliderTrackElement = class extends ContextPartElement {
|
|
1913
|
+
constructor(..._args) {
|
|
1914
|
+
super(..._args);
|
|
1915
|
+
this.consumer = new ContextConsumer(this, {
|
|
1916
|
+
context: sliderContext,
|
|
1917
|
+
subscribe: true
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
static {
|
|
1921
|
+
this.tagName = "media-slider-track";
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
//#endregion
|
|
1926
|
+
//#region src/ui/slider/slider-value-element.ts
|
|
1927
|
+
var SliderValueElement = class extends MediaElement {
|
|
1928
|
+
constructor(..._args) {
|
|
1929
|
+
super(..._args);
|
|
1930
|
+
this.type = "current";
|
|
1931
|
+
}
|
|
1932
|
+
static {
|
|
1933
|
+
this.tagName = "media-slider-value";
|
|
1934
|
+
}
|
|
1935
|
+
static {
|
|
1936
|
+
this.properties = { type: { type: String } };
|
|
1937
|
+
}
|
|
1938
|
+
#ctx = new ContextConsumer(this, {
|
|
1939
|
+
context: sliderContext,
|
|
1940
|
+
subscribe: true
|
|
1941
|
+
});
|
|
1942
|
+
connectedCallback() {
|
|
1943
|
+
super.connectedCallback();
|
|
1944
|
+
this.setAttribute("aria-live", "off");
|
|
1945
|
+
}
|
|
1946
|
+
update(_changed) {
|
|
1947
|
+
super.update(_changed);
|
|
1948
|
+
const ctx = this.#ctx.value;
|
|
1949
|
+
if (!ctx) return;
|
|
1950
|
+
const value = this.type === "pointer" ? ctx.pointerValue : ctx.state.value;
|
|
1951
|
+
this.textContent = ctx.formatValue ? ctx.formatValue(value, this.type) : String(Math.round(value));
|
|
1952
|
+
applyStateDataAttrs(this, ctx.state, ctx.stateAttrMap);
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1955
|
+
|
|
1956
|
+
//#endregion
|
|
1957
|
+
//#region src/ui/time-slider/time-slider-element.ts
|
|
1958
|
+
var TimeSliderElement = class extends MediaElement {
|
|
1959
|
+
constructor(..._args) {
|
|
1960
|
+
super(..._args);
|
|
1961
|
+
this.label = TimeSliderCore.defaultProps.label;
|
|
1962
|
+
this.commitThrottle = TimeSliderCore.defaultProps.commitThrottle;
|
|
1963
|
+
this.step = TimeSliderCore.defaultProps.step;
|
|
1964
|
+
this.largeStep = TimeSliderCore.defaultProps.largeStep;
|
|
1965
|
+
this.orientation = TimeSliderCore.defaultProps.orientation;
|
|
1966
|
+
this.disabled = TimeSliderCore.defaultProps.disabled;
|
|
1967
|
+
this.thumbAlignment = TimeSliderCore.defaultProps.thumbAlignment;
|
|
1968
|
+
}
|
|
1969
|
+
static {
|
|
1970
|
+
this.tagName = "media-time-slider";
|
|
1971
|
+
}
|
|
1972
|
+
static {
|
|
1973
|
+
this.properties = {
|
|
1974
|
+
label: { type: String },
|
|
1975
|
+
commitThrottle: {
|
|
1976
|
+
type: Number,
|
|
1977
|
+
attribute: "commit-throttle"
|
|
1978
|
+
},
|
|
1979
|
+
step: { type: Number },
|
|
1980
|
+
largeStep: {
|
|
1981
|
+
type: Number,
|
|
1982
|
+
attribute: "large-step"
|
|
1983
|
+
},
|
|
1984
|
+
orientation: { type: String },
|
|
1985
|
+
disabled: { type: Boolean },
|
|
1986
|
+
thumbAlignment: {
|
|
1987
|
+
type: String,
|
|
1988
|
+
attribute: "thumb-alignment"
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
#core = new TimeSliderCore();
|
|
1993
|
+
#provider = new ContextProvider(this, { context: sliderContext });
|
|
1994
|
+
#timeState = new PlayerController(this, playerContext, selectTime);
|
|
1995
|
+
#bufferState = new PlayerController(this, playerContext, selectBuffer);
|
|
1996
|
+
#slider = null;
|
|
1997
|
+
#disconnect = null;
|
|
1998
|
+
connectedCallback() {
|
|
1999
|
+
super.connectedCallback();
|
|
2000
|
+
if (this.destroyed) return;
|
|
2001
|
+
this.#disconnect = new AbortController();
|
|
2002
|
+
const signal = this.#disconnect.signal;
|
|
2003
|
+
this.#slider = createSlider({
|
|
2004
|
+
getElement: () => this,
|
|
2005
|
+
getThumbElement: () => this.querySelector("media-slider-thumb"),
|
|
2006
|
+
getOrientation: () => this.orientation,
|
|
2007
|
+
isRTL: () => isRTL(this),
|
|
2008
|
+
isDisabled: () => this.disabled || !this.#timeState.value,
|
|
2009
|
+
getPercent: () => {
|
|
2010
|
+
const media = this.#timeState.value;
|
|
2011
|
+
if (!media) return 0;
|
|
2012
|
+
return this.#core.percentFromValue(media.currentTime);
|
|
2013
|
+
},
|
|
2014
|
+
getStepPercent: () => this.#core.getStepPercent(),
|
|
2015
|
+
getLargeStepPercent: () => this.#core.getLargeStepPercent(),
|
|
2016
|
+
onValueCommit: (percent) => {
|
|
2017
|
+
const media = this.#timeState.value;
|
|
2018
|
+
if (media) media.seek(this.#core.rawValueFromPercent(percent));
|
|
2019
|
+
},
|
|
2020
|
+
commitThrottle: this.commitThrottle,
|
|
2021
|
+
onDragStart: () => {
|
|
2022
|
+
this.dispatchEvent(new CustomEvent("drag-start", { bubbles: true }));
|
|
2023
|
+
},
|
|
2024
|
+
onDragEnd: () => {
|
|
2025
|
+
this.dispatchEvent(new CustomEvent("drag-end", { bubbles: true }));
|
|
2026
|
+
},
|
|
2027
|
+
adjustPercent: (raw, thumbSize, trackSize) => this.#core.adjustPercentForAlignment(raw, thumbSize, trackSize),
|
|
2028
|
+
onResize: () => this.requestUpdate()
|
|
2029
|
+
});
|
|
2030
|
+
applyElementProps(this, this.#slider.rootProps, { signal });
|
|
2031
|
+
applyStyles(this, this.#slider.rootStyle);
|
|
2032
|
+
this.#slider.input.subscribe(() => this.requestUpdate(), { signal });
|
|
2033
|
+
if (!this.#timeState.value) logMissingFeature(this.localName, this.#timeState.displayName);
|
|
2034
|
+
}
|
|
2035
|
+
disconnectedCallback() {
|
|
2036
|
+
super.disconnectedCallback();
|
|
2037
|
+
this.#disconnect?.abort();
|
|
2038
|
+
this.#disconnect = null;
|
|
2039
|
+
}
|
|
2040
|
+
destroyCallback() {
|
|
2041
|
+
this.#slider?.destroy();
|
|
2042
|
+
super.destroyCallback();
|
|
2043
|
+
}
|
|
2044
|
+
willUpdate(_changed) {
|
|
2045
|
+
super.willUpdate(_changed);
|
|
2046
|
+
this.#core.setProps(this);
|
|
2047
|
+
}
|
|
2048
|
+
update(_changed) {
|
|
2049
|
+
super.update(_changed);
|
|
2050
|
+
if (!this.#slider) return;
|
|
2051
|
+
const time = this.#timeState.value;
|
|
2052
|
+
const buffer = this.#bufferState.value;
|
|
2053
|
+
if (!time) return;
|
|
2054
|
+
this.#core.setInput(this.#slider.input.current);
|
|
2055
|
+
const media = {
|
|
2056
|
+
...time,
|
|
2057
|
+
...buffer ?? {
|
|
2058
|
+
buffered: [],
|
|
2059
|
+
seekable: []
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
this.#core.setMedia(media);
|
|
2063
|
+
const state = this.#core.getState();
|
|
2064
|
+
const cssVars = getTimeSliderCSSVars(this.#slider.adjustForAlignment(state));
|
|
2065
|
+
applyStyles(this, cssVars);
|
|
2066
|
+
applyStateDataAttrs(this, state, TimeSliderDataAttrs);
|
|
2067
|
+
this.#provider.setValue({
|
|
2068
|
+
state,
|
|
2069
|
+
stateAttrMap: TimeSliderDataAttrs,
|
|
2070
|
+
pointerValue: this.#core.valueFromPercent(state.pointerPercent),
|
|
2071
|
+
thumbAttrs: this.#core.getAttrs(state),
|
|
2072
|
+
thumbProps: this.#slider.thumbProps,
|
|
2073
|
+
formatValue: (value) => formatTime(value, state.duration)
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
|
|
2078
|
+
//#endregion
|
|
2079
|
+
//#region src/define/ui/time-slider.ts
|
|
2080
|
+
safeDefine(TimeSliderElement);
|
|
2081
|
+
safeDefine(SliderBufferElement);
|
|
2082
|
+
safeDefine(SliderFillElement);
|
|
2083
|
+
safeDefine(SliderPreviewElement);
|
|
2084
|
+
safeDefine(SliderThumbElement);
|
|
2085
|
+
safeDefine(SliderThumbnailElement);
|
|
2086
|
+
safeDefine(SliderTrackElement);
|
|
2087
|
+
safeDefine(SliderValueElement);
|
|
2088
|
+
|
|
2089
|
+
//#endregion
|
|
2090
|
+
//#region src/ui/tooltip/context.ts
|
|
2091
|
+
const TOOLTIP_GROUP_CONTEXT_KEY = Symbol("@videojs/tooltip-group");
|
|
2092
|
+
const tooltipGroupContext = createContext(TOOLTIP_GROUP_CONTEXT_KEY);
|
|
2093
|
+
|
|
2094
|
+
//#endregion
|
|
2095
|
+
//#region src/ui/tooltip/tooltip-element.ts
|
|
2096
|
+
var TooltipElement = class extends MediaElement {
|
|
2097
|
+
constructor(..._args) {
|
|
2098
|
+
super(..._args);
|
|
2099
|
+
this.open = TooltipCore.defaultProps.open;
|
|
2100
|
+
this.defaultOpen = TooltipCore.defaultProps.defaultOpen;
|
|
2101
|
+
this.side = TooltipCore.defaultProps.side;
|
|
2102
|
+
this.align = TooltipCore.defaultProps.align;
|
|
2103
|
+
this.delay = TooltipCore.defaultProps.delay;
|
|
2104
|
+
this.closeDelay = TooltipCore.defaultProps.closeDelay;
|
|
2105
|
+
this.disableHoverablePopup = TooltipCore.defaultProps.disableHoverablePopup;
|
|
2106
|
+
this.disabled = TooltipCore.defaultProps.disabled;
|
|
2107
|
+
}
|
|
2108
|
+
static {
|
|
2109
|
+
this.tagName = "media-tooltip";
|
|
2110
|
+
}
|
|
2111
|
+
static {
|
|
2112
|
+
this.properties = {
|
|
2113
|
+
open: { type: Boolean },
|
|
2114
|
+
defaultOpen: {
|
|
2115
|
+
type: Boolean,
|
|
2116
|
+
attribute: "default-open"
|
|
2117
|
+
},
|
|
2118
|
+
side: { type: String },
|
|
2119
|
+
align: { type: String },
|
|
2120
|
+
delay: { type: Number },
|
|
2121
|
+
closeDelay: {
|
|
2122
|
+
type: Number,
|
|
2123
|
+
attribute: "close-delay"
|
|
2124
|
+
},
|
|
2125
|
+
disableHoverablePopup: {
|
|
2126
|
+
type: Boolean,
|
|
2127
|
+
attribute: "disable-hoverable-popup"
|
|
2128
|
+
},
|
|
2129
|
+
disabled: { type: Boolean }
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
#core = new TooltipCore();
|
|
2133
|
+
#groupConsumer = new ContextConsumer(this, { context: tooltipGroupContext });
|
|
2134
|
+
#tooltip = null;
|
|
2135
|
+
#snapshot = null;
|
|
2136
|
+
#disconnect = null;
|
|
2137
|
+
#triggerAbort = null;
|
|
2138
|
+
#currentTrigger = null;
|
|
2139
|
+
#positionAbort = null;
|
|
2140
|
+
#positionFrame = 0;
|
|
2141
|
+
#resizeObserver = null;
|
|
2142
|
+
#positionTrigger = null;
|
|
2143
|
+
connectedCallback() {
|
|
2144
|
+
super.connectedCallback();
|
|
2145
|
+
this.#disconnect = new AbortController();
|
|
2146
|
+
this.#tooltip = createTooltip({
|
|
2147
|
+
transition: createTransition(),
|
|
2148
|
+
onOpenChange: (nextOpen, details) => {
|
|
2149
|
+
this.open = nextOpen;
|
|
2150
|
+
this.dispatchEvent(new CustomEvent("open-change", { detail: {
|
|
2151
|
+
open: nextOpen,
|
|
2152
|
+
...details
|
|
2153
|
+
} }));
|
|
2154
|
+
},
|
|
2155
|
+
delay: () => this.delay,
|
|
2156
|
+
closeDelay: () => this.closeDelay,
|
|
2157
|
+
disableHoverablePopup: () => this.disableHoverablePopup,
|
|
2158
|
+
disabled: () => this.disabled,
|
|
2159
|
+
group: () => this.#groupConsumer.value
|
|
2160
|
+
});
|
|
2161
|
+
this.#tooltip.setPopupElement(this);
|
|
2162
|
+
applyElementProps(this, this.#tooltip.popupProps, { signal: this.#disconnect.signal });
|
|
2163
|
+
if (this.#snapshot) this.#snapshot.track(this.#tooltip.input);
|
|
2164
|
+
else this.#snapshot = new SnapshotController(this, this.#tooltip.input);
|
|
2165
|
+
}
|
|
2166
|
+
firstUpdated(changed) {
|
|
2167
|
+
super.firstUpdated(changed);
|
|
2168
|
+
if (this.defaultOpen && !this.open) this.#tooltip?.open();
|
|
2169
|
+
}
|
|
2170
|
+
disconnectedCallback() {
|
|
2171
|
+
super.disconnectedCallback();
|
|
2172
|
+
this.#cleanupPositioning();
|
|
2173
|
+
this.#cleanupTrigger();
|
|
2174
|
+
this.#tooltip?.destroy();
|
|
2175
|
+
this.#tooltip = null;
|
|
2176
|
+
this.#disconnect?.abort();
|
|
2177
|
+
this.#disconnect = null;
|
|
2178
|
+
}
|
|
2179
|
+
willUpdate(changed) {
|
|
2180
|
+
super.willUpdate(changed);
|
|
2181
|
+
this.#core.setProps(this);
|
|
2182
|
+
if (this.#tooltip && changed.has("open")) {
|
|
2183
|
+
const { active: interactionOpen } = this.#tooltip.input.current;
|
|
2184
|
+
if (this.open !== interactionOpen) if (this.open) this.#tooltip.open();
|
|
2185
|
+
else this.#tooltip.close();
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
update(_changed) {
|
|
2189
|
+
super.update(_changed);
|
|
2190
|
+
if (!this.#tooltip) return;
|
|
2191
|
+
const triggerEl = this.#findTrigger();
|
|
2192
|
+
this.#syncTrigger(triggerEl);
|
|
2193
|
+
const input = this.#tooltip.input.current;
|
|
2194
|
+
this.#core.setInput(input);
|
|
2195
|
+
const state = this.#core.getState();
|
|
2196
|
+
applyElementProps(this, this.#core.getPopupAttrs(state));
|
|
2197
|
+
applyStateDataAttrs(this, state, TooltipDataAttrs);
|
|
2198
|
+
if (state.open) tryShowPopover(this);
|
|
2199
|
+
else tryHidePopover(this);
|
|
2200
|
+
if (this.#currentTrigger) {
|
|
2201
|
+
applyElementProps(this.#currentTrigger, this.#core.getTriggerAttrs(state, this.id));
|
|
2202
|
+
applyStyles(this.#currentTrigger, getAnchorNameStyle(this.id));
|
|
2203
|
+
}
|
|
2204
|
+
if (!state.open) {
|
|
2205
|
+
this.#cleanupPositioning();
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
const posOpts = {
|
|
2209
|
+
side: state.side,
|
|
2210
|
+
align: state.align
|
|
2211
|
+
};
|
|
2212
|
+
if (supportsAnchorPositioning()) applyStyles(this, getAnchorPositionStyle(this.id, posOpts, void 0, void 0, void 0, void 0, TooltipCSSVars));
|
|
2213
|
+
else {
|
|
2214
|
+
const triggerRect = this.#currentTrigger?.getBoundingClientRect();
|
|
2215
|
+
const selfRect = getPopupPositionRect(this);
|
|
2216
|
+
const boundaryRect = document.documentElement.getBoundingClientRect();
|
|
2217
|
+
const offsets = resolveOffsets(this, TooltipCSSVars);
|
|
2218
|
+
applyStyles(this, getAnchorPositionStyle(this.id, posOpts, triggerRect, selfRect, boundaryRect, offsets, TooltipCSSVars));
|
|
2219
|
+
}
|
|
2220
|
+
this.#syncPositioning();
|
|
2221
|
+
}
|
|
2222
|
+
#findTrigger() {
|
|
2223
|
+
if (!this.id) return null;
|
|
2224
|
+
return this.getRootNode().querySelector(`[commandfor="${this.id}"]`);
|
|
2225
|
+
}
|
|
2226
|
+
#syncTrigger(triggerEl) {
|
|
2227
|
+
if (triggerEl === this.#currentTrigger) return;
|
|
2228
|
+
this.#cleanupPositioning();
|
|
2229
|
+
this.#cleanupTrigger();
|
|
2230
|
+
this.#currentTrigger = triggerEl;
|
|
2231
|
+
this.#tooltip?.setTriggerElement(triggerEl);
|
|
2232
|
+
if (triggerEl && this.#tooltip) {
|
|
2233
|
+
this.#triggerAbort = new AbortController();
|
|
2234
|
+
applyElementProps(triggerEl, this.#tooltip.triggerProps, { signal: this.#triggerAbort.signal });
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
#cleanupTrigger() {
|
|
2238
|
+
if (this.#currentTrigger) {
|
|
2239
|
+
applyElementProps(this.#currentTrigger, { "aria-describedby": void 0 });
|
|
2240
|
+
this.#currentTrigger.style.removeProperty("anchor-name");
|
|
2241
|
+
}
|
|
2242
|
+
this.#triggerAbort?.abort();
|
|
2243
|
+
this.#triggerAbort = null;
|
|
2244
|
+
this.#currentTrigger = null;
|
|
2245
|
+
}
|
|
2246
|
+
#syncPositioning() {
|
|
2247
|
+
if (supportsAnchorPositioning()) return;
|
|
2248
|
+
const triggerEl = this.#currentTrigger;
|
|
2249
|
+
if (!triggerEl) return;
|
|
2250
|
+
if (this.#positionAbort && this.#positionTrigger === triggerEl) return;
|
|
2251
|
+
this.#cleanupPositioning();
|
|
2252
|
+
this.#positionAbort = new AbortController();
|
|
2253
|
+
this.#positionTrigger = triggerEl;
|
|
2254
|
+
const { signal } = this.#positionAbort;
|
|
2255
|
+
const reposition = () => {
|
|
2256
|
+
cancelAnimationFrame(this.#positionFrame);
|
|
2257
|
+
this.#positionFrame = requestAnimationFrame(() => {
|
|
2258
|
+
if (signal.aborted) return;
|
|
2259
|
+
this.requestUpdate();
|
|
2260
|
+
});
|
|
2261
|
+
};
|
|
2262
|
+
window.addEventListener("scroll", reposition, {
|
|
2263
|
+
capture: true,
|
|
2264
|
+
passive: true,
|
|
2265
|
+
signal
|
|
2266
|
+
});
|
|
2267
|
+
window.addEventListener("resize", reposition, { signal });
|
|
2268
|
+
if (typeof ResizeObserver === "function") {
|
|
2269
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
2270
|
+
reposition();
|
|
2271
|
+
});
|
|
2272
|
+
this.#resizeObserver.observe(triggerEl);
|
|
2273
|
+
this.#resizeObserver.observe(this);
|
|
2274
|
+
}
|
|
2275
|
+
reposition();
|
|
2276
|
+
}
|
|
2277
|
+
#cleanupPositioning() {
|
|
2278
|
+
this.#positionAbort?.abort();
|
|
2279
|
+
this.#positionAbort = null;
|
|
2280
|
+
this.#positionTrigger = null;
|
|
2281
|
+
cancelAnimationFrame(this.#positionFrame);
|
|
2282
|
+
this.#positionFrame = 0;
|
|
2283
|
+
this.#resizeObserver?.disconnect();
|
|
2284
|
+
this.#resizeObserver = null;
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2288
|
+
//#endregion
|
|
2289
|
+
//#region src/define/ui/tooltip.ts
|
|
2290
|
+
safeDefine(TooltipElement);
|
|
2291
|
+
|
|
2292
|
+
//#endregion
|
|
2293
|
+
//#region src/ui/tooltip/tooltip-group-element.ts
|
|
2294
|
+
var TooltipGroupElement = class extends MediaElement {
|
|
2295
|
+
constructor(..._args) {
|
|
2296
|
+
super(..._args);
|
|
2297
|
+
this.delay = TooltipGroupCore.defaultProps.delay;
|
|
2298
|
+
this.closeDelay = TooltipGroupCore.defaultProps.closeDelay;
|
|
2299
|
+
this.timeout = TooltipGroupCore.defaultProps.timeout;
|
|
2300
|
+
}
|
|
2301
|
+
static {
|
|
2302
|
+
this.tagName = "media-tooltip-group";
|
|
2303
|
+
}
|
|
2304
|
+
static {
|
|
2305
|
+
this.properties = {
|
|
2306
|
+
delay: { type: Number },
|
|
2307
|
+
closeDelay: {
|
|
2308
|
+
type: Number,
|
|
2309
|
+
attribute: "close-delay"
|
|
2310
|
+
},
|
|
2311
|
+
timeout: { type: Number }
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
#core = new TooltipGroupCore();
|
|
2315
|
+
#provider = new ContextProvider(this, {
|
|
2316
|
+
context: tooltipGroupContext,
|
|
2317
|
+
initialValue: this.#core
|
|
2318
|
+
});
|
|
2319
|
+
update(_changed) {
|
|
2320
|
+
super.update(_changed);
|
|
2321
|
+
this.#core.setProps(this);
|
|
2322
|
+
this.#provider.setValue(this.#core);
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
|
|
2326
|
+
//#endregion
|
|
2327
|
+
//#region src/define/ui/tooltip-group.ts
|
|
2328
|
+
safeDefine(TooltipGroupElement);
|
|
2329
|
+
|
|
2330
|
+
//#endregion
|
|
2331
|
+
//#region src/ui/volume-slider/volume-slider-element.ts
|
|
2332
|
+
var VolumeSliderElement = class extends MediaElement {
|
|
2333
|
+
constructor(..._args) {
|
|
2334
|
+
super(..._args);
|
|
2335
|
+
this.label = VolumeSliderCore.defaultProps.label;
|
|
2336
|
+
this.step = VolumeSliderCore.defaultProps.step;
|
|
2337
|
+
this.largeStep = VolumeSliderCore.defaultProps.largeStep;
|
|
2338
|
+
this.orientation = VolumeSliderCore.defaultProps.orientation;
|
|
2339
|
+
this.disabled = VolumeSliderCore.defaultProps.disabled;
|
|
2340
|
+
this.thumbAlignment = VolumeSliderCore.defaultProps.thumbAlignment;
|
|
2341
|
+
}
|
|
2342
|
+
static {
|
|
2343
|
+
this.tagName = "media-volume-slider";
|
|
2344
|
+
}
|
|
2345
|
+
static {
|
|
2346
|
+
this.properties = {
|
|
2347
|
+
label: { type: String },
|
|
2348
|
+
step: { type: Number },
|
|
2349
|
+
largeStep: {
|
|
2350
|
+
type: Number,
|
|
2351
|
+
attribute: "large-step"
|
|
2352
|
+
},
|
|
2353
|
+
orientation: { type: String },
|
|
2354
|
+
disabled: { type: Boolean },
|
|
2355
|
+
thumbAlignment: {
|
|
2356
|
+
type: String,
|
|
2357
|
+
attribute: "thumb-alignment"
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
#core = new VolumeSliderCore();
|
|
2362
|
+
#provider = new ContextProvider(this, { context: sliderContext });
|
|
2363
|
+
#volumeState = new PlayerController(this, playerContext, selectVolume);
|
|
2364
|
+
#slider = null;
|
|
2365
|
+
#disconnect = null;
|
|
2366
|
+
connectedCallback() {
|
|
2367
|
+
super.connectedCallback();
|
|
2368
|
+
if (this.destroyed) return;
|
|
2369
|
+
this.#disconnect = new AbortController();
|
|
2370
|
+
const signal = this.#disconnect.signal;
|
|
2371
|
+
this.#slider = createSlider({
|
|
2372
|
+
getElement: () => this,
|
|
2373
|
+
getThumbElement: () => this.querySelector("media-slider-thumb"),
|
|
2374
|
+
getOrientation: () => this.orientation,
|
|
2375
|
+
isRTL: () => isRTL(this),
|
|
2376
|
+
isDisabled: () => this.disabled || !this.#volumeState.value,
|
|
2377
|
+
getPercent: () => {
|
|
2378
|
+
const media = this.#volumeState.value;
|
|
2379
|
+
if (!media) return 0;
|
|
2380
|
+
return media.volume * 100;
|
|
2381
|
+
},
|
|
2382
|
+
getStepPercent: () => this.#core.getStepPercent(),
|
|
2383
|
+
getLargeStepPercent: () => this.#core.getLargeStepPercent(),
|
|
2384
|
+
onValueChange: (percent) => {
|
|
2385
|
+
this.#setVolume(percent);
|
|
2386
|
+
},
|
|
2387
|
+
onValueCommit: (percent) => {
|
|
2388
|
+
this.#setVolume(percent);
|
|
2389
|
+
},
|
|
2390
|
+
onDragStart: () => {
|
|
2391
|
+
this.dispatchEvent(new CustomEvent("drag-start", { bubbles: true }));
|
|
2392
|
+
},
|
|
2393
|
+
onDragEnd: () => {
|
|
2394
|
+
this.dispatchEvent(new CustomEvent("drag-end", { bubbles: true }));
|
|
2395
|
+
},
|
|
2396
|
+
adjustPercent: (raw, thumbSize, trackSize) => this.#core.adjustPercentForAlignment(raw, thumbSize, trackSize),
|
|
2397
|
+
onResize: () => this.requestUpdate()
|
|
2398
|
+
});
|
|
2399
|
+
applyElementProps(this, this.#slider.rootProps, { signal });
|
|
2400
|
+
applyStyles(this, this.#slider.rootStyle);
|
|
2401
|
+
this.#slider.input.subscribe(() => this.requestUpdate(), { signal });
|
|
2402
|
+
if (!this.#volumeState.value) logMissingFeature(this.localName, this.#volumeState.displayName);
|
|
2403
|
+
}
|
|
2404
|
+
disconnectedCallback() {
|
|
2405
|
+
super.disconnectedCallback();
|
|
2406
|
+
this.#disconnect?.abort();
|
|
2407
|
+
this.#disconnect = null;
|
|
2408
|
+
}
|
|
2409
|
+
destroyCallback() {
|
|
2410
|
+
this.#slider?.destroy();
|
|
2411
|
+
super.destroyCallback();
|
|
2412
|
+
}
|
|
2413
|
+
willUpdate(_changed) {
|
|
2414
|
+
super.willUpdate(_changed);
|
|
2415
|
+
this.#core.setProps(this);
|
|
2416
|
+
}
|
|
2417
|
+
update(_changed) {
|
|
2418
|
+
super.update(_changed);
|
|
2419
|
+
if (!this.#slider) return;
|
|
2420
|
+
const media = this.#volumeState.value;
|
|
2421
|
+
if (!media) return;
|
|
2422
|
+
this.#core.setInput(this.#slider.input.current);
|
|
2423
|
+
this.#core.setMedia(media);
|
|
2424
|
+
const state = this.#core.getState();
|
|
2425
|
+
const cssVars = getSliderCSSVars(this.#slider.adjustForAlignment(state));
|
|
2426
|
+
applyStyles(this, cssVars);
|
|
2427
|
+
applyStateDataAttrs(this, state, VolumeSliderDataAttrs);
|
|
2428
|
+
this.#provider.setValue({
|
|
2429
|
+
state,
|
|
2430
|
+
stateAttrMap: VolumeSliderDataAttrs,
|
|
2431
|
+
pointerValue: this.#core.valueFromPercent(state.pointerPercent),
|
|
2432
|
+
thumbAttrs: this.#core.getAttrs(state),
|
|
2433
|
+
thumbProps: this.#slider.thumbProps,
|
|
2434
|
+
formatValue: (value) => `${Math.round(value)}%`
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
#setVolume(percent) {
|
|
2438
|
+
this.#volumeState.value?.setVolume(this.#core.valueFromPercent(percent) / 100);
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
|
|
2442
|
+
//#endregion
|
|
2443
|
+
//#region src/define/ui/volume-slider.ts
|
|
2444
|
+
safeDefine(VolumeSliderElement);
|
|
2445
|
+
safeDefine(SliderFillElement);
|
|
2446
|
+
safeDefine(SliderPreviewElement);
|
|
2447
|
+
safeDefine(SliderThumbElement);
|
|
2448
|
+
safeDefine(SliderTrackElement);
|
|
2449
|
+
safeDefine(SliderValueElement);
|
|
2450
|
+
|
|
2451
|
+
//#endregion
|
|
2452
|
+
export { PiPButtonDataAttrs as a, FullscreenButtonCore as c, CaptionsButtonDataAttrs as d, CaptionsButtonCore as f, createStyles as g, SkinMixin as h, PosterCore as i, ControlsDataAttrs as l, BufferingIndicatorCore as m, MediaButtonElement as n, PiPButtonCore as o, BufferingIndicatorDataAttrs as p, PosterDataAttrs as r, FullscreenButtonDataAttrs as s, ContextPartElement as t, ControlsCore as u };
|
|
2453
|
+
//# sourceMappingURL=volume-slider-CfhOO9RM.js.map
|