@maas/vue-equipment 0.14.1 → 0.14.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/nuxt/module.mjs +4 -4
- package/dist/plugins/MagicConsent/index.d.ts +2 -0
- package/dist/plugins/MagicDrawer/index.d.ts +2 -0
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +4 -5
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +2 -1
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +4 -3
- package/dist/plugins/MagicModal/index.d.ts +2 -0
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +3 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +5 -5
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +6 -5
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +7 -16
- package/dist/plugins/MagicToast/index.d.ts +2 -0
- package/dist/utils/index.d.mts +5 -1
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/types/RequireAllNested.ts +3 -0
- package/dist/utils/types/index.ts +1 -0
- package/package.json +1 -1
package/dist/nuxt/module.json
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -4,14 +4,14 @@ const functions$1 = [
|
|
|
4
4
|
{
|
|
5
5
|
name: "MagicConsent",
|
|
6
6
|
"package": "plugins",
|
|
7
|
-
lastUpdated:
|
|
7
|
+
lastUpdated: 1705422905000,
|
|
8
8
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicConsent/",
|
|
9
9
|
description: "consent"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
name: "MagicDrawer",
|
|
13
13
|
"package": "plugins",
|
|
14
|
-
lastUpdated:
|
|
14
|
+
lastUpdated: 1705422905000,
|
|
15
15
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicDrawer/",
|
|
16
16
|
description: "drawer"
|
|
17
17
|
},
|
|
@@ -25,7 +25,7 @@ const functions$1 = [
|
|
|
25
25
|
{
|
|
26
26
|
name: "MagicModal",
|
|
27
27
|
"package": "plugins",
|
|
28
|
-
lastUpdated:
|
|
28
|
+
lastUpdated: 1705422905000,
|
|
29
29
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicModal/",
|
|
30
30
|
description: "modal"
|
|
31
31
|
},
|
|
@@ -53,7 +53,7 @@ const functions$1 = [
|
|
|
53
53
|
{
|
|
54
54
|
name: "MagicToast",
|
|
55
55
|
"package": "plugins",
|
|
56
|
-
lastUpdated:
|
|
56
|
+
lastUpdated: 1705422905000,
|
|
57
57
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicToast/",
|
|
58
58
|
description: "toast"
|
|
59
59
|
},
|
|
@@ -2,5 +2,7 @@ import type { Plugin } from 'vue';
|
|
|
2
2
|
import MagicConsent from './src/components/MagicConsent.vue.js';
|
|
3
3
|
import { useConsentApi } from './src/composables/useConsentApi.js';
|
|
4
4
|
import { useConsentEmitter } from './src/composables/useConsentEmitter.js';
|
|
5
|
+
import type { ConsentEvents } from './src/types.js';
|
|
5
6
|
declare const MagicConsentPlugin: Plugin;
|
|
6
7
|
export { MagicConsentPlugin, MagicConsent, useConsentApi, useConsentEmitter };
|
|
8
|
+
export type { ConsentEvents };
|
|
@@ -2,5 +2,7 @@ import MagicDrawer from './src/components/MagicDrawer.vue.js';
|
|
|
2
2
|
import { useDrawerApi } from './src/composables/useDrawerApi.js';
|
|
3
3
|
import { useDrawerEmitter } from './src/composables/useDrawerEmitter.js';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
|
+
import type { DrawerEvents } from './src/types.js';
|
|
5
6
|
declare const MagicDrawerPlugin: Plugin;
|
|
6
7
|
export { MagicDrawerPlugin, MagicDrawer, useDrawerApi, useDrawerEmitter };
|
|
8
|
+
export type { DrawerEvents };
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
>
|
|
8
8
|
<component
|
|
9
9
|
:is="mappedOptions.tag"
|
|
10
|
-
ref="
|
|
10
|
+
ref="drawerRef"
|
|
11
11
|
class="magic-drawer"
|
|
12
12
|
:id="toValue(id)"
|
|
13
13
|
:class="[
|
|
@@ -77,7 +77,6 @@ import { useDrawerApi } from './../composables/useDrawerApi'
|
|
|
77
77
|
import { useDrawerCallback } from '../composables/private/useDrawerCallback'
|
|
78
78
|
import { useDrawerDrag } from '../composables/private/useDrawerDrag'
|
|
79
79
|
|
|
80
|
-
import type { RequireAll } from '@maas/vue-equipment/utils'
|
|
81
80
|
import type { DrawerOptions } from './../types/index'
|
|
82
81
|
|
|
83
82
|
import '@maas/vue-equipment/utils/css/animations/fade-in.css'
|
|
@@ -112,8 +111,8 @@ const props = withDefaults(defineProps<MagicDrawerProps>(), {
|
|
|
112
111
|
})
|
|
113
112
|
|
|
114
113
|
const elRef = ref<HTMLDivElement | undefined>(undefined)
|
|
115
|
-
const
|
|
116
|
-
const drawerApi = useDrawerApi(props.id, { focusTarget:
|
|
114
|
+
const drawerRef = ref<HTMLElement | undefined>(undefined)
|
|
115
|
+
const drawerApi = useDrawerApi(props.id, { focusTarget: drawerRef })
|
|
117
116
|
const mappedOptions: typeof defaultOptions = customDefu(
|
|
118
117
|
props.options,
|
|
119
118
|
defaultOptions
|
|
@@ -201,7 +200,7 @@ function convertToPixels(value: string) {
|
|
|
201
200
|
}
|
|
202
201
|
|
|
203
202
|
function saveOvershoot() {
|
|
204
|
-
const element = unrefElement(
|
|
203
|
+
const element = unrefElement(drawerRef)
|
|
205
204
|
const overshootVar = getComputedStyle(element!).getPropertyValue(
|
|
206
205
|
'--magic-drawer-drag-overshoot'
|
|
207
206
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { type DefaultOptions } from '../../utils/defaultOptions.js';
|
|
3
3
|
type UseDrawerDragArgs = {
|
|
4
4
|
elRef: MaybeRef<HTMLDivElement | undefined>;
|
|
5
|
-
position: MaybeRef<
|
|
6
|
-
threshold: MaybeRef<
|
|
5
|
+
position: MaybeRef<DefaultOptions['position']>;
|
|
6
|
+
threshold: MaybeRef<DefaultOptions['threshold']>;
|
|
7
7
|
overshoot: MaybeRef<number>;
|
|
8
8
|
close: () => void;
|
|
9
9
|
};
|
|
@@ -114,6 +114,7 @@ export function useDrawerDrag(args) {
|
|
|
114
114
|
}
|
|
115
115
|
function resetStateAndListeners() {
|
|
116
116
|
dragging.value = false;
|
|
117
|
+
shouldClose.value = false;
|
|
117
118
|
cancelPointermove?.();
|
|
118
119
|
}
|
|
119
120
|
function resetDragged() {
|
|
@@ -126,7 +127,6 @@ export function useDrawerDrag(args) {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
function onPointerup(e) {
|
|
129
|
-
resetStateAndListeners();
|
|
130
130
|
if (shouldClose.value) {
|
|
131
131
|
close();
|
|
132
132
|
} else {
|
|
@@ -155,6 +155,7 @@ export function useDrawerDrag(args) {
|
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
resetStateAndListeners();
|
|
158
159
|
e.preventDefault();
|
|
159
160
|
}
|
|
160
161
|
function onPointermove(e) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DrawerOptions } from '../types.js';
|
|
2
|
-
import type {
|
|
3
|
-
declare const defaultOptions:
|
|
4
|
-
|
|
2
|
+
import type { RequireAllNested } from '@maas/vue-equipment/utils';
|
|
3
|
+
declare const defaultOptions: RequireAllNested<DrawerOptions>;
|
|
4
|
+
type DefaultOptions = typeof defaultOptions;
|
|
5
|
+
export { defaultOptions, type DefaultOptions };
|
|
@@ -2,5 +2,7 @@ import MagicModal from './src/components/MagicModal.vue.js';
|
|
|
2
2
|
import { useModalApi } from './src/composables/useModalApi.js';
|
|
3
3
|
import { useModalEmitter } from './src/composables/useModalEmitter.js';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
|
+
import type { ModalEvents } from './src/types.js';
|
|
5
6
|
declare const MagicModalPlugin: Plugin;
|
|
6
7
|
export { MagicModalPlugin, MagicModal, useModalEmitter, useModalApi };
|
|
8
|
+
export type { ModalEvents };
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
>
|
|
8
8
|
<component
|
|
9
9
|
:is="mappedOptions.tag"
|
|
10
|
-
ref="
|
|
10
|
+
ref="modalRef"
|
|
11
11
|
class="magic-modal"
|
|
12
12
|
:id="toValue(id)"
|
|
13
13
|
:class="toValue(props.class)"
|
|
@@ -94,8 +94,8 @@ const props = withDefaults(defineProps<MagicModalProps>(), {
|
|
|
94
94
|
options: () => defaultOptions,
|
|
95
95
|
})
|
|
96
96
|
|
|
97
|
-
const
|
|
98
|
-
const modalApi = useModalApi(props.id, { focusTarget:
|
|
97
|
+
const modalRef = ref<HTMLElement | undefined>(undefined)
|
|
98
|
+
const modalApi = useModalApi(props.id, { focusTarget: modalRef })
|
|
99
99
|
const mappedOptions = customDefu(props.options, defaultOptions)
|
|
100
100
|
|
|
101
101
|
const {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
class="magic-player-mux-popover"
|
|
8
8
|
>
|
|
9
9
|
<canvas
|
|
10
|
-
ref="
|
|
10
|
+
ref="canvasRef"
|
|
11
11
|
:width="storyboard?.tile_width"
|
|
12
12
|
:height="storyboard?.tile_height"
|
|
13
13
|
/>
|
|
@@ -42,7 +42,7 @@ const { instance } = usePlayerApi(props.id)
|
|
|
42
42
|
const { seekedTime } = instance.value.controlsApi
|
|
43
43
|
const { pixelRatio } = useDevicePixelRatio()
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const canvasRef = shallowRef() as Ref<HTMLCanvasElement>
|
|
46
46
|
const storyboard = shallowRef<MuxStoryboard | undefined>()
|
|
47
47
|
let context: CanvasRenderingContext2D | undefined = undefined
|
|
48
48
|
let image: HTMLImageElement | undefined = undefined
|
|
@@ -62,7 +62,7 @@ async function init() {
|
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
64
|
storyboard.value = await fetch(
|
|
65
|
-
`https://image.mux.com/${props.playbackId}/storyboard.json
|
|
65
|
+
`https://image.mux.com/${props.playbackId}/storyboard.json`
|
|
66
66
|
).then((res) => res.json())
|
|
67
67
|
|
|
68
68
|
if (!storyboard.value) throw new Error()
|
|
@@ -71,7 +71,7 @@ async function init() {
|
|
|
71
71
|
image.src = storyboard.value.url
|
|
72
72
|
await image.decode()
|
|
73
73
|
|
|
74
|
-
context =
|
|
74
|
+
context = canvasRef.value.getContext('2d')!
|
|
75
75
|
context.drawImage(image, 0, 0)
|
|
76
76
|
} catch (e: any) {
|
|
77
77
|
console.error('Can not initialize timeine preview.', e)
|
|
@@ -107,7 +107,7 @@ function drawFrame(time: number) {
|
|
|
107
107
|
0,
|
|
108
108
|
0,
|
|
109
109
|
tile_width,
|
|
110
|
-
tile_height
|
|
110
|
+
tile_height
|
|
111
111
|
)
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="
|
|
2
|
+
<div ref="elRef" class="magic-scroll-motion">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
8
|
import { ref, inject, computed, onMounted, toRaw, watch } from 'vue'
|
|
9
|
+
import { unrefElement } from '@vueuse/core'
|
|
9
10
|
import { animate, type Easing } from 'motion'
|
|
10
11
|
import { ScrollProgressKey } from '../symbols'
|
|
11
12
|
|
|
@@ -22,16 +23,16 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
22
23
|
})
|
|
23
24
|
|
|
24
25
|
const animation = ref()
|
|
25
|
-
const
|
|
26
|
+
const elRef = ref()
|
|
26
27
|
|
|
27
28
|
const progress = inject(
|
|
28
29
|
ScrollProgressKey,
|
|
29
|
-
computed(() => 0)
|
|
30
|
+
computed(() => 0)
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
function createAnimation(currentTime: number = 0) {
|
|
33
34
|
if (!props.keyframes) return
|
|
34
|
-
animation.value = animate(
|
|
35
|
+
animation.value = animate(unrefElement(elRef), props.keyframes, {
|
|
35
36
|
duration: 1,
|
|
36
37
|
easing: props.easing || 'linear',
|
|
37
38
|
offset: props.offset,
|
|
@@ -53,6 +54,6 @@ watch(
|
|
|
53
54
|
() => props.keyframes,
|
|
54
55
|
() => {
|
|
55
56
|
createAnimation(progress.value)
|
|
56
|
-
}
|
|
57
|
+
}
|
|
57
58
|
)
|
|
58
59
|
</script>
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="
|
|
2
|
+
<div ref="elRef" class="magic-scroll-scene">
|
|
3
3
|
<slot :map-value="mapValue" :progress="progress" />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
provide,
|
|
11
|
-
inject,
|
|
12
|
-
onMounted,
|
|
13
|
-
watch,
|
|
14
|
-
nextTick,
|
|
15
|
-
toRaw,
|
|
16
|
-
readonly,
|
|
17
|
-
} from 'vue'
|
|
18
|
-
import { useIntersectionObserver } from '@vueuse/core'
|
|
8
|
+
import { ref, provide, inject, onMounted, watch, nextTick, readonly } from 'vue'
|
|
9
|
+
import { unrefElement, useIntersectionObserver } from '@vueuse/core'
|
|
19
10
|
import { mapValue } from '@maas/vue-equipment/utils'
|
|
20
11
|
import { useScrollApi } from '../composables/useScrollApi'
|
|
21
12
|
import {
|
|
@@ -39,12 +30,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
39
30
|
const scrollPosition = inject(ScrollPositionKey, undefined)
|
|
40
31
|
const scrollParent = inject(ScrollParentKey)
|
|
41
32
|
|
|
42
|
-
const
|
|
43
|
-
const sceneRef = ref<HTMLElement | undefined>(undefined)
|
|
33
|
+
const elRef = ref<HTMLElement | undefined>(undefined)
|
|
44
34
|
const progress = ref(0)
|
|
35
|
+
const intersecting = ref()
|
|
45
36
|
|
|
46
37
|
const { getCalculations, getProgress } = useScrollApi({
|
|
47
|
-
child:
|
|
38
|
+
child: elRef,
|
|
48
39
|
parent: scrollParent,
|
|
49
40
|
from: props.from,
|
|
50
41
|
to: props.to,
|
|
@@ -70,7 +61,7 @@ watch(
|
|
|
70
61
|
)
|
|
71
62
|
|
|
72
63
|
useIntersectionObserver(
|
|
73
|
-
|
|
64
|
+
elRef,
|
|
74
65
|
([{ isIntersecting }]) => {
|
|
75
66
|
intersecting.value = isIntersecting
|
|
76
67
|
if (isIntersecting) {
|
|
@@ -2,5 +2,7 @@ import MagicToast from './src/components/MagicToast.vue.js';
|
|
|
2
2
|
import { useToastApi } from './src/composables/useToastApi.js';
|
|
3
3
|
import { useToastEmitter } from './src/composables/useToastEmitter.js';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
|
+
import type { ToastEvents } from './src/types.js';
|
|
5
6
|
declare const MagicToastPlugin: Plugin;
|
|
6
7
|
export { MagicToastPlugin, MagicToast, useToastApi, useToastEmitter };
|
|
8
|
+
export type { ToastEvents };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -25,4 +25,8 @@ type RequireAll<T> = {
|
|
|
25
25
|
[P in keyof T]-?: T[P];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
type RequireAllNested<T> = {
|
|
29
|
+
[P in keyof T]-?: RequireAllNested<T[P]>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { type PickPartial, type RequireAll, type RequireAllNested, type SlugifyOptions, clampValue, isIOS, mapValue, slugify, uniq, uuid };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -25,4 +25,8 @@ type RequireAll<T> = {
|
|
|
25
25
|
[P in keyof T]-?: T[P];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
type RequireAllNested<T> = {
|
|
29
|
+
[P in keyof T]-?: RequireAllNested<T[P]>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { type PickPartial, type RequireAll, type RequireAllNested, type SlugifyOptions, clampValue, isIOS, mapValue, slugify, uniq, uuid };
|
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.14.
|
|
4
|
+
"version": "0.14.3",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.12",
|