@maas/vue-equipment 1.0.0-beta.13 → 1.0.0-beta.14
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/MagicAccordionContent.vue +65 -82
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +24 -30
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +65 -61
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +41 -45
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +137 -150
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +45 -52
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +80 -82
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +40 -47
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +68 -74
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +22 -38
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +95 -85
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +41 -47
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +41 -39
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +2 -2
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +23 -34
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +40 -73
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +70 -87
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +7 -7
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +262 -304
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +12 -12
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +100 -100
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +41 -69
- package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +54 -59
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +188 -208
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +181 -194
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +91 -100
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +83 -85
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +79 -75
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +106 -105
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +54 -60
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +1 -1
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +136 -164
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +1 -1
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +53 -78
- package/dist/plugins/MagicPie/src/components/MagicPie.vue +147 -175
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +49 -65
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +87 -129
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +33 -41
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +99 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +47 -75
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +16 -31
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +43 -44
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +52 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +65 -72
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +154 -225
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +49 -59
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +63 -70
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +29 -33
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +59 -69
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +80 -95
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +52 -70
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +2 -2
- package/package.json +1 -1
- package/dist/plugins/MagicAccordion/demo/data/footer.json +0 -117
- package/dist/plugins/MagicCommand/demo/data/about.json +0 -3
- package/dist/plugins/MagicCommand/demo/data/search.json +0 -594
|
@@ -1,23 +1,69 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<teleport
|
|
3
|
+
v-if="wrapperActive"
|
|
4
|
+
:to="mappedOptions.teleport?.target"
|
|
5
|
+
:disabled="mappedOptions.teleport?.disabled"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
ref="drawer"
|
|
9
|
+
class="magic-drawer"
|
|
10
|
+
:data-id="toValue(id)"
|
|
11
|
+
:data-dragging="dragging"
|
|
12
|
+
:data-wheeling="wheeling"
|
|
13
|
+
:data-disabled="disabled"
|
|
14
|
+
:data-position="mappedOptions.position"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
aria-modal="true"
|
|
17
|
+
>
|
|
18
|
+
<transition
|
|
19
|
+
v-if="mappedOptions.backdrop || !!$slots.backdrop"
|
|
20
|
+
:name="backdropTransition"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
v-show="innerActive"
|
|
24
|
+
class="magic-drawer__backdrop"
|
|
25
|
+
@click.self="guardedClose"
|
|
26
|
+
>
|
|
27
|
+
<slot name="backdrop" />
|
|
28
|
+
</div>
|
|
29
|
+
</transition>
|
|
30
|
+
|
|
31
|
+
<div ref="wrapper" class="magic-drawer__wrapper">
|
|
32
|
+
<transition
|
|
33
|
+
:name="contentTransition"
|
|
34
|
+
@before-leave="onBeforeLeave"
|
|
35
|
+
@leave="onLeave"
|
|
36
|
+
@after-leave="onAfterLeave"
|
|
37
|
+
@before-enter="onBeforeEnter"
|
|
38
|
+
@enter="onEnter"
|
|
39
|
+
@after-enter="onAfterEnter"
|
|
40
|
+
>
|
|
41
|
+
<div v-show="innerActive" class="magic-drawer__content">
|
|
42
|
+
<component
|
|
43
|
+
:is="mappedOptions.tag"
|
|
44
|
+
ref="el"
|
|
45
|
+
class="magic-drawer__drag"
|
|
46
|
+
:style="style"
|
|
47
|
+
@pointerdown="guardedPointerdown"
|
|
48
|
+
@click="guardedClick"
|
|
49
|
+
>
|
|
50
|
+
<slot />
|
|
51
|
+
<div v-if="hasDragged" class="magic-drawer__overlay" />
|
|
52
|
+
</component>
|
|
53
|
+
</div>
|
|
54
|
+
</transition>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</teleport>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup>
|
|
14
61
|
import {
|
|
15
62
|
useTemplateRef,
|
|
16
63
|
shallowRef,
|
|
17
64
|
watch,
|
|
18
65
|
computed,
|
|
19
66
|
nextTick,
|
|
20
|
-
toValue,
|
|
21
67
|
onBeforeMount,
|
|
22
68
|
onBeforeUnmount,
|
|
23
69
|
onUnmounted,
|
|
@@ -44,300 +90,212 @@ import "@maas/vue-equipment/utils/css/animations/slide-ltr-out.css";
|
|
|
44
90
|
import "@maas/vue-equipment/utils/css/animations/slide-rtl-out.css";
|
|
45
91
|
import "@maas/vue-equipment/utils/css/animations/slide-ttb-out.css";
|
|
46
92
|
import "@maas/vue-equipment/utils/css/animations/slide-btt-out.css";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
93
|
+
defineOptions({
|
|
94
|
+
inheritAttrs: false
|
|
95
|
+
});
|
|
96
|
+
const customDefu = createDefu((obj, key, value) => {
|
|
97
|
+
if (key === "close" || key === "snapPoints") {
|
|
98
|
+
obj[key] = value;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const { options = {}, id } = defineProps({
|
|
103
|
+
id: {
|
|
104
|
+
type: null,
|
|
105
|
+
required: true
|
|
55
106
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
for (const key of mappedOptions.keyListener.close) {
|
|
212
|
-
onKeyStroke(key, (e) => {
|
|
213
|
-
close();
|
|
214
|
-
e.preventDefault();
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
watch(isActive, async (value) => {
|
|
219
|
-
if (value) {
|
|
220
|
-
await onOpen();
|
|
221
|
-
} else {
|
|
222
|
-
onClose();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
watch(innerActive, () => {
|
|
226
|
-
saveOvershoot();
|
|
227
|
-
});
|
|
228
|
-
onBeforeMount(async () => {
|
|
229
|
-
if (mappedOptions.initial.open) {
|
|
230
|
-
open();
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
onBeforeUnmount(() => {
|
|
107
|
+
options: {
|
|
108
|
+
type: Object,
|
|
109
|
+
required: false
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const mappedOptions = customDefu(options, defaultOptions);
|
|
113
|
+
const elRef = useTemplateRef("el");
|
|
114
|
+
const drawerRef = useTemplateRef("drawer");
|
|
115
|
+
const wrapperRef = useTemplateRef("wrapper");
|
|
116
|
+
const {
|
|
117
|
+
trapFocus,
|
|
118
|
+
releaseFocus,
|
|
119
|
+
lockScroll,
|
|
120
|
+
unlockScroll,
|
|
121
|
+
addScrollLockPadding,
|
|
122
|
+
removeScrollLockPadding
|
|
123
|
+
} = useDrawerDOM({
|
|
124
|
+
focusTarget: drawerRef,
|
|
125
|
+
focusTrap: mappedOptions.focusTrap
|
|
126
|
+
});
|
|
127
|
+
const { isActive, open, close } = useMagicDrawer(id);
|
|
128
|
+
const overshoot = shallowRef(0);
|
|
129
|
+
const {
|
|
130
|
+
position,
|
|
131
|
+
snapPoints,
|
|
132
|
+
threshold,
|
|
133
|
+
animation,
|
|
134
|
+
preventDragClose,
|
|
135
|
+
initial
|
|
136
|
+
} = mappedOptions;
|
|
137
|
+
const disabled = computed(() => {
|
|
138
|
+
if (options.disabled === void 0) {
|
|
139
|
+
return defaultOptions.disabled;
|
|
140
|
+
} else {
|
|
141
|
+
return options.disabled;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const { onPointerdown, onClick, style, hasDragged } = useDrawerDrag({
|
|
145
|
+
id,
|
|
146
|
+
elRef,
|
|
147
|
+
wrapperRef,
|
|
148
|
+
position,
|
|
149
|
+
snapPoints,
|
|
150
|
+
threshold,
|
|
151
|
+
overshoot,
|
|
152
|
+
animation,
|
|
153
|
+
initial,
|
|
154
|
+
preventDragClose,
|
|
155
|
+
disabled
|
|
156
|
+
});
|
|
157
|
+
const { initializeWheelListener, destroyWheelListener } = useDrawerWheel({
|
|
158
|
+
id,
|
|
159
|
+
elRef,
|
|
160
|
+
position,
|
|
161
|
+
disabled
|
|
162
|
+
});
|
|
163
|
+
const { initializeState, deleteState } = useDrawerState(id);
|
|
164
|
+
const state = initializeState();
|
|
165
|
+
const { dragging, wheeling } = toRefs(state);
|
|
166
|
+
const innerActive = shallowRef(false);
|
|
167
|
+
const wrapperActive = shallowRef(false);
|
|
168
|
+
const wasActive = shallowRef(false);
|
|
169
|
+
const {
|
|
170
|
+
onBeforeEnter,
|
|
171
|
+
onEnter,
|
|
172
|
+
onAfterEnter,
|
|
173
|
+
onBeforeLeave,
|
|
174
|
+
onLeave,
|
|
175
|
+
onAfterLeave
|
|
176
|
+
} = useDrawerCallback({
|
|
177
|
+
id,
|
|
178
|
+
mappedOptions,
|
|
179
|
+
addScrollLockPadding,
|
|
180
|
+
removeScrollLockPadding,
|
|
181
|
+
lockScroll,
|
|
182
|
+
unlockScroll,
|
|
183
|
+
trapFocus,
|
|
184
|
+
releaseFocus,
|
|
185
|
+
wrapperActive,
|
|
186
|
+
wasActive
|
|
187
|
+
});
|
|
188
|
+
useDrawerProgress({ id, elRef, drawerRef, position, overshoot });
|
|
189
|
+
const { resetMetaViewport } = useMetaViewport();
|
|
190
|
+
const preventTransition = computed(() => {
|
|
191
|
+
return mappedOptions.initial.open && !mappedOptions.initial.transition && !wasActive.value;
|
|
192
|
+
});
|
|
193
|
+
const backdropTransition = computed(() => {
|
|
194
|
+
return preventTransition.value ? void 0 : mappedOptions.transition?.backdrop;
|
|
195
|
+
});
|
|
196
|
+
const contentTransition = computed(() => {
|
|
197
|
+
return preventTransition.value ? void 0 : mappedOptions.transition?.content;
|
|
198
|
+
});
|
|
199
|
+
function convertToPixels(value) {
|
|
200
|
+
const regex = /^(\d*\.?\d+)\s*(rem|px)$/;
|
|
201
|
+
const match = value.match(regex);
|
|
202
|
+
if (!match) {
|
|
203
|
+
console.error(
|
|
204
|
+
`--magic-drawer-drag-overshoot (${value}) needs to be specified in px or rem`
|
|
205
|
+
);
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
const numericValue = parseFloat(match[1]);
|
|
209
|
+
const unit = match[2];
|
|
210
|
+
const bodyFontSize = window.getComputedStyle(document.body).fontSize;
|
|
211
|
+
const rootFontSize = parseFloat(bodyFontSize) || 16;
|
|
212
|
+
switch (unit) {
|
|
213
|
+
case "rem":
|
|
214
|
+
return numericValue * rootFontSize;
|
|
215
|
+
case "px":
|
|
216
|
+
return numericValue;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function onOpen() {
|
|
220
|
+
wrapperActive.value = true;
|
|
221
|
+
await nextTick();
|
|
222
|
+
innerActive.value = true;
|
|
223
|
+
await nextTick();
|
|
224
|
+
if (mappedOptions.enableMousewheel) {
|
|
225
|
+
initializeWheelListener();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function onClose() {
|
|
229
|
+
innerActive.value = false;
|
|
230
|
+
if (mappedOptions.enableMousewheel) {
|
|
231
|
+
destroyWheelListener();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function guardedPointerdown(event) {
|
|
235
|
+
if (!disabled.value) {
|
|
236
|
+
onPointerdown(event);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function guardedClick(event) {
|
|
240
|
+
if (!disabled.value) {
|
|
241
|
+
onClick(event);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function guardedClose() {
|
|
245
|
+
if (!disabled.value) {
|
|
246
|
+
close();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function saveOvershoot() {
|
|
250
|
+
const element = unrefElement(drawerRef);
|
|
251
|
+
if (!element) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const overshootVar = getComputedStyle(element, null).getPropertyValue(
|
|
255
|
+
"--magic-drawer-drag-overshoot"
|
|
256
|
+
);
|
|
257
|
+
overshoot.value = convertToPixels(overshootVar) || 0;
|
|
258
|
+
}
|
|
259
|
+
if (mappedOptions.keyListener.close) {
|
|
260
|
+
for (const key of mappedOptions.keyListener.close) {
|
|
261
|
+
onKeyStroke(key, (e) => {
|
|
234
262
|
close();
|
|
263
|
+
e.preventDefault();
|
|
235
264
|
});
|
|
236
|
-
onUnmounted(() => {
|
|
237
|
-
if (mappedOptions.scrollLock) {
|
|
238
|
-
unlockScroll();
|
|
239
|
-
if (typeof mappedOptions.scrollLock === "object" && mappedOptions.scrollLock.padding) {
|
|
240
|
-
removeScrollLockPadding();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (mappedOptions.focusTrap) {
|
|
244
|
-
releaseFocus();
|
|
245
|
-
}
|
|
246
|
-
if (!mappedOptions.preventZoom) {
|
|
247
|
-
resetMetaViewport();
|
|
248
|
-
}
|
|
249
|
-
deleteState();
|
|
250
|
-
});
|
|
251
|
-
return (_ctx, _cache) => {
|
|
252
|
-
return wrapperActive.value ? (_openBlock(), _createBlock(_Teleport, {
|
|
253
|
-
key: 0,
|
|
254
|
-
to: _unref(mappedOptions).teleport?.target,
|
|
255
|
-
disabled: _unref(mappedOptions).teleport?.disabled
|
|
256
|
-
}, [
|
|
257
|
-
_createElementVNode("div", _mergeProps({
|
|
258
|
-
ref: "drawer",
|
|
259
|
-
class: "magic-drawer",
|
|
260
|
-
"data-id": toValue(_ctx.id),
|
|
261
|
-
"data-dragging": _unref(dragging),
|
|
262
|
-
"data-wheeling": _unref(wheeling),
|
|
263
|
-
"data-disabled": disabled.value,
|
|
264
|
-
"data-position": _unref(mappedOptions).position
|
|
265
|
-
}, _ctx.$attrs, { "aria-modal": "true" }), [
|
|
266
|
-
_unref(mappedOptions).backdrop || !!_ctx.$slots.backdrop ? (_openBlock(), _createBlock(_Transition, {
|
|
267
|
-
key: 0,
|
|
268
|
-
name: backdropTransition.value,
|
|
269
|
-
persisted: ""
|
|
270
|
-
}, {
|
|
271
|
-
default: _withCtx(() => [
|
|
272
|
-
_withDirectives(_createElementVNode(
|
|
273
|
-
"div",
|
|
274
|
-
{
|
|
275
|
-
class: "magic-drawer__backdrop",
|
|
276
|
-
onClick: _withModifiers(guardedClose, ["self"])
|
|
277
|
-
},
|
|
278
|
-
[
|
|
279
|
-
_renderSlot(_ctx.$slots, "backdrop")
|
|
280
|
-
],
|
|
281
|
-
512
|
|
282
|
-
/* NEED_PATCH */
|
|
283
|
-
), [
|
|
284
|
-
[_vShow, innerActive.value]
|
|
285
|
-
])
|
|
286
|
-
]),
|
|
287
|
-
_: 3
|
|
288
|
-
/* FORWARDED */
|
|
289
|
-
}, 8, ["name"])) : _createCommentVNode("v-if", true),
|
|
290
|
-
_createElementVNode(
|
|
291
|
-
"div",
|
|
292
|
-
_hoisted_2,
|
|
293
|
-
[
|
|
294
|
-
_createVNode(_Transition, {
|
|
295
|
-
name: contentTransition.value,
|
|
296
|
-
onBeforeLeave: _unref(onBeforeLeave),
|
|
297
|
-
onLeave: _unref(onLeave),
|
|
298
|
-
onAfterLeave: _unref(onAfterLeave),
|
|
299
|
-
onBeforeEnter: _unref(onBeforeEnter),
|
|
300
|
-
onEnter: _unref(onEnter),
|
|
301
|
-
onAfterEnter: _unref(onAfterEnter),
|
|
302
|
-
persisted: ""
|
|
303
|
-
}, {
|
|
304
|
-
default: _withCtx(() => [
|
|
305
|
-
_withDirectives(_createElementVNode(
|
|
306
|
-
"div",
|
|
307
|
-
_hoisted_3,
|
|
308
|
-
[
|
|
309
|
-
(_openBlock(), _createBlock(_resolveDynamicComponent(_unref(mappedOptions).tag), {
|
|
310
|
-
ref: "el",
|
|
311
|
-
class: "magic-drawer__drag",
|
|
312
|
-
style: _normalizeStyle(_unref(style)),
|
|
313
|
-
onPointerdown: guardedPointerdown,
|
|
314
|
-
onClick: guardedClick
|
|
315
|
-
}, {
|
|
316
|
-
default: _withCtx(() => [
|
|
317
|
-
_renderSlot(_ctx.$slots, "default"),
|
|
318
|
-
_unref(hasDragged) ? (_openBlock(), _createElementBlock("div", _hoisted_4)) : _createCommentVNode("v-if", true)
|
|
319
|
-
]),
|
|
320
|
-
_: 3
|
|
321
|
-
/* FORWARDED */
|
|
322
|
-
}, 40, ["style"]))
|
|
323
|
-
],
|
|
324
|
-
512
|
|
325
|
-
/* NEED_PATCH */
|
|
326
|
-
), [
|
|
327
|
-
[_vShow, innerActive.value]
|
|
328
|
-
])
|
|
329
|
-
]),
|
|
330
|
-
_: 3
|
|
331
|
-
/* FORWARDED */
|
|
332
|
-
}, 8, ["name", "onBeforeLeave", "onLeave", "onAfterLeave", "onBeforeEnter", "onEnter", "onAfterEnter"])
|
|
333
|
-
],
|
|
334
|
-
512
|
|
335
|
-
/* NEED_PATCH */
|
|
336
|
-
)
|
|
337
|
-
], 16, _hoisted_1)
|
|
338
|
-
], 8, ["to", "disabled"])) : _createCommentVNode("v-if", true);
|
|
339
|
-
};
|
|
340
265
|
}
|
|
266
|
+
}
|
|
267
|
+
watch(isActive, async (value) => {
|
|
268
|
+
if (value) {
|
|
269
|
+
await onOpen();
|
|
270
|
+
} else {
|
|
271
|
+
onClose();
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
watch(innerActive, () => {
|
|
275
|
+
saveOvershoot();
|
|
276
|
+
});
|
|
277
|
+
onBeforeMount(async () => {
|
|
278
|
+
if (mappedOptions.initial.open) {
|
|
279
|
+
open();
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
onBeforeUnmount(() => {
|
|
283
|
+
close();
|
|
284
|
+
});
|
|
285
|
+
onUnmounted(() => {
|
|
286
|
+
if (mappedOptions.scrollLock) {
|
|
287
|
+
unlockScroll();
|
|
288
|
+
if (typeof mappedOptions.scrollLock === "object" && mappedOptions.scrollLock.padding) {
|
|
289
|
+
removeScrollLockPadding();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (mappedOptions.focusTrap) {
|
|
293
|
+
releaseFocus();
|
|
294
|
+
}
|
|
295
|
+
if (!mappedOptions.preventZoom) {
|
|
296
|
+
resetMetaViewport();
|
|
297
|
+
}
|
|
298
|
+
deleteState();
|
|
341
299
|
});
|
|
342
300
|
</script>
|
|
343
301
|
|
|
@@ -14,12 +14,12 @@ interface MagicDrawerProps {
|
|
|
14
14
|
id: MaybeRef<string>;
|
|
15
15
|
options?: MagicDrawerOptions;
|
|
16
16
|
}
|
|
17
|
-
declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions> & Omit<import("../types/index").DrawerDefaultOptions, keyof MagicDrawerOptions> & {
|
|
17
|
+
declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions> & Omit<import("../types/index.js").DrawerDefaultOptions, keyof MagicDrawerOptions> & {
|
|
18
18
|
threshold: ({
|
|
19
19
|
lock?: number;
|
|
20
20
|
distance?: number;
|
|
21
21
|
momentum?: number;
|
|
22
|
-
} & import("../../../../utils").RequireAll<{
|
|
22
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
23
23
|
lock?: number;
|
|
24
24
|
distance?: number;
|
|
25
25
|
momentum?: number;
|
|
@@ -31,7 +31,7 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
31
31
|
lock?: number;
|
|
32
32
|
distance?: number;
|
|
33
33
|
momentum?: number;
|
|
34
|
-
} & import("../../../../utils").RequireAll<{
|
|
34
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
35
35
|
lock?: number;
|
|
36
36
|
distance?: number;
|
|
37
37
|
momentum?: number;
|
|
@@ -50,7 +50,7 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
50
50
|
duration?: number;
|
|
51
51
|
easing?: (t: number) => number;
|
|
52
52
|
};
|
|
53
|
-
} & import("../../../../utils").RequireAll<{
|
|
53
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
54
54
|
snap?: {
|
|
55
55
|
duration?: number;
|
|
56
56
|
easing?: (t: number) => number;
|
|
@@ -65,7 +65,7 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
65
65
|
duration?: number;
|
|
66
66
|
easing?: (t: number) => number;
|
|
67
67
|
};
|
|
68
|
-
} & import("../../../../utils").RequireAll<{
|
|
68
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
69
69
|
snap?: {
|
|
70
70
|
duration?: number;
|
|
71
71
|
easing?: (t: number) => number;
|
|
@@ -83,17 +83,17 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
83
83
|
padding: boolean;
|
|
84
84
|
} | ((boolean | {
|
|
85
85
|
padding: boolean;
|
|
86
|
-
}) & import("../../../../utils").RequireAll<boolean | {
|
|
86
|
+
}) & import("../../../../utils/index.js").RequireAll<boolean | {
|
|
87
87
|
padding: boolean;
|
|
88
88
|
} | undefined>) | (Omit<{
|
|
89
89
|
padding: boolean;
|
|
90
|
-
}, "padding"> & Omit<false & import("../../../../utils").RequireAll<{
|
|
90
|
+
}, "padding"> & Omit<false & import("../../../../utils/index.js").RequireAll<{
|
|
91
91
|
padding: boolean;
|
|
92
92
|
}>, "padding"> & {
|
|
93
93
|
padding: boolean;
|
|
94
94
|
}) | (Omit<{
|
|
95
95
|
padding: boolean;
|
|
96
|
-
}, "padding"> & Omit<true & import("../../../../utils").RequireAll<{
|
|
96
|
+
}, "padding"> & Omit<true & import("../../../../utils/index.js").RequireAll<{
|
|
97
97
|
padding: boolean;
|
|
98
98
|
}>, "padding"> & {
|
|
99
99
|
padding: boolean;
|
|
@@ -116,23 +116,23 @@ declare const mappedOptions: Omit<MagicDrawerOptions, keyof MagicDrawerOptions>
|
|
|
116
116
|
};
|
|
117
117
|
keyListener: ({
|
|
118
118
|
close?: string[] | false;
|
|
119
|
-
} & import("../../../../utils").RequireAll<{
|
|
119
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
120
120
|
close?: string[] | false;
|
|
121
121
|
}>) | (Omit<{
|
|
122
122
|
close?: string[] | false;
|
|
123
123
|
}, "close"> & Omit<{
|
|
124
124
|
close?: string[] | false;
|
|
125
|
-
} & import("../../../../utils").RequireAll<{
|
|
125
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
126
126
|
close?: string[] | false;
|
|
127
127
|
}>, "close"> & {
|
|
128
128
|
close: (false | string[] | undefined) & (false | string[]);
|
|
129
129
|
});
|
|
130
130
|
position: "right" | "left" | "top" | "bottom";
|
|
131
|
-
snapPoints: import("../types/index").DrawerSnapPoint[];
|
|
131
|
+
snapPoints: import("../types/index.js").DrawerSnapPoint[];
|
|
132
132
|
initial: {
|
|
133
133
|
open?: boolean;
|
|
134
134
|
transition?: boolean;
|
|
135
|
-
snapPoint?: import("../types/index").DrawerSnapPoint;
|
|
135
|
+
snapPoint?: import("../types/index.js").DrawerSnapPoint;
|
|
136
136
|
};
|
|
137
137
|
enableMousewheel: boolean;
|
|
138
138
|
preventZoom: boolean;
|