@maas/vue-equipment 0.7.5 → 0.7.7
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.mjs +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +3 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +2 -2
- package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +2 -2
- package/dist/utils/index.d.mts +5 -1
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +28 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +15 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -6
package/dist/nuxt/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
2
|
import { ref, computed, toValue } from "vue";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useScrollLock } from "@vueuse/core";
|
|
@@ -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) || uuid());
|
|
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,7 +43,7 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
|
-
import
|
|
46
|
+
import { uuid } from '@maas/vue-equipment/utils'
|
|
47
47
|
import { defu } from 'defu'
|
|
48
48
|
import { toValue, ref, watch, type MaybeRef } from 'vue'
|
|
49
49
|
import { onClickOutside, type MaybeElement } from '@vueuse/core'
|
|
@@ -67,7 +67,7 @@ const { toasts, count, oldest } = useToastApi(props.id)
|
|
|
67
67
|
|
|
68
68
|
const mappedOptions = defu(props.options, defaultOptions)
|
|
69
69
|
const isExpanded = ref(mappedOptions.layout?.expand === true)
|
|
70
|
-
const teleportKey = ref(
|
|
70
|
+
const teleportKey = ref(uuid())
|
|
71
71
|
const listRef = ref<MaybeElement>()
|
|
72
72
|
|
|
73
73
|
const {
|
|
@@ -107,7 +107,7 @@ function outsideClickCallback() {
|
|
|
107
107
|
onClickOutside(listRef, outsideClickCallback)
|
|
108
108
|
watch(
|
|
109
109
|
() => props.id,
|
|
110
|
-
() => (teleportKey.value =
|
|
110
|
+
() => (teleportKey.value = uuid()),
|
|
111
111
|
)
|
|
112
112
|
</script>
|
|
113
113
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
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 = uuid();
|
|
12
12
|
let { component, props, duration = 0 } = args;
|
|
13
13
|
const toast = {
|
|
14
14
|
component,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { uuid } from "@maas/vue-equipment/utils";
|
|
2
2
|
import {
|
|
3
3
|
computed,
|
|
4
4
|
onUnmounted,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
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) || uuid());
|
|
13
13
|
const instance = computed(() => findInstance(toValue(mappedId)));
|
|
14
14
|
function initialize() {
|
|
15
15
|
const id2 = toValue(mappedId);
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -4,4 +4,8 @@ declare function isIOS(): boolean;
|
|
|
4
4
|
|
|
5
5
|
declare function mapValue(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
declare function uuid(): `${string}-${string}-${string}-${string}-${string}`;
|
|
8
|
+
|
|
9
|
+
declare function uniq<T extends any[]>(a: T): any[];
|
|
10
|
+
|
|
11
|
+
export { clampValue, isIOS, mapValue, uniq, uuid };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,4 +4,8 @@ declare function isIOS(): boolean;
|
|
|
4
4
|
|
|
5
5
|
declare function mapValue(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
declare function uuid(): `${string}-${string}-${string}-${string}-${string}`;
|
|
8
|
+
|
|
9
|
+
declare function uniq<T extends any[]>(a: T): any[];
|
|
10
|
+
|
|
11
|
+
export { clampValue, isIOS, mapValue, uniq, uuid };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// index.ts
|
|
@@ -22,7 +32,9 @@ var utils_exports = {};
|
|
|
22
32
|
__export(utils_exports, {
|
|
23
33
|
clampValue: () => clampValue,
|
|
24
34
|
isIOS: () => isIOS,
|
|
25
|
-
mapValue: () => mapValue
|
|
35
|
+
mapValue: () => mapValue,
|
|
36
|
+
uniq: () => uniq,
|
|
37
|
+
uuid: () => uuid
|
|
26
38
|
});
|
|
27
39
|
module.exports = __toCommonJS(utils_exports);
|
|
28
40
|
|
|
@@ -42,10 +54,24 @@ function isIOS() {
|
|
|
42
54
|
function mapValue(value, inMin, inMax, outMin, outMax) {
|
|
43
55
|
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
44
56
|
}
|
|
57
|
+
|
|
58
|
+
// src/functions/uuid.ts
|
|
59
|
+
var import_crypto = __toESM(require("crypto"));
|
|
60
|
+
var isBrowser = typeof window !== "undefined";
|
|
61
|
+
function uuid() {
|
|
62
|
+
return isBrowser ? window.crypto.randomUUID() : import_crypto.default.randomUUID();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/functions/uniq.ts
|
|
66
|
+
function uniq(a) {
|
|
67
|
+
return Array.from(new Set(a));
|
|
68
|
+
}
|
|
45
69
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
70
|
0 && (module.exports = {
|
|
47
71
|
clampValue,
|
|
48
72
|
isIOS,
|
|
49
|
-
mapValue
|
|
73
|
+
mapValue,
|
|
74
|
+
uniq,
|
|
75
|
+
uuid
|
|
50
76
|
});
|
|
51
77
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../packages/utils/index.ts","../../packages/utils/src/functions/clampValue.ts","../../packages/utils/src/functions/isIOS.ts","../../packages/utils/src/functions/mapValue.ts"],"sourcesContent":["export * from './src/functions/clampValue'\nexport * from './src/functions/isIOS'\nexport * from './src/functions/mapValue'\n","export function clampValue(value: number, min: number, max: number) {\n return value <= min ? min : value >= max ? max : value\n}\n","export function isIOS() {\n if (typeof window === 'undefined') return false\n return /iPad|iPhone|iPod/.test(navigator?.userAgent)\n}\n","export function mapValue(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number,\n) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../packages/utils/index.ts","../../packages/utils/src/functions/clampValue.ts","../../packages/utils/src/functions/isIOS.ts","../../packages/utils/src/functions/mapValue.ts","../../packages/utils/src/functions/uuid.ts","../../packages/utils/src/functions/uniq.ts"],"sourcesContent":["export * from './src/functions/clampValue'\nexport * from './src/functions/isIOS'\nexport * from './src/functions/mapValue'\nexport * from './src/functions/uuid'\nexport * from './src/functions/uniq'\n","export function clampValue(value: number, min: number, max: number) {\n return value <= min ? min : value >= max ? max : value\n}\n","export function isIOS() {\n if (typeof window === 'undefined') return false\n return /iPad|iPhone|iPod/.test(navigator?.userAgent)\n}\n","export function mapValue(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number,\n) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin\n}\n","import crypto from 'crypto'\nconst isBrowser = typeof window !== 'undefined'\n\nexport function uuid() {\n return isBrowser ? window.crypto.randomUUID() : crypto.randomUUID()\n}\n","export function uniq<T extends any[]>(a: T) {\n return Array.from(new Set(a))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,WAAW,OAAe,KAAa,KAAa;AAClE,SAAO,SAAS,MAAM,MAAM,SAAS,MAAM,MAAM;AACnD;;;ACFO,SAAS,QAAQ;AACtB,MAAI,OAAO,WAAW;AAAa,WAAO;AAC1C,SAAO,mBAAmB,KAAK,WAAW,SAAS;AACrD;;;ACHO,SAAS,SACd,OACA,OACA,OACA,QACA,QACA;AACA,UAAS,QAAQ,UAAU,SAAS,WAAY,QAAQ,SAAS;AACnE;;;ACRA,oBAAmB;AACnB,IAAM,YAAY,OAAO,WAAW;AAE7B,SAAS,OAAO;AACrB,SAAO,YAAY,OAAO,OAAO,WAAW,IAAI,cAAAA,QAAO,WAAW;AACpE;;;ACLO,SAAS,KAAsB,GAAM;AAC1C,SAAO,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC;AAC9B;","names":["crypto"]}
|
package/dist/utils/index.mjs
CHANGED
|
@@ -14,9 +14,23 @@ function isIOS() {
|
|
|
14
14
|
function mapValue(value, inMin, inMax, outMin, outMax) {
|
|
15
15
|
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
// src/functions/uuid.ts
|
|
19
|
+
import crypto from "crypto";
|
|
20
|
+
var isBrowser = typeof window !== "undefined";
|
|
21
|
+
function uuid() {
|
|
22
|
+
return isBrowser ? window.crypto.randomUUID() : crypto.randomUUID();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/functions/uniq.ts
|
|
26
|
+
function uniq(a) {
|
|
27
|
+
return Array.from(new Set(a));
|
|
28
|
+
}
|
|
17
29
|
export {
|
|
18
30
|
clampValue,
|
|
19
31
|
isIOS,
|
|
20
|
-
mapValue
|
|
32
|
+
mapValue,
|
|
33
|
+
uniq,
|
|
34
|
+
uuid
|
|
21
35
|
};
|
|
22
36
|
//# sourceMappingURL=index.mjs.map
|
package/dist/utils/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../packages/utils/src/functions/clampValue.ts","../../packages/utils/src/functions/isIOS.ts","../../packages/utils/src/functions/mapValue.ts"],"sourcesContent":["export function clampValue(value: number, min: number, max: number) {\n return value <= min ? min : value >= max ? max : value\n}\n","export function isIOS() {\n if (typeof window === 'undefined') return false\n return /iPad|iPhone|iPod/.test(navigator?.userAgent)\n}\n","export function mapValue(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number,\n) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin\n}\n"],"mappings":";AAAO,SAAS,WAAW,OAAe,KAAa,KAAa;AAClE,SAAO,SAAS,MAAM,MAAM,SAAS,MAAM,MAAM;AACnD;;;ACFO,SAAS,QAAQ;AACtB,MAAI,OAAO,WAAW;AAAa,WAAO;AAC1C,SAAO,mBAAmB,KAAK,WAAW,SAAS;AACrD;;;ACHO,SAAS,SACd,OACA,OACA,OACA,QACA,QACA;AACA,UAAS,QAAQ,UAAU,SAAS,WAAY,QAAQ,SAAS;AACnE;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../packages/utils/src/functions/clampValue.ts","../../packages/utils/src/functions/isIOS.ts","../../packages/utils/src/functions/mapValue.ts","../../packages/utils/src/functions/uuid.ts","../../packages/utils/src/functions/uniq.ts"],"sourcesContent":["export function clampValue(value: number, min: number, max: number) {\n return value <= min ? min : value >= max ? max : value\n}\n","export function isIOS() {\n if (typeof window === 'undefined') return false\n return /iPad|iPhone|iPod/.test(navigator?.userAgent)\n}\n","export function mapValue(\n value: number,\n inMin: number,\n inMax: number,\n outMin: number,\n outMax: number,\n) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin\n}\n","import crypto from 'crypto'\nconst isBrowser = typeof window !== 'undefined'\n\nexport function uuid() {\n return isBrowser ? window.crypto.randomUUID() : crypto.randomUUID()\n}\n","export function uniq<T extends any[]>(a: T) {\n return Array.from(new Set(a))\n}\n"],"mappings":";AAAO,SAAS,WAAW,OAAe,KAAa,KAAa;AAClE,SAAO,SAAS,MAAM,MAAM,SAAS,MAAM,MAAM;AACnD;;;ACFO,SAAS,QAAQ;AACtB,MAAI,OAAO,WAAW;AAAa,WAAO;AAC1C,SAAO,mBAAmB,KAAK,WAAW,SAAS;AACrD;;;ACHO,SAAS,SACd,OACA,OACA,OACA,QACA,QACA;AACA,UAAS,QAAQ,UAAU,SAAS,WAAY,QAAQ,SAAS;AACnE;;;ACRA,OAAO,YAAY;AACnB,IAAM,YAAY,OAAO,WAAW;AAE7B,SAAS,OAAO;AACrB,SAAO,YAAY,OAAO,OAAO,WAAW,IAAI,OAAO,WAAW;AACpE;;;ACLO,SAAS,KAAsB,GAAM;AAC1C,SAAO,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC;AAC9B;","names":[]}
|
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.7",
|
|
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",
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
"luxon": "^3.4.2",
|
|
68
68
|
"mitt": "^3.0.1",
|
|
69
69
|
"motion": "^10.16.2",
|
|
70
|
-
"nuxt": "^3.5.1"
|
|
71
|
-
"uuid": "^9.0.0"
|
|
70
|
+
"nuxt": "^3.5.1"
|
|
72
71
|
},
|
|
73
72
|
"peerDependenciesMeta": {
|
|
74
73
|
"@maas/magic-timer": {
|
|
@@ -94,9 +93,6 @@
|
|
|
94
93
|
},
|
|
95
94
|
"nuxt": {
|
|
96
95
|
"optional": false
|
|
97
|
-
},
|
|
98
|
-
"uuid": {
|
|
99
|
-
"optional": false
|
|
100
96
|
}
|
|
101
97
|
},
|
|
102
98
|
"scripts": {
|