@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.
Files changed (22) hide show
  1. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
  2. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +156 -121
  3. package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
  4. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +112 -55
  5. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
  6. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +115 -63
  7. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +7 -7
  8. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +92 -67
  9. package/dist/index.umd.js +19 -19
  10. package/dist/package.json.js +1 -1
  11. package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +5 -0
  12. package/dist/src/components/data/nmorph-audio-preview/types.d.ts +5 -0
  13. package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +3 -2
  14. package/dist/src/components/data/nmorph-file-card/types.d.ts +2 -0
  15. package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +2 -2
  16. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +13 -6
  17. package/dist/src/components/data/nmorph-video-preview/types.d.ts +4 -0
  18. package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
  19. package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +1 -0
  20. package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -0
  21. package/dist/style.css +1 -1
  22. package/package.json +1 -1
@@ -1,9 +1,12 @@
1
1
  import './NmorphNotificationProvider.css';
2
- import { defineComponent as A, ref as h, inject as F, computed as g, watch as L, onBeforeUnmount as O, openBlock as a, createElementBlock as c, normalizeStyle as I, Fragment as x, renderList as T, createBlock as P, TransitionGroup as S, normalizeClass as D, withCtx as V, createVNode as j, unref as q, mergeProps as G, createElementVNode as _, toDisplayString as U, createCommentVNode as H } from "vue";
3
- import { NmorphNotificationPlacement as J } from "./types.js";
4
- import K from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
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 Q = ["title"], W = { class: "nmorph-notification-provider__duration-value" }, X = 500, re = /* @__PURE__ */ A({
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(b) {
15
- const k = (e) => typeof e.id == "string" && e.id.length > 0, d = h([]), i = h([]), n = h([]), s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), w = Object.values(J), l = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), N = (e) => l(e) > 0, z = (e) => {
16
- if (e < 1e3) return `${e}ms`;
17
- const t = e / 1e3;
18
- return `${Number.isInteger(t) ? t : Number(t.toFixed(1))}s`;
19
- }, y = (e) => z(l(e)), $ = (e) => ({
20
- "--nmorph-notification-provider-duration": `${l(e)}ms`
21
- }), p = (e) => {
22
- const t = s.get(e);
23
- t && clearTimeout(t), s.delete(e), u.delete(e);
24
- }, C = (e) => {
25
- n.value = n.value.filter((t) => t.id !== e), i.value = i.value.filter((t) => t !== e), p(e);
26
- }, f = (e, t = !0) => {
27
- i.value.includes(e) || (p(e), t && !d.value.includes(e) && (d.value = [...d.value, e]), i.value = [...i.value, e], setTimeout(() => C(e), X));
28
- }, E = (e) => {
29
- const t = l(e);
30
- u.get(e.id) !== t && (p(e.id), t && (s.set(
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(() => f(e.id), t)
33
- ), u.set(e.id, t)));
34
- }, m = b, B = F("nmorph", void 0), M = g(
35
- () => w.map((e) => {
36
- const t = n.value.filter(
37
- (o) => (o.placement ?? m.placement) === e
38
- ), r = Math.max(t.length - m.quantity, 0);
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
- L(
46
- () => m.notifications,
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(k).filter((r) => !d.value.includes(r.id));
49
- n.value = n.value.map((r) => {
50
- const o = t.find((v) => v.id === r.id);
51
- return o ? { ...r, ...o } : r;
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
- n.value.some(
54
- (v) => v.id === r.id
55
- ) || n.value.push(r);
56
- }), t.forEach((r) => E(r)), n.value.filter(
57
- (r) => !t.some((o) => o.id === r.id)
58
- ).forEach((r) => f(r.id, !1));
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 R = g(() => m.zIndex ?? (B?.zIndex.current.value ?? 1e3) + 1);
63
- return O(() => {
64
- s.forEach((e) => clearTimeout(e)), s.clear(), u.clear();
65
- }), (e, t) => (a(), c("div", {
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: I({ zIndex: R.value })
92
+ style: k({ zIndex: F.value })
68
93
  }, [
69
- (a(!0), c(x, null, T(M.value, (r) => (a(), P(S, {
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: D(`nmorph-notification-provider__list nmorph-notification-provider__list--${r.placement}`)
99
+ class: R(`nmorph-notification-provider__list nmorph-notification-provider__list--${r.placement}`)
75
100
  }, {
76
- default: V(() => [
77
- (a(!0), c(x, null, T(r.notifications, (o) => (a(), c("div", {
78
- key: o.id,
79
- style: I($(o)),
80
- class: D([
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
- N(o) && "nmorph-notification-provider__notification--with-duration",
83
- i.value.includes(o.id) && "nmorph-notification-provider__notification--closing"
107
+ _(n) && "nmorph-notification-provider__notification--with-duration",
108
+ i.value.includes(n.id) && "nmorph-notification-provider__notification--closing"
84
109
  ])
85
110
  }, [
86
- j(q(K), G({
111
+ X(Y(re), Z({
87
112
  class: "nmorph-notification-provider__alert",
88
- style: { width: o.width }
89
- }, { ref_for: !0 }, o, {
90
- onClose: () => f(o.id)
113
+ style: { width: n.width }
114
+ }, { ref_for: !0 }, L(n), {
115
+ onClose: () => I(n.id)
91
116
  }), null, 16, ["style", "onClose"]),
92
- N(o) ? (a(), c("div", {
93
- key: `${o.id}-${l(o)}`,
117
+ _(n) ? (a(), s("div", {
118
+ key: `${n.id}-${d(n)}`,
94
119
  class: "nmorph-notification-provider__duration",
95
- title: y(o),
120
+ title: y(n) ? T(n) : void 0,
96
121
  "aria-hidden": "true"
97
122
  }, [
98
- t[0] || (t[0] = _("span", { class: "nmorph-notification-provider__duration-track" }, [
99
- _("span", { class: "nmorph-notification-provider__duration-bar" })
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
- _("span", W, U(y(o)), 1)
102
- ], 8, Q)) : H("", !0)
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
- re as default
136
+ de as default
112
137
  };