@nmorph/nmorph-ui-kit 2.2.51 → 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.
Files changed (28) hide show
  1. package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
  2. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +118 -86
  3. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.css +1 -1
  4. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +183 -225
  5. package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.css +1 -0
  6. package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.vue.js +298 -0
  7. package/dist/components/data/nmorph-media-gallery/NmorphMediaGallery.vue3.js +6 -0
  8. package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.css +1 -0
  9. package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.js +110 -0
  10. package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue3.js +6 -0
  11. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +6 -5
  12. package/dist/index.es.js +866 -863
  13. package/dist/index.umd.js +21 -21
  14. package/dist/outside-hooks/use-nmorph-theme.js +16 -16
  15. package/dist/package.json.js +1 -1
  16. package/dist/src/components/data/index.d.ts +2 -0
  17. package/dist/src/components/data/nmorph-card/NmorphCard.vue.d.ts +1 -1
  18. package/dist/src/components/data/nmorph-file-card/types.d.ts +1 -1
  19. package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +3 -3
  20. package/dist/src/components/data/nmorph-media-gallery/NmorphMediaGallery.vue.d.ts +26 -0
  21. package/dist/src/components/data/nmorph-media-gallery/types.d.ts +34 -0
  22. package/dist/src/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.d.ts +43 -0
  23. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +2 -1
  24. package/dist/src/components/data/nmorph-video-preview/types.d.ts +2 -0
  25. package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +1 -1
  26. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +1 -1
  27. package/dist/style.css +1 -1
  28. package/package.json +24 -23
