@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.
- package/dist/assets/icons/full-screen.svg.js +6 -6
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +84 -78
- package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +125 -89
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.css +1 -1
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +183 -225
- package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.css +1 -0
- package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.vue.js +298 -0
- package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.vue3.js +6 -0
- package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.css +1 -0
- package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.js +110 -0
- package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue3.js +6 -0
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js +57 -54
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +227 -134
- package/dist/index.es.js +866 -863
- package/dist/index.umd.js +29 -29
- package/dist/outside-hooks/use-nmorph-theme.js +16 -16
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/index.d.ts +2 -0
- package/dist/src/components/data/nmorph-card/NmorphCard.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-file-card/types.d.ts +1 -1
- package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +3 -3
- package/dist/src/components/data/nmorph-media-gallery/NmorphMediaGallery.vue.d.ts +26 -0
- package/dist/src/components/data/nmorph-media-gallery/types.d.ts +34 -0
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.d.ts +43 -0
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +9 -2
- package/dist/src/components/data/nmorph-video-preview/types.d.ts +6 -0
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +9 -9
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +24 -23
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
import './NmorphVideoPreview.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssSizeVariables as
|
|
5
|
-
import
|
|
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
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
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
|
-
},
|
|
20
|
+
}, fe = {
|
|
17
21
|
key: 2,
|
|
18
22
|
class: "nmorph-video-preview__error"
|
|
19
|
-
},
|
|
23
|
+
}, _e = {
|
|
20
24
|
key: 3,
|
|
21
25
|
class: "nmorph-video-preview__meta"
|
|
22
|
-
},
|
|
26
|
+
}, he = {
|
|
23
27
|
key: 0,
|
|
24
28
|
class: "nmorph-video-preview__name"
|
|
25
|
-
},
|
|
29
|
+
}, we = {
|
|
26
30
|
key: 1,
|
|
27
31
|
class: "nmorph-video-preview__duration"
|
|
28
|
-
},
|
|
32
|
+
}, ye = {
|
|
29
33
|
key: 4,
|
|
30
34
|
class: "nmorph-video-preview__actions"
|
|
31
|
-
},
|
|
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(
|
|
57
|
-
const e =
|
|
58
|
-
if (!
|
|
59
|
-
const
|
|
60
|
-
return `${
|
|
61
|
-
},
|
|
62
|
-
() =>
|
|
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
|
-
|
|
74
|
-
!
|
|
79
|
+
i.value && "playing",
|
|
80
|
+
!A.value && "no-actions"
|
|
75
81
|
]
|
|
76
82
|
})
|
|
77
|
-
),
|
|
78
|
-
() =>
|
|
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 = () =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
|
113
|
+
await p.value.play();
|
|
90
114
|
} catch {
|
|
91
|
-
|
|
115
|
+
i.value = !1;
|
|
92
116
|
}
|
|
93
117
|
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
|
|
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
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
],
|
|
287
|
+
], 64));
|
|
195
288
|
}
|
|
196
289
|
});
|
|
197
290
|
export {
|
|
198
|
-
|
|
291
|
+
qe as default
|
|
199
292
|
};
|