@maas/vue-equipment 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.d.ts +2 -2
- package/dist/plugins/MagicPlayer/index.d.ts +3 -3
- package/dist/plugins/MagicPlayer/index.mjs +6 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +24 -18
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +8 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +20 -9
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +2 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +29 -25
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +1 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +27 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +21 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +10 -7
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +34 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +297 -0
- package/dist/plugins/MagicPlayer/src/composables/private/{useMediaApi.d.ts → usePlayerMediaApi.d.ts} +11 -7
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +263 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +12 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +70 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +15 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.mjs +9 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +22 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +142 -0
- package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.d.ts +63 -5
- package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.mjs +12 -65
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +12 -25
- package/package.json +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/useControlsApi.d.ts +0 -17
- package/dist/plugins/MagicPlayer/src/composables/private/useControlsApi.mjs +0 -131
- package/dist/plugins/MagicPlayer/src/composables/private/useMediaApi.mjs +0 -122
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.d.ts +0 -18
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.mjs +0 -63
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.d.ts +0 -20
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.mjs +0 -42
- package/dist/plugins/MagicPlayer/src/composables/private/useRuntimeSourceProvider.d.ts +0 -6
- package/dist/plugins/MagicPlayer/src/composables/private/useRuntimeSourceProvider.mjs +0 -48
- package/dist/plugins/MagicPlayer/src/utils/index.d.ts +0 -1
- package/dist/plugins/MagicPlayer/src/utils/index.mjs +0 -8
package/dist/nuxt/module.json
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
import { type MaybeElementRef } from '@vueuse/core';
|
|
3
3
|
import type { DrawerOptions, SnapPoint } from '../types/index.js';
|
|
4
|
-
export type
|
|
4
|
+
export type UseDrawerApiOptions = Pick<DrawerOptions, 'scrollLock'> & {
|
|
5
5
|
focusTarget: MaybeElementRef;
|
|
6
6
|
};
|
|
7
|
-
export declare function useDrawerApi(id?: MaybeRef<string>, options?:
|
|
7
|
+
export declare function useDrawerApi(id?: MaybeRef<string>, options?: UseDrawerApiOptions): {
|
|
8
8
|
id: import("vue").ComputedRef<string>;
|
|
9
9
|
isActive: import("vue").ComputedRef<boolean>;
|
|
10
10
|
open: () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from 'vue';
|
|
2
2
|
import MagicPlayer from './src/components/MagicPlayer.vue.js';
|
|
3
3
|
import MagicPlayerControls from './src/components/MagicPlayerControls.vue.js';
|
|
4
|
+
import MagicPlayerMuxPopover from './src/components/MagicPlayerMuxPopover.vue.js';
|
|
4
5
|
import MagicPlayerOverlay from './src/components/MagicPlayerOverlay.vue.js';
|
|
6
|
+
import MagicPlayerPoster from './src/components/MagicPlayerPoster.vue.js';
|
|
5
7
|
import MagicPlayerTimeline from './src/components/MagicPlayerTimeline.vue.js';
|
|
6
|
-
import MagicPlayerMuxPopover from './src/components/MagicPlayerMuxPopover.vue.js';
|
|
7
8
|
import { usePlayerApi } from './src/composables/usePlayerApi.js';
|
|
8
9
|
declare const MagicPlayerPlugin: Plugin;
|
|
9
|
-
export { MagicPlayerPlugin, MagicPlayer, MagicPlayerControls, MagicPlayerOverlay, MagicPlayerTimeline,
|
|
10
|
-
export type * from './src/types/index';
|
|
10
|
+
export { MagicPlayerPlugin, MagicPlayer, MagicPlayerControls, MagicPlayerMuxPopover, MagicPlayerPoster, MagicPlayerOverlay, MagicPlayerTimeline, usePlayerApi, };
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import MagicPlayer from "./src/components/MagicPlayer.vue";
|
|
2
2
|
import MagicPlayerControls from "./src/components/MagicPlayerControls.vue";
|
|
3
|
+
import MagicPlayerMuxPopover from "./src/components/MagicPlayerMuxPopover.vue";
|
|
3
4
|
import MagicPlayerOverlay from "./src/components/MagicPlayerOverlay.vue";
|
|
5
|
+
import MagicPlayerPoster from "./src/components/MagicPlayerPoster.vue";
|
|
4
6
|
import MagicPlayerTimeline from "./src/components/MagicPlayerTimeline.vue";
|
|
5
|
-
import MagicPlayerMuxPopover from "./src/components/MagicPlayerMuxPopover.vue";
|
|
6
7
|
import { usePlayerApi } from "./src/composables/usePlayerApi.mjs";
|
|
7
8
|
const MagicPlayerPlugin = {
|
|
8
9
|
install: (app) => {
|
|
9
10
|
app.component("MagicPlayer", MagicPlayer);
|
|
10
11
|
app.component("MagicPlayerControls", MagicPlayerControls);
|
|
12
|
+
app.component("MagicPlayerMuxPopover", MagicPlayerMuxPopover);
|
|
11
13
|
app.component("MagicPlayerOverlay", MagicPlayerOverlay);
|
|
14
|
+
app.component("MagicPlayerPoster", MagicPlayerPoster);
|
|
12
15
|
app.component("MagicPlayerTimeline", MagicPlayerTimeline);
|
|
13
|
-
app.component("MagicPlayerMuxPopover", MagicPlayerMuxPopover);
|
|
14
16
|
}
|
|
15
17
|
};
|
|
16
18
|
export {
|
|
17
19
|
MagicPlayerPlugin,
|
|
18
20
|
MagicPlayer,
|
|
19
21
|
MagicPlayerControls,
|
|
22
|
+
MagicPlayerMuxPopover,
|
|
23
|
+
MagicPlayerPoster,
|
|
20
24
|
MagicPlayerOverlay,
|
|
21
25
|
MagicPlayerTimeline,
|
|
22
|
-
MagicPlayerMuxPopover,
|
|
23
26
|
usePlayerApi
|
|
24
27
|
};
|
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
preload="auto"
|
|
13
13
|
playsinline
|
|
14
14
|
disablePictureInPicture
|
|
15
|
+
:loop="props.loop"
|
|
15
16
|
/>
|
|
16
|
-
<div v-show="!loaded || !touched" class="magic-player-poster">
|
|
17
|
-
<slot name="poster" />
|
|
18
|
-
</div>
|
|
19
17
|
<slot />
|
|
20
18
|
</div>
|
|
21
19
|
</template>
|
|
@@ -23,51 +21,59 @@
|
|
|
23
21
|
<script setup lang="ts">
|
|
24
22
|
import { ref, computed, onMounted } from 'vue'
|
|
25
23
|
import { useIntersectionObserver } from '@vueuse/core'
|
|
26
|
-
import {
|
|
24
|
+
import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
|
|
25
|
+
import { usePlayerMediaApi } from '../composables/private/usePlayerMediaApi'
|
|
26
|
+
import { usePlayerRuntime } from '../composables/private/usePlayerRuntime'
|
|
27
27
|
|
|
28
28
|
import type { SourceType } from './../types'
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
interface Props {
|
|
31
31
|
id: string
|
|
32
32
|
srcType?: SourceType
|
|
33
33
|
src: string
|
|
34
34
|
ratio?: string
|
|
35
35
|
fill?: boolean
|
|
36
36
|
autoplay?: boolean
|
|
37
|
+
loop?: boolean
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
const props = withDefaults(defineProps<
|
|
40
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
40
41
|
srcType: 'native',
|
|
41
42
|
src: '',
|
|
42
43
|
ratio: '16:9',
|
|
43
44
|
fill: false,
|
|
44
45
|
autoplay: false,
|
|
46
|
+
loop: false,
|
|
45
47
|
})
|
|
46
48
|
|
|
47
49
|
const playerRef = ref<HTMLDivElement | undefined>(undefined)
|
|
48
50
|
const videoRef = ref<HTMLVideoElement | undefined>(undefined)
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
const { instance } = usePlayerApi({
|
|
52
|
+
const { playing, muted } = usePlayerMediaApi({
|
|
52
53
|
id: props.id,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
mediaRef: videoRef,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
usePlayerRuntime({
|
|
58
|
+
id: props.id,
|
|
59
|
+
mediaRef: videoRef,
|
|
56
60
|
src: props.src,
|
|
61
|
+
srcType: props.srcType,
|
|
57
62
|
})
|
|
58
63
|
|
|
59
|
-
const {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
const { onMouseenter, onMouseleave, play, pause } = usePlayerVideoApi({
|
|
65
|
+
id: props.id,
|
|
66
|
+
videoRef: videoRef,
|
|
67
|
+
playerRef: playerRef,
|
|
68
|
+
})
|
|
63
69
|
|
|
64
70
|
useIntersectionObserver(
|
|
65
71
|
playerRef,
|
|
66
72
|
([{ isIntersecting }]) => {
|
|
67
73
|
if (!isIntersecting && playing.value) {
|
|
68
|
-
|
|
74
|
+
pause()
|
|
69
75
|
} else if (isIntersecting && !playing.value && props.autoplay) {
|
|
70
|
-
|
|
76
|
+
play()
|
|
71
77
|
}
|
|
72
78
|
},
|
|
73
79
|
{
|
|
@@ -101,5 +107,5 @@ onMounted(() => {
|
|
|
101
107
|
</script>
|
|
102
108
|
|
|
103
109
|
<style>
|
|
104
|
-
:root{--magic-player-aspect-ratio:16/9}.magic-player{aspect-ratio:var(--magic-player-aspect-ratio);overflow:hidden;position:relative;width:100%}.magic-player-video{height:100%;left:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}
|
|
110
|
+
:root{--magic-player-aspect-ratio:16/9}.magic-player{aspect-ratio:var(--magic-player-aspect-ratio);overflow:hidden;position:relative;width:100%}.magic-player-video{height:100%;left:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}
|
|
105
111
|
</style>
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import type { SourceType } from './../types';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
id: string;
|
|
4
4
|
srcType?: SourceType;
|
|
5
5
|
src: string;
|
|
6
6
|
ratio?: string;
|
|
7
7
|
fill?: boolean;
|
|
8
8
|
autoplay?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
loop?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
11
12
|
srcType: string;
|
|
12
13
|
src: string;
|
|
13
14
|
ratio: string;
|
|
14
15
|
fill: boolean;
|
|
15
16
|
autoplay: boolean;
|
|
16
|
-
|
|
17
|
+
loop: boolean;
|
|
18
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
17
19
|
srcType: string;
|
|
18
20
|
src: string;
|
|
19
21
|
ratio: string;
|
|
20
22
|
fill: boolean;
|
|
21
23
|
autoplay: boolean;
|
|
24
|
+
loop: boolean;
|
|
22
25
|
}>>>, {
|
|
23
26
|
fill: boolean;
|
|
24
27
|
srcType: SourceType;
|
|
25
28
|
src: string;
|
|
26
29
|
ratio: string;
|
|
27
30
|
autoplay: boolean;
|
|
31
|
+
loop: boolean;
|
|
28
32
|
}, {}>, {
|
|
29
|
-
poster?(_: {}): any;
|
|
30
33
|
default?(_: {}): any;
|
|
31
34
|
}>;
|
|
32
35
|
export default _default;
|
|
@@ -80,7 +80,9 @@ import IconVolumeOn from './icons/VolumeOn.vue'
|
|
|
80
80
|
import IconVolumeOff from './icons/VolumeOff.vue'
|
|
81
81
|
import IconFullscreenEnter from './icons/FullscreenEnter.vue'
|
|
82
82
|
import IconFullscreenExit from './icons/FullscreenExit.vue'
|
|
83
|
-
import {
|
|
83
|
+
import { usePlayerMediaApi } from '../composables/private/usePlayerMediaApi'
|
|
84
|
+
import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
|
|
85
|
+
import { usePlayerControlsApi } from '../composables/private/usePlayerControlsApi'
|
|
84
86
|
|
|
85
87
|
interface Props {
|
|
86
88
|
id: string
|
|
@@ -92,20 +94,29 @@ const barRef = ref<HTMLDivElement | undefined>(undefined)
|
|
|
92
94
|
const trackRef = ref<HTMLDivElement | undefined>(undefined)
|
|
93
95
|
const popoverRef = ref<HTMLDivElement | undefined>(undefined)
|
|
94
96
|
|
|
95
|
-
const {
|
|
97
|
+
const { playing, waiting, muted } = usePlayerMediaApi({
|
|
98
|
+
id: props.id,
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const {
|
|
102
|
+
touched,
|
|
103
|
+
mouseEntered,
|
|
104
|
+
isFullscreen,
|
|
105
|
+
play,
|
|
106
|
+
pause,
|
|
107
|
+
mute,
|
|
108
|
+
unmute,
|
|
109
|
+
enterFullscreen,
|
|
110
|
+
exitFullscreen,
|
|
111
|
+
} = usePlayerVideoApi({ id: props.id })
|
|
112
|
+
|
|
113
|
+
const { popoverOffsetX, seekedTime } = usePlayerControlsApi({
|
|
96
114
|
id: props.id,
|
|
97
115
|
barRef: barRef,
|
|
98
116
|
trackRef: trackRef,
|
|
99
117
|
popoverRef: popoverRef,
|
|
100
118
|
})
|
|
101
119
|
|
|
102
|
-
const { playing, waiting, muted } = instance.value.mediaApi
|
|
103
|
-
const { touched, mouseEntered, isFullscreen } = instance.value.playerApi
|
|
104
|
-
const { popoverOffsetX, seekedTime } = instance.value.controlsApi
|
|
105
|
-
|
|
106
|
-
const { play, pause, mute, unmute, enterFullscreen, exitFullscreen } =
|
|
107
|
-
instance.value.playerApi
|
|
108
|
-
|
|
109
120
|
const { idle } = useIdle(3000)
|
|
110
121
|
</script>
|
|
111
122
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import { shallowRef, onMounted, watch, computed, type Ref } from 'vue'
|
|
18
18
|
import { useDevicePixelRatio } from '@vueuse/core'
|
|
19
|
-
import {
|
|
19
|
+
import { usePlayerControlsApi } from '../composables/private/usePlayerControlsApi'
|
|
20
20
|
|
|
21
21
|
type Props = {
|
|
22
22
|
id: string
|
|
@@ -37,9 +37,7 @@ type MuxStoryboard = {
|
|
|
37
37
|
|
|
38
38
|
const props = defineProps<Props>()
|
|
39
39
|
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
const { seekedTime } = instance.value.controlsApi
|
|
40
|
+
const { seekedTime } = usePlayerControlsApi({ id: props.id })
|
|
43
41
|
const { pixelRatio } = useDevicePixelRatio()
|
|
44
42
|
|
|
45
43
|
const canvasRef = shallowRef() as Ref<HTMLCanvasElement>
|
|
@@ -11,35 +11,37 @@
|
|
|
11
11
|
}"
|
|
12
12
|
@click.stop="togglePlay"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
<slot>
|
|
15
|
+
<template v-if="waiting">
|
|
16
|
+
<button class="magic-player-overlay__button">
|
|
17
|
+
<slot name="waitingIcon">
|
|
18
|
+
<icon-waiting />
|
|
19
|
+
</slot>
|
|
20
|
+
</button>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else>
|
|
23
|
+
<button v-if="!playing" class="magic-player-overlay__button">
|
|
24
|
+
<slot name="playIcon">
|
|
25
|
+
<icon-play />
|
|
26
|
+
</slot>
|
|
27
|
+
</button>
|
|
28
|
+
<button v-else class="magic-player-overlay__button">
|
|
29
|
+
<slot name="pauseIcon">
|
|
30
|
+
<icon-pause />
|
|
31
|
+
</slot>
|
|
32
|
+
</button>
|
|
33
|
+
</template>
|
|
34
|
+
</slot>
|
|
33
35
|
</div>
|
|
34
36
|
</template>
|
|
35
37
|
|
|
36
38
|
<script setup lang="ts">
|
|
37
|
-
import {} from 'vue'
|
|
38
39
|
import { useIdle } from '@vueuse/core'
|
|
39
40
|
import IconPlay from './icons/Play.vue'
|
|
40
41
|
import IconPause from './icons/Pause.vue'
|
|
41
42
|
import IconWaiting from './icons/Waiting.vue'
|
|
42
|
-
import {
|
|
43
|
+
import { usePlayerMediaApi } from '../composables/private/usePlayerMediaApi'
|
|
44
|
+
import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
|
|
43
45
|
|
|
44
46
|
interface Props {
|
|
45
47
|
id: string
|
|
@@ -47,10 +49,12 @@ interface Props {
|
|
|
47
49
|
|
|
48
50
|
const props = defineProps<Props>()
|
|
49
51
|
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const { mouseEntered, togglePlay } =
|
|
52
|
+
const { playing, waiting } = usePlayerMediaApi({
|
|
53
|
+
id: props.id,
|
|
54
|
+
})
|
|
55
|
+
const { mouseEntered, togglePlay } = usePlayerVideoApi({
|
|
56
|
+
id: props.id,
|
|
57
|
+
})
|
|
54
58
|
|
|
55
59
|
const { idle } = useIdle(3000)
|
|
56
60
|
</script>
|
|
@@ -2,6 +2,7 @@ interface Props {
|
|
|
2
2
|
id: string;
|
|
3
3
|
}
|
|
4
4
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>>, {}, {}>, {
|
|
5
|
+
default?(_: {}): any;
|
|
5
6
|
waitingIcon?(_: {}): any;
|
|
6
7
|
playIcon?(_: {}): any;
|
|
7
8
|
pauseIcon?(_: {}): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="!loaded || !touched" class="magic-player-poster">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { usePlayerRuntime } from '../composables/private/usePlayerRuntime'
|
|
9
|
+
import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
|
|
10
|
+
|
|
11
|
+
export type MagicPlayerPosterProps = {
|
|
12
|
+
id: string
|
|
13
|
+
}
|
|
14
|
+
const props = defineProps<MagicPlayerPosterProps>()
|
|
15
|
+
|
|
16
|
+
const { loaded } = usePlayerRuntime({
|
|
17
|
+
id: props.id,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const { touched } = usePlayerVideoApi({
|
|
21
|
+
id: props.id,
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
.magic-player-poster{inset:0;position:absolute}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type MagicPlayerPosterProps = {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<MagicPlayerPosterProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<MagicPlayerPosterProps>>>, {}, {}>, {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
}>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
10
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
+
} : {
|
|
13
|
+
type: import('vue').PropType<T[K]>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -36,30 +36,33 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script setup lang="ts">
|
|
39
|
-
import {} from 'vue'
|
|
40
|
-
import {
|
|
39
|
+
import { computed } from 'vue'
|
|
40
|
+
import { usePlayerControlsApi } from '../composables/private/usePlayerControlsApi'
|
|
41
41
|
|
|
42
42
|
interface Props {
|
|
43
43
|
id: string
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const props = defineProps<Props>()
|
|
47
|
-
const { instance } = usePlayerApi(props.id)
|
|
48
47
|
|
|
49
48
|
const {
|
|
50
49
|
mouseEntered,
|
|
51
50
|
seekedPercentage,
|
|
52
51
|
scrubbedPercentage,
|
|
53
52
|
bufferedPercentage,
|
|
54
|
-
} = instance.value.controlsApi
|
|
55
|
-
|
|
56
|
-
const {
|
|
57
53
|
onMouseenter,
|
|
58
54
|
onMouseleave,
|
|
59
55
|
onPointerdown,
|
|
60
56
|
onPointerup,
|
|
61
57
|
onPointermove,
|
|
62
|
-
|
|
58
|
+
trackRect,
|
|
59
|
+
} = usePlayerControlsApi({
|
|
60
|
+
id: props.id,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const height = computed(() => {
|
|
64
|
+
return trackRect.value?.height
|
|
65
|
+
})
|
|
63
66
|
</script>
|
|
64
67
|
|
|
65
68
|
<style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type MaybeRef, type Ref } from 'vue';
|
|
2
|
+
export type UsePlayerControlsApiArgs = {
|
|
3
|
+
id: MaybeRef<string>;
|
|
4
|
+
barRef?: Ref<HTMLDivElement | undefined>;
|
|
5
|
+
trackRef?: Ref<HTMLDivElement | undefined>;
|
|
6
|
+
popoverRef?: Ref<HTMLDivElement | undefined>;
|
|
7
|
+
};
|
|
8
|
+
export declare function usePlayerControlsApi(args: UsePlayerControlsApiArgs): {
|
|
9
|
+
mouseEntered: Ref<boolean>;
|
|
10
|
+
dragging: Ref<boolean>;
|
|
11
|
+
seekedTime: Ref<number>;
|
|
12
|
+
seekedPercentage: Ref<number>;
|
|
13
|
+
scrubbedPercentage: Ref<number>;
|
|
14
|
+
bufferedPercentage: import("vue").ComputedRef<number>;
|
|
15
|
+
thumbPercentage: Ref<number>;
|
|
16
|
+
popoverOffsetX: Ref<number>;
|
|
17
|
+
onMouseenter: () => void;
|
|
18
|
+
onMouseleave: () => void;
|
|
19
|
+
onPointerdown: (e: MouseEvent | TouchEvent) => void;
|
|
20
|
+
onPointerup: () => void;
|
|
21
|
+
onPointermove: (e: MouseEvent | TouchEvent) => void;
|
|
22
|
+
trackRect: Ref<{
|
|
23
|
+
height: number;
|
|
24
|
+
width: number;
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
readonly bottom: number;
|
|
28
|
+
readonly left: number;
|
|
29
|
+
readonly right: number;
|
|
30
|
+
readonly top: number;
|
|
31
|
+
toJSON: () => any;
|
|
32
|
+
} | undefined>;
|
|
33
|
+
};
|
|
34
|
+
export type UsePlayerControlsApiReturn = ReturnType<typeof usePlayerControlsApi>;
|