@maas/vue-equipment 0.11.6 → 0.12.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/MagicModal/src/composables/private/useModalStore.d.ts +2 -2
- package/dist/plugins/MagicModal/src/composables/private/useModalStore.mjs +4 -4
- package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +3 -3
- package/dist/plugins/MagicPlayer/index.d.ts +2 -7
- package/dist/plugins/MagicPlayer/index.mjs +4 -25
- package/dist/plugins/MagicPlayer/nuxt.mjs +1 -13
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +21 -16
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +10 -29
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +73 -91
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +16 -16
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +11 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +8 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +97 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +21 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +25 -15
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +11 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue +1 -1
- package/dist/plugins/MagicPlayer/src/composables/{useControlsApi.d.ts → private/useControlsApi.d.ts} +8 -8
- package/dist/plugins/MagicPlayer/src/composables/{useControlsApi.mjs → private/useControlsApi.mjs} +23 -20
- package/dist/plugins/MagicPlayer/src/composables/{useMediaApi.d.ts → private/useMediaApi.d.ts} +2 -2
- package/dist/plugins/MagicPlayer/src/composables/{useMediaApi.mjs → private/useMediaApi.mjs} +29 -28
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.d.ts +18 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.mjs +63 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.d.ts +18 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.mjs +36 -0
- package/dist/plugins/MagicPlayer/src/composables/{useRuntimeSourceProvider.d.ts → private/useRuntimeSourceProvider.d.ts} +1 -3
- package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.d.ts +2 -17
- package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.mjs +62 -43
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +14 -3
- package/package.json +1 -1
- package/dist/plugins/MagicPlayer/src/composables/useControls.d.ts +0 -8
- package/dist/plugins/MagicPlayer/src/composables/useControls.mjs +0 -15
- package/dist/plugins/MagicPlayer/src/composables/usePlayer.d.ts +0 -12
- package/dist/plugins/MagicPlayer/src/composables/usePlayer.mjs +0 -33
- package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +0 -45
- package/dist/plugins/MagicPlayer/src/symbols/index.mjs +0 -10
- /package/dist/plugins/MagicPlayer/src/composables/{useRuntimeSourceProvider.mjs → private/useRuntimeSourceProvider.mjs} +0 -0
|
@@ -1,50 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
|
+
import { computed, onUnmounted, toValue } from "vue";
|
|
3
|
+
import { usePlayerStore } from "./private/usePlayerStore.mjs";
|
|
4
|
+
import { usePlayerInternalApi } from "./private/usePlayerInternalApi.mjs";
|
|
5
|
+
import { useMediaApi } from "./private/useMediaApi.mjs";
|
|
6
|
+
import { useControlsApi } from "./private/useControlsApi.mjs";
|
|
7
|
+
import { useRuntimeSourceProvider } from "./private/useRuntimeSourceProvider.mjs";
|
|
4
8
|
export function usePlayerApi(args) {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
const { findInstance, addInstance, removeInstance } = usePlayerStore();
|
|
10
|
+
const mappedId = computed(() => {
|
|
11
|
+
if (typeof args === "string") {
|
|
12
|
+
return toValue(args) || uuid();
|
|
13
|
+
} else if ("id" in args) {
|
|
14
|
+
return toValue(args.id) || uuid();
|
|
15
|
+
} else {
|
|
16
|
+
return uuid();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const instance = computed(() => findInstance(toValue(mappedId)));
|
|
20
|
+
function initialize() {
|
|
21
|
+
const id = toValue(mappedId);
|
|
22
|
+
let instance2 = findInstance(id);
|
|
23
|
+
if (!instance2) {
|
|
24
|
+
instance2 = addInstance(id);
|
|
25
|
+
}
|
|
26
|
+
if (typeof args !== "string") {
|
|
27
|
+
if ("mediaRef" in args) {
|
|
28
|
+
instance2.mediaApi = useMediaApi({ mediaRef: args.mediaRef });
|
|
29
|
+
} else if ("videoRef" in args) {
|
|
30
|
+
instance2.mediaApi = useMediaApi({ mediaRef: args.videoRef });
|
|
31
|
+
}
|
|
32
|
+
if ("videoRef" in args && "playerRef" in args) {
|
|
33
|
+
instance2.playerApi = usePlayerInternalApi({
|
|
34
|
+
id,
|
|
35
|
+
playerRef: args.playerRef,
|
|
36
|
+
videoRef: args.videoRef
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if ("videoRef" in args && "srcType" in args && "src" in args) {
|
|
40
|
+
instance2.runtimeProvider = useRuntimeSourceProvider({
|
|
41
|
+
videoRef: args.videoRef,
|
|
42
|
+
srcType: args.srcType,
|
|
43
|
+
src: args.src
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if ("barRef" in args && "trackRef" in args) {
|
|
47
|
+
instance2.controlsApi = useControlsApi({
|
|
48
|
+
id,
|
|
49
|
+
barRef: args.barRef,
|
|
50
|
+
trackRef: args.trackRef,
|
|
51
|
+
popoverRef: args.popoverRef
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return instance2;
|
|
28
56
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
57
|
+
function destroy(id) {
|
|
58
|
+
if (!id)
|
|
59
|
+
return;
|
|
60
|
+
removeInstance(toValue(id));
|
|
31
61
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
touched.value = true;
|
|
35
|
-
}
|
|
62
|
+
onUnmounted(() => {
|
|
63
|
+
destroy(toValue(mappedId));
|
|
36
64
|
});
|
|
65
|
+
initialize();
|
|
37
66
|
return {
|
|
38
|
-
|
|
39
|
-
touched,
|
|
40
|
-
play,
|
|
41
|
-
pause,
|
|
42
|
-
togglePlay,
|
|
43
|
-
seek,
|
|
44
|
-
mute,
|
|
45
|
-
unmute,
|
|
46
|
-
enterFullscreen,
|
|
47
|
-
exitFullscreen,
|
|
48
|
-
toggleFullscreen
|
|
67
|
+
instance
|
|
49
68
|
};
|
|
50
69
|
}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
type SourceType = 'native' | 'hls';
|
|
3
|
-
type
|
|
3
|
+
type UseMediaApiArgs = {
|
|
4
|
+
mediaRef: MaybeRef<HTMLMediaElement | undefined>;
|
|
5
|
+
};
|
|
6
|
+
type UseControlsApiArgs = {
|
|
7
|
+
id: MaybeRef<string>;
|
|
4
8
|
barRef?: MaybeRef<HTMLDivElement | undefined>;
|
|
5
9
|
trackRef: MaybeRef<HTMLDivElement | undefined>;
|
|
6
10
|
popoverRef?: MaybeRef<HTMLDivElement | undefined>;
|
|
7
11
|
};
|
|
8
|
-
type
|
|
12
|
+
type UsePlayerInternalApiArgs = {
|
|
13
|
+
id: MaybeRef<string>;
|
|
9
14
|
playerRef: MaybeRef<HTMLElement | undefined>;
|
|
10
15
|
videoRef: MaybeRef<HTMLVideoElement | undefined>;
|
|
16
|
+
};
|
|
17
|
+
type UseRuntimeSourceProviderArgs = {
|
|
18
|
+
videoRef: MaybeRef<HTMLVideoElement | undefined>;
|
|
11
19
|
srcType: SourceType;
|
|
12
20
|
src: string;
|
|
13
21
|
};
|
|
14
|
-
|
|
22
|
+
type UsePlayerApiArgs = MaybeRef<string> | (Partial<UseMediaApiArgs & UseControlsApiArgs & UsePlayerInternalApiArgs & UseRuntimeSourceProviderArgs> & {
|
|
23
|
+
id: MaybeRef<string>;
|
|
24
|
+
});
|
|
25
|
+
export type { SourceType, UseMediaApiArgs, UsePlayerApiArgs, UseControlsApiArgs, UsePlayerInternalApiArgs, UseRuntimeSourceProviderArgs, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.5",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type UseControlsApiReturn } from './useControlsApi.js';
|
|
2
|
-
import type { UseControlsArgs } from '../types.js';
|
|
3
|
-
type UseControlsReturn = {
|
|
4
|
-
controlsApi: UseControlsApiReturn;
|
|
5
|
-
};
|
|
6
|
-
export declare function useProvideControls(args: UseControlsArgs): UseControlsReturn;
|
|
7
|
-
export declare function useInjectControls(): UseControlsReturn;
|
|
8
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { provide, inject } from "vue";
|
|
2
|
-
import { useControlsApi } from "./useControlsApi.mjs";
|
|
3
|
-
import { ControlsApiInjectionKey } from "./../symbols/index.mjs";
|
|
4
|
-
export function useProvideControls(args) {
|
|
5
|
-
const controlsApi = useControlsApi(args);
|
|
6
|
-
provide(ControlsApiInjectionKey, controlsApi);
|
|
7
|
-
return {
|
|
8
|
-
controlsApi
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export function useInjectControls() {
|
|
12
|
-
return {
|
|
13
|
-
controlsApi: inject(ControlsApiInjectionKey)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type UseMediaApiReturn } from './useMediaApi.js';
|
|
2
|
-
import { type UsePlayerApiReturn } from './usePlayerApi.js';
|
|
3
|
-
import { type UseRuntimeSourceProviderReturn } from './useRuntimeSourceProvider.js';
|
|
4
|
-
import type { UsePlayerArgs } from './../types.js';
|
|
5
|
-
type UsePlayerReturn = {
|
|
6
|
-
playerApi: UsePlayerApiReturn;
|
|
7
|
-
mediaApi: UseMediaApiReturn;
|
|
8
|
-
runtimeProvider: UseRuntimeSourceProviderReturn;
|
|
9
|
-
};
|
|
10
|
-
export declare function useProvidePlayer(args: UsePlayerArgs): UsePlayerReturn;
|
|
11
|
-
export declare function useInjectPlayer(): UsePlayerReturn;
|
|
12
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { provide, inject } from "vue";
|
|
2
|
-
import { useMediaApi } from "./useMediaApi.mjs";
|
|
3
|
-
import { usePlayerApi } from "./usePlayerApi.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useRuntimeSourceProvider
|
|
6
|
-
} from "./useRuntimeSourceProvider.mjs";
|
|
7
|
-
import {
|
|
8
|
-
MediaApiInjectionKey,
|
|
9
|
-
PlayerApiInjectionKey,
|
|
10
|
-
RuntimeSourceProviderInjectionKey
|
|
11
|
-
} from "./../symbols/index.mjs";
|
|
12
|
-
export function useProvidePlayer(args) {
|
|
13
|
-
const mediaApi = useMediaApi(args.videoRef);
|
|
14
|
-
provide(MediaApiInjectionKey, mediaApi);
|
|
15
|
-
const playerApi = usePlayerApi({ ...args, mediaApi });
|
|
16
|
-
provide(PlayerApiInjectionKey, playerApi);
|
|
17
|
-
const runtimeProvider = useRuntimeSourceProvider(args);
|
|
18
|
-
provide(RuntimeSourceProviderInjectionKey, runtimeProvider);
|
|
19
|
-
return {
|
|
20
|
-
playerApi,
|
|
21
|
-
mediaApi,
|
|
22
|
-
runtimeProvider
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export function useInjectPlayer() {
|
|
26
|
-
return {
|
|
27
|
-
playerApi: inject(PlayerApiInjectionKey),
|
|
28
|
-
mediaApi: inject(MediaApiInjectionKey),
|
|
29
|
-
runtimeProvider: inject(
|
|
30
|
-
RuntimeSourceProviderInjectionKey
|
|
31
|
-
)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { InjectionKey } from 'vue';
|
|
2
|
-
import type { UseRuntimeSourceProviderReturn } from '../composables/useRuntimeSourceProvider.js';
|
|
3
|
-
declare const MediaApiInjectionKey: InjectionKey<{
|
|
4
|
-
currentTime: import("vue").Ref<number>;
|
|
5
|
-
duration: import("vue").Ref<number>;
|
|
6
|
-
waiting: import("vue").Ref<boolean>;
|
|
7
|
-
seeking: import("vue").Ref<boolean>;
|
|
8
|
-
ended: import("vue").Ref<boolean>;
|
|
9
|
-
stalled: import("vue").Ref<boolean>;
|
|
10
|
-
buffered: import("vue").Ref<[number, number][]>;
|
|
11
|
-
playing: import("vue").Ref<boolean>;
|
|
12
|
-
rate: import("vue").Ref<number>;
|
|
13
|
-
volume: import("vue").Ref<number>;
|
|
14
|
-
muted: import("vue").Ref<boolean>;
|
|
15
|
-
}>;
|
|
16
|
-
declare const PlayerApiInjectionKey: InjectionKey<{
|
|
17
|
-
isFullscreen: import("vue").Ref<boolean>;
|
|
18
|
-
touched: import("vue").Ref<boolean>;
|
|
19
|
-
play: () => void;
|
|
20
|
-
pause: () => void;
|
|
21
|
-
togglePlay: () => void;
|
|
22
|
-
seek: (time: number) => void;
|
|
23
|
-
mute: () => void;
|
|
24
|
-
unmute: () => void;
|
|
25
|
-
enterFullscreen: () => Promise<void>;
|
|
26
|
-
exitFullscreen: () => Promise<void>;
|
|
27
|
-
toggleFullscreen: () => Promise<void>;
|
|
28
|
-
}>;
|
|
29
|
-
declare const RuntimeSourceProviderInjectionKey: InjectionKey<UseRuntimeSourceProviderReturn>;
|
|
30
|
-
declare const ControlsApiInjectionKey: InjectionKey<{
|
|
31
|
-
entered: import("vue").Ref<boolean>;
|
|
32
|
-
dragging: import("vue").Ref<boolean>;
|
|
33
|
-
seekedTime: import("vue").Ref<number>;
|
|
34
|
-
seekedPercentage: import("vue").Ref<number>;
|
|
35
|
-
scrubbedPercentage: import("vue").Ref<number>;
|
|
36
|
-
bufferedPercentage: import("vue").ComputedRef<any>;
|
|
37
|
-
thumbPercentage: import("vue").Ref<number>;
|
|
38
|
-
popoverOffsetX: import("vue").Ref<number>;
|
|
39
|
-
onMouseEnter: () => void;
|
|
40
|
-
onMouseLeave: () => void;
|
|
41
|
-
onPointerDown: (e: MouseEvent | TouchEvent) => void;
|
|
42
|
-
onPointerUp: () => void;
|
|
43
|
-
onPointerMove: (e: MouseEvent | TouchEvent) => void;
|
|
44
|
-
}>;
|
|
45
|
-
export { MediaApiInjectionKey, PlayerApiInjectionKey, RuntimeSourceProviderInjectionKey, ControlsApiInjectionKey, };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const MediaApiInjectionKey = Symbol();
|
|
2
|
-
const PlayerApiInjectionKey = Symbol();
|
|
3
|
-
const RuntimeSourceProviderInjectionKey = Symbol();
|
|
4
|
-
const ControlsApiInjectionKey = Symbol();
|
|
5
|
-
export {
|
|
6
|
-
MediaApiInjectionKey,
|
|
7
|
-
PlayerApiInjectionKey,
|
|
8
|
-
RuntimeSourceProviderInjectionKey,
|
|
9
|
-
ControlsApiInjectionKey
|
|
10
|
-
};
|