@maas/vue-equipment 0.36.1 → 0.36.3
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/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -10
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +2 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +1 -0
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +24 -5
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +3 -0
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +2 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +24 -8
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +2 -4
- package/package.json +1 -1
package/dist/nuxt/module.json
CHANGED
|
@@ -23,16 +23,7 @@ declare function __VLS_template(): {
|
|
|
23
23
|
};
|
|
24
24
|
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
25
|
[key: string]: any;
|
|
26
|
-
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").
|
|
27
|
-
asChild: {
|
|
28
|
-
type: BooleanConstructor;
|
|
29
|
-
default: boolean;
|
|
30
|
-
};
|
|
31
|
-
as: {
|
|
32
|
-
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
}>>, {
|
|
26
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
36
27
|
asChild: boolean;
|
|
37
28
|
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
38
29
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
@@ -76,7 +76,7 @@ const disabled = computed(() => {
|
|
|
76
76
|
}
|
|
77
77
|
})
|
|
78
78
|
|
|
79
|
-
const { snapPoints, animation, initial, threshold } = mappedOptions
|
|
79
|
+
const { snapPoints, animation, initial, threshold, scrollLock } = mappedOptions
|
|
80
80
|
|
|
81
81
|
const { onPointerdown, onClick, style, hasDragged } = useDraggableDrag({
|
|
82
82
|
id: props.id,
|
|
@@ -86,6 +86,7 @@ const { onPointerdown, onClick, style, hasDragged } = useDraggableDrag({
|
|
|
86
86
|
snapPoints,
|
|
87
87
|
animation,
|
|
88
88
|
initial,
|
|
89
|
+
scrollLock,
|
|
89
90
|
})
|
|
90
91
|
|
|
91
92
|
// Public functions
|
|
@@ -8,6 +8,7 @@ type UseDraggableDragArgs = {
|
|
|
8
8
|
snapPoints: MaybeRef<DefaultOptions['snapPoints']>;
|
|
9
9
|
animation: MaybeRef<DefaultOptions['animation']>;
|
|
10
10
|
initial: MaybeRef<DefaultOptions['initial']>;
|
|
11
|
+
scrollLock: MaybeRef<DefaultOptions['scrollLock']>;
|
|
11
12
|
};
|
|
12
13
|
export declare function useDraggableDrag(args: UseDraggableDragArgs): {
|
|
13
14
|
initialize: () => Promise<void>;
|
|
@@ -27,7 +27,16 @@ import { useDraggableSnap } from "./useDraggableSnap.mjs";
|
|
|
27
27
|
import { useDraggableState } from "./useDraggableState.mjs";
|
|
28
28
|
import { useDraggableScrollLock } from "./useDraggableScrollLock.mjs";
|
|
29
29
|
export function useDraggableDrag(args) {
|
|
30
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
id,
|
|
32
|
+
elRef,
|
|
33
|
+
wrapperRef,
|
|
34
|
+
threshold,
|
|
35
|
+
snapPoints,
|
|
36
|
+
initial,
|
|
37
|
+
animation,
|
|
38
|
+
scrollLock
|
|
39
|
+
} = args;
|
|
31
40
|
const { initializeState } = useDraggableState(toValue(id));
|
|
32
41
|
const {
|
|
33
42
|
dragStart,
|
|
@@ -271,8 +280,13 @@ export function useDraggableDrag(args) {
|
|
|
271
280
|
});
|
|
272
281
|
}
|
|
273
282
|
resetStateAndListeners();
|
|
274
|
-
|
|
275
|
-
|
|
283
|
+
const scrollLockValue = toValue(scrollLock);
|
|
284
|
+
if (scrollLockValue) {
|
|
285
|
+
unlockScroll();
|
|
286
|
+
if (typeof scrollLockValue === "object" && scrollLockValue.padding) {
|
|
287
|
+
removeScrollLockPadding();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
276
290
|
guardedReleasePointerCapture({ event: e, element: elRef.value });
|
|
277
291
|
}
|
|
278
292
|
function onPointermove(e) {
|
|
@@ -311,8 +325,13 @@ export function useDraggableDrag(args) {
|
|
|
311
325
|
}
|
|
312
326
|
}
|
|
313
327
|
function onPointerdown(e) {
|
|
314
|
-
|
|
315
|
-
|
|
328
|
+
const scrollLockValue = toValue(scrollLock);
|
|
329
|
+
if (scrollLockValue) {
|
|
330
|
+
lockScroll();
|
|
331
|
+
if (typeof scrollLockValue === "object" && scrollLockValue.padding) {
|
|
332
|
+
addScrollLockPadding();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
316
335
|
if (dragging.value) {
|
|
317
336
|
return;
|
|
318
337
|
} else {
|
|
@@ -23,16 +23,7 @@ declare function __VLS_template(): {
|
|
|
23
23
|
};
|
|
24
24
|
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
25
|
[key: string]: any;
|
|
26
|
-
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").
|
|
27
|
-
asChild: {
|
|
28
|
-
type: BooleanConstructor;
|
|
29
|
-
default: boolean;
|
|
30
|
-
};
|
|
31
|
-
as: {
|
|
32
|
-
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
}>>, {
|
|
26
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
36
27
|
asChild: boolean;
|
|
37
28
|
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
38
29
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
@@ -19,8 +19,12 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script setup lang="ts">
|
|
22
|
-
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
|
23
|
-
import {
|
|
22
|
+
import { ref, watch, onMounted, onBeforeUnmount } from 'vue'
|
|
23
|
+
import {
|
|
24
|
+
useElementVisibility,
|
|
25
|
+
useEventListener,
|
|
26
|
+
defaultWindow,
|
|
27
|
+
} from '@vueuse/core'
|
|
24
28
|
import { usePlayerVideoApi } from '../composables/private/usePlayerVideoApi'
|
|
25
29
|
import { usePlayerMediaApi } from '../composables/private/usePlayerMediaApi'
|
|
26
30
|
import { usePlayerRuntime } from '../composables/private/usePlayerRuntime'
|
|
@@ -47,6 +51,8 @@ const props = withDefaults(defineProps<MagicPlayerProps>(), {
|
|
|
47
51
|
const playerRef = ref<HTMLDivElement | undefined>(undefined)
|
|
48
52
|
const videoRef = ref<HTMLVideoElement | undefined>(undefined)
|
|
49
53
|
|
|
54
|
+
const isVisible = useElementVisibility(playerRef)
|
|
55
|
+
|
|
50
56
|
const { playing, muted } = usePlayerMediaApi({
|
|
51
57
|
id: props.id,
|
|
52
58
|
mediaRef: videoRef,
|
|
@@ -65,13 +71,23 @@ const { onMouseenter, onMouseleave, play, pause } = usePlayerVideoApi({
|
|
|
65
71
|
playerRef: playerRef,
|
|
66
72
|
})
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
function onWindowFocus() {
|
|
75
|
+
if (isVisible.value && !playing.value && props.autoplay) {
|
|
76
|
+
play()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Auto play when window is focused
|
|
81
|
+
useEventListener(defaultWindow, 'focus', onWindowFocus)
|
|
82
|
+
|
|
83
|
+
// Auto play when element is visible
|
|
84
|
+
watch(
|
|
85
|
+
isVisible,
|
|
86
|
+
(value) => {
|
|
87
|
+
if (value && !playing.value && props.autoplay) {
|
|
74
88
|
play()
|
|
89
|
+
} else if (!value && playing.value) {
|
|
90
|
+
pause()
|
|
75
91
|
}
|
|
76
92
|
},
|
|
77
93
|
{
|
|
@@ -60,10 +60,8 @@ export function usePlayerMediaApi(args) {
|
|
|
60
60
|
if (!el) return;
|
|
61
61
|
if (isPlaying) {
|
|
62
62
|
const playPromise = el.play();
|
|
63
|
-
if (playPromise !== void 0)
|
|
64
|
-
|
|
65
|
-
console.warn("Playback error:", error);
|
|
66
|
-
});
|
|
63
|
+
if (playPromise !== void 0) playPromise.catch((error) => {
|
|
64
|
+
});
|
|
67
65
|
} else {
|
|
68
66
|
el.pause();
|
|
69
67
|
}
|
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.36.
|
|
4
|
+
"version": "0.36.3",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|