@maas/vue-equipment 0.27.2 → 0.28.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/composables/index.d.mts +1 -9
- package/dist/composables/index.d.ts +1 -9
- package/dist/composables/index.js +2 -55
- package/dist/composables/index.js.map +1 -1
- package/dist/composables/index.mjs +1 -53
- package/dist/composables/index.mjs.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +16 -16
- package/dist/plugins/MagicCommand/index.d.ts +3 -4
- package/dist/plugins/MagicCommand/index.mjs +8 -7
- package/dist/plugins/MagicCommand/nuxt.mjs +1 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue +3 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +10 -8
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +10 -8
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +6 -6
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +2 -2
- package/dist/plugins/MagicCommand/src/composables/{useCommandApi.d.ts → useMagicCommand.d.ts} +1 -1
- package/dist/plugins/MagicCommand/src/composables/{useCommandApi.mjs → useMagicCommand.mjs} +5 -7
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +3 -3
- package/dist/plugins/MagicCommand/src/symbols/index.mjs +3 -3
- package/dist/plugins/MagicCookie/index.d.ts +2 -3
- package/dist/plugins/MagicCookie/index.mjs +2 -3
- package/dist/plugins/MagicCookie/nuxt.mjs +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue +2 -2
- package/dist/plugins/MagicCookie/src/composables/{useCookieApi.d.ts → useMagicCookie.d.ts} +2 -1
- package/dist/plugins/MagicCookie/src/composables/{useCookieApi.mjs → useMagicCookie.mjs} +3 -3
- package/dist/plugins/MagicDraggable/index.d.ts +1 -2
- package/dist/plugins/MagicDraggable/index.mjs +1 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +12 -10
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +1 -0
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +33 -3
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.d.ts +6 -0
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +42 -0
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -0
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.d.ts +4 -1
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +2 -1
- package/dist/plugins/MagicDrawer/index.d.ts +2 -3
- package/dist/plugins/MagicDrawer/index.mjs +2 -3
- package/dist/plugins/MagicDrawer/nuxt.mjs +1 -5
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +13 -23
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.mjs +10 -9
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.d.ts +13 -0
- package/dist/plugins/MagicDrawer/src/composables/{useDrawerApi.mjs → private/useDrawerDOM.mjs} +4 -46
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +14 -10
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +22 -20
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +5 -4
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +4 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +5 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerUtils.d.ts +0 -7
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerUtils.mjs +1 -6
- package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.d.ts +13 -0
- package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +31 -0
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +5 -1
- package/dist/plugins/MagicEmitter/index.d.ts +4 -0
- package/dist/plugins/MagicEmitter/index.mjs +2 -0
- package/dist/plugins/MagicEmitter/nuxt.d.ts +2 -0
- package/dist/plugins/MagicEmitter/nuxt.mjs +12 -0
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +446 -0
- package/dist/plugins/{MagicModal/src/composables/useModalEmitter.mjs → MagicEmitter/src/composables/useMagicEmitter.mjs} +1 -1
- package/dist/plugins/MagicEmitter/src/types/index.d.ts +19 -0
- package/dist/plugins/MagicEmitter/src/types/index.mjs +0 -0
- package/dist/plugins/MagicMarquee/nuxt.mjs +1 -3
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +1 -1
- package/dist/plugins/MagicModal/index.d.ts +2 -3
- package/dist/plugins/MagicModal/index.mjs +2 -3
- package/dist/plugins/MagicModal/nuxt.mjs +1 -5
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +8 -9
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.mjs +10 -9
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.d.ts +13 -0
- package/dist/plugins/MagicModal/src/composables/{useModalApi.mjs → private/useModalDOM.mjs} +3 -17
- package/dist/plugins/MagicModal/src/composables/useMagicModal.d.ts +6 -0
- package/dist/plugins/MagicModal/src/composables/useMagicModal.mjs +17 -0
- package/dist/plugins/MagicNoise/index.d.ts +1 -1
- package/dist/plugins/MagicNoise/index.mjs +1 -1
- package/dist/plugins/MagicNoise/nuxt.mjs +1 -6
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +2 -2
- package/dist/plugins/MagicNoise/src/composables/{useNoiseApi.d.ts → private/useNoiseApi.d.ts} +1 -1
- package/dist/plugins/MagicNoise/src/composables/{useNoiseApi.mjs → private/useNoiseApi.mjs} +1 -1
- package/dist/plugins/MagicPlayer/index.d.ts +2 -2
- package/dist/plugins/MagicPlayer/index.mjs +2 -2
- package/dist/plugins/MagicPlayer/nuxt.mjs +1 -1
- package/dist/plugins/MagicPlayer/src/composables/{usePlayerApi.d.ts → useMagicPlayer.d.ts} +2 -2
- package/dist/plugins/MagicPlayer/src/composables/{usePlayerApi.mjs → useMagicPlayer.mjs} +1 -1
- package/dist/plugins/MagicScroll/index.d.ts +2 -4
- package/dist/plugins/MagicScroll/index.mjs +6 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +3 -3
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +5 -5
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +8 -8
- package/dist/plugins/MagicScroll/src/composables/{useScrollApi.d.ts → private/useScrollApi.d.ts} +1 -1
- package/dist/plugins/MagicScroll/src/composables/{useScrollApi.mjs → private/useScrollApi.mjs} +4 -4
- package/dist/plugins/MagicScroll/src/composables/useCollisionDetect.mjs +2 -2
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicScroll/src/symbols/index.mjs +4 -4
- package/dist/plugins/MagicScroll/src/types/index.d.ts +2 -2
- package/dist/plugins/MagicToast/index.d.ts +2 -3
- package/dist/plugins/MagicToast/index.mjs +2 -3
- package/dist/plugins/MagicToast/nuxt.mjs +0 -4
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +5 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +5 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.mjs +23 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +3 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +11 -9
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +12 -0
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +36 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/index.d.mts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +7 -0
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/types/ValueOf.ts +1 -0
- package/dist/utils/types/index.ts +1 -0
- package/package.json +1 -1
- package/dist/plugins/MagicCommand/src/composables/useCommandEmitter.d.ts +0 -15
- package/dist/plugins/MagicCommand/src/composables/useCommandEmitter.mjs +0 -9
- package/dist/plugins/MagicCookie/src/composables/useCookieEmitter.d.ts +0 -15
- package/dist/plugins/MagicCookie/src/composables/useCookieEmitter.mjs +0 -9
- package/dist/plugins/MagicDraggable/src/composables/useDraggableApi.d.ts +0 -1
- package/dist/plugins/MagicDraggable/src/composables/useDraggableApi.mjs +0 -2
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.d.ts +0 -26
- package/dist/plugins/MagicDrawer/src/composables/useDrawerEmitter.d.ts +0 -15
- package/dist/plugins/MagicDrawer/src/composables/useDrawerEmitter.mjs +0 -9
- package/dist/plugins/MagicModal/src/composables/useModalApi.d.ts +0 -19
- package/dist/plugins/MagicModal/src/composables/useModalEmitter.d.ts +0 -15
- package/dist/plugins/MagicScroll/src/composables/useCollisionEmitter.d.ts +0 -15
- package/dist/plugins/MagicScroll/src/composables/useCollisionEmitter.mjs +0 -9
- package/dist/plugins/MagicToast/src/composables/useToastApi.d.ts +0 -13
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +0 -50
- package/dist/plugins/MagicToast/src/composables/useToastEmitter.d.ts +0 -15
- package/dist/plugins/MagicToast/src/composables/useToastEmitter.mjs +0 -9
- /package/dist/plugins/MagicMarquee/src/composables/{useMarqueeApi.d.ts → private/useMarqueeApi.d.ts} +0 -0
- /package/dist/plugins/MagicMarquee/src/composables/{useMarqueeApi.mjs → private/useMarqueeApi.mjs} +0 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
export declare function useMagicEmitter(): {
|
|
2
|
+
on: {
|
|
3
|
+
<Key extends "progress" | "snapTo" | "accept" | "acceptSelected" | "reject" | "collision" | "beforeEnter" | "enter" | "afterEnter" | "beforeLeave" | "leave" | "afterLeave" | "beforeSnap" | "afterSnap" | "beforeDrag" | "drag" | "afterDrag">(type: Key, handler: import("mitt").Handler<({
|
|
4
|
+
collision: {
|
|
5
|
+
dir: "up" | "down";
|
|
6
|
+
pos: "top" | "bottom";
|
|
7
|
+
el: HTMLElement;
|
|
8
|
+
data?: Record<string, unknown> | undefined;
|
|
9
|
+
};
|
|
10
|
+
} & {
|
|
11
|
+
beforeEnter: string;
|
|
12
|
+
enter: string;
|
|
13
|
+
afterEnter: string;
|
|
14
|
+
beforeLeave: string;
|
|
15
|
+
leave: string;
|
|
16
|
+
afterLeave: string;
|
|
17
|
+
} & {
|
|
18
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
19
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
20
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
21
|
+
} & {
|
|
22
|
+
beforeEnter: string;
|
|
23
|
+
enter: string;
|
|
24
|
+
afterEnter: string;
|
|
25
|
+
beforeLeave: string;
|
|
26
|
+
leave: string;
|
|
27
|
+
afterLeave: string;
|
|
28
|
+
beforeSnap: {
|
|
29
|
+
id: string;
|
|
30
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
31
|
+
};
|
|
32
|
+
snapTo: {
|
|
33
|
+
id: string;
|
|
34
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
35
|
+
duration?: number | undefined;
|
|
36
|
+
};
|
|
37
|
+
afterSnap: {
|
|
38
|
+
id: string;
|
|
39
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
40
|
+
};
|
|
41
|
+
beforeDrag: {
|
|
42
|
+
id: string;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
};
|
|
46
|
+
drag: {
|
|
47
|
+
id: string;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
afterDrag: {
|
|
52
|
+
id: string;
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
};
|
|
56
|
+
progress: {
|
|
57
|
+
id: string;
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
};
|
|
61
|
+
} & {
|
|
62
|
+
beforeEnter: string;
|
|
63
|
+
enter: string;
|
|
64
|
+
afterEnter: string;
|
|
65
|
+
beforeLeave: string;
|
|
66
|
+
leave: string;
|
|
67
|
+
afterLeave: string;
|
|
68
|
+
} & {
|
|
69
|
+
beforeEnter: string;
|
|
70
|
+
enter: string;
|
|
71
|
+
afterEnter: string;
|
|
72
|
+
beforeLeave: string;
|
|
73
|
+
leave: string;
|
|
74
|
+
afterLeave: string;
|
|
75
|
+
})[Key]>): void;
|
|
76
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
77
|
+
collision: {
|
|
78
|
+
dir: "up" | "down";
|
|
79
|
+
pos: "top" | "bottom";
|
|
80
|
+
el: HTMLElement;
|
|
81
|
+
data?: Record<string, unknown> | undefined;
|
|
82
|
+
};
|
|
83
|
+
} & {
|
|
84
|
+
beforeEnter: string;
|
|
85
|
+
enter: string;
|
|
86
|
+
afterEnter: string;
|
|
87
|
+
beforeLeave: string;
|
|
88
|
+
leave: string;
|
|
89
|
+
afterLeave: string;
|
|
90
|
+
} & {
|
|
91
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
92
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
93
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
94
|
+
} & {
|
|
95
|
+
beforeEnter: string;
|
|
96
|
+
enter: string;
|
|
97
|
+
afterEnter: string;
|
|
98
|
+
beforeLeave: string;
|
|
99
|
+
leave: string;
|
|
100
|
+
afterLeave: string;
|
|
101
|
+
beforeSnap: {
|
|
102
|
+
id: string;
|
|
103
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
104
|
+
};
|
|
105
|
+
snapTo: {
|
|
106
|
+
id: string;
|
|
107
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
108
|
+
duration?: number | undefined;
|
|
109
|
+
};
|
|
110
|
+
afterSnap: {
|
|
111
|
+
id: string;
|
|
112
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
113
|
+
};
|
|
114
|
+
beforeDrag: {
|
|
115
|
+
id: string;
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
};
|
|
119
|
+
drag: {
|
|
120
|
+
id: string;
|
|
121
|
+
x: number;
|
|
122
|
+
y: number;
|
|
123
|
+
};
|
|
124
|
+
afterDrag: {
|
|
125
|
+
id: string;
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
};
|
|
129
|
+
progress: {
|
|
130
|
+
id: string;
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
};
|
|
134
|
+
} & {
|
|
135
|
+
beforeEnter: string;
|
|
136
|
+
enter: string;
|
|
137
|
+
afterEnter: string;
|
|
138
|
+
beforeLeave: string;
|
|
139
|
+
leave: string;
|
|
140
|
+
afterLeave: string;
|
|
141
|
+
} & {
|
|
142
|
+
beforeEnter: string;
|
|
143
|
+
enter: string;
|
|
144
|
+
afterEnter: string;
|
|
145
|
+
beforeLeave: string;
|
|
146
|
+
leave: string;
|
|
147
|
+
afterLeave: string;
|
|
148
|
+
}>): void;
|
|
149
|
+
};
|
|
150
|
+
off: {
|
|
151
|
+
<Key_1 extends "progress" | "snapTo" | "accept" | "acceptSelected" | "reject" | "collision" | "beforeEnter" | "enter" | "afterEnter" | "beforeLeave" | "leave" | "afterLeave" | "beforeSnap" | "afterSnap" | "beforeDrag" | "drag" | "afterDrag">(type: Key_1, handler?: import("mitt").Handler<({
|
|
152
|
+
collision: {
|
|
153
|
+
dir: "up" | "down";
|
|
154
|
+
pos: "top" | "bottom";
|
|
155
|
+
el: HTMLElement;
|
|
156
|
+
data?: Record<string, unknown> | undefined;
|
|
157
|
+
};
|
|
158
|
+
} & {
|
|
159
|
+
beforeEnter: string;
|
|
160
|
+
enter: string;
|
|
161
|
+
afterEnter: string;
|
|
162
|
+
beforeLeave: string;
|
|
163
|
+
leave: string;
|
|
164
|
+
afterLeave: string;
|
|
165
|
+
} & {
|
|
166
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
167
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
168
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
169
|
+
} & {
|
|
170
|
+
beforeEnter: string;
|
|
171
|
+
enter: string;
|
|
172
|
+
afterEnter: string;
|
|
173
|
+
beforeLeave: string;
|
|
174
|
+
leave: string;
|
|
175
|
+
afterLeave: string;
|
|
176
|
+
beforeSnap: {
|
|
177
|
+
id: string;
|
|
178
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
179
|
+
};
|
|
180
|
+
snapTo: {
|
|
181
|
+
id: string;
|
|
182
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
183
|
+
duration?: number | undefined;
|
|
184
|
+
};
|
|
185
|
+
afterSnap: {
|
|
186
|
+
id: string;
|
|
187
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
188
|
+
};
|
|
189
|
+
beforeDrag: {
|
|
190
|
+
id: string;
|
|
191
|
+
x: number;
|
|
192
|
+
y: number;
|
|
193
|
+
};
|
|
194
|
+
drag: {
|
|
195
|
+
id: string;
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
};
|
|
199
|
+
afterDrag: {
|
|
200
|
+
id: string;
|
|
201
|
+
x: number;
|
|
202
|
+
y: number;
|
|
203
|
+
};
|
|
204
|
+
progress: {
|
|
205
|
+
id: string;
|
|
206
|
+
x: number;
|
|
207
|
+
y: number;
|
|
208
|
+
};
|
|
209
|
+
} & {
|
|
210
|
+
beforeEnter: string;
|
|
211
|
+
enter: string;
|
|
212
|
+
afterEnter: string;
|
|
213
|
+
beforeLeave: string;
|
|
214
|
+
leave: string;
|
|
215
|
+
afterLeave: string;
|
|
216
|
+
} & {
|
|
217
|
+
beforeEnter: string;
|
|
218
|
+
enter: string;
|
|
219
|
+
afterEnter: string;
|
|
220
|
+
beforeLeave: string;
|
|
221
|
+
leave: string;
|
|
222
|
+
afterLeave: string;
|
|
223
|
+
})[Key_1]> | undefined): void;
|
|
224
|
+
(type: "*", handler: import("mitt").WildcardHandler<{
|
|
225
|
+
collision: {
|
|
226
|
+
dir: "up" | "down";
|
|
227
|
+
pos: "top" | "bottom";
|
|
228
|
+
el: HTMLElement;
|
|
229
|
+
data?: Record<string, unknown> | undefined;
|
|
230
|
+
};
|
|
231
|
+
} & {
|
|
232
|
+
beforeEnter: string;
|
|
233
|
+
enter: string;
|
|
234
|
+
afterEnter: string;
|
|
235
|
+
beforeLeave: string;
|
|
236
|
+
leave: string;
|
|
237
|
+
afterLeave: string;
|
|
238
|
+
} & {
|
|
239
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
240
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
241
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
242
|
+
} & {
|
|
243
|
+
beforeEnter: string;
|
|
244
|
+
enter: string;
|
|
245
|
+
afterEnter: string;
|
|
246
|
+
beforeLeave: string;
|
|
247
|
+
leave: string;
|
|
248
|
+
afterLeave: string;
|
|
249
|
+
beforeSnap: {
|
|
250
|
+
id: string;
|
|
251
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
252
|
+
};
|
|
253
|
+
snapTo: {
|
|
254
|
+
id: string;
|
|
255
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
256
|
+
duration?: number | undefined;
|
|
257
|
+
};
|
|
258
|
+
afterSnap: {
|
|
259
|
+
id: string;
|
|
260
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
261
|
+
};
|
|
262
|
+
beforeDrag: {
|
|
263
|
+
id: string;
|
|
264
|
+
x: number;
|
|
265
|
+
y: number;
|
|
266
|
+
};
|
|
267
|
+
drag: {
|
|
268
|
+
id: string;
|
|
269
|
+
x: number;
|
|
270
|
+
y: number;
|
|
271
|
+
};
|
|
272
|
+
afterDrag: {
|
|
273
|
+
id: string;
|
|
274
|
+
x: number;
|
|
275
|
+
y: number;
|
|
276
|
+
};
|
|
277
|
+
progress: {
|
|
278
|
+
id: string;
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
};
|
|
282
|
+
} & {
|
|
283
|
+
beforeEnter: string;
|
|
284
|
+
enter: string;
|
|
285
|
+
afterEnter: string;
|
|
286
|
+
beforeLeave: string;
|
|
287
|
+
leave: string;
|
|
288
|
+
afterLeave: string;
|
|
289
|
+
} & {
|
|
290
|
+
beforeEnter: string;
|
|
291
|
+
enter: string;
|
|
292
|
+
afterEnter: string;
|
|
293
|
+
beforeLeave: string;
|
|
294
|
+
leave: string;
|
|
295
|
+
afterLeave: string;
|
|
296
|
+
}>): void;
|
|
297
|
+
};
|
|
298
|
+
emit: {
|
|
299
|
+
<Key_2 extends "progress" | "snapTo" | "accept" | "acceptSelected" | "reject" | "collision" | "beforeEnter" | "enter" | "afterEnter" | "beforeLeave" | "leave" | "afterLeave" | "beforeSnap" | "afterSnap" | "beforeDrag" | "drag" | "afterDrag">(type: Key_2, event: ({
|
|
300
|
+
collision: {
|
|
301
|
+
dir: "up" | "down";
|
|
302
|
+
pos: "top" | "bottom";
|
|
303
|
+
el: HTMLElement;
|
|
304
|
+
data?: Record<string, unknown> | undefined;
|
|
305
|
+
};
|
|
306
|
+
} & {
|
|
307
|
+
beforeEnter: string;
|
|
308
|
+
enter: string;
|
|
309
|
+
afterEnter: string;
|
|
310
|
+
beforeLeave: string;
|
|
311
|
+
leave: string;
|
|
312
|
+
afterLeave: string;
|
|
313
|
+
} & {
|
|
314
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
315
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
316
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
317
|
+
} & {
|
|
318
|
+
beforeEnter: string;
|
|
319
|
+
enter: string;
|
|
320
|
+
afterEnter: string;
|
|
321
|
+
beforeLeave: string;
|
|
322
|
+
leave: string;
|
|
323
|
+
afterLeave: string;
|
|
324
|
+
beforeSnap: {
|
|
325
|
+
id: string;
|
|
326
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
327
|
+
};
|
|
328
|
+
snapTo: {
|
|
329
|
+
id: string;
|
|
330
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
331
|
+
duration?: number | undefined;
|
|
332
|
+
};
|
|
333
|
+
afterSnap: {
|
|
334
|
+
id: string;
|
|
335
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
336
|
+
};
|
|
337
|
+
beforeDrag: {
|
|
338
|
+
id: string;
|
|
339
|
+
x: number;
|
|
340
|
+
y: number;
|
|
341
|
+
};
|
|
342
|
+
drag: {
|
|
343
|
+
id: string;
|
|
344
|
+
x: number;
|
|
345
|
+
y: number;
|
|
346
|
+
};
|
|
347
|
+
afterDrag: {
|
|
348
|
+
id: string;
|
|
349
|
+
x: number;
|
|
350
|
+
y: number;
|
|
351
|
+
};
|
|
352
|
+
progress: {
|
|
353
|
+
id: string;
|
|
354
|
+
x: number;
|
|
355
|
+
y: number;
|
|
356
|
+
};
|
|
357
|
+
} & {
|
|
358
|
+
beforeEnter: string;
|
|
359
|
+
enter: string;
|
|
360
|
+
afterEnter: string;
|
|
361
|
+
beforeLeave: string;
|
|
362
|
+
leave: string;
|
|
363
|
+
afterLeave: string;
|
|
364
|
+
} & {
|
|
365
|
+
beforeEnter: string;
|
|
366
|
+
enter: string;
|
|
367
|
+
afterEnter: string;
|
|
368
|
+
beforeLeave: string;
|
|
369
|
+
leave: string;
|
|
370
|
+
afterLeave: string;
|
|
371
|
+
})[Key_2]): void;
|
|
372
|
+
<Key_3 extends "progress" | "snapTo" | "accept" | "acceptSelected" | "reject" | "collision" | "beforeEnter" | "enter" | "afterEnter" | "beforeLeave" | "leave" | "afterLeave" | "beforeSnap" | "afterSnap" | "beforeDrag" | "drag" | "afterDrag">(type: undefined extends ({
|
|
373
|
+
collision: {
|
|
374
|
+
dir: "up" | "down";
|
|
375
|
+
pos: "top" | "bottom";
|
|
376
|
+
el: HTMLElement;
|
|
377
|
+
data?: Record<string, unknown> | undefined;
|
|
378
|
+
};
|
|
379
|
+
} & {
|
|
380
|
+
beforeEnter: string;
|
|
381
|
+
enter: string;
|
|
382
|
+
afterEnter: string;
|
|
383
|
+
beforeLeave: string;
|
|
384
|
+
leave: string;
|
|
385
|
+
afterLeave: string;
|
|
386
|
+
} & {
|
|
387
|
+
accept: import("../../../MagicCookie/src/types").CookieConsent;
|
|
388
|
+
reject: import("../../../MagicCookie/src/types").CookieConsent;
|
|
389
|
+
acceptSelected: import("../../../MagicCookie/src/types").CookieConsent;
|
|
390
|
+
} & {
|
|
391
|
+
beforeEnter: string;
|
|
392
|
+
enter: string;
|
|
393
|
+
afterEnter: string;
|
|
394
|
+
beforeLeave: string;
|
|
395
|
+
leave: string;
|
|
396
|
+
afterLeave: string;
|
|
397
|
+
beforeSnap: {
|
|
398
|
+
id: string;
|
|
399
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
400
|
+
};
|
|
401
|
+
snapTo: {
|
|
402
|
+
id: string;
|
|
403
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
404
|
+
duration?: number | undefined;
|
|
405
|
+
};
|
|
406
|
+
afterSnap: {
|
|
407
|
+
id: string;
|
|
408
|
+
snapPoint: import("../../../MagicDrawer/src/types").SnapPoint;
|
|
409
|
+
};
|
|
410
|
+
beforeDrag: {
|
|
411
|
+
id: string;
|
|
412
|
+
x: number;
|
|
413
|
+
y: number;
|
|
414
|
+
};
|
|
415
|
+
drag: {
|
|
416
|
+
id: string;
|
|
417
|
+
x: number;
|
|
418
|
+
y: number;
|
|
419
|
+
};
|
|
420
|
+
afterDrag: {
|
|
421
|
+
id: string;
|
|
422
|
+
x: number;
|
|
423
|
+
y: number;
|
|
424
|
+
};
|
|
425
|
+
progress: {
|
|
426
|
+
id: string;
|
|
427
|
+
x: number;
|
|
428
|
+
y: number;
|
|
429
|
+
};
|
|
430
|
+
} & {
|
|
431
|
+
beforeEnter: string;
|
|
432
|
+
enter: string;
|
|
433
|
+
afterEnter: string;
|
|
434
|
+
beforeLeave: string;
|
|
435
|
+
leave: string;
|
|
436
|
+
afterLeave: string;
|
|
437
|
+
} & {
|
|
438
|
+
beforeEnter: string;
|
|
439
|
+
enter: string;
|
|
440
|
+
afterEnter: string;
|
|
441
|
+
beforeLeave: string;
|
|
442
|
+
leave: string;
|
|
443
|
+
afterLeave: string;
|
|
444
|
+
})[Key_3] ? Key_3 : never): void;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CollisionEvents } from '../../../MagicScroll.js';
|
|
2
|
+
import type { CommandEvents } from '../../../MagicCommand.js';
|
|
3
|
+
import type { CookieEvents } from '../../../MagicCookie.js';
|
|
4
|
+
import type { DrawerEvents } from '../../../MagicDrawer.js';
|
|
5
|
+
import type { ModalEvents } from '../../../MagicModal.js';
|
|
6
|
+
import type { ToastEvents } from '../../../MagicToast.js';
|
|
7
|
+
type Merge<T extends any[]> = T extends [infer First, ...infer Rest] ? MergeTypes<First, Merge<Rest>> : {};
|
|
8
|
+
type MergeTypes<T, U> = {
|
|
9
|
+
[K in keyof T]: K extends keyof U ? U[K] : T[K];
|
|
10
|
+
} & U;
|
|
11
|
+
export type MagicEmitterEvents = Merge<[
|
|
12
|
+
CollisionEvents,
|
|
13
|
+
CommandEvents,
|
|
14
|
+
CookieEvents,
|
|
15
|
+
DrawerEvents,
|
|
16
|
+
ModalEvents,
|
|
17
|
+
ToastEvents
|
|
18
|
+
]>;
|
|
19
|
+
export {};
|
|
File without changes
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineNuxtModule,
|
|
3
3
|
createResolver,
|
|
4
|
-
addComponentsDir
|
|
5
|
-
addImportsDir
|
|
4
|
+
addComponentsDir
|
|
6
5
|
} from "@nuxt/kit";
|
|
7
6
|
export default defineNuxtModule({
|
|
8
7
|
meta: {
|
|
@@ -15,6 +14,5 @@ export default defineNuxtModule({
|
|
|
15
14
|
global: true,
|
|
16
15
|
pathPrefix: false
|
|
17
16
|
});
|
|
18
|
-
addImportsDir(resolver.resolve("src/composables"));
|
|
19
17
|
}
|
|
20
18
|
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { ref, computed, onMounted } from 'vue'
|
|
20
|
-
import { useMarqueeApi } from '../composables/useMarqueeApi'
|
|
20
|
+
import { useMarqueeApi } from '../composables/private/useMarqueeApi'
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
23
|
direction?: 'reverse' | 'normal'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import MagicModal from './src/components/MagicModal.vue.js';
|
|
2
|
-
import {
|
|
3
|
-
import { useModalEmitter } from './src/composables/useModalEmitter.js';
|
|
2
|
+
import { useMagicModal } from './src/composables/useMagicModal.js';
|
|
4
3
|
import type { Plugin } from 'vue';
|
|
5
4
|
import type { ModalEvents, ModalOptions } from './src/types/index.js';
|
|
6
5
|
declare const MagicModalPlugin: Plugin;
|
|
7
|
-
export { MagicModalPlugin, MagicModal,
|
|
6
|
+
export { MagicModalPlugin, MagicModal, useMagicModal };
|
|
8
7
|
export type { ModalEvents, ModalOptions };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import MagicModal from "./src/components/MagicModal.vue";
|
|
2
|
-
import {
|
|
3
|
-
import { useModalEmitter } from "./src/composables/useModalEmitter.mjs";
|
|
2
|
+
import { useMagicModal } from "./src/composables/useMagicModal.mjs";
|
|
4
3
|
const MagicModalPlugin = {
|
|
5
4
|
install: (app) => {
|
|
6
5
|
app.component("MagicModal", MagicModal);
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
|
-
export { MagicModalPlugin, MagicModal,
|
|
8
|
+
export { MagicModalPlugin, MagicModal, useMagicModal };
|
|
@@ -17,11 +17,7 @@ export default defineNuxtModule({
|
|
|
17
17
|
});
|
|
18
18
|
addImports({
|
|
19
19
|
from: "@maas/vue-equipment/plugins/MagicModal",
|
|
20
|
-
name: "
|
|
21
|
-
});
|
|
22
|
-
addImports({
|
|
23
|
-
from: "@maas/vue-equipment/plugins/MagicModal",
|
|
24
|
-
name: "useModalEmitter"
|
|
20
|
+
name: "useMagicModal"
|
|
25
21
|
});
|
|
26
22
|
}
|
|
27
23
|
});
|
|
@@ -67,8 +67,9 @@ import {
|
|
|
67
67
|
import { createDefu } from 'defu'
|
|
68
68
|
import { onKeyStroke } from '@vueuse/core'
|
|
69
69
|
import { defaultOptions } from './../utils/defaultOptions'
|
|
70
|
-
import {
|
|
70
|
+
import { useModalDOM } from '../composables/private/useModalDOM'
|
|
71
71
|
import { useModalCallback } from '../composables/private/useModalCallback'
|
|
72
|
+
import { useMagicModal } from '../composables/useMagicModal'
|
|
72
73
|
|
|
73
74
|
import type { ModalOptions } from './../types/index'
|
|
74
75
|
|
|
@@ -97,21 +98,19 @@ const props = withDefaults(defineProps<MagicModalProps>(), {
|
|
|
97
98
|
|
|
98
99
|
const mappedOptions = customDefu(props.options, defaultOptions)
|
|
99
100
|
const modalRef = ref<HTMLElement | undefined>(undefined)
|
|
100
|
-
const modalApi = useModalApi(props.id, {
|
|
101
|
-
focusTarget: modalRef,
|
|
102
|
-
focusTrap: mappedOptions.focusTrap,
|
|
103
|
-
})
|
|
104
|
-
|
|
105
101
|
const {
|
|
106
|
-
isActive,
|
|
107
|
-
close,
|
|
108
102
|
trapFocus,
|
|
109
103
|
releaseFocus,
|
|
110
104
|
lockScroll,
|
|
111
105
|
unlockScroll,
|
|
112
106
|
addScrollLockPadding,
|
|
113
107
|
removeScrollLockPadding,
|
|
114
|
-
} =
|
|
108
|
+
} = useModalDOM({
|
|
109
|
+
focusTarget: modalRef,
|
|
110
|
+
focusTrap: mappedOptions.focusTrap,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const { isActive, close } = useMagicModal(props.id)
|
|
115
114
|
|
|
116
115
|
// Split isActive into two values to animate modal smoothly
|
|
117
116
|
const innerActive = ref(false)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toValue, nextTick } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { useMagicEmitter } from "@maas/vue-equipment/plugins";
|
|
3
3
|
export function useModalCallback(args) {
|
|
4
4
|
const {
|
|
5
5
|
id,
|
|
@@ -12,36 +12,37 @@ export function useModalCallback(args) {
|
|
|
12
12
|
releaseFocus,
|
|
13
13
|
wrapperActive
|
|
14
14
|
} = args;
|
|
15
|
+
const emitter = useMagicEmitter();
|
|
15
16
|
function onBeforeEnter(_el) {
|
|
16
|
-
|
|
17
|
+
emitter.emit("beforeEnter", toValue(id));
|
|
17
18
|
if (mappedOptions.scrollLock) {
|
|
18
|
-
if (mappedOptions.
|
|
19
|
+
if (typeof mappedOptions.scrollLock === "object" && mappedOptions.scrollLock.padding) {
|
|
19
20
|
addScrollLockPadding();
|
|
20
21
|
}
|
|
21
22
|
lockScroll();
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
function onEnter(_el) {
|
|
25
|
-
|
|
26
|
+
emitter.emit("enter", toValue(id));
|
|
26
27
|
}
|
|
27
28
|
async function onAfterEnter(_el) {
|
|
28
|
-
|
|
29
|
+
emitter.emit("afterEnter", toValue(id));
|
|
29
30
|
if (mappedOptions.focusTrap) {
|
|
30
31
|
await nextTick();
|
|
31
32
|
trapFocus();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
function onBeforeLeave(_el) {
|
|
35
|
-
|
|
36
|
+
emitter.emit("beforeLeave", toValue(id));
|
|
36
37
|
}
|
|
37
38
|
function onLeave(_el) {
|
|
38
|
-
|
|
39
|
+
emitter.emit("leave", toValue(id));
|
|
39
40
|
}
|
|
40
41
|
function onAfterLeave(_el) {
|
|
41
|
-
|
|
42
|
+
emitter.emit("afterLeave", toValue(id));
|
|
42
43
|
if (mappedOptions.scrollLock) {
|
|
43
44
|
unlockScroll();
|
|
44
|
-
if (mappedOptions.
|
|
45
|
+
if (typeof mappedOptions.scrollLock === "object" && mappedOptions.scrollLock.padding) {
|
|
45
46
|
removeScrollLockPadding();
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type MaybeElementRef } from '@vueuse/core';
|
|
2
|
+
import type { ModalOptions } from '../../types/index.js';
|
|
3
|
+
export type useModalApiOptions = Pick<ModalOptions, 'scrollLock' | 'focusTrap'> & {
|
|
4
|
+
focusTarget: MaybeElementRef;
|
|
5
|
+
};
|
|
6
|
+
export declare function useModalDOM(options?: useModalApiOptions): {
|
|
7
|
+
trapFocus: () => void;
|
|
8
|
+
releaseFocus: () => void;
|
|
9
|
+
lockScroll: () => void;
|
|
10
|
+
unlockScroll: () => void;
|
|
11
|
+
addScrollLockPadding: () => void;
|
|
12
|
+
removeScrollLockPadding: () => void;
|
|
13
|
+
};
|