@nmorph/nmorph-ui-kit 2.2.50 → 2.2.52

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