@maas/vue-equipment 1.0.0-beta.1 → 1.0.0-beta.11
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/README.md +2 -2
- package/dist/composables/index.d.ts +5 -5
- package/dist/composables/index.js +23 -13
- package/dist/composables/index.js.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +9 -2
- package/dist/plugins/.turbo/turbo-lint.log +1 -9
- package/dist/plugins/MagicAccordion/demo/data/footer.json +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +33 -22
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +12 -21
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +15 -13
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +23 -59
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +2 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +17 -22
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +11 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +24 -13
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +0 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +29 -28
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +5 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +7 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +7 -6
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +25 -60
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +15 -22
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicCommand/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +13 -22
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +9 -21
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +21 -12
- package/dist/plugins/MagicCookie/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +20 -26
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +94 -23
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +9 -5
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +34 -14
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +6 -4
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +54 -19
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +4 -4
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +33 -24
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +165 -24
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +34 -14
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.mjs +28 -10
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +16 -14
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +15 -15
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +14 -25
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +8 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +4 -5
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +18 -21
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +3 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +41 -24
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +5 -7
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +40 -25
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +3 -14
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +31 -28
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +19 -8
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +28 -38
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -23
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +29 -19
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +27 -60
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +15 -22
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +15 -5
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +4 -4
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +35 -15
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +18 -6
- package/dist/plugins/MagicMenu/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.mjs +2 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +9 -9
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +44 -22
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +34 -14
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +14 -14
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +1 -10
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +3 -3
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +2 -2
- package/dist/plugins/MagicPie/index.d.ts +7 -0
- package/dist/plugins/MagicPie/index.mjs +8 -0
- package/dist/plugins/MagicPie/nuxt.d.ts +2 -0
- package/dist/plugins/MagicPie/nuxt.mjs +23 -0
- package/dist/plugins/MagicPie/src/components/MagicPie.vue +202 -0
- package/dist/plugins/MagicPie/src/components/MagicPie.vue.d.ts +7 -0
- package/dist/plugins/MagicPie/src/composables/private/usePieState.d.ts +6 -0
- package/dist/plugins/MagicPie/src/composables/private/usePieState.mjs +33 -0
- package/dist/plugins/MagicPie/src/composables/useMagicPie.d.ts +13 -0
- package/dist/plugins/MagicPie/src/composables/useMagicPie.mjs +43 -0
- package/dist/plugins/MagicPie/src/types/index.d.ts +9 -0
- package/dist/plugins/MagicPie/src/types/index.mjs +0 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +14 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +32 -38
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +27 -26
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +19 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +29 -14
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +13 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +23 -23
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +24 -25
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +61 -33
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +10 -10
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +15 -9
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +13 -13
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +18 -11
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +6 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +4 -4
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +20 -20
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +17 -8
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +11 -11
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +45 -37
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +18 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +13 -24
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +3 -3
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +14 -4
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +23 -29
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -10
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +8 -11
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +24 -23
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +5 -5
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +22 -22
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +33 -15
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +1 -0
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +10 -2
- package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/index.d.ts +9 -4
- package/dist/utils/index.js +39 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +16 -7
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, createBlock as _createBlock, withCtx as _withCtx, TransitionGroup as _TransitionGroup, createVNode as _createVNode, createElementVNode as _createElementVNode, Teleport as _Teleport } from "vue";
|
|
4
|
-
const _hoisted_1 = ["id", "data-position", "data-expanded"];
|
|
4
|
+
const _hoisted_1 = ["data-id", "data-position", "data-expanded"];
|
|
5
5
|
import {
|
|
6
6
|
toValue,
|
|
7
|
-
|
|
7
|
+
useTemplateRef,
|
|
8
8
|
provide,
|
|
9
|
-
useId,
|
|
10
9
|
watch,
|
|
11
10
|
onBeforeUnmount
|
|
12
11
|
} from "vue";
|
|
13
12
|
import { onClickOutside } from "@vueuse/core";
|
|
14
|
-
import { defu } from "defu";
|
|
15
13
|
import { useToastState } from "../composables/private/useToastState";
|
|
16
14
|
import { useToastView } from "../composables/private/useToastView";
|
|
17
15
|
import { useToastCallback } from "../composables/private/useToastCallback";
|
|
@@ -34,11 +32,10 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
34
32
|
options: { type: Object, required: false }
|
|
35
33
|
},
|
|
36
34
|
setup(__props) {
|
|
37
|
-
const teleportId = ref(useId());
|
|
38
35
|
const { deleteView } = useToastView(__props.id);
|
|
39
36
|
const { deleteState, initializeState } = useToastState(__props.id);
|
|
40
37
|
const state = initializeState(__props.options);
|
|
41
|
-
const listRef =
|
|
38
|
+
const listRef = useTemplateRef("list");
|
|
42
39
|
const {
|
|
43
40
|
onBeforeEnter,
|
|
44
41
|
onEnter,
|
|
@@ -52,8 +49,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
52
49
|
watch(
|
|
53
50
|
() => __props.options,
|
|
54
51
|
(value) => {
|
|
55
|
-
|
|
56
|
-
teleportId.value = useId();
|
|
52
|
+
initializeState(value);
|
|
57
53
|
},
|
|
58
54
|
{
|
|
59
55
|
deep: true
|
|
@@ -65,19 +61,17 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
65
61
|
provide(MagicToastInstanceId, __props.id);
|
|
66
62
|
return (_ctx, _cache) => {
|
|
67
63
|
return _openBlock(), _createBlock(_Teleport, {
|
|
68
|
-
key: teleportId.value,
|
|
69
64
|
to: _unref(state).options.teleport?.target,
|
|
70
65
|
disabled: _unref(state).options.teleport?.disabled
|
|
71
66
|
}, [
|
|
72
67
|
_createElementVNode("div", _mergeProps({
|
|
73
|
-
id: toValue(_ctx.id),
|
|
68
|
+
"data-id": toValue(_ctx.id),
|
|
74
69
|
"data-position": _unref(state).options.position,
|
|
75
70
|
"data-expanded": _unref(state).expanded,
|
|
76
71
|
class: "magic-toast-provider"
|
|
77
72
|
}, _ctx.$attrs), [
|
|
78
73
|
_createVNode(_TransitionGroup, {
|
|
79
|
-
|
|
80
|
-
ref: listRef,
|
|
74
|
+
ref: "list",
|
|
81
75
|
tag: "ol",
|
|
82
76
|
class: "magic-toast-provider__list",
|
|
83
77
|
name: _unref(state).options.transition,
|
|
@@ -164,7 +158,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
164
158
|
--magic-toast-padding-y: 1rem;
|
|
165
159
|
--magic-toast-padding-x: 1rem;
|
|
166
160
|
--magic-toast-gap: 0.75rem;
|
|
167
|
-
--magic-toast-duration: 175ms;
|
|
161
|
+
--magic-toast-animation-duration: 175ms;
|
|
168
162
|
--magic-toast-scale-factor: 0.05;
|
|
169
163
|
--magic-toast-overlap-y: 1rem;
|
|
170
164
|
|
|
@@ -213,11 +207,11 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
213
207
|
}
|
|
214
208
|
|
|
215
209
|
.magic-toast-provider[data-position='top-left'],
|
|
216
|
-
.magic-toast-provider[data-position='top
|
|
210
|
+
.magic-toast-provider[data-position='top'],
|
|
217
211
|
.magic-toast-provider[data-position='top-right'] {
|
|
218
|
-
--mt-enter-animation: mt-slide-ttb-in var(--magic-toast-duration)
|
|
212
|
+
--mt-enter-animation: mt-slide-ttb-in var(--magic-toast-animation-duration)
|
|
219
213
|
var(--ease-in-out);
|
|
220
|
-
--mt-leave-animation: mt-slide-ttb-out var(--magic-toast-duration)
|
|
214
|
+
--mt-leave-animation: mt-slide-ttb-out var(--magic-toast-animation-duration)
|
|
221
215
|
var(--ease-in-out);
|
|
222
216
|
--mt-multiplier-y: 1;
|
|
223
217
|
--mt-justify-content: flex-end;
|
|
@@ -225,11 +219,11 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
225
219
|
}
|
|
226
220
|
|
|
227
221
|
.magic-toast-provider[data-position='bottom-left'],
|
|
228
|
-
.magic-toast-provider[data-position='bottom
|
|
222
|
+
.magic-toast-provider[data-position='bottom'],
|
|
229
223
|
.magic-toast-provider[data-position='bottom-right'] {
|
|
230
|
-
--mt-enter-animation: mt-slide-btt-in var(--magic-toast-duration)
|
|
224
|
+
--mt-enter-animation: mt-slide-btt-in var(--magic-toast-animation-duration)
|
|
231
225
|
var(--ease-in-out);
|
|
232
|
-
--mt-leave-animation: mt-slide-btt-out var(--magic-toast-duration)
|
|
226
|
+
--mt-leave-animation: mt-slide-btt-out var(--magic-toast-animation-duration)
|
|
233
227
|
var(--ease-in-out);
|
|
234
228
|
--mt-multiplier-y: -1;
|
|
235
229
|
--mt-justify-content: flex-end;
|
|
@@ -245,21 +239,21 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
245
239
|
--mt-align-items: flex-end;
|
|
246
240
|
}
|
|
247
241
|
|
|
248
|
-
.magic-toast-provider[data-position='
|
|
242
|
+
.magic-toast-provider[data-position='left'] {
|
|
249
243
|
--mt-justify-content: center;
|
|
250
244
|
--mt-align-items: flex-start;
|
|
251
|
-
--mt-enter-animation: slide-ltr-in var(--magic-toast-duration)
|
|
245
|
+
--mt-enter-animation: slide-ltr-in var(--magic-toast-animation-duration)
|
|
252
246
|
var(--ease-in-out);
|
|
253
|
-
--mt-leave-animation: slide-ltr-out var(--magic-toast-duration)
|
|
247
|
+
--mt-leave-animation: slide-ltr-out var(--magic-toast-animation-duration)
|
|
254
248
|
var(--ease-in-out);
|
|
255
249
|
}
|
|
256
250
|
|
|
257
|
-
.magic-toast-provider[data-position='
|
|
251
|
+
.magic-toast-provider[data-position='right'] {
|
|
258
252
|
--mt-justify-content: center;
|
|
259
253
|
--mt-align-items: flex-end;
|
|
260
|
-
--mt-enter-animation: slide-rtl-in var(--magic-toast-duration)
|
|
254
|
+
--mt-enter-animation: slide-rtl-in var(--magic-toast-animation-duration)
|
|
261
255
|
var(--ease-in-out);
|
|
262
|
-
--mt-leave-animation: slide-rtl-out var(--magic-toast-duration)
|
|
256
|
+
--mt-leave-animation: slide-rtl-out var(--magic-toast-animation-duration)
|
|
263
257
|
var(--ease-in-out);
|
|
264
258
|
}
|
|
265
259
|
|
|
@@ -268,20 +262,20 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
268
262
|
position: absolute;
|
|
269
263
|
|
|
270
264
|
&[data-position='bottom-left'],
|
|
271
|
-
&[data-position='bottom
|
|
265
|
+
&[data-position='bottom'],
|
|
272
266
|
&[data-position='bottom-right'] {
|
|
273
267
|
bottom: calc(var(--mt-height) * var(--mt-index) * 1px);
|
|
274
268
|
}
|
|
275
269
|
|
|
276
270
|
&[data-position='top-left'],
|
|
277
|
-
&[data-position='top
|
|
271
|
+
&[data-position='top'],
|
|
278
272
|
&[data-position='top-right'] {
|
|
279
273
|
top: calc(var(--mt-height) * var(--mt-index) * 1px);
|
|
280
274
|
}
|
|
281
275
|
}
|
|
282
276
|
|
|
283
277
|
.magic-toast-leave-active {
|
|
284
|
-
animation: fade-out var(--magic-toast-duration) var(--ease-in-out);
|
|
278
|
+
animation: fade-out var(--magic-toast-animation-duration) var(--ease-in-out);
|
|
285
279
|
position: absolute;
|
|
286
280
|
}
|
|
287
281
|
|
|
@@ -291,6 +285,6 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
291
285
|
}
|
|
292
286
|
|
|
293
287
|
.magic-toast-move {
|
|
294
|
-
transition: all var(--magic-toast-duration) var(--ease-in-out);
|
|
288
|
+
transition: all var(--magic-toast-animation-duration) var(--ease-in-out);
|
|
295
289
|
}
|
|
296
290
|
</style>
|
|
@@ -10,14 +10,5 @@ interface MagicToastProps {
|
|
|
10
10
|
id: MaybeRef<string>;
|
|
11
11
|
options?: MagicToastOptions;
|
|
12
12
|
}
|
|
13
|
-
declare const _default: import("vue").DefineComponent<
|
|
13
|
+
declare const _default: import("vue").DefineComponent<MagicToastProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicToastProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
export default _default;
|
|
15
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
16
|
-
type __VLS_TypePropsToOption<T> = {
|
|
17
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
18
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
19
|
-
} : {
|
|
20
|
-
type: import('vue').PropType<T[K]>;
|
|
21
|
-
required: true;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
-
const _hoisted_1 = ["id", "data-expanded", "data-dragging", "data-position", "data-debug"];
|
|
5
|
-
import {
|
|
4
|
+
const _hoisted_1 = ["data-id", "data-expanded", "data-dragging", "data-position", "data-debug"];
|
|
5
|
+
import { computed, inject } from "vue";
|
|
6
6
|
import { MagicToastInstanceId } from "../../symbols";
|
|
7
7
|
import { useToastState } from "../composables/private/useToastState";
|
|
8
8
|
import { useToastDrag } from "../composables/private/useToastDrag";
|
|
@@ -18,7 +18,6 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
18
18
|
if (!instanceId) {
|
|
19
19
|
throw new Error("MagicToastView must be used within a MagicToastProvider");
|
|
20
20
|
}
|
|
21
|
-
const elRef = ref(void 0);
|
|
22
21
|
const { initializeState } = useToastState(instanceId);
|
|
23
22
|
const state = initializeState();
|
|
24
23
|
const count = computed(() => state.views.length);
|
|
@@ -35,10 +34,8 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
35
34
|
});
|
|
36
35
|
return (_ctx, _cache) => {
|
|
37
36
|
return _openBlock(), _createElementBlock("li", {
|
|
38
|
-
id: _ctx.id,
|
|
39
|
-
ref_key: "elRef",
|
|
40
|
-
ref: elRef,
|
|
41
37
|
class: "magic-toast-view",
|
|
38
|
+
"data-id": _ctx.id,
|
|
42
39
|
"data-expanded": _unref(state).expanded,
|
|
43
40
|
"data-dragging": view.value.dragging,
|
|
44
41
|
"data-position": _unref(state).options.position,
|
|
@@ -83,7 +80,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
83
80
|
|
|
84
81
|
<style>
|
|
85
82
|
:root {
|
|
86
|
-
--magic-toast-view-transition: all var(--magic-toast-duration)
|
|
83
|
+
--magic-toast-view-transition: all var(--magic-toast-animation-duration)
|
|
87
84
|
var(--ease-in-out);
|
|
88
85
|
}
|
|
89
86
|
|
|
@@ -94,13 +91,13 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
94
91
|
user-select: none;
|
|
95
92
|
|
|
96
93
|
&[data-position='bottom-left'],
|
|
97
|
-
&[data-position='bottom
|
|
94
|
+
&[data-position='bottom'],
|
|
98
95
|
&[data-position='bottom-right'] {
|
|
99
96
|
padding-top: var(--magic-toast-gap);
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
&[data-position='top-left'],
|
|
103
|
-
&[data-position='top
|
|
100
|
+
&[data-position='top'],
|
|
104
101
|
&[data-position='top-right'] {
|
|
105
102
|
padding-bottom: var(--magic-toast-gap);
|
|
106
103
|
}
|
|
@@ -138,11 +135,11 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
138
135
|
cursor: var(--magic-toast-view-cursor-dragging, grabbing);
|
|
139
136
|
}
|
|
140
137
|
|
|
141
|
-
.magic-toast-view[data-position='
|
|
138
|
+
.magic-toast-view[data-position='left'] {
|
|
142
139
|
position: absolute;
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
.magic-toast-view[data-position='
|
|
142
|
+
.magic-toast-view[data-position='right'] {
|
|
146
143
|
position: absolute;
|
|
147
144
|
}
|
|
148
145
|
|
|
@@ -3,30 +3,31 @@ interface MagicToastViewProps {
|
|
|
3
3
|
id: string;
|
|
4
4
|
index: number;
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
declare const
|
|
18
|
-
|
|
6
|
+
declare const state: import("../types").ToastState;
|
|
7
|
+
declare const view: import("vue").ComputedRef<import("../types").ToastView>;
|
|
8
|
+
declare const reversedIndex: import("vue").ComputedRef<number>;
|
|
9
|
+
declare const height: import("vue").ComputedRef<string>;
|
|
10
|
+
declare const offset: import("vue").ComputedRef<string>;
|
|
11
|
+
declare const style: import("vue").ComputedRef<string>, onPointerdown: (e: PointerEvent) => void, onClick: (e: MouseEvent) => Promise<void>;
|
|
12
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
13
|
+
declare var __VLS_1: {};
|
|
14
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
15
|
+
default?: (props: typeof __VLS_1) => any;
|
|
16
|
+
}>;
|
|
17
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicToastViewProps, {
|
|
18
|
+
state: typeof state;
|
|
19
|
+
view: typeof view;
|
|
20
|
+
reversedIndex: typeof reversedIndex;
|
|
21
|
+
height: typeof height;
|
|
22
|
+
offset: typeof offset;
|
|
23
|
+
style: typeof style;
|
|
24
|
+
onPointerdown: typeof onPointerdown;
|
|
25
|
+
onClick: typeof onClick;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicToastViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicToastViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicToastViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
29
|
export default _default;
|
|
20
|
-
type
|
|
21
|
-
type __VLS_TypePropsToOption<T> = {
|
|
22
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
-
} : {
|
|
25
|
-
type: import('vue').PropType<T[K]>;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
30
31
|
new (): {
|
|
31
32
|
$slots: S;
|
|
32
33
|
};
|
|
@@ -2,8 +2,8 @@ import { type MaybeRef } from 'vue';
|
|
|
2
2
|
export declare function useToastCallback(instanceId: MaybeRef<string>): {
|
|
3
3
|
onBeforeEnter: () => void;
|
|
4
4
|
onEnter: () => void;
|
|
5
|
-
onAfterEnter: (el:
|
|
5
|
+
onAfterEnter: (el: HTMLElement) => void;
|
|
6
6
|
onBeforeLeave: () => void;
|
|
7
7
|
onLeave: () => void;
|
|
8
|
-
onAfterLeave: (el:
|
|
8
|
+
onAfterLeave: (el: HTMLElement) => void;
|
|
9
9
|
};
|
|
@@ -12,10 +12,13 @@ export function useToastCallback(instanceId) {
|
|
|
12
12
|
}
|
|
13
13
|
function onEnter() {
|
|
14
14
|
emitter.emit("enter", toValue(instanceId));
|
|
15
|
+
if (state.views.length && state.options.layout?.max && state.views.length > state.options.layout.max) {
|
|
16
|
+
deleteView(state.views[0].id);
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
function onAfterEnter(el) {
|
|
17
20
|
emitter.emit("afterEnter", toValue(instanceId));
|
|
18
|
-
const view = getView(el.id);
|
|
21
|
+
const view = getView(el.dataset.id ?? "");
|
|
19
22
|
if (view) {
|
|
20
23
|
const mappedEl = el;
|
|
21
24
|
const style = window.getComputedStyle(mappedEl);
|
|
@@ -28,9 +31,6 @@ export function useToastCallback(instanceId) {
|
|
|
28
31
|
};
|
|
29
32
|
view.dimensions = dimensions;
|
|
30
33
|
}
|
|
31
|
-
if (state.views.length && state.options.layout?.max && state.views.length > state.options.layout.max) {
|
|
32
|
-
deleteView(state.views[0].id);
|
|
33
|
-
}
|
|
34
34
|
}
|
|
35
35
|
function onBeforeLeave() {
|
|
36
36
|
emitter.emit("beforeLeave", toValue(instanceId));
|
|
@@ -39,7 +39,7 @@ export function useToastCallback(instanceId) {
|
|
|
39
39
|
emitter.emit("leave", toValue(instanceId));
|
|
40
40
|
}
|
|
41
41
|
function onAfterLeave(el) {
|
|
42
|
-
const view = getView(el.id);
|
|
42
|
+
const view = getView(el.dataset.id ?? "");
|
|
43
43
|
if (view) {
|
|
44
44
|
deleteView(view.id);
|
|
45
45
|
}
|
|
@@ -64,10 +64,10 @@ export function useToastDrag(args) {
|
|
|
64
64
|
easing
|
|
65
65
|
} = args2;
|
|
66
66
|
switch (position) {
|
|
67
|
-
case "top
|
|
67
|
+
case "top":
|
|
68
68
|
case "top-left":
|
|
69
69
|
case "top-right":
|
|
70
|
-
case "bottom
|
|
70
|
+
case "bottom":
|
|
71
71
|
case "bottom-left":
|
|
72
72
|
case "bottom-right":
|
|
73
73
|
interpolate({
|
|
@@ -80,8 +80,8 @@ export function useToastDrag(args) {
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
break;
|
|
83
|
-
case "
|
|
84
|
-
case "
|
|
83
|
+
case "left":
|
|
84
|
+
case "right":
|
|
85
85
|
interpolate({
|
|
86
86
|
from: draggedX.value,
|
|
87
87
|
to,
|
|
@@ -98,10 +98,10 @@ export function useToastDrag(args) {
|
|
|
98
98
|
const distanceX = Math.abs(draggedX.value - lastDraggedX.value);
|
|
99
99
|
const distanceY = Math.abs(draggedY.value - lastDraggedY.value);
|
|
100
100
|
switch (position) {
|
|
101
|
-
case "top
|
|
101
|
+
case "top":
|
|
102
102
|
case "top-left":
|
|
103
103
|
case "top-right":
|
|
104
|
-
case "bottom
|
|
104
|
+
case "bottom":
|
|
105
105
|
case "bottom-left":
|
|
106
106
|
case "bottom-right":
|
|
107
107
|
if (distanceY > toValue(threshold).distance) {
|
|
@@ -110,8 +110,8 @@ export function useToastDrag(args) {
|
|
|
110
110
|
interpolateTo.value = 0;
|
|
111
111
|
}
|
|
112
112
|
break;
|
|
113
|
-
case "
|
|
114
|
-
case "
|
|
113
|
+
case "left":
|
|
114
|
+
case "right":
|
|
115
115
|
if (distanceX > toValue(threshold).distance) {
|
|
116
116
|
shouldClose.value = true;
|
|
117
117
|
} else {
|
|
@@ -127,10 +127,10 @@ export function useToastDrag(args) {
|
|
|
127
127
|
const velocityX = elapsed && distanceX ? distanceX / elapsed : 0;
|
|
128
128
|
const velocityY = elapsed && distanceY ? distanceY / elapsed : 0;
|
|
129
129
|
switch (position) {
|
|
130
|
-
case "top
|
|
130
|
+
case "top":
|
|
131
131
|
case "top-left":
|
|
132
132
|
case "top-right":
|
|
133
|
-
case "bottom
|
|
133
|
+
case "bottom":
|
|
134
134
|
case "bottom-left":
|
|
135
135
|
case "bottom-right":
|
|
136
136
|
if (velocityY > 0.5) {
|
|
@@ -139,8 +139,8 @@ export function useToastDrag(args) {
|
|
|
139
139
|
interpolateTo.value = 0;
|
|
140
140
|
}
|
|
141
141
|
break;
|
|
142
|
-
case "
|
|
143
|
-
case "
|
|
142
|
+
case "left":
|
|
143
|
+
case "right":
|
|
144
144
|
if (velocityX > 0.5) {
|
|
145
145
|
shouldClose.value = true;
|
|
146
146
|
} else {
|
|
@@ -151,7 +151,7 @@ export function useToastDrag(args) {
|
|
|
151
151
|
}
|
|
152
152
|
function setDragged({ x, y }) {
|
|
153
153
|
switch (position) {
|
|
154
|
-
case "top
|
|
154
|
+
case "top":
|
|
155
155
|
const newDraggedTC = Math.min(y - originY.value, 0);
|
|
156
156
|
draggedY.value = newDraggedTC;
|
|
157
157
|
break;
|
|
@@ -163,7 +163,7 @@ export function useToastDrag(args) {
|
|
|
163
163
|
const newDraggedTR = Math.min(y - originY.value, 0);
|
|
164
164
|
draggedY.value = newDraggedTR;
|
|
165
165
|
break;
|
|
166
|
-
case "bottom
|
|
166
|
+
case "bottom":
|
|
167
167
|
const newDraggedBC = Math.max(y - originY.value, 0);
|
|
168
168
|
draggedY.value = newDraggedBC;
|
|
169
169
|
break;
|
|
@@ -175,11 +175,11 @@ export function useToastDrag(args) {
|
|
|
175
175
|
const newDraggedBR = Math.max(y - originY.value, 0);
|
|
176
176
|
draggedY.value = newDraggedBR;
|
|
177
177
|
break;
|
|
178
|
-
case "
|
|
178
|
+
case "left":
|
|
179
179
|
const newDraggedCL = Math.min(x - originX.value, 0);
|
|
180
180
|
draggedX.value = newDraggedCL;
|
|
181
181
|
break;
|
|
182
|
-
case "
|
|
182
|
+
case "right":
|
|
183
183
|
const newDraggedCR = Math.max(x - originX.value, 0);
|
|
184
184
|
draggedX.value = newDraggedCR;
|
|
185
185
|
break;
|
|
@@ -202,18 +202,18 @@ export function useToastDrag(args) {
|
|
|
202
202
|
});
|
|
203
203
|
} else {
|
|
204
204
|
switch (position) {
|
|
205
|
-
case "top
|
|
205
|
+
case "top":
|
|
206
206
|
case "top-left":
|
|
207
207
|
case "top-right":
|
|
208
|
-
case "bottom
|
|
208
|
+
case "bottom":
|
|
209
209
|
case "bottom-left":
|
|
210
210
|
case "bottom-right":
|
|
211
211
|
interpolateDragged({
|
|
212
212
|
to: lastDraggedY.value
|
|
213
213
|
});
|
|
214
214
|
break;
|
|
215
|
-
case "
|
|
216
|
-
case "
|
|
215
|
+
case "left":
|
|
216
|
+
case "right":
|
|
217
217
|
interpolateDragged({
|
|
218
218
|
to: lastDraggedX.value
|
|
219
219
|
});
|
|
@@ -257,10 +257,10 @@ export function useToastDrag(args) {
|
|
|
257
257
|
function onPointerdown(e) {
|
|
258
258
|
const scrollLockValue = toValue(scrollLock);
|
|
259
259
|
if (scrollLockValue) {
|
|
260
|
-
lockScroll();
|
|
261
260
|
if (typeof scrollLockValue === "object" && scrollLockValue.padding) {
|
|
262
261
|
addScrollLockPadding();
|
|
263
262
|
}
|
|
263
|
+
lockScroll();
|
|
264
264
|
}
|
|
265
265
|
if (dragging.value) {
|
|
266
266
|
return;
|
|
@@ -297,7 +297,7 @@ export function useToastDrag(args) {
|
|
|
297
297
|
e.preventDefault();
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
if (position === "
|
|
300
|
+
if (position === "left" || position === "right") {
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
303
|
if (state.options.layout?.expand === "click") {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, shallowRef } from "vue";
|
|
2
2
|
import { useScrollLock } from "@vueuse/core";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
scrollbarGutterSupport,
|
|
5
|
+
scrollbarWidth
|
|
6
|
+
} from "@maas/vue-equipment/utils";
|
|
7
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : shallowRef(false);
|
|
5
8
|
export function useToastScrollLock() {
|
|
6
9
|
const positionFixedElements = ref([]);
|
|
7
10
|
function lockScroll() {
|
|
@@ -12,25 +15,40 @@ export function useToastScrollLock() {
|
|
|
12
15
|
}
|
|
13
16
|
function addScrollLockPadding() {
|
|
14
17
|
if (typeof window === "undefined") return;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
document.body.style.setProperty(
|
|
19
|
+
"--scrollbar-width",
|
|
20
|
+
`${scrollbarWidth()}px`
|
|
21
|
+
);
|
|
19
22
|
positionFixedElements.value = [
|
|
20
23
|
...document.body.getElementsByTagName("*")
|
|
21
24
|
].filter(
|
|
22
|
-
(x) => getComputedStyle(x, null).getPropertyValue("position") === "fixed" &&
|
|
23
|
-
);
|
|
24
|
-
positionFixedElements.value.forEach(
|
|
25
|
-
(elem) => elem.style.paddingRight = "var(--scrollbar-width)"
|
|
25
|
+
(x) => getComputedStyle(x, null).getPropertyValue("position") === "fixed" && getComputedStyle(x, null).getPropertyValue("right") === "0px"
|
|
26
26
|
);
|
|
27
|
+
switch (scrollbarGutterSupport()) {
|
|
28
|
+
case true:
|
|
29
|
+
document.documentElement.style.scrollbarGutter = "stable";
|
|
30
|
+
positionFixedElements.value.forEach((elem) => {
|
|
31
|
+
elem.style.scrollbarGutter = "stable";
|
|
32
|
+
elem.style.overflow = "auto";
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
case false:
|
|
36
|
+
document.body.style.paddingRight = "var(--scrollbar-width)";
|
|
37
|
+
positionFixedElements.value.forEach(
|
|
38
|
+
(elem) => elem.style.paddingRight = "var(--scrollbar-width)"
|
|
39
|
+
);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
27
42
|
}
|
|
28
43
|
function removeScrollLockPadding() {
|
|
29
|
-
document.
|
|
44
|
+
document.documentElement.style.scrollbarGutter = "";
|
|
30
45
|
document.body.style.removeProperty("--scrollbar-width");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
document.body.style.paddingRight = "";
|
|
47
|
+
positionFixedElements.value.forEach((elem) => {
|
|
48
|
+
elem.style.paddingRight = "";
|
|
49
|
+
elem.style.scrollbarGutter = "";
|
|
50
|
+
elem.style.overflow = "";
|
|
51
|
+
});
|
|
34
52
|
}
|
|
35
53
|
return {
|
|
36
54
|
lockScroll,
|
|
@@ -11,6 +11,7 @@ export declare function useMagicToast(id: MaybeRef<string>): {
|
|
|
11
11
|
count: import("vue").ComputedRef<number>;
|
|
12
12
|
add: (args: AddArgs) => string;
|
|
13
13
|
remove: (id: string) => void;
|
|
14
|
+
clear: (transition?: string) => Promise<void>;
|
|
14
15
|
expand: () => void;
|
|
15
16
|
collapse: () => void;
|
|
16
17
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { computed, toValue } from "vue";
|
|
1
|
+
import { computed, toValue, nextTick } from "vue";
|
|
2
2
|
import { useToastState } from "./private/useToastState.mjs";
|
|
3
3
|
import { useToastView } from "./private/useToastView.mjs";
|
|
4
4
|
export function useMagicToast(id) {
|
|
5
5
|
const { initializeState } = useToastState(toValue(id));
|
|
6
6
|
const state = initializeState();
|
|
7
7
|
const { initializeView, deleteView } = useToastView(id);
|
|
8
|
-
const toasts = computed(() => state
|
|
8
|
+
const toasts = computed(() => state.views);
|
|
9
9
|
const count = computed(() => toasts.value?.length);
|
|
10
10
|
function add(args) {
|
|
11
11
|
const { id: id2, component, props, duration } = args;
|
|
@@ -21,6 +21,13 @@ export function useMagicToast(id) {
|
|
|
21
21
|
function remove(id2) {
|
|
22
22
|
deleteView(id2);
|
|
23
23
|
}
|
|
24
|
+
async function clear(transition) {
|
|
25
|
+
const lastTransition = state.options.transition;
|
|
26
|
+
state.options.transition = transition ?? "";
|
|
27
|
+
state.views = [];
|
|
28
|
+
await nextTick();
|
|
29
|
+
state.options.transition = lastTransition;
|
|
30
|
+
}
|
|
24
31
|
function expand() {
|
|
25
32
|
state.expanded = true;
|
|
26
33
|
}
|
|
@@ -32,6 +39,7 @@ export function useMagicToast(id) {
|
|
|
32
39
|
count,
|
|
33
40
|
add,
|
|
34
41
|
remove,
|
|
42
|
+
clear,
|
|
35
43
|
expand,
|
|
36
44
|
collapse
|
|
37
45
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybeRef } from 'vue';
|
|
2
2
|
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
3
|
-
type Position = 'top-left' | 'top
|
|
3
|
+
type Position = 'top-left' | 'top' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
4
4
|
export type ToastView = {
|
|
5
5
|
id: string;
|
|
6
6
|
component: object;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './MagicMarquee/index.js';
|
|
|
8
8
|
export * from './MagicMenu/index.js';
|
|
9
9
|
export * from './MagicModal/index.js';
|
|
10
10
|
export * from './MagicNoise/index.js';
|
|
11
|
+
export * from './MagicPie/index.js';
|
|
11
12
|
export * from './MagicPlayer/index.js';
|
|
12
13
|
export * from './MagicScroll/index.js';
|
|
13
14
|
export * from './MagicToast/index.js';
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./MagicMarquee/index.mjs";
|
|
|
8
8
|
export * from "./MagicMenu/index.mjs";
|
|
9
9
|
export * from "./MagicModal/index.mjs";
|
|
10
10
|
export * from "./MagicNoise/index.mjs";
|
|
11
|
+
export * from "./MagicPie/index.mjs";
|
|
11
12
|
export * from "./MagicPlayer/index.mjs";
|
|
12
13
|
export * from "./MagicScroll/index.mjs";
|
|
13
14
|
export * from "./MagicToast/index.mjs";
|