@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,40 +1,36 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="magic-scroll-provider">
|
|
3
|
+
<slot :scroll-return="scrollReturn" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
5
8
|
import { provide, computed } from "vue";
|
|
6
9
|
import { useScroll, unrefElement } from "@vueuse/core";
|
|
7
10
|
import { MagicScrollReturn, MagicScrollTarget } from "../symbols";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const providedTarget = computed(() => {
|
|
25
|
-
if (__props.target) {
|
|
26
|
-
return unrefElement(__props.target);
|
|
27
|
-
}
|
|
11
|
+
const { target } = defineProps({
|
|
12
|
+
target: {
|
|
13
|
+
type: null,
|
|
14
|
+
required: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const mappedTarget = computed(() => {
|
|
18
|
+
switch (true) {
|
|
19
|
+
case !!target:
|
|
20
|
+
return unrefElement(target);
|
|
21
|
+
case typeof window !== "undefined":
|
|
22
|
+
return window;
|
|
23
|
+
default:
|
|
28
24
|
return void 0;
|
|
29
|
-
});
|
|
30
|
-
const scrollReturn = useScroll(mappedTarget);
|
|
31
|
-
provide(MagicScrollReturn, scrollReturn);
|
|
32
|
-
provide(MagicScrollTarget, providedTarget);
|
|
33
|
-
return (_ctx, _cache) => {
|
|
34
|
-
return _openBlock(), _createElementBlock("div", _hoisted_1, [
|
|
35
|
-
_renderSlot(_ctx.$slots, "default", { scrollReturn: _unref(scrollReturn) })
|
|
36
|
-
]);
|
|
37
|
-
};
|
|
38
25
|
}
|
|
39
26
|
});
|
|
27
|
+
const providedTarget = computed(() => {
|
|
28
|
+
if (target) {
|
|
29
|
+
return unrefElement(target);
|
|
30
|
+
}
|
|
31
|
+
return void 0;
|
|
32
|
+
});
|
|
33
|
+
const scrollReturn = useScroll(mappedTarget);
|
|
34
|
+
provide(MagicScrollReturn, scrollReturn);
|
|
35
|
+
provide(MagicScrollTarget, providedTarget);
|
|
40
36
|
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="el" class="magic-scroll-scene">
|
|
3
|
+
<slot :progress="progress" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
8
|
import {
|
|
9
9
|
shallowRef,
|
|
10
10
|
provide,
|
|
@@ -21,69 +21,59 @@ import {
|
|
|
21
21
|
MagicScrollProgress,
|
|
22
22
|
MagicScrollReturn
|
|
23
23
|
} from "../symbols";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
to: { type: String, required: false, default: "bottom-top" }
|
|
24
|
+
const { from = "top-bottom", to = "bottom-top" } = defineProps({
|
|
25
|
+
from: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
29
28
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!scrollTarget) {
|
|
34
|
-
console.error("MagicScrollScene must be used within a MagicScrollProvider");
|
|
35
|
-
}
|
|
36
|
-
const progress = shallowRef(0);
|
|
37
|
-
const intersecting = shallowRef(false);
|
|
38
|
-
const elRef = useTemplateRef("el");
|
|
39
|
-
const { getCalculations, getProgress } = useScrollApi({
|
|
40
|
-
child: elRef,
|
|
41
|
-
parent: scrollTarget,
|
|
42
|
-
from: __props.from,
|
|
43
|
-
to: __props.to
|
|
44
|
-
});
|
|
45
|
-
async function calculate() {
|
|
46
|
-
getCalculations();
|
|
47
|
-
await nextTick();
|
|
48
|
-
progress.value = getProgress();
|
|
49
|
-
}
|
|
50
|
-
watch(
|
|
51
|
-
() => scrollReturn?.y.value,
|
|
52
|
-
() => {
|
|
53
|
-
if (intersecting.value) {
|
|
54
|
-
calculate();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
watch(
|
|
59
|
-
() => scrollReturn?.y.value,
|
|
60
|
-
() => {
|
|
61
|
-
calculate();
|
|
62
|
-
},
|
|
63
|
-
{ once: true }
|
|
64
|
-
);
|
|
65
|
-
useIntersectionObserver(
|
|
66
|
-
elRef,
|
|
67
|
-
([{ isIntersecting }]) => {
|
|
68
|
-
intersecting.value = isIntersecting;
|
|
69
|
-
if (isIntersecting) {
|
|
70
|
-
calculate();
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{ rootMargin: "150% 0px 150% 0px", immediate: true }
|
|
74
|
-
);
|
|
75
|
-
provide(MagicScrollProgress, readonly(progress));
|
|
76
|
-
return (_ctx, _cache) => {
|
|
77
|
-
return _openBlock(), _createElementBlock(
|
|
78
|
-
"div",
|
|
79
|
-
_hoisted_1,
|
|
80
|
-
[
|
|
81
|
-
_renderSlot(_ctx.$slots, "default", { progress: progress.value })
|
|
82
|
-
],
|
|
83
|
-
512
|
|
84
|
-
/* NEED_PATCH */
|
|
85
|
-
);
|
|
86
|
-
};
|
|
29
|
+
to: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false
|
|
87
32
|
}
|
|
88
33
|
});
|
|
34
|
+
const scrollReturn = inject(MagicScrollReturn, void 0);
|
|
35
|
+
const scrollTarget = inject(MagicScrollTarget, void 0);
|
|
36
|
+
if (!scrollTarget) {
|
|
37
|
+
console.error("MagicScrollScene must be used within a MagicScrollProvider");
|
|
38
|
+
}
|
|
39
|
+
const progress = shallowRef(0);
|
|
40
|
+
const intersecting = shallowRef(false);
|
|
41
|
+
const elRef = useTemplateRef("el");
|
|
42
|
+
const { getCalculations, getProgress } = useScrollApi({
|
|
43
|
+
child: elRef,
|
|
44
|
+
parent: scrollTarget,
|
|
45
|
+
from,
|
|
46
|
+
to
|
|
47
|
+
});
|
|
48
|
+
async function calculate() {
|
|
49
|
+
getCalculations();
|
|
50
|
+
await nextTick();
|
|
51
|
+
progress.value = getProgress();
|
|
52
|
+
}
|
|
53
|
+
watch(
|
|
54
|
+
() => scrollReturn?.y.value,
|
|
55
|
+
() => {
|
|
56
|
+
if (intersecting.value) {
|
|
57
|
+
calculate();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
watch(
|
|
62
|
+
() => scrollReturn?.y.value,
|
|
63
|
+
() => {
|
|
64
|
+
calculate();
|
|
65
|
+
},
|
|
66
|
+
{ once: true }
|
|
67
|
+
);
|
|
68
|
+
useIntersectionObserver(
|
|
69
|
+
elRef,
|
|
70
|
+
([{ isIntersecting }]) => {
|
|
71
|
+
intersecting.value = isIntersecting;
|
|
72
|
+
if (isIntersecting) {
|
|
73
|
+
calculate();
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{ rootMargin: "150% 0px 150% 0px", immediate: true }
|
|
77
|
+
);
|
|
78
|
+
provide(MagicScrollProgress, readonly(progress));
|
|
89
79
|
</script>
|
|
@@ -1,7 +1,47 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<teleport
|
|
3
|
+
:to="state.options.teleport?.target"
|
|
4
|
+
:disabled="state.options.teleport?.disabled"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
:data-id="mappedId"
|
|
8
|
+
:data-position="state.options.position"
|
|
9
|
+
:data-expanded="state.expanded"
|
|
10
|
+
class="magic-toast-provider"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<transition-group
|
|
14
|
+
ref="list"
|
|
15
|
+
tag="ol"
|
|
16
|
+
class="magic-toast-provider__list"
|
|
17
|
+
:name="state.options.transition"
|
|
18
|
+
:on-before-enter="onBeforeEnter"
|
|
19
|
+
:on-enter="onEnter"
|
|
20
|
+
:on-after-enter="onAfterEnter"
|
|
21
|
+
:on-before-leave="onBeforeLeave"
|
|
22
|
+
:on-leave="onLeave"
|
|
23
|
+
:on-after-leave="onAfterLeave"
|
|
24
|
+
@mouseenter="onMouseenter"
|
|
25
|
+
@mouseleave="onMouseleave"
|
|
26
|
+
>
|
|
27
|
+
<magic-toast-view
|
|
28
|
+
v-for="(view, index) in state.views"
|
|
29
|
+
:id="view.id"
|
|
30
|
+
:key="view.id"
|
|
31
|
+
:index="index"
|
|
32
|
+
>
|
|
33
|
+
<component
|
|
34
|
+
:is="view.component"
|
|
35
|
+
v-bind="view.props"
|
|
36
|
+
@remove="deleteView(view.id)"
|
|
37
|
+
/>
|
|
38
|
+
</magic-toast-view>
|
|
39
|
+
</transition-group>
|
|
40
|
+
</div>
|
|
41
|
+
</teleport>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
5
45
|
import {
|
|
6
46
|
toValue,
|
|
7
47
|
useTemplateRef,
|
|
@@ -13,7 +53,6 @@ import { onClickOutside } from "@vueuse/core";
|
|
|
13
53
|
import { useToastState } from "../composables/private/useToastState";
|
|
14
54
|
import { useToastView } from "../composables/private/useToastView";
|
|
15
55
|
import { useToastCallback } from "../composables/private/useToastCallback";
|
|
16
|
-
import MagicToastView from "./MagicToastView.vue";
|
|
17
56
|
import { MagicToastInstanceId } from "../../symbols";
|
|
18
57
|
import "@maas/vue-equipment/utils/css/animations/fade-out.css";
|
|
19
58
|
import "@maas/vue-equipment/utils/css/animations/squash-y.css";
|
|
@@ -22,99 +61,47 @@ import "@maas/vue-equipment/utils/css/animations/slide-ltr-out.css";
|
|
|
22
61
|
import "@maas/vue-equipment/utils/css/animations/slide-rtl-in.css";
|
|
23
62
|
import "@maas/vue-equipment/utils/css/animations/slide-rtl-out.css";
|
|
24
63
|
import { useToastListener } from "../composables/private/useToastListener";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
64
|
+
const { id, options } = defineProps({
|
|
65
|
+
id: {
|
|
66
|
+
type: null,
|
|
67
|
+
required: true
|
|
28
68
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
69
|
+
options: {
|
|
70
|
+
type: Object,
|
|
71
|
+
required: false
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const mappedId = toValue(id);
|
|
75
|
+
defineOptions({
|
|
76
|
+
inheritAttrs: false
|
|
77
|
+
});
|
|
78
|
+
const { deleteView } = useToastView(id);
|
|
79
|
+
const { deleteState, initializeState } = useToastState(id);
|
|
80
|
+
const state = initializeState(options);
|
|
81
|
+
const listRef = useTemplateRef("list");
|
|
82
|
+
const {
|
|
83
|
+
onBeforeEnter,
|
|
84
|
+
onEnter,
|
|
85
|
+
onAfterEnter,
|
|
86
|
+
onBeforeLeave,
|
|
87
|
+
onLeave,
|
|
88
|
+
onAfterLeave
|
|
89
|
+
} = useToastCallback(id);
|
|
90
|
+
const { onMouseenter, onMouseleave, outsideClickCallback } = useToastListener(id);
|
|
91
|
+
onClickOutside(listRef, outsideClickCallback);
|
|
92
|
+
watch(
|
|
93
|
+
() => options,
|
|
94
|
+
(value) => {
|
|
95
|
+
initializeState(value);
|
|
33
96
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const { deleteState, initializeState } = useToastState(__props.id);
|
|
37
|
-
const state = initializeState(__props.options);
|
|
38
|
-
const listRef = useTemplateRef("list");
|
|
39
|
-
const {
|
|
40
|
-
onBeforeEnter,
|
|
41
|
-
onEnter,
|
|
42
|
-
onAfterEnter,
|
|
43
|
-
onBeforeLeave,
|
|
44
|
-
onLeave,
|
|
45
|
-
onAfterLeave
|
|
46
|
-
} = useToastCallback(__props.id);
|
|
47
|
-
const { onMouseenter, onMouseleave, outsideClickCallback } = useToastListener(__props.id);
|
|
48
|
-
onClickOutside(listRef, outsideClickCallback);
|
|
49
|
-
watch(
|
|
50
|
-
() => __props.options,
|
|
51
|
-
(value) => {
|
|
52
|
-
initializeState(value);
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
deep: true
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
onBeforeUnmount(() => {
|
|
59
|
-
deleteState();
|
|
60
|
-
});
|
|
61
|
-
provide(MagicToastInstanceId, __props.id);
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return _openBlock(), _createBlock(_Teleport, {
|
|
64
|
-
to: _unref(state).options.teleport?.target,
|
|
65
|
-
disabled: _unref(state).options.teleport?.disabled
|
|
66
|
-
}, [
|
|
67
|
-
_createElementVNode("div", _mergeProps({
|
|
68
|
-
"data-id": toValue(_ctx.id),
|
|
69
|
-
"data-position": _unref(state).options.position,
|
|
70
|
-
"data-expanded": _unref(state).expanded,
|
|
71
|
-
class: "magic-toast-provider"
|
|
72
|
-
}, _ctx.$attrs), [
|
|
73
|
-
_createVNode(_TransitionGroup, {
|
|
74
|
-
ref: "list",
|
|
75
|
-
tag: "ol",
|
|
76
|
-
class: "magic-toast-provider__list",
|
|
77
|
-
name: _unref(state).options.transition,
|
|
78
|
-
"on-before-enter": _unref(onBeforeEnter),
|
|
79
|
-
"on-enter": _unref(onEnter),
|
|
80
|
-
"on-after-enter": _unref(onAfterEnter),
|
|
81
|
-
"on-before-leave": _unref(onBeforeLeave),
|
|
82
|
-
"on-leave": _unref(onLeave),
|
|
83
|
-
"on-after-leave": _unref(onAfterLeave),
|
|
84
|
-
onMouseenter: _unref(onMouseenter),
|
|
85
|
-
onMouseleave: _unref(onMouseleave)
|
|
86
|
-
}, {
|
|
87
|
-
default: _withCtx(() => [
|
|
88
|
-
(_openBlock(true), _createElementBlock(
|
|
89
|
-
_Fragment,
|
|
90
|
-
null,
|
|
91
|
-
_renderList(_unref(state).views, (view, index) => {
|
|
92
|
-
return _openBlock(), _createBlock(MagicToastView, {
|
|
93
|
-
id: view.id,
|
|
94
|
-
key: view.id,
|
|
95
|
-
index
|
|
96
|
-
}, {
|
|
97
|
-
default: _withCtx(() => [
|
|
98
|
-
(_openBlock(), _createBlock(_resolveDynamicComponent(view.component), _mergeProps({ ref_for: true }, view.props, {
|
|
99
|
-
onRemove: ($event) => _unref(deleteView)(view.id)
|
|
100
|
-
}), null, 16, ["onRemove"]))
|
|
101
|
-
]),
|
|
102
|
-
_: 2
|
|
103
|
-
/* DYNAMIC */
|
|
104
|
-
}, 1032, ["id", "index"]);
|
|
105
|
-
}),
|
|
106
|
-
128
|
|
107
|
-
/* KEYED_FRAGMENT */
|
|
108
|
-
))
|
|
109
|
-
]),
|
|
110
|
-
_: 1
|
|
111
|
-
/* STABLE */
|
|
112
|
-
}, 8, ["name", "on-before-enter", "on-enter", "on-after-enter", "on-before-leave", "on-leave", "on-after-leave", "onMouseenter", "onMouseleave"])
|
|
113
|
-
], 16, _hoisted_1)
|
|
114
|
-
], 8, ["to", "disabled"]);
|
|
115
|
-
};
|
|
97
|
+
{
|
|
98
|
+
deep: true
|
|
116
99
|
}
|
|
100
|
+
);
|
|
101
|
+
onBeforeUnmount(() => {
|
|
102
|
+
deleteState();
|
|
117
103
|
});
|
|
104
|
+
provide(MagicToastInstanceId, id);
|
|
118
105
|
</script>
|
|
119
106
|
|
|
120
107
|
<style>
|
|
@@ -1,81 +1,63 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
class="magic-toast-view"
|
|
4
|
+
:data-id="id"
|
|
5
|
+
:data-expanded="state.expanded"
|
|
6
|
+
:data-dragging="view.dragging"
|
|
7
|
+
:data-position="state.options.position"
|
|
8
|
+
:data-debug="state.options.debug"
|
|
9
|
+
:style="{
|
|
10
|
+
'--mt-index': reversedIndex,
|
|
11
|
+
'--mt-offset': offset,
|
|
12
|
+
'--mt-height': height
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
class="magic-toast-view__inner"
|
|
17
|
+
@pointerdown="onPointerdown"
|
|
18
|
+
@click="onClick"
|
|
19
|
+
>
|
|
20
|
+
<div :style="style" class="magic-toast-view__drag">
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</li>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
5
28
|
import { computed, inject } from "vue";
|
|
6
29
|
import { MagicToastInstanceId } from "../../symbols";
|
|
7
30
|
import { useToastState } from "../composables/private/useToastState";
|
|
8
31
|
import { useToastDrag } from "../composables/private/useToastDrag";
|
|
9
32
|
import "@maas/vue-equipment/utils/css/transitions/fade.css";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
index: { type: Number, required: true }
|
|
33
|
+
const { id, index } = defineProps({
|
|
34
|
+
id: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true
|
|
15
37
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw new Error("MagicToastView must be used within a MagicToastProvider");
|
|
20
|
-
}
|
|
21
|
-
const { initializeState } = useToastState(instanceId);
|
|
22
|
-
const state = initializeState();
|
|
23
|
-
const count = computed(() => state.views.length);
|
|
24
|
-
const view = computed(() => state.views[__props.index]);
|
|
25
|
-
const reversedIndex = computed(() => count.value - __props.index - 1);
|
|
26
|
-
const height = computed(() => `${view.value.dimensions?.height}px`);
|
|
27
|
-
const offset = computed(() => {
|
|
28
|
-
const mapped = state.views.slice(0, reversedIndex.value).reduce((acc, view2) => acc + (view2.dimensions?.height ?? 0), 0);
|
|
29
|
-
return `${mapped}px`;
|
|
30
|
-
});
|
|
31
|
-
const { style, onPointerdown, onClick } = useToastDrag({
|
|
32
|
-
view: view.value,
|
|
33
|
-
instanceId
|
|
34
|
-
});
|
|
35
|
-
return (_ctx, _cache) => {
|
|
36
|
-
return _openBlock(), _createElementBlock("li", {
|
|
37
|
-
class: "magic-toast-view",
|
|
38
|
-
"data-id": _ctx.id,
|
|
39
|
-
"data-expanded": _unref(state).expanded,
|
|
40
|
-
"data-dragging": view.value.dragging,
|
|
41
|
-
"data-position": _unref(state).options.position,
|
|
42
|
-
"data-debug": _unref(state).options.debug,
|
|
43
|
-
style: _normalizeStyle({
|
|
44
|
-
"--mt-index": reversedIndex.value,
|
|
45
|
-
"--mt-offset": offset.value,
|
|
46
|
-
"--mt-height": height.value
|
|
47
|
-
})
|
|
48
|
-
}, [
|
|
49
|
-
_createElementVNode(
|
|
50
|
-
"div",
|
|
51
|
-
{
|
|
52
|
-
class: "magic-toast-view__inner",
|
|
53
|
-
onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
|
|
54
|
-
(...args) => _unref(onPointerdown) && _unref(onPointerdown)(...args)),
|
|
55
|
-
onClick: _cache[1] || (_cache[1] = //@ts-ignore
|
|
56
|
-
(...args) => _unref(onClick) && _unref(onClick)(...args))
|
|
57
|
-
},
|
|
58
|
-
[
|
|
59
|
-
_createElementVNode(
|
|
60
|
-
"div",
|
|
61
|
-
{
|
|
62
|
-
style: _normalizeStyle(_unref(style)),
|
|
63
|
-
class: "magic-toast-view__drag"
|
|
64
|
-
},
|
|
65
|
-
[
|
|
66
|
-
_renderSlot(_ctx.$slots, "default")
|
|
67
|
-
],
|
|
68
|
-
4
|
|
69
|
-
/* STYLE */
|
|
70
|
-
)
|
|
71
|
-
],
|
|
72
|
-
32
|
|
73
|
-
/* NEED_HYDRATION */
|
|
74
|
-
)
|
|
75
|
-
], 12, _hoisted_1);
|
|
76
|
-
};
|
|
38
|
+
index: {
|
|
39
|
+
type: Number,
|
|
40
|
+
required: true
|
|
77
41
|
}
|
|
78
42
|
});
|
|
43
|
+
const instanceId = inject(MagicToastInstanceId, void 0);
|
|
44
|
+
if (!instanceId) {
|
|
45
|
+
throw new Error("MagicToastView must be used within a MagicToastProvider");
|
|
46
|
+
}
|
|
47
|
+
const { initializeState } = useToastState(instanceId);
|
|
48
|
+
const state = initializeState();
|
|
49
|
+
const count = computed(() => state.views.length);
|
|
50
|
+
const view = computed(() => state.views[index]);
|
|
51
|
+
const reversedIndex = computed(() => count.value - index - 1);
|
|
52
|
+
const height = computed(() => `${view.value.dimensions?.height}px`);
|
|
53
|
+
const offset = computed(() => {
|
|
54
|
+
const mapped = state.views.slice(0, reversedIndex.value).reduce((acc, view2) => acc + (view2.dimensions?.height ?? 0), 0);
|
|
55
|
+
return `${mapped}px`;
|
|
56
|
+
});
|
|
57
|
+
const { style, onPointerdown, onClick } = useToastDrag({
|
|
58
|
+
view: view.value,
|
|
59
|
+
instanceId
|
|
60
|
+
});
|
|
79
61
|
</script>
|
|
80
62
|
|
|
81
63
|
<style>
|
|
@@ -3,8 +3,8 @@ interface MagicToastViewProps {
|
|
|
3
3
|
id: string;
|
|
4
4
|
index: number;
|
|
5
5
|
}
|
|
6
|
-
declare const state: import("../types").ToastState;
|
|
7
|
-
declare const view: import("vue").ComputedRef<import("../types").ToastView>;
|
|
6
|
+
declare const state: import("../types/index.js").ToastState;
|
|
7
|
+
declare const view: import("vue").ComputedRef<import("../types/index.js").ToastView>;
|
|
8
8
|
declare const reversedIndex: import("vue").ComputedRef<number>;
|
|
9
9
|
declare const height: import("vue").ComputedRef<string>;
|
|
10
10
|
declare const offset: import("vue").ComputedRef<string>;
|
package/package.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"footer": [
|
|
3
|
-
{
|
|
4
|
-
"label": "Catalogue",
|
|
5
|
-
"list": [
|
|
6
|
-
{
|
|
7
|
-
"url": "https://maas.engineering/mirror-ui",
|
|
8
|
-
"label": "Mirror Ui",
|
|
9
|
-
"badge": {
|
|
10
|
-
"name": "Pro",
|
|
11
|
-
"variant": "info",
|
|
12
|
-
"mode": "translucent"
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
"icon": "maas-mr"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"url": "https://maas.engineering/dreamtype",
|
|
19
|
-
"label": "Dreamtype™",
|
|
20
|
-
"badge": {
|
|
21
|
-
"name": "Soon",
|
|
22
|
-
"variant": "primary",
|
|
23
|
-
"mode": "outline"
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
"icon": "maas-dt"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"url": "https://maas.engineering/azzets",
|
|
30
|
-
"label": "Azzets",
|
|
31
|
-
"badge": {
|
|
32
|
-
"name": "Soon",
|
|
33
|
-
"variant": "primary",
|
|
34
|
-
"mode": "outline"
|
|
35
|
-
},
|
|
36
|
-
"icon": "maas-az"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"label": "Open Source",
|
|
42
|
-
"list": [
|
|
43
|
-
{
|
|
44
|
-
"url": "https://maas.engineering/vue-equipment",
|
|
45
|
-
"label": "Vue Equipment",
|
|
46
|
-
|
|
47
|
-
"icon": "maas-ve"
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
"url": "https://maas.engineering/open-foundry",
|
|
52
|
-
"label": "Open Foundry",
|
|
53
|
-
"badge": {
|
|
54
|
-
"name": "Soon",
|
|
55
|
-
"variant": "primary",
|
|
56
|
-
"mode": "outline"
|
|
57
|
-
},
|
|
58
|
-
"icon": "maas-of"
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"label": "Company",
|
|
64
|
-
"list": [
|
|
65
|
-
{
|
|
66
|
-
"url": "https://maas.engineering/blog",
|
|
67
|
-
"label": "Readme",
|
|
68
|
-
"badge": {
|
|
69
|
-
"name": "Blog",
|
|
70
|
-
"variant": "primary",
|
|
71
|
-
"mode": "outline"
|
|
72
|
-
},
|
|
73
|
-
"icon": "edit-alt"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"url": "https://maas.engineering/about",
|
|
77
|
-
"label": "About us",
|
|
78
|
-
"icon": "maas-robot"
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
"url": "https://maas.engineering/contact",
|
|
83
|
-
"label": "Contact",
|
|
84
|
-
"icon": "maas-robot"
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"label": "Community",
|
|
90
|
-
"list": [
|
|
91
|
-
{
|
|
92
|
-
"url": "https://github.com/magicasaservice",
|
|
93
|
-
"label": "GitHub"
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
"url": "https://figma.com",
|
|
98
|
-
"label": "Figma"
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"label": "Legal",
|
|
104
|
-
"list": [
|
|
105
|
-
{
|
|
106
|
-
"url": "https://maas.engineering/legal-notice",
|
|
107
|
-
"label": "Legal Notice"
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
"url": "https://maas.engineering/privacy-policy",
|
|
112
|
-
"label": "Privacy Policy"
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"about": "Magic as a Service™ is a creative engineering company founded by the experience design studio International Magic. Our mission is to innovate on digital products and services to equip others with the tools and capabilities we wish we had ourselves. By combining design, engineering and culture into one stream, we produce powerful and sustainable outcomes for our users and clients."
|
|
3
|
-
}
|