@maas/vue-equipment 1.0.0-beta.22 → 1.0.0-beta.24

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.
Files changed (80) hide show
  1. package/dist/nuxt/module.json +1 -1
  2. package/dist/nuxt/module.mjs +24 -24
  3. package/dist/plugins/.turbo/turbo-lint.log +2 -2
  4. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +2 -29
  5. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +2 -7
  6. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +2 -16
  7. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +2 -11
  8. package/dist/plugins/MagicAccordion/src/types/index.d.ts +2 -2
  9. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +2 -20
  10. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +2 -7
  11. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +2 -19
  12. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +2 -7
  13. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +2 -7
  14. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +2 -18
  15. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +2 -9
  16. package/dist/plugins/MagicCommand/src/types/index.d.ts +2 -2
  17. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +2 -7
  18. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +2 -4
  19. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +2 -16
  20. package/dist/plugins/MagicCookie/src/types/index.d.ts +2 -2
  21. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +2 -92
  22. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +12 -15
  23. package/dist/plugins/MagicDraggable/src/types/index.d.ts +2 -2
  24. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +2 -161
  25. package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +1 -1
  26. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +112 -10
  27. package/dist/plugins/MagicEmitter/src/types/index.d.ts +2 -0
  28. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +2 -7
  29. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +2 -13
  30. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +2 -34
  31. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +2 -33
  32. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +2 -21
  33. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +2 -7
  34. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +2 -12
  35. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +2 -18
  36. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +2 -9
  37. package/dist/plugins/MagicMenu/src/types/index.d.ts +2 -2
  38. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +2 -40
  39. package/dist/plugins/MagicModal/src/types/index.d.ts +2 -2
  40. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +8 -4
  41. package/dist/plugins/MagicNoise/src/types/index.d.ts +2 -0
  42. package/dist/plugins/MagicNoise/src/utils/defaultOptions.mjs +3 -1
  43. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +51 -18
  44. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +12 -2
  45. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +2 -22
  46. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +48 -10
  47. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +6 -23
  48. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +5 -2
  49. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +2 -8
  50. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +37 -5
  51. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +2 -18
  52. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +2 -2
  53. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +47 -20
  54. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +11 -10
  55. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +2 -42
  56. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +5 -7
  57. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +5 -1
  58. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerEmitter.d.ts +8 -0
  59. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerEmitter.mjs +103 -0
  60. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +22 -11
  61. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +4 -4
  62. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +13 -9
  63. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +1 -0
  64. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +39 -32
  65. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +4 -1
  66. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +6 -3
  67. package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +2 -1
  68. package/dist/plugins/MagicPlayer/src/symbols/index.mjs +2 -0
  69. package/dist/plugins/MagicPlayer/src/types/index.d.ts +45 -19
  70. package/dist/plugins/MagicPlayer/src/utils/defaultOptions.d.ts +2 -2
  71. package/dist/plugins/MagicPlayer/src/utils/playbackDefaults.d.ts +3 -0
  72. package/dist/plugins/MagicPlayer/src/utils/playbackDefaults.mjs +7 -0
  73. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +2 -4
  74. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +2 -4
  75. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +2 -24
  76. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +2 -7
  77. package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +2 -19
  78. package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +1 -1
  79. package/dist/plugins/MagicToast/src/types/index.d.ts +2 -2
  80. package/package.json +5 -3
@@ -1,30 +1,13 @@
1
- import IconPlay from './icons/Play.vue.js';
2
- import IconPause from './icons/Pause.vue.js';
3
- import IconWaiting from './icons/Waiting.vue.js';
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
- declare const idle: import("vue").ShallowRef<boolean>;
7
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
8
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_8: {}, __VLS_13: {};
9
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
1
+ declare var __VLS_1: {}, __VLS_7: {}, __VLS_12: {}, __VLS_17: {};
2
+ type __VLS_Slots = {} & {
10
3
  default?: (props: typeof __VLS_1) => any;
11
4
  } & {
12
- waitingIcon?: (props: typeof __VLS_3) => any;
5
+ waitingIcon?: (props: typeof __VLS_7) => any;
13
6
  } & {
14
- playIcon?: (props: typeof __VLS_8) => any;
7
+ playIcon?: (props: typeof __VLS_12) => any;
15
8
  } & {
16
- pauseIcon?: (props: typeof __VLS_13) => any;
17
- }>;
18
- declare const __VLS_self: import("vue").DefineComponent<{}, {
19
- IconPlay: typeof IconPlay;
20
- IconPause: typeof IconPause;
21
- IconWaiting: typeof IconWaiting;
22
- mouseEntered: typeof mouseEntered;
23
- playing: typeof playing;
24
- waiting: typeof waiting;
25
- togglePlay: typeof togglePlay;
26
- idle: typeof idle;
27
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ pauseIcon?: (props: typeof __VLS_17) => any;
10
+ };
28
11
  declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
