@nmorph/nmorph-ui-kit 2.2.48 → 2.2.50
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/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +156 -121
- package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +112 -55
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +115 -63
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +7 -7
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +92 -67
- package/dist/index.umd.js +19 -19
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +5 -0
- package/dist/src/components/data/nmorph-audio-preview/types.d.ts +5 -0
- package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +3 -2
- package/dist/src/components/data/nmorph-file-card/types.d.ts +2 -0
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +2 -2
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +13 -6
- package/dist/src/components/data/nmorph-video-preview/types.d.ts +4 -0
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
- package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +1 -0
- package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import './NmorphNotificationProvider.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { NmorphNotificationPlacement as
|
|
4
|
-
import
|
|
2
|
+
import { defineComponent as G, ref as h, inject as H, computed as g, watch as x, onBeforeUnmount as K, openBlock as a, createElementBlock as s, normalizeStyle as k, Fragment as M, renderList as A, createBlock as J, TransitionGroup as Q, normalizeClass as R, withCtx as W, createVNode as X, unref as Y, mergeProps as Z, createElementVNode as z, toDisplayString as ee, createCommentVNode as C } from "vue";
|
|
3
|
+
import { NmorphNotificationPlacement as te } from "./types.js";
|
|
4
|
+
import re from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
const
|
|
6
|
+
const ne = ["title"], oe = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "nmorph-notification-provider__duration-value"
|
|
9
|
+
}, ie = 500, ae = 250, de = /* @__PURE__ */ G({
|
|
7
10
|
__name: "NmorphNotificationProvider",
|
|
8
11
|
props: {
|
|
9
12
|
notifications: {},
|
|
@@ -11,95 +14,117 @@ const Q = ["title"], W = { class: "nmorph-notification-provider__duration-value"
|
|
|
11
14
|
zIndex: { default: void 0 },
|
|
12
15
|
quantity: { default: 100 }
|
|
13
16
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
t
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
setup(E) {
|
|
18
|
+
const V = (e) => typeof e.id == "string" && e.id.length > 0, m = h([]), i = h([]), o = h([]), l = h(Date.now()), u = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
19
|
+
let c;
|
|
20
|
+
const $ = Object.values(te), d = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), _ = (e) => d(e) > 0, y = (e) => e.showDurationValue !== !1, B = (e) => {
|
|
21
|
+
const t = d(e), r = v.get(e.id);
|
|
22
|
+
return !t || !r ? t : Math.max(t - (l.value - r), 0);
|
|
23
|
+
}, b = (e) => e < 1e3 ? `${Math.ceil(e)}ms` : `${Math.ceil(e / 1e3)}s`, T = (e) => b(B(e)), P = (e) => ({
|
|
24
|
+
"--nmorph-notification-provider-duration": `${d(e)}ms`
|
|
25
|
+
}), L = (e) => {
|
|
26
|
+
const t = { ...e };
|
|
27
|
+
return delete t.duration, delete t.placement, delete t.showDurationValue, delete t.width, t;
|
|
28
|
+
}, N = (e, t = !1) => {
|
|
29
|
+
const r = u.get(e);
|
|
30
|
+
r && clearTimeout(r), u.delete(e), p.delete(e), t || v.delete(e);
|
|
31
|
+
}, O = (e) => {
|
|
32
|
+
o.value = o.value.filter((t) => t.id !== e), i.value = i.value.filter((t) => t !== e), N(e);
|
|
33
|
+
}, I = (e, t = !0) => {
|
|
34
|
+
i.value.includes(e) || (N(e, !0), t && !m.value.includes(e) && (m.value = [...m.value, e]), i.value = [...i.value, e], setTimeout(() => O(e), ie));
|
|
35
|
+
}, S = (e) => {
|
|
36
|
+
const t = d(e);
|
|
37
|
+
p.get(e.id) !== t && (N(e.id), t && (l.value = Date.now(), v.set(e.id, l.value), u.set(
|
|
31
38
|
e.id,
|
|
32
|
-
setTimeout(() =>
|
|
33
|
-
),
|
|
34
|
-
},
|
|
35
|
-
() =>
|
|
36
|
-
const t =
|
|
37
|
-
(
|
|
38
|
-
), r = Math.max(t.length -
|
|
39
|
+
setTimeout(() => I(e.id), t)
|
|
40
|
+
), p.set(e.id, t)));
|
|
41
|
+
}, f = E, U = H("nmorph", void 0), j = g(
|
|
42
|
+
() => $.map((e) => {
|
|
43
|
+
const t = o.value.filter(
|
|
44
|
+
(n) => (n.placement ?? f.placement) === e
|
|
45
|
+
), r = Math.max(t.length - f.quantity, 0);
|
|
39
46
|
return {
|
|
40
47
|
placement: e,
|
|
41
48
|
notifications: t.slice(r)
|
|
42
49
|
};
|
|
43
50
|
})
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
), q = g(
|
|
52
|
+
() => o.value.some(
|
|
53
|
+
(e) => _(e) && !i.value.includes(e.id)
|
|
54
|
+
)
|
|
55
|
+
), w = () => {
|
|
56
|
+
c && (clearInterval(c), c = void 0);
|
|
57
|
+
};
|
|
58
|
+
x(
|
|
59
|
+
q,
|
|
60
|
+
(e) => {
|
|
61
|
+
if (!e) {
|
|
62
|
+
w();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
c || (l.value = Date.now(), c = setInterval(() => {
|
|
66
|
+
l.value = Date.now();
|
|
67
|
+
}, ae));
|
|
68
|
+
},
|
|
69
|
+
{ immediate: !0 }
|
|
70
|
+
), x(
|
|
71
|
+
() => f.notifications,
|
|
47
72
|
(e) => {
|
|
48
|
-
const t = e.filter(
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
return
|
|
73
|
+
const t = e.filter(V).filter((r) => !m.value.includes(r.id));
|
|
74
|
+
o.value = o.value.map((r) => {
|
|
75
|
+
const n = t.find((D) => D.id === r.id);
|
|
76
|
+
return n ? { ...r, ...n } : r;
|
|
52
77
|
}), t.forEach((r) => {
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
) ||
|
|
56
|
-
}), t.forEach((r) =>
|
|
57
|
-
(r) => !t.some((
|
|
58
|
-
).forEach((r) =>
|
|
78
|
+
o.value.some(
|
|
79
|
+
(D) => D.id === r.id
|
|
80
|
+
) || o.value.push(r);
|
|
81
|
+
}), t.forEach((r) => S(r)), o.value.filter(
|
|
82
|
+
(r) => !t.some((n) => n.id === r.id)
|
|
83
|
+
).forEach((r) => I(r.id, !1));
|
|
59
84
|
},
|
|
60
85
|
{ deep: !0, immediate: !0 }
|
|
61
86
|
);
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
}), (e, t) => (a(),
|
|
87
|
+
const F = g(() => f.zIndex ?? (U?.zIndex.current.value ?? 1e3) + 1);
|
|
88
|
+
return K(() => {
|
|
89
|
+
u.forEach((e) => clearTimeout(e)), u.clear(), p.clear(), v.clear(), w();
|
|
90
|
+
}), (e, t) => (a(), s("div", {
|
|
66
91
|
class: "nmorph-notification-provider",
|
|
67
|
-
style:
|
|
92
|
+
style: k({ zIndex: F.value })
|
|
68
93
|
}, [
|
|
69
|
-
(a(!0),
|
|
94
|
+
(a(!0), s(M, null, A(j.value, (r) => (a(), J(Q, {
|
|
70
95
|
key: r.placement,
|
|
71
96
|
appear: "",
|
|
72
97
|
name: "nmorph-notification",
|
|
73
98
|
tag: "div",
|
|
74
|
-
class:
|
|
99
|
+
class: R(`nmorph-notification-provider__list nmorph-notification-provider__list--${r.placement}`)
|
|
75
100
|
}, {
|
|
76
|
-
default:
|
|
77
|
-
(a(!0),
|
|
78
|
-
key:
|
|
79
|
-
style:
|
|
80
|
-
class:
|
|
101
|
+
default: W(() => [
|
|
102
|
+
(a(!0), s(M, null, A(r.notifications, (n) => (a(), s("div", {
|
|
103
|
+
key: n.id,
|
|
104
|
+
style: k(P(n)),
|
|
105
|
+
class: R([
|
|
81
106
|
"nmorph-notification-provider__notification",
|
|
82
|
-
|
|
83
|
-
i.value.includes(
|
|
107
|
+
_(n) && "nmorph-notification-provider__notification--with-duration",
|
|
108
|
+
i.value.includes(n.id) && "nmorph-notification-provider__notification--closing"
|
|
84
109
|
])
|
|
85
110
|
}, [
|
|
86
|
-
|
|
111
|
+
X(Y(re), Z({
|
|
87
112
|
class: "nmorph-notification-provider__alert",
|
|
88
|
-
style: { width:
|
|
89
|
-
}, { ref_for: !0 },
|
|
90
|
-
onClose: () =>
|
|
113
|
+
style: { width: n.width }
|
|
114
|
+
}, { ref_for: !0 }, L(n), {
|
|
115
|
+
onClose: () => I(n.id)
|
|
91
116
|
}), null, 16, ["style", "onClose"]),
|
|
92
|
-
|
|
93
|
-
key: `${
|
|
117
|
+
_(n) ? (a(), s("div", {
|
|
118
|
+
key: `${n.id}-${d(n)}`,
|
|
94
119
|
class: "nmorph-notification-provider__duration",
|
|
95
|
-
title: y(
|
|
120
|
+
title: y(n) ? T(n) : void 0,
|
|
96
121
|
"aria-hidden": "true"
|
|
97
122
|
}, [
|
|
98
|
-
t[0] || (t[0] =
|
|
99
|
-
|
|
123
|
+
t[0] || (t[0] = z("span", { class: "nmorph-notification-provider__duration-track" }, [
|
|
124
|
+
z("span", { class: "nmorph-notification-provider__duration-bar" })
|
|
100
125
|
], -1)),
|
|
101
|
-
|
|
102
|
-
], 8,
|
|
126
|
+
y(n) ? (a(), s("span", oe, ee(T(n)), 1)) : C("", !0)
|
|
127
|
+
], 8, ne)) : C("", !0)
|
|
103
128
|
], 6))), 128))
|
|
104
129
|
]),
|
|
105
130
|
_: 2
|
|
@@ -108,5 +133,5 @@ const Q = ["title"], W = { class: "nmorph-notification-provider__duration-value"
|
|
|
108
133
|
}
|
|
109
134
|
});
|
|
110
135
|
export {
|
|
111
|
-
|
|
136
|
+
de as default
|
|
112
137
|
};
|