@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
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import './NmorphMediaGallery.css';
|
|
2
|
+
import { defineComponent as de, ref as f, computed as i, watch as C, onBeforeUnmount as ce, openBlock as p, createBlock as y, withCtx as r, createElementVNode as g, unref as t, normalizeStyle as ve, createElementBlock as T, createCommentVNode as L, withModifiers as me, createVNode as l } from "vue";
|
|
3
|
+
import { useModifiers as fe } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import pe from "../nmorph-preview-portal/NmorphPreviewPortal.vue.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import he from "../nmorph-image/NmorphImage.vue.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import k from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import w from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import _e from "../../../assets/icons/pause.svg.js";
|
|
13
|
+
import ye from "../../../assets/icons/play.svg.js";
|
|
14
|
+
import ge from "../../../assets/icons/rotate-right.svg.js";
|
|
15
|
+
import ke from "../../../assets/icons/rotate-left.svg.js";
|
|
16
|
+
import Ie from "../../../assets/icons/zoom-in.svg.js";
|
|
17
|
+
import xe from "../../../assets/icons/zoom-out.svg.js";
|
|
18
|
+
import we from "../../../assets/icons/enlarge.svg.js";
|
|
19
|
+
import Ne from "../../../assets/icons/shrink.svg.js";
|
|
20
|
+
const be = { class: "nmorph-media-gallery__stage" }, Pe = ["src", "poster", "controls", "muted", "playsinline", "preload", "title"], Ce = ["aria-label"], Ve = { class: "nmorph-media-gallery__action-element" }, Ee = { class: "nmorph-media-gallery__action-element" }, He = { class: "nmorph-media-gallery__action-element" }, Be = { class: "nmorph-media-gallery__action-element" }, Le = { class: "nmorph-media-gallery__action-element" }, Fe = 45, Je = /* @__PURE__ */ de({
|
|
21
|
+
__name: "NmorphMediaGallery",
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: { type: Boolean, default: !1 },
|
|
24
|
+
items: {},
|
|
25
|
+
initialIndex: { default: 0 },
|
|
26
|
+
activeIndex: { default: void 0 },
|
|
27
|
+
zIndex: { default: void 0 },
|
|
28
|
+
showNavigationButtons: { type: Boolean, default: !0 },
|
|
29
|
+
showActionBar: { type: Boolean, default: !0 },
|
|
30
|
+
imageFit: { default: "contain" },
|
|
31
|
+
videoFit: { default: "contain" }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:model-value", "update:active-index", "close", "change"],
|
|
34
|
+
setup(X, { emit: Y }) {
|
|
35
|
+
const o = X, N = Y, c = f(o.modelValue), I = f(0), v = f(null), b = f(null), u = f(!1), d = f(1), s = f(0), h = f(null), m = i(() => o.items || []), F = i(() => m.value.length > 1), z = i(() => o.showNavigationButtons && F.value), x = (e) => {
|
|
36
|
+
const n = m.value.length - 1;
|
|
37
|
+
return n < 0 || !Number.isFinite(e) || e < 0 ? 0 : e > n ? n : e;
|
|
38
|
+
}, _ = i(() => x(I.value)), a = i(() => m.value[_.value]), M = i(() => a.value?.kind === "image"), V = i(() => a.value?.kind === "video"), U = i(
|
|
39
|
+
() => a.value?.kind === "video" ? a.value.controls !== !1 : !1
|
|
40
|
+
), Z = i(() => a.value?.kind === "video" ? a.value.muted === !0 : !1), G = i(
|
|
41
|
+
() => a.value?.kind === "video" ? a.value.playsinline !== !1 : !0
|
|
42
|
+
), W = i(
|
|
43
|
+
() => a.value?.kind === "video" && a.value.preload || "metadata"
|
|
44
|
+
), R = i(
|
|
45
|
+
() => a.value?.kind === "video" && a.value.name || "video"
|
|
46
|
+
), j = i(
|
|
47
|
+
() => fe({
|
|
48
|
+
"nmorph-media-gallery": [
|
|
49
|
+
c.value && "opened",
|
|
50
|
+
M.value && "image",
|
|
51
|
+
V.value && "video",
|
|
52
|
+
u.value && V.value && "video-playing",
|
|
53
|
+
o.imageFit === "cover" && M.value && "image-cover",
|
|
54
|
+
o.videoFit === "cover" && V.value && "video-cover"
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
), q = i(() => `rotate(${s.value}deg) scale(${d.value})`);
|
|
58
|
+
C(
|
|
59
|
+
() => o.modelValue,
|
|
60
|
+
(e) => {
|
|
61
|
+
c.value = e;
|
|
62
|
+
}
|
|
63
|
+
), C(
|
|
64
|
+
() => o.activeIndex,
|
|
65
|
+
(e) => {
|
|
66
|
+
typeof e == "number" && (I.value = x(e));
|
|
67
|
+
},
|
|
68
|
+
{ immediate: !0 }
|
|
69
|
+
), C(
|
|
70
|
+
() => [o.initialIndex, m.value.length],
|
|
71
|
+
() => {
|
|
72
|
+
typeof o.activeIndex != "number" && (I.value = x(o.initialIndex));
|
|
73
|
+
},
|
|
74
|
+
{ immediate: !0 }
|
|
75
|
+
);
|
|
76
|
+
const E = () => {
|
|
77
|
+
!v.value || v.value === b.value || (v.value.pause(), u.value = !1, b.value = v.value);
|
|
78
|
+
}, J = () => {
|
|
79
|
+
d.value = 1, s.value = 0;
|
|
80
|
+
}, $ = (e) => {
|
|
81
|
+
if (!m.value.length) return;
|
|
82
|
+
const n = x(e);
|
|
83
|
+
if (n === _.value) return;
|
|
84
|
+
E(), u.value = !1, I.value = n, J(), N("update:active-index", n);
|
|
85
|
+
const P = m.value[n];
|
|
86
|
+
P && N("change", P, n);
|
|
87
|
+
}, H = () => {
|
|
88
|
+
const e = m.value.length;
|
|
89
|
+
e && $(_.value === 0 ? e - 1 : _.value - 1);
|
|
90
|
+
}, B = () => {
|
|
91
|
+
const e = m.value.length;
|
|
92
|
+
e && $(_.value === e - 1 ? 0 : _.value + 1);
|
|
93
|
+
}, K = () => {
|
|
94
|
+
c.value && (E(), c.value = !1, N("update:model-value", !1), N("close"));
|
|
95
|
+
}, Q = () => {
|
|
96
|
+
s.value = s.value + 90, s.value >= 360 && (s.value = 0);
|
|
97
|
+
}, ee = () => {
|
|
98
|
+
s.value = s.value - 90, s.value <= -360 && (s.value = 0);
|
|
99
|
+
}, ae = () => {
|
|
100
|
+
d.value = parseFloat(Math.min(d.value + 0.2, 4).toFixed(3));
|
|
101
|
+
}, te = () => {
|
|
102
|
+
d.value = parseFloat(Math.max(d.value - 0.2, 0.2).toFixed(3));
|
|
103
|
+
}, oe = () => {
|
|
104
|
+
d.value = 1;
|
|
105
|
+
}, le = async () => {
|
|
106
|
+
if (v.value) {
|
|
107
|
+
if (u.value) {
|
|
108
|
+
v.value.pause();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await v.value.play();
|
|
113
|
+
} catch {
|
|
114
|
+
u.value = !1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, ne = () => {
|
|
118
|
+
u.value = !0, b.value = null;
|
|
119
|
+
}, ie = () => {
|
|
120
|
+
u.value = !1;
|
|
121
|
+
}, re = () => {
|
|
122
|
+
u.value = !1;
|
|
123
|
+
}, ue = () => {
|
|
124
|
+
u.value = !1;
|
|
125
|
+
}, S = (e) => {
|
|
126
|
+
if (c.value && !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
|
|
127
|
+
if (e.key === "Escape") {
|
|
128
|
+
e.preventDefault(), K();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
F.value && (e.key === "ArrowLeft" && (e.preventDefault(), H()), e.key === "ArrowRight" && (e.preventDefault(), B()));
|
|
132
|
+
}
|
|
133
|
+
}, se = () => {
|
|
134
|
+
typeof document > "u" || document.addEventListener("keydown", S);
|
|
135
|
+
}, D = () => {
|
|
136
|
+
typeof document > "u" || document.removeEventListener("keydown", S);
|
|
137
|
+
};
|
|
138
|
+
C(
|
|
139
|
+
c,
|
|
140
|
+
(e) => {
|
|
141
|
+
e ? (se(), b.value = null, I.value = x(
|
|
142
|
+
typeof o.activeIndex == "number" ? o.activeIndex : o.initialIndex
|
|
143
|
+
)) : (E(), u.value = !1, D());
|
|
144
|
+
},
|
|
145
|
+
{ immediate: !0 }
|
|
146
|
+
), ce(D);
|
|
147
|
+
const A = (e) => {
|
|
148
|
+
h.value = { x: e.clientX, y: e.clientY };
|
|
149
|
+
}, O = (e) => {
|
|
150
|
+
if (!h.value || !z.value) {
|
|
151
|
+
h.value = null;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const n = e.clientX - h.value.x, P = e.clientY - h.value.y;
|
|
155
|
+
h.value = null, !(Math.abs(n) < Fe || Math.abs(n) < Math.abs(P) * 1.2) && (n > 0 ? H() : B());
|
|
156
|
+
};
|
|
157
|
+
return (e, n) => c.value ? (p(), y(pe, {
|
|
158
|
+
key: 0,
|
|
159
|
+
show: c.value,
|
|
160
|
+
"z-index": o.zIndex,
|
|
161
|
+
"state-class": j.value,
|
|
162
|
+
"content-class": "nmorph-media-gallery__content",
|
|
163
|
+
"left-class": "nmorph-media-gallery__left",
|
|
164
|
+
"right-class": "nmorph-media-gallery__right",
|
|
165
|
+
"actions-class": "nmorph-media-gallery__actions",
|
|
166
|
+
"show-navigation": z.value,
|
|
167
|
+
"show-action-bar": o.showActionBar && a.value?.kind === "image",
|
|
168
|
+
onClose: K,
|
|
169
|
+
onPrevious: H,
|
|
170
|
+
onNext: B
|
|
171
|
+
}, {
|
|
172
|
+
actions: r(() => [
|
|
173
|
+
g("div", Ve, [
|
|
174
|
+
l(t(w), { onClick: Q }, {
|
|
175
|
+
default: r(() => [
|
|
176
|
+
l(t(k), null, {
|
|
177
|
+
default: r(() => [
|
|
178
|
+
l(t(ge))
|
|
179
|
+
]),
|
|
180
|
+
_: 1
|
|
181
|
+
})
|
|
182
|
+
]),
|
|
183
|
+
_: 1
|
|
184
|
+
})
|
|
185
|
+
]),
|
|
186
|
+
g("div", Ee, [
|
|
187
|
+
l(t(w), { onClick: ee }, {
|
|
188
|
+
default: r(() => [
|
|
189
|
+
l(t(k), null, {
|
|
190
|
+
default: r(() => [
|
|
191
|
+
l(t(ke))
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
})
|
|
195
|
+
]),
|
|
196
|
+
_: 1
|
|
197
|
+
})
|
|
198
|
+
]),
|
|
199
|
+
g("div", He, [
|
|
200
|
+
l(t(w), { onClick: ae }, {
|
|
201
|
+
default: r(() => [
|
|
202
|
+
l(t(k), null, {
|
|
203
|
+
default: r(() => [
|
|
204
|
+
l(t(Ie))
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
})
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
})
|
|
211
|
+
]),
|
|
212
|
+
g("div", Be, [
|
|
213
|
+
l(t(w), { onClick: te }, {
|
|
214
|
+
default: r(() => [
|
|
215
|
+
l(t(k), null, {
|
|
216
|
+
default: r(() => [
|
|
217
|
+
l(t(xe))
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
})
|
|
221
|
+
]),
|
|
222
|
+
_: 1
|
|
223
|
+
})
|
|
224
|
+
]),
|
|
225
|
+
g("div", Le, [
|
|
226
|
+
l(t(w), {
|
|
227
|
+
disabled: d.value === 1,
|
|
228
|
+
onClick: oe
|
|
229
|
+
}, {
|
|
230
|
+
default: r(() => [
|
|
231
|
+
l(t(k), null, {
|
|
232
|
+
default: r(() => [
|
|
233
|
+
d.value < 1 ? (p(), y(t(we), { key: 0 })) : (p(), y(t(Ne), { key: 1 }))
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
})
|
|
237
|
+
]),
|
|
238
|
+
_: 1
|
|
239
|
+
}, 8, ["disabled"])
|
|
240
|
+
])
|
|
241
|
+
]),
|
|
242
|
+
default: r(() => [
|
|
243
|
+
g("div", be, [
|
|
244
|
+
a.value?.kind === "image" ? (p(), y(t(he), {
|
|
245
|
+
key: 0,
|
|
246
|
+
src: a.value.src,
|
|
247
|
+
alt: a.value.alt || a.value.name || "",
|
|
248
|
+
title: a.value.name,
|
|
249
|
+
fit: o.imageFit,
|
|
250
|
+
"frame-border": 0,
|
|
251
|
+
style: ve({ transform: q.value }),
|
|
252
|
+
onPointerdown: A,
|
|
253
|
+
onPointerup: O
|
|
254
|
+
}, null, 8, ["src", "alt", "title", "fit", "style"])) : a.value?.kind === "video" ? (p(), T("video", {
|
|
255
|
+
key: 1,
|
|
256
|
+
ref_key: "currentVideoRef",
|
|
257
|
+
ref: v,
|
|
258
|
+
class: "nmorph-media-gallery__video",
|
|
259
|
+
src: a.value.src,
|
|
260
|
+
poster: a.value.poster || void 0,
|
|
261
|
+
controls: U.value,
|
|
262
|
+
muted: Z.value,
|
|
263
|
+
playsinline: G.value,
|
|
264
|
+
preload: W.value,
|
|
265
|
+
title: a.value.name,
|
|
266
|
+
onPointerdown: A,
|
|
267
|
+
onPointerup: O,
|
|
268
|
+
onPlay: ne,
|
|
269
|
+
onPause: ie,
|
|
270
|
+
onEnded: re,
|
|
271
|
+
onError: ue
|
|
272
|
+
}, null, 40, Pe)) : L("", !0),
|
|
273
|
+
a.value?.kind === "video" ? (p(), T("button", {
|
|
274
|
+
key: 2,
|
|
275
|
+
class: "nmorph-media-gallery__play",
|
|
276
|
+
type: "button",
|
|
277
|
+
"aria-label": u.value ? `Pause ${R.value}` : `Play ${R.value}`,
|
|
278
|
+
onClick: me(le, ["stop"])
|
|
279
|
+
}, [
|
|
280
|
+
l(t(k), {
|
|
281
|
+
size: "medium",
|
|
282
|
+
color: "var(--nmorph-contrast-text-color)"
|
|
283
|
+
}, {
|
|
284
|
+
default: r(() => [
|
|
285
|
+
u.value ? (p(), y(t(_e), { key: 0 })) : (p(), y(t(ye), { key: 1 }))
|
|
286
|
+
]),
|
|
287
|
+
_: 1
|
|
288
|
+
})
|
|
289
|
+
], 8, Ce)) : L("", !0)
|
|
290
|
+
])
|
|
291
|
+
]),
|
|
292
|
+
_: 1
|
|
293
|
+
}, 8, ["show", "z-index", "state-class", "show-navigation", "show-action-bar"])) : L("", !0);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
export {
|
|
297
|
+
Je as default
|
|
298
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nmorph-preview-portal{display:contents}.nmorph-preview-portal .nmorph-preview-portal__content{--nmorph-preview-portal-content-width: min( calc(100vw - 96px) , 960px);--nmorph-preview-portal-content-height: min( calc(100vh - 180px) , 720px);position:absolute;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:var(--nmorph-preview-portal-content-width);height:var(--nmorph-preview-portal-content-height);transform:translate(-50%,-50%);transition:var(--transition-04) opacity ease-in-out;pointer-events:none}.nmorph-preview-portal .nmorph-preview-portal__actions{position:absolute;bottom:-50px;left:50%;z-index:2;display:flex;height:0;transform:translate(-50%);transition:ease-in-out bottom var(--transition-03)}.nmorph-preview-portal .nmorph-button__content{box-shadow:none}.nmorph-preview-portal .nmorph-preview-portal__left,.nmorph-preview-portal .nmorph-preview-portal__right{z-index:2}.nmorph-preview-portal .nmorph-preview-portal__left{position:absolute;top:50%;left:-100%;transform:rotate(90deg) translate(-50%);transition:ease-in-out left var(--transition-03)}.nmorph-preview-portal .nmorph-preview-portal__right{position:absolute;top:50%;right:-100%;transform:rotate(270deg) translate(50%);transition:ease-in-out right var(--transition-03)}.nmorph-preview-portal.nmorph-preview-portal--opened .nmorph-preview-portal__actions{bottom:50px}.nmorph-preview-portal.nmorph-preview-portal--opened{--nmorph-preview-portal-btn-margin: 20px}.nmorph-preview-portal.nmorph-preview-portal--opened .nmorph-preview-portal__left{left:var(--nmorph-preview-portal-btn-margin)}.nmorph-preview-portal.nmorph-preview-portal--opened .nmorph-preview-portal__right{right:var(--nmorph-preview-portal-btn-margin)}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import './NmorphPreviewPortal.css';
|
|
2
|
+
import { defineComponent as k, computed as u, openBlock as r, createBlock as B, Teleport as $, createElementVNode as f, normalizeStyle as N, normalizeClass as a, createVNode as o, unref as s, withCtx as l, renderSlot as v, createElementBlock as m, createCommentVNode as i } from "vue";
|
|
3
|
+
import { createCssSizeVariables as x } from "../../../utils/common.js";
|
|
4
|
+
import z from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import c from "../../basic/nmorph-button/NmorphButton.vue.js";
|
|
7
|
+
/* empty css */
|
|
8
|
+
import w from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import C from "../../../assets/icons/chevron-down.svg.js";
|
|
11
|
+
const D = /* @__PURE__ */ k({
|
|
12
|
+
__name: "NmorphPreviewPortal",
|
|
13
|
+
props: {
|
|
14
|
+
show: { type: Boolean },
|
|
15
|
+
zIndex: { default: void 0 },
|
|
16
|
+
rootClass: { default: "" },
|
|
17
|
+
stateClass: { default: "" },
|
|
18
|
+
contentClass: { default: "" },
|
|
19
|
+
leftClass: { default: "" },
|
|
20
|
+
rightClass: { default: "" },
|
|
21
|
+
actionsClass: { default: "" },
|
|
22
|
+
navigationButtonMargin: { default: void 0 },
|
|
23
|
+
showNavigation: { type: Boolean, default: !1 },
|
|
24
|
+
showActionBar: { type: Boolean, default: !1 }
|
|
25
|
+
},
|
|
26
|
+
emits: ["close", "previous", "next"],
|
|
27
|
+
setup(h, { emit: _ }) {
|
|
28
|
+
const e = h, n = _, y = u(() => [
|
|
29
|
+
"nmorph-preview-portal",
|
|
30
|
+
e.rootClass,
|
|
31
|
+
e.stateClass,
|
|
32
|
+
e.show && "nmorph-preview-portal--opened"
|
|
33
|
+
]), g = u(
|
|
34
|
+
() => x({
|
|
35
|
+
"--nmorph-preview-portal-btn-margin": e.navigationButtonMargin
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
return (d, t) => e.show ? (r(), B($, {
|
|
39
|
+
key: 0,
|
|
40
|
+
to: "body"
|
|
41
|
+
}, [
|
|
42
|
+
f("div", {
|
|
43
|
+
class: a(y.value),
|
|
44
|
+
style: N(g.value)
|
|
45
|
+
}, [
|
|
46
|
+
o(s(z), {
|
|
47
|
+
show: e.show,
|
|
48
|
+
"z-index": e.zIndex,
|
|
49
|
+
"disabled-teleport": "",
|
|
50
|
+
onOnOutsideClick: t[2] || (t[2] = (p) => n("close")),
|
|
51
|
+
onOnEscapeKeydown: t[3] || (t[3] = (p) => n("close"))
|
|
52
|
+
}, {
|
|
53
|
+
default: l(() => [
|
|
54
|
+
f("div", {
|
|
55
|
+
class: a(["nmorph-preview-portal__content", e.contentClass])
|
|
56
|
+
}, [
|
|
57
|
+
v(d.$slots, "default")
|
|
58
|
+
], 2),
|
|
59
|
+
e.showNavigation ? (r(), m("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: a(["nmorph-preview-portal__left", e.leftClass])
|
|
62
|
+
}, [
|
|
63
|
+
o(s(c), {
|
|
64
|
+
onClick: t[0] || (t[0] = (p) => n("previous"))
|
|
65
|
+
}, {
|
|
66
|
+
default: l(() => [
|
|
67
|
+
o(s(w), null, {
|
|
68
|
+
default: l(() => [
|
|
69
|
+
o(s(C))
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
})
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
})
|
|
76
|
+
], 2)) : i("", !0),
|
|
77
|
+
e.showNavigation ? (r(), m("div", {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: a(["nmorph-preview-portal__right", e.rightClass])
|
|
80
|
+
}, [
|
|
81
|
+
o(s(c), {
|
|
82
|
+
onClick: t[1] || (t[1] = (p) => n("next"))
|
|
83
|
+
}, {
|
|
84
|
+
default: l(() => [
|
|
85
|
+
o(s(w), null, {
|
|
86
|
+
default: l(() => [
|
|
87
|
+
o(s(C))
|
|
88
|
+
]),
|
|
89
|
+
_: 1
|
|
90
|
+
})
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
})
|
|
94
|
+
], 2)) : i("", !0),
|
|
95
|
+
e.showActionBar ? (r(), m("div", {
|
|
96
|
+
key: 2,
|
|
97
|
+
class: a(["nmorph-preview-portal__actions", e.actionsClass])
|
|
98
|
+
}, [
|
|
99
|
+
v(d.$slots, "actions")
|
|
100
|
+
], 2)) : i("", !0)
|
|
101
|
+
]),
|
|
102
|
+
_: 3
|
|
103
|
+
}, 8, ["show", "z-index"])
|
|
104
|
+
], 6)
|
|
105
|
+
])) : i("", !0);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export {
|
|
109
|
+
D as default
|
|
110
|
+
};
|
package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import './NmorphTagItem.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssVariables as
|
|
5
|
-
import { NmorphComponentHeight as
|
|
6
|
-
import
|
|
2
|
+
import { defineComponent as I, ref as b, computed as m, onMounted as S, onBeforeUnmount as $, watch as z, openBlock as h, createElementBlock as _, normalizeStyle as H, normalizeClass as F, createElementVNode as U, renderSlot as G, toDisplayString as P, createBlock as K, unref as k, withModifiers as j, withCtx as Z, createVNode as q, createCommentVNode as J, nextTick as Q } from "vue";
|
|
3
|
+
import { useModifiers as W } from "../../../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssVariables as X } from "../../../../../utils/common.js";
|
|
5
|
+
import { NmorphComponentHeight as Y } from "../../../../../types/common.types.js";
|
|
6
|
+
import ee from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import
|
|
9
|
-
const
|
|
8
|
+
import te from "../../../../../assets/icons/error.svg.js";
|
|
9
|
+
const oe = { class: "nmorph-tag-item__content" }, re = { key: 1 }, ne = "var(--nmorph-gray-color)", y = "var(--nmorph-black-color)", le = "var(--nmorph-white-color)", de = /* @__PURE__ */ I({
|
|
10
10
|
__name: "NmorphTagItem",
|
|
11
11
|
props: {
|
|
12
12
|
value: {},
|
|
@@ -14,25 +14,27 @@ const te = { class: "nmorph-tag-item__content" }, oe = { key: 1 }, re = "var(--n
|
|
|
14
14
|
removable: { type: Boolean, default: !0 },
|
|
15
15
|
height: { default: "basic" },
|
|
16
16
|
design: { default: "nmorph" },
|
|
17
|
-
color: { default:
|
|
17
|
+
color: { default: ne }
|
|
18
18
|
},
|
|
19
19
|
emits: ["click", "close"],
|
|
20
|
-
setup(
|
|
21
|
-
const N = { r: 201, g: 210, b: 222 },
|
|
22
|
-
let
|
|
23
|
-
const R =
|
|
24
|
-
() =>
|
|
25
|
-
nmorph: [
|
|
26
|
-
"nmorph-tag-item": [
|
|
20
|
+
setup(g, { emit: O }) {
|
|
21
|
+
const N = { r: 201, g: 210, b: 222 }, l = g, i = b(null), u = b(y);
|
|
22
|
+
let p = null;
|
|
23
|
+
const R = m(
|
|
24
|
+
() => W({
|
|
25
|
+
nmorph: [Y[l.height]],
|
|
26
|
+
"nmorph-tag-item": [l.design]
|
|
27
27
|
})
|
|
28
|
-
),
|
|
29
|
-
"--
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, D = () => {
|
|
34
|
-
C("
|
|
35
|
-
}, L = (
|
|
28
|
+
), d = m(() => l.design === "common"), w = m(
|
|
29
|
+
() => d.value ? u.value : "var(--nmorph-contrast-text-color)"
|
|
30
|
+
), V = m(() => d.value ? X({
|
|
31
|
+
"--tag-item-background-color": l.color,
|
|
32
|
+
"--tag-item-content-color": u.value
|
|
33
|
+
}) : {}), C = O, D = () => {
|
|
34
|
+
C("close", l.value);
|
|
35
|
+
}, L = () => {
|
|
36
|
+
C("click", l.value);
|
|
37
|
+
}, T = (o) => {
|
|
36
38
|
const t = o.trim().replace("#", "");
|
|
37
39
|
if (![3, 4, 6, 8].includes(t.length)) return null;
|
|
38
40
|
const e = t.length <= 4 ? t.split("").map((r) => `${r}${r}`).join("") : t;
|
|
@@ -41,69 +43,70 @@ const te = { class: "nmorph-tag-item__content" }, oe = { key: 1 }, re = "var(--n
|
|
|
41
43
|
g: parseInt(e.slice(2, 4), 16),
|
|
42
44
|
b: parseInt(e.slice(4, 6), 16)
|
|
43
45
|
};
|
|
44
|
-
},
|
|
46
|
+
}, M = (o) => {
|
|
45
47
|
const t = o.match(/^rgba?\((.+)\)$/);
|
|
46
48
|
if (!t) return null;
|
|
47
|
-
const e = t[1].split("/")[0], r = e.includes(",") ? e.split(",") : e.trim().split(/\s+/), [n, a, c] = r.map((
|
|
48
|
-
return [n, a, c].some((
|
|
49
|
-
},
|
|
49
|
+
const e = t[1].split("/")[0], r = e.includes(",") ? e.split(",") : e.trim().split(/\s+/), [n, a, c] = r.map((s) => Number.parseFloat(s));
|
|
50
|
+
return [n, a, c].some((s) => Number.isNaN(s)) ? null : { r: n, g: a, b: c };
|
|
51
|
+
}, x = (o, t) => {
|
|
50
52
|
const e = o.trim().match(/^var\(\s*(--[A-Za-z0-9-_]+)(?:\s*,\s*(.+))?\)$/);
|
|
51
53
|
if (!e) return o;
|
|
52
|
-
const [, r, n] = e, a = t.ownerDocument, c = getComputedStyle(t).getPropertyValue(r).trim(),
|
|
53
|
-
return c ||
|
|
54
|
+
const [, r, n] = e, a = t.ownerDocument, c = getComputedStyle(t).getPropertyValue(r).trim(), s = getComputedStyle(a.documentElement).getPropertyValue(r).trim();
|
|
55
|
+
return c || s || n || o;
|
|
54
56
|
}, A = (o, t) => {
|
|
55
57
|
let e = o;
|
|
56
58
|
for (let r = 0; r < 4; r += 1) {
|
|
57
|
-
const n =
|
|
59
|
+
const n = x(e, t);
|
|
58
60
|
if (n === e) break;
|
|
59
61
|
e = n;
|
|
60
62
|
}
|
|
61
|
-
return
|
|
63
|
+
return T(e) || M(e) || N;
|
|
62
64
|
}, B = ({ r: o, g: t, b: e }) => {
|
|
63
65
|
const [r, n, a] = [o, t, e].map((c) => {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
+
const s = c / 255;
|
|
67
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
66
68
|
});
|
|
67
69
|
return 0.2126 * r + 0.7152 * n + 0.0722 * a;
|
|
68
|
-
},
|
|
70
|
+
}, v = (o, t) => {
|
|
69
71
|
const [e, r] = [o, t].sort((n, a) => a - n);
|
|
70
72
|
return (e + 0.05) / (r + 0.05);
|
|
71
73
|
}, E = (o) => {
|
|
72
|
-
const t = B(o), e =
|
|
73
|
-
return e > r ?
|
|
74
|
-
},
|
|
75
|
-
await
|
|
74
|
+
const t = B(o), e = v(t, 1), r = v(t, 0);
|
|
75
|
+
return e > r ? le : y;
|
|
76
|
+
}, f = async () => {
|
|
77
|
+
await Q(), !(!d.value || !i.value) && (u.value = E(A(l.color, i.value)));
|
|
76
78
|
};
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
+
return S(() => {
|
|
80
|
+
f(), !(typeof MutationObserver > "u" || !i.value) && (p = new MutationObserver(() => f()), p.observe(i.value.ownerDocument.documentElement, {
|
|
79
81
|
attributes: !0,
|
|
80
82
|
attributeFilter: ["nmorph-data-theme", "class", "style"]
|
|
81
83
|
}));
|
|
82
|
-
}),
|
|
83
|
-
|
|
84
|
-
}),
|
|
84
|
+
}), $(() => {
|
|
85
|
+
p?.disconnect();
|
|
86
|
+
}), z(() => [l.color, l.design], f, { flush: "post" }), (o, t) => (h(), _("div", {
|
|
85
87
|
ref_key: "tagRef",
|
|
86
88
|
ref: i,
|
|
87
|
-
class:
|
|
88
|
-
style:
|
|
89
|
-
onClick:
|
|
89
|
+
class: F(R.value),
|
|
90
|
+
style: H(V.value),
|
|
91
|
+
onClick: L
|
|
90
92
|
}, [
|
|
91
|
-
|
|
92
|
-
o.$slots.default ?
|
|
93
|
-
|
|
93
|
+
U("div", oe, [
|
|
94
|
+
o.$slots.default ? G(o.$slots, "default", { key: 0 }) : (h(), _("span", re, P(g.text), 1)),
|
|
95
|
+
l.removable ? (h(), K(k(ee), {
|
|
94
96
|
key: 2,
|
|
95
97
|
class: "nmorph-tag-item__close-icon",
|
|
96
|
-
|
|
98
|
+
color: w.value,
|
|
99
|
+
onClick: j(D, ["stop"])
|
|
97
100
|
}, {
|
|
98
|
-
default:
|
|
99
|
-
|
|
101
|
+
default: Z(() => [
|
|
102
|
+
q(k(te))
|
|
100
103
|
]),
|
|
101
104
|
_: 1
|
|
102
|
-
})) :
|
|
105
|
+
}, 8, ["color"])) : J("", !0)
|
|
103
106
|
])
|
|
104
107
|
], 6));
|
|
105
108
|
}
|
|
106
109
|
});
|
|
107
110
|
export {
|
|
108
|
-
|
|
111
|
+
de as default
|
|
109
112
|
};
|
|
@@ -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--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-
|
|
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-contrast-text-color);background:color-mix(in srgb,var(--nmorph-black-color) 58%,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{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-video-preview .nmorph-video-preview__play:hover{background:color-mix(in srgb,var(--nmorph-black-color) 72%,transparent)}.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:0;background:transparent}.nmorph-video-preview .nmorph-video-preview__action-button,.nmorph-video-preview .nmorph-video-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;padding:0;color:var(--nmorph-contrast-text-color);font:inherit;text-decoration:none;background:color-mix(in srgb,var(--nmorph-black-color) 58%,transparent);border:0;border-radius:var(--default-border-radius);cursor:pointer}.nmorph-video-preview .nmorph-video-preview__action-button:hover,.nmorph-video-preview .nmorph-video-preview__action-link:hover{background:color-mix(in srgb,var(--nmorph-black-color) 72%,transparent)}.nmorph-video-preview .nmorph-video-preview__action-button .nmorph-icon,.nmorph-video-preview .nmorph-video-preview__action-link .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.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)}.nmorph-video-preview__portal{display:contents}.nmorph-video-preview__portal .nmorph-video-preview__portal-content{--nmorph-video-preview-portal-width: min( calc(100vw - 96px) , 1080px);--nmorph-video-preview-portal-height: min( calc(100vh - 180px) , 720px);position:absolute;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:var(--nmorph-video-preview-portal-width);height:var(--nmorph-video-preview-portal-height);transform:translate(-50%,-50%)}.nmorph-video-preview__portal .nmorph-video-preview__portal-media{display:block;width:100%;max-width:100%;height:100%;max-height:100%;object-fit:contain;background:var(--nmorph-black-color);border-radius:var(--default-border-radius)}
|