@maas/vue-equipment 0.26.1 → 0.26.3
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/nuxt/module.mjs +2 -2
- package/dist/plugins/MagicCommand/demo/DefaultView.vue.d.ts +1 -0
- package/dist/plugins/MagicCommand/index.d.ts +1 -1
- package/dist/plugins/MagicDrawer/nuxt.mjs +2 -1
- package/dist/plugins/MagicDrawer/src/composables/useDrawerApi.mjs +7 -3
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +1 -0
- package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +7 -3
- package/dist/plugins/MagicScroll/index.d.ts +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +20 -3
- package/dist/plugins/MagicToast/src/composables/useToastApi.d.ts +2 -0
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +4 -14
- package/package.json +2 -1
package/dist/nuxt/module.json
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ const functions$1 = [
|
|
|
4
4
|
{
|
|
5
5
|
name: "MagicCommand",
|
|
6
6
|
"package": "plugins",
|
|
7
|
-
lastUpdated:
|
|
7
|
+
lastUpdated: 1713883907000,
|
|
8
8
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicCommand/",
|
|
9
9
|
description: "command"
|
|
10
10
|
},
|
|
@@ -53,7 +53,7 @@ const functions$1 = [
|
|
|
53
53
|
{
|
|
54
54
|
name: "MagicScroll",
|
|
55
55
|
"package": "plugins",
|
|
56
|
-
lastUpdated:
|
|
56
|
+
lastUpdated: 1713883907000,
|
|
57
57
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicScroll/",
|
|
58
58
|
description: "scroll"
|
|
59
59
|
},
|
|
@@ -4,6 +4,7 @@ interface Props {
|
|
|
4
4
|
}
|
|
5
5
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}, {}>;
|
|
6
6
|
export default _default;
|
|
7
|
+
|
|
7
8
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
8
9
|
type __VLS_TypePropsToOption<T> = {
|
|
9
10
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCommandApi } from './src/composables/useCommandApi.js';
|
|
2
2
|
import { useCommandEmitter } from './src/composables/useCommandEmitter.js';
|
|
3
|
-
import { CommandInstanceId, CommandOptionsKey } from './src/symbols.js';
|
|
3
|
+
import { CommandInstanceId, CommandOptionsKey } from './src/symbols/index.js';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
5
|
import type { CommandEvents } from './src/types/index.js';
|
|
6
6
|
declare const MagicCommandPlugin: Plugin;
|
|
@@ -8,8 +8,9 @@ export default defineNuxtModule({
|
|
|
8
8
|
meta: {
|
|
9
9
|
name: "@maas/vue-equipment/nuxt/MagicDrawer"
|
|
10
10
|
},
|
|
11
|
-
setup() {
|
|
11
|
+
setup(_options, nuxt) {
|
|
12
12
|
const resolver = createResolver(import.meta.url);
|
|
13
|
+
nuxt.options.build.transpile.push("wheel-gestures");
|
|
13
14
|
addComponentsDir({
|
|
14
15
|
path: resolver.resolve("src/components"),
|
|
15
16
|
global: true,
|
|
@@ -11,12 +11,12 @@ const defaultOptions = {
|
|
|
11
11
|
focusTarget: void 0,
|
|
12
12
|
scrollLock: true
|
|
13
13
|
};
|
|
14
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : ref(false);
|
|
14
15
|
export function useDrawerApi(id, options) {
|
|
15
16
|
const positionFixedElements = ref([]);
|
|
16
17
|
const mappedId = computed(() => toValue(id) || uuid());
|
|
17
18
|
const mappedOptions = defu(options, defaultOptions);
|
|
18
19
|
const focusTrap = mappedOptions.focusTarget ? typeof mappedOptions.focusTrap === "boolean" ? useFocusTrap(mappedOptions.focusTarget) : useFocusTrap(mappedOptions.focusTarget, mappedOptions.focusTrap) : void 0;
|
|
19
|
-
const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
|
|
20
20
|
const { drawerStore, addInstance, removeInstance } = useDrawerStore();
|
|
21
21
|
const { deleteState } = useDrawerState(mappedId.value);
|
|
22
22
|
function progressCallback(payload) {
|
|
@@ -52,10 +52,14 @@ export function useDrawerApi(id, options) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function lockScroll() {
|
|
55
|
-
scrollLock
|
|
55
|
+
if (mappedOptions.scrollLock) {
|
|
56
|
+
scrollLock.value = true;
|
|
57
|
+
}
|
|
56
58
|
}
|
|
57
59
|
function unlockScroll() {
|
|
58
|
-
scrollLock
|
|
60
|
+
if (mappedOptions.scrollLock) {
|
|
61
|
+
scrollLock.value = false;
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
function addScrollLockPadding() {
|
|
61
65
|
if (typeof window === "undefined")
|
|
@@ -9,12 +9,12 @@ const defaultOptions = {
|
|
|
9
9
|
focusTarget: void 0,
|
|
10
10
|
scrollLock: true
|
|
11
11
|
};
|
|
12
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : ref(false);
|
|
12
13
|
export function useModalApi(id, options) {
|
|
13
14
|
const positionFixedElements = ref([]);
|
|
14
15
|
const mappedId = computed(() => toValue(id) || uuid());
|
|
15
16
|
const mappedOptions = defu(options, defaultOptions);
|
|
16
17
|
const focusTrap = mappedOptions.focusTarget ? typeof mappedOptions.focusTrap === "boolean" ? useFocusTrap(mappedOptions.focusTarget) : useFocusTrap(mappedOptions.focusTarget, mappedOptions.focusTrap) : void 0;
|
|
17
|
-
const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
|
|
18
18
|
const { modalStore, addInstance, removeInstance } = useModalStore();
|
|
19
19
|
const isActive = computed(() => modalStore.value.includes(mappedId.value));
|
|
20
20
|
function open() {
|
|
@@ -34,10 +34,14 @@ export function useModalApi(id, options) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function lockScroll() {
|
|
37
|
-
scrollLock
|
|
37
|
+
if (mappedOptions.scrollLock) {
|
|
38
|
+
scrollLock.value = true;
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
function unlockScroll() {
|
|
40
|
-
scrollLock
|
|
42
|
+
if (mappedOptions.scrollLock) {
|
|
43
|
+
scrollLock.value = false;
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
function addScrollLockPadding() {
|
|
43
47
|
if (typeof window === "undefined")
|
|
@@ -6,9 +6,9 @@ import MagicScrollCollision from './src/components/MagicScrollCollision.vue.js';
|
|
|
6
6
|
import { useCollisionEmitter } from './src/composables/useCollisionEmitter.js';
|
|
7
7
|
import { useScrollApi } from './src/composables/useScrollApi.js';
|
|
8
8
|
import { useCollisionDetect } from './src/composables/useCollisionDetect.js';
|
|
9
|
-
import { ScrollParentKey, ScrollPositionKey, ScrollProgressKey } from './src/symbols.js';
|
|
9
|
+
import { ScrollParentKey, ScrollPositionKey, ScrollProgressKey } from './src/symbols/index.js';
|
|
10
10
|
import type { Plugin } from 'vue';
|
|
11
11
|
declare const MagicScrollPlugin: Plugin;
|
|
12
12
|
export { MagicScrollPlugin, MagicScrollProvider, MagicScrollScene, MagicScrollTransform, MagicScrollMotion, MagicScrollCollision, useCollisionEmitter, useScrollApi, useCollisionDetect, ScrollParentKey, ScrollPositionKey, ScrollProgressKey, };
|
|
13
|
-
export * from './src/symbols.js';
|
|
13
|
+
export * from './src/symbols/index.js';
|
|
14
14
|
export type * from './src/types/index';
|
|
@@ -43,10 +43,17 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
toValue,
|
|
48
|
+
ref,
|
|
49
|
+
watch,
|
|
50
|
+
onBeforeMount,
|
|
51
|
+
onUnmounted,
|
|
52
|
+
type MaybeRef,
|
|
53
|
+
} from 'vue'
|
|
47
54
|
import { defu } from 'defu'
|
|
48
|
-
import { toValue, ref, watch, type MaybeRef } from 'vue'
|
|
49
55
|
import { onClickOutside, type MaybeElement } from '@vueuse/core'
|
|
56
|
+
import { uuid } from '@maas/vue-equipment/utils'
|
|
50
57
|
import { defaultOptions } from './../utils/defaultOptions'
|
|
51
58
|
import { useToastApi } from './../composables/useToastApi'
|
|
52
59
|
import { useToastCallback } from './../composables/private/useToastCallback'
|
|
@@ -69,7 +76,7 @@ interface MagicToastProps {
|
|
|
69
76
|
|
|
70
77
|
const props = defineProps<MagicToastProps>()
|
|
71
78
|
|
|
72
|
-
const { toasts, count, oldest } = useToastApi(props.id)
|
|
79
|
+
const { toasts, count, oldest, initialize, destroy } = useToastApi(props.id)
|
|
73
80
|
|
|
74
81
|
const mappedOptions = defu(props.options, defaultOptions)
|
|
75
82
|
const isExpanded = ref(mappedOptions.layout?.expand === true)
|
|
@@ -111,10 +118,20 @@ function outsideClickCallback() {
|
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
onClickOutside(listRef, outsideClickCallback)
|
|
121
|
+
|
|
122
|
+
// Lifecycle hooks and listeners
|
|
114
123
|
watch(
|
|
115
124
|
() => props.id,
|
|
116
125
|
() => (teleportKey.value = uuid())
|
|
117
126
|
)
|
|
127
|
+
|
|
128
|
+
onBeforeMount(() => {
|
|
129
|
+
initialize()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
onUnmounted(() => {
|
|
133
|
+
destroy(toValue(props.id))
|
|
134
|
+
})
|
|
118
135
|
</script>
|
|
119
136
|
|
|
120
137
|
<style>
|
|
@@ -7,5 +7,7 @@ export declare function useToastApi(id?: MaybeRef<string>): {
|
|
|
7
7
|
add: (options: AddArgs) => Promise<string | undefined>;
|
|
8
8
|
remove: (id: string) => void;
|
|
9
9
|
clear: () => void;
|
|
10
|
+
initialize: () => import("./../types").ToastInstance | undefined;
|
|
11
|
+
destroy: (id: string) => void;
|
|
10
12
|
};
|
|
11
13
|
export type UseToastApiReturn = ReturnType<typeof useToastApi>;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
|
-
import {
|
|
3
|
-
computed,
|
|
4
|
-
onUnmounted,
|
|
5
|
-
onBeforeMount,
|
|
6
|
-
toValue,
|
|
7
|
-
markRaw
|
|
8
|
-
} from "vue";
|
|
2
|
+
import { computed, toValue, markRaw } from "vue";
|
|
9
3
|
import { useToastStore } from "./private/useToastStore.mjs";
|
|
10
4
|
export function useToastApi(id) {
|
|
11
5
|
const { findInstance, addInstance, removeInstance } = useToastStore();
|
|
@@ -43,18 +37,14 @@ export function useToastApi(id) {
|
|
|
43
37
|
return;
|
|
44
38
|
instance.value.toasts = [];
|
|
45
39
|
}
|
|
46
|
-
onBeforeMount(() => {
|
|
47
|
-
initialize();
|
|
48
|
-
});
|
|
49
|
-
onUnmounted(() => {
|
|
50
|
-
destroy(toValue(mappedId));
|
|
51
|
-
});
|
|
52
40
|
return {
|
|
53
41
|
toasts,
|
|
54
42
|
count,
|
|
55
43
|
oldest,
|
|
56
44
|
add,
|
|
57
45
|
remove,
|
|
58
|
-
clear
|
|
46
|
+
clear,
|
|
47
|
+
initialize,
|
|
48
|
+
destroy
|
|
59
49
|
};
|
|
60
50
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.3",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@antfu/ni": "^0.21.12",
|
|
8
8
|
"@release-it/bumper": "^6.0.1",
|
|
9
9
|
"@types/node": "^20.10.4",
|
|
10
|
+
"@vue/tsconfig": "^0.5.1",
|
|
10
11
|
"release-it": "^17.0.1",
|
|
11
12
|
"turbo": "^1.11.2"
|
|
12
13
|
},
|