@nmorph/nmorph-ui-kit 2.2.49 → 2.2.51

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 (24) hide show
  1. package/dist/assets/icons/full-screen.svg.js +6 -6
  2. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
  3. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +84 -78
  4. package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
  5. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +108 -81
  6. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js +57 -54
  7. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
  8. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +230 -133
  9. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +92 -67
  10. package/dist/index.umd.js +24 -24
  11. package/dist/package.json.js +1 -1
  12. package/dist/src/components/data/nmorph-file-card/types.d.ts +1 -1
  13. package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +3 -3
  14. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +11 -3
  15. package/dist/src/components/data/nmorph-video-preview/types.d.ts +6 -0
  16. package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
  17. package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +3 -3
  18. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
  19. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
  20. package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +9 -9
  21. package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +1 -0
  22. package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -0
  23. package/dist/style.css +1 -1
  24. package/package.json +1 -1
@@ -1,34 +1,39 @@
1
1
  import './NmorphVideoPreview.css';
2
- import { defineComponent as E, useSlots as A, ref as h, computed as u, openBlock as o, createElementBlock as t, normalizeStyle as M, normalizeClass as T, createCommentVNode as n, createVNode as s, unref as r, withCtx as c, createBlock as m, toDisplayString as _, renderSlot as O, createElementVNode as R } from "vue";
3
- import { useModifiers as L } from "../../../utils/create-modifiers.js";
4
- import { createCssSizeVariables as j } from "../../../utils/common.js";
5
- import p from "../../basic/nmorph-icon/NmorphIcon.vue.js";
2
+ import { defineComponent as Q, useAttrs as U, useSlots as W, ref as b, computed as s, openBlock as t, createElementBlock as a, Fragment as X, createElementVNode as _, mergeProps as Y, createCommentVNode as n, createVNode as l, unref as r, withCtx as d, createBlock as v, toDisplayString as k, renderSlot as Z, Teleport as ee } from "vue";
3
+ import { useModifiers as oe } from "../../../utils/create-modifiers.js";
4
+ import { createCssSizeVariables as te } from "../../../utils/common.js";
5
+ import u from "../../basic/nmorph-icon/NmorphIcon.vue.js";
6
6
  /* empty css */
