@maas/vue-equipment 1.0.0-beta.36 → 1.0.0-beta.37
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/MagicAccordionProvider.vue +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +4 -4
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.d.ts +1 -5
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.mjs +2 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +8 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +2 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +1 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +0 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.mjs +8 -12
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +4 -4
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +8 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +2 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +16 -5
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +7 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +1 -1
- package/dist/plugins/MagicToast/src/types/index.d.ts +8 -8
- package/package.json +1 -1
- /package/dist/plugins/MagicToast/{symbols → src/symbols}/index.d.ts +0 -0
- /package/dist/plugins/MagicToast/{symbols → src/symbols}/index.mjs +0 -0
package/dist/nuxt/module.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import { onBeforeUnmount, provide } from "vue";
|
|
9
9
|
import { Primitive } from "@maas/vue-primitive";
|
|
10
|
-
import { MagicAccordionInstanceId } from "../symbols";
|
|
11
10
|
import { useAccordionState } from "../composables/private/useAccordionState";
|
|
11
|
+
import { MagicAccordionInstanceId } from "../symbols";
|
|
12
12
|
const { id, asChild, options } = defineProps({
|
|
13
13
|
id: { type: null, required: true },
|
|
14
14
|
asChild: { type: Boolean, required: false },
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<primitive
|
|
3
3
|
:as-child="asChild"
|
|
4
4
|
:data-id="mappedId"
|
|
5
|
-
:data-active="
|
|
5
|
+
:data-active="mappedActive"
|
|
6
6
|
class="magic-accordion-view"
|
|
7
7
|
>
|
|
8
|
-
<slot :view-active="
|
|
8
|
+
<slot :view-active="mappedActive" />
|
|
9
9
|
</primitive>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
MagicAccordionViewId
|
|
22
22
|
} from "../symbols";
|
|
23
23
|
import { useAccordionView } from "../composables/private/useAccordionView";
|
|
24
|
-
const { id, active } = defineProps({
|
|
24
|
+
const { id, active = false } = defineProps({
|
|
25
25
|
id: { type: String, required: false },
|
|
26
26
|
asChild: { type: Boolean, required: false },
|
|
27
27
|
active: { type: Boolean, required: false }
|
|
@@ -40,7 +40,7 @@ const mappedActive = computed(() => view.active);
|
|
|
40
40
|
const { initializeView, deleteView } = useAccordionView(instanceId);
|
|
41
41
|
const view = initializeView({
|
|
42
42
|
id: mappedId.value,
|
|
43
|
-
active
|
|
43
|
+
active
|
|
44
44
|
});
|
|
45
45
|
provide(MagicAccordionViewId, mappedId.value);
|
|
46
46
|
provide(MagicAccordionViewActive, mappedActive);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
-
|
|
3
|
-
instanceId: MaybeRef<string>;
|
|
4
|
-
}
|
|
5
|
-
export declare function useMagicAccordion(args: UseMagicAccordionArgs): {
|
|
2
|
+
export declare function useMagicAccordion(id: MaybeRef<string>): {
|
|
6
3
|
selectView: (id: string) => void;
|
|
7
4
|
unselectView: (id: string) => void;
|
|
8
5
|
};
|
|
9
6
|
export type UseMagicAccordionReturn = ReturnType<typeof useMagicAccordion>;
|
|
10
|
-
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {} from "vue";
|
|
2
2
|
import { useAccordionView } from "./private/useAccordionView.mjs";
|
|
3
|
-
export function useMagicAccordion(
|
|
4
|
-
const {
|
|
5
|
-
const { selectView, unselectView } = useAccordionView(instanceId);
|
|
3
|
+
export function useMagicAccordion(id) {
|
|
4
|
+
const { selectView, unselectView } = useAccordionView(id);
|
|
6
5
|
return {
|
|
7
6
|
selectView,
|
|
8
7
|
unselectView
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
MagicCommandItemActive,
|
|
38
38
|
MagicCommandItemDisabled
|
|
39
39
|
} from "../symbols";
|
|
40
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
40
41
|
const {
|
|
41
42
|
id,
|
|
42
43
|
initial = false,
|
|
@@ -46,7 +47,7 @@ const {
|
|
|
46
47
|
initial: { type: Boolean, required: false },
|
|
47
48
|
disabled: { type: Boolean, required: false }
|
|
48
49
|
});
|
|
49
|
-
const emit = defineEmits(["click"]);
|
|
50
|
+
const emit = defineEmits(["click", "enter"]);
|
|
50
51
|
const magicError = useMagicError({
|
|
51
52
|
prefix: "MagicCommand",
|
|
52
53
|
source: "MagicCommand"
|
|
@@ -89,9 +90,15 @@ function onClick(event) {
|
|
|
89
90
|
emit("click", event);
|
|
90
91
|
guardedSelect();
|
|
91
92
|
}
|
|
93
|
+
function onReturn() {
|
|
94
|
+
if (!item.disabled && item.active) {
|
|
95
|
+
emit("enter");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
92
98
|
provide(MagicCommandItemId, mappedId.value);
|
|
93
99
|
provide(MagicCommandItemActive, mappedActive);
|
|
94
100
|
provide(MagicCommandItemDisabled, mappedDisabled);
|
|
101
|
+
onKeyStroke("Enter", onReturn);
|
|
95
102
|
onMounted(() => {
|
|
96
103
|
if (initial) {
|
|
97
104
|
selectItem(mappedId.value);
|
|
@@ -12,8 +12,10 @@ type __VLS_Slots = {} & {
|
|
|
12
12
|
};
|
|
13
13
|
declare const __VLS_component: import("vue").DefineComponent<MagicCommandItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
14
14
|
click: (event: MouseEvent) => any;
|
|
15
|
+
enter: () => any;
|
|
15
16
|
}, string, import("vue").PublicProps, Readonly<MagicCommandItemProps> & Readonly<{
|
|
16
17
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
18
|
+
onEnter?: (() => any) | undefined;
|
|
17
19
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
20
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
21
|
export default _default;
|
|
@@ -31,13 +31,11 @@ import {
|
|
|
31
31
|
import { useMagicKeys } from "@vueuse/core";
|
|
32
32
|
const {
|
|
33
33
|
viewId,
|
|
34
|
-
active = void 0,
|
|
35
34
|
disabled = void 0,
|
|
36
35
|
action = "open",
|
|
37
36
|
trigger = ["click"]
|
|
38
37
|
} = defineProps({
|
|
39
38
|
viewId: { type: String, required: false },
|
|
40
|
-
active: { type: Boolean, required: false },
|
|
41
39
|
disabled: { type: Boolean, required: false },
|
|
42
40
|
action: { type: String, required: false },
|
|
43
41
|
trigger: { type: Array, required: false },
|
|
@@ -63,7 +61,7 @@ magicError.assert(mappedViewId.value, {
|
|
|
63
61
|
});
|
|
64
62
|
const { getView } = useCommandView(instanceId);
|
|
65
63
|
const view = getView(mappedViewId.value);
|
|
66
|
-
const mappedActive = computed(() =>
|
|
64
|
+
const mappedActive = computed(() => toValue(itemActive) ?? false);
|
|
67
65
|
const mappedDisabled = computed(
|
|
68
66
|
() => disabled ?? toValue(itemDisabled) ?? false
|
|
69
67
|
);
|
|
@@ -51,12 +51,10 @@ export function useCommandItem(args) {
|
|
|
51
51
|
const index = view?.items.findIndex(
|
|
52
52
|
(item) => item.id === activeItem.value?.id
|
|
53
53
|
);
|
|
54
|
-
if (index !== void 0) {
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
selectItem(
|
|
58
|
-
} else if (view && loop) {
|
|
59
|
-
selectItem(view.items[0].id);
|
|
54
|
+
if (index !== void 0 && view) {
|
|
55
|
+
const nextItem = view.items[index + 1] ?? (loop ? view.items[0] : void 0);
|
|
56
|
+
if (nextItem) {
|
|
57
|
+
selectItem(nextItem.id);
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
}
|
|
@@ -64,12 +62,10 @@ export function useCommandItem(args) {
|
|
|
64
62
|
const index = view?.items.findIndex(
|
|
65
63
|
(item) => item.id === activeItem.value?.id
|
|
66
64
|
);
|
|
67
|
-
if (index !== void 0) {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
selectItem(
|
|
71
|
-
} else if (view && loop) {
|
|
72
|
-
selectItem(view.items[view.items.length - 1].id);
|
|
65
|
+
if (index !== void 0 && view) {
|
|
66
|
+
const prevItem = view.items[index - 1] ?? (loop ? view.items[view.items.length - 1] : void 0);
|
|
67
|
+
if (prevItem) {
|
|
68
|
+
selectItem(prevItem.id);
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function useMagicEmitter(): {
|
|
2
2
|
on: {
|
|
3
|
-
<Key extends "progress" | "
|
|
3
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, handler: import("mitt").Handler<({
|
|
4
4
|
beforeEnter: string | {
|
|
5
5
|
id: string;
|
|
6
6
|
viewId: string;
|
|
@@ -536,7 +536,7 @@ export declare function useMagicEmitter(): {
|
|
|
536
536
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>>): void;
|
|
537
537
|
};
|
|
538
538
|
off: {
|
|
539
|
-
<Key extends "progress" | "
|
|
539
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, handler?: import("mitt").Handler<({
|
|
540
540
|
beforeEnter: string | {
|
|
541
541
|
id: string;
|
|
542
542
|
viewId: string;
|
|
@@ -1072,7 +1072,7 @@ export declare function useMagicEmitter(): {
|
|
|
1072
1072
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>>): void;
|
|
1073
1073
|
};
|
|
1074
1074
|
emit: {
|
|
1075
|
-
<Key extends "progress" | "
|
|
1075
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, event: ({
|
|
1076
1076
|
beforeEnter: string | {
|
|
1077
1077
|
id: string;
|
|
1078
1078
|
viewId: string;
|
|
@@ -1339,7 +1339,7 @@ export declare function useMagicEmitter(): {
|
|
|
1339
1339
|
leave: string;
|
|
1340
1340
|
afterLeave: string;
|
|
1341
1341
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>)[Key]): void;
|
|
1342
|
-
<Key extends "progress" | "
|
|
1342
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: undefined extends ({
|
|
1343
1343
|
beforeEnter: string | {
|
|
1344
1344
|
id: string;
|
|
1345
1345
|
viewId: string;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
20
21
|
import { computed, inject, provide, onBeforeUnmount, watch, useId } from "vue";
|
|
21
22
|
import {
|
|
22
23
|
useMagicError
|
|
@@ -35,7 +36,7 @@ const { id, disabled } = defineProps({
|
|
|
35
36
|
id: { type: String, required: false },
|
|
36
37
|
disabled: { type: Boolean, required: false }
|
|
37
38
|
});
|
|
38
|
-
const emit = defineEmits(["click"]);
|
|
39
|
+
const emit = defineEmits(["click", "enter"]);
|
|
39
40
|
const magicError = useMagicError({
|
|
40
41
|
prefix: "MagicMenu",
|
|
41
42
|
source: "MagicMenu"
|
|
@@ -102,8 +103,14 @@ function onClick(event) {
|
|
|
102
103
|
unselectAllViews();
|
|
103
104
|
}
|
|
104
105
|
}
|
|
106
|
+
function onReturn() {
|
|
107
|
+
if (!item.disabled && item.active) {
|
|
108
|
+
emit("enter");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
105
111
|
provide(MagicMenuItemId, mappedId.value);
|
|
106
112
|
provide(MagicMenuItemActive, mappedActive);
|
|
113
|
+
onKeyStroke("Enter", onReturn);
|
|
107
114
|
onBeforeUnmount(() => {
|
|
108
115
|
deleteItem(mappedId.value);
|
|
109
116
|
});
|
|
@@ -11,8 +11,10 @@ type __VLS_Slots = {} & {
|
|
|
11
11
|
};
|
|
12
12
|
declare const __VLS_component: import("vue").DefineComponent<MagicMenuItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
13
13
|
click: (event: MouseEvent) => any;
|
|
14
|
+
enter: () => any;
|
|
14
15
|
}, string, import("vue").PublicProps, Readonly<MagicMenuItemProps> & Readonly<{
|
|
15
16
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
17
|
+
onEnter?: (() => any) | undefined;
|
|
16
18
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
19
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
18
20
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {} from "vue";
|
|
2
1
|
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
3
2
|
import { useMenuState } from "./useMenuState.mjs";
|
|
4
3
|
import { useMenuView } from "./useMenuView.mjs";
|
|
@@ -43,7 +42,10 @@ export function useMenuKeyListener(instanceId) {
|
|
|
43
42
|
}
|
|
44
43
|
function selectFirstItem(view) {
|
|
45
44
|
const { selectItem } = useMenuItem({ instanceId, viewId: view.id });
|
|
46
|
-
|
|
45
|
+
const firstItem = getEnabledItems(view)[0];
|
|
46
|
+
if (firstItem) {
|
|
47
|
+
selectItem(firstItem.id, true);
|
|
48
|
+
}
|
|
47
49
|
}
|
|
48
50
|
async function onArrowRight(e) {
|
|
49
51
|
try {
|
|
@@ -116,11 +118,17 @@ export function useMenuKeyListener(instanceId) {
|
|
|
116
118
|
const prevIndex = enabledItems.findIndex((item) => item.active) - 1;
|
|
117
119
|
if (prevIndex >= 0) {
|
|
118
120
|
const { selectItem } = useMenuItem({ instanceId, viewId });
|
|
119
|
-
|
|
121
|
+
const prevItem = enabledItems[prevIndex];
|
|
122
|
+
if (prevItem) {
|
|
123
|
+
selectItem(prevItem.id, true);
|
|
124
|
+
}
|
|
120
125
|
unselectUnrelatedViews(viewId);
|
|
121
126
|
} else if (prevIndex !== -1) {
|
|
122
127
|
const { selectItem } = useMenuItem({ instanceId, viewId });
|
|
123
|
-
|
|
128
|
+
const lastItem = enabledItems[enabledItems.length - 1];
|
|
129
|
+
if (lastItem) {
|
|
130
|
+
selectItem(lastItem.id, true);
|
|
131
|
+
}
|
|
124
132
|
unselectUnrelatedViews(viewId);
|
|
125
133
|
}
|
|
126
134
|
}
|
|
@@ -142,7 +150,10 @@ export function useMenuKeyListener(instanceId) {
|
|
|
142
150
|
const nextIndex = enabledItems.findIndex((item) => item.active) + 1;
|
|
143
151
|
if (nextIndex >= 0) {
|
|
144
152
|
const { selectItem } = useMenuItem({ instanceId, viewId });
|
|
145
|
-
|
|
153
|
+
const nextItem = enabledItems[nextIndex];
|
|
154
|
+
if (nextItem) {
|
|
155
|
+
selectItem(nextItem.id, true);
|
|
156
|
+
}
|
|
146
157
|
unselectUnrelatedViews(viewId);
|
|
147
158
|
}
|
|
148
159
|
}
|
|
@@ -55,7 +55,7 @@ import { useToastView } from "../composables/private/useToastView";
|
|
|
55
55
|
import { useToastCallback } from "../composables/private/useToastCallback";
|
|
56
56
|
import { useToastListener } from "../composables/private/useToastListener";
|
|
57
57
|
import MagicToastView from "./MagicToastView.vue";
|
|
58
|
-
import { MagicToastInstanceId } from "
|
|
58
|
+
import { MagicToastInstanceId } from "../symbols";
|
|
59
59
|
import "@maas/vue-equipment/utils/css/keyframes/fade-out.css";
|
|
60
60
|
import "@maas/vue-equipment/utils/css/keyframes/squash-y.css";
|
|
61
61
|
import "@maas/vue-equipment/utils/css/keyframes/slide-ltr-in.css";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="magic-toast-view"
|
|
4
4
|
:data-id="id"
|
|
5
5
|
:data-expanded="state.expanded"
|
|
6
|
-
:data-dragging="view
|
|
6
|
+
:data-dragging="view?.dragging"
|
|
7
7
|
:data-position="state.options.position"
|
|
8
8
|
:data-debug="state.options.debug"
|
|
9
9
|
:style="{
|
|
@@ -29,7 +29,7 @@ import { computed, inject } from "vue";
|
|
|
29
29
|
import {
|
|
30
30
|
useMagicError
|
|
31
31
|
} from "@maas/vue-equipment/plugins/MagicError";
|
|
32
|
-
import { MagicToastInstanceId } from "
|
|
32
|
+
import { MagicToastInstanceId } from "../symbols";
|
|
33
33
|
import { useToastState } from "../composables/private/useToastState";
|
|
34
34
|
import { useToastDrag } from "../composables/private/useToastDrag";
|
|
35
35
|
const { id, index } = defineProps({
|
|
@@ -50,7 +50,11 @@ const state = initializeState();
|
|
|
50
50
|
const count = computed(() => state.views.length);
|
|
51
51
|
const view = computed(() => state.views[index]);
|
|
52
52
|
const reversedIndex = computed(() => count.value - index - 1);
|
|
53
|
-
|
|
53
|
+
magicError.assert(view.value, {
|
|
54
|
+
message: "MagicToastView could not be registered",
|
|
55
|
+
errorCode: "missing_view"
|
|
56
|
+
});
|
|
57
|
+
const height = computed(() => `${view.value?.dimensions?.height}px`);
|
|
54
58
|
const offset = computed(() => {
|
|
55
59
|
const mapped = state.views.slice(0, reversedIndex.value).reduce((acc, view2) => acc + (view2.dimensions?.height ?? 0), 0);
|
|
56
60
|
return `${mapped}px`;
|
|
@@ -12,7 +12,7 @@ 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) {
|
|
15
|
+
if (state.views.length && state.views[0] && state.options.layout?.max && state.views.length > state.options.layout.max) {
|
|
16
16
|
deleteView(state.views[0].id);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MaybeRef } from 'vue';
|
|
2
2
|
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
3
3
|
type Position = 'top-left' | 'top' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
4
|
-
export
|
|
4
|
+
export interface ToastView {
|
|
5
5
|
id: string;
|
|
6
6
|
component: object;
|
|
7
7
|
props?: MaybeRef<Record<string, unknown>>;
|
|
@@ -24,22 +24,22 @@ export type ToastView = {
|
|
|
24
24
|
lastDraggedY: number;
|
|
25
25
|
draggedX: number;
|
|
26
26
|
draggedY: number;
|
|
27
|
-
}
|
|
28
|
-
export
|
|
27
|
+
}
|
|
28
|
+
export interface ToastState {
|
|
29
29
|
id: string;
|
|
30
30
|
views: ToastView[];
|
|
31
31
|
options: ToastDefaultOptions;
|
|
32
32
|
expanded: boolean;
|
|
33
33
|
animating: boolean;
|
|
34
|
-
}
|
|
35
|
-
export
|
|
34
|
+
}
|
|
35
|
+
export interface ActiveToast {
|
|
36
36
|
id: string;
|
|
37
37
|
height: number;
|
|
38
38
|
padding: {
|
|
39
39
|
top: number;
|
|
40
40
|
bottom: number;
|
|
41
41
|
};
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
export interface ToastEvents {
|
|
44
44
|
beforeEnter: string;
|
|
45
45
|
enter: string;
|
|
@@ -48,7 +48,7 @@ export interface ToastEvents {
|
|
|
48
48
|
leave: string;
|
|
49
49
|
afterLeave: string;
|
|
50
50
|
}
|
|
51
|
-
export
|
|
51
|
+
export interface MagicToastOptions {
|
|
52
52
|
debug?: boolean;
|
|
53
53
|
position?: Position;
|
|
54
54
|
duration?: number;
|
|
@@ -78,7 +78,7 @@ export type MagicToastOptions = {
|
|
|
78
78
|
distance?: number;
|
|
79
79
|
momentum?: number;
|
|
80
80
|
};
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
export type ToastDefaultOptions = RequireAll<MagicToastOptions> & {
|
|
83
83
|
threshold: RequireAll<MagicToastOptions['threshold']>;
|
|
84
84
|
animation: RequireAll<MagicToastOptions['animation']>;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|