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