@maas/vue-equipment 0.7.3 → 0.7.5
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/MagicModal/src/composables/useModalApi.d.ts +1 -1
- package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +7 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +2 -2
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +2 -2
- package/package.json +1 -1
- package/dist/utils/types/PickPartial.d.ts +0 -4
package/dist/nuxt/module.json
CHANGED
|
@@ -5,7 +5,7 @@ export type useModalApiOptions = Pick<Options, 'scrollLock'> & {
|
|
|
5
5
|
focusTarget: MaybeElementRef;
|
|
6
6
|
};
|
|
7
7
|
export declare function useModalApi(id?: MaybeRef<string>, options?: useModalApiOptions): {
|
|
8
|
-
id: import("vue").ComputedRef<
|
|
8
|
+
id: import("vue").ComputedRef<any>;
|
|
9
9
|
isActive: import("vue").ComputedRef<boolean>;
|
|
10
10
|
open: () => void;
|
|
11
11
|
close: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
1
2
|
import { ref, computed, toValue } from "vue";
|
|
2
3
|
import { defu } from "defu";
|
|
3
|
-
import { v4 as uuidv4 } from "uuid";
|
|
4
4
|
import { useScrollLock } from "@vueuse/core";
|
|
5
5
|
import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
|
|
6
6
|
import { useModalStore } from "./private/useModalStore.mjs";
|
|
@@ -10,7 +10,7 @@ const defaultOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
export function useModalApi(id, options) {
|
|
12
12
|
const positionFixedElements = ref([]);
|
|
13
|
-
const mappedId = computed(() => toValue(id) ||
|
|
13
|
+
const mappedId = computed(() => toValue(id) || crypto.randomUUID());
|
|
14
14
|
const mappedOptions = defu(options, defaultOptions);
|
|
15
15
|
const focusTrap = mappedOptions.focusTarget ? useFocusTrap(mappedOptions.focusTarget) : void 0;
|
|
16
16
|
const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
|
|
@@ -43,8 +43,9 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
|
+
import crypto from 'crypto'
|
|
46
47
|
import { defu } from 'defu'
|
|
47
|
-
import { toValue, ref,
|
|
48
|
+
import { toValue, ref, watch, type MaybeRef } from 'vue'
|
|
48
49
|
import { onClickOutside, type MaybeElement } from '@vueuse/core'
|
|
49
50
|
import { defaultOptions } from './../utils/defaultOptions'
|
|
50
51
|
import { useToastApi } from './../composables/useToastApi'
|
|
@@ -66,6 +67,7 @@ const { toasts, count, oldest } = useToastApi(props.id)
|
|
|
66
67
|
|
|
67
68
|
const mappedOptions = defu(props.options, defaultOptions)
|
|
68
69
|
const isExpanded = ref(mappedOptions.layout?.expand === true)
|
|
70
|
+
const teleportKey = ref(crypto.randomUUID())
|
|
69
71
|
const listRef = ref<MaybeElement>()
|
|
70
72
|
|
|
71
73
|
const {
|
|
@@ -78,8 +80,6 @@ const {
|
|
|
78
80
|
activeElements,
|
|
79
81
|
} = useToastCallback({ id: props.id, mappedOptions, count, oldest })
|
|
80
82
|
|
|
81
|
-
const teleportKey = computed(() => `${props.class}-${props.id}`)
|
|
82
|
-
|
|
83
83
|
function onMouseenter() {
|
|
84
84
|
if (mappedOptions.layout?.expand === 'hover') {
|
|
85
85
|
isExpanded.value = true
|
|
@@ -105,6 +105,10 @@ function outsideClickCallback() {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
onClickOutside(listRef, outsideClickCallback)
|
|
108
|
+
watch(
|
|
109
|
+
() => props.id,
|
|
110
|
+
() => (teleportKey.value = crypto.randomUUID()),
|
|
111
|
+
)
|
|
108
112
|
</script>
|
|
109
113
|
|
|
110
114
|
<style lang="css">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import crypto from "crypto";
|
|
2
2
|
export function useToastInternalApi() {
|
|
3
3
|
function removeToastAfterTimeout(id, duration, ctx) {
|
|
4
4
|
if (duration > 0) {
|
|
@@ -8,7 +8,7 @@ export function useToastInternalApi() {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
function addToast(args, ctx) {
|
|
11
|
-
const id =
|
|
11
|
+
const id = crypto.randomUUID();
|
|
12
12
|
let { component, props, duration = 0 } = args;
|
|
13
13
|
const toast = {
|
|
14
14
|
component,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
1
2
|
import {
|
|
2
3
|
computed,
|
|
3
4
|
onUnmounted,
|
|
@@ -5,11 +6,10 @@ import {
|
|
|
5
6
|
toValue,
|
|
6
7
|
markRaw
|
|
7
8
|
} from "vue";
|
|
8
|
-
import { v4 as uuidv4 } from "uuid";
|
|
9
9
|
import { useToastStore } from "./private/useToastStore.mjs";
|
|
10
10
|
export function useToastApi(id) {
|
|
11
11
|
const { findInstance, addInstance, removeInstance } = useToastStore();
|
|
12
|
-
const mappedId = computed(() => toValue(id) ||
|
|
12
|
+
const mappedId = computed(() => toValue(id) || crypto.randomUUID());
|
|
13
13
|
const instance = computed(() => findInstance(toValue(mappedId)));
|
|
14
14
|
function initialize() {
|
|
15
15
|
const id2 = toValue(mappedId);
|
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.7.
|
|
4
|
+
"version": "0.7.5",
|
|
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",
|