@maas/vue-equipment 0.7.2 → 0.7.4

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.7.1"
4
+ "version": "0.7.3"
5
5
  }
@@ -1,6 +1,5 @@
1
1
  import { ref, computed, toValue } from "vue";
2
2
  import { defu } from "defu";
3
- import { v4 as uuidv4 } from "uuid";
4
3
  import { useScrollLock } from "@vueuse/core";
5
4
  import { useFocusTrap } from "@vueuse/integrations/useFocusTrap";
6
5
  import { useModalStore } from "./private/useModalStore.mjs";
@@ -10,7 +9,7 @@ const defaultOptions = {
10
9
  };
11
10
  export function useModalApi(id, options) {
12
11
  const positionFixedElements = ref([]);
13
- const mappedId = computed(() => toValue(id) || uuidv4());
12
+ const mappedId = computed(() => toValue(id) || crypto.randomUUID());
14
13
  const mappedOptions = defu(options, defaultOptions);
15
14
  const focusTrap = mappedOptions.focusTarget ? useFocusTrap(mappedOptions.focusTarget) : void 0;
16
15
  const scrollLock = mappedOptions.scrollLock && typeof window !== "undefined" ? useScrollLock(document.body) : ref(false);
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <Teleport
3
+ :key="teleportKey"
3
4
  :to="mappedOptions.teleport?.target"
4
5
  :disabled="mappedOptions.teleport?.disabled"
5
6
  >
@@ -43,7 +44,7 @@
43
44
 
44
45
  <script setup lang="ts">
45
46
  import { defu } from 'defu'
46
- import { toValue, ref, type MaybeRef } from 'vue'
47
+ import { toValue, ref, computed, watch, type MaybeRef } from 'vue'
47
48
  import { onClickOutside, type MaybeElement } from '@vueuse/core'
48
49
  import { defaultOptions } from './../utils/defaultOptions'
49
50
  import { useToastApi } from './../composables/useToastApi'
@@ -65,6 +66,7 @@ const { toasts, count, oldest } = useToastApi(props.id)
65
66
 
66
67
  const mappedOptions = defu(props.options, defaultOptions)
67
68
  const isExpanded = ref(mappedOptions.layout?.expand === true)
69
+ const teleportKey = ref(crypto.randomUUID())
68
70
  const listRef = ref<MaybeElement>()
69
71
 
70
72
  const {
@@ -102,6 +104,10 @@ function outsideClickCallback() {
102
104
  }
103
105
 
104
106
  onClickOutside(listRef, outsideClickCallback)
107
+ watch(
108
+ () => props.id,
109
+ () => (teleportKey.value = crypto.randomUUID()),
110
+ )
105
111
  </script>
106
112
 
107
113
  <style lang="css">
@@ -1,4 +1,4 @@
1
1
  import type { ToastInstance, AddArgs } from './../../types.js';
2
2
  export declare function useToastInternalApi(): {
3
- addToast: (args: AddArgs, ctx: ToastInstance) => string;
3
+ addToast: (args: AddArgs, ctx: ToastInstance) => `${string}-${string}-${string}-${string}-${string}`;
4
4
  };
@@ -1,4 +1,3 @@
1
- import { v4 as uuidv4 } from "uuid";
2
1
  export function useToastInternalApi() {
3
2
  function removeToastAfterTimeout(id, duration, ctx) {
4
3
  if (duration > 0) {
@@ -8,7 +7,7 @@ export function useToastInternalApi() {
8
7
  }
9
8
  }
10
9
  function addToast(args, ctx) {
11
- const id = uuidv4();
10
+ const id = crypto.randomUUID();
12
11
  let { component, props, duration = 0 } = args;
13
12
  const toast = {
14
13
  component,
@@ -5,11 +5,10 @@ import {
5
5
  toValue,
6
6
  markRaw
7
7
  } from "vue";
8
- import { v4 as uuidv4 } from "uuid";
9
8
  import { useToastStore } from "./private/useToastStore.mjs";
10
9
  export function useToastApi(id) {
11
10
  const { findInstance, addInstance, removeInstance } = useToastStore();
12
- const mappedId = computed(() => toValue(id) || uuidv4());
11
+ const mappedId = computed(() => toValue(id) || crypto.randomUUID());
13
12
  const instance = computed(() => findInstance(toValue(mappedId)));
14
13
  function initialize() {
15
14
  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.2",
4
+ "version": "0.7.4",
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",