@videojs/html 10.0.0-beta.15 → 10.0.0-beta.16
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-ui.dev.js +4 -5
- package/cdn/audio-minimal-ui.js +1 -1
- package/cdn/audio-minimal.dev.js +7 -8
- package/cdn/audio-minimal.dev.js.map +1 -1
- package/cdn/audio-minimal.js +1 -1
- package/cdn/audio-minimal.js.map +1 -1
- package/cdn/audio-ui.dev.js +5 -5
- package/cdn/audio-ui.js +1 -1
- package/cdn/audio.dev.js +23 -7
- package/cdn/audio.dev.js.map +1 -1
- package/cdn/audio.js +1 -1
- package/cdn/audio.js.map +1 -1
- package/cdn/background.dev.js +3 -3
- package/cdn/background.js +1 -1
- package/cdn/background.js.map +1 -1
- package/cdn/context-C-IpVHEt.js +14 -0
- package/cdn/context-C-IpVHEt.js.map +1 -0
- package/cdn/{context-BjrbhiSk.js → context-CvJ83xGk.js} +2 -83
- package/cdn/context-CvJ83xGk.js.map +1 -0
- package/cdn/create-player-B_oNyyb5.js +7 -0
- package/cdn/create-player-B_oNyyb5.js.map +1 -0
- package/cdn/{create-player-p9xCO0yC.js → create-player-DckZq-sE.js} +56 -1416
- package/cdn/create-player-DckZq-sE.js.map +1 -0
- package/cdn/{hls-BriQI4q1.js → hls-CJCXZSGG.js} +8 -11
- package/cdn/{hls-BriQI4q1.js.map → hls-CJCXZSGG.js.map} +1 -1
- package/cdn/{hls-26YJVjvD.js → hls-lPH0rWmB.js} +3 -3
- package/cdn/{hls-26YJVjvD.js.map → hls-lPH0rWmB.js.map} +1 -1
- package/cdn/hotkey-B7OaweHa.js +154 -0
- package/cdn/hotkey-B7OaweHa.js.map +1 -0
- package/cdn/hotkey-BLEt77Z0.js +2 -0
- package/cdn/hotkey-BLEt77Z0.js.map +1 -0
- package/cdn/media/dash-video.dev.js +3 -4
- package/cdn/media/dash-video.dev.js.map +1 -1
- package/cdn/media/dash-video.js +2 -2
- package/cdn/media/hls-video.dev.js +4 -5
- package/cdn/media/hls-video.dev.js.map +1 -1
- package/cdn/media/hls-video.js +1 -1
- package/cdn/media/hls-video.js.map +1 -1
- package/cdn/media/mux-audio.dev.d.ts +1 -0
- package/cdn/media/mux-audio.dev.js +29 -0
- package/cdn/media/mux-audio.dev.js.map +1 -0
- package/cdn/media/mux-audio.js +2 -0
- package/cdn/media/mux-audio.js.map +1 -0
- package/cdn/media/mux-video.dev.js +5 -3099
- package/cdn/media/mux-video.dev.js.map +1 -1
- package/cdn/media/mux-video.js +1 -24
- package/cdn/media/mux-video.js.map +1 -1
- package/cdn/media/native-hls-video.dev.js +4 -4
- package/cdn/media/native-hls-video.js +1 -1
- package/cdn/media/simple-hls-video.dev.js +965 -680
- package/cdn/media/simple-hls-video.dev.js.map +1 -1
- package/cdn/media/simple-hls-video.js +6 -6
- package/cdn/media/simple-hls-video.js.map +1 -1
- package/cdn/{media-attach-mixin-DfKkofgF.js → media-attach-mixin-CMH1ziXP.js} +2 -2
- package/cdn/{media-attach-mixin-DfKkofgF.js.map → media-attach-mixin-CMH1ziXP.js.map} +1 -1
- package/cdn/{media-attach-mixin-Dv2D43tb.js → media-attach-mixin-DUzmXEJ3.js} +2 -2
- package/cdn/{media-attach-mixin-Dv2D43tb.js.map → media-attach-mixin-DUzmXEJ3.js.map} +1 -1
- package/cdn/{media-props-mixin-Dc5dpCV4.js → media-props-mixin-CZLZIhGT.js} +92 -8
- package/cdn/media-props-mixin-CZLZIhGT.js.map +1 -0
- package/cdn/media-props-mixin-DrjlZybt.js +47 -0
- package/cdn/media-props-mixin-DrjlZybt.js.map +1 -0
- package/cdn/{minimal-BUUGNZK7.js → minimal-D9Dw-L2P.js} +1 -1
- package/cdn/{minimal-BUUGNZK7.js.map → minimal-D9Dw-L2P.js.map} +1 -1
- package/cdn/{minimal-CJGOJ6pE.js → minimal-Dc5nNl_-.js} +1 -1
- package/cdn/{minimal-CJGOJ6pE.js.map → minimal-Dc5nNl_-.js.map} +1 -1
- package/cdn/mux-CBXn2z5k.js +3102 -0
- package/cdn/mux-CBXn2z5k.js.map +1 -0
- package/cdn/mux-DmGzBNIq.js +25 -0
- package/cdn/mux-DmGzBNIq.js.map +1 -0
- package/cdn/{native-hls-D2rfyyyW.js → native-hls-BCOLtRUl.js} +2 -3
- package/cdn/{native-hls-D2rfyyyW.js.map → native-hls-BCOLtRUl.js.map} +1 -1
- package/cdn/native-hls-BU8--1Kg.js +2 -0
- package/cdn/{native-hls-CjRvSXAJ.js.map → native-hls-BU8--1Kg.js.map} +1 -1
- package/cdn/player-DAmuLGE1.js +2 -0
- package/cdn/{player-Cz9-_j7J.js.map → player-DAmuLGE1.js.map} +1 -1
- package/cdn/{player-D0bhjT8X.js → player-Dbl1MUJ2.js} +3 -3
- package/cdn/{player-D0bhjT8X.js.map → player-Dbl1MUJ2.js.map} +1 -1
- package/cdn/poster-B9COb7AR.js +2 -0
- package/cdn/poster-B9COb7AR.js.map +1 -0
- package/cdn/poster-qAhnKWea.js +480 -0
- package/cdn/poster-qAhnKWea.js.map +1 -0
- package/cdn/{skin-element-DB-cKAAx.js → skin-element-DbmY-ske.js} +2 -2
- package/cdn/{skin-element-DB-cKAAx.js.map → skin-element-DbmY-ske.js.map} +1 -1
- package/cdn/{skin-element-zakTHELS.js → skin-element-ih3VrnYx.js} +2 -2
- package/cdn/{skin-element-zakTHELS.js.map → skin-element-ih3VrnYx.js.map} +1 -1
- package/cdn/video-minimal-ui.dev.js +4 -5
- package/cdn/video-minimal-ui.js +1 -1
- package/cdn/video-minimal.dev.js +7 -8
- package/cdn/video-minimal.dev.js.map +1 -1
- package/cdn/video-minimal.js +1 -1
- package/cdn/video-minimal.js.map +1 -1
- package/cdn/video-ui.dev.js +5 -5
- package/cdn/video-ui.js +1 -1
- package/cdn/video.dev.js +26 -7
- package/cdn/video.dev.js.map +1 -1
- package/cdn/video.js +1 -1
- package/cdn/video.js.map +1 -1
- package/cdn/volume-slider-BbIc1N4U.js +8 -0
- package/cdn/volume-slider-BbIc1N4U.js.map +1 -0
- package/cdn/{volume-slider-Co5X4Z1t.js → volume-slider-C6ek7oC9.js} +1855 -386
- package/cdn/volume-slider-C6ek7oC9.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/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 +23 -0
- package/dist/default/define/audio/skin.css +23 -0
- package/dist/default/define/audio/skin.js +1 -1
- package/dist/default/define/audio/skin.js.map +1 -1
- package/dist/default/define/audio/ui.js +1 -0
- package/dist/default/define/background/skin.js +1 -1
- package/dist/default/define/media/mux-audio.js +13 -0
- package/dist/default/define/media/mux-audio.js.map +1 -0
- package/dist/default/define/skin-element.js +1 -1
- package/dist/default/define/ui/hotkey.js +7 -0
- package/dist/default/define/ui/hotkey.js.map +1 -0
- package/dist/default/define/ui/slider.js +1 -1
- package/dist/default/define/ui/time-slider.js +1 -1
- package/dist/default/define/ui/volume-slider.js +1 -1
- package/dist/default/define/video/minimal-skin.css +23 -0
- package/dist/default/define/video/skin.css +23 -0
- package/dist/default/define/video/skin.js +1 -1
- package/dist/default/define/video/skin.js.map +1 -1
- package/dist/default/define/video/ui.js +1 -0
- package/dist/default/index.js +5 -1
- package/dist/default/media/container-element.js +16 -0
- package/dist/default/media/container-element.js.map +1 -1
- package/dist/default/media/mux-audio/index.js +18 -0
- package/dist/default/media/mux-audio/index.js.map +1 -0
- package/dist/default/player/context.js.map +1 -1
- package/dist/default/ui/alert-dialog/alert-dialog-element.js +1 -0
- package/dist/default/ui/alert-dialog/alert-dialog-element.js.map +1 -1
- package/dist/default/ui/buffering-indicator/buffering-indicator-element.js +1 -0
- package/dist/default/ui/buffering-indicator/buffering-indicator-element.js.map +1 -1
- package/dist/default/ui/captions-button/captions-button-element.js +1 -0
- package/dist/default/ui/captions-button/captions-button-element.js.map +1 -1
- package/dist/default/ui/error-dialog/error-dialog-element.js +1 -0
- package/dist/default/ui/error-dialog/error-dialog-element.js.map +1 -1
- package/dist/default/ui/fullscreen-button/fullscreen-button-element.js +1 -0
- package/dist/default/ui/fullscreen-button/fullscreen-button-element.js.map +1 -1
- package/dist/default/ui/hotkey/aria-key-shortcuts-controller.js +28 -0
- package/dist/default/ui/hotkey/aria-key-shortcuts-controller.js.map +1 -0
- package/dist/default/ui/hotkey/hotkey-element.js +81 -0
- package/dist/default/ui/hotkey/hotkey-element.js.map +1 -0
- package/dist/default/ui/media-button-element.js +9 -1
- package/dist/default/ui/media-button-element.js.map +1 -1
- package/dist/default/ui/mute-button/mute-button-element.js +1 -0
- package/dist/default/ui/mute-button/mute-button-element.js.map +1 -1
- package/dist/default/ui/pip-button/pip-button-element.js +1 -0
- package/dist/default/ui/pip-button/pip-button-element.js.map +1 -1
- package/dist/default/ui/play-button/play-button-element.js +1 -0
- package/dist/default/ui/play-button/play-button-element.js.map +1 -1
- package/dist/default/ui/popover/popover-element.js +7 -55
- package/dist/default/ui/popover/popover-element.js.map +1 -1
- package/dist/default/ui/position-controller.js +76 -0
- package/dist/default/ui/position-controller.js.map +1 -0
- package/dist/default/ui/slider/slider-element.js +1 -1
- package/dist/default/ui/slider/slider-preview-element.js +1 -1
- package/dist/default/ui/time-slider/time-slider-element.js +5 -5
- package/dist/default/ui/time-slider/time-slider-element.js.map +1 -1
- package/dist/default/ui/tooltip/tooltip-element.js +8 -54
- package/dist/default/ui/tooltip/tooltip-element.js.map +1 -1
- package/dist/default/ui/volume-slider/volume-slider-element.js +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/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 +23 -0
- package/dist/dev/define/audio/skin.css +23 -0
- package/dist/dev/define/audio/skin.d.ts.map +1 -1
- package/dist/dev/define/audio/skin.js +16 -0
- package/dist/dev/define/audio/skin.js.map +1 -1
- package/dist/dev/define/audio/ui.js +1 -0
- package/dist/dev/define/background/skin.js +1 -1
- package/dist/dev/define/media/mux-audio.d.ts +14 -0
- package/dist/dev/define/media/mux-audio.d.ts.map +1 -0
- package/dist/dev/define/media/mux-audio.js +13 -0
- package/dist/dev/define/media/mux-audio.js.map +1 -0
- package/dist/dev/define/skin-element.d.ts +1 -1
- package/dist/dev/define/skin-element.js +1 -1
- package/dist/dev/define/ui/hotkey.d.ts +9 -0
- package/dist/dev/define/ui/hotkey.d.ts.map +1 -0
- package/dist/dev/define/ui/hotkey.js +7 -0
- package/dist/dev/define/ui/hotkey.js.map +1 -0
- package/dist/dev/define/ui/slider.js +1 -1
- package/dist/dev/define/ui/time-slider.js +1 -1
- package/dist/dev/define/ui/volume-slider.js +1 -1
- package/dist/dev/define/video/minimal-skin.css +23 -0
- package/dist/dev/define/video/skin.css +23 -0
- package/dist/dev/define/video/skin.d.ts.map +1 -1
- package/dist/dev/define/video/skin.js +19 -0
- package/dist/dev/define/video/skin.js.map +1 -1
- package/dist/dev/define/video/ui.js +1 -0
- package/dist/dev/index.d.ts +6 -2
- package/dist/dev/index.js +5 -1
- package/dist/dev/media/container-element.d.ts +3 -0
- package/dist/dev/media/container-element.d.ts.map +1 -1
- package/dist/dev/media/container-element.js +16 -0
- package/dist/dev/media/container-element.js.map +1 -1
- package/dist/dev/media/mux-audio/index.d.ts +11 -0
- package/dist/dev/media/mux-audio/index.d.ts.map +1 -0
- package/dist/dev/media/mux-audio/index.js +18 -0
- package/dist/dev/media/mux-audio/index.js.map +1 -0
- package/dist/dev/player/context.d.ts +4 -2
- package/dist/dev/player/context.d.ts.map +1 -1
- package/dist/dev/player/context.js.map +1 -1
- package/dist/dev/ui/alert-dialog/alert-dialog-element.d.ts.map +1 -1
- package/dist/dev/ui/alert-dialog/alert-dialog-element.js +1 -0
- package/dist/dev/ui/alert-dialog/alert-dialog-element.js.map +1 -1
- package/dist/dev/ui/buffering-indicator/buffering-indicator-element.d.ts.map +1 -1
- package/dist/dev/ui/buffering-indicator/buffering-indicator-element.js +1 -0
- package/dist/dev/ui/buffering-indicator/buffering-indicator-element.js.map +1 -1
- package/dist/dev/ui/captions-button/captions-button-element.d.ts +1 -0
- package/dist/dev/ui/captions-button/captions-button-element.d.ts.map +1 -1
- package/dist/dev/ui/captions-button/captions-button-element.js +1 -0
- package/dist/dev/ui/captions-button/captions-button-element.js.map +1 -1
- package/dist/dev/ui/context-part-element.d.ts +1 -1
- package/dist/dev/ui/error-dialog/error-dialog-element.d.ts.map +1 -1
- package/dist/dev/ui/error-dialog/error-dialog-element.js +1 -0
- package/dist/dev/ui/error-dialog/error-dialog-element.js.map +1 -1
- package/dist/dev/ui/fullscreen-button/fullscreen-button-element.d.ts +1 -0
- package/dist/dev/ui/fullscreen-button/fullscreen-button-element.d.ts.map +1 -1
- package/dist/dev/ui/fullscreen-button/fullscreen-button-element.js +1 -0
- package/dist/dev/ui/fullscreen-button/fullscreen-button-element.js.map +1 -1
- package/dist/dev/ui/hotkey/aria-key-shortcuts-controller.d.ts +15 -0
- package/dist/dev/ui/hotkey/aria-key-shortcuts-controller.d.ts.map +1 -0
- package/dist/dev/ui/hotkey/aria-key-shortcuts-controller.js +28 -0
- package/dist/dev/ui/hotkey/aria-key-shortcuts-controller.js.map +1 -0
- package/dist/dev/ui/hotkey/hotkey-element.d.ts +21 -0
- package/dist/dev/ui/hotkey/hotkey-element.d.ts.map +1 -0
- package/dist/dev/ui/hotkey/hotkey-element.js +81 -0
- package/dist/dev/ui/hotkey/hotkey-element.js.map +1 -0
- package/dist/dev/ui/media-button-element.d.ts +2 -0
- package/dist/dev/ui/media-button-element.d.ts.map +1 -1
- package/dist/dev/ui/media-button-element.js +9 -1
- package/dist/dev/ui/media-button-element.js.map +1 -1
- package/dist/dev/ui/mute-button/mute-button-element.d.ts +1 -0
- package/dist/dev/ui/mute-button/mute-button-element.d.ts.map +1 -1
- package/dist/dev/ui/mute-button/mute-button-element.js +1 -0
- package/dist/dev/ui/mute-button/mute-button-element.js.map +1 -1
- package/dist/dev/ui/pip-button/pip-button-element.d.ts +1 -0
- package/dist/dev/ui/pip-button/pip-button-element.d.ts.map +1 -1
- package/dist/dev/ui/pip-button/pip-button-element.js +1 -0
- package/dist/dev/ui/pip-button/pip-button-element.js.map +1 -1
- package/dist/dev/ui/play-button/play-button-element.d.ts +1 -0
- package/dist/dev/ui/play-button/play-button-element.d.ts.map +1 -1
- package/dist/dev/ui/play-button/play-button-element.js +1 -0
- package/dist/dev/ui/play-button/play-button-element.js.map +1 -1
- package/dist/dev/ui/popover/popover-element.d.ts.map +1 -1
- package/dist/dev/ui/popover/popover-element.js +7 -55
- package/dist/dev/ui/popover/popover-element.js.map +1 -1
- package/dist/dev/ui/position-controller.js +76 -0
- package/dist/dev/ui/position-controller.js.map +1 -0
- package/dist/dev/ui/slider/slider-element.js +1 -1
- package/dist/dev/ui/slider/slider-preview-element.d.ts +21 -0
- package/dist/dev/ui/slider/slider-preview-element.d.ts.map +1 -0
- package/dist/dev/ui/slider/slider-preview-element.js +1 -1
- package/dist/dev/ui/time-slider/time-slider-element.d.ts +2 -2
- package/dist/dev/ui/time-slider/time-slider-element.js +5 -5
- 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 +8 -54
- package/dist/dev/ui/tooltip/tooltip-element.js.map +1 -1
- package/dist/dev/ui/volume-slider/volume-slider-element.js +1 -1
- package/package.json +8 -8
- package/cdn/context-BjrbhiSk.js.map +0 -1
- package/cdn/context-CdkhXQEw.js +0 -14
- package/cdn/context-CdkhXQEw.js.map +0 -1
- package/cdn/create-player-BqU8r8H4.js +0 -7
- package/cdn/create-player-BqU8r8H4.js.map +0 -1
- package/cdn/create-player-p9xCO0yC.js.map +0 -1
- package/cdn/delegate-B626t_Va.js +0 -2
- package/cdn/delegate-B626t_Va.js.map +0 -1
- package/cdn/delegate-BCw-LjP_.js +0 -56
- package/cdn/delegate-BCw-LjP_.js.map +0 -1
- package/cdn/media-props-mixin-Bd_N2HWy.js +0 -47
- package/cdn/media-props-mixin-Bd_N2HWy.js.map +0 -1
- package/cdn/media-props-mixin-Dc5dpCV4.js.map +0 -1
- package/cdn/native-hls-CjRvSXAJ.js +0 -2
- package/cdn/player-Cz9-_j7J.js +0 -2
- package/cdn/poster-2FPYTjyv.js +0 -2
- package/cdn/poster-2FPYTjyv.js.map +0 -1
- package/cdn/poster-gVT-J1-z.js +0 -215
- package/cdn/poster-gVT-J1-z.js.map +0 -1
- package/cdn/volume-slider-Co5X4Z1t.js.map +0 -1
- package/cdn/volume-slider-D18sXnIA.js +0 -8
- package/cdn/volume-slider-D18sXnIA.js.map +0 -1
- /package/cdn/{minimal-ui-BL9eBXck.js → minimal-ui-DXFwjywa.js} +0 -0
- /package/cdn/{minimal-ui-a1UOKF79.js → minimal-ui-jrmrxIOn.js} +0 -0
- /package/cdn/{ui-CFIgmrlA.js → ui-18UYtw8D.js} +0 -0
- /package/cdn/{ui-Ccp_LyCf.js → ui-8HVY3XSt.js} +0 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { t as listen } from "./listen-w-Aun0yN.js";
|
|
2
|
-
import { a as ContextRequestEvent, n as mediaContext, r as playerContext, t as containerContext } from "./context-
|
|
2
|
+
import { a as ContextRequestEvent, n as mediaContext, r as playerContext, t as containerContext } from "./context-CvJ83xGk.js";
|
|
3
3
|
import { t as anyAbortSignal } from "./abort-CzqmAxxH.js";
|
|
4
4
|
import { t as shallowEqual } from "./shallow-equal-C8Fs4TTE.js";
|
|
5
5
|
|
|
6
6
|
//#region ../utils/dist/dom/event.js
|
|
7
|
+
/** Resolve the deepest event target, preferring composedPath for shadow DOM. */
|
|
8
|
+
function resolveEventTarget(event) {
|
|
9
|
+
const path = event.composedPath();
|
|
10
|
+
return path.length > 0 ? path[0] : event.target;
|
|
11
|
+
}
|
|
7
12
|
function onEvent(target, type, options) {
|
|
8
13
|
return new Promise((resolve, reject) => {
|
|
9
14
|
const handleAbort = () => {
|
|
@@ -24,67 +29,6 @@ function onEvent(target, type, options) {
|
|
|
24
29
|
});
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region ../utils/dist/dom/supports.js
|
|
29
|
-
function supportsAnchorPositioning() {
|
|
30
|
-
return typeof CSS !== "undefined" && CSS.supports("anchor-name: --a");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region ../utils/dist/dom/popover.js
|
|
35
|
-
function tryShowPopover(el) {
|
|
36
|
-
try {
|
|
37
|
-
el?.showPopover?.();
|
|
38
|
-
} catch {}
|
|
39
|
-
}
|
|
40
|
-
function tryHidePopover(el) {
|
|
41
|
-
try {
|
|
42
|
-
el?.hidePopover?.();
|
|
43
|
-
} catch {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region ../utils/dist/string/casing.js
|
|
48
|
-
function kebabCase(str) {
|
|
49
|
-
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region ../utils/dist/dom/style.js
|
|
54
|
-
function applyStyles(element, styles) {
|
|
55
|
-
for (const [prop, value] of Object.entries(styles)) if (typeof value === "string") {
|
|
56
|
-
const key = prop.startsWith("--") ? prop : kebabCase(prop);
|
|
57
|
-
element.style.setProperty(key, value);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function resolveCSSLength(el, value) {
|
|
61
|
-
const trimmed = value.trim();
|
|
62
|
-
if (!trimmed) return 0;
|
|
63
|
-
const parsed = Number.parseFloat(trimmed);
|
|
64
|
-
if (Number.isNaN(parsed)) return 0;
|
|
65
|
-
if (/^-?\d*\.?\d+$/.test(trimmed) || trimmed.endsWith("px")) return parsed;
|
|
66
|
-
const doc = el.ownerDocument;
|
|
67
|
-
const root = doc?.documentElement;
|
|
68
|
-
if (trimmed.endsWith("rem")) return parsed * (root ? Number.parseFloat(getComputedStyle(root).fontSize) || 16 : 16);
|
|
69
|
-
if (trimmed.endsWith("em")) return parsed * (el instanceof HTMLElement ? Number.parseFloat(getComputedStyle(el).fontSize) || 16 : 16);
|
|
70
|
-
if (!doc) return parsed;
|
|
71
|
-
const measurementEl = doc.createElement("div");
|
|
72
|
-
measurementEl.style.position = "absolute";
|
|
73
|
-
measurementEl.style.visibility = "hidden";
|
|
74
|
-
measurementEl.style.pointerEvents = "none";
|
|
75
|
-
measurementEl.style.inlineSize = trimmed;
|
|
76
|
-
measurementEl.style.blockSize = "0";
|
|
77
|
-
measurementEl.style.padding = "0";
|
|
78
|
-
measurementEl.style.border = "0";
|
|
79
|
-
measurementEl.style.inset = "0";
|
|
80
|
-
const parent = doc.body ?? doc.documentElement;
|
|
81
|
-
if (!parent) return parsed;
|
|
82
|
-
parent.appendChild(measurementEl);
|
|
83
|
-
const pixels = measurementEl.getBoundingClientRect().width;
|
|
84
|
-
measurementEl.remove();
|
|
85
|
-
return Number.isFinite(pixels) ? pixels : parsed;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
32
|
//#endregion
|
|
89
33
|
//#region ../utils/dist/dom/text-track.js
|
|
90
34
|
/** Find the `<track>` element that owns the given `TextTrack`. */
|
|
@@ -97,7 +41,7 @@ function getTextTrackList(media, filterPred) {
|
|
|
97
41
|
return Array.from(media.textTracks).filter(filterPred).sort(sortByTextTrackKind);
|
|
98
42
|
}
|
|
99
43
|
function sortByTextTrackKind(a, b) {
|
|
100
|
-
return a.kind
|
|
44
|
+
return a.kind > b.kind ? 1 : a.kind < b.kind ? -1 : 0;
|
|
101
45
|
}
|
|
102
46
|
|
|
103
47
|
//#endregion
|
|
@@ -529,6 +473,13 @@ function combine(...slices) {
|
|
|
529
473
|
return {
|
|
530
474
|
state: (ctx) => {
|
|
531
475
|
const states = slices.map((slice) => slice.state(ctx));
|
|
476
|
+
{
|
|
477
|
+
const seen = /* @__PURE__ */ new Set();
|
|
478
|
+
for (const state of states) for (const key of Object.keys(state)) {
|
|
479
|
+
if (seen.has(key)) console.warn(`[vjs-store] combine(): duplicate state key "${key}" — later slice overwrites earlier one`);
|
|
480
|
+
seen.add(key);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
532
483
|
return Object.assign({}, ...states);
|
|
533
484
|
},
|
|
534
485
|
attach: (ctx) => {
|
|
@@ -560,54 +511,6 @@ function throwDestroyedError() {
|
|
|
560
511
|
throw new StoreError("DESTROYED");
|
|
561
512
|
}
|
|
562
513
|
|
|
563
|
-
//#endregion
|
|
564
|
-
//#region ../utils/dist/object/pick.js
|
|
565
|
-
/**
|
|
566
|
-
* Creates a new object with only the specified keys.
|
|
567
|
-
*
|
|
568
|
-
* @example
|
|
569
|
-
* const obj = { a: 1, b: 2, c: 3 };
|
|
570
|
-
* pick(obj, ['a', 'c']); // { a: 1, c: 3 }
|
|
571
|
-
*/
|
|
572
|
-
function pick(obj, keys) {
|
|
573
|
-
const result = {};
|
|
574
|
-
for (const key of keys) result[key] = obj[key];
|
|
575
|
-
return result;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
//#endregion
|
|
579
|
-
//#region ../store/dist/dev/core/selector.js
|
|
580
|
-
const stateContext = {
|
|
581
|
-
target: throwNoTargetError,
|
|
582
|
-
signals: new AbortControllerRegistry(),
|
|
583
|
-
set: throwNoTargetError
|
|
584
|
-
};
|
|
585
|
-
/**
|
|
586
|
-
* Create a type-safe selector for a slice's state.
|
|
587
|
-
*
|
|
588
|
-
* The selector returns the slice's state, or `undefined` if the slice
|
|
589
|
-
* is not configured in the store.
|
|
590
|
-
*
|
|
591
|
-
* @example
|
|
592
|
-
* ```ts
|
|
593
|
-
* const selectPlayback = createSelector(playbackSlice);
|
|
594
|
-
* selectPlayback(store.state); // { paused, play, pause, ... } | undefined
|
|
595
|
-
* selectPlayback.displayName; // 'playback' (from slice name)
|
|
596
|
-
* ```
|
|
597
|
-
*
|
|
598
|
-
* @param slice - The slice to create a selector for.
|
|
599
|
-
*/
|
|
600
|
-
function createSelector(slice) {
|
|
601
|
-
const initialState = slice.state(stateContext);
|
|
602
|
-
const keys = Object.keys(initialState);
|
|
603
|
-
const firstKey = keys[0];
|
|
604
|
-
if (!firstKey) return Object.assign(() => void 0, { displayName: slice.name });
|
|
605
|
-
return Object.assign((state) => {
|
|
606
|
-
if (!(firstKey in state)) return void 0;
|
|
607
|
-
return pick(state, keys);
|
|
608
|
-
}, { displayName: slice.name });
|
|
609
|
-
}
|
|
610
|
-
|
|
611
514
|
//#endregion
|
|
612
515
|
//#region ../store/dist/dev/core/slice.js
|
|
613
516
|
function defineSlice() {
|
|
@@ -618,33 +521,6 @@ function defineSlice() {
|
|
|
618
521
|
//#region ../utils/dist/function/noop.js
|
|
619
522
|
function noop(..._args) {}
|
|
620
523
|
|
|
621
|
-
//#endregion
|
|
622
|
-
//#region ../utils/dist/function/throttle.js
|
|
623
|
-
/**
|
|
624
|
-
* Trailing-edge throttle: the first call schedules a timer; subsequent calls
|
|
625
|
-
* within the window update the arguments. The function fires once per `ms`
|
|
626
|
-
* window with the latest arguments.
|
|
627
|
-
*/
|
|
628
|
-
function throttle(fn, ms) {
|
|
629
|
-
let timerId = null;
|
|
630
|
-
let latestArgs;
|
|
631
|
-
const throttled = (...args) => {
|
|
632
|
-
latestArgs = args;
|
|
633
|
-
if (timerId !== null) return;
|
|
634
|
-
timerId = setTimeout(() => {
|
|
635
|
-
timerId = null;
|
|
636
|
-
fn(...latestArgs);
|
|
637
|
-
}, ms);
|
|
638
|
-
};
|
|
639
|
-
throttled.cancel = () => {
|
|
640
|
-
if (timerId !== null) {
|
|
641
|
-
clearTimeout(timerId);
|
|
642
|
-
timerId = null;
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
return throttled;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
524
|
//#endregion
|
|
649
525
|
//#region ../store/dist/dev/core/state.js
|
|
650
526
|
let isFlushScheduled = false;
|
|
@@ -733,6 +609,7 @@ function createStore() {
|
|
|
733
609
|
return target;
|
|
734
610
|
},
|
|
735
611
|
signals,
|
|
612
|
+
get: () => state.current,
|
|
736
613
|
set: (partial) => state.patch(partial)
|
|
737
614
|
});
|
|
738
615
|
state = createState(initialState);
|
|
@@ -858,9 +735,17 @@ const IDLE_DELAY = 2e3;
|
|
|
858
735
|
const TAP_THRESHOLD = 250;
|
|
859
736
|
const controlsFeature = definePlayerFeature({
|
|
860
737
|
name: "controls",
|
|
861
|
-
state: () => ({
|
|
738
|
+
state: ({ get, set }) => ({
|
|
862
739
|
userActive: true,
|
|
863
|
-
controlsVisible: true
|
|
740
|
+
controlsVisible: true,
|
|
741
|
+
toggleControls() {
|
|
742
|
+
const next = !get().userActive;
|
|
743
|
+
set({
|
|
744
|
+
userActive: next,
|
|
745
|
+
controlsVisible: next
|
|
746
|
+
});
|
|
747
|
+
return next;
|
|
748
|
+
}
|
|
864
749
|
}),
|
|
865
750
|
attach({ target, signal, get, set }) {
|
|
866
751
|
const { media, container } = target;
|
|
@@ -894,6 +779,11 @@ const controlsFeature = definePlayerFeature({
|
|
|
894
779
|
controlsVisible: computeVisible(false)
|
|
895
780
|
});
|
|
896
781
|
}
|
|
782
|
+
set({ toggleControls() {
|
|
783
|
+
if (get().controlsVisible) setInactive();
|
|
784
|
+
else setActive();
|
|
785
|
+
return get().controlsVisible;
|
|
786
|
+
} });
|
|
897
787
|
let pointerDownTime = 0;
|
|
898
788
|
function onPointerDown() {
|
|
899
789
|
pointerDownTime = Date.now();
|
|
@@ -1162,6 +1052,9 @@ const playbackFeature = definePlayerFeature({
|
|
|
1162
1052
|
//#endregion
|
|
1163
1053
|
//#region ../core/dist/dev/dom/store/features/playback-rate.js
|
|
1164
1054
|
const DEFAULT_RATES = [
|
|
1055
|
+
.2,
|
|
1056
|
+
.5,
|
|
1057
|
+
.7,
|
|
1165
1058
|
1,
|
|
1166
1059
|
1.2,
|
|
1167
1060
|
1.5,
|
|
@@ -1312,15 +1205,19 @@ const timeFeature = definePlayerFeature({
|
|
|
1312
1205
|
return media.currentTime;
|
|
1313
1206
|
}
|
|
1314
1207
|
}),
|
|
1315
|
-
attach({ target, signal, set }) {
|
|
1208
|
+
attach({ target, signal, set, get }) {
|
|
1316
1209
|
const { media } = target;
|
|
1317
1210
|
const sync = () => set({
|
|
1318
1211
|
currentTime: media.currentTime,
|
|
1319
1212
|
duration: Number.isFinite(media.duration) ? media.duration : 0,
|
|
1320
1213
|
seeking: media.seeking
|
|
1321
1214
|
});
|
|
1215
|
+
const onTimeUpdate = () => {
|
|
1216
|
+
if (get().seeking) return;
|
|
1217
|
+
sync();
|
|
1218
|
+
};
|
|
1322
1219
|
sync();
|
|
1323
|
-
listen(media, "timeupdate",
|
|
1220
|
+
listen(media, "timeupdate", onTimeUpdate, { signal });
|
|
1324
1221
|
listen(media, "durationchange", sync, { signal });
|
|
1325
1222
|
listen(media, "seeking", sync, { signal });
|
|
1326
1223
|
listen(media, "seeked", sync, { signal });
|
|
@@ -1403,1278 +1300,6 @@ const audioFeatures = [
|
|
|
1403
1300
|
];
|
|
1404
1301
|
const backgroundFeatures = [];
|
|
1405
1302
|
|
|
1406
|
-
//#endregion
|
|
1407
|
-
//#region ../core/dist/dev/dom/store/selectors.js
|
|
1408
|
-
/** Select the buffer state (buffered ranges, percent buffered). */
|
|
1409
|
-
const selectBuffer = createSelector(bufferFeature);
|
|
1410
|
-
/** Select the controls state (controls visible, user-active). */
|
|
1411
|
-
const selectControls = createSelector(controlsFeature);
|
|
1412
|
-
/** Select the error state (error, dismissed, dismissError). */
|
|
1413
|
-
const selectError = createSelector(errorFeature);
|
|
1414
|
-
/** Select the fullscreen state (fullscreen active, availability). */
|
|
1415
|
-
const selectFullscreen = createSelector(fullscreenFeature);
|
|
1416
|
-
/** Select the PiP state (picture-in-picture active, availability). */
|
|
1417
|
-
const selectPiP = createSelector(pipFeature);
|
|
1418
|
-
/** Select the playback state (paused, ended, play, pause, toggle). */
|
|
1419
|
-
const selectPlayback = createSelector(playbackFeature);
|
|
1420
|
-
/** Select the playback rate state (playbackRate, playbackRates, setPlaybackRate). */
|
|
1421
|
-
const selectPlaybackRate = createSelector(playbackRateFeature);
|
|
1422
|
-
/** Select the source state (src, type). */
|
|
1423
|
-
const selectSource = createSelector(sourceFeature);
|
|
1424
|
-
/** Select the text track state (chapters cues, thumbnail cues). */
|
|
1425
|
-
const selectTextTrack = createSelector(textTrackFeature);
|
|
1426
|
-
/** Select the time state (currentTime, duration, seek). */
|
|
1427
|
-
const selectTime = createSelector(timeFeature);
|
|
1428
|
-
/** Select the volume state (volume, muted, setVolume, setMuted). */
|
|
1429
|
-
const selectVolume = createSelector(volumeFeature);
|
|
1430
|
-
|
|
1431
|
-
//#endregion
|
|
1432
|
-
//#region ../core/dist/dev/dom/ui/dismiss-layer.js
|
|
1433
|
-
function createDismissLayer(options) {
|
|
1434
|
-
const { transition } = options;
|
|
1435
|
-
const state = transition.state;
|
|
1436
|
-
const abort = new AbortController();
|
|
1437
|
-
let docAbort = null;
|
|
1438
|
-
function open() {
|
|
1439
|
-
if (abort.signal.aborted) return null;
|
|
1440
|
-
const { active, status } = state.current;
|
|
1441
|
-
if (active && status !== "ending") return null;
|
|
1442
|
-
if (status === "ending") transition.cancel();
|
|
1443
|
-
return transition.open();
|
|
1444
|
-
}
|
|
1445
|
-
function close(element) {
|
|
1446
|
-
const { active, status } = state.current;
|
|
1447
|
-
if (abort.signal.aborted || !active || status === "ending") return null;
|
|
1448
|
-
return transition.close(element);
|
|
1449
|
-
}
|
|
1450
|
-
function setupDocumentListeners() {
|
|
1451
|
-
cleanupDocumentListeners();
|
|
1452
|
-
if (typeof document === "undefined") return;
|
|
1453
|
-
docAbort = new AbortController();
|
|
1454
|
-
const { signal } = docAbort;
|
|
1455
|
-
listen(document, "keydown", handleKeydown, { signal });
|
|
1456
|
-
options.onDocumentActive?.(signal);
|
|
1457
|
-
}
|
|
1458
|
-
function cleanupDocumentListeners() {
|
|
1459
|
-
docAbort?.abort();
|
|
1460
|
-
docAbort = null;
|
|
1461
|
-
}
|
|
1462
|
-
function handleKeydown(event) {
|
|
1463
|
-
if (event.key !== "Escape") return;
|
|
1464
|
-
if (!state.current.active) return;
|
|
1465
|
-
if (!(options.closeOnEscape?.() ?? true)) return;
|
|
1466
|
-
options.onEscapeDismiss(event);
|
|
1467
|
-
}
|
|
1468
|
-
const unsubscribe = state.subscribe(() => {
|
|
1469
|
-
if (state.current.active) setupDocumentListeners();
|
|
1470
|
-
else cleanupDocumentListeners();
|
|
1471
|
-
});
|
|
1472
|
-
abort.signal.addEventListener("abort", () => {
|
|
1473
|
-
unsubscribe();
|
|
1474
|
-
transition.destroy();
|
|
1475
|
-
cleanupDocumentListeners();
|
|
1476
|
-
});
|
|
1477
|
-
function destroy() {
|
|
1478
|
-
if (abort.signal.aborted) return;
|
|
1479
|
-
abort.abort();
|
|
1480
|
-
}
|
|
1481
|
-
return {
|
|
1482
|
-
input: state,
|
|
1483
|
-
open,
|
|
1484
|
-
close,
|
|
1485
|
-
signal: abort.signal,
|
|
1486
|
-
destroy
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
//#endregion
|
|
1491
|
-
//#region ../core/dist/dev/dom/ui/alert-dialog.js
|
|
1492
|
-
function createAlertDialog(options) {
|
|
1493
|
-
const { onOpenChange } = options;
|
|
1494
|
-
let element = null;
|
|
1495
|
-
let previousFocus = null;
|
|
1496
|
-
let elementAbort = null;
|
|
1497
|
-
const layer = createDismissLayer({
|
|
1498
|
-
transition: options.transition,
|
|
1499
|
-
closeOnEscape: options.closeOnEscape,
|
|
1500
|
-
onEscapeDismiss(event) {
|
|
1501
|
-
event.stopPropagation();
|
|
1502
|
-
applyClose();
|
|
1503
|
-
}
|
|
1504
|
-
});
|
|
1505
|
-
const state = layer.input;
|
|
1506
|
-
function applyOpen() {
|
|
1507
|
-
previousFocus = document.activeElement;
|
|
1508
|
-
const opening = layer.open();
|
|
1509
|
-
if (!opening) return;
|
|
1510
|
-
onOpenChange(true);
|
|
1511
|
-
requestAnimationFrame(() => {
|
|
1512
|
-
if (layer.signal.aborted || !state.current.active) return;
|
|
1513
|
-
element?.focus();
|
|
1514
|
-
});
|
|
1515
|
-
opening.then(() => {
|
|
1516
|
-
if (layer.signal.aborted || !state.current.active) return;
|
|
1517
|
-
options.onOpenChangeComplete?.(true);
|
|
1518
|
-
});
|
|
1519
|
-
}
|
|
1520
|
-
function applyClose() {
|
|
1521
|
-
const closing = layer.close(element);
|
|
1522
|
-
if (!closing) return;
|
|
1523
|
-
onOpenChange(false);
|
|
1524
|
-
closing.then(() => {
|
|
1525
|
-
if (layer.signal.aborted) return;
|
|
1526
|
-
if (previousFocus) {
|
|
1527
|
-
previousFocus.focus();
|
|
1528
|
-
previousFocus = null;
|
|
1529
|
-
}
|
|
1530
|
-
options.onOpenChangeComplete?.(false);
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1533
|
-
function setupElementListeners() {
|
|
1534
|
-
cleanupElementListeners();
|
|
1535
|
-
if (!element) return;
|
|
1536
|
-
elementAbort = new AbortController();
|
|
1537
|
-
const { signal } = elementAbort;
|
|
1538
|
-
listen(element, "click", handleElementClick, { signal });
|
|
1539
|
-
}
|
|
1540
|
-
function cleanupElementListeners() {
|
|
1541
|
-
elementAbort?.abort();
|
|
1542
|
-
elementAbort = null;
|
|
1543
|
-
}
|
|
1544
|
-
function handleElementClick(event) {
|
|
1545
|
-
if (event.target instanceof HTMLButtonElement) applyClose();
|
|
1546
|
-
}
|
|
1547
|
-
function setElement(el) {
|
|
1548
|
-
element = el;
|
|
1549
|
-
setupElementListeners();
|
|
1550
|
-
}
|
|
1551
|
-
layer.signal.addEventListener("abort", () => {
|
|
1552
|
-
cleanupElementListeners();
|
|
1553
|
-
element = null;
|
|
1554
|
-
previousFocus = null;
|
|
1555
|
-
});
|
|
1556
|
-
return {
|
|
1557
|
-
input: state,
|
|
1558
|
-
open: applyOpen,
|
|
1559
|
-
close: applyClose,
|
|
1560
|
-
setElement,
|
|
1561
|
-
destroy: layer.destroy
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region ../core/dist/dev/dom/ui/button.js
|
|
1567
|
-
function createButton(options) {
|
|
1568
|
-
const { onActivate, isDisabled } = options;
|
|
1569
|
-
return {
|
|
1570
|
-
role: "button",
|
|
1571
|
-
tabIndex: 0,
|
|
1572
|
-
onClick(event) {
|
|
1573
|
-
if (isDisabled()) {
|
|
1574
|
-
event.preventDefault();
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
onActivate();
|
|
1578
|
-
},
|
|
1579
|
-
onPointerDown(event) {
|
|
1580
|
-
if (isDisabled()) event.preventDefault();
|
|
1581
|
-
},
|
|
1582
|
-
onMouseDown(event) {
|
|
1583
|
-
if (isDisabled()) event.preventDefault();
|
|
1584
|
-
},
|
|
1585
|
-
onKeyDown(event) {
|
|
1586
|
-
if (event.target !== event.currentTarget) return;
|
|
1587
|
-
if (isDisabled()) {
|
|
1588
|
-
if (event.key !== "Tab") event.preventDefault();
|
|
1589
|
-
return;
|
|
1590
|
-
}
|
|
1591
|
-
if (event.key === "Enter") {
|
|
1592
|
-
event.preventDefault();
|
|
1593
|
-
onActivate();
|
|
1594
|
-
} else if (event.key === " ") event.preventDefault();
|
|
1595
|
-
},
|
|
1596
|
-
onKeyUp(event) {
|
|
1597
|
-
if (event.target !== event.currentTarget) return;
|
|
1598
|
-
if (isDisabled()) return;
|
|
1599
|
-
if (event.key === " ") onActivate();
|
|
1600
|
-
}
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
//#endregion
|
|
1605
|
-
//#region ../core/dist/dev/dom/ui/popover/popover.js
|
|
1606
|
-
function createPopover(options) {
|
|
1607
|
-
const { onOpenChange, closeOnOutsideClick } = options;
|
|
1608
|
-
let triggerEl = null;
|
|
1609
|
-
let popupEl = null;
|
|
1610
|
-
let hoverTimeout = null;
|
|
1611
|
-
const capturedPointers = /* @__PURE__ */ new Set();
|
|
1612
|
-
const layer = createDismissLayer({
|
|
1613
|
-
transition: options.transition,
|
|
1614
|
-
closeOnEscape: options.closeOnEscape,
|
|
1615
|
-
onEscapeDismiss(event) {
|
|
1616
|
-
event.preventDefault();
|
|
1617
|
-
applyClose("escape", event);
|
|
1618
|
-
},
|
|
1619
|
-
onDocumentActive(signal) {
|
|
1620
|
-
listen(document, "pointerdown", handleDocumentPointerdown, {
|
|
1621
|
-
capture: true,
|
|
1622
|
-
signal
|
|
1623
|
-
});
|
|
1624
|
-
}
|
|
1625
|
-
});
|
|
1626
|
-
const state = layer.input;
|
|
1627
|
-
function clearHoverTimeout() {
|
|
1628
|
-
if (hoverTimeout !== null) {
|
|
1629
|
-
clearTimeout(hoverTimeout);
|
|
1630
|
-
hoverTimeout = null;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
function canHover() {
|
|
1634
|
-
return globalThis.matchMedia?.("(hover: hover)")?.matches ?? false;
|
|
1635
|
-
}
|
|
1636
|
-
function canOpenOnFocus() {
|
|
1637
|
-
if (!canHover()) return false;
|
|
1638
|
-
return globalThis.matchMedia?.("(pointer: fine)")?.matches ?? false;
|
|
1639
|
-
}
|
|
1640
|
-
function canToggleOnClick() {
|
|
1641
|
-
if (!options.openOnHover?.()) return true;
|
|
1642
|
-
return canHover();
|
|
1643
|
-
}
|
|
1644
|
-
/**
|
|
1645
|
-
* The transition handler manages animation lifecycle via `createState`:
|
|
1646
|
-
*
|
|
1647
|
-
* **Open:** `transition.open()` patches `{ active: true, status: 'starting' }`.
|
|
1648
|
-
* After one RAF it patches `{ status: 'idle' }` and the promise resolves.
|
|
1649
|
-
* Frameworks render `data-starting-style` / `data-ending-style` via
|
|
1650
|
-
* `getPopupAttrs(state)` — no imperative DOM mutation needed.
|
|
1651
|
-
*
|
|
1652
|
-
* **Close:** `transition.close(el)` patches `{ status: 'ending' }` (keeping
|
|
1653
|
-
* `active: true` so the element stays mounted). After a double-RAF it waits
|
|
1654
|
-
* for `getAnimations()` to settle, then patches `{ active: false, status: 'idle' }`.
|
|
1655
|
-
*
|
|
1656
|
-
* `onOpenChange` fires immediately (before animations).
|
|
1657
|
-
* `onOpenChangeComplete` fires after animations finish.
|
|
1658
|
-
*/
|
|
1659
|
-
function applyOpen(reason, event) {
|
|
1660
|
-
const opening = layer.open();
|
|
1661
|
-
if (!opening) return;
|
|
1662
|
-
onOpenChange(true, event ? {
|
|
1663
|
-
reason,
|
|
1664
|
-
event
|
|
1665
|
-
} : { reason });
|
|
1666
|
-
opening.then(() => {
|
|
1667
|
-
if (layer.signal.aborted || !state.current.active) return;
|
|
1668
|
-
options.onOpenChangeComplete?.(true);
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
function applyClose(reason, event) {
|
|
1672
|
-
const closing = layer.close(popupEl);
|
|
1673
|
-
if (!closing) return;
|
|
1674
|
-
onOpenChange(false, event ? {
|
|
1675
|
-
reason,
|
|
1676
|
-
event
|
|
1677
|
-
} : { reason });
|
|
1678
|
-
closing.then(() => {
|
|
1679
|
-
if (layer.signal.aborted) return;
|
|
1680
|
-
tryHidePopover(popupEl);
|
|
1681
|
-
options.onOpenChangeComplete?.(false);
|
|
1682
|
-
});
|
|
1683
|
-
}
|
|
1684
|
-
function open(reason = "click") {
|
|
1685
|
-
applyOpen(reason);
|
|
1686
|
-
}
|
|
1687
|
-
function close(reason = "click") {
|
|
1688
|
-
applyClose(reason);
|
|
1689
|
-
}
|
|
1690
|
-
function handleDocumentPointerdown(event) {
|
|
1691
|
-
if (!closeOnOutsideClick() || !state.current.active) return;
|
|
1692
|
-
const path = event.composedPath();
|
|
1693
|
-
if (triggerEl && path.includes(triggerEl) || popupEl && path.includes(popupEl)) return;
|
|
1694
|
-
applyClose("outside-click", event);
|
|
1695
|
-
}
|
|
1696
|
-
layer.signal.addEventListener("abort", () => {
|
|
1697
|
-
clearHoverTimeout();
|
|
1698
|
-
capturedPointers.clear();
|
|
1699
|
-
triggerEl = null;
|
|
1700
|
-
popupEl = null;
|
|
1701
|
-
});
|
|
1702
|
-
const triggerProps = {
|
|
1703
|
-
onClick(event) {
|
|
1704
|
-
if (!canToggleOnClick()) return;
|
|
1705
|
-
if (state.current.active && state.current.status !== "ending") applyClose("click", event);
|
|
1706
|
-
else applyOpen("click", event);
|
|
1707
|
-
},
|
|
1708
|
-
onPointerEnter(_event) {
|
|
1709
|
-
if (!options.openOnHover?.()) return;
|
|
1710
|
-
if (!canHover()) return;
|
|
1711
|
-
clearHoverTimeout();
|
|
1712
|
-
if (state.current.active) return;
|
|
1713
|
-
const delay = options.delay?.() ?? 300;
|
|
1714
|
-
hoverTimeout = setTimeout(() => applyOpen("hover"), delay);
|
|
1715
|
-
},
|
|
1716
|
-
onPointerLeave(_event) {
|
|
1717
|
-
if (!options.openOnHover?.()) return;
|
|
1718
|
-
if (!canHover()) return;
|
|
1719
|
-
clearHoverTimeout();
|
|
1720
|
-
if (!state.current.active) return;
|
|
1721
|
-
const closeDelay = options.closeDelay?.() ?? 0;
|
|
1722
|
-
hoverTimeout = setTimeout(() => applyClose("hover"), closeDelay);
|
|
1723
|
-
},
|
|
1724
|
-
onFocusIn(_event) {
|
|
1725
|
-
if (options.openOnHover?.()) {
|
|
1726
|
-
if (!canOpenOnFocus()) return;
|
|
1727
|
-
applyOpen("focus");
|
|
1728
|
-
}
|
|
1729
|
-
},
|
|
1730
|
-
onFocusOut(event) {
|
|
1731
|
-
const relatedTarget = event.relatedTarget;
|
|
1732
|
-
if (relatedTarget && (triggerEl?.contains(relatedTarget) || popupEl?.contains(relatedTarget))) return;
|
|
1733
|
-
if (options.openOnHover?.()) applyClose("blur");
|
|
1734
|
-
}
|
|
1735
|
-
};
|
|
1736
|
-
const popupProps = {
|
|
1737
|
-
onPointerEnter(_event) {
|
|
1738
|
-
if (!options.openOnHover?.()) return;
|
|
1739
|
-
clearHoverTimeout();
|
|
1740
|
-
},
|
|
1741
|
-
onPointerLeave(_event) {
|
|
1742
|
-
if (!options.openOnHover?.()) return;
|
|
1743
|
-
if (capturedPointers.size > 0) return;
|
|
1744
|
-
clearHoverTimeout();
|
|
1745
|
-
if (!state.current.active) return;
|
|
1746
|
-
const closeDelay = options.closeDelay?.() ?? 0;
|
|
1747
|
-
hoverTimeout = setTimeout(() => applyClose("hover"), closeDelay);
|
|
1748
|
-
},
|
|
1749
|
-
onGotPointerCapture(event) {
|
|
1750
|
-
capturedPointers.add(event.pointerId);
|
|
1751
|
-
},
|
|
1752
|
-
onLostPointerCapture(event) {
|
|
1753
|
-
capturedPointers.delete(event.pointerId);
|
|
1754
|
-
},
|
|
1755
|
-
onFocusOut(event) {
|
|
1756
|
-
const relatedTarget = event.relatedTarget;
|
|
1757
|
-
if (relatedTarget && (triggerEl?.contains(relatedTarget) || popupEl?.contains(relatedTarget))) return;
|
|
1758
|
-
applyClose("blur");
|
|
1759
|
-
}
|
|
1760
|
-
};
|
|
1761
|
-
function setTriggerElement(el) {
|
|
1762
|
-
triggerEl = el;
|
|
1763
|
-
}
|
|
1764
|
-
function setPopupElement(el) {
|
|
1765
|
-
if (!el && popupEl && state.current.active) tryHidePopover(popupEl);
|
|
1766
|
-
popupEl = el;
|
|
1767
|
-
if (el) {
|
|
1768
|
-
if (state.current.active) tryShowPopover(el);
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
return {
|
|
1772
|
-
input: state,
|
|
1773
|
-
triggerProps,
|
|
1774
|
-
popupProps,
|
|
1775
|
-
get triggerElement() {
|
|
1776
|
-
return triggerEl;
|
|
1777
|
-
},
|
|
1778
|
-
setTriggerElement,
|
|
1779
|
-
setPopupElement,
|
|
1780
|
-
open,
|
|
1781
|
-
close,
|
|
1782
|
-
destroy: layer.destroy
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
//#endregion
|
|
1787
|
-
//#region ../core/dist/dev/core/ui/popover/popover-css-vars.js
|
|
1788
|
-
const PopoverCSSVars = {
|
|
1789
|
-
sideOffset: "--media-popover-side-offset",
|
|
1790
|
-
alignOffset: "--media-popover-align-offset",
|
|
1791
|
-
anchorWidth: "--media-popover-anchor-width",
|
|
1792
|
-
anchorHeight: "--media-popover-anchor-height",
|
|
1793
|
-
availableWidth: "--media-popover-available-width",
|
|
1794
|
-
availableHeight: "--media-popover-available-height"
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
|
-
//#endregion
|
|
1798
|
-
//#region ../core/dist/dev/dom/ui/popover/popover-positioning.js
|
|
1799
|
-
const OPPOSITE_SIDE = {
|
|
1800
|
-
top: "bottom",
|
|
1801
|
-
bottom: "top",
|
|
1802
|
-
left: "right",
|
|
1803
|
-
right: "left"
|
|
1804
|
-
};
|
|
1805
|
-
/**
|
|
1806
|
-
* Get positioning styles for the popup element.
|
|
1807
|
-
*
|
|
1808
|
-
* When the browser supports CSS Anchor Positioning, returns native CSS properties
|
|
1809
|
-
* that reference the provided CSS var names for side/align offsets — no JS offset
|
|
1810
|
-
* values needed.
|
|
1811
|
-
*
|
|
1812
|
-
* When rects are provided and anchor positioning is unsupported, falls back to
|
|
1813
|
-
* manual JS-computed positioning. The caller must resolve offset CSS vars via
|
|
1814
|
-
* `getComputedStyle` and pass them as `offsets`.
|
|
1815
|
-
*
|
|
1816
|
-
* Returns camelCase keys for standard CSS properties and `--*` keys for
|
|
1817
|
-
* custom properties — compatible with both React's `style` prop and
|
|
1818
|
-
* `applyStyles()` from `@videojs/utils/dom`.
|
|
1819
|
-
*/
|
|
1820
|
-
function getAnchorPositionStyle(anchorName, opts, triggerRect, popupRect, boundaryRect, offsets, cssVars = PopoverCSSVars) {
|
|
1821
|
-
if (supportsAnchorPositioning()) return getAnchorPositionCSS(anchorName, opts, cssVars);
|
|
1822
|
-
if (triggerRect && popupRect) return {
|
|
1823
|
-
...getManualPositionStyle(triggerRect, popupRect, opts, offsets ?? {
|
|
1824
|
-
sideOffset: 0,
|
|
1825
|
-
alignOffset: 0
|
|
1826
|
-
}),
|
|
1827
|
-
...boundaryRect ? getPositioningCSSVars(triggerRect, boundaryRect, opts.side, cssVars) : {},
|
|
1828
|
-
position: "fixed",
|
|
1829
|
-
inset: "auto",
|
|
1830
|
-
margin: "0"
|
|
1831
|
-
};
|
|
1832
|
-
return {};
|
|
1833
|
-
}
|
|
1834
|
-
/** Generate style to set on the trigger for CSS Anchor Positioning. */
|
|
1835
|
-
function getAnchorNameStyle(anchorName) {
|
|
1836
|
-
if (!supportsAnchorPositioning()) return {};
|
|
1837
|
-
return { anchorName: `--${anchorName}` };
|
|
1838
|
-
}
|
|
1839
|
-
function getAnchorPositionCSS(anchorName, opts, cssVars = PopoverCSSVars) {
|
|
1840
|
-
const SIDE_OFFSET_VAR = `var(${cssVars.sideOffset}, 0px)`;
|
|
1841
|
-
const ALIGN_OFFSET_VAR = `var(${cssVars.alignOffset}, 0px)`;
|
|
1842
|
-
const { side, align } = opts;
|
|
1843
|
-
const style = {
|
|
1844
|
-
positionAnchor: `--${anchorName}`,
|
|
1845
|
-
position: "fixed",
|
|
1846
|
-
inset: "auto",
|
|
1847
|
-
margin: "0",
|
|
1848
|
-
justifySelf: "normal",
|
|
1849
|
-
alignSelf: "normal",
|
|
1850
|
-
marginInlineStart: "0",
|
|
1851
|
-
marginBlockStart: "0"
|
|
1852
|
-
};
|
|
1853
|
-
const insetProp = OPPOSITE_SIDE[side];
|
|
1854
|
-
if (side === "top" || side === "bottom") {
|
|
1855
|
-
style[insetProp] = `calc(anchor(${side}) + ${SIDE_OFFSET_VAR})`;
|
|
1856
|
-
if (align === "start") style.left = `calc(anchor(left) + ${ALIGN_OFFSET_VAR})`;
|
|
1857
|
-
else if (align === "end") style.right = `calc(anchor(right) + ${ALIGN_OFFSET_VAR})`;
|
|
1858
|
-
else {
|
|
1859
|
-
style.justifySelf = "anchor-center";
|
|
1860
|
-
style.marginInlineStart = ALIGN_OFFSET_VAR;
|
|
1861
|
-
}
|
|
1862
|
-
} else {
|
|
1863
|
-
style[insetProp] = `calc(anchor(${side}) + ${SIDE_OFFSET_VAR})`;
|
|
1864
|
-
if (align === "start") style.top = `calc(anchor(top) + ${ALIGN_OFFSET_VAR})`;
|
|
1865
|
-
else if (align === "end") style.bottom = `calc(anchor(bottom) + ${ALIGN_OFFSET_VAR})`;
|
|
1866
|
-
else {
|
|
1867
|
-
style.alignSelf = "anchor-center";
|
|
1868
|
-
style.marginBlockStart = ALIGN_OFFSET_VAR;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
return style;
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Compute CSS variables for sizing constraints relative to the anchor/boundary.
|
|
1875
|
-
*
|
|
1876
|
-
* Accepts a `cssVars` map so the same logic works for both popover
|
|
1877
|
-
* (`--media-popover-*`) and tooltip (`--media-tooltip-*`) namespaces.
|
|
1878
|
-
*/
|
|
1879
|
-
function getPositioningCSSVars(triggerRect, boundaryRect, side, cssVars = PopoverCSSVars) {
|
|
1880
|
-
const vars = {};
|
|
1881
|
-
vars[cssVars.anchorWidth] = `${triggerRect.width}px`;
|
|
1882
|
-
vars[cssVars.anchorHeight] = `${triggerRect.height}px`;
|
|
1883
|
-
if (side === "top" || side === "bottom") {
|
|
1884
|
-
vars[cssVars.availableHeight] = side === "top" ? `${triggerRect.top - boundaryRect.top}px` : `${boundaryRect.bottom - triggerRect.bottom}px`;
|
|
1885
|
-
vars[cssVars.availableWidth] = `${boundaryRect.width}px`;
|
|
1886
|
-
} else {
|
|
1887
|
-
vars[cssVars.availableWidth] = side === "left" ? `${triggerRect.left - boundaryRect.left}px` : `${boundaryRect.right - triggerRect.right}px`;
|
|
1888
|
-
vars[cssVars.availableHeight] = `${boundaryRect.height}px`;
|
|
1889
|
-
}
|
|
1890
|
-
return vars;
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Compute manual positioning when CSS Anchor Positioning is not supported.
|
|
1894
|
-
*
|
|
1895
|
-
* Returns inline `top`/`left` styles in **viewport coordinates** for use
|
|
1896
|
-
* with `position: fixed` (the popup is in the top layer). All rects from
|
|
1897
|
-
* `getBoundingClientRect()` are already viewport-relative.
|
|
1898
|
-
*
|
|
1899
|
-
* Offsets are resolved by the caller from CSS custom properties via
|
|
1900
|
-
* `getComputedStyle()` and passed as `offsets`.
|
|
1901
|
-
*/
|
|
1902
|
-
function getManualPositionStyle(triggerRect, popupRect, opts, offsets = {
|
|
1903
|
-
sideOffset: 0,
|
|
1904
|
-
alignOffset: 0
|
|
1905
|
-
}) {
|
|
1906
|
-
const { side, align } = opts;
|
|
1907
|
-
const { sideOffset, alignOffset } = offsets;
|
|
1908
|
-
let top = 0;
|
|
1909
|
-
let left = 0;
|
|
1910
|
-
if (side === "top") top = triggerRect.top - popupRect.height - sideOffset;
|
|
1911
|
-
else if (side === "bottom") top = triggerRect.bottom + sideOffset;
|
|
1912
|
-
else if (side === "left") left = triggerRect.left - popupRect.width - sideOffset;
|
|
1913
|
-
else left = triggerRect.right + sideOffset;
|
|
1914
|
-
if (side === "top" || side === "bottom") if (align === "start") left = triggerRect.left + alignOffset;
|
|
1915
|
-
else if (align === "end") left = triggerRect.right - popupRect.width + alignOffset;
|
|
1916
|
-
else left = triggerRect.left + (triggerRect.width - popupRect.width) / 2 + alignOffset;
|
|
1917
|
-
else if (align === "start") top = triggerRect.top + alignOffset;
|
|
1918
|
-
else if (align === "end") top = triggerRect.bottom - popupRect.height + alignOffset;
|
|
1919
|
-
else top = triggerRect.top + (triggerRect.height - popupRect.height) / 2 + alignOffset;
|
|
1920
|
-
return {
|
|
1921
|
-
top: `${top}px`,
|
|
1922
|
-
left: `${left}px`
|
|
1923
|
-
};
|
|
1924
|
-
}
|
|
1925
|
-
/**
|
|
1926
|
-
* Read side-offset and align-offset CSS custom properties from the
|
|
1927
|
-
* popup element's computed style, returning numeric pixel values.
|
|
1928
|
-
*/
|
|
1929
|
-
function resolveOffsets(el, cssVars = PopoverCSSVars) {
|
|
1930
|
-
const computed = getComputedStyle(el);
|
|
1931
|
-
return {
|
|
1932
|
-
sideOffset: resolveCSSLength(el, computed.getPropertyValue(cssVars.sideOffset)),
|
|
1933
|
-
alignOffset: resolveCSSLength(el, computed.getPropertyValue(cssVars.alignOffset))
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
/**
|
|
1937
|
-
* Measure the popup's layout box for positioning.
|
|
1938
|
-
*
|
|
1939
|
-
* `getBoundingClientRect()` includes active transforms, which causes the
|
|
1940
|
-
* fallback position to drift while opening/closing animations scale the popup.
|
|
1941
|
-
* Using `offsetWidth`/`offsetHeight` preserves the untransformed size.
|
|
1942
|
-
*/
|
|
1943
|
-
function getPopupPositionRect(el) {
|
|
1944
|
-
const rect = el.getBoundingClientRect();
|
|
1945
|
-
const width = el.offsetWidth || rect.width;
|
|
1946
|
-
const height = el.offsetHeight || rect.height;
|
|
1947
|
-
const adjustedRect = {
|
|
1948
|
-
...rect,
|
|
1949
|
-
width,
|
|
1950
|
-
height,
|
|
1951
|
-
right: rect.left + width,
|
|
1952
|
-
bottom: rect.top + height
|
|
1953
|
-
};
|
|
1954
|
-
return {
|
|
1955
|
-
...adjustedRect,
|
|
1956
|
-
toJSON: () => adjustedRect
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
//#endregion
|
|
1961
|
-
//#region ../utils/dist/number/number.js
|
|
1962
|
-
/** Clamp a value between min and max (inclusive). */
|
|
1963
|
-
function clamp(value, min, max) {
|
|
1964
|
-
return Math.max(min, Math.min(max, value));
|
|
1965
|
-
}
|
|
1966
|
-
/** Snap a value to the nearest step, offset from min. */
|
|
1967
|
-
function roundToStep(value, step, min) {
|
|
1968
|
-
const nearest = Math.round((value - min) / step) * step + min;
|
|
1969
|
-
const dot = `${step}`.indexOf(".");
|
|
1970
|
-
return dot === -1 ? nearest : Number(nearest.toFixed(`${step}`.length - dot - 1));
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
//#endregion
|
|
1974
|
-
//#region ../core/dist/dev/dom/utils/pointer.js
|
|
1975
|
-
/** Convert a pointer event position to a 0–100 percent along an element's rect. */
|
|
1976
|
-
function getPercentFromPointerEvent(event, rect, orientation, isRTL) {
|
|
1977
|
-
let ratio;
|
|
1978
|
-
if (orientation === "vertical") ratio = 1 - (event.clientY - rect.top) / rect.height;
|
|
1979
|
-
else if (isRTL) ratio = (rect.right - event.clientX) / rect.width;
|
|
1980
|
-
else ratio = (event.clientX - rect.left) / rect.width;
|
|
1981
|
-
if (!Number.isFinite(ratio)) return 0;
|
|
1982
|
-
return clamp(ratio * 100, 0, 100);
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
//#endregion
|
|
1986
|
-
//#region ../core/dist/dev/dom/ui/slider.js
|
|
1987
|
-
/** Intentional drag threshold — number of pointermove events before drag starts. */
|
|
1988
|
-
const DRAG_THRESHOLD = 2;
|
|
1989
|
-
function createSlider(options) {
|
|
1990
|
-
const input = createState({
|
|
1991
|
-
pointerPercent: 0,
|
|
1992
|
-
dragPercent: 0,
|
|
1993
|
-
dragging: false,
|
|
1994
|
-
pointing: false,
|
|
1995
|
-
focused: false
|
|
1996
|
-
});
|
|
1997
|
-
const abort = new AbortController();
|
|
1998
|
-
const commitThrottleMs = options.commitThrottle ?? 0;
|
|
1999
|
-
let isDragging = false, moveCount = 0, cachedRTL = false, cachedRect = null, capturedPointerId = null;
|
|
2000
|
-
const throttledCommit = commitThrottleMs > 0 ? throttle((percent) => options.onValueCommit?.(percent), commitThrottleMs) : null;
|
|
2001
|
-
function releaseCapture() {
|
|
2002
|
-
if (isNull(capturedPointerId)) return;
|
|
2003
|
-
const id = capturedPointerId;
|
|
2004
|
-
capturedPointerId = null;
|
|
2005
|
-
try {
|
|
2006
|
-
options.getElement().releasePointerCapture(id);
|
|
2007
|
-
} catch {}
|
|
2008
|
-
}
|
|
2009
|
-
function endDrag() {
|
|
2010
|
-
if (!isDragging) input.patch({ pointing: false });
|
|
2011
|
-
else {
|
|
2012
|
-
isDragging = false;
|
|
2013
|
-
input.patch({
|
|
2014
|
-
dragging: false,
|
|
2015
|
-
pointing: false
|
|
2016
|
-
});
|
|
2017
|
-
options.onDragEnd?.();
|
|
2018
|
-
}
|
|
2019
|
-
cleanup();
|
|
2020
|
-
}
|
|
2021
|
-
function cleanup() {
|
|
2022
|
-
throttledCommit?.cancel();
|
|
2023
|
-
capturedPointerId = null;
|
|
2024
|
-
cachedRect = null;
|
|
2025
|
-
}
|
|
2026
|
-
const rootProps = {
|
|
2027
|
-
onPointerDown(event) {
|
|
2028
|
-
if (options.isDisabled()) return;
|
|
2029
|
-
event.preventDefault();
|
|
2030
|
-
const el = options.getElement();
|
|
2031
|
-
cachedRect = el.getBoundingClientRect();
|
|
2032
|
-
cachedRTL = options.isRTL();
|
|
2033
|
-
moveCount = 0;
|
|
2034
|
-
releaseCapture();
|
|
2035
|
-
capturedPointerId = event.pointerId;
|
|
2036
|
-
el.setPointerCapture(event.pointerId);
|
|
2037
|
-
const percent = getPercentFromPointerEvent(event, cachedRect, options.getOrientation(), cachedRTL);
|
|
2038
|
-
input.patch({
|
|
2039
|
-
pointing: true,
|
|
2040
|
-
pointerPercent: percent,
|
|
2041
|
-
dragPercent: percent
|
|
2042
|
-
});
|
|
2043
|
-
options.onValueChange?.(percent);
|
|
2044
|
-
options.getThumbElement?.()?.focus({
|
|
2045
|
-
preventScroll: true,
|
|
2046
|
-
focusVisible: false
|
|
2047
|
-
});
|
|
2048
|
-
},
|
|
2049
|
-
onPointerMove(event) {
|
|
2050
|
-
if (options.isDisabled()) return;
|
|
2051
|
-
if (!isNull(capturedPointerId)) {
|
|
2052
|
-
if (event.pointerType !== "touch" && event.buttons === 0) {
|
|
2053
|
-
endDrag();
|
|
2054
|
-
return;
|
|
2055
|
-
}
|
|
2056
|
-
moveCount++;
|
|
2057
|
-
const percent = getPercentFromPointerEvent(event, cachedRect, options.getOrientation(), cachedRTL);
|
|
2058
|
-
if (!isDragging && moveCount >= DRAG_THRESHOLD) {
|
|
2059
|
-
isDragging = true;
|
|
2060
|
-
input.patch({
|
|
2061
|
-
dragging: true,
|
|
2062
|
-
dragPercent: percent,
|
|
2063
|
-
pointerPercent: percent
|
|
2064
|
-
});
|
|
2065
|
-
options.onDragStart?.();
|
|
2066
|
-
options.onValueChange?.(percent);
|
|
2067
|
-
throttledCommit?.(percent);
|
|
2068
|
-
} else if (isDragging) {
|
|
2069
|
-
input.patch({
|
|
2070
|
-
dragPercent: percent,
|
|
2071
|
-
pointerPercent: percent
|
|
2072
|
-
});
|
|
2073
|
-
options.onValueChange?.(percent);
|
|
2074
|
-
throttledCommit?.(percent);
|
|
2075
|
-
} else input.patch({ pointerPercent: percent });
|
|
2076
|
-
return;
|
|
2077
|
-
}
|
|
2078
|
-
const percent = getPercentFromPointerEvent(event, options.getElement().getBoundingClientRect(), options.getOrientation(), options.isRTL());
|
|
2079
|
-
input.patch({
|
|
2080
|
-
pointing: true,
|
|
2081
|
-
pointerPercent: percent
|
|
2082
|
-
});
|
|
2083
|
-
},
|
|
2084
|
-
onPointerUp(event) {
|
|
2085
|
-
if (isNull(capturedPointerId)) return;
|
|
2086
|
-
const percent = getPercentFromPointerEvent(event, cachedRect, options.getOrientation(), cachedRTL);
|
|
2087
|
-
throttledCommit?.cancel();
|
|
2088
|
-
options.onValueCommit?.(percent);
|
|
2089
|
-
},
|
|
2090
|
-
onPointerLeave() {
|
|
2091
|
-
if (!isNull(capturedPointerId)) return;
|
|
2092
|
-
input.patch({ pointing: false });
|
|
2093
|
-
},
|
|
2094
|
-
onLostPointerCapture() {
|
|
2095
|
-
endDrag();
|
|
2096
|
-
}
|
|
2097
|
-
};
|
|
2098
|
-
const thumbProps = {
|
|
2099
|
-
onKeyDown(event) {
|
|
2100
|
-
if (options.isDisabled()) {
|
|
2101
|
-
if (event.key !== "Tab") event.preventDefault();
|
|
2102
|
-
return;
|
|
2103
|
-
}
|
|
2104
|
-
const stepPercent = options.getStepPercent();
|
|
2105
|
-
const largeStepPercent = options.getLargeStepPercent();
|
|
2106
|
-
const rounded = roundToStep(options.getPercent(), stepPercent, 0);
|
|
2107
|
-
const horizontalSign = options.isRTL() ? -1 : 1;
|
|
2108
|
-
const step = event.shiftKey ? largeStepPercent : stepPercent;
|
|
2109
|
-
let newPercent = null;
|
|
2110
|
-
switch (event.key) {
|
|
2111
|
-
case "ArrowRight":
|
|
2112
|
-
newPercent = rounded + step * horizontalSign;
|
|
2113
|
-
break;
|
|
2114
|
-
case "ArrowLeft":
|
|
2115
|
-
newPercent = rounded - step * horizontalSign;
|
|
2116
|
-
break;
|
|
2117
|
-
case "ArrowUp":
|
|
2118
|
-
newPercent = rounded + step;
|
|
2119
|
-
break;
|
|
2120
|
-
case "ArrowDown":
|
|
2121
|
-
newPercent = rounded - step;
|
|
2122
|
-
break;
|
|
2123
|
-
case "PageUp":
|
|
2124
|
-
newPercent = rounded + largeStepPercent;
|
|
2125
|
-
break;
|
|
2126
|
-
case "PageDown":
|
|
2127
|
-
newPercent = rounded - largeStepPercent;
|
|
2128
|
-
break;
|
|
2129
|
-
case "Home":
|
|
2130
|
-
newPercent = 0;
|
|
2131
|
-
break;
|
|
2132
|
-
case "End":
|
|
2133
|
-
newPercent = 100;
|
|
2134
|
-
break;
|
|
2135
|
-
default:
|
|
2136
|
-
if (!event.metaKey && !event.ctrlKey && !event.altKey && event.key >= "0" && event.key <= "9") newPercent = Number(event.key) * 10;
|
|
2137
|
-
break;
|
|
2138
|
-
}
|
|
2139
|
-
if (newPercent !== null) {
|
|
2140
|
-
event.preventDefault();
|
|
2141
|
-
newPercent = clamp(newPercent, 0, 100);
|
|
2142
|
-
input.patch({
|
|
2143
|
-
pointerPercent: newPercent,
|
|
2144
|
-
dragPercent: newPercent
|
|
2145
|
-
});
|
|
2146
|
-
options.onValueChange?.(newPercent);
|
|
2147
|
-
options.onValueCommit?.(newPercent);
|
|
2148
|
-
}
|
|
2149
|
-
},
|
|
2150
|
-
onFocus() {
|
|
2151
|
-
input.patch({ focused: true });
|
|
2152
|
-
},
|
|
2153
|
-
onBlur() {
|
|
2154
|
-
input.patch({ focused: false });
|
|
2155
|
-
}
|
|
2156
|
-
};
|
|
2157
|
-
function adjustForAlignment(state) {
|
|
2158
|
-
if (!options.adjustPercent || state.thumbAlignment !== "edge") return state;
|
|
2159
|
-
const rootEl = options.getElement();
|
|
2160
|
-
const thumbEl = options.getThumbElement?.();
|
|
2161
|
-
if (!thumbEl) return state;
|
|
2162
|
-
const isHorizontal = state.orientation === "horizontal";
|
|
2163
|
-
const thumbSize = isHorizontal ? thumbEl.offsetWidth : thumbEl.offsetHeight;
|
|
2164
|
-
const trackSize = isHorizontal ? rootEl.offsetWidth : rootEl.offsetHeight;
|
|
2165
|
-
return {
|
|
2166
|
-
...state,
|
|
2167
|
-
fillPercent: options.adjustPercent(state.fillPercent, thumbSize, trackSize),
|
|
2168
|
-
pointerPercent: options.adjustPercent(state.pointerPercent, thumbSize, trackSize)
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
let resizeObserver = null;
|
|
2172
|
-
if (options.onResize) {
|
|
2173
|
-
resizeObserver = new ResizeObserver(() => options.onResize());
|
|
2174
|
-
resizeObserver.observe(options.getElement());
|
|
2175
|
-
}
|
|
2176
|
-
return {
|
|
2177
|
-
input,
|
|
2178
|
-
rootProps,
|
|
2179
|
-
rootStyle: {
|
|
2180
|
-
touchAction: "none",
|
|
2181
|
-
userSelect: "none"
|
|
2182
|
-
},
|
|
2183
|
-
thumbProps,
|
|
2184
|
-
adjustForAlignment,
|
|
2185
|
-
destroy() {
|
|
2186
|
-
if (abort.signal.aborted) return;
|
|
2187
|
-
abort.abort();
|
|
2188
|
-
resizeObserver?.disconnect();
|
|
2189
|
-
releaseCapture();
|
|
2190
|
-
cleanup();
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
//#endregion
|
|
2196
|
-
//#region ../core/dist/dev/core/ui/slider/slider-css-vars.js
|
|
2197
|
-
/** CSS custom property names for slider visual state. */
|
|
2198
|
-
const SliderCSSVars = {
|
|
2199
|
-
fill: "--media-slider-fill",
|
|
2200
|
-
pointer: "--media-slider-pointer",
|
|
2201
|
-
buffer: "--media-slider-buffer"
|
|
2202
|
-
};
|
|
2203
|
-
|
|
2204
|
-
//#endregion
|
|
2205
|
-
//#region ../core/dist/dev/dom/ui/slider-css-vars.js
|
|
2206
|
-
function getSliderCSSVars(state) {
|
|
2207
|
-
return {
|
|
2208
|
-
[SliderCSSVars.fill]: `${state.fillPercent.toFixed(3)}%`,
|
|
2209
|
-
[SliderCSSVars.pointer]: `${state.pointerPercent.toFixed(3)}%`
|
|
2210
|
-
};
|
|
2211
|
-
}
|
|
2212
|
-
function getTimeSliderCSSVars(state) {
|
|
2213
|
-
return {
|
|
2214
|
-
...getSliderCSSVars(state),
|
|
2215
|
-
[SliderCSSVars.buffer]: `${state.bufferPercent.toFixed(3)}%`
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
/** Compute structural positioning styles for a slider preview element. */
|
|
2219
|
-
function getSliderPreviewStyle(width, overflow) {
|
|
2220
|
-
const halfWidth = width / 2;
|
|
2221
|
-
return {
|
|
2222
|
-
position: "absolute",
|
|
2223
|
-
left: overflow === "visible" ? `calc(var(${SliderCSSVars.pointer}) - ${halfWidth}px)` : `min(max(0px, calc(var(${SliderCSSVars.pointer}) - ${halfWidth}px)), calc(100% - ${width}px))`,
|
|
2224
|
-
width: "max-content",
|
|
2225
|
-
pointerEvents: "none"
|
|
2226
|
-
};
|
|
2227
|
-
}
|
|
2228
|
-
|
|
2229
|
-
//#endregion
|
|
2230
|
-
//#region ../core/dist/dev/core/ui/thumbnail/thumbnail-core.js
|
|
2231
|
-
var ThumbnailCore = class {
|
|
2232
|
-
findActiveThumbnail(thumbnails, time) {
|
|
2233
|
-
if (thumbnails.length === 0) return void 0;
|
|
2234
|
-
let low = 0;
|
|
2235
|
-
let high = thumbnails.length - 1;
|
|
2236
|
-
let result;
|
|
2237
|
-
while (low <= high) {
|
|
2238
|
-
const mid = low + high >>> 1;
|
|
2239
|
-
const image = thumbnails[mid];
|
|
2240
|
-
if (time >= image.startTime) {
|
|
2241
|
-
result = image;
|
|
2242
|
-
low = mid + 1;
|
|
2243
|
-
} else high = mid - 1;
|
|
2244
|
-
}
|
|
2245
|
-
return result;
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* Parse CSS constraint strings into numeric `ThumbnailConstraints`.
|
|
2249
|
-
*
|
|
2250
|
-
* Accepts any object with string `minWidth`/`maxWidth`/`minHeight`/`maxHeight`
|
|
2251
|
-
* properties — `CSSStyleDeclaration` satisfies this structurally.
|
|
2252
|
-
*/
|
|
2253
|
-
parseConstraints(raw) {
|
|
2254
|
-
const minW = parseFloat(raw.minWidth);
|
|
2255
|
-
const maxW = parseFloat(raw.maxWidth);
|
|
2256
|
-
const minH = parseFloat(raw.minHeight);
|
|
2257
|
-
const maxH = parseFloat(raw.maxHeight);
|
|
2258
|
-
return {
|
|
2259
|
-
minWidth: Number.isFinite(minW) ? minW : 0,
|
|
2260
|
-
maxWidth: Number.isFinite(maxW) ? maxW : Infinity,
|
|
2261
|
-
minHeight: Number.isFinite(minH) ? minH : 0,
|
|
2262
|
-
maxHeight: Number.isFinite(maxH) ? maxH : Infinity
|
|
2263
|
-
};
|
|
2264
|
-
}
|
|
2265
|
-
/**
|
|
2266
|
-
* Calculate a uniform scale factor that fits `tileWidth × tileHeight` within the
|
|
2267
|
-
* given CSS min/max constraints while preserving aspect ratio.
|
|
2268
|
-
*
|
|
2269
|
-
* - Scales down when the tile exceeds max constraints.
|
|
2270
|
-
* - Scales up when the tile is smaller than min constraints.
|
|
2271
|
-
* - Returns `1` when no scaling is needed.
|
|
2272
|
-
*/
|
|
2273
|
-
calculateScale(tileWidth, tileHeight, constraints) {
|
|
2274
|
-
const { minWidth, maxWidth, minHeight, maxHeight } = constraints;
|
|
2275
|
-
const maxRatio = Math.min(maxWidth / tileWidth, maxHeight / tileHeight);
|
|
2276
|
-
const minRatio = Math.max(minWidth / tileWidth, minHeight / tileHeight);
|
|
2277
|
-
if (Number.isFinite(maxRatio) && maxRatio < 1) return maxRatio;
|
|
2278
|
-
if (Number.isFinite(minRatio) && minRatio > 1) return minRatio;
|
|
2279
|
-
return 1;
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* Compute container and image dimensions for the current thumbnail, scaled to
|
|
2283
|
-
* fit within the element's CSS min/max constraints.
|
|
2284
|
-
*
|
|
2285
|
-
* The container clips the sprite sheet via `overflow: hidden`, and the image is
|
|
2286
|
-
* positioned with `transform: translate()` to show the correct tile.
|
|
2287
|
-
*/
|
|
2288
|
-
resize(thumbnail, imgNaturalWidth, imgNaturalHeight, constraints) {
|
|
2289
|
-
const tileWidth = thumbnail.width ?? imgNaturalWidth;
|
|
2290
|
-
const tileHeight = thumbnail.height ?? imgNaturalHeight;
|
|
2291
|
-
if (!tileWidth || !tileHeight) return void 0;
|
|
2292
|
-
const scale = this.calculateScale(tileWidth, tileHeight, constraints);
|
|
2293
|
-
const coordX = thumbnail.coords?.x ?? 0;
|
|
2294
|
-
const coordY = thumbnail.coords?.y ?? 0;
|
|
2295
|
-
const inset = scale !== 1 ? 1 : 0;
|
|
2296
|
-
return {
|
|
2297
|
-
scale,
|
|
2298
|
-
containerWidth: Math.max(0, Math.floor(tileWidth * scale) - inset * 2),
|
|
2299
|
-
containerHeight: Math.max(0, Math.floor(tileHeight * scale) - inset * 2),
|
|
2300
|
-
imageWidth: Math.ceil(imgNaturalWidth * scale),
|
|
2301
|
-
imageHeight: Math.ceil(imgNaturalHeight * scale),
|
|
2302
|
-
offsetX: Math.ceil(coordX * scale) + inset,
|
|
2303
|
-
offsetY: Math.ceil(coordY * scale) + inset
|
|
2304
|
-
};
|
|
2305
|
-
}
|
|
2306
|
-
getState(loading, error, thumbnail) {
|
|
2307
|
-
return {
|
|
2308
|
-
loading,
|
|
2309
|
-
error,
|
|
2310
|
-
hidden: !loading && !thumbnail
|
|
2311
|
-
};
|
|
2312
|
-
}
|
|
2313
|
-
getAttrs(_state) {
|
|
2314
|
-
return {
|
|
2315
|
-
role: "img",
|
|
2316
|
-
"aria-hidden": "true"
|
|
2317
|
-
};
|
|
2318
|
-
}
|
|
2319
|
-
};
|
|
2320
|
-
|
|
2321
|
-
//#endregion
|
|
2322
|
-
//#region ../core/dist/dev/dom/ui/thumbnail.js
|
|
2323
|
-
function createThumbnail(options) {
|
|
2324
|
-
const { getContainer, getImg, onStateChange } = options;
|
|
2325
|
-
const core = new ThumbnailCore();
|
|
2326
|
-
const abort = new AbortController();
|
|
2327
|
-
const signal = abort.signal;
|
|
2328
|
-
let loading = false;
|
|
2329
|
-
let error = false;
|
|
2330
|
-
let naturalWidth = 0;
|
|
2331
|
-
let naturalHeight = 0;
|
|
2332
|
-
let lastSrc = "";
|
|
2333
|
-
let imgBound = false;
|
|
2334
|
-
let resizeObserver = null;
|
|
2335
|
-
function onImgLoad() {
|
|
2336
|
-
const img = getImg();
|
|
2337
|
-
if (img) {
|
|
2338
|
-
naturalWidth = img.naturalWidth;
|
|
2339
|
-
naturalHeight = img.naturalHeight;
|
|
2340
|
-
}
|
|
2341
|
-
loading = false;
|
|
2342
|
-
error = false;
|
|
2343
|
-
onStateChange();
|
|
2344
|
-
}
|
|
2345
|
-
function onImgError() {
|
|
2346
|
-
loading = false;
|
|
2347
|
-
error = true;
|
|
2348
|
-
onStateChange();
|
|
2349
|
-
}
|
|
2350
|
-
function bindImg(img) {
|
|
2351
|
-
listen(img, "load", onImgLoad, { signal });
|
|
2352
|
-
listen(img, "error", onImgError, { signal });
|
|
2353
|
-
}
|
|
2354
|
-
function ensureBindings() {
|
|
2355
|
-
if (!imgBound) {
|
|
2356
|
-
const img = getImg();
|
|
2357
|
-
if (img) {
|
|
2358
|
-
bindImg(img);
|
|
2359
|
-
imgBound = true;
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
if (!resizeObserver) {
|
|
2363
|
-
const container = getContainer();
|
|
2364
|
-
if (container) {
|
|
2365
|
-
resizeObserver = new ResizeObserver(onStateChange);
|
|
2366
|
-
resizeObserver.observe(container);
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
function updateSrc(url) {
|
|
2371
|
-
ensureBindings();
|
|
2372
|
-
const src = url ?? "";
|
|
2373
|
-
if (src === lastSrc) return;
|
|
2374
|
-
lastSrc = src;
|
|
2375
|
-
if (src) {
|
|
2376
|
-
loading = true;
|
|
2377
|
-
error = false;
|
|
2378
|
-
} else {
|
|
2379
|
-
loading = false;
|
|
2380
|
-
error = false;
|
|
2381
|
-
naturalWidth = 0;
|
|
2382
|
-
naturalHeight = 0;
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
function connect() {
|
|
2386
|
-
ensureBindings();
|
|
2387
|
-
const img = getImg();
|
|
2388
|
-
if (img?.complete && lastSrc) {
|
|
2389
|
-
if (img.naturalWidth > 0) {
|
|
2390
|
-
naturalWidth = img.naturalWidth;
|
|
2391
|
-
naturalHeight = img.naturalHeight;
|
|
2392
|
-
loading = false;
|
|
2393
|
-
error = false;
|
|
2394
|
-
} else {
|
|
2395
|
-
loading = false;
|
|
2396
|
-
error = true;
|
|
2397
|
-
}
|
|
2398
|
-
onStateChange();
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
function destroy() {
|
|
2402
|
-
abort.abort();
|
|
2403
|
-
resizeObserver?.disconnect();
|
|
2404
|
-
resizeObserver = null;
|
|
2405
|
-
}
|
|
2406
|
-
return {
|
|
2407
|
-
get loading() {
|
|
2408
|
-
return loading;
|
|
2409
|
-
},
|
|
2410
|
-
get error() {
|
|
2411
|
-
return error;
|
|
2412
|
-
},
|
|
2413
|
-
get naturalWidth() {
|
|
2414
|
-
return naturalWidth;
|
|
2415
|
-
},
|
|
2416
|
-
get naturalHeight() {
|
|
2417
|
-
return naturalHeight;
|
|
2418
|
-
},
|
|
2419
|
-
readConstraints() {
|
|
2420
|
-
const el = getContainer();
|
|
2421
|
-
if (!el) return {
|
|
2422
|
-
minWidth: 0,
|
|
2423
|
-
maxWidth: Infinity,
|
|
2424
|
-
minHeight: 0,
|
|
2425
|
-
maxHeight: Infinity
|
|
2426
|
-
};
|
|
2427
|
-
return core.parseConstraints(getComputedStyle(el));
|
|
2428
|
-
},
|
|
2429
|
-
updateSrc,
|
|
2430
|
-
connect,
|
|
2431
|
-
destroy
|
|
2432
|
-
};
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
//#endregion
|
|
2436
|
-
//#region ../core/dist/dev/dom/ui/tooltip/tooltip.js
|
|
2437
|
-
/** Map popover reasons to tooltip reasons, filtering out click/outside-click. */
|
|
2438
|
-
const REASON_MAP = {
|
|
2439
|
-
hover: "hover",
|
|
2440
|
-
focus: "focus",
|
|
2441
|
-
escape: "escape",
|
|
2442
|
-
blur: "blur"
|
|
2443
|
-
};
|
|
2444
|
-
function createTooltip(options) {
|
|
2445
|
-
const popoverOpts = {
|
|
2446
|
-
transition: options.transition,
|
|
2447
|
-
onOpenChange(open, details) {
|
|
2448
|
-
const reason = REASON_MAP[details.reason];
|
|
2449
|
-
if (!reason) return;
|
|
2450
|
-
const group = options.group?.();
|
|
2451
|
-
if (open) group?.notifyOpen();
|
|
2452
|
-
else group?.notifyClose();
|
|
2453
|
-
const tooltipDetails = details.event ? {
|
|
2454
|
-
reason,
|
|
2455
|
-
event: details.event
|
|
2456
|
-
} : { reason };
|
|
2457
|
-
options.onOpenChange(open, tooltipDetails);
|
|
2458
|
-
},
|
|
2459
|
-
closeOnEscape: () => true,
|
|
2460
|
-
closeOnOutsideClick: () => false,
|
|
2461
|
-
openOnHover: () => true,
|
|
2462
|
-
delay: () => {
|
|
2463
|
-
const group = options.group?.();
|
|
2464
|
-
if (group?.shouldSkipDelay()) return 0;
|
|
2465
|
-
return options.delay?.() ?? group?.delay ?? 600;
|
|
2466
|
-
},
|
|
2467
|
-
closeDelay: () => {
|
|
2468
|
-
const group = options.group?.();
|
|
2469
|
-
return options.closeDelay?.() ?? group?.closeDelay ?? 0;
|
|
2470
|
-
}
|
|
2471
|
-
};
|
|
2472
|
-
if (options.onOpenChangeComplete) popoverOpts.onOpenChangeComplete = options.onOpenChangeComplete;
|
|
2473
|
-
const popover = createPopover(popoverOpts);
|
|
2474
|
-
let isPointerDown = false;
|
|
2475
|
-
const { onClick: _, ...baseTriggerProps } = popover.triggerProps;
|
|
2476
|
-
const triggerProps = {
|
|
2477
|
-
...baseTriggerProps,
|
|
2478
|
-
onPointerDown() {
|
|
2479
|
-
isPointerDown = true;
|
|
2480
|
-
},
|
|
2481
|
-
onPointerEnter(event) {
|
|
2482
|
-
if (options.disabled?.()) return;
|
|
2483
|
-
if (event.pointerType === "touch") return;
|
|
2484
|
-
baseTriggerProps.onPointerEnter(event);
|
|
2485
|
-
},
|
|
2486
|
-
onFocusIn(event) {
|
|
2487
|
-
if (options.disabled?.()) return;
|
|
2488
|
-
if (isPointerDown) {
|
|
2489
|
-
isPointerDown = false;
|
|
2490
|
-
return;
|
|
2491
|
-
}
|
|
2492
|
-
baseTriggerProps.onFocusIn(event);
|
|
2493
|
-
}
|
|
2494
|
-
};
|
|
2495
|
-
const popupProps = {
|
|
2496
|
-
...popover.popupProps,
|
|
2497
|
-
onPointerEnter(event) {
|
|
2498
|
-
if (options.disableHoverablePopup?.()) return;
|
|
2499
|
-
popover.popupProps.onPointerEnter(event);
|
|
2500
|
-
}
|
|
2501
|
-
};
|
|
2502
|
-
return {
|
|
2503
|
-
...popover,
|
|
2504
|
-
triggerProps,
|
|
2505
|
-
popupProps,
|
|
2506
|
-
get triggerElement() {
|
|
2507
|
-
return popover.triggerElement;
|
|
2508
|
-
},
|
|
2509
|
-
open: () => popover.open("hover"),
|
|
2510
|
-
close: () => popover.close("hover")
|
|
2511
|
-
};
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
//#endregion
|
|
2515
|
-
//#region ../core/dist/dev/dom/ui/transition.js
|
|
2516
|
-
/**
|
|
2517
|
-
* Manages open/close transition lifecycle via `createState`.
|
|
2518
|
-
*
|
|
2519
|
-
* **Open:** patches `{ active: true, status: 'starting' }`, then after a
|
|
2520
|
-
* double-RAF patches `{ status: 'idle' }` so the browser paints the
|
|
2521
|
-
* initial ("from") state before transitioning.
|
|
2522
|
-
*
|
|
2523
|
-
* **Close:** patches `{ status: 'ending' }` (keeping `active: true` so the
|
|
2524
|
-
* element stays mounted), then after a double-RAF waits for
|
|
2525
|
-
* `getAnimations()` to settle before patching `{ active: false, status: 'idle' }`.
|
|
2526
|
-
*/
|
|
2527
|
-
function createTransition() {
|
|
2528
|
-
const state = createState({
|
|
2529
|
-
active: false,
|
|
2530
|
-
status: "idle"
|
|
2531
|
-
});
|
|
2532
|
-
let destroyed = false;
|
|
2533
|
-
let rafId1 = 0;
|
|
2534
|
-
let rafId2 = 0;
|
|
2535
|
-
function open() {
|
|
2536
|
-
cancelAnimationFrame(rafId1);
|
|
2537
|
-
cancelAnimationFrame(rafId2);
|
|
2538
|
-
rafId1 = 0;
|
|
2539
|
-
rafId2 = 0;
|
|
2540
|
-
state.patch({
|
|
2541
|
-
active: true,
|
|
2542
|
-
status: "starting"
|
|
2543
|
-
});
|
|
2544
|
-
return new Promise((resolve) => {
|
|
2545
|
-
rafId1 = requestAnimationFrame(() => {
|
|
2546
|
-
rafId1 = 0;
|
|
2547
|
-
rafId2 = requestAnimationFrame(() => {
|
|
2548
|
-
rafId2 = 0;
|
|
2549
|
-
if (destroyed || !state.current.active) return resolve();
|
|
2550
|
-
state.patch({ status: "idle" });
|
|
2551
|
-
resolve();
|
|
2552
|
-
});
|
|
2553
|
-
});
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
function close(el) {
|
|
2557
|
-
cancelAnimationFrame(rafId1);
|
|
2558
|
-
cancelAnimationFrame(rafId2);
|
|
2559
|
-
rafId1 = 0;
|
|
2560
|
-
rafId2 = 0;
|
|
2561
|
-
state.patch({ status: "ending" });
|
|
2562
|
-
return new Promise((resolve) => {
|
|
2563
|
-
rafId1 = requestAnimationFrame(() => {
|
|
2564
|
-
rafId1 = 0;
|
|
2565
|
-
rafId2 = requestAnimationFrame(() => {
|
|
2566
|
-
rafId2 = 0;
|
|
2567
|
-
if (destroyed) return resolve();
|
|
2568
|
-
waitForAnimations(el).finally(() => {
|
|
2569
|
-
if (destroyed || state.current.status !== "ending") return resolve();
|
|
2570
|
-
state.patch({
|
|
2571
|
-
active: false,
|
|
2572
|
-
status: "idle"
|
|
2573
|
-
});
|
|
2574
|
-
resolve();
|
|
2575
|
-
});
|
|
2576
|
-
});
|
|
2577
|
-
});
|
|
2578
|
-
});
|
|
2579
|
-
}
|
|
2580
|
-
function cancel() {
|
|
2581
|
-
cancelAnimationFrame(rafId1);
|
|
2582
|
-
cancelAnimationFrame(rafId2);
|
|
2583
|
-
rafId1 = 0;
|
|
2584
|
-
rafId2 = 0;
|
|
2585
|
-
if (state.current.status !== "idle") state.patch({ status: "idle" });
|
|
2586
|
-
}
|
|
2587
|
-
return {
|
|
2588
|
-
state,
|
|
2589
|
-
open,
|
|
2590
|
-
close,
|
|
2591
|
-
cancel,
|
|
2592
|
-
destroy() {
|
|
2593
|
-
if (destroyed) return;
|
|
2594
|
-
destroyed = true;
|
|
2595
|
-
cancel();
|
|
2596
|
-
}
|
|
2597
|
-
};
|
|
2598
|
-
}
|
|
2599
|
-
function waitForAnimations(el) {
|
|
2600
|
-
if (!el) return Promise.resolve();
|
|
2601
|
-
const animations = el.getAnimations?.() ?? [];
|
|
2602
|
-
if (animations.length === 0) return Promise.resolve();
|
|
2603
|
-
return Promise.all(animations.map((a) => a.finished)).then(noop, noop);
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
//#endregion
|
|
2607
|
-
//#region ../core/dist/dev/dom/ui/wheel-step.js
|
|
2608
|
-
function createWheelStep(options) {
|
|
2609
|
-
return { onWheel(event) {
|
|
2610
|
-
if (options.isDisabled()) return;
|
|
2611
|
-
const direction = Math.sign(event.deltaY);
|
|
2612
|
-
if (direction === 0) return;
|
|
2613
|
-
event.preventDefault();
|
|
2614
|
-
const stepPercent = options.getStepPercent();
|
|
2615
|
-
const newPercent = clamp(options.getPercent() - direction * stepPercent, 0, 100);
|
|
2616
|
-
options.onValueChange?.(newPercent);
|
|
2617
|
-
} };
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
//#endregion
|
|
2621
|
-
//#region ../core/dist/dev/dom/utils/element-props.js
|
|
2622
|
-
/**
|
|
2623
|
-
* Apply props to a DOM element.
|
|
2624
|
-
*
|
|
2625
|
-
* Handles both attributes and event listeners:
|
|
2626
|
-
* - Event props (onClick, onKeyDown, etc.) are attached as listeners
|
|
2627
|
-
* - Boolean props: `true` sets empty attribute, `false` removes
|
|
2628
|
-
* - `undefined` removes the attribute
|
|
2629
|
-
* - Other props are set as string attributes
|
|
2630
|
-
*/
|
|
2631
|
-
function applyElementProps(element, props, options) {
|
|
2632
|
-
const signal = options?.signal;
|
|
2633
|
-
for (const [key, value] of Object.entries(props)) if (isFunction(value) && key.startsWith("on")) listen(element, key.slice(2).toLowerCase(), value, signal ? { signal } : void 0);
|
|
2634
|
-
else if (isUndefined(value) || value === false) element.removeAttribute(key);
|
|
2635
|
-
else if (value === true) element.setAttribute(key, "");
|
|
2636
|
-
else element.setAttribute(key, String(value));
|
|
2637
|
-
}
|
|
2638
|
-
|
|
2639
|
-
//#endregion
|
|
2640
|
-
//#region ../core/dist/dev/dom/utils/log.js
|
|
2641
|
-
const warned = /* @__PURE__ */ new Set();
|
|
2642
|
-
function logMissingFeature(displayName, featureName) {
|
|
2643
|
-
const key = `${displayName}:${featureName}`;
|
|
2644
|
-
if (warned.has(key)) return;
|
|
2645
|
-
warned.add(key);
|
|
2646
|
-
console.warn(`${displayName} requires ${featureName} feature`);
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
//#endregion
|
|
2650
|
-
//#region ../core/dist/dev/dom/utils/state-data-attrs.js
|
|
2651
|
-
/**
|
|
2652
|
-
* Apply state as data attributes to an element.
|
|
2653
|
-
*
|
|
2654
|
-
* - `true` → sets `data-keyname=""`
|
|
2655
|
-
* - truthy string/number → sets `data-keyname="value"`
|
|
2656
|
-
* - falsy → removes the attribute
|
|
2657
|
-
*
|
|
2658
|
-
* @example
|
|
2659
|
-
* ```ts
|
|
2660
|
-
* const state = { paused: true, ended: false };
|
|
2661
|
-
* applyStateDataAttrs(element, state);
|
|
2662
|
-
* // element has data-paused="", data-ended is removed
|
|
2663
|
-
* ```
|
|
2664
|
-
*/
|
|
2665
|
-
function applyStateDataAttrs(element, state, map) {
|
|
2666
|
-
for (const key in state) {
|
|
2667
|
-
if (map && !(key in map)) continue;
|
|
2668
|
-
const name = map?.[key] ?? toDataAttrName(key), value = state[key];
|
|
2669
|
-
if (value === true) element.setAttribute(name, "");
|
|
2670
|
-
else if (value) element.setAttribute(name, String(value));
|
|
2671
|
-
else element.removeAttribute(name);
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
function toDataAttrName(key) {
|
|
2675
|
-
return `data-${key.toLowerCase()}`;
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
1303
|
//#endregion
|
|
2679
1304
|
//#region ../../node_modules/.pnpm/@lit+context@1.1.6/node_modules/@lit/context/development/lib/controllers/context-consumer.js
|
|
2680
1305
|
/**
|
|
@@ -2934,6 +1559,21 @@ var MediaContainerElement = class extends ContainerMixin(MediaElement) {
|
|
|
2934
1559
|
static {
|
|
2935
1560
|
this.tagName = "media-container";
|
|
2936
1561
|
}
|
|
1562
|
+
#disconnect = null;
|
|
1563
|
+
connectedCallback() {
|
|
1564
|
+
super.connectedCallback();
|
|
1565
|
+
if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
|
|
1566
|
+
this.#disconnect = new AbortController();
|
|
1567
|
+
listen(this, "pointerup", this.#onPointerUp, { signal: this.#disconnect.signal });
|
|
1568
|
+
}
|
|
1569
|
+
disconnectedCallback() {
|
|
1570
|
+
super.disconnectedCallback();
|
|
1571
|
+
this.#disconnect?.abort();
|
|
1572
|
+
this.#disconnect = null;
|
|
1573
|
+
}
|
|
1574
|
+
#onPointerUp = () => {
|
|
1575
|
+
if (!this.contains(document.activeElement) || document.activeElement === document.body) this.focus({ preventScroll: true });
|
|
1576
|
+
};
|
|
2937
1577
|
};
|
|
2938
1578
|
|
|
2939
1579
|
//#endregion
|
|
@@ -3314,5 +1954,5 @@ function createPlayer(config) {
|
|
|
3314
1954
|
}
|
|
3315
1955
|
|
|
3316
1956
|
//#endregion
|
|
3317
|
-
export {
|
|
3318
|
-
//# sourceMappingURL=create-player-
|
|
1957
|
+
export { ReactiveElement as A, noop as C, isNull as D, isFunction as E, isNumber as O, createState as S, AbortControllerRegistry as T, pipFeature as _, MediaElement as a, controlsFeature as b, audioFeatures as c, volumeFeature as d, timeFeature as f, playbackFeature as g, playbackRateFeature as h, MediaContainerElement as i, resolveEventTarget as j, isUndefined as k, backgroundFeatures as l, sourceFeature as m, PlayerController as n, ContextProvider as o, textTrackFeature as p, SnapshotController as r, ContextConsumer as s, createPlayer as t, videoFeatures as u, fullscreenFeature as v, throwNoTargetError as w, bufferFeature as x, errorFeature as y };
|
|
1958
|
+
//# sourceMappingURL=create-player-DckZq-sE.js.map
|