@nmorph/nmorph-ui-kit 2.2.50 → 2.2.51

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