@templatical/media-library 0.39.1 → 0.39.2
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/MediaEditModal-DltAfTVH.js +311 -0
- package/dist/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +9 -0
- package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js +3528 -0
- package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js.map +1 -0
- package/dist/cdn/chunks/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +10 -1
- package/dist/cdn/chunks/{ca-CGf3MuE2.js.map → ca-B1Ig3u8O.js.map} +1 -1
- package/dist/cdn/chunks/{de-D5ebAV5i.js → de-BNbyJubD.js} +10 -1
- package/dist/cdn/chunks/{de-D5ebAV5i.js.map → de-BNbyJubD.js.map} +1 -1
- package/dist/cdn/chunks/en-CQxhpwqd.js +101 -0
- package/dist/cdn/chunks/en-CQxhpwqd.js.map +1 -0
- package/dist/cdn/chunks/{es-BG--QNW0.js → es-B2EH-TdJ.js} +10 -1
- package/dist/cdn/chunks/{es-BG--QNW0.js.map → es-B2EH-TdJ.js.map} +1 -1
- package/dist/cdn/chunks/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +10 -1
- package/dist/cdn/chunks/{fr-Mdi4AlCR.js.map → fr-9SWy_n9K.js.map} +1 -1
- package/dist/cdn/chunks/{icons-DIwxXaHv.js → icons-DWBJnZvW.js} +1134 -1041
- package/dist/cdn/chunks/icons-DWBJnZvW.js.map +1 -0
- package/dist/{nl-D-6hT8te.js → cdn/chunks/nl-DJasgSvI.js} +11 -0
- package/dist/cdn/chunks/{nl-D-6hT8te.js.map → nl-DJasgSvI.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +10 -1
- package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js.map → pt-BR-BtCfbqSj.js.map} +1 -1
- package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js +535 -0
- package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js.map +1 -0
- package/dist/cdn/media-library.css +1 -1
- package/dist/cdn/media-library.js +1422 -5260
- package/dist/cdn/media-library.js.map +1 -1
- package/dist/{de-D5ebAV5i.js → de-BNbyJubD.js} +9 -0
- package/dist/en-CQxhpwqd.js +99 -0
- package/dist/{es-BG--QNW0.js → es-B2EH-TdJ.js} +9 -0
- package/dist/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/{cdn/chunks/nl-D-6hT8te.js → nl-DJasgSvI.js} +9 -2
- package/dist/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +9 -0
- package/dist/templatical-media-library.css +1 -1
- package/dist/templatical-media-library.js +1320 -1931
- package/dist/useFocusTrap-6eIRXtCA.js +111 -0
- package/package.json +2 -2
- package/dist/cdn/chunks/icons-DIwxXaHv.js.map +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { t as e } from "./en-CQxhpwqd.js";
|
|
2
|
+
import { computed as t, inject as n, isRef as r, onScopeDispose as i, watch as a } from "vue";
|
|
3
|
+
import { useEventListener as o } from "@vueuse/core";
|
|
4
|
+
//#region src/keys.ts
|
|
5
|
+
var s = Symbol("templaticalMediaLimits"), c = Symbol("templaticalMediaPopoverTarget"), l = Symbol("templaticalMediaTranslations"), u = Symbol("templaticalMediaUiTheme"), d = Symbol("templaticalMediaUiLocale");
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/composables/useI18n.ts
|
|
8
|
+
function f(t) {
|
|
9
|
+
let i = t ?? n(l, null), a = (r(i) ? i.value : i) ?? e;
|
|
10
|
+
function o(e, t) {
|
|
11
|
+
return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
t: a,
|
|
15
|
+
format: o
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/composables/useMediaCategories.ts
|
|
20
|
+
var p = [
|
|
21
|
+
"images",
|
|
22
|
+
"documents",
|
|
23
|
+
"videos",
|
|
24
|
+
"audio"
|
|
25
|
+
];
|
|
26
|
+
function m(e) {
|
|
27
|
+
let r = e ?? n(s, null);
|
|
28
|
+
if (!r) throw Error("[Templatical] useMediaCategories() needs media limits in scope. Render it under <MediaLibraryModal> or provide MEDIA_LIMITS_KEY yourself.");
|
|
29
|
+
let i = r, a = t(() => !0), o = t(() => i.maxFileSize ?? Infinity), c = t(() => {
|
|
30
|
+
let e = i.accept;
|
|
31
|
+
if (e && e.length > 0) return e;
|
|
32
|
+
let t = i.mimeTypes;
|
|
33
|
+
return t ? Object.keys(t) : p;
|
|
34
|
+
}), l = t(() => {
|
|
35
|
+
let e = i.mimeTypes;
|
|
36
|
+
return e ? c.value.flatMap((t) => e[t] ?? []) : [];
|
|
37
|
+
}), u = t(() => l.value.join(","));
|
|
38
|
+
function d(e, t) {
|
|
39
|
+
let n = i.mimeTypes;
|
|
40
|
+
return !n || (t && t.length > 0 ? t : Object.keys(n)).some((t) => n[t]?.includes(e) ?? !1);
|
|
41
|
+
}
|
|
42
|
+
function f(e) {
|
|
43
|
+
return d(e.type) && e.size <= o.value;
|
|
44
|
+
}
|
|
45
|
+
function m(e) {
|
|
46
|
+
let t = i.mimeTypes;
|
|
47
|
+
return t ? t.images?.includes(e) ?? !1 : e.startsWith("image/");
|
|
48
|
+
}
|
|
49
|
+
function h(e) {
|
|
50
|
+
let t = i.mimeTypes;
|
|
51
|
+
if (!t) return null;
|
|
52
|
+
for (let [n, r] of Object.entries(t)) if (r?.includes(e)) return n;
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
isMediaLibraryEnabled: a,
|
|
57
|
+
allAcceptedMimeTypes: l,
|
|
58
|
+
allAcceptedInputString: u,
|
|
59
|
+
maxFileSize: o,
|
|
60
|
+
availableCategories: c,
|
|
61
|
+
isAcceptedMimeType: d,
|
|
62
|
+
isAcceptedFile: f,
|
|
63
|
+
isImageMimeType: m,
|
|
64
|
+
getCategoryForMimeType: h
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region \0plugin-vue:export-helper
|
|
69
|
+
var h = (e, t) => {
|
|
70
|
+
let n = e.__vccOpts || e;
|
|
71
|
+
for (let [e, r] of t) n[e] = r;
|
|
72
|
+
return n;
|
|
73
|
+
}, g = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
74
|
+
function _(e, t) {
|
|
75
|
+
let n = null, r = null, s = null;
|
|
76
|
+
function c(e) {
|
|
77
|
+
if (!e) return document;
|
|
78
|
+
let t = e.getRootNode();
|
|
79
|
+
return t && "activeElement" in t ? t : document;
|
|
80
|
+
}
|
|
81
|
+
function l() {
|
|
82
|
+
return e.value ? Array.from(e.value.querySelectorAll(g)).filter((e) => e.offsetParent !== null) : [];
|
|
83
|
+
}
|
|
84
|
+
function u(t) {
|
|
85
|
+
if (t.key !== "Tab") return;
|
|
86
|
+
let n = l();
|
|
87
|
+
if (n.length === 0) return;
|
|
88
|
+
let r = n[0], i = n[n.length - 1], a = c(e.value).activeElement;
|
|
89
|
+
t.shiftKey ? a === r && (t.preventDefault(), i.focus()) : a === i && (t.preventDefault(), r.focus());
|
|
90
|
+
}
|
|
91
|
+
function d() {
|
|
92
|
+
let t = r !== null || s !== null;
|
|
93
|
+
t && f({ restoreFocus: !1 }), t || (n = c(e.value).activeElement), s = requestAnimationFrame(() => {
|
|
94
|
+
s = null;
|
|
95
|
+
let t = l();
|
|
96
|
+
t.length > 0 && (e.value?.querySelector("[autofocus], input:not([disabled])") ?? t[0]).focus();
|
|
97
|
+
}), r = o(e, "keydown", u);
|
|
98
|
+
}
|
|
99
|
+
function f(e = {}) {
|
|
100
|
+
let t = e.restoreFocus !== !1;
|
|
101
|
+
s !== null && (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(s), s = null), r?.(), r = null, t && n && n.focus && (n.focus(), n = null);
|
|
102
|
+
}
|
|
103
|
+
let p = a([t, e], ([e, t]) => {
|
|
104
|
+
e && t ? d() : f();
|
|
105
|
+
}, { flush: "post" });
|
|
106
|
+
i(() => {
|
|
107
|
+
p(), f();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { s as a, d as c, f as i, u as l, h as n, c as o, m as r, l as s, _ as t };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@templatical/media-library",
|
|
3
3
|
"description": "Media library management for Templatical email editor",
|
|
4
|
-
"version": "0.39.
|
|
4
|
+
"version": "0.39.2",
|
|
5
5
|
"bugs": "https://github.com/templatical/sdk/issues",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@lucide/vue": "^1.47.0",
|
|
8
|
-
"@templatical/types": "0.39.
|
|
8
|
+
"@templatical/types": "0.39.2",
|
|
9
9
|
"@vueuse/core": "^15.0.0",
|
|
10
10
|
"vue-advanced-cropper": "^2.8.9"
|
|
11
11
|
},
|