12
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
30
13
  export default _default;
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div v-show="!loaded || !touched" class="magic-player-poster">
2
+ <div
3
+ v-show="!loaded || !started || hasOverlay && !touched"
4
+ class="magic-player-poster"
5
+ >
3
6
  <slot />
4
7
  </div>
5
8
  </template>
@@ -16,7 +19,7 @@ if (!instanceId) {
16
19
  }
17
20
  const { initializeState } = usePlayerState(instanceId);
18
21
  const state = initializeState();
19
- const { loaded, touched } = toRefs(state);
22
+ const { loaded, started, hasOverlay, touched } = toRefs(state);
20
23
  </script>
21
24
 
22
25
  <style>
@@ -1,13 +1,7 @@
1
- declare const loaded: import("vue").Ref<boolean, boolean>, touched: import("vue").Ref<boolean, boolean>;
2
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
3
1
  declare var __VLS_1: {};
4
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
2
+ type __VLS_Slots = {} & {
5
3
  default?: (props: typeof __VLS_1) => any;
6
- }>;
7
- declare const __VLS_self: import("vue").DefineComponent<{}, {
8
- loaded: typeof loaded;
9
- touched: typeof touched;
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ };
11
5
  declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
6
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
13
7
  export default _default;
@@ -4,26 +4,39 @@
4
4
  class="magic-player-provider"
5
5
  :data-id="id"
6
6
  :data-mode="mappedOptions.mode"
7
- :data-fullscreen="isFullscreen"
7
+ :data-fullscreen="fullscreen"
8
8
  :data-touched="touched"
9
9
  :data-playing="playing"
10
- :data-paused="!playing"
10
+ :data-paused="paused"
11
+ :data-started="started"
11
12
  :data-waiting="waiting"
12
13
  :data-loaded="loaded"
13
14
  :data-muted="muted"
14
15
  @mouseenter="onMouseenter"
15
16
  @mouseleave="onMouseleave"
17
+ @pointerdown="onPointerdown"
16
18
  >
17
19
  <slot />
18
20
  </div>
19
21
  </template>
20
22
 
21
23
  <script setup>
22
- import { toRefs, provide, onUnmounted } from "vue";
24
+ import {
25
+ toRefs,
26
+ provide,
27
+ onMounted,
28
+ onUnmounted,
29
+ useTemplateRef
30
+ } from "vue";
23
31
  import defu from "defu";
24
32
  import { usePlayerState } from "../composables/private/usePlayerState";
25
- import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
33
+ import {
34
+ MagicPlayerInstanceId,
35
+ MagicPlayerOptionsKey,
36
+ MagicPlayerRef
37
+ } from "../symbols";
26
38
  import { defaultOptions } from "../utils/defaultOptions";
