@maas/vue-equipment 1.0.0-beta.12 → 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/.turbo/turbo-lint.log +2 -2
- 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 +51 -62
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +101 -122
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +8 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +35 -42
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +101 -108
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +49 -77
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +18 -37
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +1 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +45 -52
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +5 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +60 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +74 -70
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +171 -213
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +8 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +0 -4
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +6 -47
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +4 -31
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +147 -234
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +1 -15
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +17 -164
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +0 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +6 -24
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.d.ts +7 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +56 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +0 -5
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +7 -62
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +32 -51
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +47 -0
- package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -2
- package/dist/plugins/MagicPlayer/src/symbols/index.mjs +10 -1
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +29 -0
- 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 +4 -4
- 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
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +0 -15
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.mjs +0 -9
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="el" class="magic-scroll-collision">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
8
|
import {
|
|
9
9
|
shallowRef,
|
|
10
10
|
inject,
|
|
@@ -18,60 +18,50 @@ import {
|
|
|
18
18
|
import { useCollisionDetection } from "../composables/private/useCollisionDetection";
|
|
19
19
|
import { MagicScrollReturn, MagicScrollTarget } from "../symbols";
|
|
20
20
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
offset: { type: Object, required: false }
|
|
21
|
+
const { id, offset } = defineProps({
|
|
22
|
+
id: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
54
|
-
useIntersectionObserver(
|
|
55
|
-
elRef,
|
|
56
|
-
([{ isIntersecting }]) => {
|
|
57
|
-
intersecting.value = isIntersecting;
|
|
58
|
-
},
|
|
59
|
-
{ rootMargin: "150% 0px 150% 0px", immediate: true }
|
|
60
|
-
);
|
|
61
|
-
onMounted(() => {
|
|
26
|
+
offset: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: false
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const scrollReturn = inject(MagicScrollReturn, void 0);
|
|
32
|
+
const scrollTarget = inject(MagicScrollTarget);
|
|
33
|
+
if (!scrollTarget) {
|
|
34
|
+
console.error(
|
|
35
|
+
"MagicScrollCollision must be used within a MagicScrollProvider"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const intersecting = shallowRef(false);
|
|
39
|
+
const elRef = useTemplateRef("el");
|
|
40
|
+
const scrollY = computed(() => toValue(scrollReturn?.y) || 0);
|
|
41
|
+
const mappedId = computed(() => id ?? `magic-scroll-collision-${useId()}`);
|
|
42
|
+
const { observe } = useCollisionDetection({
|
|
43
|
+
id: mappedId.value,
|
|
44
|
+
child: elRef,
|
|
45
|
+
parent: scrollTarget,
|
|
46
|
+
scrollY,
|
|
47
|
+
offset
|
|
48
|
+
});
|
|
49
|
+
watch(
|
|
50
|
+
() => scrollY.value,
|
|
51
|
+
() => {
|
|
52
|
+
if (intersecting.value) {
|
|
62
53
|
observe();
|
|
63
|
-
}
|
|
64
|
-
return (_ctx, _cache) => {
|
|
65
|
-
return _openBlock(), _createElementBlock(
|
|
66
|
-
"div",
|
|
67
|
-
_hoisted_1,
|
|
68
|
-
[
|
|
69
|
-
_renderSlot(_ctx.$slots, "default")
|
|
70
|
-
],
|
|
71
|
-
512
|
|
72
|
-
/* NEED_PATCH */
|
|
73
|
-
);
|
|
74
|
-
};
|
|
54
|
+
}
|
|
75
55
|
}
|
|
56
|
+
);
|
|
57
|
+
useIntersectionObserver(
|
|
58
|
+
elRef,
|
|
59
|
+
([{ isIntersecting }]) => {
|
|
60
|
+
intersecting.value = isIntersecting;
|
|
61
|
+
},
|
|
62
|
+
{ rootMargin: "150% 0px 150% 0px", immediate: true }
|
|
63
|
+
);
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
observe();
|
|
76
66
|
});
|
|
77
67
|
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="el" class="magic-scroll-motion">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
8
|
import { ref, inject, computed, onMounted, watch, useTemplateRef } from "vue";
|
|
9
9
|
import { unrefElement } from "@vueuse/core";
|
|
10
10
|
import defu from "defu";
|
|
@@ -12,70 +12,63 @@ import {
|
|
|
12
12
|
animate
|
|
13
13
|
} from "motion";
|
|
14
14
|
import { MagicScrollProgress } from "../symbols";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const { progress, sequence, sequenceOptions } = defineProps({
|
|
16
|
+
sequence: {
|
|
17
|
+
type: Array,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
sequenceOptions: {
|
|
21
|
+
type: Object,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
progress: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: false
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const animation = ref(void 0);
|
|
30
|
+
const elRef = useTemplateRef("el");
|
|
31
|
+
const injectedProgress = inject(
|
|
32
|
+
MagicScrollProgress,
|
|
33
|
+
computed(() => 0)
|
|
34
|
+
);
|
|
35
|
+
const mappedProgress = computed(() => {
|
|
36
|
+
return progress || injectedProgress.value || 0;
|
|
37
|
+
});
|
|
38
|
+
const defaultSequenceOptions = {
|
|
39
|
+
duration: 1,
|
|
40
|
+
delay: 0
|
|
41
|
+
};
|
|
42
|
+
const mappedSequenceOptions = defu(sequenceOptions, defaultSequenceOptions);
|
|
43
|
+
function createAnimation() {
|
|
44
|
+
const el = unrefElement(elRef);
|
|
45
|
+
if (!sequence || !sequence.length || !el) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const mappedSequence = sequence.map((item) => {
|
|
49
|
+
const [animation2 = [], options = {}] = item;
|
|
50
|
+
return [el, animation2, options];
|
|
51
|
+
});
|
|
52
|
+
animation.value = animate(mappedSequence, mappedSequenceOptions);
|
|
53
|
+
animation.value.pause();
|
|
54
|
+
animation.value.time = mappedProgress.value;
|
|
55
|
+
}
|
|
56
|
+
watch(mappedProgress, (value) => {
|
|
57
|
+
if (!value && value !== 0 || !animation.value) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
animation.value.time = value;
|
|
61
|
+
});
|
|
62
|
+
watch(
|
|
63
|
+
() => sequence,
|
|
64
|
+
() => {
|
|
65
|
+
createAnimation();
|
|
21
66
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const elRef = useTemplateRef("el");
|
|
25
|
-
const injectedProgress = inject(
|
|
26
|
-
MagicScrollProgress,
|
|
27
|
-
computed(() => 0)
|
|
28
|
-
);
|
|
29
|
-
const mappedProgress = computed(() => {
|
|
30
|
-
return __props.progress || injectedProgress.value || 0;
|
|
31
|
-
});
|
|
32
|
-
const defaultSequenceOptions = {
|
|
33
|
-
duration: 1,
|
|
34
|
-
delay: 0
|
|
35
|
-
};
|
|
36
|
-
const mappedSequenceOptions = defu(__props.sequenceOptions, defaultSequenceOptions);
|
|
37
|
-
function createAnimation() {
|
|
38
|
-
const el = unrefElement(elRef);
|
|
39
|
-
if (!__props.sequence || !__props.sequence.length || !el) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const mappedSequence = __props.sequence.map((item) => {
|
|
43
|
-
const [animation2 = [], options = {}] = item;
|
|
44
|
-
return [el, animation2, options];
|
|
45
|
-
});
|
|
46
|
-
animation.value = animate(mappedSequence, mappedSequenceOptions);
|
|
47
|
-
animation.value.pause();
|
|
48
|
-
animation.value.time = mappedProgress.value;
|
|
49
|
-
}
|
|
50
|
-
watch(mappedProgress, (value) => {
|
|
51
|
-
if (!value && value !== 0 || !animation.value) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
animation.value.time = value;
|
|
55
|
-
});
|
|
56
|
-
watch(
|
|
57
|
-
() => __props.sequence,
|
|
58
|
-
() => {
|
|
59
|
-
createAnimation();
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
deep: true
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
onMounted(() => {
|
|
66
|
-
createAnimation();
|
|
67
|
-
});
|
|
68
|
-
return (_ctx, _cache) => {
|
|
69
|
-
return _openBlock(), _createElementBlock(
|
|
70
|
-
"div",
|
|
71
|
-
_hoisted_1,
|
|
72
|
-
[
|
|
73
|
-
_renderSlot(_ctx.$slots, "default")
|
|
74
|
-
],
|
|
75
|
-
512
|
|
76
|
-
/* NEED_PATCH */
|
|
77
|
-
);
|
|
78
|
-
};
|
|
67
|
+
{
|
|
68
|
+
deep: true
|
|
79
69
|
}
|
|
70
|
+
);
|
|
71
|
+
onMounted(() => {
|
|
72
|
+
createAnimation();
|
|
80
73
|
});
|
|
81
74
|
</script>
|
|
@@ -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,9 +1,48 @@
|
|
|
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="toValue(id)"
|
|
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
|
-
toValue,
|
|
7
46
|
useTemplateRef,
|
|
8
47
|
provide,
|
|
9
48
|
watch,
|
|
@@ -13,7 +52,6 @@ import { onClickOutside } from "@vueuse/core";
|
|
|
13
52
|
import { useToastState } from "../composables/private/useToastState";
|
|
14
53
|
import { useToastView } from "../composables/private/useToastView";
|
|
15
54
|
import { useToastCallback } from "../composables/private/useToastCallback";
|
|
16
|
-
import MagicToastView from "./MagicToastView.vue";
|
|
17
55
|
import { MagicToastInstanceId } from "../../symbols";
|
|
18
56
|
import "@maas/vue-equipment/utils/css/animations/fade-out.css";
|
|
19
57
|
import "@maas/vue-equipment/utils/css/animations/squash-y.css";
|
|
@@ -22,99 +60,46 @@ import "@maas/vue-equipment/utils/css/animations/slide-ltr-out.css";
|
|
|
22
60
|
import "@maas/vue-equipment/utils/css/animations/slide-rtl-in.css";
|
|
23
61
|
import "@maas/vue-equipment/utils/css/animations/slide-rtl-out.css";
|
|
24
62
|
import { useToastListener } from "../composables/private/useToastListener";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
63
|
+
const { id, options } = defineProps({
|
|
64
|
+
id: {
|
|
65
|
+
type: null,
|
|
66
|
+
required: true
|
|
28
67
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
68
|
+
options: {
|
|
69
|
+
type: Object,
|
|
70
|
+
required: false
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
defineOptions({
|
|
74
|
+
inheritAttrs: false
|
|
75
|
+
});
|
|
76
|
+
const { deleteView } = useToastView(id);
|
|
77
|
+
const { deleteState, initializeState } = useToastState(id);
|
|
78
|
+
const state = initializeState(options);
|
|
79
|
+
const listRef = useTemplateRef("list");
|
|
80
|
+
const {
|
|
81
|
+
onBeforeEnter,
|
|
82
|
+
onEnter,
|
|
83
|
+
onAfterEnter,
|
|
84
|
+
onBeforeLeave,
|
|
85
|
+
onLeave,
|
|
86
|
+
onAfterLeave
|
|
87
|
+
} = useToastCallback(id);
|
|
88
|
+
const { onMouseenter, onMouseleave, outsideClickCallback } = useToastListener(id);
|
|
89
|
+
onClickOutside(listRef, outsideClickCallback);
|
|
90
|
+
watch(
|
|
91
|
+
() => options,
|
|
92
|
+
(value) => {
|
|
93
|
+
initializeState(value);
|
|
33
94
|
},
|
|
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
|
-
};
|
|
95
|
+
{
|
|
96
|
+
deep: true
|
|
116
97
|
}
|
|
98
|
+
);
|
|
99
|
+
onBeforeUnmount(() => {
|
|
100
|
+
deleteState();
|
|
117
101
|
});
|
|
102
|
+
provide(MagicToastInstanceId, id);
|
|
118
103
|
</script>
|
|
119
104
|
|
|
120
105
|
<style>
|