@templatical/media-library 0.39.0 → 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.
Files changed (38) hide show
  1. package/README.md +2 -3
  2. package/dist/MediaEditModal-DltAfTVH.js +311 -0
  3. package/dist/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +9 -0
  4. package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js +3528 -0
  5. package/dist/cdn/chunks/MediaEditModal-CeKcr-C0.js.map +1 -0
  6. package/dist/cdn/chunks/{ca-CGf3MuE2.js → ca-B1Ig3u8O.js} +10 -1
  7. package/dist/cdn/chunks/{ca-CGf3MuE2.js.map → ca-B1Ig3u8O.js.map} +1 -1
  8. package/dist/cdn/chunks/{de-D5ebAV5i.js → de-BNbyJubD.js} +10 -1
  9. package/dist/cdn/chunks/{de-D5ebAV5i.js.map → de-BNbyJubD.js.map} +1 -1
  10. package/dist/cdn/chunks/en-CQxhpwqd.js +101 -0
  11. package/dist/cdn/chunks/en-CQxhpwqd.js.map +1 -0
  12. package/dist/cdn/chunks/{es-BG--QNW0.js → es-B2EH-TdJ.js} +10 -1
  13. package/dist/cdn/chunks/{es-BG--QNW0.js.map → es-B2EH-TdJ.js.map} +1 -1
  14. package/dist/cdn/chunks/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +10 -1
  15. package/dist/cdn/chunks/{fr-Mdi4AlCR.js.map → fr-9SWy_n9K.js.map} +1 -1
  16. package/dist/cdn/chunks/{icons-DJG-T8pC.js → icons-DWBJnZvW.js} +1132 -1032
  17. package/dist/cdn/chunks/icons-DWBJnZvW.js.map +1 -0
  18. package/dist/{nl-D-6hT8te.js → cdn/chunks/nl-DJasgSvI.js} +11 -0
  19. package/dist/cdn/chunks/{nl-D-6hT8te.js.map → nl-DJasgSvI.js.map} +1 -1
  20. package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +10 -1
  21. package/dist/cdn/chunks/{pt-BR-DMfAgDWi.js.map → pt-BR-BtCfbqSj.js.map} +1 -1
  22. package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js +535 -0
  23. package/dist/cdn/chunks/useFocusTrap-tWtljvAm.js.map +1 -0
  24. package/dist/cdn/media-library.css +1 -1
  25. package/dist/cdn/media-library.js +1422 -5258
  26. package/dist/cdn/media-library.js.map +1 -1
  27. package/dist/{de-D5ebAV5i.js → de-BNbyJubD.js} +9 -0
  28. package/dist/en-CQxhpwqd.js +99 -0
  29. package/dist/{es-BG--QNW0.js → es-B2EH-TdJ.js} +9 -0
  30. package/dist/{fr-Mdi4AlCR.js → fr-9SWy_n9K.js} +9 -0
  31. package/dist/index.d.ts +9 -0
  32. package/dist/{cdn/chunks/nl-D-6hT8te.js → nl-DJasgSvI.js} +9 -2
  33. package/dist/{pt-BR-DMfAgDWi.js → pt-BR-BtCfbqSj.js} +9 -0
  34. package/dist/templatical-media-library.css +1 -1
  35. package/dist/templatical-media-library.js +1320 -1931
  36. package/dist/useFocusTrap-6eIRXtCA.js +111 -0
  37. package/package.json +9 -9
  38. package/dist/cdn/chunks/icons-DJG-T8pC.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,22 +1,22 @@
1
1
  {
2
2
  "name": "@templatical/media-library",
3
3
  "description": "Media library management for Templatical email editor",
4
- "version": "0.39.0",
4
+ "version": "0.39.2",
5
5
  "bugs": "https://github.com/templatical/sdk/issues",
6
6
  "dependencies": {
7
- "@lucide/vue": "^1.45.0",
8
- "@templatical/types": "0.39.0",
9
- "@vueuse/core": "^14.4.0",
7
+ "@lucide/vue": "^1.47.0",
8
+ "@templatical/types": "0.39.2",
9
+ "@vueuse/core": "^15.0.0",
10
10
  "vue-advanced-cropper": "^2.8.9"
11
11
  },
12
12
  "devDependencies": {
13
- "@vitejs/plugin-vue": "^6.0.8",
14
- "@vue/test-utils": "^2.5.0",
13
+ "@vitejs/plugin-vue": "^6.0.9",
14
+ "@vue/test-utils": "^2.5.1",
15
15
  "tailwindcss": "^4.3.3",
16
16
  "typescript": "^6.0.3",
17
17
  "vite": "^8.3.0",
18
- "vitest": "^5.0.0",
19
- "vue": "^3.5.42",
18
+ "vitest": "^5.0.1",
19
+ "vue": "^3.5.43",
20
20
  "vue-tsc": "^3.3.11"
21
21
  },
22
22
  "exports": {
@@ -41,7 +41,7 @@
41
41
  "license": "FSL-1.1-MIT",
42
42
  "module": "./dist/templatical-media-library.js",
43
43
  "peerDependencies": {
44
- "vue": "^3.5.42"
44
+ "vue": "^3.5.43"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"