@maas/vue-equipment 0.13.0 → 0.14.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 +22 -28
- package/dist/plugins/MagicConsent/src/composables/private/defineConsentApi.mjs +1 -1
- package/dist/plugins/MagicDrawer/index.d.ts +6 -0
- package/dist/plugins/MagicDrawer/index.mjs +9 -0
- package/dist/plugins/MagicDrawer/nuxt.d.ts +0 -0
- package/dist/plugins/MagicDrawer/nuxt.mjs +27 -0
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +237 -0
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +52 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.d.ts +22 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.mjs +61 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +15 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +201 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerStore.d.ts +5 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerStore.mjs +15 -0
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.d.ts +19 -0
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.mjs +75 -0
- package/dist/plugins/MagicDrawer/src/composables/useDrawerEmitter.d.ts +15 -0
- package/dist/plugins/MagicDrawer/src/composables/useDrawerEmitter.mjs +9 -0
- package/dist/plugins/MagicDrawer/src/index.d.ts +0 -0
- package/dist/plugins/MagicDrawer/src/index.mjs +0 -0
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +29 -0
- package/dist/plugins/MagicDrawer/src/types/index.mjs +0 -0
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +4 -0
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.mjs +22 -0
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +2 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +4 -4
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +4 -4
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.mjs +14 -13
- package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +1 -1
- package/dist/plugins/MagicModal/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicNoise/src/utils/defaultOptions.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/useControlsApi.mjs +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.mjs +1 -1
- package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.mjs +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/composables/useScrollApi.mjs +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +6 -6
- package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +5 -5
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +1 -1
- package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/css/animations/slide-btt-out.css +0 -3
- package/dist/utils/css/animations/slide-ltr-out.css +0 -3
- package/dist/utils/css/animations/slide-rtl-out.css +0 -3
- package/dist/utils/css/animations/slide-ttb-out.css +0 -3
- package/dist/utils/{index.d.cts → index.d.mts} +9 -1
- package/dist/utils/index.d.ts +9 -1
- package/dist/utils/index.js +60 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/{index.cjs → index.mjs} +28 -35
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +2 -4
- package/dist/utils/index.cjs.map +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ref,
|
|
3
|
+
computed,
|
|
4
|
+
onMounted,
|
|
5
|
+
watch,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
toValue
|
|
8
|
+
} from "vue";
|
|
9
|
+
import { useEventListener, unrefElement } from "@vueuse/core";
|
|
10
|
+
import { interpolate } from "@maas/vue-equipment/utils";
|
|
11
|
+
import { useDrawerEmitter } from "../useDrawerEmitter.mjs";
|
|
12
|
+
export function useDrawerDrag(args) {
|
|
13
|
+
const { elRef, position, overshoot, threshold, close } = args;
|
|
14
|
+
const dragStart = ref(void 0);
|
|
15
|
+
const originX = ref(0);
|
|
16
|
+
const originY = ref(0);
|
|
17
|
+
const dragging = ref(false);
|
|
18
|
+
const shouldClose = ref(false);
|
|
19
|
+
const elRect = ref(void 0);
|
|
20
|
+
let cancelPointermove = void 0;
|
|
21
|
+
const draggedX = ref(0);
|
|
22
|
+
const draggedY = ref(0);
|
|
23
|
+
const style = computed(
|
|
24
|
+
() => `transform: translate(${draggedX.value}px, ${draggedY.value}px)`
|
|
25
|
+
);
|
|
26
|
+
function getSizes() {
|
|
27
|
+
elRect.value = unrefElement(elRef)?.getBoundingClientRect();
|
|
28
|
+
}
|
|
29
|
+
function checkPosition() {
|
|
30
|
+
switch (position) {
|
|
31
|
+
case "bottom":
|
|
32
|
+
if (draggedY.value > toValue(threshold).distance) {
|
|
33
|
+
shouldClose.value = true;
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
case "top":
|
|
37
|
+
if (draggedY.value < toValue(threshold).distance * -1) {
|
|
38
|
+
shouldClose.value = true;
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
case "right":
|
|
42
|
+
if (draggedX.value > toValue(threshold).distance) {
|
|
43
|
+
shouldClose.value = true;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case "left":
|
|
47
|
+
if (draggedX.value < toValue(threshold).distance * -1) {
|
|
48
|
+
shouldClose.value = true;
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function checkMomentum({ x, y }) {
|
|
54
|
+
const elapsed = Date.now() - dragStart.value.getTime();
|
|
55
|
+
const velocityX = (x - originX.value) / elapsed;
|
|
56
|
+
const velocityY = (y - originY.value) / elapsed;
|
|
57
|
+
switch (position) {
|
|
58
|
+
case "bottom":
|
|
59
|
+
if (velocityY > toValue(threshold).momentum) {
|
|
60
|
+
shouldClose.value = true;
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case "top":
|
|
64
|
+
if (velocityY < toValue(threshold).momentum * -1) {
|
|
65
|
+
shouldClose.value = true;
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case "right":
|
|
69
|
+
if (velocityX > toValue(threshold).momentum) {
|
|
70
|
+
shouldClose.value = true;
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case "left":
|
|
74
|
+
if (velocityX < toValue(threshold).momentum * -1) {
|
|
75
|
+
shouldClose.value = true;
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function clamp(value, from, to) {
|
|
81
|
+
if (from > to) {
|
|
82
|
+
if (value > from)
|
|
83
|
+
return value;
|
|
84
|
+
if (value < to)
|
|
85
|
+
return to;
|
|
86
|
+
else
|
|
87
|
+
return value;
|
|
88
|
+
} else if (from < to) {
|
|
89
|
+
if (value < from)
|
|
90
|
+
return value;
|
|
91
|
+
if (value > to)
|
|
92
|
+
return to;
|
|
93
|
+
else
|
|
94
|
+
return value;
|
|
95
|
+
} else {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function setDragged({ x, y }) {
|
|
100
|
+
switch (position) {
|
|
101
|
+
case "bottom":
|
|
102
|
+
draggedY.value = clamp(y - originY.value, 0, toValue(overshoot) * -1);
|
|
103
|
+
break;
|
|
104
|
+
case "top":
|
|
105
|
+
draggedY.value = clamp(y - originY.value, 0, toValue(overshoot));
|
|
106
|
+
break;
|
|
107
|
+
case "right":
|
|
108
|
+
draggedX.value = clamp(x - originX.value, 0, toValue(overshoot) * -1);
|
|
109
|
+
break;
|
|
110
|
+
case "left":
|
|
111
|
+
draggedX.value = clamp(x - originX.value, 0, toValue(overshoot));
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function resetStateAndListeners() {
|
|
116
|
+
dragging.value = false;
|
|
117
|
+
cancelPointermove?.();
|
|
118
|
+
}
|
|
119
|
+
function resetDragged() {
|
|
120
|
+
draggedX.value = 0;
|
|
121
|
+
draggedY.value = 0;
|
|
122
|
+
}
|
|
123
|
+
function emitterCallback(event, _payload) {
|
|
124
|
+
if (event === "afterLeave") {
|
|
125
|
+
resetDragged();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function onPointerup(e) {
|
|
129
|
+
resetStateAndListeners();
|
|
130
|
+
if (shouldClose.value) {
|
|
131
|
+
close();
|
|
132
|
+
} else {
|
|
133
|
+
switch (position) {
|
|
134
|
+
case "bottom":
|
|
135
|
+
case "top":
|
|
136
|
+
interpolate({
|
|
137
|
+
from: draggedY.value,
|
|
138
|
+
to: 0,
|
|
139
|
+
duration: 50,
|
|
140
|
+
callback: (value) => {
|
|
141
|
+
draggedY.value = value;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
break;
|
|
145
|
+
case "right":
|
|
146
|
+
case "left":
|
|
147
|
+
interpolate({
|
|
148
|
+
from: draggedX.value,
|
|
149
|
+
to: 0,
|
|
150
|
+
duration: 50,
|
|
151
|
+
callback: (value) => {
|
|
152
|
+
draggedX.value = value;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
}
|
|
160
|
+
function onPointermove(e) {
|
|
161
|
+
shouldClose.value = false;
|
|
162
|
+
checkMomentum({ x: e.screenX, y: e.screenY });
|
|
163
|
+
setDragged({ x: e.screenX, y: e.screenY });
|
|
164
|
+
checkPosition();
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
}
|
|
167
|
+
function onPointerdown(e) {
|
|
168
|
+
if (dragging.value) {
|
|
169
|
+
return;
|
|
170
|
+
} else {
|
|
171
|
+
dragging.value = true;
|
|
172
|
+
}
|
|
173
|
+
;
|
|
174
|
+
e.target.setPointerCapture(e.pointerId);
|
|
175
|
+
useEventListener(document, "pointerup", onPointerup);
|
|
176
|
+
cancelPointermove = useEventListener(document, "pointermove", onPointermove);
|
|
177
|
+
originX.value = e.screenX;
|
|
178
|
+
originY.value = e.screenY;
|
|
179
|
+
dragStart.value = /* @__PURE__ */ new Date();
|
|
180
|
+
onPointermove(e);
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
}
|
|
183
|
+
onMounted(() => {
|
|
184
|
+
getSizes();
|
|
185
|
+
useDrawerEmitter().on("*", emitterCallback);
|
|
186
|
+
});
|
|
187
|
+
watch(
|
|
188
|
+
() => unrefElement(elRef),
|
|
189
|
+
() => {
|
|
190
|
+
getSizes();
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
onBeforeUnmount(() => {
|
|
194
|
+
useDrawerEmitter().off("*", emitterCallback);
|
|
195
|
+
});
|
|
196
|
+
return {
|
|
197
|
+
style,
|
|
198
|
+
dragging,
|
|
199
|
+
onPointerdown
|
|
200
|
+
};
|
|
201
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
let drawerStore = ref([]);
|
|
3
|
+
export function useDrawerStore() {
|
|
4
|
+
function addInstance(id) {
|
|
5
|
+
drawerStore.value.push(id);
|
|
6
|
+
}
|
|
7
|
+
function removeInstance(id) {
|
|
8
|
+
drawerStore.value = drawerStore.value.filter((x) => x !== id);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
drawerStore,
|
|
12
|
+
addInstance,
|
|
13
|
+
removeInstance
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
|
+
import type { DrawerOptions } from '../types/index.js';
|
|
3
|
+
import type { MaybeElementRef } from '@vueuse/core';
|
|
4
|
+
export type useDrawerApiOptions = Pick<DrawerOptions, 'scrollLock'> & {
|
|
5
|
+
focusTarget: MaybeElementRef;
|
|
6
|
+
};
|
|
7
|
+
export declare function useDrawerApi(id?: MaybeRef<string>, options?: useDrawerApiOptions): {
|
|
8
|
+
id: import("vue").ComputedRef<string>;
|
|
9
|
+
isActive: import("vue").ComputedRef<boolean>;
|
|
10
|
+
open: () => void;
|
|
11
|
+
close: () => void;
|
|
12
|
+
trapFocus: () => void;
|
|
13
|
+
releaseFocus: () => void;
|
|
14
|
+
lockScroll: () => void;
|
|
15
|
+
unlockScroll: () => void;
|
|
16
|
+
addScrollLockPadding: () => void;
|
|
17
|
+
removeScrollLockPadding: () => void;
|
|
18
|
+
};
|
|
19
|
+
export type UseDrawerApiReturn = ReturnType<typeof useDrawerApi>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
|
+
import { ref, computed, toValue } from "vue";
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { useScrollLock } from "@vueuse/core";
|
|
5
|
+
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
|
|
6
|
+
import { useDrawerStore } from "./private/useDrawerStore.mjs";
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
focusTarget: void 0,
|
|
9
|
+
scrollLock: true
|
|
10
|
+
};
|
|
11
|
+
export function useDrawerApi(id, options) {
|
|
12
|
+
const positionFixedElements = ref([]);
|
|
13
|
+
const mappedId = computed(() => toValue(id) || uuid());
|
|
14
|
+
const mappedOptions = defu(options, defaultOptions);
|
|
15
|
+
const focusTrap = mappedOptions.focusTarget ? useFocusTrap(mappedOptions.focusTarget) : void 0;
|
|
16
|
+
const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
|
|
17
|
+
const { drawerStore, addInstance, removeInstance } = useDrawerStore();
|
|
18
|
+
const isActive = computed(() => drawerStore.value.includes(mappedId.value));
|
|
19
|
+
function open() {
|
|
20
|
+
addInstance(mappedId.value);
|
|
21
|
+
}
|
|
22
|
+
function close() {
|
|
23
|
+
removeInstance(mappedId.value);
|
|
24
|
+
}
|
|
25
|
+
function trapFocus() {
|
|
26
|
+
if (focusTrap) {
|
|
27
|
+
focusTrap.activate();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function releaseFocus() {
|
|
31
|
+
if (focusTrap) {
|
|
32
|
+
focusTrap.deactivate();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function lockScroll() {
|
|
36
|
+
scrollLock.value = true;
|
|
37
|
+
}
|
|
38
|
+
function unlockScroll() {
|
|
39
|
+
scrollLock.value = false;
|
|
40
|
+
}
|
|
41
|
+
function addScrollLockPadding() {
|
|
42
|
+
if (typeof window === "undefined")
|
|
43
|
+
return;
|
|
44
|
+
const scrollbarWidth = window.innerWidth - document.body.offsetWidth;
|
|
45
|
+
document.body.style.setProperty("--scrollbar-width", `${scrollbarWidth}px`);
|
|
46
|
+
document.body.style.paddingRight = "var(--scrollbar-width)";
|
|
47
|
+
positionFixedElements.value = [
|
|
48
|
+
...document.body.getElementsByTagName("*")
|
|
49
|
+
].filter(
|
|
50
|
+
(x) => getComputedStyle(x, null).getPropertyValue("position") === "fixed"
|
|
51
|
+
);
|
|
52
|
+
positionFixedElements.value.forEach(
|
|
53
|
+
(elem) => elem.style.paddingRight = "var(--scrollbar-width)"
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function removeScrollLockPadding() {
|
|
57
|
+
document.body.style.paddingRight = "";
|
|
58
|
+
document.body.style.removeProperty("--scrollbar-width");
|
|
59
|
+
positionFixedElements.value.forEach(
|
|
60
|
+
(elem) => elem.style.paddingRight = ""
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
id: mappedId,
|
|
65
|
+
isActive,
|
|
66
|
+
open,
|
|
67
|
+
close,
|
|
68
|
+
trapFocus,
|
|
69
|
+
releaseFocus,
|
|
70
|
+
lockScroll,
|
|
71
|
+
unlockScroll,
|
|
72
|
+
addScrollLockPadding,
|
|
73
|
+
removeScrollLockPadding
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DrawerEvents } from '../types.js';
|
|
2
|
+
export declare function useDrawerEmitter(): {
|
|
3
|
+
on: {
|
|
4
|
+
<Key extends keyof DrawerEvents>(type: Key, handler: import("mitt").Handler<DrawerEvents[Key]>): void;
|
|
5
|
+
(type: "*", handler: import("mitt").WildcardHandler<DrawerEvents>): void;
|
|
6
|
+
};
|
|
7
|
+
off: {
|
|
8
|
+
<Key_1 extends keyof DrawerEvents>(type: Key_1, handler?: import("mitt").Handler<DrawerEvents[Key_1]> | undefined): void;
|
|
9
|
+
(type: "*", handler: import("mitt").WildcardHandler<DrawerEvents>): void;
|
|
10
|
+
};
|
|
11
|
+
emit: {
|
|
12
|
+
<Key_2 extends keyof DrawerEvents>(type: Key_2, event: DrawerEvents[Key_2]): void;
|
|
13
|
+
<Key_3 extends keyof DrawerEvents>(type: undefined extends DrawerEvents[Key_3] ? Key_3 : never): void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type DrawerOptions = {
|
|
2
|
+
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
3
|
+
backdrop?: boolean;
|
|
4
|
+
focusTrap?: boolean;
|
|
5
|
+
scrollLock?: boolean;
|
|
6
|
+
scrollLockPadding?: boolean;
|
|
7
|
+
teleport?: {
|
|
8
|
+
target?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
transitions?: {
|
|
12
|
+
content?: string;
|
|
13
|
+
backdrop?: string;
|
|
14
|
+
};
|
|
15
|
+
threshold: {
|
|
16
|
+
distance: number;
|
|
17
|
+
momentum: number;
|
|
18
|
+
};
|
|
19
|
+
tag?: 'dialog' | 'div';
|
|
20
|
+
keys?: string[] | false;
|
|
21
|
+
};
|
|
22
|
+
export type DrawerEvents = {
|
|
23
|
+
beforeEnter: string;
|
|
24
|
+
enter: string;
|
|
25
|
+
afterEnter: string;
|
|
26
|
+
beforeLeave: string;
|
|
27
|
+
leave: string;
|
|
28
|
+
afterLeave: string;
|
|
29
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const defaultOptions = {
|
|
2
|
+
position: "bottom",
|
|
3
|
+
backdrop: true,
|
|
4
|
+
focusTrap: true,
|
|
5
|
+
scrollLock: true,
|
|
6
|
+
scrollLockPadding: true,
|
|
7
|
+
teleport: {
|
|
8
|
+
target: "body",
|
|
9
|
+
disabled: false
|
|
10
|
+
},
|
|
11
|
+
transitions: {
|
|
12
|
+
content: "magic-drawer--content",
|
|
13
|
+
backdrop: "magic-drawer--backdrop"
|
|
14
|
+
},
|
|
15
|
+
threshold: {
|
|
16
|
+
distance: 150,
|
|
17
|
+
momentum: 1
|
|
18
|
+
},
|
|
19
|
+
tag: "dialog",
|
|
20
|
+
keys: ["Escape"]
|
|
21
|
+
};
|
|
22
|
+
export { defaultOptions };
|
|
@@ -71,8 +71,8 @@ import { useModalCallback } from '../composables/private/useModalCallback'
|
|
|
71
71
|
|
|
72
72
|
import type { ModalOptions } from './../types/index'
|
|
73
73
|
|
|
74
|
-
import 'utils/css/animations/fade-in.css'
|
|
75
|
-
import 'utils/css/animations/fade-out.css'
|
|
74
|
+
import '@maas/vue-equipment/utils/css/animations/fade-in.css'
|
|
75
|
+
import '@maas/vue-equipment/utils/css/animations/fade-out.css'
|
|
76
76
|
|
|
77
77
|
// Prevent keys array from being merged with default
|
|
78
78
|
const customDefu = createDefu((obj, key, value) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Component, type MaybeRef } from 'vue';
|
|
2
2
|
import type { ModalOptions } from './../types/index';
|
|
3
|
-
import 'utils/css/animations/fade-in.css';
|
|
4
|
-
import 'utils/css/animations/fade-out.css';
|
|
3
|
+
import '@maas/vue-equipment/utils/css/animations/fade-in.css';
|
|
4
|
+
import '@maas/vue-equipment/utils/css/animations/fade-out.css';
|
|
5
5
|
interface MagicModalProps {
|
|
6
6
|
id: MaybeRef<string>;
|
|
7
7
|
class?: MaybeRef<string>;
|
|
@@ -10,9 +10,9 @@ interface MagicModalProps {
|
|
|
10
10
|
options?: ModalOptions;
|
|
11
11
|
}
|
|
12
12
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MagicModalProps>, {
|
|
13
|
-
options: () =>
|
|
13
|
+
options: () => ModalOptions;
|
|
14
14
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MagicModalProps>, {
|
|
15
|
-
options: () =>
|
|
15
|
+
options: () => ModalOptions;
|
|
16
16
|
}>>>, {
|
|
17
17
|
options: ModalOptions;
|
|
18
18
|
}, {}>, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref, type MaybeRef } from 'vue';
|
|
2
2
|
import type { ModalOptions } from '../../types.js';
|
|
3
|
-
type
|
|
3
|
+
type UseModalCallbackArgs = {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
5
|
mappedOptions: ModalOptions;
|
|
6
6
|
addScrollLockPadding: () => void;
|
|
@@ -11,12 +11,12 @@ type Args = {
|
|
|
11
11
|
releaseFocus: () => void;
|
|
12
12
|
wrapperActive: Ref<boolean>;
|
|
13
13
|
};
|
|
14
|
-
export declare function useModalCallback(
|
|
14
|
+
export declare function useModalCallback(args: UseModalCallbackArgs): {
|
|
15
15
|
onBeforeEnter: (_el: Element) => void;
|
|
16
16
|
onEnter: (_el: Element) => void;
|
|
17
|
-
onAfterEnter: (
|
|
17
|
+
onAfterEnter: (_el: Element) => Promise<void>;
|
|
18
18
|
onBeforeLeave: (_el: Element) => void;
|
|
19
|
-
onLeave: (
|
|
19
|
+
onLeave: (_el: Element) => void;
|
|
20
20
|
onAfterLeave: (_el: Element) => void;
|
|
21
21
|
};
|
|
22
22
|
export {};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { toValue, nextTick } from "vue";
|
|
2
2
|
import { useModalEmitter } from "./../useModalEmitter.mjs";
|
|
3
|
-
export function useModalCallback({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
export function useModalCallback(args) {
|
|
4
|
+
const {
|
|
5
|
+
id,
|
|
6
|
+
mappedOptions,
|
|
7
|
+
addScrollLockPadding,
|
|
8
|
+
removeScrollLockPadding,
|
|
9
|
+
lockScroll,
|
|
10
|
+
unlockScroll,
|
|
11
|
+
trapFocus,
|
|
12
|
+
releaseFocus,
|
|
13
|
+
wrapperActive
|
|
14
|
+
} = args;
|
|
14
15
|
function onBeforeEnter(_el) {
|
|
15
16
|
useModalEmitter().emit("beforeEnter", toValue(id));
|
|
16
17
|
}
|
|
17
18
|
function onEnter(_el) {
|
|
18
19
|
useModalEmitter().emit("enter", toValue(id));
|
|
19
20
|
}
|
|
20
|
-
async function onAfterEnter(
|
|
21
|
+
async function onAfterEnter(_el) {
|
|
21
22
|
useModalEmitter().emit("afterEnter", toValue(id));
|
|
22
23
|
if (mappedOptions.scrollLock) {
|
|
23
24
|
if (mappedOptions.scrollLockPadding) {
|
|
@@ -33,7 +34,7 @@ export function useModalCallback({
|
|
|
33
34
|
function onBeforeLeave(_el) {
|
|
34
35
|
useModalEmitter().emit("beforeLeave", toValue(id));
|
|
35
36
|
}
|
|
36
|
-
function onLeave(
|
|
37
|
+
function onLeave(_el) {
|
|
37
38
|
useModalEmitter().emit("leave", toValue(id));
|
|
38
39
|
}
|
|
39
40
|
function onAfterLeave(_el) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModalOptions } from '../types
|
|
2
|
-
import type { RequireAll } from 'utils';
|
|
1
|
+
import type { ModalOptions } from '../types.js';
|
|
2
|
+
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
3
3
|
declare const defaultOptions: RequireAll<ModalOptions>;
|
|
4
4
|
export { defaultOptions };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useEventListener,
|
|
5
5
|
defaultWindow
|
|
6
6
|
} from "@vueuse/core";
|
|
7
|
-
import { clampValue, mapValue } from "utils";
|
|
7
|
+
import { clampValue, mapValue } from "@maas/vue-equipment/utils";
|
|
8
8
|
import { usePlayerStore } from "./usePlayerStore.mjs";
|
|
9
9
|
export function useControlsApi(args) {
|
|
10
10
|
const { findInstance } = usePlayerStore();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, watch, toValue } from "vue";
|
|
2
2
|
import { useFullscreen } from "@vueuse/core";
|
|
3
|
-
import { isIOS } from "utils";
|
|
3
|
+
import { isIOS } from "@maas/vue-equipment/utils";
|
|
4
4
|
import { usePlayerStore } from "./usePlayerStore.mjs";
|
|
5
5
|
export function usePlayerInternalApi(args) {
|
|
6
6
|
const touched = ref(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { uuid } from "utils";
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
2
|
import { computed, onUnmounted, toValue } from "vue";
|
|
3
3
|
import { usePlayerStore } from "./private/usePlayerStore.mjs";
|
|
4
4
|
import { usePlayerInternalApi } from "./private/usePlayerInternalApi.mjs";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
readonly,
|
|
17
17
|
} from 'vue'
|
|
18
18
|
import { useIntersectionObserver } from '@vueuse/core'
|
|
19
|
-
import { mapValue } from 'utils'
|
|
19
|
+
import { mapValue } from '@maas/vue-equipment/utils'
|
|
20
20
|
import { useScrollApi } from '../composables/useScrollApi'
|
|
21
21
|
import {
|
|
22
22
|
ScrollPositionKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref, inject, toValue } from "vue";
|
|
2
2
|
import { useWindowSize } from "@vueuse/core";
|
|
3
3
|
import { ScrollPositionKey } from "../symbols/index.mjs";
|
|
4
|
-
import { clampValue } from "utils";
|
|
4
|
+
import { clampValue } from "@maas/vue-equipment/utils";
|
|
5
5
|
export function useScrollApi(params) {
|
|
6
6
|
const { child, parent, from, to } = params;
|
|
7
7
|
const scrollPosition = inject(ScrollPositionKey, void 0);
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
|
-
import { uuid } from 'utils'
|
|
46
|
+
import { uuid } from '@maas/vue-equipment/utils'
|
|
47
47
|
import { defu } from 'defu'
|
|
48
48
|
import { toValue, ref, watch, type MaybeRef } from 'vue'
|
|
49
49
|
import { onClickOutside, type MaybeElement } from '@vueuse/core'
|
|
@@ -55,11 +55,11 @@ import MagicToastComponent from './MagicToastComponent.vue'
|
|
|
55
55
|
|
|
56
56
|
import type { ToastOptions } from './../types/index'
|
|
57
57
|
|
|
58
|
-
import 'utils/css/animations/fade-out.css'
|
|
59
|
-
import 'utils/css/animations/slide-ltr-in.css'
|
|
60
|
-
import 'utils/css/animations/slide-rtl-in.css'
|
|
61
|
-
import 'utils/css/animations/slide-ttb-in.css'
|
|
62
|
-
import 'utils/css/animations/slide-btt-in.css'
|
|
58
|
+
import '@maas/vue-equipment/utils/css/animations/fade-out.css'
|
|
59
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ltr-in.css'
|
|
60
|
+
import '@maas/vue-equipment/utils/css/animations/slide-rtl-in.css'
|
|
61
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ttb-in.css'
|
|
62
|
+
import '@maas/vue-equipment/utils/css/animations/slide-btt-in.css'
|
|
63
63
|
|
|
64
64
|
interface MagicToastProps {
|
|
65
65
|
id: MaybeRef<string>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
import type { ToastOptions } from './../types/index';
|
|
3
|
-
import 'utils/css/animations/fade-out.css';
|
|
4
|
-
import 'utils/css/animations/slide-ltr-in.css';
|
|
5
|
-
import 'utils/css/animations/slide-rtl-in.css';
|
|
6
|
-
import 'utils/css/animations/slide-ttb-in.css';
|
|
7
|
-
import 'utils/css/animations/slide-btt-in.css';
|
|
3
|
+
import '@maas/vue-equipment/utils/css/animations/fade-out.css';
|
|
4
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ltr-in.css';
|
|
5
|
+
import '@maas/vue-equipment/utils/css/animations/slide-rtl-in.css';
|
|
6
|
+
import '@maas/vue-equipment/utils/css/animations/slide-ttb-in.css';
|
|
7
|
+
import '@maas/vue-equipment/utils/css/animations/slide-btt-in.css';
|
|
8
8
|
interface MagicToastProps {
|
|
9
9
|
id: MaybeRef<string>;
|
|
10
10
|
class: MaybeRef<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToastInstance } from '../../types.js';
|
|
1
|
+
import type { ToastInstance, AddArgs } from '../../types.js';
|
|
2
2
|
export declare function useToastStore(): {
|
|
3
3
|
toastStore: import("vue").Ref<{
|
|
4
4
|
id: string;
|
|
@@ -8,7 +8,7 @@ export declare function useToastStore(): {
|
|
|
8
8
|
props?: Record<string, any> | undefined;
|
|
9
9
|
remove: Function;
|
|
10
10
|
}[];
|
|
11
|
-
add: (args:
|
|
11
|
+
add: (args: AddArgs) => string;
|
|
12
12
|
remove: (id: string) => void;
|
|
13
13
|
}[]>;
|
|
14
14
|
findInstance: (id: string) => ToastInstance | undefined;
|