@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,78 +1,50 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="parent" class="magic-marquee">
|
|
3
|
+
<div class="magic-marquee__track">
|
|
4
|
+
<div ref="child" class="magic-marquee__content">
|
|
5
|
+
<slot />
|
|
6
|
+
</div>
|
|
7
|
+
<div
|
|
8
|
+
v-for="duplicate in duplicates"
|
|
9
|
+
:key="duplicate"
|
|
10
|
+
class="magic-marquee__content"
|
|
11
|
+
:aria-hidden="true"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
13
20
|
import { useTemplateRef, onMounted, onBeforeUnmount } from "vue";
|
|
14
21
|
import { useMarqueeApi } from "../composables/private/useMarqueeApi";
|
|
15
22
|
import { useMarqueeState } from "../composables/private/useMarqueeState";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
options: { type: Object, required: false }
|
|
23
|
+
const { id, options } = defineProps({
|
|
24
|
+
id: {
|
|
25
|
+
type: null,
|
|
26
|
+
required: true
|
|
21
27
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const parentRef = useTemplateRef("parent");
|
|
26
|
-
const childRef = useTemplateRef("child");
|
|
27
|
-
const { duplicates, initialize } = useMarqueeApi({
|
|
28
|
-
child: childRef,
|
|
29
|
-
parent: parentRef,
|
|
30
|
-
instanceId: __props.id
|
|
31
|
-
});
|
|
32
|
-
onMounted(() => {
|
|
33
|
-
initialize();
|
|
34
|
-
});
|
|
35
|
-
onBeforeUnmount(() => {
|
|
36
|
-
deleteState();
|
|
37
|
-
});
|
|
38
|
-
return (_ctx, _cache) => {
|
|
39
|
-
return _openBlock(), _createElementBlock(
|
|
40
|
-
"div",
|
|
41
|
-
_hoisted_1,
|
|
42
|
-
[
|
|
43
|
-
_createElementVNode("div", _hoisted_2, [
|
|
44
|
-
_createElementVNode(
|
|
45
|
-
"div",
|
|
46
|
-
_hoisted_3,
|
|
47
|
-
[
|
|
48
|
-
_renderSlot(_ctx.$slots, "default")
|
|
49
|
-
],
|
|
50
|
-
512
|
|
51
|
-
/* NEED_PATCH */
|
|
52
|
-
),
|
|
53
|
-
(_openBlock(true), _createElementBlock(
|
|
54
|
-
_Fragment,
|
|
55
|
-
null,
|
|
56
|
-
_renderList(_unref(duplicates), (duplicate) => {
|
|
57
|
-
return _openBlock(), _createElementBlock("div", {
|
|
58
|
-
key: duplicate,
|
|
59
|
-
class: "magic-marquee__content",
|
|
60
|
-
"aria-hidden": true
|
|
61
|
-
}, [
|
|
62
|
-
_renderSlot(_ctx.$slots, "default")
|
|
63
|
-
]);
|
|
64
|
-
}),
|
|
65
|
-
128
|
|
66
|
-
/* KEYED_FRAGMENT */
|
|
67
|
-
))
|
|
68
|
-
])
|
|
69
|
-
],
|
|
70
|
-
512
|
|
71
|
-
/* NEED_PATCH */
|
|
72
|
-
);
|
|
73
|
-
};
|
|
28
|
+
options: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: false
|
|
74
31
|
}
|
|
75
32
|
});
|
|
33
|
+
const { deleteState, initializeState } = useMarqueeState(id);
|
|
34
|
+
initializeState(options);
|
|
35
|
+
const parentRef = useTemplateRef("parent");
|
|
36
|
+
const childRef = useTemplateRef("child");
|
|
37
|
+
const { duplicates, initialize } = useMarqueeApi({
|
|
38
|
+
child: childRef,
|
|
39
|
+
parent: parentRef,
|
|
40
|
+
instanceId: id
|
|
41
|
+
});
|
|
42
|
+
onMounted(() => {
|
|
43
|
+
initialize();
|
|
44
|
+
});
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
deleteState();
|
|
47
|
+
});
|
|
76
48
|
</script>
|
|
77
49
|
|
|
78
50
|
<style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
export declare function useMagicMarquee(id: MaybeRef<string>): {
|
|
3
|
-
state: import("../types").MarqueeState;
|
|
3
|
+
state: import("../types/index.js").MarqueeState;
|
|
4
4
|
isPlaying: import("vue").ComputedRef<boolean>;
|
|
5
5
|
play: () => void;
|
|
6
6
|
pause: () => void;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<transition :name="mappedTransition">
|
|
3
|
+
<div
|
|
4
|
+
v-if="channel.active"
|
|
5
|
+
class="magic-menu-channel"
|
|
6
|
+
:data-initialized="state.active"
|
|
7
|
+
:data-id="mappedId"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</transition>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
5
15
|
import { computed, inject, provide } from "vue";
|
|
6
16
|
import { useMenuChannel } from "../composables/private/useMenuChannel";
|
|
7
17
|
import {
|
|
@@ -12,64 +22,49 @@ import {
|
|
|
12
22
|
MagicMenuChannelActive
|
|
13
23
|
} from "../symbols";
|
|
14
24
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
transition: { type: String, required: false }
|
|
25
|
+
const { transition, id } = defineProps({
|
|
26
|
+
id: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true
|
|
20
29
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
() => __props.transition ?? state.options.transition.channel
|
|
44
|
-
);
|
|
45
|
-
const { initializeChannel } = useMenuChannel({
|
|
46
|
-
instanceId,
|
|
47
|
-
viewId
|
|
48
|
-
});
|
|
49
|
-
const channel = initializeChannel({
|
|
50
|
-
id: mappedId.value
|
|
51
|
-
});
|
|
52
|
-
const mappedActive = computed(() => channel.active);
|
|
53
|
-
provide(MagicMenuChannelId, mappedId.value);
|
|
54
|
-
provide(MagicMenuChannelActive, mappedActive);
|
|
55
|
-
return (_ctx, _cache) => {
|
|
56
|
-
return _openBlock(), _createBlock(_Transition, { name: mappedTransition.value }, {
|
|
57
|
-
default: _withCtx(() => [
|
|
58
|
-
_unref(channel).active ? (_openBlock(), _createElementBlock("div", {
|
|
59
|
-
key: 0,
|
|
60
|
-
class: "magic-menu-channel",
|
|
61
|
-
"data-initialized": _unref(state).active,
|
|
62
|
-
"data-id": mappedId.value
|
|
63
|
-
}, [
|
|
64
|
-
_renderSlot(_ctx.$slots, "default")
|
|
65
|
-
], 8, _hoisted_1)) : _createCommentVNode("v-if", true)
|
|
66
|
-
]),
|
|
67
|
-
_: 3
|
|
68
|
-
/* FORWARDED */
|
|
69
|
-
}, 8, ["name"]);
|
|
70
|
-
};
|
|
30
|
+
transition: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const instanceId = inject(MagicMenuInstanceId, void 0);
|
|
36
|
+
const viewId = inject(MagicMenuViewId, void 0);
|
|
37
|
+
const contentId = inject(MagicMenuContentId, void 0);
|
|
38
|
+
if (!instanceId) {
|
|
39
|
+
throw new Error("MagicMenuChannel must be nested inside MagicMenuProvider");
|
|
40
|
+
}
|
|
41
|
+
if (!viewId) {
|
|
42
|
+
throw new Error("MagicMenuChannel must be nested inside MagicMenuView");
|
|
43
|
+
}
|
|
44
|
+
if (!id) {
|
|
45
|
+
throw new Error("MagicMenuChannel requires an id");
|
|
46
|
+
}
|
|
47
|
+
const { initializeState } = useMenuState(instanceId);
|
|
48
|
+
const state = initializeState();
|
|
49
|
+
if (!contentId) {
|
|
50
|
+
if (state.options.debug) {
|
|
51
|
+
console.warn("MagicMenuChannel is not nested inside MagicMenuContent");
|
|
71
52
|
}
|
|
53
|
+
}
|
|
54
|
+
const mappedId = computed(() => `magic-menu-channel-${id}`);
|
|
55
|
+
const mappedTransition = computed(
|
|
56
|
+
() => transition ?? state.options.transition.channel
|
|
57
|
+
);
|
|
58
|
+
const { initializeChannel } = useMenuChannel({
|
|
59
|
+
instanceId,
|
|
60
|
+
viewId
|
|
61
|
+
});
|
|
62
|
+
const channel = initializeChannel({
|
|
63
|
+
id: mappedId.value
|
|
72
64
|
});
|
|
65
|
+
const mappedActive = computed(() => channel.active);
|
|
66
|
+
provide(MagicMenuChannelId, mappedId.value);
|
|
67
|
+
provide(MagicMenuChannelActive, mappedActive);
|
|
73
68
|
</script>
|
|
74
69
|
|
|
75
70
|
<style>
|
|
@@ -2,10 +2,10 @@ interface MagicMenuChannelProps {
|
|
|
2
2
|
id: string;
|
|
3
3
|
transition?: string;
|
|
4
4
|
}
|
|
5
|
-
declare const state: import("../types").MenuState;
|
|
5
|
+
declare const state: import("../types/index.js").MenuState;
|
|
6
6
|
declare const mappedId: import("vue").ComputedRef<string>;
|
|
7
7
|
declare const mappedTransition: import("vue").ComputedRef<string>;
|
|
8
|
-
declare const channel: import("../types").MenuChannel;
|
|
8
|
+
declare const channel: import("../types/index.js").MenuChannel;
|
|
9
9
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
10
10
|
declare var __VLS_5: {};
|
|
11
11
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -1,8 +1,61 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<teleport v-if="wrapperActive" to="body">
|
|
3
|
+
<transition
|
|
4
|
+
:name="mappedTransition"
|
|
5
|
+
:on-before-enter="onBeforeEnter"
|
|
6
|
+
:on-enter="onEnter"
|
|
7
|
+
:on-after-enter="onAfterEnter"
|
|
8
|
+
:on-before-leave="onBeforeLeave"
|
|
9
|
+
:on-leave="onLeave"
|
|
10
|
+
:on-after-leave="onAfterLeave"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
v-if="innerActive"
|
|
14
|
+
class="magic-menu-content"
|
|
15
|
+
:data-id="`${viewId}-content`"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
>
|
|
18
|
+
<magic-menu-float
|
|
19
|
+
:placement="view?.placement"
|
|
20
|
+
:middleware="middleware"
|
|
21
|
+
:arrow="arrow"
|
|
22
|
+
:reference-el="referenceEl"
|
|
23
|
+
>
|
|
24
|
+
<template v-if="$slots.arrow && arrow" #arrow>
|
|
25
|
+
<slot name="arrow" />
|
|
26
|
+
</template>
|
|
27
|
+
<template #default>
|
|
28
|
+
<div
|
|
29
|
+
class="magic-menu-content__inner"
|
|
30
|
+
:data-pointer-disabled="pointerDisabled"
|
|
31
|
+
>
|
|
32
|
+
<slot />
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
</magic-menu-float>
|
|
36
|
+
</div>
|
|
37
|
+
</transition>
|
|
38
|
+
<template v-if="state.options.debug">
|
|
39
|
+
<span
|
|
40
|
+
v-for="point in coords"
|
|
41
|
+
:key="`${point.x}${point.y}`"
|
|
42
|
+
:style="{
|
|
43
|
+
background: 'red',
|
|
44
|
+
position: 'fixed',
|
|
45
|
+
top: point.y + 'px',
|
|
46
|
+
left: point.x + 'px',
|
|
47
|
+
width: '4px',
|
|
48
|
+
height: '4px',
|
|
49
|
+
zIndex: 1e3,
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
transform: 'translate(-50%, -50%)'
|
|
52
|
+
}"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
55
|
+
</teleport>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
6
59
|
import {
|
|
7
60
|
shallowRef,
|
|
8
61
|
inject,
|
|
@@ -26,215 +79,142 @@ import {
|
|
|
26
79
|
} from "../symbols";
|
|
27
80
|
import "@maas/vue-equipment/utils/css/animations/fade-in.css";
|
|
28
81
|
import "@maas/vue-equipment/utils/css/animations/fade-out.css";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
82
|
+
defineOptions({
|
|
83
|
+
inheritAttrs: false
|
|
84
|
+
});
|
|
85
|
+
const { arrow = void 0, transition } = defineProps({
|
|
86
|
+
arrow: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
required: false,
|
|
89
|
+
skipCheck: true
|
|
32
90
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
middleware: { type: Array, required: false },
|
|
37
|
-
transition: { type: String, required: false },
|
|
38
|
-
referenceEl: { type: null, required: false }
|
|
91
|
+
middleware: {
|
|
92
|
+
type: Array,
|
|
93
|
+
required: false
|
|
39
94
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
isInsideTo,
|
|
119
|
-
isInsideFrom
|
|
120
|
-
} = useMenuCursor(view, state.options.debug);
|
|
121
|
-
function disableCursor() {
|
|
122
|
-
state.input.disabled = [...state.input.disabled, "pointer"];
|
|
95
|
+
transition: {
|
|
96
|
+
type: String,
|
|
97
|
+
required: false
|
|
98
|
+
},
|
|
99
|
+
referenceEl: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const instanceId = inject(MagicMenuInstanceId, void 0);
|
|
105
|
+
const viewId = inject(MagicMenuViewId, void 0);
|
|
106
|
+
if (!instanceId) {
|
|
107
|
+
throw new Error("MagicMenuContent must be nested inside MagicMenuProvider");
|
|
108
|
+
}
|
|
109
|
+
if (!viewId) {
|
|
110
|
+
throw new Error("MagicMenuContent must be nested inside MagicMenuView");
|
|
111
|
+
}
|
|
112
|
+
const { getView, unselectView } = useMenuView(instanceId);
|
|
113
|
+
const view = getView(viewId);
|
|
114
|
+
const { initializeState } = useMenuState(instanceId);
|
|
115
|
+
const state = initializeState();
|
|
116
|
+
const pointerDisabled = computed(() => state.input.disabled.includes("pointer"));
|
|
117
|
+
const mappedTransition = computed(() => {
|
|
118
|
+
switch (true) {
|
|
119
|
+
case !!transition:
|
|
120
|
+
return transition;
|
|
121
|
+
case !!view?.parent.item:
|
|
122
|
+
return state.options.transition.content.nested;
|
|
123
|
+
case !!state.options.transition.content.default:
|
|
124
|
+
return state.options.transition.content.default;
|
|
125
|
+
default:
|
|
126
|
+
return ModeTransitions[state.options.mode];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const innerActive = shallowRef(false);
|
|
130
|
+
const wrapperActive = shallowRef(false);
|
|
131
|
+
const {
|
|
132
|
+
lockScroll,
|
|
133
|
+
unlockScroll,
|
|
134
|
+
addScrollLockPadding,
|
|
135
|
+
removeScrollLockPadding
|
|
136
|
+
} = useMenuDOM();
|
|
137
|
+
const {
|
|
138
|
+
onBeforeEnter,
|
|
139
|
+
onEnter,
|
|
140
|
+
onAfterEnter,
|
|
141
|
+
onBeforeLeave,
|
|
142
|
+
onLeave,
|
|
143
|
+
onAfterLeave
|
|
144
|
+
} = useMenuCallback({
|
|
145
|
+
state,
|
|
146
|
+
instanceId,
|
|
147
|
+
viewId,
|
|
148
|
+
innerActive,
|
|
149
|
+
wrapperActive,
|
|
150
|
+
lockScroll,
|
|
151
|
+
unlockScroll,
|
|
152
|
+
addScrollLockPadding,
|
|
153
|
+
removeScrollLockPadding
|
|
154
|
+
});
|
|
155
|
+
async function onOpen() {
|
|
156
|
+
wrapperActive.value = true;
|
|
157
|
+
await nextTick();
|
|
158
|
+
innerActive.value = true;
|
|
159
|
+
await nextTick();
|
|
160
|
+
initialize();
|
|
161
|
+
}
|
|
162
|
+
function onClose() {
|
|
163
|
+
destroy();
|
|
164
|
+
innerActive.value = false;
|
|
165
|
+
}
|
|
166
|
+
watch(
|
|
167
|
+
() => view?.active,
|
|
168
|
+
async (value) => {
|
|
169
|
+
if (value) {
|
|
170
|
+
await onOpen();
|
|
171
|
+
} else {
|
|
172
|
+
onClose();
|
|
123
173
|
}
|
|
124
|
-
|
|
125
|
-
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
const {
|
|
177
|
+
coords,
|
|
178
|
+
destroy,
|
|
179
|
+
initialize,
|
|
180
|
+
isInsideTriangle,
|
|
181
|
+
isInsideTo,
|
|
182
|
+
isInsideFrom
|
|
183
|
+
} = useMenuCursor(view, state.options.debug);
|
|
184
|
+
function disableCursor() {
|
|
185
|
+
state.input.disabled = [...state.input.disabled, "pointer"];
|
|
186
|
+
}
|
|
187
|
+
function enableCursor() {
|
|
188
|
+
state.input.disabled = state.input.disabled.filter((x) => x !== "pointer");
|
|
189
|
+
}
|
|
190
|
+
watch(isInsideTriangle, (value) => {
|
|
191
|
+
if (value) {
|
|
192
|
+
disableCursor();
|
|
193
|
+
} else {
|
|
194
|
+
enableCursor();
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
watch(isInsideTo, (value) => {
|
|
198
|
+
if (value) {
|
|
199
|
+
enableCursor();
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const isOutside = computed(
|
|
203
|
+
() => !isInsideTo.value && !isInsideFrom.value && !isInsideTriangle.value
|
|
204
|
+
);
|
|
205
|
+
watch(isOutside, (value, oldValue) => {
|
|
206
|
+
if (value && !oldValue) {
|
|
207
|
+
switch (state.options.mode) {
|
|
208
|
+
case "navigation":
|
|
209
|
+
const delay = state.options.delay?.mouseleave ?? ModeDelayMouseleave.navigation;
|
|
210
|
+
unselectView(viewId, delay);
|
|
126
211
|
}
|
|
127
|
-
watch(isInsideTriangle, (value) => {
|
|
128
|
-
if (value) {
|
|
129
|
-
disableCursor();
|
|
130
|
-
} else {
|
|
131
|
-
enableCursor();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
watch(isInsideTo, (value) => {
|
|
135
|
-
if (value) {
|
|
136
|
-
enableCursor();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
const isOutside = computed(
|
|
140
|
-
() => !isInsideTo.value && !isInsideFrom.value && !isInsideTriangle.value
|
|
141
|
-
);
|
|
142
|
-
watch(isOutside, (value, oldValue) => {
|
|
143
|
-
if (value && !oldValue) {
|
|
144
|
-
switch (state.options.mode) {
|
|
145
|
-
case "navigation":
|
|
146
|
-
const delay = state.options.delay?.mouseleave ?? ModeDelayMouseleave.navigation;
|
|
147
|
-
unselectView(viewId, delay);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
onBeforeUnmount(() => {
|
|
152
|
-
destroy();
|
|
153
|
-
});
|
|
154
|
-
provide(MagicMenuContentId, `${viewId}-content`);
|
|
155
|
-
return (_ctx, _cache) => {
|
|
156
|
-
const _component_magic_menu_float = _resolveComponent("magic-menu-float");
|
|
157
|
-
return wrapperActive.value ? (_openBlock(), _createBlock(_Teleport, {
|
|
158
|
-
key: 0,
|
|
159
|
-
to: "body"
|
|
160
|
-
}, [
|
|
161
|
-
_createVNode(_Transition, {
|
|
162
|
-
name: mappedTransition.value,
|
|
163
|
-
"on-before-enter": _unref(onBeforeEnter),
|
|
164
|
-
"on-enter": _unref(onEnter),
|
|
165
|
-
"on-after-enter": _unref(onAfterEnter),
|
|
166
|
-
"on-before-leave": _unref(onBeforeLeave),
|
|
167
|
-
"on-leave": _unref(onLeave),
|
|
168
|
-
"on-after-leave": _unref(onAfterLeave)
|
|
169
|
-
}, {
|
|
170
|
-
default: _withCtx(() => [
|
|
171
|
-
innerActive.value ? (_openBlock(), _createElementBlock("div", _mergeProps({
|
|
172
|
-
key: 0,
|
|
173
|
-
class: "magic-menu-content",
|
|
174
|
-
"data-id": `${_unref(viewId)}-content`
|
|
175
|
-
}, _ctx.$attrs), [
|
|
176
|
-
_createVNode(_component_magic_menu_float, {
|
|
177
|
-
placement: _unref(view)?.placement,
|
|
178
|
-
middleware: _ctx.middleware,
|
|
179
|
-
arrow: _ctx.arrow,
|
|
180
|
-
"reference-el": _ctx.referenceEl
|
|
181
|
-
}, _createSlots({
|
|
182
|
-
default: _withCtx(() => [
|
|
183
|
-
_createElementVNode("div", {
|
|
184
|
-
class: "magic-menu-content__inner",
|
|
185
|
-
"data-pointer-disabled": pointerDisabled.value
|
|
186
|
-
}, [
|
|
187
|
-
_renderSlot(_ctx.$slots, "default")
|
|
188
|
-
], 8, _hoisted_2)
|
|
189
|
-
]),
|
|
190
|
-
_: 2
|
|
191
|
-
/* DYNAMIC */
|
|
192
|
-
}, [
|
|
193
|
-
_ctx.$slots.arrow && _ctx.arrow ? {
|
|
194
|
-
name: "arrow",
|
|
195
|
-
fn: _withCtx(() => [
|
|
196
|
-
_renderSlot(_ctx.$slots, "arrow")
|
|
197
|
-
]),
|
|
198
|
-
key: "0"
|
|
199
|
-
} : void 0
|
|
200
|
-
]), 1032, ["placement", "middleware", "arrow", "reference-el"])
|
|
201
|
-
], 16, _hoisted_1)) : _createCommentVNode("v-if", true)
|
|
202
|
-
]),
|
|
203
|
-
_: 3
|
|
204
|
-
/* FORWARDED */
|
|
205
|
-
}, 8, ["name", "on-before-enter", "on-enter", "on-after-enter", "on-before-leave", "on-leave", "on-after-leave"]),
|
|
206
|
-
_unref(state).options.debug ? (_openBlock(true), _createElementBlock(
|
|
207
|
-
_Fragment,
|
|
208
|
-
{ key: 0 },
|
|
209
|
-
_renderList(_unref(coords), (point) => {
|
|
210
|
-
return _openBlock(), _createElementBlock(
|
|
211
|
-
"span",
|
|
212
|
-
{
|
|
213
|
-
key: `${point.x}${point.y}`,
|
|
214
|
-
style: _normalizeStyle({
|
|
215
|
-
background: "red",
|
|
216
|
-
position: "fixed",
|
|
217
|
-
top: point.y + "px",
|
|
218
|
-
left: point.x + "px",
|
|
219
|
-
width: "4px",
|
|
220
|
-
height: "4px",
|
|
221
|
-
zIndex: 1e3,
|
|
222
|
-
pointerEvents: "none",
|
|
223
|
-
transform: "translate(-50%, -50%)"
|
|
224
|
-
})
|
|
225
|
-
},
|
|
226
|
-
null,
|
|
227
|
-
4
|
|
228
|
-
/* STYLE */
|
|
229
|
-
);
|
|
230
|
-
}),
|
|
231
|
-
128
|
|
232
|
-
/* KEYED_FRAGMENT */
|
|
233
|
-
)) : _createCommentVNode("v-if", true)
|
|
234
|
-
])) : _createCommentVNode("v-if", true);
|
|
235
|
-
};
|
|
236
212
|
}
|
|
237
213
|
});
|
|
214
|
+
onBeforeUnmount(() => {
|
|
215
|
+
destroy();
|
|
216
|
+
});
|
|
217
|
+
provide(MagicMenuContentId, `${viewId}-content`);
|
|
238
218
|
</script>
|
|
239
219
|
|
|
240
220
|
<style>
|