@maas/vue-equipment 1.0.0-beta.11 → 1.0.0-beta.13
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/dist/nuxt/module.json +1 -1
- package/dist/plugins/.turbo/turbo-lint.log +2 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +11 -6
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +31 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +8 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +6 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +5 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +6 -6
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +5 -9
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +1 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +17 -23
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +5 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +91 -83
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +18 -7
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +53 -24
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +8 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +0 -4
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +6 -47
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +4 -31
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +147 -234
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +1 -15
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +17 -164
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +0 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +6 -24
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.d.ts +7 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +56 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +0 -5
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +7 -62
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +32 -51
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +47 -0
- package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -2
- package/dist/plugins/MagicPlayer/src/symbols/index.mjs +10 -1
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +29 -0
- package/package.json +4 -4
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +0 -15
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.mjs +0 -9
package/dist/nuxt/module.json
CHANGED
|
@@ -119,7 +119,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.magic-draggable__drag {
|
|
122
|
-
cursor: (--magic-draggable-cursor, grab);
|
|
122
|
+
cursor: var(--magic-draggable-cursor, grab);
|
|
123
123
|
user-select: none;
|
|
124
124
|
pointer-events: auto;
|
|
125
125
|
position: relative;
|
|
@@ -131,7 +131,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
.magic-draggable[data-dragging='true'] .magic-draggable__drag {
|
|
134
|
-
cursor: (--magic-draggable-cursor-dragging, grabbing);
|
|
134
|
+
cursor: var(--magic-draggable-cursor-dragging, grabbing);
|
|
135
135
|
user-select: none;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -6,6 +6,7 @@ const _hoisted_1 = {
|
|
|
6
6
|
class: "magic-player-audio"
|
|
7
7
|
};
|
|
8
8
|
import {
|
|
9
|
+
toRefs,
|
|
9
10
|
useTemplateRef,
|
|
10
11
|
shallowRef,
|
|
11
12
|
inject,
|
|
@@ -16,13 +17,14 @@ import { useIntersectionObserver } from "@vueuse/core";
|
|
|
16
17
|
import { usePlayerAudioApi } from "../composables/private/usePlayerAudioApi";
|
|
17
18
|
import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
18
19
|
import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
|
|
20
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
19
21
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
20
22
|
export default /* @__PURE__ */ _defineComponent({
|
|
21
23
|
__name: "MagicPlayerAudio",
|
|
22
24
|
setup(__props) {
|
|
23
|
-
const
|
|
25
|
+
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
24
26
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
25
|
-
if (!
|
|
27
|
+
if (!injectedInstanceId) {
|
|
26
28
|
throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
|
|
27
29
|
}
|
|
28
30
|
if (!injectedOptions) {
|
|
@@ -31,18 +33,21 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
31
33
|
const elRef = useTemplateRef("el");
|
|
32
34
|
const pausedByIntersection = shallowRef(false);
|
|
33
35
|
const { initialize, destroy } = usePlayerRuntime({
|
|
34
|
-
id:
|
|
36
|
+
id: injectedInstanceId,
|
|
35
37
|
mediaRef: elRef,
|
|
36
38
|
src: injectedOptions.src,
|
|
37
39
|
srcType: injectedOptions.srcType
|
|
38
40
|
});
|
|
39
|
-
|
|
40
|
-
id:
|
|
41
|
+
usePlayerMediaApi({
|
|
42
|
+
id: injectedInstanceId,
|
|
41
43
|
mediaRef: elRef
|
|
42
44
|
});
|
|
43
45
|
const { play, pause } = usePlayerAudioApi({
|
|
44
|
-
id:
|
|
46
|
+
id: injectedInstanceId
|
|
45
47
|
});
|
|
48
|
+
const { initializeState } = usePlayerState(injectedInstanceId);
|
|
49
|
+
const state = initializeState();
|
|
50
|
+
const { playing } = toRefs(state);
|
|
46
51
|
useIntersectionObserver(
|
|
47
52
|
elRef,
|
|
48
53
|
([{ isIntersecting }]) => {
|
|
@@ -27,14 +27,25 @@ const _hoisted_8 = {
|
|
|
27
27
|
class: "magic-player-audio-controls__item -shrink-0",
|
|
28
28
|
"data-slot": "display-time-duration"
|
|
29
29
|
};
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
toRefs,
|
|
32
|
+
computed,
|
|
33
|
+
inject,
|
|
34
|
+
provide,
|
|
35
|
+
useTemplateRef,
|
|
36
|
+
onBeforeUnmount
|
|
37
|
+
} from "vue";
|
|
31
38
|
import { useIdle } from "@vueuse/core";
|
|
32
|
-
import {
|
|
39
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
33
40
|
import { usePlayerAudioApi } from "../composables/private/usePlayerAudioApi";
|
|
34
41
|
import { usePlayerControlsApi } from "../composables/private/usePlayerControlsApi";
|
|
35
42
|
import IconPlay from "./icons/Play.vue";
|
|
36
43
|
import IconPause from "./icons/Pause.vue";
|
|
37
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
MagicPlayerInstanceId,
|
|
46
|
+
MagicPlayerTrackRef,
|
|
47
|
+
MagicPlayerBarRef
|
|
48
|
+
} from "../symbols";
|
|
38
49
|
export default /* @__PURE__ */ _defineComponent({
|
|
39
50
|
__name: "MagicPlayerAudioControls",
|
|
40
51
|
props: {
|
|
@@ -50,19 +61,25 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
50
61
|
}
|
|
51
62
|
const barRef = useTemplateRef("bar");
|
|
52
63
|
const trackRef = useTemplateRef("track");
|
|
53
|
-
const {
|
|
64
|
+
const { play, pause } = usePlayerAudioApi({
|
|
54
65
|
id: mappedInstanceId.value
|
|
55
66
|
});
|
|
56
|
-
const {
|
|
57
|
-
id: mappedInstanceId.value
|
|
58
|
-
});
|
|
59
|
-
usePlayerControlsApi({
|
|
67
|
+
const { initialize, destroy, onMouseenter, onMouseleave } = usePlayerControlsApi({
|
|
60
68
|
id: mappedInstanceId.value,
|
|
61
69
|
barRef,
|
|
62
70
|
trackRef
|
|
63
71
|
});
|
|
72
|
+
const { initializeState } = usePlayerState(mappedInstanceId.value);
|
|
73
|
+
const state = initializeState();
|
|
74
|
+
const { playing, waiting, touched, controlsMouseEntered } = toRefs(state);
|
|
64
75
|
const { idle } = useIdle(3e3);
|
|
76
|
+
initialize();
|
|
77
|
+
onBeforeUnmount(() => {
|
|
78
|
+
destroy();
|
|
79
|
+
});
|
|
65
80
|
provide(MagicPlayerInstanceId, mappedInstanceId.value);
|
|
81
|
+
provide(MagicPlayerTrackRef, trackRef);
|
|
82
|
+
provide(MagicPlayerBarRef, barRef);
|
|
66
83
|
return (_ctx, _cache) => {
|
|
67
84
|
const _component_magic_player_display_time = _resolveComponent("magic-player-display-time");
|
|
68
85
|
const _component_magic_player_timeline = _resolveComponent("magic-player-timeline");
|
|
@@ -73,7 +90,11 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
73
90
|
"data-paused": !_unref(playing),
|
|
74
91
|
"data-waiting": _unref(waiting),
|
|
75
92
|
"data-idle": _unref(idle),
|
|
76
|
-
"data-hover": _unref(
|
|
93
|
+
"data-hover": _unref(controlsMouseEntered),
|
|
94
|
+
onMouseenter: _cache[2] || (_cache[2] = //@ts-ignore
|
|
95
|
+
(...args) => _unref(onMouseenter) && _unref(onMouseenter)(...args)),
|
|
96
|
+
onMouseleave: _cache[3] || (_cache[3] = //@ts-ignore
|
|
97
|
+
(...args) => _unref(onMouseleave) && _unref(onMouseleave)(...args))
|
|
77
98
|
}, [
|
|
78
99
|
_createElementVNode("div", _hoisted_2, [
|
|
79
100
|
_createElementVNode(
|
|
@@ -121,7 +142,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
121
142
|
/* NEED_PATCH */
|
|
122
143
|
)
|
|
123
144
|
])
|
|
124
|
-
],
|
|
145
|
+
], 40, _hoisted_1);
|
|
125
146
|
};
|
|
126
147
|
}
|
|
127
148
|
});
|
|
@@ -3,8 +3,9 @@ import IconPause from './icons/Pause.vue.js';
|
|
|
3
3
|
interface MagicAudioPlayerControlsProps {
|
|
4
4
|
instanceId?: string;
|
|
5
5
|
}
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
6
|
+
declare const play: () => void, pause: () => void;
|
|
7
|
+
declare const onMouseenter: () => void, onMouseleave: () => void;
|
|
8
|
+
declare const playing: import("vue").Ref<boolean, boolean>, waiting: import("vue").Ref<boolean, boolean>, touched: import("vue").Ref<boolean, boolean>, controlsMouseEntered: import("vue").Ref<boolean, boolean>;
|
|
8
9
|
declare const idle: import("vue").Ref<boolean, boolean>;
|
|
9
10
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
10
11
|
declare var __VLS_1: {}, __VLS_6: {};
|
|
@@ -16,12 +17,14 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
16
17
|
declare const __VLS_self: import("vue").DefineComponent<MagicAudioPlayerControlsProps, {
|
|
17
18
|
IconPlay: typeof IconPlay;
|
|
18
19
|
IconPause: typeof IconPause;
|
|
19
|
-
playing: typeof playing;
|
|
20
|
-
waiting: typeof waiting;
|
|
21
20
|
play: typeof play;
|
|
22
21
|
pause: typeof pause;
|
|
22
|
+
onMouseenter: typeof onMouseenter;
|
|
23
|
+
onMouseleave: typeof onMouseleave;
|
|
24
|
+
playing: typeof playing;
|
|
25
|
+
waiting: typeof waiting;
|
|
23
26
|
touched: typeof touched;
|
|
24
|
-
|
|
27
|
+
controlsMouseEntered: typeof controlsMouseEntered;
|
|
25
28
|
idle: typeof idle;
|
|
26
29
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAudioPlayerControlsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
30
|
declare const __VLS_component: import("vue").DefineComponent<MagicAudioPlayerControlsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAudioPlayerControlsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
4
|
const _hoisted_1 = { class: "magic-player-display-time" };
|
|
5
|
-
import { computed, inject } from "vue";
|
|
6
|
-
import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
5
|
+
import { computed, inject, toRefs } from "vue";
|
|
7
6
|
import { formatTime } from "@maas/vue-equipment/utils";
|
|
7
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
8
8
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
9
9
|
export default /* @__PURE__ */ _defineComponent({
|
|
10
10
|
__name: "MagicPlayerDisplayTime",
|
|
@@ -18,9 +18,10 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
18
18
|
"MagicPlayerDisplayTime must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls."
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
});
|
|
21
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
22
|
+
const state = initializeState();
|
|
23
|
+
const { currentTime, duration } = toRefs(state);
|
|
24
|
+
const remainingTime = computed(() => duration.value - currentTime.value);
|
|
24
25
|
const stringifiedTime = computed(() => {
|
|
25
26
|
switch (__props.type) {
|
|
26
27
|
case "current":
|
|
@@ -3,6 +3,7 @@ import { defineComponent as _defineComponent } from "vue";
|
|
|
3
3
|
import { createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
4
|
const _hoisted_1 = ["width", "height"];
|
|
5
5
|
import {
|
|
6
|
+
toRefs,
|
|
6
7
|
shallowRef,
|
|
7
8
|
onMounted,
|
|
8
9
|
watch,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
useTemplateRef
|
|
12
13
|
} from "vue";
|
|
13
14
|
import { useDevicePixelRatio } from "@vueuse/core";
|
|
14
|
-
import {
|
|
15
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
15
16
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
16
17
|
export default /* @__PURE__ */ _defineComponent({
|
|
17
18
|
__name: "MagicPlayerMuxPopover",
|
|
@@ -26,7 +27,9 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
26
27
|
"MagicPlayerMuxPopover must be nested inside MagicPlayerVideoControls."
|
|
27
28
|
);
|
|
28
29
|
}
|
|
29
|
-
const {
|
|
30
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
31
|
+
const state = initializeState();
|
|
32
|
+
const { seekedTime } = toRefs(state);
|
|
30
33
|
const { pixelRatio } = useDevicePixelRatio();
|
|
31
34
|
const canvasRef = useTemplateRef("canvas");
|
|
32
35
|
const storyboard = shallowRef();
|
|
@@ -14,12 +14,12 @@ const _hoisted_4 = {
|
|
|
14
14
|
key: 1,
|
|
15
15
|
class: "magic-player-overlay__button"
|
|
16
16
|
};
|
|
17
|
-
import { inject } from "vue";
|
|
17
|
+
import { inject, toRefs } from "vue";
|
|
18
18
|
import { useIdle } from "@vueuse/core";
|
|
19
19
|
import IconPlay from "./icons/Play.vue";
|
|
20
20
|
import IconPause from "./icons/Pause.vue";
|
|
21
21
|
import IconWaiting from "./icons/Waiting.vue";
|
|
22
|
-
import {
|
|
22
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
23
23
|
import { usePlayerVideoApi } from "../composables/private/usePlayerVideoApi";
|
|
24
24
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
25
25
|
export default /* @__PURE__ */ _defineComponent({
|
|
@@ -31,10 +31,10 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
31
31
|
"MagicPlayerOverlay must be nested inside MagicPlayerProvider."
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
const {
|
|
34
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
35
|
+
const state = initializeState();
|
|
36
|
+
const { mouseEntered, playing, waiting } = toRefs(state);
|
|
37
|
+
const { togglePlay } = usePlayerVideoApi({
|
|
38
38
|
id: instanceId
|
|
39
39
|
});
|
|
40
40
|
const { idle } = useIdle(3e3);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import IconPlay from './icons/Play.vue.js';
|
|
2
2
|
import IconPause from './icons/Pause.vue.js';
|
|
3
3
|
import IconWaiting from './icons/Waiting.vue.js';
|
|
4
|
-
declare const playing: import("vue").
|
|
5
|
-
declare const
|
|
4
|
+
declare const mouseEntered: import("vue").Ref<boolean, boolean>, playing: import("vue").Ref<boolean, boolean>, waiting: import("vue").Ref<boolean, boolean>;
|
|
5
|
+
declare const togglePlay: () => void;
|
|
6
6
|
declare const idle: import("vue").Ref<boolean, boolean>;
|
|
7
7
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
8
8
|
declare var __VLS_1: {}, __VLS_3: {}, __VLS_8: {}, __VLS_13: {};
|
|
@@ -19,9 +19,9 @@ declare const __VLS_self: import("vue").DefineComponent<{}, {
|
|
|
19
19
|
IconPlay: typeof IconPlay;
|
|
20
20
|
IconPause: typeof IconPause;
|
|
21
21
|
IconWaiting: typeof IconWaiting;
|
|
22
|
+
mouseEntered: typeof mouseEntered;
|
|
22
23
|
playing: typeof playing;
|
|
23
24
|
waiting: typeof waiting;
|
|
24
|
-
mouseEntered: typeof mouseEntered;
|
|
25
25
|
togglePlay: typeof togglePlay;
|
|
26
26
|
idle: typeof idle;
|
|
27
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, vShow as _vShow, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
4
|
const _hoisted_1 = { class: "magic-player-poster" };
|
|
5
|
-
import { inject } from "vue";
|
|
6
|
-
import {
|
|
7
|
-
import { usePlayerVideoApi } from "../composables/private/usePlayerVideoApi";
|
|
5
|
+
import { inject, toRefs } from "vue";
|
|
6
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
8
7
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
9
8
|
export default /* @__PURE__ */ _defineComponent({
|
|
10
9
|
__name: "MagicPlayerPoster",
|
|
@@ -15,12 +14,9 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
15
14
|
"MagicPlayerPoster must be nested inside MagicPlayerProvider."
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
const { touched } = usePlayerVideoApi({
|
|
22
|
-
id: instanceId
|
|
23
|
-
});
|
|
17
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
18
|
+
const state = initializeState();
|
|
19
|
+
const { loaded, touched } = toRefs(state);
|
|
24
20
|
return (_ctx, _cache) => {
|
|
25
21
|
return _withDirectives((_openBlock(), _createElementBlock(
|
|
26
22
|
"div",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
declare const loaded: import("vue").
|
|
2
|
-
declare const touched: import("vue").ShallowRef<boolean, boolean>;
|
|
1
|
+
declare const loaded: import("vue").Ref<boolean, boolean>, touched: import("vue").Ref<boolean, boolean>;
|
|
3
2
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
4
3
|
declare var __VLS_1: {};
|
|
5
4
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
-
const _hoisted_1 = ["data-mode", "data-fullscreen", "data-touched", "data-playing", "data-paused", "data-waiting", "data-loaded", "data-muted"];
|
|
5
|
-
import {
|
|
4
|
+
const _hoisted_1 = ["data-id", "data-mode", "data-fullscreen", "data-touched", "data-playing", "data-paused", "data-waiting", "data-loaded", "data-muted"];
|
|
5
|
+
import { toRefs, provide, onUnmounted } from "vue";
|
|
6
6
|
import defu from "defu";
|
|
7
|
-
import {
|
|
8
|
-
import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
9
|
-
import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
|
|
7
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
10
8
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
11
9
|
import { defaultOptions } from "../utils/defaultOptions";
|
|
12
10
|
export default /* @__PURE__ */ _defineComponent({
|
|
@@ -17,27 +15,25 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
17
15
|
},
|
|
18
16
|
setup(__props) {
|
|
19
17
|
const mappedOptions = defu(__props.options, defaultOptions);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
18
|
+
const { initializeState, deleteState } = usePlayerState(__props.id);
|
|
19
|
+
const state = initializeState();
|
|
20
|
+
const { playing, waiting, muted, loaded, isFullscreen, touched, mouseEntered } = toRefs(state);
|
|
21
|
+
function onMouseenter() {
|
|
22
|
+
mouseEntered.value = true;
|
|
23
|
+
}
|
|
24
|
+
function onMouseleave() {
|
|
25
|
+
mouseEntered.value = false;
|
|
26
|
+
}
|
|
27
|
+
onUnmounted(() => {
|
|
28
|
+
deleteState();
|
|
23
29
|
});
|
|
24
|
-
const { loaded } = usePlayerRuntime({
|
|
25
|
-
id: __props.id,
|
|
26
|
-
src: mappedOptions.src,
|
|
27
|
-
srcType: mappedOptions.srcType
|
|
28
|
-
});
|
|
29
|
-
const { onMouseenter, onMouseleave, isFullscreen, touched } = usePlayerVideoApi(
|
|
30
|
-
{
|
|
31
|
-
id: __props.id,
|
|
32
|
-
playerRef
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
30
|
provide(MagicPlayerInstanceId, __props.id);
|
|
36
31
|
provide(MagicPlayerOptionsKey, mappedOptions);
|
|
37
32
|
return (_ctx, _cache) => {
|
|
38
33
|
return _openBlock(), _createElementBlock("div", {
|
|
39
34
|
ref: "player",
|
|
40
35
|
class: "magic-player-provider",
|
|
36
|
+
"data-id": _ctx.id,
|
|
41
37
|
"data-mode": _unref(mappedOptions).mode,
|
|
42
38
|
"data-fullscreen": _unref(isFullscreen),
|
|
43
39
|
"data-touched": _unref(touched),
|
|
@@ -46,10 +42,8 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
46
42
|
"data-waiting": _unref(waiting),
|
|
47
43
|
"data-loaded": _unref(loaded),
|
|
48
44
|
"data-muted": _unref(muted),
|
|
49
|
-
onMouseenter
|
|
50
|
-
|
|
51
|
-
onMouseleave: _cache[1] || (_cache[1] = //@ts-ignore
|
|
52
|
-
(...args) => _unref(onMouseleave) && _unref(onMouseleave)(...args))
|
|
45
|
+
onMouseenter,
|
|
46
|
+
onMouseleave
|
|
53
47
|
}, [
|
|
54
48
|
_renderSlot(_ctx.$slots, "default")
|
|
55
49
|
], 40, _hoisted_1);
|
|
@@ -5,9 +5,9 @@ interface MagicPlayerProps {
|
|
|
5
5
|
options?: MagicPlayerOptions;
|
|
6
6
|
}
|
|
7
7
|
declare const mappedOptions: MagicPlayerOptions;
|
|
8
|
-
declare const playing: import("vue").
|
|
9
|
-
declare
|
|
10
|
-
declare
|
|
8
|
+
declare const playing: import("vue").Ref<boolean, boolean>, waiting: import("vue").Ref<boolean, boolean>, muted: import("vue").Ref<boolean, boolean>, loaded: import("vue").Ref<boolean, boolean>, isFullscreen: import("vue").Ref<boolean, boolean>, touched: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
declare function onMouseenter(): void;
|
|
10
|
+
declare function onMouseleave(): void;
|
|
11
11
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
12
12
|
declare var __VLS_1: {};
|
|
13
13
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -19,10 +19,10 @@ declare const __VLS_self: import("vue").DefineComponent<MagicPlayerProps, {
|
|
|
19
19
|
waiting: typeof waiting;
|
|
20
20
|
muted: typeof muted;
|
|
21
21
|
loaded: typeof loaded;
|
|
22
|
-
onMouseenter: typeof onMouseenter;
|
|
23
|
-
onMouseleave: typeof onMouseleave;
|
|
24
22
|
isFullscreen: typeof isFullscreen;
|
|
25
23
|
touched: typeof touched;
|
|
24
|
+
onMouseenter: typeof onMouseenter;
|
|
25
|
+
onMouseleave: typeof onMouseleave;
|
|
26
26
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
27
|
declare const __VLS_component: import("vue").DefineComponent<MagicPlayerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, vShow as _vShow, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
-
const _hoisted_1 = {
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
ref: "track",
|
|
6
|
+
class: "magic-player-timeline"
|
|
7
|
+
};
|
|
5
8
|
const _hoisted_2 = { class: "magic-player-timeline__track" };
|
|
6
9
|
const _hoisted_3 = { class: "magic-player-timeline__inner-track" };
|
|
7
|
-
import { inject } from "vue";
|
|
10
|
+
import { inject, toRefs } from "vue";
|
|
8
11
|
import { usePlayerControlsApi } from "../composables/private/usePlayerControlsApi";
|
|
9
|
-
import {
|
|
12
|
+
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
13
|
+
import {
|
|
14
|
+
MagicPlayerInstanceId,
|
|
15
|
+
MagicPlayerTrackRef,
|
|
16
|
+
MagicPlayerPopoverRef,
|
|
17
|
+
MagicPlayerBarRef
|
|
18
|
+
} from "../symbols";
|
|
10
19
|
export default /* @__PURE__ */ _defineComponent({
|
|
11
20
|
__name: "MagicPlayerTimeline",
|
|
12
21
|
setup(__props) {
|
|
@@ -16,96 +25,95 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
16
25
|
"MagicPlayerPoster must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls."
|
|
17
26
|
);
|
|
18
27
|
}
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
id: instanceId
|
|
28
|
+
const { initializeState } = usePlayerState(instanceId);
|
|
29
|
+
const state = initializeState();
|
|
30
|
+
const { controlsMouseEntered, seekedPercentage, scrubbedPercentage } = toRefs(state);
|
|
31
|
+
const barRef = inject(MagicPlayerBarRef);
|
|
32
|
+
const trackRef = inject(MagicPlayerTrackRef);
|
|
33
|
+
const popoverRef = inject(MagicPlayerPopoverRef);
|
|
34
|
+
const { bufferedPercentage, onPointerdown, onPointermove } = usePlayerControlsApi({
|
|
35
|
+
id: instanceId,
|
|
36
|
+
barRef,
|
|
37
|
+
trackRef,
|
|
38
|
+
popoverRef
|
|
31
39
|
});
|
|
32
40
|
return (_ctx, _cache) => {
|
|
33
|
-
return _openBlock(), _createElementBlock(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
[
|
|
50
|
-
_createElementVNode("div", _hoisted_2, [
|
|
51
|
-
_createElementVNode(
|
|
52
|
-
"div",
|
|
53
|
-
{
|
|
54
|
-
class: "magic-player-timeline__thumb",
|
|
55
|
-
style: _normalizeStyle({ left: `${_unref(scrubbedPercentage)}%` })
|
|
56
|
-
},
|
|
57
|
-
_cache[5] || (_cache[5] = [
|
|
58
|
-
_createElementVNode(
|
|
59
|
-
"div",
|
|
60
|
-
{ class: "magic-player-timeline__thumb-handle" },
|
|
61
|
-
null,
|
|
62
|
-
-1
|
|
63
|
-
/* HOISTED */
|
|
64
|
-
)
|
|
65
|
-
]),
|
|
66
|
-
4
|
|
67
|
-
/* STYLE */
|
|
68
|
-
),
|
|
69
|
-
_createElementVNode("div", _hoisted_3, [
|
|
41
|
+
return _openBlock(), _createElementBlock(
|
|
42
|
+
"div",
|
|
43
|
+
_hoisted_1,
|
|
44
|
+
[
|
|
45
|
+
_createElementVNode(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
class: "magic-player-timeline__target",
|
|
49
|
+
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
50
|
+
(...args) => _unref(onPointerdown) && _unref(onPointerdown)(...args)),
|
|
51
|
+
onPointermove: _cache[1] || (_cache[1] = //@ts-ignore
|
|
52
|
+
(...args) => _unref(onPointermove) && _unref(onPointermove)(...args))
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
_createElementVNode("div", _hoisted_2, [
|
|
70
56
|
_createElementVNode(
|
|
71
57
|
"div",
|
|
72
58
|
{
|
|
73
|
-
class: "magic-player-
|
|
74
|
-
style: _normalizeStyle({ left: `${_unref(bufferedPercentage)}%` })
|
|
75
|
-
},
|
|
76
|
-
null,
|
|
77
|
-
4
|
|
78
|
-
/* STYLE */
|
|
79
|
-
),
|
|
80
|
-
_withDirectives(_createElementVNode(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
class: "magic-player-timeline__seeked",
|
|
84
|
-
style: _normalizeStyle({ left: `${_unref(seekedPercentage)}%` })
|
|
85
|
-
},
|
|
86
|
-
null,
|
|
87
|
-
4
|
|
88
|
-
/* STYLE */
|
|
89
|
-
), [
|
|
90
|
-
[_vShow, _unref(mouseEntered)]
|
|
91
|
-
]),
|
|
92
|
-
_createElementVNode(
|
|
93
|
-
"div",
|
|
94
|
-
{
|
|
95
|
-
class: "magic-player-timeline__scrubbed",
|
|
59
|
+
class: "magic-player-timeline__thumb",
|
|
96
60
|
style: _normalizeStyle({ left: `${_unref(scrubbedPercentage)}%` })
|
|
97
61
|
},
|
|
98
|
-
|
|
62
|
+
_cache[2] || (_cache[2] = [
|
|
63
|
+
_createElementVNode(
|
|
64
|
+
"div",
|
|
65
|
+
{ class: "magic-player-timeline__thumb-handle" },
|
|
66
|
+
null,
|
|
67
|
+
-1
|
|
68
|
+
/* HOISTED */
|
|
69
|
+
)
|
|
70
|
+
]),
|
|
99
71
|
4
|
|
100
72
|
/* STYLE */
|
|
101
|
-
)
|
|
73
|
+
),
|
|
74
|
+
_createElementVNode("div", _hoisted_3, [
|
|
75
|
+
_createElementVNode(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
class: "magic-player-timeline__buffered",
|
|
79
|
+
style: _normalizeStyle({ left: `${_unref(bufferedPercentage)}%` })
|
|
80
|
+
},
|
|
81
|
+
null,
|
|
82
|
+
4
|
|
83
|
+
/* STYLE */
|
|
84
|
+
),
|
|
85
|
+
_withDirectives(_createElementVNode(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
class: "magic-player-timeline__seeked",
|
|
89
|
+
style: _normalizeStyle({ left: `${_unref(seekedPercentage)}%` })
|
|
90
|
+
},
|
|
91
|
+
null,
|
|
92
|
+
4
|
|
93
|
+
/* STYLE */
|
|
94
|
+
), [
|
|
95
|
+
[_vShow, _unref(controlsMouseEntered)]
|
|
96
|
+
]),
|
|
97
|
+
_createElementVNode(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
class: "magic-player-timeline__scrubbed",
|
|
101
|
+
style: _normalizeStyle({ left: `${_unref(scrubbedPercentage)}%` })
|
|
102
|
+
},
|
|
103
|
+
null,
|
|
104
|
+
4
|
|
105
|
+
/* STYLE */
|
|
106
|
+
)
|
|
107
|
+
])
|
|
102
108
|
])
|
|
103
|
-
]
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
],
|
|
110
|
+
32
|
|
111
|
+
/* NEED_HYDRATION */
|
|
112
|
+
)
|
|
113
|
+
],
|
|
114
|
+
512
|
|
115
|
+
/* NEED_PATCH */
|
|
116
|
+
);
|
|
109
117
|
};
|
|
110
118
|
}
|
|
111
119
|
});
|