@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,10 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div :data-id="mappedId" class="magic-menu-view">
|
|
3
|
+
<slot :view-active="view.active" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
5
8
|
import { computed, inject, onBeforeUnmount, provide, useId } from "vue";
|
|
6
9
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
7
10
|
import {
|
|
@@ -12,63 +15,54 @@ import {
|
|
|
12
15
|
MagicMenuViewActive
|
|
13
16
|
} from "../symbols";
|
|
14
17
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
placement: { type: null, required: false }
|
|
18
|
+
const { id, placement } = defineProps({
|
|
19
|
+
id: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: false
|
|
20
22
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const itemId = inject(MagicMenuItemId, void 0);
|
|
25
|
-
if (!instanceId) {
|
|
26
|
-
throw new Error("MagicMenuView must be nested inside MagicMenuProvider");
|
|
27
|
-
}
|
|
28
|
-
const mappedId = computed(() => __props.id ?? `magic-menu-view-${useId()}`);
|
|
29
|
-
const mappedParentTree = computed(() => [...parentTree, mappedId.value]);
|
|
30
|
-
const mappedActive = computed(() => view.active);
|
|
31
|
-
const { initializeView, deleteView } = useMenuView(instanceId);
|
|
32
|
-
const { initializeState } = useMenuState(instanceId);
|
|
33
|
-
const state = initializeState();
|
|
34
|
-
const mappedPlacement = computed(() => {
|
|
35
|
-
if (__props.placement) {
|
|
36
|
-
return __props.placement;
|
|
37
|
-
}
|
|
38
|
-
switch (state.options.mode) {
|
|
39
|
-
case "navigation":
|
|
40
|
-
return "bottom";
|
|
41
|
-
case "menubar":
|
|
42
|
-
return !itemId ? "bottom-start" : "right-start";
|
|
43
|
-
case "dropdown":
|
|
44
|
-
return !itemId ? "bottom" : "right-start";
|
|
45
|
-
case "context":
|
|
46
|
-
return "right-start";
|
|
47
|
-
default:
|
|
48
|
-
return void 0;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const view = initializeView({
|
|
52
|
-
id: mappedId.value,
|
|
53
|
-
parent: { views: parentTree, item: itemId ?? "" },
|
|
54
|
-
placement: mappedPlacement.value ?? "bottom"
|
|
55
|
-
});
|
|
56
|
-
provide(MagicMenuParentTree, mappedParentTree.value);
|
|
57
|
-
provide(MagicMenuViewId, mappedId.value);
|
|
58
|
-
provide(MagicMenuViewActive, mappedActive);
|
|
59
|
-
onBeforeUnmount(() => {
|
|
60
|
-
deleteView(mappedId.value);
|
|
61
|
-
});
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return _openBlock(), _createElementBlock("div", {
|
|
64
|
-
"data-id": mappedId.value,
|
|
65
|
-
class: "magic-menu-view"
|
|
66
|
-
}, [
|
|
67
|
-
_renderSlot(_ctx.$slots, "default", {
|
|
68
|
-
viewActive: _unref(view).active
|
|
69
|
-
})
|
|
70
|
-
], 8, _hoisted_1);
|
|
71
|
-
};
|
|
23
|
+
placement: {
|
|
24
|
+
type: null,
|
|
25
|
+
required: false
|
|
72
26
|
}
|
|
73
27
|
});
|
|
28
|
+
const parentTree = inject(MagicMenuParentTree, []);
|
|
29
|
+
const instanceId = inject(MagicMenuInstanceId, void 0);
|
|
30
|
+
const itemId = inject(MagicMenuItemId, void 0);
|
|
31
|
+
if (!instanceId) {
|
|
32
|
+
throw new Error("MagicMenuView must be nested inside MagicMenuProvider");
|
|
33
|
+
}
|
|
34
|
+
const mappedId = computed(() => id ?? `magic-menu-view-${useId()}`);
|
|
35
|
+
const mappedParentTree = computed(() => [...parentTree, mappedId.value]);
|
|
36
|
+
const mappedActive = computed(() => view.active);
|
|
37
|
+
const { initializeView, deleteView } = useMenuView(instanceId);
|
|
38
|
+
const { initializeState } = useMenuState(instanceId);
|
|
39
|
+
const state = initializeState();
|
|
40
|
+
const mappedPlacement = computed(() => {
|
|
41
|
+
if (placement) {
|
|
42
|
+
return placement;
|
|
43
|
+
}
|
|
44
|
+
switch (state.options.mode) {
|
|
45
|
+
case "navigation":
|
|
46
|
+
return "bottom";
|
|
47
|
+
case "menubar":
|
|
48
|
+
return !itemId ? "bottom-start" : "right-start";
|
|
49
|
+
case "dropdown":
|
|
50
|
+
return !itemId ? "bottom" : "right-start";
|
|
51
|
+
case "context":
|
|
52
|
+
return "right-start";
|
|
53
|
+
default:
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const view = initializeView({
|
|
58
|
+
id: mappedId.value,
|
|
59
|
+
parent: { views: parentTree, item: itemId ?? "" },
|
|
60
|
+
placement: mappedPlacement.value ?? "bottom"
|
|
61
|
+
});
|
|
62
|
+
provide(MagicMenuParentTree, mappedParentTree.value);
|
|
63
|
+
provide(MagicMenuViewId, mappedId.value);
|
|
64
|
+
provide(MagicMenuViewActive, mappedActive);
|
|
65
|
+
onBeforeUnmount(() => {
|
|
66
|
+
deleteView(mappedId.value);
|
|
67
|
+
});
|
|
74
68
|
</script>
|
|
@@ -4,7 +4,7 @@ interface MagicMenuViewProps {
|
|
|
4
4
|
placement?: Placement;
|
|
5
5
|
}
|
|
6
6
|
declare const mappedId: import("vue").ComputedRef<string>;
|
|
7
|
-
declare const view: import("../types").MenuView;
|
|
7
|
+
declare const view: import("../types/index.js").MenuView;
|
|
8
8
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
9
9
|
declare var __VLS_1: {
|
|
10
10
|
viewActive: boolean;
|
|
@@ -1,7 +1,52 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<teleport
|
|
3
|
+
v-if="wrapperActive"
|
|
4
|
+
:to="mappedOptions.teleport?.target"
|
|
5
|
+
:disabled="mappedOptions.teleport?.disabled"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
ref="modal"
|
|
9
|
+
class="magic-modal"
|
|
10
|
+
:data-id="mappedId"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
aria-modal="true"
|
|
13
|
+
@click.self="close"
|
|
14
|
+
>
|
|
15
|
+
<transition
|
|
16
|
+
v-if="mappedOptions.backdrop || !!$slots.backdrop"
|
|
17
|
+
:name="mappedOptions.transition?.backdrop"
|
|
18
|
+
>
|
|
19
|
+
<div
|
|
20
|
+
v-show="innerActive"
|
|
21
|
+
class="magic-modal__backdrop"
|
|
22
|
+
@click.self="close"
|
|
23
|
+
>
|
|
24
|
+
<slot name="backdrop" />
|
|
25
|
+
</div>
|
|
26
|
+
</transition>
|
|
27
|
+
<transition
|
|
28
|
+
:name="mappedOptions.transition?.content"
|
|
29
|
+
@before-leave="onBeforeLeave"
|
|
30
|
+
@leave="onLeave"
|
|
31
|
+
@after-leave="onAfterLeave"
|
|
32
|
+
@before-enter="onBeforeEnter"
|
|
33
|
+
@enter="onEnter"
|
|
34
|
+
@after-enter="onAfterEnter"
|
|
35
|
+
>
|
|
36
|
+
<component
|
|
37
|
+
:is="mappedOptions.tag"
|
|
38
|
+
v-show="innerActive"
|
|
39
|
+
class="magic-modal__content"
|
|
40
|
+
@click.self="close"
|
|
41
|
+
>
|
|
42
|
+
<slot />
|
|
43
|
+
</component>
|
|
44
|
+
</transition>
|
|
45
|
+
</div>
|
|
46
|
+
</teleport>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
5
50
|
import {
|
|
6
51
|
useTemplateRef,
|
|
7
52
|
shallowRef,
|
|
@@ -19,170 +64,99 @@ import { useModalCallback } from "../composables/private/useModalCallback";
|
|
|
19
64
|
import { useMagicModal } from "../composables/useMagicModal";
|
|
20
65
|
import "@maas/vue-equipment/utils/css/animations/fade-in.css";
|
|
21
66
|
import "@maas/vue-equipment/utils/css/animations/fade-out.css";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
67
|
+
defineOptions({
|
|
68
|
+
inheritAttrs: false
|
|
69
|
+
});
|
|
70
|
+
const customDefu = createDefu((obj, key, value) => {
|
|
71
|
+
if (key === "close") {
|
|
72
|
+
obj[key] = value;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const { id, options = {} } = defineProps({
|
|
77
|
+
id: {
|
|
78
|
+
type: null,
|
|
79
|
+
required: true
|
|
25
80
|
},
|
|
26
|
-
__name: "MagicModal",
|
|
27
81
|
props: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
options: { type: Object, required: false, default: () => ({}) }
|
|
82
|
+
type: Object,
|
|
83
|
+
required: false
|
|
31
84
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
onKeyStroke(key, (e) => {
|
|
84
|
-
close();
|
|
85
|
-
e.preventDefault();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
watch(isActive, async (value) => {
|
|
90
|
-
if (value) {
|
|
91
|
-
await onOpen();
|
|
92
|
-
} else {
|
|
93
|
-
onClose();
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
onBeforeUnmount(() => {
|
|
85
|
+
options: {
|
|
86
|
+
type: Object,
|
|
87
|
+
required: false
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const mappedOptions = customDefu(options, defaultOptions);
|
|
91
|
+
const mappedId = toValue(id);
|
|
92
|
+
const modalRef = useTemplateRef("modal");
|
|
93
|
+
const {
|
|
94
|
+
trapFocus,
|
|
95
|
+
releaseFocus,
|
|
96
|
+
lockScroll,
|
|
97
|
+
unlockScroll,
|
|
98
|
+
addScrollLockPadding,
|
|
99
|
+
removeScrollLockPadding
|
|
100
|
+
} = useModalDOM({
|
|
101
|
+
focusTarget: modalRef,
|
|
102
|
+
focusTrap: mappedOptions.focusTrap
|
|
103
|
+
});
|
|
104
|
+
const { isActive, close } = useMagicModal(id);
|
|
105
|
+
const innerActive = shallowRef(false);
|
|
106
|
+
const wrapperActive = shallowRef(false);
|
|
107
|
+
const {
|
|
108
|
+
onBeforeEnter,
|
|
109
|
+
onEnter,
|
|
110
|
+
onAfterEnter,
|
|
111
|
+
onBeforeLeave,
|
|
112
|
+
onLeave,
|
|
113
|
+
onAfterLeave
|
|
114
|
+
} = useModalCallback({
|
|
115
|
+
id,
|
|
116
|
+
mappedOptions,
|
|
117
|
+
addScrollLockPadding,
|
|
118
|
+
removeScrollLockPadding,
|
|
119
|
+
lockScroll,
|
|
120
|
+
unlockScroll,
|
|
121
|
+
trapFocus,
|
|
122
|
+
releaseFocus,
|
|
123
|
+
wrapperActive
|
|
124
|
+
});
|
|
125
|
+
async function onOpen() {
|
|
126
|
+
wrapperActive.value = true;
|
|
127
|
+
await nextTick();
|
|
128
|
+
innerActive.value = true;
|
|
129
|
+
}
|
|
130
|
+
function onClose() {
|
|
131
|
+
innerActive.value = false;
|
|
132
|
+
}
|
|
133
|
+
if (mappedOptions.keyListener?.close) {
|
|
134
|
+
for (const key of mappedOptions.keyListener.close) {
|
|
135
|
+
onKeyStroke(key, (e) => {
|
|
97
136
|
close();
|
|
137
|
+
e.preventDefault();
|
|
98
138
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, _ctx.$attrs, {
|
|
121
|
-
"aria-modal": "true",
|
|
122
|
-
onClick: _cache[1] || (_cache[1] = _withModifiers(
|
|
123
|
-
//@ts-ignore
|
|
124
|
-
(...args) => _unref(close) && _unref(close)(...args),
|
|
125
|
-
["self"]
|
|
126
|
-
))
|
|
127
|
-
}), [
|
|
128
|
-
_unref(mappedOptions).backdrop || !!_ctx.$slots.backdrop ? (_openBlock(), _createBlock(_Transition, {
|
|
129
|
-
key: 0,
|
|
130
|
-
name: _unref(mappedOptions).transition?.backdrop,
|
|
131
|
-
persisted: ""
|
|
132
|
-
}, {
|
|
133
|
-
default: _withCtx(() => [
|
|
134
|
-
_withDirectives(_createElementVNode(
|
|
135
|
-
"div",
|
|
136
|
-
{
|
|
137
|
-
class: "magic-modal__backdrop",
|
|
138
|
-
onClick: _cache[0] || (_cache[0] = _withModifiers(
|
|
139
|
-
//@ts-ignore
|
|
140
|
-
(...args) => _unref(close) && _unref(close)(...args),
|
|
141
|
-
["self"]
|
|
142
|
-
))
|
|
143
|
-
},
|
|
144
|
-
[
|
|
145
|
-
_renderSlot(_ctx.$slots, "backdrop")
|
|
146
|
-
],
|
|
147
|
-
512
|
|
148
|
-
/* NEED_PATCH */
|
|
149
|
-
), [
|
|
150
|
-
[_vShow, innerActive.value]
|
|
151
|
-
])
|
|
152
|
-
]),
|
|
153
|
-
_: 3
|
|
154
|
-
/* FORWARDED */
|
|
155
|
-
}, 8, ["name"])) : _createCommentVNode("v-if", true),
|
|
156
|
-
_createVNode(_Transition, {
|
|
157
|
-
name: _unref(mappedOptions).transition?.content,
|
|
158
|
-
onBeforeLeave: _unref(onBeforeLeave),
|
|
159
|
-
onLeave: _unref(onLeave),
|
|
160
|
-
onAfterLeave: _unref(onAfterLeave),
|
|
161
|
-
onBeforeEnter: _unref(onBeforeEnter),
|
|
162
|
-
onEnter: _unref(onEnter),
|
|
163
|
-
onAfterEnter: _unref(onAfterEnter),
|
|
164
|
-
persisted: ""
|
|
165
|
-
}, {
|
|
166
|
-
default: _withCtx(() => [
|
|
167
|
-
_withDirectives((_openBlock(), _createBlock(_resolveDynamicComponent(_unref(mappedOptions).tag), {
|
|
168
|
-
class: "magic-modal__content",
|
|
169
|
-
onClick: _withModifiers(_unref(close), ["self"])
|
|
170
|
-
}, {
|
|
171
|
-
default: _withCtx(() => [
|
|
172
|
-
_renderSlot(_ctx.$slots, "default")
|
|
173
|
-
]),
|
|
174
|
-
_: 3
|
|
175
|
-
/* FORWARDED */
|
|
176
|
-
}, 8, ["onClick"])), [
|
|
177
|
-
[_vShow, innerActive.value]
|
|
178
|
-
])
|
|
179
|
-
]),
|
|
180
|
-
_: 3
|
|
181
|
-
/* FORWARDED */
|
|
182
|
-
}, 8, ["name", "onBeforeLeave", "onLeave", "onAfterLeave", "onBeforeEnter", "onEnter", "onAfterEnter"])
|
|
183
|
-
], 16, _hoisted_1)
|
|
184
|
-
], 8, ["to", "disabled"])) : _createCommentVNode("v-if", true);
|
|
185
|
-
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
watch(isActive, async (value) => {
|
|
142
|
+
if (value) {
|
|
143
|
+
await onOpen();
|
|
144
|
+
} else {
|
|
145
|
+
onClose();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
onBeforeUnmount(() => {
|
|
149
|
+
close();
|
|
150
|
+
});
|
|
151
|
+
onUnmounted(() => {
|
|
152
|
+
if (mappedOptions.scrollLock) {
|
|
153
|
+
unlockScroll();
|
|
154
|
+
if (typeof mappedOptions.scrollLock === "object" && mappedOptions.scrollLock.padding) {
|
|
155
|
+
removeScrollLockPadding();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (mappedOptions.focusTrap) {
|
|
159
|
+
releaseFocus();
|
|
186
160
|
}
|
|
187
161
|
});
|
|
188
162
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
2
|
import type { MagicModalOptions } from './../types/index.js';
|
|
3
3
|
import '@maas/vue-equipment/utils/css/animations/fade-in.css';
|
|
4
4
|
import '@maas/vue-equipment/utils/css/animations/fade-out.css';
|
|
@@ -7,13 +7,9 @@ interface MagicModalProps {
|
|
|
7
7
|
props?: Record<string, unknown>;
|
|
8
8
|
options?: MagicModalOptions;
|
|
9
9
|
}
|
|
10
|
-
declare const mappedOptions: Omit<MagicModalOptions, keyof MagicModalOptions> & Omit<import("../../../../utils").RequireAll<MagicModalOptions>, keyof MagicModalOptions> & {
|
|
11
|
-
transition: {
|
|
12
|
-
content?: string;
|
|
13
|
-
backdrop?: string;
|
|
14
|
-
};
|
|
10
|
+
declare const mappedOptions: Omit<MagicModalOptions, keyof MagicModalOptions> & Omit<import("../../../../utils/index.js").RequireAll<MagicModalOptions>, keyof MagicModalOptions> & {
|
|
15
11
|
backdrop: boolean;
|
|
16
|
-
tag: "
|
|
12
|
+
tag: "dialog" | "div";
|
|
17
13
|
focusTrap: boolean | import("focus-trap").Options;
|
|
18
14
|
scrollLock: boolean | {
|
|
19
15
|
padding: boolean;
|
|
@@ -22,10 +18,15 @@ declare const mappedOptions: Omit<MagicModalOptions, keyof MagicModalOptions> &
|
|
|
22
18
|
target?: string;
|
|
23
19
|
disabled?: boolean;
|
|
24
20
|
};
|
|
21
|
+
transition: {
|
|
22
|
+
content?: string;
|
|
23
|
+
backdrop?: string;
|
|
24
|
+
};
|
|
25
25
|
keyListener: {
|
|
26
26
|
close?: string[] | false;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
declare const mappedId: string;
|
|
29
30
|
declare const close: () => void;
|
|
30
31
|
declare const innerActive: import("vue").ShallowRef<boolean, boolean>;
|
|
31
32
|
declare const wrapperActive: import("vue").ShallowRef<boolean, boolean>;
|
|
@@ -38,8 +39,8 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
38
39
|
default?: (props: typeof __VLS_32) => any;
|
|
39
40
|
}>;
|
|
40
41
|
declare const __VLS_self: import("vue").DefineComponent<MagicModalProps, {
|
|
41
|
-
toValue: typeof toValue;
|
|
42
42
|
mappedOptions: typeof mappedOptions;
|
|
43
|
+
mappedId: typeof mappedId;
|
|
43
44
|
close: typeof close;
|
|
44
45
|
innerActive: typeof innerActive;
|
|
45
46
|
wrapperActive: typeof wrapperActive;
|
|
@@ -1,87 +1,62 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
ref: "offCanvas",
|
|
12
|
-
class: "magic-noise__off-canvas"
|
|
13
|
-
};
|
|
1
|
+
<template>
|
|
2
|
+
<div class="magic-noise" :data-loading="!isReady">
|
|
3
|
+
<div class="magic-noise__inner">
|
|
4
|
+
<canvas ref="canvas" class="magic-noise__canvas" />
|
|
5
|
+
<canvas ref="offCanvas" class="magic-noise__off-canvas" />
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
14
11
|
import { onMounted, onUnmounted, watch, useTemplateRef } from "vue";
|
|
15
12
|
import { useResizeObserver, useDebounceFn } from "@vueuse/core";
|
|
16
13
|
import { useNoiseApi } from "../composables/private/useNoiseApi";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
pause: { type: Boolean, required: false, default: false }
|
|
14
|
+
const { pause = false, options } = defineProps({
|
|
15
|
+
options: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: false
|
|
22
18
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
transferControls.value?.resume();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
onMounted(() => {
|
|
53
|
-
throttledDraw();
|
|
54
|
-
throttledRotateAndTransfer();
|
|
55
|
-
});
|
|
56
|
-
onUnmounted(() => {
|
|
57
|
-
isReady.value = false;
|
|
58
|
-
transferControls.value?.pause();
|
|
19
|
+
pause: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: false
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const canvasRef = useTemplateRef("canvas");
|
|
25
|
+
const offCanvasRef = useTemplateRef("offCanvas");
|
|
26
|
+
const noiseApi = useNoiseApi({
|
|
27
|
+
canvasRef,
|
|
28
|
+
offCanvasRef,
|
|
29
|
+
options
|
|
30
|
+
});
|
|
31
|
+
const {
|
|
32
|
+
initialize,
|
|
33
|
+
drawControls,
|
|
34
|
+
transferControls,
|
|
35
|
+
throttledDraw,
|
|
36
|
+
throttledRotateAndTransfer,
|
|
37
|
+
isReady
|
|
38
|
+
} = noiseApi;
|
|
39
|
+
useResizeObserver(canvasRef, useDebounceFn(initialize, 100));
|
|
40
|
+
watch(
|
|
41
|
+
() => pause,
|
|
42
|
+
(pause2) => {
|
|
43
|
+
if (pause2) {
|
|
59
44
|
drawControls.value?.pause();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
_createElementVNode("div", _hoisted_2, [
|
|
67
|
-
_createElementVNode(
|
|
68
|
-
"canvas",
|
|
69
|
-
_hoisted_3,
|
|
70
|
-
null,
|
|
71
|
-
512
|
|
72
|
-
/* NEED_PATCH */
|
|
73
|
-
),
|
|
74
|
-
_createElementVNode(
|
|
75
|
-
"canvas",
|
|
76
|
-
_hoisted_4,
|
|
77
|
-
null,
|
|
78
|
-
512
|
|
79
|
-
/* NEED_PATCH */
|
|
80
|
-
)
|
|
81
|
-
])
|
|
82
|
-
], 8, _hoisted_1);
|
|
83
|
-
};
|
|
45
|
+
transferControls.value?.pause();
|
|
46
|
+
} else {
|
|
47
|
+
drawControls.value?.resume();
|
|
48
|
+
transferControls.value?.resume();
|
|
49
|
+
}
|
|
84
50
|
}
|
|
51
|
+
);
|
|
52
|
+
onMounted(() => {
|
|
53
|
+
throttledDraw();
|
|
54
|
+
throttledRotateAndTransfer();
|
|
55
|
+
});
|
|
56
|
+
onUnmounted(() => {
|
|
57
|
+
isReady.value = false;
|
|
58
|
+
transferControls.value?.pause();
|
|
59
|
+
drawControls.value?.pause();
|
|
85
60
|
});
|
|
86
61
|
</script>
|
|
87
62
|
|