@@ -1 +1 @@
1
- .nmorph-file-card{display:flex;gap:var(--indentation-03);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-file-card .nmorph-file-card__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-text-color) 10%,transparent);border-radius:var(--default-border-radius);--color: currentColor}.nmorph-file-card .nmorph-file-card__icon-action{position:absolute;right:-4px;bottom:-4px;display:inline-flex;justify-content:center;align-items:center;width:18px;height:18px;color:var(--nmorph-contrast-text-color);text-decoration:none;background:color-mix(in srgb,var(--nmorph-black-color) 36%,transparent);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset)}.nmorph-file-card .nmorph-file-card__icon-action:hover{background:color-mix(in srgb,var(--nmorph-black-color) 48%,transparent)}.nmorph-file-card .nmorph-file-card__icon-action .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-file-card .nmorph-file-card__body{display:flex;flex:1 1 0;flex-direction:column;gap:var(--indentation-01);min-width:0}.nmorph-file-card .nmorph-file-card__info{display:flex;flex-direction:column;gap:2px;min-width:0}.nmorph-file-card .nmorph-file-card__name,.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-card .nmorph-file-card__name{font-weight:600;font-size:var(--font-size-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__error{color:var(--nmorph-error-text-color)}.nmorph-file-card .nmorph-file-card__audio-preview,.nmorph-file-card .nmorph-file-card__video-preview{width:100%;min-width:0}.nmorph-file-card .nmorph-file-card__badge{flex:0 0 auto;max-width:72px;padding:2px 6px;overflow:hidden;color:var(--nmorph-accent-color);font-weight:700;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-transform:uppercase;text-overflow:ellipsis;background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent);border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__actions{display:flex;flex:0 0 auto;gap:var(--indentation-01);align-items:center}.nmorph-file-card .nmorph-file-card__action-link,.nmorph-file-card .nmorph-file-card__action-loader{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:inherit;text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-file-card .nmorph-file-card__action-link .nmorph-icon{--color: currentColor}.nmorph-file-card .nmorph-file-card__action-loader{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__action-loader .nmorph-icon{--color: currentColor}.nmorph-file-card.nmorph-file-card--compact{min-height:52px;padding:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__icon{width:30px;height:30px}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__audio-preview,.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__video-preview{margin-top:0}.nmorph-file-card.nmorph-file-card--media-audio.nmorph-file-card--no-actions .nmorph-file-card__body{padding-inline-end:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--media-video.nmorph-file-card--compact{padding-block:var(--indentation-03)}.nmorph-file-card.nmorph-file-card--error{outline:1px solid var(--nmorph-error-color)}.nmorph-file-card.nmorph-file-card--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-file-card.nmorph-file-card--soft .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--plain{background:transparent;box-shadow:none}.nmorph-file-card.nmorph-file-card--plain .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--icon-plain .nmorph-file-card__icon{background:transparent}
1
+ .nmorph-file-card{display:flex;gap:var(--indentation-03);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-file-card .nmorph-file-card__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-text-color) 10%,transparent);border-radius:var(--default-border-radius);--color: currentColor}.nmorph-file-card .nmorph-file-card__icon-action{position:absolute;right:-4px;bottom:-4px;display:inline-flex;justify-content:center;align-items:center;width:18px;height:18px;color:var(--nmorph-contrast-text-color);text-decoration:none;background:color-mix(in srgb,var(--nmorph-black-color) 36%,transparent);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset)}.nmorph-file-card .nmorph-file-card__icon-action:hover{background:color-mix(in srgb,var(--nmorph-black-color) 48%,transparent)}.nmorph-file-card .nmorph-file-card__icon-action .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-file-card .nmorph-file-card__body{display:flex;flex:1 1 0;flex-direction:column;gap:var(--indentation-01);min-width:0}.nmorph-file-card .nmorph-file-card__info{display:flex;flex-direction:column;gap:2px;min-width:0}.nmorph-file-card .nmorph-file-card__name,.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-card .nmorph-file-card__name{font-weight:600;font-size:var(--font-size-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__error{color:var(--nmorph-error-text-color)}.nmorph-file-card .nmorph-file-card__audio-preview,.nmorph-file-card .nmorph-file-card__video-preview,.nmorph-file-card .nmorph-file-card__image-preview{width:100%;min-width:0}.nmorph-file-card .nmorph-file-card__image-preview{display:block;height:120px;padding:0;overflow:hidden;color:inherit;font:inherit;background:transparent;border:0;border-radius:var(--default-border-radius);cursor:pointer}.nmorph-file-card .nmorph-file-card__image-preview .nmorph-file-card__image{display:block;width:100%;max-width:100%;height:100%;object-fit:cover}.nmorph-file-card .nmorph-file-card__badge{flex:0 0 auto;max-width:72px;padding:2px 6px;overflow:hidden;color:var(--nmorph-accent-color);font-weight:700;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-transform:uppercase;text-overflow:ellipsis;background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent);border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__visual-size{position:absolute;right:var(--indentation-02);bottom:var(--indentation-02);z-index:2;display:inline-flex;align-items:center;min-width:0;max-width:calc(100% - var(--indentation-04));min-height:22px;padding:0 6px;overflow:hidden;color:var(--nmorph-contrast-text-color);font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-overflow:ellipsis;background:color-mix(in srgb,var(--nmorph-black-color) 58%,transparent);border-radius:var(--default-border-radius);pointer-events:none}.nmorph-file-card .nmorph-file-card__actions{display:flex;flex:0 0 auto;gap:var(--indentation-01);align-items:center}.nmorph-file-card .nmorph-file-card__action-link,.nmorph-file-card .nmorph-file-card__action-loader{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;width:22px;height:22px;padding:0;color:inherit;line-height:1;text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-file-card .nmorph-file-card__action-link .nmorph-icon{--color: currentColor}.nmorph-file-card .nmorph-file-card__action-loader{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__action-loader .nmorph-icon{--color: currentColor}.nmorph-file-card.nmorph-file-card--compact{min-height:52px;padding:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__icon{width:30px;height:30px}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__audio-preview,.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__video-preview{margin-top:0}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__image-preview{height:96px;margin-top:0}.nmorph-file-card.nmorph-file-card--media-audio.nmorph-file-card--no-actions .nmorph-file-card__body{padding-inline-end:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--media-visual{position:relative;display:block;gap:0;min-height:0;padding:0;overflow:hidden}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__body{position:relative;display:block;width:100%;min-width:0}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__info{position:absolute;top:var(--indentation-02);left:var(--indentation-02);z-index:2;max-width:calc(100% - 48px);pointer-events:none}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__name{display:block;min-height:22px;padding:0 6px;overflow:hidden;color:var(--nmorph-contrast-text-color);line-height:22px;white-space:nowrap;text-overflow:ellipsis;background:color-mix(in srgb,var(--nmorph-black-color) 58%,transparent);border-radius:var(--default-border-radius)}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__image-preview,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__video-preview,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-video-preview,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-video-preview__media,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__image{display:block;width:100%;max-width:none;height:100%;border-radius:inherit;object-fit:cover}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__actions{position:absolute;top:var(--indentation-02);right:var(--indentation-02);z-index:3}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__action-link,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__action-loader{color:var(--nmorph-contrast-text-color);background:color-mix(in srgb,var(--nmorph-black-color) 58%,transparent);border:0}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__action-link .nmorph-icon,.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__action-loader .nmorph-icon{flex:0 0 auto;--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-file-card.nmorph-file-card--media-visual .nmorph-file-card__action-link:hover{color:var(--nmorph-contrast-text-color);background:color-mix(in srgb,var(--nmorph-black-color) 72%,transparent)}.nmorph-file-card.nmorph-file-card--media-video .nmorph-file-card__info{max-width:calc(100% - 112px)}.nmorph-file-card.nmorph-file-card--media-video .nmorph-video-preview__actions{right:calc(var(--indentation-02) + 26px)}.nmorph-file-card.nmorph-file-card--media-image .nmorph-file-card__image-preview{border-radius:inherit}.nmorph-file-card.nmorph-file-card--error{outline:1px solid var(--nmorph-error-color)}.nmorph-file-card.nmorph-file-card--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-file-card.nmorph-file-card--soft .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--plain{background:transparent;box-shadow:none}.nmorph-file-card.nmorph-file-card--plain .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--icon-plain .nmorph-file-card__icon{background:transparent}
@@ -1,36 +1,42 @@
1
1
  import './NmorphFileCard.css';
2
- import { defineComponent as V, useSlots as W, computed as a, openBlock as r, createElementBlock as n, normalizeClass as K, createElementVNode as f, createVNode as t, unref as i, withCtx as c, createBlock as b, resolveDynamicComponent as j, createCommentVNode as l, toDisplayString as h, renderSlot as G } from "vue";
3
- import { useModifiers as U } from "../../../utils/create-modifiers.js";
4
- import { getFileExtension as q, getPlainFileType as J, getTypeCandidates as Q, isKnownFileType as m } 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 ae from "../nmorph-audio-preview/NmorphAudioPreview.vue.js";
2
+ import { defineComponent as K, useSlots as j, computed as a, openBlock as r, createElementBlock as i, normalizeClass as G, createVNode as n, unref as l, withCtx as m, createBlock as T, resolveDynamicComponent as U, createCommentVNode as t, createElementVNode as g, toDisplayString as d, Fragment as q, renderSlot as J } from "vue";
3
+ import { useModifiers as Q } from "../../../utils/create-modifiers.js";
4
+ import { getFileExtension as X, getPlainFileType as Y, getTypeCandidates as Z, isKnownFileType as u } from "../../../utils/file-types.js";
5
+ import { NmorphImageResolution as ee, NmorphAudioResolution as oe, NmorphVideoResolution as ae, NmorphArchiveResolution as re, NmorphDocResolution as ie } from "../../form/nmorph-file-upload/types.js";
6
+ import te from "../nmorph-audio-preview/NmorphAudioPreview.vue.js";
7
7
  /* empty css */
8
- import re from "../nmorph-video-preview/NmorphVideoPreview.vue.js";
8
+ import ne from "../nmorph-video-preview/NmorphVideoPreview.vue.js";
9
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";
13
- import d from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
+ import le from "../../../assets/icons/image.svg.js";
11
+ import se from "../../../assets/icons/archive.svg.js";
12
+ import H from "../../../assets/icons/doc.svg.js";
13
+ import p from "../../basic/nmorph-icon/NmorphIcon.vue.js";
14
14
  /* empty css */
15
- import ie from "../../../assets/icons/audio.svg.js";
16
- import le from "../../../assets/icons/video.svg.js";
17
- import se from "../../../assets/icons/eye.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" }, he = { class: "nmorph-file-card__info" }, ve = { class: "nmorph-file-card__name" }, _e = {
15
+ import ce from "../../../assets/icons/audio.svg.js";
16
+ import me from "../../../assets/icons/video.svg.js";
17
+ import de from "../../../assets/icons/eye.svg.js";
18
+ import ue from "../../../assets/icons/loading.svg.js";
19
+ import pe from "../../../assets/icons/open.svg.js";
20
+ import fe from "../../../assets/icons/download.svg.js";
21
+ const ve = {
22
+ key: 0,
23
+ class: "nmorph-file-card__icon"
24
+ }, he = ["href", "aria-label"], _e = { class: "nmorph-file-card__body" }, we = ["title"], ge = { class: "nmorph-file-card__name" }, ye = {
22
25
  key: 0,
23
26
  class: "nmorph-file-card__error"
24
- }, we = {
27
+ }, be = {
25
28
  key: 1,
26
29
  class: "nmorph-file-card__meta"
27
- }, ye = {
28
- key: 0,
29
- class: "nmorph-file-card__badge"
30
- }, ge = {
30
+ }, ke = ["title", "aria-label"], Ne = ["src", "alt"], Be = {
31
31
  key: 1,
32
+ class: "nmorph-file-card__visual-size"
33
+ }, Ce = {
34
+ key: 2,
35
+ class: "nmorph-file-card__badge"
36
+ }, Se = {
37
+ key: 3,
32
38
  class: "nmorph-file-card__actions"
33
- }, Ne = ["aria-label"], Be = ["href", "aria-label"], be = ["href", "download", "aria-label"], ke = "var(--nmorph-contrast-text-color)", Ke = /* @__PURE__ */ V({
39
+ }, Te = ["aria-label"], xe = ["href", "aria-label"], Pe = ["href", "download", "aria-label"], Ae = "var(--nmorph-contrast-text-color)", Qe = /* @__PURE__ */ K({
34
40
  __name: "NmorphFileCard",
35
41
  props: {
36
42
  name: {},
@@ -50,67 +56,76 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
50
56
  showDefaultActions: { type: Boolean, default: !0 }
51
57
  },
52
58
  emits: ["open", "download", "error"],
53
- setup(P, { emit: H }) {
54
- const e = P, v = H, $ = W(), p = a(() => (e.extension || q(e.name) || J(e.mimeType)).toLowerCase()), s = a(() => Q(e.mimeType, e.name)), D = a(() => e.mimeType.toLowerCase().startsWith("image/") || s.value.some((o) => m(o, X)) ? ne : e.mimeType.toLowerCase().startsWith("audio/") || s.value.some((o) => m(o, Y)) ? ie : e.mimeType.toLowerCase().startsWith("video/") || s.value.some((o) => m(o, Z)) ? le : s.value.some((o) => m(o, ee)) ? te : s.value.some((o) => m(o, oe)) ? A : A), E = (o) => {
59
+ setup(D, { emit: E }) {
60
+ const e = D, y = E, L = j(), f = a(() => (e.extension || X(e.name) || Y(e.mimeType)).toLowerCase()), s = a(() => Z(e.mimeType, e.name)), M = a(() => e.mimeType.toLowerCase().startsWith("image/") || s.value.some((o) => u(o, ee)) ? le : e.mimeType.toLowerCase().startsWith("audio/") || s.value.some((o) => u(o, oe)) ? ce : e.mimeType.toLowerCase().startsWith("video/") || s.value.some((o) => u(o, ae)) ? me : s.value.some((o) => u(o, re)) ? se : s.value.some((o) => u(o, ie)) ? H : H), O = (o) => {
55
61
  if (o === void 0 || Number.isNaN(o) || o < 0) return "";
56
62
  if (o === 0) return "0 B";
57
- const g = ["B", "KB", "MB", "GB", "TB"], N = Math.min(Math.floor(Math.log(o) / Math.log(1024)), g.length - 1), B = o / 1024 ** N, F = B >= 10 || N === 0 || Number.isInteger(B) ? 0 : 1;
58
- return `${B.toFixed(F)} ${g[N]}`;
59
- }, L = a(() => E(e.size)), O = a(() => p.value || e.mimeType), k = a(() => [O.value, L.value].filter(Boolean).join(" · ")), _ = a(() => e.mediaPreview === "audio" && !!e.previewSrc && !e.loading && !e.error), w = a(() => e.mediaPreview === "video" && !!e.previewSrc && !e.loading && !e.error), u = a(() => _.value || w.value), R = a(() => e.compact ? "96px" : "120px"), C = a(() => e.mimeType.toLowerCase() === "application/pdf" || p.value === "pdf"), S = a(() => C.value ? e.previewSrc || e.downloadHref : ""), y = a(
60
- () => e.showDefaultActions && !!S.value && !u.value && C.value
61
- ), T = a(
62
- () => !!$.actions || e.showDefaultActions && (e.loading || e.previewSrc && !u.value && !y.value || e.downloadHref)
63
- ), M = a(
64
- () => U({
63
+ const B = ["B", "KB", "MB", "GB", "TB"], C = Math.min(Math.floor(Math.log(o) / Math.log(1024)), B.length - 1), S = o / 1024 ** C, W = S >= 10 || C === 0 || Number.isInteger(S) ? 0 : 1;
64
+ return `${S.toFixed(W)} ${B[C]}`;
65
+ }, b = a(() => O(e.size)), R = a(() => f.value || e.mimeType), x = a(() => [R.value, b.value].filter(Boolean).join(" · ")), k = a(() => e.mediaPreview === "audio" && !!e.previewSrc && !e.loading && !e.error), v = a(() => e.mediaPreview === "video" && !!e.previewSrc && !e.loading && !e.error), h = a(() => e.mediaPreview === "image" && !!e.previewSrc && !e.loading && !e.error), _ = a(
66
+ () => k.value || v.value || h.value
67
+ ), c = a(() => v.value || h.value), z = a(() => e.compact ? "96px" : "120px"), P = a(() => e.mimeType.toLowerCase() === "application/pdf" || f.value === "pdf"), A = a(() => P.value ? e.previewSrc || e.downloadHref : ""), N = a(
68
+ () => e.showDefaultActions && !!A.value && !_.value && P.value
69
+ ), I = a(
70
+ () => !!L.actions || e.showDefaultActions && (e.loading || e.previewSrc && !_.value && !N.value || e.downloadHref)
71
+ ), F = a(
72
+ () => Q({
65
73
  "nmorph-file-card": [
66
74
  e.surface,
67
75
  e.compact && "compact",
68
76
  e.loading && "loading",
69
77
  e.error && "error",
70
- u.value && "media",
71
- _.value && "media-audio",
72
- w.value && "media-video",
78
+ _.value && "media",
79
+ k.value && "media-audio",
80
+ v.value && "media-video",
81
+ h.value && "media-image",
82
+ c.value && "media-visual",
73
83
  !e.iconSurface && "icon-plain",
74
- !T.value && "no-actions"
84
+ !I.value && "no-actions"
75
85
  ]
76
86
  })
77
- ), x = () => v("open"), z = () => v("download"), I = () => v("error");
78
- return (o, g) => (r(), n("div", {
79
- class: K(M.value)
87
+ ), w = () => y("open"), V = () => y("download"), $ = () => y("error");
88
+ return (o, B) => (r(), i("div", {
89
+ class: G(F.value)
80
90
  }, [
81
- f("div", pe, [
82
- t(i(d), { size: "medium" }, {
83
- default: c(() => [
84
- (r(), b(j(D.value)))
91
+ c.value ? t("", !0) : (r(), i("div", ve, [
92
+ n(l(p), { size: "medium" }, {
93
+ default: m(() => [
94
+ (r(), T(U(M.value)))
85
95
  ]),
86
96
  _: 1
87
97
  }),
88
- y.value && !e.loading && !e.error ? (r(), n("a", {
98
+ N.value && !e.loading && !e.error ? (r(), i("a", {
89
99
  key: 0,
90
- href: S.value,
100
+ href: A.value,
91
101
  target: "_blank",
92
102
  rel: "noopener noreferrer",
93
103
  class: "nmorph-file-card__icon-action",
94
104
  "aria-label": `Preview ${e.name}`,
95
- onClick: x
105
+ onClick: w
96
106
  }, [
97
- t(i(d), {
107
+ n(l(p), {
98
108
  size: "small",
99
- color: ke
109
+ color: Ae
100
110
  }, {
101
- default: c(() => [
102
- t(i(se))
111
+ default: m(() => [
112
+ n(l(de))
103
113
  ]),
104
114
  _: 1
105
115
  })
106
- ], 8, ue)) : l("", !0)
107
- ]),
108
- f("div", fe, [
109
- f("div", he, [
110
- f("span", ve, h(e.name), 1),
111
- e.error && e.errorText ? (r(), n("span", _e, h(e.errorText), 1)) : k.value ? (r(), n("span", we, h(k.value), 1)) : l("", !0)
112
- ]),
113
- _.value ? (r(), b(ae, {
116
+ ], 8, he)) : t("", !0)
117
+ ])),
118
+ g("div", _e, [
119
+ g("div", {
120
+ class: "nmorph-file-card__info",
121
+ title: e.name
122
+ }, [
123
+ g("span", ge, d(e.name), 1),
124
+ c.value ? t("", !0) : (r(), i(q, { key: 0 }, [
125
+ e.error && e.errorText ? (r(), i("span", ye, d(e.errorText), 1)) : x.value ? (r(), i("span", be, d(x.value), 1)) : t("", !0)
126
+ ], 64))
127
+ ], 8, we),
128
+ k.value ? (r(), T(te, {
114
129
  key: 0,
115
130
  class: "nmorph-file-card__audio-preview",
116
131
  src: e.previewSrc,
@@ -121,74 +136,91 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
121
136
  "show-icon": !1,
122
137
  "show-header": !1,
123
138
  "show-default-actions": !1,
124
- onError: I
125
- }, null, 8, ["src", "name"])) : l("", !0),
126
- w.value ? (r(), b(re, {
139
+ onError: $
140
+ }, null, 8, ["src", "name"])) : t("", !0),
141
+ v.value ? (r(), T(ne, {
127
142
  key: 1,
128
143
  class: "nmorph-file-card__video-preview",
129
144
  src: e.previewSrc,
130
145
  name: e.name,
131
- height: R.value,
146
+ height: z.value,
132
147
  surface: "plain",
133
148
  embedded: "",
134
149
  compact: "",
135
150
  controls: !1,
136
151
  "show-meta": !1,
137
152
  "show-default-actions": !1,
138
- onError: I
139
- }, null, 8, ["src", "name", "height"])) : l("", !0)
153
+ "preview-mode": "emit",
154
+ onError: $,
155
+ onPreview: w
156
+ }, null, 8, ["src", "name", "height"])) : t("", !0),
157
+ h.value ? (r(), i("button", {
158
+ key: 2,
159
+ class: "nmorph-file-card__image-preview",
160
+ type: "button",
161
+ title: e.name,
162
+ "aria-label": `Preview ${e.name}`,
163
+ onClick: w
164
+ }, [
165
+ g("img", {
166
+ class: "nmorph-file-card__image",
167
+ src: e.previewSrc,
168
+ alt: e.name
169
+ }, null, 8, Ne)
170
+ ], 8, ke)) : t("", !0)
140
171
  ]),
141
- e.showExtensionBadge && p.value ? (r(), n("span", ye, h(p.value), 1)) : l("", !0),
142
- T.value ? (r(), n("div", ge, [
143
- G(o.$slots, "actions", {}, () => [
144
- e.loading ? (r(), n("span", {
172
+ c.value && b.value ? (r(), i("span", Be, d(b.value), 1)) : t("", !0),
173
+ e.showExtensionBadge && f.value && !c.value ? (r(), i("span", Ce, d(f.value), 1)) : t("", !0),
174
+ I.value ? (r(), i("div", Se, [
175
+ J(o.$slots, "actions", {}, () => [
176
+ e.loading ? (r(), i("span", {
145
177
  key: 0,
146
178
  class: "nmorph-file-card__action-loader",
147
179
  role: "status",
148
180
  "aria-label": `Uploading ${e.name}`
149
181
  }, [
150
- t(i(d), { size: "small" }, {
151
- default: c(() => [
152
- t(i(ce))
182
+ n(l(p), { size: "small" }, {
183
+ default: m(() => [
184
+ n(l(ue))
153
185
  ]),
154
186
  _: 1
155
187
  })
156
- ], 8, Ne)) : e.previewSrc && !u.value && !y.value ? (r(), n("a", {
188
+ ], 8, Te)) : e.previewSrc && !_.value && !N.value ? (r(), i("a", {
157
189
  key: 1,
158
190
  href: e.previewSrc,
159
191
  target: "_blank",
160
192
  rel: "noopener noreferrer",
161
193
  class: "nmorph-file-card__action-link",
162
194
  "aria-label": `Open ${e.name}`,
163
- onClick: x
195
+ onClick: w
164
196
  }, [
165
- t(i(d), { size: "small" }, {
166
- default: c(() => [
167
- t(i(me))
197
+ n(l(p), { size: "small" }, {
198
+ default: m(() => [
199
+ n(l(pe))
168
200
  ]),
169
201
  _: 1
170
202
  })
171
- ], 8, Be)) : l("", !0),
172
- !e.loading && e.downloadHref ? (r(), n("a", {
203
+ ], 8, xe)) : t("", !0),
204
+ !e.loading && e.downloadHref ? (r(), i("a", {
173
205
  key: 2,
174
206
  href: e.downloadHref,
175
207
  download: e.name,
176
208
  class: "nmorph-file-card__action-link",
177
209
  "aria-label": `Download ${e.name}`,
178
- onClick: z
210
+ onClick: V
179
211
  }, [
180
- t(i(d), { size: "small" }, {
181
- default: c(() => [
182
- t(i(de))
212
+ n(l(p), { size: "small" }, {
213
+ default: m(() => [
214
+ n(l(fe))
183
215
  ]),
184
216
  _: 1
185
217
  })
186
- ], 8, be)) : l("", !0)
218
+ ], 8, Pe)) : t("", !0)
187
219
  ])
188
- ])) : l("", !0)
220
+ ])) : t("", !0)
189
221
  ], 2));
190
222
  }
191
223
  });
192
224
  export {
193
- Ke as default
225
+ Qe as default
194
226
  };
@@ -1 +1 @@
1
- .nmorph-image-preview{--width: 50px;--height: 50px;--nmorph-image-preview-radius: var(--default-border-radius);width:var(--width);height:var(--height);overflow:hidden;border-radius:var(--nmorph-image-preview-radius)}.nmorph-image-preview .nmorph-image-preview__trigger{position:relative;width:100%;height:100%;cursor:pointer}.nmorph-image-preview .nmorph-image-preview__trigger:hover{filter:brightness(.8)}.nmorph-image-preview .nmorph-image-preview__trigger .nmorph-image{width:100%;height:100%}.nmorph-image-preview.nmorph-image-preview--gallery-trigger{width:auto;height:auto;overflow:visible}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger{display:flex;flex-wrap:wrap;gap:var(--nmorph-image-preview-trigger-gap, 8px);width:auto;height:auto}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger:hover{filter:none}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item{position:relative;display:block;width:var(--width);height:var(--height);padding:0;overflow:hidden;color:inherit;font:inherit;background:transparent;border:0;border-radius:var(--nmorph-image-preview-radius);cursor:pointer}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item:hover{filter:brightness(.8)}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item .nmorph-image{width:100%;height:100%}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-more{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:var(--nmorph-white-color);font-weight:600;line-height:var(--line-height-regular);background:color-mix(in srgb,var(--nmorph-black-color) 60%,transparent);pointer-events:none}.nmorph-image-preview__portal{display:contents}.nmorph-image-preview__portal .nmorph-image-preview__content{--nmorph-image-preview-content-width: min( calc(100vw - 96px) , 960px);--nmorph-image-preview-content-height: min( calc(100vh - 180px) , 720px);position:absolute;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:var(--nmorph-image-preview-content-width);height:var(--nmorph-image-preview-content-height);transform:translate(-50%,-50%);transition:var(--transition-04) opacity ease-in-out;pointer-events:none}.nmorph-image-preview__portal .nmorph-image-preview__content .nmorph-image{width:100%;height:100%;pointer-events:none}.nmorph-image-preview__portal .nmorph-image-preview__content .nmorph-image img{display:block;width:auto;max-width:100%;height:auto;max-height:100%;object-fit:contain;pointer-events:auto}.nmorph-image-preview__portal .nmorph-image-preview__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-image-preview__portal .nmorph-image-preview__action-element{margin-right:var(--indentation-03)}.nmorph-image-preview__portal .nmorph-button__content{box-shadow:none}.nmorph-image-preview__portal .nmorph-image-preview__left,.nmorph-image-preview__portal .nmorph-image-preview__right{z-index:2}.nmorph-image-preview__portal .nmorph-image-preview__left{position:absolute;top:50%;left:-100%;transform:rotate(90deg) translate(-50%);transition:ease-in-out left var(--transition-03)}.nmorph-image-preview__portal .nmorph-image-preview__right{position:absolute;top:50%;right:-100%;transform:rotate(270deg) translate(50%);transition:ease-in-out right var(--transition-03)}.nmorph-image-preview__portal.nmorph-image-preview--opened .nmorph-image-preview__actions{bottom:50px}.nmorph-image-preview__portal.nmorph-image-preview--opened{--nmorph-image-preview-btn-margin: 20px}.nmorph-image-preview__portal.nmorph-image-preview--opened .nmorph-image-preview__left{left:var(--nmorph-image-preview-btn-margin)}.nmorph-image-preview__portal.nmorph-image-preview--opened .nmorph-image-preview__right{right:var(--nmorph-image-preview-btn-margin)}
1
+ .nmorph-image-preview{--width: 50px;--height: 50px;--nmorph-image-preview-radius: var(--default-border-radius);width:var(--width);height:var(--height);overflow:hidden;border-radius:var(--nmorph-image-preview-radius)}.nmorph-image-preview .nmorph-image-preview__trigger{position:relative;width:100%;height:100%;cursor:pointer}.nmorph-image-preview .nmorph-image-preview__trigger:hover{filter:brightness(.8)}.nmorph-image-preview .nmorph-image-preview__trigger .nmorph-image{width:100%;height:100%}.nmorph-image-preview.nmorph-image-preview--gallery-trigger{width:auto;height:auto;overflow:visible}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger{display:flex;flex-wrap:wrap;gap:var(--nmorph-image-preview-trigger-gap, 8px);width:auto;height:auto}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger:hover{filter:none}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item{position:relative;display:block;width:var(--width);height:var(--height);padding:0;overflow:hidden;color:inherit;font:inherit;background:transparent;border:0;border-radius:var(--nmorph-image-preview-radius);cursor:pointer}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item:hover{filter:brightness(.8)}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-item .nmorph-image{width:100%;height:100%}.nmorph-image-preview.nmorph-image-preview--gallery-trigger .nmorph-image-preview__trigger-more{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:var(--nmorph-white-color);font-weight:600;line-height:var(--line-height-regular);background:color-mix(in srgb,var(--nmorph-black-color) 60%,transparent);pointer-events:none}.nmorph-image-preview__portal{display:contents}.nmorph-image-preview__portal .nmorph-image-preview__content .nmorph-image{width:100%;height:100%;pointer-events:none}.nmorph-image-preview__portal .nmorph-image-preview__content .nmorph-image img{display:block;width:auto;max-width:100%;height:auto;max-height:100%;object-fit:contain;pointer-events:auto}.nmorph-image-preview__portal .nmorph-image-preview__action-element{margin-right:var(--indentation-03)}