39
+ import { usePlayerEmitter } from "../composables/private/usePlayerEmitter";
27
40
  const { id, options } = defineProps({
28
41
  id: { type: null, required: true },
29
42
  options: { type: Object, required: false }
@@ -31,18 +44,37 @@ const { id, options } = defineProps({
31
44
  const mappedOptions = defu(options, defaultOptions);
32
45
  const { initializeState, deleteState } = usePlayerState(id);
33
46
  const state = initializeState();
34
- const { playing, waiting, muted, loaded, isFullscreen, touched, mouseEntered } = toRefs(state);
47
+ const {
48
+ playing,
49
+ paused,
50
+ started,
51
+ waiting,
52
+ muted,
53
+ loaded,
54
+ fullscreen,
55
+ touched,
56
+ mouseEntered
57
+ } = toRefs(state);
58
+ const { initializeEmitter } = usePlayerEmitter({ id });
59
+ const playerRef = useTemplateRef("player");
35
60
  function onMouseenter() {
36
61
  mouseEntered.value = true;
37
62
  }
38
63
  function onMouseleave() {
39
64
  mouseEntered.value = false;
40
65
  }
66
+ function onPointerdown() {
67
+ touched.value = true;
68
+ }
69
+ onMounted(() => {
70
+ initializeEmitter();
71
+ });
41
72
  onUnmounted(() => {
42
73
  deleteState();
43
74
  });
44
75
  provide(MagicPlayerInstanceId, id);
45
76
  provide(MagicPlayerOptionsKey, mappedOptions);
77
+ provide(MagicPlayerRef, playerRef);
46
78
  </script>
47
79
 
48
80
  <style>
@@ -4,26 +4,10 @@ interface MagicPlayerProps {
4
4
  id: MaybeRef<string>;
5
5
  options?: MagicPlayerOptions;
6
6
  }
7
- declare const mappedOptions: MagicPlayerOptions;
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
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
12
7
  declare var __VLS_1: {};
13
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
8
+ type __VLS_Slots = {} & {
14
9
  default?: (props: typeof __VLS_1) => any;
15
- }>;
16
- declare const __VLS_self: import("vue").DefineComponent<MagicPlayerProps, {
17
- mappedOptions: typeof mappedOptions;
18
- playing: typeof playing;
19
- waiting: typeof waiting;
20
- muted: typeof muted;
21
- loaded: typeof loaded;
22
- isFullscreen: typeof isFullscreen;
23
- touched: typeof touched;
24
- onMouseenter: typeof onMouseenter;
25
- onMouseleave: typeof onMouseleave;
26
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ };
27
11
  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
12
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
29
13
  export default _default;
@@ -45,7 +45,7 @@ import {
45
45
  const instanceId = inject(MagicPlayerInstanceId, void 0);
46
46
  if (!instanceId) {
47
47
  throw new Error(
48
- "MagicPlayerPoster must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls."
48
+ "MagicPlayerTimeline must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls."
49
49
  );
50
50
  }
51
51
  const { initializeState } = usePlayerState(instanceId);
@@ -53,7 +53,7 @@ const state = initializeState();
53
53
  const { controlsMouseEntered, seekedPercentage, scrubbedPercentage } = toRefs(state);
54
54
  const barRef = inject(MagicPlayerBarRef);
55
55
  const trackRef = inject(MagicPlayerTrackRef);
56
- const popoverRef = inject(MagicPlayerPopoverRef);
56
+ const popoverRef = inject(MagicPlayerPopoverRef, void 0);
57
57
  const { bufferedPercentage, onPointerdown, onPointermove } = usePlayerControlsApi({
58
58
  id: instanceId,
59
59
  barRef,
@@ -17,7 +17,9 @@ import {
17
17
  watch,
18
18
  onMounted,
19
19
  inject,
20
- onBeforeUnmount
20
+ onBeforeUnmount,
21
+ shallowRef,
22
+ computed
21
23
  } from "vue";
22
24
  import {
23
25
  useElementVisibility,
@@ -28,9 +30,15 @@ import { usePlayerVideoApi } from "../composables/private/usePlayerVideoApi";
28
30
  import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
29
31
  import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
30
32
  import { usePlayerState } from "../composables/private/usePlayerState";
31
- import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
33
+ import { videoModePlaybackDefaults } from "../utils/playbackDefaults";
34
+ import {
35
+ MagicPlayerInstanceId,
36
+ MagicPlayerOptionsKey,
37
+ MagicPlayerRef
38
+ } from "../symbols";
32
39
  const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
33
40
  const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
41
+ const injectedPlayerRef = inject(MagicPlayerRef, void 0);
34
42
  if (!injectedInstanceId) {
35
43
  throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
36
44
  }
@@ -38,7 +46,6 @@ if (!injectedOptions) {
38
46
  throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
39
47
  }
40
48
  const elRef = useTemplateRef("el");
41
- const isVisible = useElementVisibility(elRef);
42
49
  const { initialize, destroy } = usePlayerRuntime({
43
50
  id: injectedInstanceId,
44
51
  mediaRef: elRef,
@@ -47,38 +54,58 @@ const { initialize, destroy } = usePlayerRuntime({
47
54
  });
48
55
  const { initializeState } = usePlayerState(injectedInstanceId);
49
56
  const state = initializeState();
50
- const { muted, playing } = toRefs(state);
57
+ const { muted, playing, started } = toRefs(state);
51
58
  usePlayerMediaApi({
52
59
  id: injectedInstanceId,
53
60
  mediaRef: elRef
54
61
  });
55
- const { play, pause } = usePlayerVideoApi({
62
+ const { play, pause, mute, initializeFullscreen } = usePlayerVideoApi({
56
63
  id: injectedInstanceId,
57
- videoRef: elRef
64
+ videoRef: elRef,
65
+ playerRef: injectedPlayerRef
66
+ });
67
+ const wasPlaying = shallowRef(false);
68
+ const isVisible = useElementVisibility(elRef);
69
+ const manageWindow = computed(() => {
70
+ const playbackOptions = injectedOptions.playback || videoModePlaybackDefaults;
71
+ return playbackOptions !== false && playbackOptions?.includes("window");
72
+ });
73
+ const manageViewport = computed(() => {
74
+ const playbackOptions = injectedOptions.playback || videoModePlaybackDefaults;
75
+ return playbackOptions !== false && playbackOptions?.includes("viewport");
58
76
  });
59
77
  function onWindowFocus() {
60
- if (isVisible.value && !playing.value && injectedOptions?.autoplay) {
78
+ if (isVisible.value && wasPlaying.value) {
61
79
  play();
62
80
  }
63
81
  }
64
- useEventListener(defaultWindow, "focus", onWindowFocus);
65
- watch(
66
- isVisible,
67
- (value) => {
68
- if (value && !playing.value && injectedOptions.autoplay) {
69
- play();
70
- } else if (!value && playing.value) {
82
+ function onWindowBlur() {
83
+ wasPlaying.value = playing.value;
84
+ pause();
85
+ }
86
+ if (manageWindow.value) {
87
+ useEventListener(defaultWindow, "focus", onWindowFocus);
88
+ useEventListener(defaultWindow, "blur", onWindowBlur);
89
+ }
90
+ if (manageViewport.value) {
91
+ watch(isVisible, (value) => {
92
+ if (!value) {
93
+ wasPlaying.value = playing.value;
71
94
  pause();
72
95
  }
73
- },
74
- {
75
- immediate: true
76
- }
77
- );
96
+ if (value && wasPlaying.value) {
97
+ play();
98
+ }
99
+ if (value && injectedOptions.autoplay && !started.value) {
100
+ play();
101
+ }
102
+ });
103
+ }
78
104
  onMounted(() => {
79
105
  initialize();
106
+ initializeFullscreen();
80
107
  if (injectedOptions.autoplay) {
81
- muted.value = true;
108
+ mute();
82
109
  }
83
110
  });
84
111
  onBeforeUnmount(() => {
@@ -2,10 +2,11 @@
2
2
  <div
3
3
  ref="el"
4
4
  class="magic-player-video-controls"
5
- :data-fullscreen="isFullscreen"
5
+ :data-fullscreen="fullscreen"
6
6
  :data-touched="touched"
7
+ :data-started="started"
7
8
  :data-playing="playing"
8
- :data-paused="!playing"
9
+ :data-paused="paused"
9
10
  :data-waiting="waiting"
10
11
  :data-muted="muted"
11
12
  :data-idle="idle"
@@ -27,7 +28,7 @@
27
28
  </div>
28
29
  <div ref="bar" class="magic-player-video-controls__bar--inner">
29
30
  <div class="magic-player-video-controls__item -shrink-0">
30
- <button v-if="!playing" @click="play">
31
+ <button v-if="paused || !started" @click="play">
31
32
  <slot name="playIcon">
32
33
  <icon-play />
33
34
  </slot>
@@ -58,7 +59,7 @@
58
59
  </button>
59
60
  </div>
60
61
  <div class="magic-player-video-controls__item -shrink-0">
61
- <button v-if="isFullscreen" @click="exitFullscreen">
62
+ <button v-if="fullscreen" @click="exitFullscreen">
62
63
  <slot name="fullscreenExitIcon">
63
64
  <icon-fullscreen-exit />
64
65
  </slot>
@@ -130,13 +131,16 @@ const { initializeState } = usePlayerState(mappedInstanceId.value);
130
131
  const state = initializeState();
131
132
  const {
132
133
  playing,
134
+ started,
135
+ paused,
133
136
  waiting,
134
137
  muted,
135
138
  touched,
136
139
  mouseEntered,
137
140
  controlsMouseEntered,
138
- isFullscreen,
141
+ fullscreen,
139
142
  popoverOffsetX,
143
+ hasOverlay,
140
144
  seekedTime
141
145
  } = toRefs(state);
142
146
  const { play, pause, mute, unmute, enterFullscreen, exitFullscreen } = usePlayerVideoApi({ id: mappedInstanceId.value });
@@ -153,14 +157,11 @@ const hidden = computed(() => {
153
157
  switch (true) {
154
158
  case standalone:
155
159
  return false;
160
+ case !isVisible.value:
156
161
  case (playing.value && idle.value):
157
- return true;
162
+ case (hasOverlay.value && !touched.value && !started.value):
158
163
  case (playing.value && !controlsMouseEntered.value && !mouseEntered.value):
159
164
  return true;
160
- case !isVisible.value:
161
- return true;
162
- case !touched.value:
163
- return true;
164
165
  default:
165
166
  return false;
166
167
  }
@@ -1,9 +1,3 @@
1
- import IconPlay from './icons/Play.vue.js';
2
- import IconPause from './icons/Pause.vue.js';
3
- import IconVolumeOn from './icons/VolumeOn.vue.js';
4
- import IconVolumeOff from './icons/VolumeOff.vue.js';
5
- import IconFullscreenEnter from './icons/FullscreenEnter.vue.js';
6
- import IconFullscreenExit from './icons/FullscreenExit.vue.js';
7
1
  import '@maas/vue-equipment/utils/css/keyframes/fade-up-in.css';
8
2
  import '@maas/vue-equipment/utils/css/keyframes/fade-up-out.css';
9
3
  interface MagicPlayerControlsProps {
@@ -11,15 +5,8 @@ interface MagicPlayerControlsProps {
11
5
  standalone?: boolean;
12
6
  transition?: string;
13
7
  }
14
- declare const mappedTransition: import("vue").ComputedRef<string | undefined>;
15
- declare const playing: import("vue").Ref<boolean, boolean>, waiting: import("vue").Ref<boolean, boolean>, muted: import("vue").Ref<boolean, boolean>, touched: import("vue").Ref<boolean, boolean>, controlsMouseEntered: import("vue").Ref<boolean, boolean>, isFullscreen: import("vue").Ref<boolean, boolean>, popoverOffsetX: import("vue").Ref<number, number>, seekedTime: import("vue").Ref<number, number>;
16
- declare const play: () => void, pause: () => void, mute: () => void, unmute: () => void, enterFullscreen: () => void, exitFullscreen: () => void;
17
- declare const onMouseenter: () => void, onMouseleave: () => void;
18
- declare const idle: import("vue").ShallowRef<boolean>;
19
- declare const hidden: import("vue").ComputedRef<boolean>;
20
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
21
8
  declare var __VLS_5: {}, __VLS_7: {}, __VLS_12: {}, __VLS_17: {}, __VLS_23: {}, __VLS_25: {}, __VLS_30: {}, __VLS_35: {}, __VLS_40: {};
22
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
9
+ type __VLS_Slots = {} & {
23
10
  popover?: (props: typeof __VLS_5) => any;
24
11
  } & {
25
12
  playIcon?: (props: typeof __VLS_7) => any;
@@ -37,34 +24,7 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
37
24
  fullscreenExitIcon?: (props: typeof __VLS_35) => any;
38
25
  } & {
39
26
  fullscreenEnterIcon?: (props: typeof __VLS_40) => any;
40
- }>;
41
- declare const __VLS_self: import("vue").DefineComponent<MagicPlayerControlsProps, {
42
- IconPlay: typeof IconPlay;
43
- IconPause: typeof IconPause;
44
- IconVolumeOn: typeof IconVolumeOn;
45
- IconVolumeOff: typeof IconVolumeOff;
46
- IconFullscreenEnter: typeof IconFullscreenEnter;
47
- IconFullscreenExit: typeof IconFullscreenExit;
48
- mappedTransition: typeof mappedTransition;
49
- playing: typeof playing;
50
- waiting: typeof waiting;
51
- muted: typeof muted;
52
- touched: typeof touched;
53
- controlsMouseEntered: typeof controlsMouseEntered;
54
- isFullscreen: typeof isFullscreen;
55
- popoverOffsetX: typeof popoverOffsetX;
56
- seekedTime: typeof seekedTime;
57
- play: typeof play;
58
- pause: typeof pause;
59
- mute: typeof mute;
60
- unmute: typeof unmute;
61
- enterFullscreen: typeof enterFullscreen;
62
- exitFullscreen: typeof exitFullscreen;
63
- onMouseenter: typeof onMouseenter;
64
- onMouseleave: typeof onMouseleave;
65
- idle: typeof idle;
66
- hidden: typeof hidden;
67
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerControlsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ };
68
28
  declare const __VLS_component: import("vue").DefineComponent<MagicPlayerControlsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPlayerControlsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
29
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
70
30
  export default _default;
@@ -1,18 +1,21 @@
1
- import { toRefs, watch, toValue } from "vue";
1
+ import { toRefs, toValue } from "vue";
2
2
  import { usePlayerState } from "./usePlayerState.mjs";
3
3
  export function usePlayerAudioApi(args) {
4
4
  const { id } = args;
5
5
  const { initializeState } = usePlayerState(toValue(id));
6
6
  const state = initializeState();
7
- const { touched, currentTime, playing, muted } = toRefs(state);
7
+ const { currentTime, playing, paused, muted } = toRefs(state);
8
8
  function play() {
9
9
  playing.value = true;
10
+ paused.value = false;
10
11
  }
11
12
  function pause() {
12
13
  playing.value = false;
14
+ paused.value = true;
13
15
  }
14
16
  function togglePlay() {
15
17
  playing.value = !playing.value;
18
+ paused.value = !playing.value;
16
19
  }
17
20
  function seek(time) {
18
21
  currentTime.value = time;
@@ -23,11 +26,6 @@ export function usePlayerAudioApi(args) {
23
26
  function unmute() {
24
27
  muted.value = false;
25
28
  }
26
- watch(playing, (value) => {
27
- if (!touched.value && value) {
28
- touched.value = true;
29
- }
30
- });
31
29
  return {
32
30
  play,
33
31
  pause,
@@ -27,6 +27,7 @@ export function usePlayerControlsApi(args) {
27
27
  currentTime,
28
28
  duration,
29
29
  dragging,
30
+ touched,
30
31
  controlsMouseEntered,
31
32
  seekedTime,
32
33
  seekedPercentage,
@@ -37,7 +38,8 @@ export function usePlayerControlsApi(args) {
37
38
  buffered,
38
39
  controlsBarRect,
39
40
  controlsTrackRect,
40
- controlsPopoverRect
41
+ controlsPopoverRect,
42
+ hasControls
41
43
  } = toRefs(state);
42
44
  const resumePlay = shallowRef(false);
43
45
  let cancelPointerup = void 0;
@@ -126,6 +128,7 @@ export function usePlayerControlsApi(args) {
126
128
  guardedSetPointerCapture({ event: e, element: barRef?.value });
127
129
  resumePlay.value = playing.value;
128
130
  dragging.value = true;
131
+ touched.value = true;
129
132
  pause();
130
133
  getSizes();
131
134
  cancelPointerup = useEventListener(document, "pointerup", onPointerup);
@@ -158,6 +161,7 @@ export function usePlayerControlsApi(args) {
158
161
  let resizeObserverBar = null;
159
162
  let windowResizeCleanup = null;
160
163
  function initialize() {
164
+ hasControls.value = true;
161
165
  watchTrack = watch(() => trackRef, getTimelineTrackSize);
162
166
  watchPopover = watch(() => popoverRef, getPopoverSizes);
163
167
  watchBar = watch(() => barRef, getPopoverSizes);
@@ -0,0 +1,8 @@
1
+ import { type MaybeRef } from 'vue';
2
+ export type UsePlayerEmitterArgs = {
3
+ id: MaybeRef<string>;
4
+ };
5
+ export declare function usePlayerEmitter(args: UsePlayerEmitterArgs): {
6
+ initializeEmitter: () => void;
7
+ };
8
+ export type UsePlayerEmitterReturn = ReturnType<typeof usePlayerEmitter>;
@@ -0,0 +1,103 @@
1
+ import { toRefs, watch, toValue } from "vue";
2
+ import { useMagicEmitter } from "@maas/vue-equipment/plugins";
3
+ import { usePlayerState } from "./usePlayerState.mjs";
4
+ export function usePlayerEmitter(args) {
5
+ const { id } = args;
6
+ const { initializeState } = usePlayerState(toValue(id));
7
+ const state = initializeState();
8
+ const {
9
+ dragging,
10
+ ended,
11
+ fullscreen,
12
+ loaded,
13
+ muted,
14
+ paused,
15
+ playing,
16
+ rate,
17
+ stalled,
18
+ started,
19
+ touched,
20
+ volume,
21
+ waiting
22
+ } = toRefs(state);
23
+ const emitter = useMagicEmitter();
24
+ function initializeEmitter() {
25
+ watch(dragging, (newDragging) => {
26
+ if (newDragging) {
27
+ emitter.emit("onDragStart", toValue(id));
28
+ }
29
+ if (!newDragging) {
30
+ emitter.emit("onDragEnd", toValue(id));
31
+ }
32
+ });
33
+ watch(ended, (newEnded) => {
34
+ if (newEnded) {
35
+ emitter.emit("onEnd", toValue(id));
36
+ }
37
+ });
38
+ watch(fullscreen, (newFullscreen) => {
39
+ if (newFullscreen) {
40
+ emitter.emit("onFullscreenEnter", toValue(id));
41
+ }
42
+ if (!newFullscreen) {
43
+ emitter.emit("onFullscreenLeave", toValue(id));
44
+ }
45
+ });
46
+ watch(loaded, (newLoaded) => {
47
+ if (newLoaded) {
48
+ emitter.emit("onLoad", toValue(id));
49
+ }
50
+ });
51
+ watch(muted, (newMuted) => {
52
+ if (newMuted) {
53
+ emitter.emit("onMute", toValue(id));
54
+ }
55
+ if (!newMuted) {
56
+ emitter.emit("onUnmute", toValue(id));
57
+ }
58
+ });
59
+ watch(paused, (newPaused) => {
60
+ if (newPaused) {
61
+ emitter.emit("onPause", toValue(id));
62
+ }
63
+ });
64
+ watch(playing, (newPlaying) => {
65
+ if (newPlaying) {
66
+ emitter.emit("onPlay", toValue(id));
67
+ }
68
+ });
69
+ watch(rate, (newRate) => {
70
+ if (newRate) {
71
+ emitter.emit("onRateChange", toValue(id));
72
+ }
73
+ });
74
+ watch(started, (newStarted) => {
75
+ if (newStarted) {
76
+ emitter.emit("onStart", toValue(id));
77
+ }
78
+ });
79
+ watch(stalled, (newStalled) => {
80
+ if (newStalled) {
81
+ emitter.emit("onStall", toValue(id));
82
+ }
83
+ });
84
+ watch(touched, (newTouched) => {
85
+ if (newTouched) {
86
+ emitter.emit("onTouch", toValue(id));
87
+ }
88
+ });
89
+ watch(volume, (newVolume) => {
90
+ if (newVolume) {
91
+ emitter.emit("onVolumeChange", toValue(id));
92
+ }
93
+ });
94
+ watch(waiting, (newWaiting) => {
95
+ if (newWaiting) {
96
+ emitter.emit("onWait", toValue(id));
97
+ }
98
+ });
99
+ }
100
+ return {
101
+ initializeEmitter
102
+ };
103
+ }