@maas/vue-equipment 0.5.0 → 0.6.1
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/composables/index.d.mts +23 -1
- package/dist/composables/index.d.ts +23 -1
- package/dist/composables/index.js +118 -8
- package/dist/composables/index.js.map +1 -1
- package/dist/composables/index.mjs +111 -2
- package/dist/composables/index.mjs.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +16 -2
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +3 -3
- package/dist/plugins/MagicMarquee/src/composables/{useMarquee.d.ts → useMarqueeApi.d.ts} +2 -2
- package/dist/plugins/MagicMarquee/src/composables/{useMarquee.mjs → useMarqueeApi.mjs} +1 -1
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +39 -59
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +15 -15
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +22 -0
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.mjs +60 -0
- package/dist/plugins/MagicModal/src/composables/useModalApi.d.ts +4 -3
- package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +5 -4
- package/dist/plugins/MagicModal/src/types/index.d.ts +7 -5
- package/dist/plugins/MagicModal/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/useControlsApi.mjs +1 -2
- package/dist/plugins/MagicPlayer/src/composables/useMediaApi.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/useMediaApi.mjs +2 -2
- package/dist/plugins/MagicPlayer/src/composables/useRuntimeSourceProvider.mjs +1 -2
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicScroll/index.d.ts +2 -2
- package/dist/plugins/MagicScroll/index.mjs +4 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +58 -0
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +42 -0
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +9 -9
- package/dist/plugins/MagicScroll/src/composables/{useProgress.d.ts → useScrollApi.d.ts} +4 -4
- package/dist/plugins/MagicScroll/src/composables/{useProgress.mjs → useScrollApi.mjs} +2 -3
- package/dist/plugins/MagicScroll/src/types/injectionKeys.d.ts +1 -2
- package/dist/plugins/MagicToast/demo/DemoToast.vue +22 -0
- package/dist/plugins/MagicToast/demo/DemoToast.vue.d.ts +14 -0
- package/dist/plugins/MagicToast/index.d.ts +5 -0
- package/dist/plugins/MagicToast/index.mjs +9 -0
- package/dist/plugins/MagicToast/nuxt.d.ts +2 -0
- package/dist/plugins/MagicToast/nuxt.mjs +5 -0
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +230 -0
- package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +28 -0
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +101 -0
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +48 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +21 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +43 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +4 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +26 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +17 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.mjs +41 -0
- package/dist/plugins/MagicToast/src/composables/useToastApi.d.ts +11 -0
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +60 -0
- package/dist/plugins/MagicToast/src/composables/useToastEmitter.d.ts +15 -0
- package/dist/plugins/MagicToast/src/composables/useToastEmitter.mjs +9 -0
- package/dist/plugins/MagicToast/src/types/index.d.ts +42 -0
- package/dist/plugins/MagicToast/src/types/index.mjs +0 -0
- package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +3 -0
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +14 -0
- package/dist/plugins/index.d.ts +2 -1
- package/dist/plugins/index.mjs +2 -1
- package/package.json +13 -1
- /package/dist/plugins/MagicModal/src/composables/{useModalStore.d.ts → private/useModalStore.d.ts} +0 -0
- /package/dist/plugins/MagicModal/src/composables/{useModalStore.mjs → private/useModalStore.mjs} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
onUnmounted,
|
|
4
|
+
onBeforeMount,
|
|
5
|
+
toValue,
|
|
6
|
+
markRaw
|
|
7
|
+
} from "vue";
|
|
8
|
+
import { v4 as uuidv4 } from "uuid";
|
|
9
|
+
import { useToastStore } from "./private/useToastStore.mjs";
|
|
10
|
+
export function useToastApi(id) {
|
|
11
|
+
const { findInstance, addInstance, removeInstance } = useToastStore();
|
|
12
|
+
const mappedId = computed(() => toValue(id) || uuidv4());
|
|
13
|
+
const instance = computed(() => findInstance(toValue(mappedId)));
|
|
14
|
+
function initialize() {
|
|
15
|
+
const id2 = toValue(mappedId);
|
|
16
|
+
if (!findInstance(id2)) {
|
|
17
|
+
return addInstance(id2);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function destroy(id2) {
|
|
21
|
+
if (!id2)
|
|
22
|
+
return;
|
|
23
|
+
clear();
|
|
24
|
+
removeInstance(toValue(id2));
|
|
25
|
+
}
|
|
26
|
+
const toasts = computed(() => instance.value?.toasts);
|
|
27
|
+
const count = computed(() => toasts.value?.length);
|
|
28
|
+
const oldest = computed(() => toasts.value?.[0]);
|
|
29
|
+
async function add(options) {
|
|
30
|
+
const { component, props, duration } = options;
|
|
31
|
+
const id2 = instance.value?.add({
|
|
32
|
+
props,
|
|
33
|
+
duration,
|
|
34
|
+
component: markRaw(component)
|
|
35
|
+
});
|
|
36
|
+
return id2;
|
|
37
|
+
}
|
|
38
|
+
function remove(id2) {
|
|
39
|
+
instance.value?.remove(id2);
|
|
40
|
+
}
|
|
41
|
+
function clear() {
|
|
42
|
+
if (!instance.value)
|
|
43
|
+
return;
|
|
44
|
+
instance.value.toasts = [];
|
|
45
|
+
}
|
|
46
|
+
onBeforeMount(() => {
|
|
47
|
+
initialize();
|
|
48
|
+
});
|
|
49
|
+
onUnmounted(() => {
|
|
50
|
+
destroy(toValue(mappedId));
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
toasts,
|
|
54
|
+
count,
|
|
55
|
+
oldest,
|
|
56
|
+
add,
|
|
57
|
+
remove,
|
|
58
|
+
clear
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToastEvents } from '../types.js';
|
|
2
|
+
export declare function useToastEmitter(): {
|
|
3
|
+
on: {
|
|
4
|
+
<Key extends keyof ToastEvents>(type: Key, handler: import("mitt").Handler<ToastEvents[Key]>): void;
|
|
5
|
+
(type: "*", handler: import("mitt").WildcardHandler<ToastEvents>): void;
|
|
6
|
+
};
|
|
7
|
+
off: {
|
|
8
|
+
<Key_1 extends keyof ToastEvents>(type: Key_1, handler?: import("mitt").Handler<ToastEvents[Key_1]> | undefined): void;
|
|
9
|
+
(type: "*", handler: import("mitt").WildcardHandler<ToastEvents>): void;
|
|
10
|
+
};
|
|
11
|
+
emit: {
|
|
12
|
+
<Key_2 extends keyof ToastEvents>(type: Key_2, event: ToastEvents[Key_2]): void;
|
|
13
|
+
<Key_3 extends keyof ToastEvents>(type: undefined extends ToastEvents[Key_3] ? Key_3 : never): void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { MaybeRef } from 'vue';
|
|
2
|
+
type Toast = {
|
|
3
|
+
id: string;
|
|
4
|
+
component: Object;
|
|
5
|
+
props?: MaybeRef<Record<string, any>>;
|
|
6
|
+
remove: Function;
|
|
7
|
+
};
|
|
8
|
+
type ToastInstance = {
|
|
9
|
+
id: string;
|
|
10
|
+
toasts: Toast[];
|
|
11
|
+
add: (args: AddArgs) => string;
|
|
12
|
+
remove: (id: string) => void;
|
|
13
|
+
};
|
|
14
|
+
type Options = {
|
|
15
|
+
teleport?: {
|
|
16
|
+
target?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
};
|
|
19
|
+
transitions?: {
|
|
20
|
+
list: string;
|
|
21
|
+
};
|
|
22
|
+
layout?: {
|
|
23
|
+
expand?: boolean | 'hover' | 'click';
|
|
24
|
+
max?: false | number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type ActiveElement = {
|
|
28
|
+
id: string;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
type ToastEvents = {
|
|
32
|
+
beforeEnter: string;
|
|
33
|
+
enter: string;
|
|
34
|
+
afterEnter: string;
|
|
35
|
+
beforeLeave: string;
|
|
36
|
+
leave: string;
|
|
37
|
+
afterLeave: string;
|
|
38
|
+
};
|
|
39
|
+
type AddArgs = Pick<Toast, 'component' | 'props'> & {
|
|
40
|
+
duration?: number;
|
|
41
|
+
};
|
|
42
|
+
export type { Toast, ToastInstance, Options, ActiveElement, ToastEvents, AddArgs, };
|
|
File without changes
|
package/dist/plugins/index.d.ts
CHANGED
package/dist/plugins/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.5",
|
|
@@ -54,15 +54,21 @@
|
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"main": "./dist/nuxt/module.cjs",
|
|
56
56
|
"peerDependencies": {
|
|
57
|
+
"@maas/magic-timer": "^0.1.3",
|
|
57
58
|
"@vueuse/core": "^10.3.0",
|
|
58
59
|
"@vueuse/integrations": "^10.3.0",
|
|
59
60
|
"focus-trap": "^7.5.2",
|
|
60
61
|
"hls.js": "^1.4.10",
|
|
62
|
+
"luxon": "^3.4.2",
|
|
61
63
|
"mitt": "^3.0.1",
|
|
64
|
+
"motion": "^10.16.2",
|
|
62
65
|
"nuxt": "^3.5.1",
|
|
63
66
|
"uuid": "^9.0.0"
|
|
64
67
|
},
|
|
65
68
|
"peerDependenciesMeta": {
|
|
69
|
+
"@maas/magic-timer": {
|
|
70
|
+
"optional": false
|
|
71
|
+
},
|
|
66
72
|
"@vueuse/core": {
|
|
67
73
|
"optional": false
|
|
68
74
|
},
|
|
@@ -72,9 +78,15 @@
|
|
|
72
78
|
"hls.js": {
|
|
73
79
|
"optional": false
|
|
74
80
|
},
|
|
81
|
+
"luxon": {
|
|
82
|
+
"optional": false
|
|
83
|
+
},
|
|
75
84
|
"mitt": {
|
|
76
85
|
"optional": false
|
|
77
86
|
},
|
|
87
|
+
"motion": {
|
|
88
|
+
"optional": false
|
|
89
|
+
},
|
|
78
90
|
"nuxt": {
|
|
79
91
|
"optional": false
|
|
80
92
|
},
|
/package/dist/plugins/MagicModal/src/composables/{useModalStore.d.ts → private/useModalStore.d.ts}
RENAMED
|
File without changes
|
/package/dist/plugins/MagicModal/src/composables/{useModalStore.mjs → private/useModalStore.mjs}
RENAMED
|
File without changes
|