7
- import q from "../../../assets/icons/pause.svg.js";
8
- import F from "../../../assets/icons/play.svg.js";
9
- import G from "../../../assets/icons/loading.svg.js";
10
- import J from "../../../assets/icons/video.svg.js";
11
- import K from "../../../assets/icons/open.svg.js";
12
- import Q from "../../../assets/icons/download.svg.js";
13
- const U = ["src", "poster", "controls", "muted", "playsinline", "preload"], W = ["aria-label"], X = {
7
+ import re from "../../../assets/icons/video.svg.js";
8
+ import ae from "../../../assets/icons/eye.svg.js";
9
+ import le from "../../../assets/icons/full-screen.svg.js";
10
+ import ne from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
11
+ /* empty css */
12
+ import se from "../../../assets/icons/pause.svg.js";
13
+ import ie from "../../../assets/icons/play.svg.js";
14
+ import de from "../../../assets/icons/loading.svg.js";
15
+ import ce from "../../../assets/icons/open.svg.js";
16
+ import ue from "../../../assets/icons/download.svg.js";
17
+ const pe = ["src", "poster", "controls", "muted", "playsinline", "preload"], me = ["aria-label"], ve = {
14
18
  key: 2,
15
19
  class: "nmorph-video-preview__state"
16
- }, Y = {
20
+ }, fe = {
17
21
  key: 2,
18
22
  class: "nmorph-video-preview__error"
19
- }, Z = {
23
+ }, _e = {
20
24
  key: 3,
21
25
  class: "nmorph-video-preview__meta"
22
- }, ee = {
26
+ }, he = {
23
27
  key: 0,
24
28
  class: "nmorph-video-preview__name"
25
- }, oe = {
29
+ }, we = {
26
30
  key: 1,
27
31
  class: "nmorph-video-preview__duration"
28
- }, ae = {
32
+ }, ye = {
29
33
  key: 4,
30
34
  class: "nmorph-video-preview__actions"
31
- }, re = ["href", "aria-label"], te = ["href", "download", "aria-label"], _e = /* @__PURE__ */ E({
35
+ }, be = ["aria-label"], ke = ["aria-label"], ge = ["href", "aria-label"], Ae = ["href", "download", "aria-label"], Be = { class: "nmorph-video-preview__portal" }, Pe = { class: "nmorph-video-preview__portal-content" }, Ce = ["src", "poster", "muted", "playsinline", "preload"], g = "var(--nmorph-contrast-text-color)", qe = /* @__PURE__ */ Q({
36
+ inheritAttrs: !1,
32
37
  __name: "NmorphVideoPreview",
33
38
  props: {
34
39
  src: {},
@@ -38,6 +43,8 @@ const U = ["src", "poster", "controls", "muted", "playsinline", "preload"], W =
38
43
  height: { default: void 0 },
39
44
  durationMs: { default: void 0 },
40
45
  surface: { default: "card" },
46
+ embedded: { type: Boolean, default: !1 },
47
+ showMeta: { type: Boolean, default: !0 },
41
48
  compact: { type: Boolean, default: !1 },
42
49
  controls: { type: Boolean, default: !0 },
43
50
  muted: { type: Boolean, default: !1 },
@@ -48,147 +55,237 @@ const U = ["src", "poster", "controls", "muted", "playsinline", "preload"], W =
48
55
  loading: { type: Boolean, default: !1 },
49
56
  error: { type: Boolean, default: !1 },
50
57
  errorText: { default: "" },
51
- showDefaultActions: { type: Boolean, default: !0 }
58
+ showDefaultActions: { type: Boolean, default: !0 },
59
+ showPreviewAction: { type: Boolean, default: !0 },
60
+ showFullscreenAction: { type: Boolean, default: !0 }
52
61
  },
53
- emits: ["play", "pause", "open", "download", "error"],
54
- setup(y, { expose: w, emit: k }) {
55
- const e = y, i = k, g = A(), d = h(null), l = h(!1), b = (a) => {
56
- if (!a || a < 0) return "";
57
- const v = Math.round(a / 1e3), I = Math.floor(v / 60), V = v % 60;
58
- return `${I}:${V.toString().padStart(2, "0")}`;
59
- }, f = u(() => b(e.durationMs)), B = u(
60
- () => !!g.actions || e.showDefaultActions && (e.src || e.downloadHref)
61
- ), H = u(
62
- () => L({
62
+ emits: ["play", "pause", "open", "preview", "fullscreen", "download", "error"],
63
+ setup(P, { expose: C, emit: N }) {
64
+ const e = P, c = N, h = U(), H = W(), p = b(null), f = b(!1), i = b(!1), O = (o) => {
65
+ if (!o || o < 0) return "";
66
+ const m = Math.round(o / 1e3), G = Math.floor(m / 60), J = m % 60;
67
+ return `${G}:${J.toString().padStart(2, "0")}`;
68
+ }, w = s(() => O(e.durationMs)), y = s(() => !!e.src && !e.loading && !e.error), $ = s(() => y.value && (e.showPreviewAction || e.showFullscreenAction)), S = s(() => e.showDefaultActions && (e.src || e.downloadHref)), A = s(() => !!H.actions || $.value || S.value), E = s(
69
+ () => oe({
63
70
  "nmorph-video-preview": [
64
71
  e.surface,
72
+ e.embedded && "embedded",
73
+ !e.showMeta && "no-meta",
65
74
  e.compact && "compact",
66
75
  e.fit,
67
76
  e.loading && "loading",
68
77
  e.error && "error",
69
- l.value && "playing"
78
+ i.value && "playing",
79
+ !A.value && "no-actions"
70
80
  ]
71
81
  })
72
- ), N = u(
73
- () => j({
82
+ ), F = s(
83
+ () => te({
74
84
  "--nmorph-video-preview-width": e.width,
75
85
  "--nmorph-video-preview-height": e.height
76
86
  })
77
- ), z = () => i("open"), C = () => i("download"), P = async () => {
78
- if (!(!d.value || e.loading || e.error)) {
79
- if (l.value) {
80
- d.value.pause();
87
+ ), I = s(() => Object.fromEntries(Object.entries(h).filter(([o]) => o !== "class" && o !== "style"))), z = s(() => [E.value, h.class]), D = s(() => [F.value, h.style]), x = () => c("open"), M = () => c("download"), R = () => {
88
+ f.value = !0, c("preview");
89
+ }, B = () => {
90
+ f.value = !1;
91
+ }, T = async () => {
92
+ const o = p.value;
93
+ if (o) {
94
+ c("fullscreen");
95
+ try {
96
+ const m = o.requestFullscreen?.() || o.webkitRequestFullscreen?.();
97
+ if (m) {
98
+ await m;
99
+ return;
100
+ }
101
+ o.webkitEnterFullscreen?.();
102
+ } catch {
103
+ }
104
+ }
105
+ }, V = async () => {
106
+ if (!(!p.value || e.loading || e.error)) {
107
+ if (i.value) {
108
+ p.value.pause();
81
109
  return;
82
110
  }
83
111
  try {
84
- await d.value.play();
112
+ await p.value.play();
85
113
  } catch {
86
- l.value = !1;
114
+ i.value = !1;
87
115
  }
88
116
  }
89
- }, S = (a) => {
90
- l.value = !0, i("play", a);
91
- }, $ = (a) => {
92
- l.value = !1, i("pause", a);
93
- }, x = () => {
94
- l.value = !1;
95
- }, D = (a) => {
96
- l.value = !1, i("error", a);
117
+ }, q = (o) => {
118
+ i.value = !0, c("play", o);
119
+ }, j = (o) => {
120
+ i.value = !1, c("pause", o);
121
+ }, L = () => {
122
+ i.value = !1;
123
+ }, K = (o) => {
124
+ i.value = !1, c("error", o);
97
125
  };
98
- return w({ videoRef: d }), (a, v) => (o(), t("div", {
99
- class: T(H.value),
100
- style: M(N.value)
101
- }, [
102
- !e.loading && !e.error ? (o(), t("video", {
103
- key: 0,
104
- ref_key: "videoRef",
105
- ref: d,
106
- class: "nmorph-video-preview__media",
107
- src: e.src,
108
- poster: e.poster || void 0,
109
- controls: e.controls,
110
- muted: e.muted,
111
- playsinline: e.playsinline,
112
- preload: e.preload,
113
- onPlay: S,
114
- onPause: $,
115
- onEnded: x,
116
- onError: D
117
- }, null, 40, U)) : n("", !0),
118
- !e.loading && !e.error ? (o(), t("button", {
119
- key: 1,
120
- class: "nmorph-video-preview__play",
121
- type: "button",
122
- "aria-label": l.value ? `Pause ${e.name || "video"}` : `Play ${e.name || "video"}`,
123
- onClick: P
124
- }, [
125
- s(r(p), { size: "medium" }, {
126
- default: c(() => [
127
- l.value ? (o(), m(r(q), { key: 0 })) : (o(), m(r(F), { key: 1 }))
128
- ]),
129
- _: 1
130
- })
131
- ], 8, W)) : (o(), t("div", X, [
132
- e.loading ? (o(), m(r(p), {
126
+ return C({ videoRef: p }), (o, m) => (t(), a(X, null, [
127
+ _("div", Y(I.value, {
128
+ class: z.value,
129
+ style: D.value
130
+ }), [
131
+ !e.loading && !e.error ? (t(), a("video", {
133
132
  key: 0,
134
- size: "large"
135
- }, {
136
- default: c(() => [
137
- s(r(G))
138
- ]),
139
- _: 1
140
- })) : (o(), m(r(p), {
133
+ ref_key: "videoRef",
134
+ ref: p,
135
+ class: "nmorph-video-preview__media",
136
+ src: e.src,
137
+ poster: e.poster || void 0,
138
+ controls: e.controls,
139
+ muted: e.muted,
140
+ playsinline: e.playsinline,
141
+ preload: e.preload,
142
+ onPlay: q,
143
+ onPause: j,
144
+ onEnded: L,
145
+ onError: K
146
+ }, null, 40, pe)) : n("", !0),
147
+ !e.loading && !e.error ? (t(), a("button", {
141
148
  key: 1,
142
- size: "large"
143
- }, {
144
- default: c(() => [
145
- s(r(J))
146
- ]),
147
- _: 1
148
- })),
149
- e.error && e.errorText ? (o(), t("span", Y, _(e.errorText), 1)) : n("", !0)
150
- ])),
151
- e.name || f.value ? (o(), t("div", Z, [
152
- e.name ? (o(), t("span", ee, _(e.name), 1)) : n("", !0),
153
- f.value ? (o(), t("span", oe, _(f.value), 1)) : n("", !0)
154
- ])) : n("", !0),
155
- B.value ? (o(), t("div", ae, [
156
- O(a.$slots, "actions", {}, () => [
157
- R("a", {
158
- href: e.src,
159
- target: "_blank",
160
- rel: "noopener noreferrer",
161
- class: "nmorph-video-preview__action-link",
162
- "aria-label": `Open ${e.name || "video"}`,
163
- onClick: z
164
- }, [
165
- s(r(p), { size: "small" }, {
166
- default: c(() => [
167
- s(r(K))
168
- ]),
169
- _: 1
170
- })
171
- ], 8, re),
172
- e.downloadHref ? (o(), t("a", {
149
+ class: "nmorph-video-preview__play",
150
+ type: "button",
151
+ "aria-label": i.value ? `Pause ${e.name || "video"}` : `Play ${e.name || "video"}`,
152
+ onClick: V
153
+ }, [
154
+ l(r(u), {
155
+ size: "medium",
156
+ color: g
157
+ }, {
158
+ default: d(() => [
159
+ i.value ? (t(), v(r(se), { key: 0 })) : (t(), v(r(ie), { key: 1 }))
160
+ ]),
161
+ _: 1
162
+ })
163
+ ], 8, me)) : (t(), a("div", ve, [
164
+ e.loading ? (t(), v(r(u), {
173
165
  key: 0,
174
- href: e.downloadHref,
175
- download: e.name,
176
- class: "nmorph-video-preview__action-link",
177
- "aria-label": `Download ${e.name || "video"}`,
178
- onClick: C
179
- }, [
180
- s(r(p), { size: "small" }, {
181
- default: c(() => [
182
- s(r(Q))
183
- ]),
184
- _: 1
185
- })
186
- ], 8, te)) : n("", !0)
166
+ size: "large"
167
+ }, {
168
+ default: d(() => [
169
+ l(r(de))
170
+ ]),
171
+ _: 1
172
+ })) : (t(), v(r(u), {
173
+ key: 1,
174
+ size: "large"
175
+ }, {
176
+ default: d(() => [
177
+ l(r(re))
178
+ ]),
179
+ _: 1
180
+ })),
181
+ e.error && e.errorText ? (t(), a("span", fe, k(e.errorText), 1)) : n("", !0)
182
+ ])),
183
+ e.showMeta && (e.name || w.value) ? (t(), a("div", _e, [
184
+ e.name ? (t(), a("span", he, k(e.name), 1)) : n("", !0),
185
+ w.value ? (t(), a("span", we, k(w.value), 1)) : n("", !0)
186
+ ])) : n("", !0),
187
+ A.value ? (t(), a("div", ye, [
188
+ Z(o.$slots, "actions", {}, () => [
189
+ e.showPreviewAction && y.value ? (t(), a("button", {
190
+ key: 0,
191
+ type: "button",
192
+ class: "nmorph-video-preview__action-button nmorph-video-preview__action-button--preview",
193
+ "aria-label": `Preview ${e.name || "video"}`,
194
+ onClick: R
195
+ }, [
196
+ l(r(u), {
197
+ size: "small",
198
+ color: g
199
+ }, {
200
+ default: d(() => [
201
+ l(r(ae))
202
+ ]),
203
+ _: 1
204
+ })
205
+ ], 8, be)) : n("", !0),
206
+ e.showFullscreenAction && y.value ? (t(), a("button", {
207
+ key: 1,
208
+ type: "button",
209
+ class: "nmorph-video-preview__action-button nmorph-video-preview__action-button--fullscreen",
210
+ "aria-label": `Fullscreen ${e.name || "video"}`,
211
+ onClick: T
212
+ }, [
213
+ l(r(u), {
214
+ size: "small",
215
+ color: g
216
+ }, {
217
+ default: d(() => [
218
+ l(r(le))
219
+ ]),
220
+ _: 1
221
+ })
222
+ ], 8, ke)) : n("", !0),
223
+ e.showDefaultActions && e.src ? (t(), a("a", {
224
+ key: 2,
225
+ href: e.src,
226
+ target: "_blank",
227
+ rel: "noopener noreferrer",
228
+ class: "nmorph-video-preview__action-link",
229
+ "aria-label": `Open ${e.name || "video"}`,
230
+ onClick: x
231
+ }, [
232
+ l(r(u), { size: "small" }, {
233
+ default: d(() => [
234
+ l(r(ce))
235
+ ]),
236
+ _: 1
237
+ })
238
+ ], 8, ge)) : n("", !0),
239
+ e.downloadHref ? (t(), a("a", {
240
+ key: 3,
241
+ href: e.downloadHref,
242
+ download: e.name,
243
+ class: "nmorph-video-preview__action-link",
244
+ "aria-label": `Download ${e.name || "video"}`,
245
+ onClick: M
246
+ }, [
247
+ l(r(u), { size: "small" }, {
248
+ default: d(() => [
249
+ l(r(ue))
250
+ ]),
251
+ _: 1
252
+ })
253
+ ], 8, Ae)) : n("", !0)
254
+ ])
255
+ ])) : n("", !0)
256
+ ], 16),
257
+ f.value ? (t(), v(ee, {
258
+ key: 0,
259
+ to: "body"
260
+ }, [
261
+ _("div", Be, [
262
+ l(r(ne), {
263
+ show: f.value,
264
+ "disabled-teleport": "",
265
+ onOnOutsideClick: B,
266
+ onOnEscapeKeydown: B
267
+ }, {
268
+ default: d(() => [
269
+ _("div", Pe, [
270
+ _("video", {
271
+ class: "nmorph-video-preview__portal-media",
272
+ src: e.src,
273
+ poster: e.poster || void 0,
274
+ controls: "",
275
+ autoplay: "",
276
+ muted: e.muted,
277
+ playsinline: e.playsinline,
278
+ preload: e.preload
279
+ }, null, 8, Ce)
280
+ ])
281
+ ]),
282
+ _: 1
283
+ }, 8, ["show"])
187
284
  ])
188
285
  ])) : n("", !0)
189
- ], 6));
286
+ ], 64));
190
287
  }
191
288
  });
192
289
  export {
193
- _e as default
290
+ qe as default
194
291
  };
@@ -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
  };