@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.
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +156 -121
- package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +112 -55
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +115 -63
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +7 -7
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +92 -67
- package/dist/index.umd.js +19 -19
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +5 -0
- package/dist/src/components/data/nmorph-audio-preview/types.d.ts +5 -0
- package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +3 -2
- package/dist/src/components/data/nmorph-file-card/types.d.ts +2 -0
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +2 -2
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +13 -6
- package/dist/src/components/data/nmorph-video-preview/types.d.ts +4 -0
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
- package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +1 -0
- package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import './NmorphFileCard.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { getFileExtension as
|
|
5
|
-
import { NmorphImageResolution as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
2
|
+
import { defineComponent as O, useSlots as W, computed as r, openBlock as a, createElementBlock as t, normalizeClass as K, createElementVNode as v, createBlock as c, unref as n, withCtx as m, createVNode as l, resolveDynamicComponent as j, createCommentVNode as i, toDisplayString as h, renderSlot as G } from "vue";
|
|
3
|
+
import { useModifiers as q } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { getFileExtension as J, getPlainFileType as Q, getTypeCandidates as U, isKnownFileType as d } from "../../../utils/file-types.js";
|
|
5
|
+
import { NmorphImageResolution as X, NmorphAudioResolution as Y, NmorphVideoResolution as Z, NmorphArchiveResolution as ee, NmorphDocResolution as oe } from "../../form/nmorph-file-upload/types.js";
|
|
6
|
+
import re from "../nmorph-audio-preview/NmorphAudioPreview.vue.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import ae from "../nmorph-video-preview/NmorphVideoPreview.vue.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import ne from "../../../assets/icons/image.svg.js";
|
|
11
|
+
import te from "../../../assets/icons/archive.svg.js";
|
|
12
|
+
import A from "../../../assets/icons/doc.svg.js";
|
|
10
13
|
import p from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
11
14
|
/* empty css */
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
15
|
+
import ie from "../../../assets/icons/eye.svg.js";
|
|
16
|
+
import le from "../../../assets/icons/audio.svg.js";
|
|
17
|
+
import se from "../../../assets/icons/video.svg.js";
|
|
18
|
+
import ce from "../../../assets/icons/loading.svg.js";
|
|
19
|
+
import me from "../../../assets/icons/open.svg.js";
|
|
20
|
+
import de from "../../../assets/icons/download.svg.js";
|
|
21
|
+
const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe = { class: "nmorph-file-card__body" }, ve = { class: "nmorph-file-card__info" }, he = { class: "nmorph-file-card__name" }, _e = {
|
|
17
22
|
key: 0,
|
|
18
23
|
class: "nmorph-file-card__error"
|
|
19
|
-
},
|
|
24
|
+
}, we = {
|
|
20
25
|
key: 1,
|
|
21
26
|
class: "nmorph-file-card__meta"
|
|
22
|
-
},
|
|
27
|
+
}, ye = {
|
|
23
28
|
key: 0,
|
|
24
29
|
class: "nmorph-file-card__badge"
|
|
25
|
-
},
|
|
30
|
+
}, ge = {
|
|
26
31
|
key: 1,
|
|
27
32
|
class: "nmorph-file-card__actions"
|
|
28
|
-
},
|
|
33
|
+
}, Be = ["href", "aria-label"], Ne = ["href", "download", "aria-label"], Oe = /* @__PURE__ */ O({
|
|
29
34
|
__name: "NmorphFileCard",
|
|
30
35
|
props: {
|
|
31
36
|
name: {},
|
|
@@ -34,6 +39,7 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
34
39
|
size: { default: void 0 },
|
|
35
40
|
previewSrc: { default: "" },
|
|
36
41
|
downloadHref: { default: "" },
|
|
42
|
+
mediaPreview: { default: "none" },
|
|
37
43
|
surface: { default: "card" },
|
|
38
44
|
showExtensionBadge: { type: Boolean, default: !0 },
|
|
39
45
|
iconSurface: { type: Boolean, default: !0 },
|
|
@@ -44,90 +50,141 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
44
50
|
showDefaultActions: { type: Boolean, default: !0 }
|
|
45
51
|
},
|
|
46
52
|
emits: ["open", "download", "error"],
|
|
47
|
-
setup(
|
|
48
|
-
const e =
|
|
53
|
+
setup(P, { emit: H }) {
|
|
54
|
+
const e = P, _ = H, D = W(), u = r(() => (e.extension || J(e.name) || Q(e.mimeType)).toLowerCase()), s = r(() => U(e.mimeType, e.name)), $ = r(() => e.mimeType.toLowerCase().startsWith("image/") || s.value.some((o) => d(o, X)) ? ne : e.mimeType.toLowerCase().startsWith("audio/") || s.value.some((o) => d(o, Y)) ? le : e.mimeType.toLowerCase().startsWith("video/") || s.value.some((o) => d(o, Z)) ? se : s.value.some((o) => d(o, ee)) ? te : s.value.some((o) => d(o, oe)) ? A : A), E = (o) => {
|
|
49
55
|
if (o === void 0 || Number.isNaN(o) || o < 0) return "";
|
|
50
56
|
if (o === 0) return "0 B";
|
|
51
|
-
const
|
|
52
|
-
return `${
|
|
53
|
-
},
|
|
54
|
-
() =>
|
|
55
|
-
),
|
|
56
|
-
() =>
|
|
57
|
+
const B = ["B", "KB", "MB", "GB", "TB"], N = Math.min(Math.floor(Math.log(o) / Math.log(1024)), B.length - 1), k = o / 1024 ** N, V = k >= 10 || N === 0 || Number.isInteger(k) ? 0 : 1;
|
|
58
|
+
return `${k.toFixed(V)} ${B[N]}`;
|
|
59
|
+
}, L = r(() => E(e.size)), M = r(() => u.value || e.mimeType), b = r(() => [M.value, L.value].filter(Boolean).join(" · ")), w = r(() => e.mediaPreview === "audio" && !!e.previewSrc && !e.loading && !e.error), y = r(() => e.mediaPreview === "video" && !!e.previewSrc && !e.loading && !e.error), f = r(() => w.value || y.value), z = r(() => e.compact ? "96px" : "120px"), S = r(() => e.mimeType.toLowerCase() === "application/pdf" || u.value === "pdf"), x = r(() => S.value ? e.previewSrc || e.downloadHref : ""), g = r(
|
|
60
|
+
() => e.showDefaultActions && !!x.value && !f.value && S.value
|
|
61
|
+
), C = r(
|
|
62
|
+
() => !!D.actions || e.showDefaultActions && (e.previewSrc && !f.value && !g.value || e.downloadHref)
|
|
63
|
+
), F = r(
|
|
64
|
+
() => q({
|
|
57
65
|
"nmorph-file-card": [
|
|
58
66
|
e.surface,
|
|
59
67
|
e.compact && "compact",
|
|
60
68
|
e.loading && "loading",
|
|
61
69
|
e.error && "error",
|
|
62
|
-
|
|
70
|
+
f.value && "media",
|
|
71
|
+
w.value && "media-audio",
|
|
72
|
+
y.value && "media-video",
|
|
73
|
+
!e.iconSurface && "icon-plain",
|
|
74
|
+
!C.value && "no-actions"
|
|
63
75
|
]
|
|
64
76
|
})
|
|
65
|
-
),
|
|
66
|
-
return (o,
|
|
67
|
-
class:
|
|
77
|
+
), T = () => _("open"), R = () => _("download"), I = () => _("error");
|
|
78
|
+
return (o, B) => (a(), t("div", {
|
|
79
|
+
class: K(F.value)
|
|
68
80
|
}, [
|
|
69
|
-
|
|
70
|
-
e.loading ? (
|
|
81
|
+
v("div", pe, [
|
|
82
|
+
e.loading ? (a(), c(n(p), {
|
|
71
83
|
key: 0,
|
|
72
84
|
size: "medium"
|
|
73
85
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
l(n(
|
|
86
|
+
default: m(() => [
|
|
87
|
+
l(n(ce))
|
|
76
88
|
]),
|
|
77
89
|
_: 1
|
|
78
|
-
})) : (
|
|
90
|
+
})) : (a(), c(n(p), {
|
|
79
91
|
key: 1,
|
|
80
92
|
size: "medium"
|
|
81
93
|
}, {
|
|
82
|
-
default:
|
|
83
|
-
(
|
|
94
|
+
default: m(() => [
|
|
95
|
+
(a(), c(j($.value)))
|
|
84
96
|
]),
|
|
85
97
|
_: 1
|
|
86
|
-
}))
|
|
98
|
+
})),
|
|
99
|
+
g.value && !e.loading && !e.error ? (a(), t("a", {
|
|
100
|
+
key: 2,
|
|
101
|
+
href: x.value,
|
|
102
|
+
target: "_blank",
|
|
103
|
+
rel: "noopener noreferrer",
|
|
104
|
+
class: "nmorph-file-card__icon-action",
|
|
105
|
+
"aria-label": `Preview ${e.name}`,
|
|
106
|
+
onClick: T
|
|
107
|
+
}, [
|
|
108
|
+
l(n(p), { size: "small" }, {
|
|
109
|
+
default: m(() => [
|
|
110
|
+
l(n(ie))
|
|
111
|
+
]),
|
|
112
|
+
_: 1
|
|
113
|
+
})
|
|
114
|
+
], 8, ue)) : i("", !0)
|
|
87
115
|
]),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
116
|
+
v("div", fe, [
|
|
117
|
+
v("div", ve, [
|
|
118
|
+
v("span", he, h(e.name), 1),
|
|
119
|
+
e.error && e.errorText ? (a(), t("span", _e, h(e.errorText), 1)) : b.value ? (a(), t("span", we, h(b.value), 1)) : i("", !0)
|
|
120
|
+
]),
|
|
121
|
+
w.value ? (a(), c(re, {
|
|
122
|
+
key: 0,
|
|
123
|
+
class: "nmorph-file-card__audio-preview",
|
|
124
|
+
src: e.previewSrc,
|
|
125
|
+
name: e.name,
|
|
126
|
+
surface: "plain",
|
|
127
|
+
embedded: "",
|
|
128
|
+
compact: "",
|
|
129
|
+
"show-icon": !1,
|
|
130
|
+
"show-header": !1,
|
|
131
|
+
"show-default-actions": !1,
|
|
132
|
+
onError: I
|
|
133
|
+
}, null, 8, ["src", "name"])) : i("", !0),
|
|
134
|
+
y.value ? (a(), c(ae, {
|
|
135
|
+
key: 1,
|
|
136
|
+
class: "nmorph-file-card__video-preview",
|
|
137
|
+
src: e.previewSrc,
|
|
138
|
+
name: e.name,
|
|
139
|
+
height: z.value,
|
|
140
|
+
surface: "plain",
|
|
141
|
+
embedded: "",
|
|
142
|
+
compact: "",
|
|
143
|
+
controls: !1,
|
|
144
|
+
"show-meta": !1,
|
|
145
|
+
"show-default-actions": !1,
|
|
146
|
+
onError: I
|
|
147
|
+
}, null, 8, ["src", "name", "height"])) : i("", !0)
|
|
91
148
|
]),
|
|
92
|
-
e.showExtensionBadge && u.value ? (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
e.previewSrc ? (
|
|
149
|
+
e.showExtensionBadge && u.value ? (a(), t("span", ye, h(u.value), 1)) : i("", !0),
|
|
150
|
+
C.value ? (a(), t("div", ge, [
|
|
151
|
+
G(o.$slots, "actions", {}, () => [
|
|
152
|
+
e.previewSrc && !f.value && !g.value ? (a(), t("a", {
|
|
96
153
|
key: 0,
|
|
97
154
|
href: e.previewSrc,
|
|
98
155
|
target: "_blank",
|
|
99
156
|
rel: "noopener noreferrer",
|
|
100
157
|
class: "nmorph-file-card__action-link",
|
|
101
158
|
"aria-label": `Open ${e.name}`,
|
|
102
|
-
onClick:
|
|
159
|
+
onClick: T
|
|
103
160
|
}, [
|
|
104
161
|
l(n(p), { size: "small" }, {
|
|
105
|
-
default:
|
|
106
|
-
l(n(
|
|
162
|
+
default: m(() => [
|
|
163
|
+
l(n(me))
|
|
107
164
|
]),
|
|
108
165
|
_: 1
|
|
109
166
|
})
|
|
110
|
-
], 8,
|
|
111
|
-
e.downloadHref ? (
|
|
167
|
+
], 8, Be)) : i("", !0),
|
|
168
|
+
e.downloadHref ? (a(), t("a", {
|
|
112
169
|
key: 1,
|
|
113
170
|
href: e.downloadHref,
|
|
114
171
|
download: e.name,
|
|
115
172
|
class: "nmorph-file-card__action-link",
|
|
116
173
|
"aria-label": `Download ${e.name}`,
|
|
117
|
-
onClick:
|
|
174
|
+
onClick: R
|
|
118
175
|
}, [
|
|
119
176
|
l(n(p), { size: "small" }, {
|
|
120
|
-
default:
|
|
121
|
-
l(n(
|
|
177
|
+
default: m(() => [
|
|
178
|
+
l(n(de))
|
|
122
179
|
]),
|
|
123
180
|
_: 1
|
|
124
181
|
})
|
|
125
|
-
], 8,
|
|
182
|
+
], 8, Ne)) : i("", !0)
|
|
126
183
|
])
|
|
127
|
-
])) :
|
|
184
|
+
])) : i("", !0)
|
|
128
185
|
], 2));
|
|
129
186
|
}
|
|
130
187
|
});
|
|
131
188
|
export {
|
|
132
|
-
|
|
189
|
+
Oe as default
|
|
133
190
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-video-preview{position:relative;display:flex;width:var(--nmorph-video-preview-width, 280px);min-width:0;max-width:100%;height:var(--nmorph-video-preview-height, 158px);overflow:hidden;color:var(--nmorph-white-color);background:color-mix(in srgb,var(--nmorph-black-color) 72%,var(--nmorph-main-color));border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-video-preview .nmorph-video-preview__media,.nmorph-video-preview .nmorph-video-preview__state{width:100%;height:100%}.nmorph-video-preview .nmorph-video-preview__media{display:block;object-fit:cover}.nmorph-video-preview.nmorph-video-preview--contain .nmorph-video-preview__media{object-fit:contain}.nmorph-video-preview .nmorph-video-preview__state{display:flex;flex-direction:column;gap:var(--indentation-02);justify-content:center;align-items:center;padding:var(--indentation-03);text-align:center}.nmorph-video-preview .nmorph-video-preview__error{max-width:100%;overflow:hidden;color:var(--nmorph-error-text-color);font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__meta{position:absolute;right:0;bottom:0;left:0;display:flex;gap:var(--indentation-02);justify-content:space-between;align-items:center;padding:18px var(--indentation-03) var(--indentation-02);background:linear-gradient(transparent,color-mix(in srgb,var(--nmorph-black-color) 66%,transparent));pointer-events:none}.nmorph-video-preview .nmorph-video-preview__name,.nmorph-video-preview .nmorph-video-preview__duration{min-width:0;overflow:hidden;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__name{flex:1 1 auto}.nmorph-video-preview .nmorph-video-preview__duration{flex:0 0 auto;font-variant-numeric:tabular-nums}.nmorph-video-preview .nmorph-video-preview__actions{position:absolute;top:var(--indentation-02);right:var(--indentation-02);display:flex;gap:var(--indentation-01);padding:2px;background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:var(--nmorph-text-color);text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-video-preview .nmorph-video-preview__action-link .nmorph-icon{--color: currentColor}.nmorph-video-preview.nmorph-video-preview--compact{width:var(--nmorph-video-preview-width, 180px);height:var(--nmorph-video-preview-height, 102px)}.nmorph-video-preview.nmorph-video-preview--error{outline:1px solid var(--nmorph-error-color)}
|
|
1
|
+
.nmorph-video-preview{position:relative;display:flex;width:var(--nmorph-video-preview-width, 280px);min-width:0;max-width:100%;height:var(--nmorph-video-preview-height, 158px);overflow:hidden;color:var(--nmorph-white-color);background:color-mix(in srgb,var(--nmorph-black-color) 72%,var(--nmorph-main-color));border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-video-preview .nmorph-video-preview__media,.nmorph-video-preview .nmorph-video-preview__state{width:100%;height:100%}.nmorph-video-preview.nmorph-video-preview--soft .nmorph-video-preview__state,.nmorph-video-preview.nmorph-video-preview--plain .nmorph-video-preview__state{color:var(--nmorph-text-color)}.nmorph-video-preview .nmorph-video-preview__media{display:block;object-fit:cover}.nmorph-video-preview.nmorph-video-preview--contain .nmorph-video-preview__media{object-fit:contain}.nmorph-video-preview .nmorph-video-preview__state{display:flex;flex-direction:column;gap:var(--indentation-02);justify-content:center;align-items:center;padding:var(--indentation-03);text-align:center}.nmorph-video-preview .nmorph-video-preview__error{max-width:100%;overflow:hidden;color:var(--nmorph-error-text-color);font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__meta{position:absolute;right:0;bottom:0;left:0;display:flex;gap:var(--indentation-02);justify-content:space-between;align-items:center;padding:18px var(--indentation-03) var(--indentation-02);background:linear-gradient(transparent,color-mix(in srgb,var(--nmorph-black-color) 66%,transparent));pointer-events:none}.nmorph-video-preview .nmorph-video-preview__play{position:absolute;top:50%;left:50%;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:42px;height:42px;padding:0;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border:0;border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset);transform:translate(-50%,-50%);cursor:pointer}.nmorph-video-preview .nmorph-video-preview__play .nmorph-icon{--color: currentColor}.nmorph-video-preview .nmorph-video-preview__play:hover{color:var(--nmorph-accent-color)}.nmorph-video-preview.nmorph-video-preview--playing .nmorph-video-preview__play{opacity:.72}.nmorph-video-preview.nmorph-video-preview--embedded{width:var(--nmorph-video-preview-width, 100%);height:var(--nmorph-video-preview-height, 120px);box-shadow:none}.nmorph-video-preview.nmorph-video-preview--embedded .nmorph-video-preview__play,.nmorph-video-preview.nmorph-video-preview--soft .nmorph-video-preview__play,.nmorph-video-preview.nmorph-video-preview--plain .nmorph-video-preview__play{box-shadow:none}.nmorph-video-preview .nmorph-video-preview__name,.nmorph-video-preview .nmorph-video-preview__duration{min-width:0;overflow:hidden;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__name{flex:1 1 auto}.nmorph-video-preview .nmorph-video-preview__duration{flex:0 0 auto;font-variant-numeric:tabular-nums}.nmorph-video-preview .nmorph-video-preview__actions{position:absolute;top:var(--indentation-02);right:var(--indentation-02);display:flex;gap:var(--indentation-01);padding:2px;background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:var(--nmorph-text-color);text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-video-preview .nmorph-video-preview__action-link .nmorph-icon{--color: currentColor}.nmorph-video-preview.nmorph-video-preview--compact{width:var(--nmorph-video-preview-width, 180px);height:var(--nmorph-video-preview-height, 102px)}.nmorph-video-preview.nmorph-video-preview--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-video-preview.nmorph-video-preview--plain{background:transparent;box-shadow:none}.nmorph-video-preview.nmorph-video-preview--error{outline:1px solid var(--nmorph-error-color)}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import './NmorphVideoPreview.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssSizeVariables as
|
|
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
5
|
import c from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
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 = {
|
|
14
|
+
key: 2,
|
|
13
15
|
class: "nmorph-video-preview__state"
|
|
14
|
-
},
|
|
16
|
+
}, Y = {
|
|
15
17
|
key: 2,
|
|
16
18
|
class: "nmorph-video-preview__error"
|
|
17
|
-
},
|
|
18
|
-
key:
|
|
19
|
+
}, Z = {
|
|
20
|
+
key: 3,
|
|
19
21
|
class: "nmorph-video-preview__meta"
|
|
20
|
-
},
|
|
22
|
+
}, ee = {
|
|
21
23
|
key: 0,
|
|
22
24
|
class: "nmorph-video-preview__name"
|
|
23
|
-
},
|
|
25
|
+
}, oe = {
|
|
24
26
|
key: 1,
|
|
25
27
|
class: "nmorph-video-preview__duration"
|
|
26
|
-
},
|
|
27
|
-
key:
|
|
28
|
+
}, ae = {
|
|
29
|
+
key: 4,
|
|
28
30
|
class: "nmorph-video-preview__actions"
|
|
29
|
-
},
|
|
31
|
+
}, re = ["href", "aria-label"], te = ["href", "download", "aria-label"], he = /* @__PURE__ */ V({
|
|
30
32
|
__name: "NmorphVideoPreview",
|
|
31
33
|
props: {
|
|
32
34
|
src: {},
|
|
@@ -35,6 +37,9 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
|
|
|
35
37
|
width: { default: void 0 },
|
|
36
38
|
height: { default: void 0 },
|
|
37
39
|
durationMs: { default: void 0 },
|
|
40
|
+
surface: { default: "card" },
|
|
41
|
+
embedded: { type: Boolean, default: !1 },
|
|
42
|
+
showMeta: { type: Boolean, default: !0 },
|
|
38
43
|
compact: { type: Boolean, default: !1 },
|
|
39
44
|
controls: { type: Boolean, default: !0 },
|
|
40
45
|
muted: { type: Boolean, default: !1 },
|
|
@@ -48,29 +53,61 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
|
|
|
48
53
|
showDefaultActions: { type: Boolean, default: !0 }
|
|
49
54
|
},
|
|
50
55
|
emits: ["play", "pause", "open", "download", "error"],
|
|
51
|
-
setup(
|
|
52
|
-
const e =
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
return `${
|
|
56
|
-
},
|
|
57
|
-
() => !!
|
|
58
|
-
),
|
|
59
|
-
() =>
|
|
60
|
-
"nmorph-video-preview": [
|
|
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({
|
|
65
|
+
"nmorph-video-preview": [
|
|
66
|
+
e.surface,
|
|
67
|
+
e.embedded && "embedded",
|
|
68
|
+
!e.showMeta && "no-meta",
|
|
69
|
+
e.compact && "compact",
|
|
70
|
+
e.fit,
|
|
71
|
+
e.loading && "loading",
|
|
72
|
+
e.error && "error",
|
|
73
|
+
l.value && "playing",
|
|
74
|
+
!_.value && "no-actions"
|
|
75
|
+
]
|
|
61
76
|
})
|
|
62
|
-
),
|
|
63
|
-
() =>
|
|
77
|
+
), N = u(
|
|
78
|
+
() => j({
|
|
64
79
|
"--nmorph-video-preview-width": e.width,
|
|
65
80
|
"--nmorph-video-preview-height": e.height
|
|
66
81
|
})
|
|
67
|
-
),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
await d.value.play();
|
|
90
|
+
} catch {
|
|
91
|
+
l.value = !1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
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);
|
|
102
|
+
};
|
|
103
|
+
return k({ videoRef: d }), (a, v) => (o(), t("div", {
|
|
104
|
+
class: T(H.value),
|
|
105
|
+
style: A(N.value)
|
|
71
106
|
}, [
|
|
72
107
|
!e.loading && !e.error ? (o(), t("video", {
|
|
73
108
|
key: 0,
|
|
109
|
+
ref_key: "videoRef",
|
|
110
|
+
ref: d,
|
|
74
111
|
class: "nmorph-video-preview__media",
|
|
75
112
|
src: e.src,
|
|
76
113
|
poster: e.poster || void 0,
|
|
@@ -78,70 +115,85 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
|
|
|
78
115
|
muted: e.muted,
|
|
79
116
|
playsinline: e.playsinline,
|
|
80
117
|
preload: e.preload,
|
|
81
|
-
onPlay:
|
|
82
|
-
onPause:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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), {
|
|
86
138
|
key: 0,
|
|
87
139
|
size: "large"
|
|
88
140
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
141
|
+
default: p(() => [
|
|
142
|
+
s(r(J))
|
|
91
143
|
]),
|
|
92
144
|
_: 1
|
|
93
|
-
})) : (o(),
|
|
145
|
+
})) : (o(), m(r(c), {
|
|
94
146
|
key: 1,
|
|
95
147
|
size: "large"
|
|
96
148
|
}, {
|
|
97
|
-
default:
|
|
98
|
-
|
|
149
|
+
default: p(() => [
|
|
150
|
+
s(r(q))
|
|
99
151
|
]),
|
|
100
152
|
_: 1
|
|
101
153
|
})),
|
|
102
|
-
e.error && e.errorText ? (o(), t("span",
|
|
154
|
+
e.error && e.errorText ? (o(), t("span", Y, h(e.errorText), 1)) : n("", !0)
|
|
103
155
|
])),
|
|
104
|
-
e.name ||
|
|
105
|
-
e.name ? (o(), t("span",
|
|
106
|
-
|
|
107
|
-
])) :
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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", {
|
|
111
163
|
href: e.src,
|
|
112
164
|
target: "_blank",
|
|
113
165
|
rel: "noopener noreferrer",
|
|
114
166
|
class: "nmorph-video-preview__action-link",
|
|
115
167
|
"aria-label": `Open ${e.name || "video"}`,
|
|
116
|
-
onClick:
|
|
168
|
+
onClick: z
|
|
117
169
|
}, [
|
|
118
|
-
|
|
119
|
-
default:
|
|
120
|
-
|
|
170
|
+
s(r(c), { size: "small" }, {
|
|
171
|
+
default: p(() => [
|
|
172
|
+
s(r(K))
|
|
121
173
|
]),
|
|
122
174
|
_: 1
|
|
123
175
|
})
|
|
124
|
-
], 8,
|
|
176
|
+
], 8, re),
|
|
125
177
|
e.downloadHref ? (o(), t("a", {
|
|
126
178
|
key: 0,
|
|
127
179
|
href: e.downloadHref,
|
|
128
180
|
download: e.name,
|
|
129
181
|
class: "nmorph-video-preview__action-link",
|
|
130
182
|
"aria-label": `Download ${e.name || "video"}`,
|
|
131
|
-
onClick:
|
|
183
|
+
onClick: C
|
|
132
184
|
}, [
|
|
133
|
-
|
|
134
|
-
default:
|
|
135
|
-
|
|
185
|
+
s(r(c), { size: "small" }, {
|
|
186
|
+
default: p(() => [
|
|
187
|
+
s(r(Q))
|
|
136
188
|
]),
|
|
137
189
|
_: 1
|
|
138
190
|
})
|
|
139
|
-
], 8,
|
|
191
|
+
], 8, te)) : n("", !0)
|
|
140
192
|
])
|
|
141
|
-
])) :
|
|
193
|
+
])) : n("", !0)
|
|
142
194
|
], 6));
|
|
143
195
|
}
|
|
144
196
|
});
|
|
145
197
|
export {
|
|
146
|
-
|
|
198
|
+
he as default
|
|
147
199
|
};
|
|
@@ -5,12 +5,12 @@ import { useFocusableInput as W } from "../../../hooks/use-focusable-input.js";
|
|
|
5
5
|
import { useFormItemInput as X, useFormItemModel as Y } from "../nmorph-form/use-form-item-input.js";
|
|
6
6
|
import { NmorphComponentHeight as Z } from "../../../types/common.types.js";
|
|
7
7
|
import ee from "../../../assets/icons/eye-blocked.svg.js";
|
|
8
|
-
import te from "
|
|
9
|
-
import oe from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
8
|
+
import te from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
10
9
|
/* empty css */
|
|
11
|
-
import
|
|
10
|
+
import oe from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
12
11
|
/* empty css */
|
|
13
|
-
import
|
|
12
|
+
import ne from "../../../assets/icons/error.svg.js";
|
|
13
|
+
import le from "../../../assets/icons/eye.svg.js";
|
|
14
14
|
const re = { class: "nmorph-text-input__input-side" }, ae = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "nmorph-text-input__prepend-icon"
|
|
@@ -59,7 +59,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
|
|
|
59
59
|
onBlur: () => l("blur")
|
|
60
60
|
});
|
|
61
61
|
x({ inputDOMRef: u, focus: E, blur: $, select: D });
|
|
62
|
-
const K = a(() => e.clearable ?
|
|
62
|
+
const K = a(() => e.clearable ? ne : s.value ? ee : le), R = a(() => e.indentation || (p["prepend-icon"] ? "28px" : "8px")), S = a(() => ({ "--nmorph-text-input-indentation": R.value }));
|
|
63
63
|
return (r, t) => (i(), f("div", {
|
|
64
64
|
class: T(N.value),
|
|
65
65
|
style: O(S.value)
|
|
@@ -89,7 +89,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
|
|
|
89
89
|
onKeydown: t[2] || (t[2] = (n) => l("keydown", n)),
|
|
90
90
|
onKeyup: t[3] || (t[3] = G((n) => l("on-enter"), ["enter"]))
|
|
91
91
|
}), null, 16, se),
|
|
92
|
-
e.typePassword || e.clearable ? (i(), b(o(
|
|
92
|
+
e.typePassword || e.clearable ? (i(), b(o(te), {
|
|
93
93
|
key: 1,
|
|
94
94
|
disabled: e.disabled,
|
|
95
95
|
class: "nmorph-text-input__password-btn",
|
|
@@ -101,7 +101,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
|
|
|
101
101
|
onClick: P
|
|
102
102
|
}, {
|
|
103
103
|
default: v(() => [
|
|
104
|
-
L(o(
|
|
104
|
+
L(o(oe), null, {
|
|
105
105
|
default: v(() => [
|
|
106
106
|
(i(), b(Q(K.value)))
|
|
107
107
|
]),
|