@maas/vue-equipment 1.0.0-beta.13 → 1.0.0-beta.15
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 -86
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +14 -13
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +263 -303
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +50 -49
- 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 +137 -163
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +9 -8
- 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 +81 -94
- 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,7 +1,14 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="magic-cookie-item"
|
|
4
|
+
:data-optional="item.optional"
|
|
5
|
+
:data-active="item.active"
|
|
6
|
+
>
|
|
7
|
+
<slot :item="item" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup>
|
|
5
12
|
import { computed, inject, provide, onBeforeUnmount, useId } from "vue";
|
|
6
13
|
import { useCookieItem } from "../composables/private/useCookieItem";
|
|
7
14
|
import {
|
|
@@ -9,44 +16,39 @@ import {
|
|
|
9
16
|
MagicCookieItemId,
|
|
10
17
|
MagicCookieItemActive
|
|
11
18
|
} from "../symbols";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
const { id, optional, maxAge } = defineProps({
|
|
20
|
+
id: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
optional: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
required: false
|
|
18
27
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw new Error("MagicCookieItem must be nested inside MagicCookieProvider");
|
|
23
|
-
}
|
|
24
|
-
const mappedId = computed(() => __props.id ?? `magic-cookie-item-${useId()}`);
|
|
25
|
-
const mappedActive = computed(() => item.active);
|
|
26
|
-
const { initializeItem, deleteItem } = useCookieItem({
|
|
27
|
-
instanceId
|
|
28
|
-
});
|
|
29
|
-
const item = initializeItem({
|
|
30
|
-
id: mappedId.value,
|
|
31
|
-
optional: __props.optional,
|
|
32
|
-
maxAge: __props.maxAge
|
|
33
|
-
});
|
|
34
|
-
provide(MagicCookieItemId, mappedId.value);
|
|
35
|
-
provide(MagicCookieItemActive, mappedActive);
|
|
36
|
-
onBeforeUnmount(() => {
|
|
37
|
-
deleteItem(mappedId.value);
|
|
38
|
-
});
|
|
39
|
-
return (_ctx, _cache) => {
|
|
40
|
-
return _openBlock(), _createElementBlock("div", {
|
|
41
|
-
class: "magic-cookie-item",
|
|
42
|
-
"data-optional": _unref(item).optional,
|
|
43
|
-
"data-active": _unref(item).active
|
|
44
|
-
}, [
|
|
45
|
-
_renderSlot(_ctx.$slots, "default", { item: _unref(item) })
|
|
46
|
-
], 8, _hoisted_1);
|
|
47
|
-
};
|
|
28
|
+
maxAge: {
|
|
29
|
+
type: Number,
|
|
30
|
+
required: false
|
|
48
31
|
}
|
|
49
32
|
});
|
|
33
|
+
const instanceId = inject(MagicCookieInstanceId, void 0);
|
|
34
|
+
if (!instanceId) {
|
|
35
|
+
throw new Error("MagicCookieItem must be nested inside MagicCookieProvider");
|
|
36
|
+
}
|
|
37
|
+
const mappedId = computed(() => id ?? `magic-cookie-item-${useId()}`);
|
|
38
|
+
const mappedActive = computed(() => item.active);
|
|
39
|
+
const { initializeItem, deleteItem } = useCookieItem({
|
|
40
|
+
instanceId
|
|
41
|
+
});
|
|
42
|
+
const item = initializeItem({
|
|
43
|
+
id: mappedId.value,
|
|
44
|
+
optional,
|
|
45
|
+
maxAge
|
|
46
|
+
});
|
|
47
|
+
provide(MagicCookieItemId, mappedId.value);
|
|
48
|
+
provide(MagicCookieItemActive, mappedActive);
|
|
49
|
+
onBeforeUnmount(() => {
|
|
50
|
+
deleteItem(mappedId.value);
|
|
51
|
+
});
|
|
50
52
|
</script>
|
|
51
53
|
|
|
52
54
|
<style>
|
|
@@ -3,10 +3,10 @@ interface MagicCookieItemProps {
|
|
|
3
3
|
optional?: boolean;
|
|
4
4
|
maxAge?: number;
|
|
5
5
|
}
|
|
6
|
-
declare const item: import("../types").CookieItem;
|
|
6
|
+
declare const item: import("../types/index.js").CookieItem;
|
|
7
7
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
item: import("../types").CookieItem;
|
|
9
|
+
item: import("../types/index.js").CookieItem;
|
|
10
10
|
};
|
|
11
11
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
12
12
|
default?: (props: typeof __VLS_1) => any;
|
|
@@ -1,43 +1,32 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<client-only>
|
|
3
|
+
<div class="magic-cookie-provider" v-bind="$attrs">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</client-only>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
4
10
|
import { provide } from "vue";
|
|
5
11
|
import { defu } from "defu";
|
|
6
12
|
import { useCookieState } from "../composables/private/useCookieState";
|
|
7
13
|
import { defaultOptions } from "../utils/defaultOptions";
|
|
8
14
|
import { MagicCookieInstanceId } from "../symbols";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
options: { type: Object, required: false }
|
|
15
|
+
defineOptions({
|
|
16
|
+
inheritAttrs: false
|
|
17
|
+
});
|
|
18
|
+
const { id, options } = defineProps({
|
|
19
|
+
id: {
|
|
20
|
+
type: null,
|
|
21
|
+
required: true
|
|
17
22
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
initializeState(mappedOptions);
|
|
22
|
-
provide(MagicCookieInstanceId, __props.id);
|
|
23
|
-
return (_ctx, _cache) => {
|
|
24
|
-
const _component_client_only = _resolveComponent("client-only");
|
|
25
|
-
return _openBlock(), _createBlock(_component_client_only, null, {
|
|
26
|
-
default: _withCtx(() => [
|
|
27
|
-
_createElementVNode(
|
|
28
|
-
"div",
|
|
29
|
-
_mergeProps({ class: "magic-cookie-provider" }, _ctx.$attrs),
|
|
30
|
-
[
|
|
31
|
-
_renderSlot(_ctx.$slots, "default")
|
|
32
|
-
],
|
|
33
|
-
16
|
|
34
|
-
/* FULL_PROPS */
|
|
35
|
-
)
|
|
36
|
-
]),
|
|
37
|
-
_: 3
|
|
38
|
-
/* FORWARDED */
|
|
39
|
-
});
|
|
40
|
-
};
|
|
23
|
+
options: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: false
|
|
41
26
|
}
|
|
42
27
|
});
|
|
28
|
+
const mappedOptions = defu(options, defaultOptions);
|
|
29
|
+
const { initializeState } = useCookieState(id);
|
|
30
|
+
initializeState(mappedOptions);
|
|
31
|
+
provide(MagicCookieInstanceId, id);
|
|
43
32
|
</script>
|
|
@@ -1,82 +1,49 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="magic-cookie-view"
|
|
4
|
+
:style="{ '--mc-duration': `${state.options.animation?.duration}ms` }"
|
|
5
|
+
>
|
|
6
|
+
<auto-size :width="false">
|
|
7
|
+
<transition
|
|
8
|
+
:name="state.options.transition"
|
|
9
|
+
@before-leave="onBeforeLeave"
|
|
10
|
+
@leave="onLeave"
|
|
11
|
+
@after-leave="onAfterLeave"
|
|
12
|
+
@before-enter="onBeforeEnter"
|
|
13
|
+
@enter="onEnter"
|
|
14
|
+
@after-enter="onAfterEnter"
|
|
15
|
+
>
|
|
16
|
+
<div v-show="state.viewActive" class="magic-cookie-view__inner">
|
|
17
|
+
<slot :view-active="state.viewActive" />
|
|
18
|
+
</div>
|
|
19
|
+
</transition>
|
|
20
|
+
</auto-size>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
5
25
|
import { inject } from "vue";
|
|
6
|
-
import { AutoSize } from "@maas/vue-autosize";
|
|
7
26
|
import { useCookieState } from "../composables/private/useCookieState";
|
|
8
27
|
import { useCookieCallback } from "../composables/private/useCookieCallback";
|
|
9
28
|
import { MagicCookieInstanceId } from "../symbols";
|
|
10
29
|
import "@maas/vue-equipment/utils/css/animations/fade-in.css";
|
|
11
30
|
import "@maas/vue-equipment/utils/css/animations/auto-size-out.css";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onLeave,
|
|
29
|
-
onAfterLeave
|
|
30
|
-
} = useCookieCallback(instanceId);
|
|
31
|
-
return (_ctx, _cache) => {
|
|
32
|
-
return _openBlock(), _createElementBlock(
|
|
33
|
-
"div",
|
|
34
|
-
{
|
|
35
|
-
class: "magic-cookie-view",
|
|
36
|
-
style: _normalizeStyle({ "--mc-duration": `${_unref(state).options.animation?.duration}ms` })
|
|
37
|
-
},
|
|
38
|
-
[
|
|
39
|
-
_createVNode(_unref(AutoSize), { width: false }, {
|
|
40
|
-
default: _withCtx(() => [
|
|
41
|
-
_createVNode(_Transition, {
|
|
42
|
-
name: _unref(state).options.transition,
|
|
43
|
-
onBeforeLeave: _unref(onBeforeLeave),
|
|
44
|
-
onLeave: _unref(onLeave),
|
|
45
|
-
onAfterLeave: _unref(onAfterLeave),
|
|
46
|
-
onBeforeEnter: _unref(onBeforeEnter),
|
|
47
|
-
onEnter: _unref(onEnter),
|
|
48
|
-
onAfterEnter: _unref(onAfterEnter),
|
|
49
|
-
persisted: ""
|
|
50
|
-
}, {
|
|
51
|
-
default: _withCtx(() => [
|
|
52
|
-
_withDirectives(_createElementVNode(
|
|
53
|
-
"div",
|
|
54
|
-
_hoisted_1,
|
|
55
|
-
[
|
|
56
|
-
_renderSlot(_ctx.$slots, "default", {
|
|
57
|
-
viewActive: _unref(state).viewActive
|
|
58
|
-
})
|
|
59
|
-
],
|
|
60
|
-
512
|
|
61
|
-
/* NEED_PATCH */
|
|
62
|
-
), [
|
|
63
|
-
[_vShow, _unref(state).viewActive]
|
|
64
|
-
])
|
|
65
|
-
]),
|
|
66
|
-
_: 3
|
|
67
|
-
/* FORWARDED */
|
|
68
|
-
}, 8, ["name", "onBeforeLeave", "onLeave", "onAfterLeave", "onBeforeEnter", "onEnter", "onAfterEnter"])
|
|
69
|
-
]),
|
|
70
|
-
_: 3
|
|
71
|
-
/* FORWARDED */
|
|
72
|
-
})
|
|
73
|
-
],
|
|
74
|
-
4
|
|
75
|
-
/* STYLE */
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
31
|
+
const instanceId = inject(MagicCookieInstanceId, void 0);
|
|
32
|
+
if (!instanceId) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"MagicCookiePreferences must be used within a MagicCookieProvider"
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const { initializeState } = useCookieState(instanceId);
|
|
38
|
+
const state = initializeState();
|
|
39
|
+
const {
|
|
40
|
+
onBeforeEnter,
|
|
41
|
+
onEnter,
|
|
42
|
+
onAfterEnter,
|
|
43
|
+
onBeforeLeave,
|
|
44
|
+
onLeave,
|
|
45
|
+
onAfterLeave
|
|
46
|
+
} = useCookieCallback(instanceId);
|
|
80
47
|
</script>
|
|
81
48
|
|
|
82
49
|
<style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AutoSize } from '@maas/vue-autosize';
|
|
2
2
|
import '@maas/vue-equipment/utils/css/animations/fade-in.css';
|
|
3
3
|
import '@maas/vue-equipment/utils/css/animations/auto-size-out.css';
|
|
4
|
-
declare const state: import("../types").CookieState;
|
|
4
|
+
declare const state: import("../types/index.js").CookieState;
|
|
5
5
|
declare const onBeforeEnter: () => void, onEnter: () => void, onAfterEnter: () => Promise<void>, onBeforeLeave: () => void, onLeave: () => void, onAfterLeave: () => void;
|
|
6
6
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
7
7
|
declare var __VLS_18: {
|
|
@@ -1,97 +1,81 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:data-id="mappedId"
|
|
4
|
+
:data-dragging="dragging"
|
|
5
|
+
:data-disabled="disabled"
|
|
6
|
+
class="magic-draggable"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<div ref="wrapper" class="magic-draggable__wrapper">
|
|
10
|
+
<component
|
|
11
|
+
:is="mappedOptions.tag"
|
|
12
|
+
ref="el"
|
|
13
|
+
class="magic-draggable__drag"
|
|
14
|
+
:style="style"
|
|
15
|
+
@pointerdown="guardedPointerdown"
|
|
16
|
+
@click="guardedClick"
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
<div v-if="hasDragged" class="magic-draggable__overlay" />
|
|
20
|
+
</component>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
13
26
|
import { useTemplateRef, computed, toValue, toRefs } from "vue";
|
|
14
27
|
import { defu } from "defu";
|
|
15
28
|
import { useDraggableDrag } from "../composables/private/useDraggableDrag";
|
|
16
29
|
import { useDraggableState } from "../composables/private/useDraggableState";
|
|
17
30
|
import { defaultOptions } from "../utils/defaultOptions";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
options: { type: Object, required: false, default: () => ({}) }
|
|
31
|
+
defineOptions({
|
|
32
|
+
inheritAttrs: false
|
|
33
|
+
});
|
|
34
|
+
const { id, options = {} } = defineProps({
|
|
35
|
+
id: {
|
|
36
|
+
type: null,
|
|
37
|
+
required: true
|
|
26
38
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
elRef,
|
|
45
|
-
wrapperRef,
|
|
46
|
-
threshold,
|
|
47
|
-
snapPoints,
|
|
48
|
-
animation,
|
|
49
|
-
initial,
|
|
50
|
-
scrollLock
|
|
51
|
-
});
|
|
52
|
-
function guardedPointerdown(event) {
|
|
53
|
-
if (!disabled.value) {
|
|
54
|
-
onPointerdown(event);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function guardedClick(event) {
|
|
58
|
-
if (!disabled.value) {
|
|
59
|
-
onClick(event);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return _openBlock(), _createElementBlock("div", _mergeProps({
|
|
64
|
-
"data-id": toValue(_ctx.id),
|
|
65
|
-
"data-dragging": _unref(dragging),
|
|
66
|
-
"data-disabled": disabled.value,
|
|
67
|
-
class: "magic-draggable"
|
|
68
|
-
}, _ctx.$attrs), [
|
|
69
|
-
_createElementVNode(
|
|
70
|
-
"div",
|
|
71
|
-
_hoisted_2,
|
|
72
|
-
[
|
|
73
|
-
(_openBlock(), _createBlock(_resolveDynamicComponent(_unref(mappedOptions).tag), {
|
|
74
|
-
ref: "el",
|
|
75
|
-
class: "magic-draggable__drag",
|
|
76
|
-
style: _normalizeStyle(_unref(style)),
|
|
77
|
-
onPointerdown: guardedPointerdown,
|
|
78
|
-
onClick: guardedClick
|
|
79
|
-
}, {
|
|
80
|
-
default: _withCtx(() => [
|
|
81
|
-
_renderSlot(_ctx.$slots, "default"),
|
|
82
|
-
_unref(hasDragged) ? (_openBlock(), _createElementBlock("div", _hoisted_3)) : _createCommentVNode("v-if", true)
|
|
83
|
-
]),
|
|
84
|
-
_: 3
|
|
85
|
-
/* FORWARDED */
|
|
86
|
-
}, 40, ["style"]))
|
|
87
|
-
],
|
|
88
|
-
512
|
|
89
|
-
/* NEED_PATCH */
|
|
90
|
-
)
|
|
91
|
-
], 16, _hoisted_1);
|
|
92
|
-
};
|
|
39
|
+
options: {
|
|
40
|
+
type: Object,
|
|
41
|
+
required: false
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const mappedOptions = defu(options, defaultOptions);
|
|
45
|
+
const mappedId = toValue(id);
|
|
46
|
+
const elRef = useTemplateRef("el");
|
|
47
|
+
const wrapperRef = useTemplateRef("wrapper");
|
|
48
|
+
const { initializeState } = useDraggableState(id);
|
|
49
|
+
const state = initializeState();
|
|
50
|
+
const { dragging } = toRefs(state);
|
|
51
|
+
const disabled = computed(() => {
|
|
52
|
+
if (options.disabled === void 0) {
|
|
53
|
+
return defaultOptions.disabled;
|
|
54
|
+
} else {
|
|
55
|
+
return options.disabled;
|
|
93
56
|
}
|
|
94
57
|
});
|
|
58
|
+
const { snapPoints, animation, initial, threshold, scrollLock } = mappedOptions;
|
|
59
|
+
const { onPointerdown, onClick, style, hasDragged } = useDraggableDrag({
|
|
60
|
+
id,
|
|
61
|
+
elRef,
|
|
62
|
+
wrapperRef,
|
|
63
|
+
threshold,
|
|
64
|
+
snapPoints,
|
|
65
|
+
animation,
|
|
66
|
+
initial,
|
|
67
|
+
scrollLock
|
|
68
|
+
});
|
|
69
|
+
function guardedPointerdown(event) {
|
|
70
|
+
if (!disabled.value) {
|
|
71
|
+
onPointerdown(event);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function guardedClick(event) {
|
|
75
|
+
if (!disabled.value) {
|
|
76
|
+
onClick(event);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
95
79
|
</script>
|
|
96
80
|
|
|
97
81
|
<style>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
2
|
import type { MagicDraggableOptions } from '../types/index.js';
|
|
3
3
|
interface MagicDraggableProps {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
5
|
options?: MagicDraggableOptions;
|
|
6
6
|
}
|
|
7
|
-
declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOptions> & Omit<import("../types").DraggableDefaultOptions, keyof MagicDraggableOptions> & {
|
|
7
|
+
declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOptions> & Omit<import("../types/index.js").DraggableDefaultOptions, keyof MagicDraggableOptions> & {
|
|
8
8
|
threshold: ({
|
|
9
9
|
lock?: number;
|
|
10
10
|
distance?: number;
|
|
11
11
|
momentum?: number;
|
|
12
12
|
idle?: number;
|
|
13
|
-
} & import("../../../../utils").RequireAll<{
|
|
13
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
14
14
|
lock?: number;
|
|
15
15
|
distance?: number;
|
|
16
16
|
momentum?: number;
|
|
@@ -25,7 +25,7 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
25
25
|
distance?: number;
|
|
26
26
|
momentum?: number;
|
|
27
27
|
idle?: number;
|
|
28
|
-
} & import("../../../../utils").RequireAll<{
|
|
28
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
29
29
|
lock?: number;
|
|
30
30
|
distance?: number;
|
|
31
31
|
momentum?: number;
|
|
@@ -36,13 +36,17 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
36
36
|
momentum: number;
|
|
37
37
|
idle: number;
|
|
38
38
|
});
|
|
39
|
+
tag: "dialog" | "div";
|
|
40
|
+
scrollLock: boolean | {
|
|
41
|
+
padding: boolean;
|
|
42
|
+
};
|
|
39
43
|
disabled: boolean;
|
|
40
44
|
animation: ({
|
|
41
45
|
snap?: {
|
|
42
46
|
duration?: number;
|
|
43
47
|
easing?: (t: number) => number;
|
|
44
48
|
};
|
|
45
|
-
} & import("../../../../utils").RequireAll<{
|
|
49
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
46
50
|
snap?: {
|
|
47
51
|
duration?: number;
|
|
48
52
|
easing?: (t: number) => number;
|
|
@@ -57,7 +61,7 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
57
61
|
duration?: number;
|
|
58
62
|
easing?: (t: number) => number;
|
|
59
63
|
};
|
|
60
|
-
} & import("../../../../utils").RequireAll<{
|
|
64
|
+
} & import("../../../../utils/index.js").RequireAll<{
|
|
61
65
|
snap?: {
|
|
62
66
|
duration?: number;
|
|
63
67
|
easing?: (t: number) => number;
|
|
@@ -68,15 +72,12 @@ declare const mappedOptions: Omit<MagicDraggableOptions, keyof MagicDraggableOpt
|
|
|
68
72
|
easing?: (t: number) => number;
|
|
69
73
|
};
|
|
70
74
|
});
|
|
71
|
-
|
|
72
|
-
scrollLock: boolean | {
|
|
73
|
-
padding: boolean;
|
|
74
|
-
};
|
|
75
|
-
snapPoints: import("../types").DraggableSnapPoint[];
|
|
75
|
+
snapPoints: import("../types/index.js").DraggableSnapPoint[];
|
|
76
76
|
initial: {
|
|
77
|
-
snapPoint?: import("../types").DraggableSnapPoint;
|
|
77
|
+
snapPoint?: import("../types/index.js").DraggableSnapPoint;
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
+
declare const mappedId: string;
|
|
80
81
|
declare const dragging: import("vue").Ref<boolean, boolean>;
|
|
81
82
|
declare const disabled: import("vue").ComputedRef<boolean>;
|
|
82
83
|
declare const style: import("vue").ComputedRef<string>, hasDragged: import("vue").ComputedRef<boolean>;
|
|
@@ -88,8 +89,8 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
88
89
|
default?: (props: typeof __VLS_12) => any;
|
|
89
90
|
}>;
|
|
90
91
|
declare const __VLS_self: import("vue").DefineComponent<MagicDraggableProps, {
|
|
91
|
-
toValue: typeof toValue;
|
|
92
92
|
mappedOptions: typeof mappedOptions;
|
|
93
|
+
mappedId: typeof mappedId;
|
|
93
94
|
dragging: typeof dragging;
|
|
94
95
|
disabled: typeof disabled;
|
|
95
96
|
style: typeof style;
|