@templatical/media-library 0.35.0 → 0.36.0
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/README.md +38 -24
- package/dist/{ca-DnghH5Xn.js → ca-CGf3MuE2.js} +1 -5
- package/dist/cdn/chunks/{ca-DnghH5Xn.js → ca-CGf3MuE2.js} +2 -6
- package/dist/cdn/chunks/ca-CGf3MuE2.js.map +1 -0
- package/dist/{de-ByQyu2jv.js → cdn/chunks/de-D5ebAV5i.js} +3 -5
- package/dist/cdn/chunks/de-D5ebAV5i.js.map +1 -0
- package/dist/{es-Bcp-DbmC.js → cdn/chunks/es-BG--QNW0.js} +3 -5
- package/dist/cdn/chunks/es-BG--QNW0.js.map +1 -0
- package/dist/{fr-DXb0cCZG.js → cdn/chunks/fr-Mdi4AlCR.js} +3 -5
- package/dist/cdn/chunks/fr-Mdi4AlCR.js.map +1 -0
- package/dist/cdn/chunks/{icons-Ds4F8sQq.js → icons-DMM4tyQd.js} +1149 -1104
- package/dist/cdn/chunks/{icons-Ds4F8sQq.js.map → icons-DMM4tyQd.js.map} +1 -1
- package/dist/{nl-DGT1t3Be.js → cdn/chunks/nl-D-6hT8te.js} +3 -5
- package/dist/cdn/chunks/nl-D-6hT8te.js.map +1 -0
- package/dist/{pt-BR-C0Hzc26R.js → cdn/chunks/pt-BR-DMfAgDWi.js} +3 -5
- package/dist/cdn/chunks/pt-BR-DMfAgDWi.js.map +1 -0
- package/dist/cdn/media-library.css +1 -1
- package/dist/cdn/media-library.js +1456 -1844
- package/dist/cdn/media-library.js.map +1 -1
- package/dist/{cdn/chunks/de-ByQyu2jv.js → de-D5ebAV5i.js} +1 -7
- package/dist/{cdn/chunks/es-Bcp-DbmC.js → es-BG--QNW0.js} +1 -7
- package/dist/{cdn/chunks/fr-DXb0cCZG.js → fr-Mdi4AlCR.js} +1 -7
- package/dist/index.d.ts +103 -160
- package/dist/{cdn/chunks/nl-DGT1t3Be.js → nl-D-6hT8te.js} +1 -7
- package/dist/{cdn/chunks/pt-BR-C0Hzc26R.js → pt-BR-DMfAgDWi.js} +1 -7
- package/dist/templatical-media-library.css +1 -1
- package/dist/templatical-media-library.js +1513 -1475
- package/package.json +4 -5
- package/dist/cdn/chunks/ca-DnghH5Xn.js.map +0 -1
- package/dist/cdn/chunks/de-ByQyu2jv.js.map +0 -1
- package/dist/cdn/chunks/es-Bcp-DbmC.js.map +0 -1
- package/dist/cdn/chunks/fr-DXb0cCZG.js.map +0 -1
- package/dist/cdn/chunks/nl-DGT1t3Be.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-C0Hzc26R.js.map +0 -1
|
@@ -1,267 +1,136 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Check as I, ChevronRight as L, Copy as R, File as z, Folder as B, Grid2x2 as V, Link as H, List as U, LoaderCircle as W, PanelLeft as G, Pencil as K, Plus as q, RefreshCw as J, Search as Y, Star as ee, Trash2 as X, Upload as te, X as ne } from "@lucide/vue";
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, inject as p, isRef as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, provide as y, ref as b, renderList as x, resolveComponent as S, toDisplayString as C, toRef as w, toValue as T, unref as E, vModelText as D, watch as O, withCtx as k, withDirectives as A, withKeys as j, withModifiers as M } from "vue";
|
|
2
|
+
import { Check as N, ChevronRight as P, Copy as F, File as I, Folder as L, Grid2x2 as R, Link as z, List as B, LoaderCircle as V, PanelLeft as H, Pencil as U, Plus as W, RefreshCw as G, Search as ee, Star as K, Trash2 as te, Upload as q, X as ne } from "@lucide/vue";
|
|
4
3
|
import { Cropper as re } from "vue-advanced-cropper";
|
|
5
|
-
import { onClickOutside as
|
|
4
|
+
import { onClickOutside as J, useClipboard as Y, useDebounceFn as ie, useDropZone as ae, useEventListener as oe, useFileDialog as se, useIntersectionObserver as X } from "@vueuse/core";
|
|
6
5
|
//#region \0rolldown/runtime.js
|
|
7
|
-
var
|
|
6
|
+
var ce = Object.defineProperty, le = (e, t) => {
|
|
8
7
|
let n = {};
|
|
9
|
-
for (var r in e)
|
|
8
|
+
for (var r in e) ce(n, r, {
|
|
10
9
|
get: e[r],
|
|
11
10
|
enumerable: !0
|
|
12
11
|
});
|
|
13
|
-
return t ||
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
get baseParams() {
|
|
26
|
-
return {
|
|
27
|
-
project: this.projectId,
|
|
28
|
-
tenant: this.tenantSlug
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
async request(e, t = {}) {
|
|
32
|
-
let n = await this.authManager.authenticatedFetch(e, {
|
|
33
|
-
...t,
|
|
34
|
-
headers: {
|
|
35
|
-
"Content-Type": "application/json",
|
|
36
|
-
Accept: "application/json",
|
|
37
|
-
...t.headers
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
if (!n.ok) {
|
|
41
|
-
let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` }));
|
|
42
|
-
throw Error(e.message, { cause: e });
|
|
43
|
-
}
|
|
44
|
-
if (n.status !== 204) return (await n.json()).data;
|
|
45
|
-
}
|
|
46
|
-
async browseMedia(t) {
|
|
47
|
-
let r = new URLSearchParams();
|
|
48
|
-
t.folder_id && r.set("folder_id", t.folder_id), t.search && r.set("search", t.search), t.category && r.set("category", t.category), t.sort && r.set("sort", t.sort), t.cursor && r.set("cursor", t.cursor);
|
|
49
|
-
let i = r.toString(), a = `${n(e["media.browse"], this.baseParams)}${i ? `?${i}` : ""}`, o = await this.authManager.authenticatedFetch(a, { headers: { Accept: "application/json" } });
|
|
50
|
-
if (!o.ok) {
|
|
51
|
-
let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
|
|
52
|
-
throw Error(e.message, { cause: e });
|
|
53
|
-
}
|
|
54
|
-
return o.json();
|
|
55
|
-
}
|
|
56
|
-
async uploadMedia(t, r) {
|
|
57
|
-
let i = new FormData();
|
|
58
|
-
i.append("file", t), r && i.append("folder_id", r);
|
|
59
|
-
let a = n(e["media.upload"], this.baseParams), o = await this.authManager.authenticatedFetch(a, {
|
|
60
|
-
method: "POST",
|
|
61
|
-
headers: { Accept: "application/json" },
|
|
62
|
-
body: i
|
|
63
|
-
});
|
|
64
|
-
if (!o.ok) {
|
|
65
|
-
let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
|
|
66
|
-
throw Error(e.message, { cause: e });
|
|
67
|
-
}
|
|
68
|
-
return (await o.json()).data;
|
|
69
|
-
}
|
|
70
|
-
async updateMedia(t, r, i) {
|
|
71
|
-
return this.request(n(e["media.update"], {
|
|
72
|
-
...this.baseParams,
|
|
73
|
-
media: t
|
|
74
|
-
}), {
|
|
75
|
-
method: "PUT",
|
|
76
|
-
body: JSON.stringify({
|
|
77
|
-
filename: r,
|
|
78
|
-
alt_text: i
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
async deleteMedia(t) {
|
|
83
|
-
return this.request(n(e["media.delete"], this.baseParams), {
|
|
84
|
-
method: "POST",
|
|
85
|
-
body: JSON.stringify({ ids: t })
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async moveMedia(t, r) {
|
|
89
|
-
return this.request(n(e["media.move"], this.baseParams), {
|
|
90
|
-
method: "POST",
|
|
91
|
-
body: JSON.stringify({
|
|
92
|
-
ids: t,
|
|
93
|
-
folder_id: r
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
async getMediaFolders() {
|
|
98
|
-
return this.request(n(e["folders.index"], this.baseParams));
|
|
99
|
-
}
|
|
100
|
-
async createMediaFolder(t, r) {
|
|
101
|
-
return this.request(n(e["folders.store"], this.baseParams), {
|
|
102
|
-
method: "POST",
|
|
103
|
-
body: JSON.stringify({
|
|
104
|
-
name: t,
|
|
105
|
-
parent_id: r ?? null
|
|
106
|
-
})
|
|
107
|
-
});
|
|
12
|
+
return t || ce(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/composable.ts
|
|
16
|
+
function ue(e) {
|
|
17
|
+
let { provider: t } = e, n = b([]), r = b([]), i = b(null), a = b("files"), o = b(""), s = b(null), c = b("newest"), l = b(!1), u = b(!1), d = b(!1), f = b(null), p = b(null), m = b(/* @__PURE__ */ new Set()), h = b(null), g = b([]), _ = b({}), v = b(!1), y = b([]), x = b(!1), S = b(null), C = b(!1), w = b(null), E = b(!1), D = b(null), O = b(null), k = b(null), A = 0;
|
|
18
|
+
function j(t) {
|
|
19
|
+
try {
|
|
20
|
+
t();
|
|
21
|
+
} catch (t) {
|
|
22
|
+
e.onError?.(t);
|
|
23
|
+
}
|
|
108
24
|
}
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
-
...this.baseParams,
|
|
112
|
-
mediaFolder: t
|
|
113
|
-
}), {
|
|
114
|
-
method: "PUT",
|
|
115
|
-
body: JSON.stringify({ name: r })
|
|
116
|
-
});
|
|
25
|
+
function M() {
|
|
26
|
+
return t.folders === !1 ? null : t.folders;
|
|
117
27
|
}
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
...this.baseParams,
|
|
121
|
-
mediaFolder: t
|
|
122
|
-
}), { method: "DELETE" });
|
|
123
|
-
}
|
|
124
|
-
async checkMediaUsage(t) {
|
|
125
|
-
let r = await this.authManager.authenticatedFetch(n(e["media.checkUsage"], this.baseParams), {
|
|
126
|
-
method: "POST",
|
|
127
|
-
headers: {
|
|
128
|
-
"Content-Type": "application/json",
|
|
129
|
-
Accept: "application/json"
|
|
130
|
-
},
|
|
131
|
-
body: JSON.stringify({ ids: t })
|
|
132
|
-
});
|
|
133
|
-
if (!r.ok) {
|
|
134
|
-
let e = await r.json().catch(() => ({ message: `HTTP error ${r.status}` }));
|
|
135
|
-
throw Error(e.message, { cause: e });
|
|
136
|
-
}
|
|
137
|
-
return r.json();
|
|
138
|
-
}
|
|
139
|
-
async getFrequentlyUsed() {
|
|
140
|
-
return this.request(n(e["media.frequentlyUsed"], this.baseParams));
|
|
141
|
-
}
|
|
142
|
-
async importFromUrl(t, r) {
|
|
143
|
-
return this.request(n(e["media.importFromUrl"], this.baseParams), {
|
|
144
|
-
method: "POST",
|
|
145
|
-
body: JSON.stringify({
|
|
146
|
-
url: t,
|
|
147
|
-
folder_id: r ?? null
|
|
148
|
-
})
|
|
149
|
-
});
|
|
28
|
+
function N() {
|
|
29
|
+
return T(e.templateId);
|
|
150
30
|
}
|
|
151
|
-
|
|
152
|
-
let
|
|
153
|
-
i.
|
|
154
|
-
let
|
|
155
|
-
|
|
156
|
-
media: t
|
|
157
|
-
}), o = await this.authManager.authenticatedFetch(a, {
|
|
158
|
-
method: "POST",
|
|
159
|
-
headers: { Accept: "application/json" },
|
|
160
|
-
body: i
|
|
161
|
-
});
|
|
162
|
-
if (!o.ok) {
|
|
163
|
-
let e = await o.json().catch(() => ({ message: `HTTP error ${o.status}` }));
|
|
164
|
-
throw Error(e.message, { cause: e });
|
|
165
|
-
}
|
|
166
|
-
return (await o.json()).data;
|
|
31
|
+
function P(e) {
|
|
32
|
+
let t = {};
|
|
33
|
+
o.value ? t.search = o.value : i.value != null && (t.folderId = i.value), s.value && (t.category = s.value), e && (t.cursor = e);
|
|
34
|
+
let n = N();
|
|
35
|
+
return n && (t.templateId = n), t;
|
|
167
36
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
//#region src/composable.ts
|
|
171
|
-
function me(e) {
|
|
172
|
-
if (!e.projectId) throw Error("projectId is required for useMediaLibrary");
|
|
173
|
-
let t = new pe(e.authManager), n = w([]), r = w([]), i = w(null), a = w("files"), o = w(""), s = w(null), c = w("newest"), l = w(!1), u = w(!1), d = w(!1), f = w(null), p = w(null), m = w(/* @__PURE__ */ new Set()), h = w(null), g = w([]), _ = w({}), v = w(!1), y = w([]), b = w(!1), x = w(null), S = w(!1), C = w(null), T = w(!1), E = w(null), D = w(null), O = 0;
|
|
174
|
-
async function k() {
|
|
175
|
-
let r = ++O;
|
|
37
|
+
async function F() {
|
|
38
|
+
let r = ++A;
|
|
176
39
|
l.value = !0;
|
|
40
|
+
let i = P();
|
|
177
41
|
try {
|
|
178
|
-
let e = await t.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
category: s.value || void 0,
|
|
182
|
-
sort: c.value === "newest" ? void 0 : c.value
|
|
183
|
-
});
|
|
184
|
-
if (r !== O) return;
|
|
185
|
-
n.value = e.data, f.value = e.meta.next_cursor, d.value = !!e.meta.next_cursor;
|
|
42
|
+
let e = await t.list(i);
|
|
43
|
+
if (r !== A) return;
|
|
44
|
+
n.value = e.items, f.value = e.nextCursor ?? null, d.value = !!e.nextCursor;
|
|
186
45
|
} catch (t) {
|
|
187
|
-
if (r !==
|
|
46
|
+
if (r !== A) return;
|
|
188
47
|
e.onError?.(t);
|
|
189
48
|
} finally {
|
|
190
|
-
r ===
|
|
49
|
+
r === A && (l.value = !1);
|
|
191
50
|
}
|
|
192
51
|
}
|
|
193
|
-
async function
|
|
52
|
+
async function I() {
|
|
194
53
|
if (!d.value || !f.value || l.value) return;
|
|
195
|
-
let r = ++
|
|
54
|
+
let r = ++A;
|
|
196
55
|
l.value = !0;
|
|
56
|
+
let i = P(f.value);
|
|
197
57
|
try {
|
|
198
|
-
let e = await t.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
category: s.value || void 0,
|
|
202
|
-
sort: c.value === "newest" ? void 0 : c.value,
|
|
203
|
-
cursor: f.value
|
|
204
|
-
});
|
|
205
|
-
if (r !== O) return;
|
|
206
|
-
n.value = [...n.value, ...e.data], f.value = e.meta.next_cursor, d.value = !!e.meta.next_cursor;
|
|
58
|
+
let e = await t.list(i);
|
|
59
|
+
if (r !== A) return;
|
|
60
|
+
n.value = [...n.value, ...e.items], f.value = e.nextCursor ?? null, d.value = !!e.nextCursor;
|
|
207
61
|
} catch (t) {
|
|
208
|
-
if (r !==
|
|
62
|
+
if (r !== A) return;
|
|
209
63
|
e.onError?.(t);
|
|
210
64
|
} finally {
|
|
211
|
-
r ===
|
|
65
|
+
r === A && (l.value = !1);
|
|
212
66
|
}
|
|
213
67
|
}
|
|
214
|
-
async function
|
|
215
|
-
o.value = e, await
|
|
68
|
+
async function L(e) {
|
|
69
|
+
o.value = e, await F();
|
|
216
70
|
}
|
|
217
|
-
async function
|
|
218
|
-
s.value = e, await
|
|
71
|
+
async function R(e) {
|
|
72
|
+
s.value = e, await F();
|
|
219
73
|
}
|
|
220
|
-
async function
|
|
221
|
-
c.value = e, await
|
|
74
|
+
async function z(e) {
|
|
75
|
+
c.value = e, await F();
|
|
222
76
|
}
|
|
223
|
-
async function
|
|
224
|
-
a.value = "files", i.value = e, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await
|
|
77
|
+
async function B(e) {
|
|
78
|
+
a.value = "files", i.value = e, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await F();
|
|
225
79
|
}
|
|
226
|
-
async function
|
|
227
|
-
a.value = "frequently-used", i.value = null, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await
|
|
80
|
+
async function V() {
|
|
81
|
+
a.value = "frequently-used", i.value = null, o.value = "", m.value = /* @__PURE__ */ new Set(), h.value = null, await q();
|
|
228
82
|
}
|
|
229
|
-
async function
|
|
83
|
+
async function H(r) {
|
|
84
|
+
let { create: a } = t;
|
|
85
|
+
if (typeof a != "function") return null;
|
|
230
86
|
u.value = !0;
|
|
231
87
|
try {
|
|
232
|
-
let e =
|
|
233
|
-
|
|
88
|
+
let e = { file: r };
|
|
89
|
+
i.value != null && (e.folderId = i.value);
|
|
90
|
+
let o = N();
|
|
91
|
+
o && (e.templateId = o);
|
|
92
|
+
let s = await a(e);
|
|
93
|
+
return n.value = [s, ...n.value], j(() => t.onCreated?.(s)), s;
|
|
234
94
|
} catch (t) {
|
|
235
95
|
return e.onError?.(t), null;
|
|
236
96
|
} finally {
|
|
237
97
|
u.value = !1;
|
|
238
98
|
}
|
|
239
99
|
}
|
|
240
|
-
async function
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
100
|
+
async function U(r) {
|
|
101
|
+
let { create: a } = t;
|
|
102
|
+
if (typeof a == "function") {
|
|
103
|
+
u.value = !0, p.value = {
|
|
104
|
+
current: 0,
|
|
105
|
+
total: r.length
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
for (let o = 0; o < r.length; o++) {
|
|
109
|
+
p.value = {
|
|
110
|
+
current: o + 1,
|
|
111
|
+
total: r.length
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
let e = { file: r[o] };
|
|
115
|
+
i.value != null && (e.folderId = i.value);
|
|
116
|
+
let s = N();
|
|
117
|
+
s && (e.templateId = s);
|
|
118
|
+
let c = await a(e);
|
|
119
|
+
n.value = [c, ...n.value], j(() => t.onCreated?.(c));
|
|
120
|
+
} catch (t) {
|
|
121
|
+
e.onError?.(t);
|
|
122
|
+
}
|
|
256
123
|
}
|
|
124
|
+
} finally {
|
|
125
|
+
u.value = !1, p.value = null;
|
|
257
126
|
}
|
|
258
|
-
} finally {
|
|
259
|
-
u.value = !1, p.value = null;
|
|
260
127
|
}
|
|
261
128
|
}
|
|
262
|
-
async function
|
|
263
|
-
if (m.value.size
|
|
264
|
-
|
|
129
|
+
async function W(t) {
|
|
130
|
+
if (m.value.size === 0) return;
|
|
131
|
+
let { move: r } = M() ?? { move: !1 };
|
|
132
|
+
if (typeof r == "function") try {
|
|
133
|
+
let e = await r([...m.value], t);
|
|
265
134
|
if (i.value === null) {
|
|
266
135
|
let t = new Map(e.map((e) => [e.id, e]));
|
|
267
136
|
n.value = n.value.map((e) => t.get(e.id) ?? e);
|
|
@@ -271,139 +140,189 @@ function me(e) {
|
|
|
271
140
|
e.onError?.(t);
|
|
272
141
|
}
|
|
273
142
|
}
|
|
274
|
-
async function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
143
|
+
async function G(r, i, a) {
|
|
144
|
+
let { update: o } = t;
|
|
145
|
+
if (typeof o == "function") try {
|
|
146
|
+
let e = { filename: i };
|
|
147
|
+
a !== void 0 && (e.alt = a);
|
|
148
|
+
let s = await o(r, e);
|
|
149
|
+
n.value = n.value.map((e) => e.id === r ? s : e), h.value?.id === r && (h.value = s), j(() => t.onUpdated?.(s));
|
|
278
150
|
} catch (t) {
|
|
279
151
|
e.onError?.(t);
|
|
280
152
|
}
|
|
281
153
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
154
|
+
function ee(e) {
|
|
155
|
+
let t = /* @__PURE__ */ new Map();
|
|
156
|
+
for (let r of n.value) e.includes(r.id) && t.set(r.id, r);
|
|
157
|
+
for (let n of g.value) e.includes(n.id) && !t.has(n.id) && t.set(n.id, n);
|
|
158
|
+
return [...t.values()];
|
|
159
|
+
}
|
|
160
|
+
function K(e) {
|
|
161
|
+
n.value = n.value.filter((t) => !e.includes(t.id)), g.value = g.value.filter((t) => !e.includes(t.id)), m.value = /* @__PURE__ */ new Set(), h.value = null;
|
|
162
|
+
}
|
|
163
|
+
async function te() {
|
|
164
|
+
if (m.value.size === 0) return;
|
|
165
|
+
let { delete: n } = t;
|
|
166
|
+
if (typeof n != "function") return;
|
|
167
|
+
let r = [...m.value], i = ee(r);
|
|
168
|
+
try {
|
|
169
|
+
await n(r), K(r);
|
|
170
|
+
for (let e of i) j(() => t.onDeleted?.(e));
|
|
285
171
|
} catch (t) {
|
|
286
172
|
e.onError?.(t);
|
|
287
173
|
}
|
|
288
174
|
}
|
|
289
|
-
async function
|
|
290
|
-
|
|
291
|
-
|
|
175
|
+
async function q() {
|
|
176
|
+
let { frequentlyUsed: n } = t;
|
|
177
|
+
if (typeof n == "function") try {
|
|
178
|
+
g.value = await n();
|
|
292
179
|
} catch (t) {
|
|
293
180
|
e.onError?.(t);
|
|
294
181
|
}
|
|
295
182
|
}
|
|
296
|
-
async function
|
|
183
|
+
async function ne() {
|
|
297
184
|
if (m.value.size === 0) return !1;
|
|
298
185
|
y.value = [...m.value];
|
|
186
|
+
let { checkUsage: n } = t;
|
|
187
|
+
if (typeof n != "function") return _.value = {}, v.value = !0, !1;
|
|
299
188
|
try {
|
|
300
|
-
let e = await
|
|
301
|
-
_.value = e
|
|
302
|
-
let
|
|
303
|
-
return v.value = !0,
|
|
189
|
+
let e = await n(y.value);
|
|
190
|
+
_.value = e;
|
|
191
|
+
let t = Object.values(e).some((e) => e.templateCount > 0);
|
|
192
|
+
return v.value = !0, t;
|
|
304
193
|
} catch (t) {
|
|
305
194
|
return e.onError?.(t), !1;
|
|
306
195
|
}
|
|
307
196
|
}
|
|
308
|
-
async function
|
|
309
|
-
|
|
310
|
-
|
|
197
|
+
async function re() {
|
|
198
|
+
let { delete: n } = t;
|
|
199
|
+
if (typeof n != "function" || (v.value = !1, y.value.length === 0)) return;
|
|
200
|
+
let r = y.value, i = ee(r);
|
|
201
|
+
try {
|
|
202
|
+
await n(r), K(r), y.value = [], _.value = {};
|
|
203
|
+
for (let e of i) j(() => t.onDeleted?.(e));
|
|
311
204
|
} catch (t) {
|
|
312
205
|
e.onError?.(t);
|
|
313
206
|
}
|
|
314
207
|
}
|
|
315
|
-
function
|
|
208
|
+
function J() {
|
|
316
209
|
v.value = !1, y.value = [], _.value = {};
|
|
317
210
|
}
|
|
318
|
-
async function
|
|
319
|
-
|
|
211
|
+
async function Y(r) {
|
|
212
|
+
let a = t.importFromUrl;
|
|
213
|
+
if (typeof a != "function") return null;
|
|
214
|
+
x.value = !0, S.value = null;
|
|
320
215
|
try {
|
|
321
|
-
let e = await
|
|
322
|
-
return n.value = [e, ...n.value], e;
|
|
216
|
+
let e = await a(r, i.value, N());
|
|
217
|
+
return n.value = [e, ...n.value], j(() => t.onCreated?.(e)), e;
|
|
323
218
|
} catch (t) {
|
|
324
|
-
return
|
|
219
|
+
return S.value = t instanceof Error ? t.message : "Import failed", e.onError?.(t), null;
|
|
325
220
|
} finally {
|
|
326
|
-
|
|
221
|
+
x.value = !1;
|
|
327
222
|
}
|
|
328
223
|
}
|
|
329
|
-
function
|
|
224
|
+
function ie(e) {
|
|
330
225
|
let t = new Set(m.value);
|
|
331
226
|
t.has(e) ? t.delete(e) : t.add(e), m.value = t;
|
|
332
227
|
}
|
|
333
|
-
function
|
|
228
|
+
function ae() {
|
|
334
229
|
m.value = /* @__PURE__ */ new Set(), h.value = null;
|
|
335
230
|
}
|
|
336
|
-
function
|
|
231
|
+
function oe(e) {
|
|
337
232
|
h.value = e, m.value = /* @__PURE__ */ new Set([e.id]);
|
|
338
233
|
}
|
|
339
|
-
async function
|
|
234
|
+
async function se() {
|
|
235
|
+
let { storage: n } = t;
|
|
236
|
+
if (typeof n != "function") {
|
|
237
|
+
k.value = null;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
340
240
|
try {
|
|
341
|
-
|
|
241
|
+
k.value = await n();
|
|
242
|
+
} catch (t) {
|
|
243
|
+
e.onError?.(t);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
async function X() {
|
|
247
|
+
let t = M();
|
|
248
|
+
if (t) try {
|
|
249
|
+
r.value = await t.list();
|
|
342
250
|
} catch (t) {
|
|
343
251
|
e.onError?.(t);
|
|
344
252
|
}
|
|
345
253
|
}
|
|
346
|
-
async function
|
|
254
|
+
async function ce(t, n) {
|
|
255
|
+
let { create: r } = M() ?? { create: !1 };
|
|
256
|
+
if (typeof r != "function") return null;
|
|
347
257
|
try {
|
|
348
|
-
let e =
|
|
349
|
-
|
|
258
|
+
let e = { name: t };
|
|
259
|
+
n !== void 0 && (e.parentId = n);
|
|
260
|
+
let i = await r(e);
|
|
261
|
+
return await X(), i;
|
|
350
262
|
} catch (t) {
|
|
351
263
|
return e.onError?.(t), null;
|
|
352
264
|
}
|
|
353
265
|
}
|
|
354
|
-
function
|
|
355
|
-
for (let n of e)
|
|
356
|
-
if (n.id === t) return n;
|
|
357
|
-
if (n.children) {
|
|
358
|
-
let e = X(n.children, t);
|
|
359
|
-
if (e) return e;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
266
|
+
function le(e, t) {
|
|
267
|
+
for (let n of e) if (n.id === t) return n;
|
|
362
268
|
return null;
|
|
363
269
|
}
|
|
364
|
-
async function
|
|
365
|
-
|
|
366
|
-
|
|
270
|
+
async function ue(t, n) {
|
|
271
|
+
let { update: r } = M() ?? { update: !1 };
|
|
272
|
+
if (typeof r == "function") try {
|
|
273
|
+
await r(t, { name: n }), await X();
|
|
367
274
|
} catch (t) {
|
|
368
275
|
e.onError?.(t);
|
|
369
276
|
}
|
|
370
277
|
}
|
|
371
|
-
async function
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
278
|
+
async function de(t) {
|
|
279
|
+
let { delete: n } = M() ?? { delete: !1 };
|
|
280
|
+
if (typeof n == "function") try {
|
|
281
|
+
let e = le(r.value, t)?.parentId ?? null;
|
|
282
|
+
await n(t), i.value === t && (i.value = e), await X(), await F();
|
|
375
283
|
} catch (t) {
|
|
376
284
|
e.onError?.(t);
|
|
377
285
|
}
|
|
378
286
|
}
|
|
379
|
-
async function
|
|
380
|
-
|
|
287
|
+
async function fe(n) {
|
|
288
|
+
D.value = n, w.value = null;
|
|
289
|
+
let { checkUsage: r } = t;
|
|
290
|
+
if (typeof r != "function") {
|
|
291
|
+
O.value = null, E.value = !0;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
381
294
|
try {
|
|
382
|
-
let e = await
|
|
383
|
-
|
|
295
|
+
let e = await r([n.id]);
|
|
296
|
+
O.value = e[n.id] ?? null, E.value = !0;
|
|
384
297
|
} catch (t) {
|
|
385
298
|
e.onError?.(t);
|
|
386
299
|
}
|
|
387
300
|
}
|
|
388
|
-
function
|
|
389
|
-
|
|
301
|
+
function pe() {
|
|
302
|
+
E.value = !1, D.value = null, O.value = null, w.value = null;
|
|
303
|
+
}
|
|
304
|
+
function Z(e) {
|
|
305
|
+
n.value = n.value.map((t) => t.id === e.id ? e : t), g.value = g.value.map((t) => t.id === e.id ? e : t), h.value?.id === e.id && (h.value = e), j(() => t.onUpdated?.(e));
|
|
390
306
|
}
|
|
391
|
-
async function
|
|
392
|
-
|
|
393
|
-
|
|
307
|
+
async function me(n) {
|
|
308
|
+
let { replace: r } = t;
|
|
309
|
+
if (typeof r != "function" || !D.value) return null;
|
|
310
|
+
C.value = !0, w.value = null;
|
|
394
311
|
try {
|
|
395
|
-
let e = await
|
|
396
|
-
return
|
|
312
|
+
let e = await r(D.value.id, n);
|
|
313
|
+
return Z(e), E.value = !1, D.value = null, O.value = null, e;
|
|
397
314
|
} catch (t) {
|
|
398
|
-
return
|
|
315
|
+
return w.value = t instanceof Error ? t.message : "Replace failed", e.onError?.(t), null;
|
|
399
316
|
} finally {
|
|
400
|
-
|
|
317
|
+
C.value = !1;
|
|
401
318
|
}
|
|
402
319
|
}
|
|
403
|
-
async function
|
|
320
|
+
async function he(n, r) {
|
|
321
|
+
let { replace: i } = t;
|
|
322
|
+
if (typeof i != "function") return null;
|
|
404
323
|
try {
|
|
405
|
-
let e = await
|
|
406
|
-
return
|
|
324
|
+
let e = await i(n, r);
|
|
325
|
+
return Z(e), e;
|
|
407
326
|
} catch (t) {
|
|
408
327
|
return e.onError?.(t), null;
|
|
409
328
|
}
|
|
@@ -425,47 +344,49 @@ function me(e) {
|
|
|
425
344
|
frequentlyUsedItems: g,
|
|
426
345
|
deleteUsageInfo: _,
|
|
427
346
|
showDeleteWarning: v,
|
|
428
|
-
loadItems:
|
|
429
|
-
loadMore:
|
|
430
|
-
search:
|
|
431
|
-
filterByCategory:
|
|
432
|
-
sortBy:
|
|
433
|
-
navigateToFolder:
|
|
434
|
-
showFrequentlyUsed:
|
|
435
|
-
uploadFile:
|
|
436
|
-
uploadFiles:
|
|
437
|
-
moveSelected:
|
|
438
|
-
updateFile:
|
|
439
|
-
deleteSelected:
|
|
440
|
-
isImportingFromUrl:
|
|
441
|
-
importFromUrlError:
|
|
442
|
-
importFromUrl:
|
|
443
|
-
toggleSelection:
|
|
444
|
-
clearSelection:
|
|
445
|
-
selectItem:
|
|
446
|
-
loadFolders:
|
|
447
|
-
createFolder:
|
|
448
|
-
renameFolder:
|
|
449
|
-
deleteFolder:
|
|
450
|
-
findFolderInTree:
|
|
451
|
-
loadFrequentlyUsed:
|
|
452
|
-
checkUsageBeforeDelete:
|
|
453
|
-
confirmDelete:
|
|
454
|
-
cancelDelete:
|
|
455
|
-
isReplacing:
|
|
456
|
-
replaceError:
|
|
457
|
-
showReplaceWarning:
|
|
458
|
-
pendingReplaceItem:
|
|
459
|
-
replaceUsageInfo:
|
|
460
|
-
checkUsageBeforeReplace:
|
|
461
|
-
cancelReplace:
|
|
462
|
-
replaceFile:
|
|
463
|
-
replaceMediaDirectly:
|
|
347
|
+
loadItems: F,
|
|
348
|
+
loadMore: I,
|
|
349
|
+
search: L,
|
|
350
|
+
filterByCategory: R,
|
|
351
|
+
sortBy: z,
|
|
352
|
+
navigateToFolder: B,
|
|
353
|
+
showFrequentlyUsed: V,
|
|
354
|
+
uploadFile: H,
|
|
355
|
+
uploadFiles: U,
|
|
356
|
+
moveSelected: W,
|
|
357
|
+
updateFile: G,
|
|
358
|
+
deleteSelected: te,
|
|
359
|
+
isImportingFromUrl: x,
|
|
360
|
+
importFromUrlError: S,
|
|
361
|
+
importFromUrl: Y,
|
|
362
|
+
toggleSelection: ie,
|
|
363
|
+
clearSelection: ae,
|
|
364
|
+
selectItem: oe,
|
|
365
|
+
loadFolders: X,
|
|
366
|
+
createFolder: ce,
|
|
367
|
+
renameFolder: ue,
|
|
368
|
+
deleteFolder: de,
|
|
369
|
+
findFolderInTree: le,
|
|
370
|
+
loadFrequentlyUsed: q,
|
|
371
|
+
checkUsageBeforeDelete: ne,
|
|
372
|
+
confirmDelete: re,
|
|
373
|
+
cancelDelete: J,
|
|
374
|
+
isReplacing: C,
|
|
375
|
+
replaceError: w,
|
|
376
|
+
showReplaceWarning: E,
|
|
377
|
+
pendingReplaceItem: D,
|
|
378
|
+
replaceUsageInfo: O,
|
|
379
|
+
checkUsageBeforeReplace: fe,
|
|
380
|
+
cancelReplace: pe,
|
|
381
|
+
replaceFile: me,
|
|
382
|
+
replaceMediaDirectly: he,
|
|
383
|
+
storageInfo: k,
|
|
384
|
+
loadStorage: se
|
|
464
385
|
};
|
|
465
386
|
}
|
|
466
387
|
//#endregion
|
|
467
388
|
//#region src/keys.ts
|
|
468
|
-
var
|
|
389
|
+
var de = Symbol("templaticalMediaLimits"), fe = Symbol("templaticalMediaPopoverTarget"), pe = Symbol("templaticalMediaTranslations"), Z = Symbol("templaticalMediaUiTheme"), me = Symbol("templaticalMediaUiLocale"), he = /* @__PURE__ */ le({ default: () => ge }), ge = { mediaLibrary: {
|
|
469
390
|
title: "Media Library",
|
|
470
391
|
searchPlaceholder: "Search files...",
|
|
471
392
|
allFiles: "All Files",
|
|
@@ -477,6 +398,7 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
|
|
|
477
398
|
newFolder: "New Folder",
|
|
478
399
|
folderName: "Folder name",
|
|
479
400
|
noFiles: "No files found",
|
|
401
|
+
noSearchResults: "No files match your search",
|
|
480
402
|
dropOrClick: "Drop files here or click to upload",
|
|
481
403
|
acceptedFormats: "Images, PDF, Video, Audio, Documents (max 10MB)",
|
|
482
404
|
uploading: "Uploading...",
|
|
@@ -522,11 +444,6 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
|
|
|
522
444
|
import: "Import",
|
|
523
445
|
importing: "Importing...",
|
|
524
446
|
importError: "Failed to import from URL",
|
|
525
|
-
conversionLabel: "Size",
|
|
526
|
-
conversionOriginal: "Original",
|
|
527
|
-
conversionSmall: "Small (150px)",
|
|
528
|
-
conversionMedium: "Medium (600px)",
|
|
529
|
-
conversionLarge: "Large (1200px)",
|
|
530
447
|
replaceFile: "Replace File",
|
|
531
448
|
replaceWarningTitle: "Replace File",
|
|
532
449
|
replaceWarningMessage: "You are about to replace this file. The replacement must have the same file extension ({extension}).",
|
|
@@ -551,8 +468,8 @@ var he = Symbol("templaticalMediaPlanConfig"), ge = Symbol("templaticalMediaPopo
|
|
|
551
468
|
} };
|
|
552
469
|
//#endregion
|
|
553
470
|
//#region src/composables/useI18n.ts
|
|
554
|
-
function
|
|
555
|
-
let t = e ??
|
|
471
|
+
function Q(e) {
|
|
472
|
+
let t = e ?? p(pe, null), n = (m(t) ? t.value : t) ?? ge;
|
|
556
473
|
function r(e, t) {
|
|
557
474
|
return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : `{${n}}`);
|
|
558
475
|
}
|
|
@@ -563,86 +480,104 @@ function Z(e) {
|
|
|
563
480
|
}
|
|
564
481
|
//#endregion
|
|
565
482
|
//#region src/components/media/MediaBreadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
566
|
-
var
|
|
483
|
+
var _e = {
|
|
567
484
|
key: 0,
|
|
568
485
|
class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
|
|
569
486
|
style: { color: "var(--tpl-text-muted)" }
|
|
570
|
-
},
|
|
487
|
+
}, ve = ["onClick"], ye = {
|
|
571
488
|
key: 1,
|
|
572
489
|
style: { color: "var(--tpl-text)" }
|
|
573
|
-
},
|
|
490
|
+
}, be = /* @__PURE__ */ d({
|
|
574
491
|
__name: "MediaBreadcrumb",
|
|
575
492
|
props: {
|
|
576
493
|
folders: {},
|
|
577
494
|
currentFolderId: {}
|
|
578
495
|
},
|
|
579
496
|
emits: ["navigate"],
|
|
580
|
-
setup(
|
|
581
|
-
let
|
|
582
|
-
if (!
|
|
497
|
+
setup(t, { emit: n }) {
|
|
498
|
+
let i = t, a = n, { t: l } = Q(), d = r(() => {
|
|
499
|
+
if (!i.currentFolderId) return [];
|
|
583
500
|
let e = [];
|
|
584
|
-
return
|
|
501
|
+
return f(i.folders, i.currentFolderId, e), e;
|
|
585
502
|
});
|
|
586
|
-
function
|
|
503
|
+
function f(e, t, n) {
|
|
587
504
|
for (let r of e) {
|
|
588
505
|
if (r.id === t) return n.push(r), !0;
|
|
589
|
-
if (
|
|
506
|
+
if (f(r.children, t, n)) return n.unshift(r), !0;
|
|
590
507
|
}
|
|
591
508
|
return !1;
|
|
592
509
|
}
|
|
593
|
-
return (
|
|
510
|
+
return (t, n) => d.value.length > 0 ? (v(), s("div", _e, [c("button", {
|
|
594
511
|
class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
|
|
595
512
|
style: { color: "var(--tpl-primary)" },
|
|
596
|
-
onClick:
|
|
597
|
-
},
|
|
513
|
+
onClick: n[0] ||= (e) => a("navigate", null)
|
|
514
|
+
}, C(E(l).mediaLibrary.allFiles), 1), (v(!0), s(e, null, x(d.value, (t, n) => (v(), s(e, { key: t.id }, [u(E(P), {
|
|
598
515
|
size: 12,
|
|
599
516
|
"stroke-width": 2
|
|
600
|
-
}),
|
|
517
|
+
}), n < d.value.length - 1 ? (v(), s("button", {
|
|
601
518
|
key: 0,
|
|
602
519
|
class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
|
|
603
520
|
style: { color: "var(--tpl-primary)" },
|
|
604
|
-
onClick: (
|
|
605
|
-
},
|
|
606
|
-
}
|
|
607
|
-
})
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
521
|
+
onClick: (e) => a("navigate", t.id)
|
|
522
|
+
}, C(t.name), 9, ve)) : (v(), s("span", ye, C(t.name), 1))], 64))), 128))])) : o("", !0);
|
|
523
|
+
}
|
|
524
|
+
}), xe = [
|
|
525
|
+
"images",
|
|
526
|
+
"documents",
|
|
527
|
+
"videos",
|
|
528
|
+
"audio"
|
|
529
|
+
];
|
|
530
|
+
function $(e) {
|
|
531
|
+
let t = e ?? p(de, null);
|
|
532
|
+
if (!t) throw Error("[Templatical] useMediaCategories() needs media limits in scope. Render it under <MediaLibraryModal> or provide MEDIA_LIMITS_KEY yourself.");
|
|
533
|
+
let n = t, i = r(() => !0), a = r(() => n.maxFileSize ?? Infinity), o = r(() => {
|
|
534
|
+
let e = n.accept;
|
|
535
|
+
if (e && e.length > 0) return e;
|
|
536
|
+
let t = n.mimeTypes;
|
|
537
|
+
return t ? Object.keys(t) : xe;
|
|
538
|
+
}), s = r(() => {
|
|
539
|
+
let e = n.mimeTypes;
|
|
540
|
+
return e ? o.value.flatMap((t) => e[t] ?? []) : [];
|
|
541
|
+
}), c = r(() => s.value.join(","));
|
|
614
542
|
function l(e, t) {
|
|
615
|
-
|
|
543
|
+
let r = n.mimeTypes;
|
|
544
|
+
return !r || (t && t.length > 0 ? t : Object.keys(r)).some((t) => r[t]?.includes(e) ?? !1);
|
|
616
545
|
}
|
|
617
546
|
function u(e) {
|
|
618
|
-
return
|
|
547
|
+
return l(e.type) && e.size <= a.value;
|
|
619
548
|
}
|
|
620
549
|
function d(e) {
|
|
621
|
-
|
|
622
|
-
|
|
550
|
+
let t = n.mimeTypes;
|
|
551
|
+
return t ? t.images?.includes(e) ?? !1 : e.startsWith("image/");
|
|
552
|
+
}
|
|
553
|
+
function f(e) {
|
|
554
|
+
let t = n.mimeTypes;
|
|
555
|
+
if (!t) return null;
|
|
556
|
+
for (let [n, r] of Object.entries(t)) if (r?.includes(e)) return n;
|
|
623
557
|
return null;
|
|
624
558
|
}
|
|
625
559
|
return {
|
|
626
|
-
isMediaLibraryEnabled:
|
|
627
|
-
allAcceptedMimeTypes:
|
|
628
|
-
allAcceptedInputString:
|
|
629
|
-
maxFileSize:
|
|
630
|
-
availableCategories:
|
|
560
|
+
isMediaLibraryEnabled: i,
|
|
561
|
+
allAcceptedMimeTypes: s,
|
|
562
|
+
allAcceptedInputString: c,
|
|
563
|
+
maxFileSize: a,
|
|
564
|
+
availableCategories: o,
|
|
631
565
|
isAcceptedMimeType: l,
|
|
632
|
-
|
|
633
|
-
|
|
566
|
+
isAcceptedFile: u,
|
|
567
|
+
isImageMimeType: d,
|
|
568
|
+
getCategoryForMimeType: f
|
|
634
569
|
};
|
|
635
570
|
}
|
|
636
571
|
//#endregion
|
|
637
572
|
//#region src/composables/useImageCrop.ts
|
|
638
|
-
var
|
|
573
|
+
var Se = {
|
|
639
574
|
free: void 0,
|
|
640
575
|
square: 1,
|
|
641
576
|
landscape43: 4 / 3,
|
|
642
577
|
landscape169: 16 / 9,
|
|
643
578
|
original: void 0
|
|
644
579
|
};
|
|
645
|
-
function
|
|
580
|
+
function Ce(e) {
|
|
646
581
|
return e === "image/png" || e === "image/gif" ? {
|
|
647
582
|
mimeType: "image/png",
|
|
648
583
|
quality: 1
|
|
@@ -654,7 +589,7 @@ function De(e) {
|
|
|
654
589
|
quality: .92
|
|
655
590
|
};
|
|
656
591
|
}
|
|
657
|
-
function
|
|
592
|
+
function we(e, t, n) {
|
|
658
593
|
let r = e.width, i = e.height;
|
|
659
594
|
if (!t && !n) return e;
|
|
660
595
|
let a = r, o = i;
|
|
@@ -668,7 +603,7 @@ function Oe(e, t, n) {
|
|
|
668
603
|
let c = s.getContext("2d");
|
|
669
604
|
return c && (c.imageSmoothingEnabled = !0, c.imageSmoothingQuality = "high", c.drawImage(e, 0, 0, a, o)), s;
|
|
670
605
|
}
|
|
671
|
-
function
|
|
606
|
+
function Te(e, t, n) {
|
|
672
607
|
return new Promise((r, i) => {
|
|
673
608
|
e.toBlob((e) => {
|
|
674
609
|
if (!e) {
|
|
@@ -680,7 +615,7 @@ function ke(e, t, n) {
|
|
|
680
615
|
}, n.mimeType, n.quality);
|
|
681
616
|
});
|
|
682
617
|
}
|
|
683
|
-
function
|
|
618
|
+
function Ee(e, t, n, r) {
|
|
684
619
|
let i = e, a = t;
|
|
685
620
|
if (n && i > n) {
|
|
686
621
|
let e = n / i;
|
|
@@ -697,101 +632,101 @@ function Ae(e, t, n, r) {
|
|
|
697
632
|
}
|
|
698
633
|
//#endregion
|
|
699
634
|
//#region src/components/media/MediaEditModal.vue?vue&type=script&setup=true&lang.ts
|
|
700
|
-
var
|
|
635
|
+
var De = ["data-tpl-theme"], Oe = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, ke = {
|
|
701
636
|
class: "tpl:text-sm tpl:font-semibold",
|
|
702
637
|
style: { color: "var(--tpl-text)" }
|
|
703
|
-
},
|
|
638
|
+
}, Ae = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:px-5" }, je = {
|
|
704
639
|
key: 0,
|
|
705
640
|
class: "tpl:mb-4"
|
|
706
|
-
},
|
|
641
|
+
}, Me = {
|
|
707
642
|
class: "tpl:relative tpl:mb-3 tpl:overflow-hidden tpl:rounded-md tpl:border",
|
|
708
643
|
style: {
|
|
709
644
|
"border-color": "var(--tpl-border)",
|
|
710
645
|
height: "300px",
|
|
711
646
|
"background-color": "var(--tpl-bg)"
|
|
712
647
|
}
|
|
713
|
-
},
|
|
648
|
+
}, Ne = { class: "tpl:space-y-3" }, Pe = {
|
|
714
649
|
class: "tpl:mb-1.5 tpl:block tpl:text-xs tpl:font-medium",
|
|
715
650
|
style: { color: "var(--tpl-text-muted)" }
|
|
716
|
-
},
|
|
651
|
+
}, Fe = { class: "tpl:flex tpl:flex-wrap tpl:gap-1.5" }, Ie = ["onClick"], Le = { class: "tpl:flex tpl:gap-3" }, Re = { class: "tpl:flex-1" }, ze = {
|
|
717
652
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
718
653
|
style: { color: "var(--tpl-text-muted)" }
|
|
719
|
-
},
|
|
654
|
+
}, Be = {
|
|
720
655
|
class: "tpl:font-normal",
|
|
721
656
|
style: { color: "var(--tpl-text-dim)" }
|
|
722
|
-
},
|
|
657
|
+
}, Ve = { class: "tpl:relative" }, He = ["value", "placeholder"], Ue = {
|
|
723
658
|
class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
|
|
724
659
|
style: { color: "var(--tpl-text-dim)" }
|
|
725
|
-
},
|
|
660
|
+
}, We = { class: "tpl:flex-1" }, Ge = {
|
|
726
661
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
727
662
|
style: { color: "var(--tpl-text-muted)" }
|
|
728
|
-
},
|
|
663
|
+
}, Ke = {
|
|
729
664
|
class: "tpl:font-normal",
|
|
730
665
|
style: { color: "var(--tpl-text-dim)" }
|
|
731
|
-
},
|
|
666
|
+
}, qe = { class: "tpl:relative" }, Je = ["value", "placeholder"], Ye = {
|
|
732
667
|
class: "tpl:absolute tpl:top-1/2 tpl:right-2.5 tpl:-translate-y-1/2 tpl:text-xs",
|
|
733
668
|
style: { color: "var(--tpl-text-dim)" }
|
|
734
|
-
},
|
|
669
|
+
}, Xe = {
|
|
735
670
|
key: 0,
|
|
736
671
|
class: "tpl:flex tpl:items-center tpl:gap-1 tpl:text-xs",
|
|
737
672
|
style: { color: "var(--tpl-text-muted)" }
|
|
738
|
-
},
|
|
673
|
+
}, Ze = {
|
|
739
674
|
class: "tpl:font-medium",
|
|
740
675
|
style: { color: "var(--tpl-text)" }
|
|
741
|
-
},
|
|
676
|
+
}, Qe = { class: "tpl:mb-3" }, $e = {
|
|
742
677
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
743
678
|
style: { color: "var(--tpl-text-muted)" }
|
|
744
|
-
},
|
|
679
|
+
}, et = ["autofocus"], tt = {
|
|
745
680
|
key: 1,
|
|
746
681
|
class: "tpl:mb-4"
|
|
747
|
-
},
|
|
682
|
+
}, nt = {
|
|
748
683
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
749
684
|
style: { color: "var(--tpl-text-muted)" }
|
|
750
|
-
},
|
|
685
|
+
}, rt = ["placeholder"], it = { class: "tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2 tpl:p-5 tpl:pt-4" }, at = ["disabled"], ot = /*@__PURE__*/ d({
|
|
751
686
|
__name: "MediaEditModal",
|
|
752
687
|
props: {
|
|
753
688
|
visible: { type: Boolean },
|
|
754
689
|
item: {}
|
|
755
690
|
},
|
|
756
691
|
emits: ["save", "close"],
|
|
757
|
-
setup(
|
|
758
|
-
let
|
|
692
|
+
setup(i, { emit: d }) {
|
|
693
|
+
let f = i, m = d, { t: _ } = Q(), y = p(Z, null), S = p(fe, b(null)), w = _.mediaLibrary, { isImageMimeType: T } = $(), j = b(""), N = b(""), P = b(null), F = b("free"), I = b(void 0), L = b(void 0), R = b(""), z = b(""), B = b(void 0), V = b(null), H = b(!1), U = b(!1), W = b(!1), G = r(() => f.item ? [
|
|
759
694
|
"image/jpeg",
|
|
760
695
|
"image/png",
|
|
761
696
|
"image/webp",
|
|
762
697
|
"image/gif"
|
|
763
|
-
].includes(
|
|
764
|
-
|
|
765
|
-
e &&
|
|
698
|
+
].includes(f.item.mimeType ?? "") : !1), ee = r(() => F.value === "original" ? B.value : Se[F.value]), K = r(() => V.value ? Ee(V.value.width, V.value.height, I.value, L.value) : null);
|
|
699
|
+
O(() => f.visible, (e) => {
|
|
700
|
+
e && f.item && (j.value = f.item.filename ?? "", N.value = f.item.alt ?? "", F.value = "free", I.value = void 0, L.value = void 0, R.value = "", z.value = "", B.value = void 0, V.value = null, H.value = !1, W.value = !1, f.item.width && f.item.height && (B.value = f.item.width / f.item.height));
|
|
766
701
|
});
|
|
767
|
-
function
|
|
702
|
+
function te(e) {
|
|
768
703
|
e.coordinates && (V.value = {
|
|
769
704
|
width: Math.round(e.coordinates.width),
|
|
770
705
|
height: Math.round(e.coordinates.height)
|
|
771
706
|
}, W.value = !0);
|
|
772
707
|
}
|
|
773
|
-
function
|
|
774
|
-
H.value = !0, !B.value &&
|
|
708
|
+
function q() {
|
|
709
|
+
H.value = !0, !B.value && f.item?.width && f.item?.height && (B.value = f.item.width / f.item.height);
|
|
775
710
|
}
|
|
776
|
-
function
|
|
711
|
+
function ne(e) {
|
|
777
712
|
let t = e.target.value;
|
|
778
713
|
R.value = t, I.value = t && parseInt(t, 10) || void 0;
|
|
779
714
|
}
|
|
780
|
-
function
|
|
715
|
+
function J(e) {
|
|
781
716
|
let t = e.target.value;
|
|
782
717
|
z.value = t, L.value = t && parseInt(t, 10) || void 0;
|
|
783
718
|
}
|
|
784
|
-
async function
|
|
785
|
-
let e =
|
|
786
|
-
if (!e || !
|
|
787
|
-
let t =
|
|
788
|
-
if (G.value &&
|
|
719
|
+
async function Y() {
|
|
720
|
+
let e = j.value.trim();
|
|
721
|
+
if (!e || !f.item || U.value) return;
|
|
722
|
+
let t = T(f.item.mimeType ?? ""), n;
|
|
723
|
+
if (G.value && P.value && W.value) {
|
|
789
724
|
U.value = !0;
|
|
790
725
|
try {
|
|
791
|
-
let { canvas: e } =
|
|
726
|
+
let { canvas: e } = P.value.getResult();
|
|
792
727
|
if (e) {
|
|
793
|
-
let t =
|
|
794
|
-
|
|
728
|
+
let t = we(e, I.value, L.value), r = Ce(f.item.mimeType ?? "");
|
|
729
|
+
n = { file: await Te(t, f.item.filename ?? "image", r) };
|
|
795
730
|
}
|
|
796
731
|
} catch {
|
|
797
732
|
U.value = !1;
|
|
@@ -799,12 +734,12 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
799
734
|
}
|
|
800
735
|
U.value = !1;
|
|
801
736
|
}
|
|
802
|
-
|
|
737
|
+
m("save", f.item.id, e, t ? N.value : void 0, n), m("close");
|
|
803
738
|
}
|
|
804
|
-
function
|
|
805
|
-
e.key === "Enter" && !U.value && (e.preventDefault(),
|
|
739
|
+
function ie(e) {
|
|
740
|
+
e.key === "Enter" && !U.value && (e.preventDefault(), Y()), e.key === "Escape" && m("close");
|
|
806
741
|
}
|
|
807
|
-
return (
|
|
742
|
+
return (r, d) => (v(), a(t, { to: E(S) || "body" }, [u(n, {
|
|
808
743
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
809
744
|
"enter-from-class": "tpl:opacity-0",
|
|
810
745
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -812,47 +747,47 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
812
747
|
"leave-from-class": "tpl:opacity-100",
|
|
813
748
|
"leave-to-class": "tpl:opacity-0"
|
|
814
749
|
}, {
|
|
815
|
-
default:
|
|
750
|
+
default: k(() => [i.visible && i.item ? (v(), s("div", {
|
|
816
751
|
key: 0,
|
|
817
|
-
"data-tpl-theme":
|
|
818
|
-
class: "tpl tpl:fixed tpl:inset-0 tpl:z-
|
|
752
|
+
"data-tpl-theme": E(y),
|
|
753
|
+
class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
819
754
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
820
|
-
onClick:
|
|
821
|
-
onKeydown:
|
|
822
|
-
}, [
|
|
823
|
-
class:
|
|
755
|
+
onClick: d[3] ||= M((e) => m("close"), ["self"]),
|
|
756
|
+
onKeydown: ie
|
|
757
|
+
}, [c("div", {
|
|
758
|
+
class: h(["tpl:flex tpl:max-h-[90%] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", G.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
|
|
824
759
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
825
760
|
}, [
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
G.value ? (
|
|
761
|
+
c("div", Oe, [c("h3", ke, C(E(_).mediaLibrary.editFile), 1)]),
|
|
762
|
+
c("div", Ae, [
|
|
763
|
+
G.value ? (v(), s("div", je, [c("div", Me, [u(E(re), {
|
|
829
764
|
ref_key: "cropperRef",
|
|
830
|
-
ref:
|
|
831
|
-
src:
|
|
832
|
-
"stencil-props": { aspectRatio:
|
|
765
|
+
ref: P,
|
|
766
|
+
src: i.item.url,
|
|
767
|
+
"stencil-props": { aspectRatio: ee.value },
|
|
833
768
|
class: "tpl:h-full tpl:w-full",
|
|
834
769
|
"background-class": "tpl-cropper-background",
|
|
835
|
-
onChange:
|
|
836
|
-
onReady:
|
|
837
|
-
}, null, 8, ["src", "stencil-props"])]),
|
|
838
|
-
|
|
770
|
+
onChange: te,
|
|
771
|
+
onReady: q
|
|
772
|
+
}, null, 8, ["src", "stencil-props"])]), c("div", Ne, [
|
|
773
|
+
c("div", null, [c("label", Pe, C(E(_).mediaLibrary.cropAspectRatio), 1), c("div", Fe, [(v(), s(e, null, x([
|
|
839
774
|
"free",
|
|
840
775
|
"square",
|
|
841
776
|
"landscape43",
|
|
842
777
|
"landscape169",
|
|
843
778
|
"original"
|
|
844
|
-
], (e) =>
|
|
779
|
+
], (e) => c("button", {
|
|
845
780
|
key: e,
|
|
846
781
|
type: "button",
|
|
847
782
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-2.5 tpl:py-1 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
848
|
-
style:
|
|
849
|
-
borderColor:
|
|
850
|
-
backgroundColor:
|
|
851
|
-
color:
|
|
783
|
+
style: g({
|
|
784
|
+
borderColor: F.value === e ? "var(--tpl-primary)" : "var(--tpl-border)",
|
|
785
|
+
backgroundColor: F.value === e ? "var(--tpl-primary-light)" : "var(--tpl-bg)",
|
|
786
|
+
color: F.value === e ? "var(--tpl-primary)" : "var(--tpl-text)"
|
|
852
787
|
}),
|
|
853
|
-
onClick: (t) =>
|
|
854
|
-
},
|
|
855
|
-
|
|
788
|
+
onClick: (t) => F.value = e
|
|
789
|
+
}, C(E(w)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Ie)), 64))])]),
|
|
790
|
+
c("div", Le, [c("div", Re, [c("label", ze, [l(C(E(_).mediaLibrary.cropMaxWidth) + " ", 1), c("span", Be, C(E(_).mediaLibrary.cropOptional), 1)]), c("div", Ve, [c("input", {
|
|
856
791
|
value: R.value,
|
|
857
792
|
type: "number",
|
|
858
793
|
min: "1",
|
|
@@ -863,8 +798,8 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
863
798
|
color: "var(--tpl-text)"
|
|
864
799
|
},
|
|
865
800
|
placeholder: V.value?.width?.toString() || "",
|
|
866
|
-
onInput:
|
|
867
|
-
}, null, 40,
|
|
801
|
+
onInput: ne
|
|
802
|
+
}, null, 40, He), c("span", Ue, C(E(_).mediaLibrary.cropPixels), 1)])]), c("div", We, [c("label", Ge, [l(C(E(_).mediaLibrary.cropMaxHeight) + " ", 1), c("span", Ke, C(E(_).mediaLibrary.cropOptional), 1)]), c("div", qe, [c("input", {
|
|
868
803
|
value: z.value,
|
|
869
804
|
type: "number",
|
|
870
805
|
min: "1",
|
|
@@ -875,12 +810,12 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
875
810
|
color: "var(--tpl-text)"
|
|
876
811
|
},
|
|
877
812
|
placeholder: V.value?.height?.toString() || "",
|
|
878
|
-
onInput:
|
|
879
|
-
}, null, 40,
|
|
880
|
-
|
|
881
|
-
])])) :
|
|
882
|
-
|
|
883
|
-
"onUpdate:modelValue":
|
|
813
|
+
onInput: J
|
|
814
|
+
}, null, 40, Je), c("span", Ye, C(E(_).mediaLibrary.cropPixels), 1)])])]),
|
|
815
|
+
K.value ? (v(), s("div", Xe, [c("span", null, C(E(_).mediaLibrary.cropOutputSize) + ": ", 1), c("span", Ze, C(K.value.width) + " x " + C(K.value.height) + " " + C(E(_).mediaLibrary.cropPixels), 1)])) : o("", !0)
|
|
816
|
+
])])) : o("", !0),
|
|
817
|
+
c("div", Qe, [c("label", $e, C(E(_).mediaLibrary.fileName), 1), A(c("input", {
|
|
818
|
+
"onUpdate:modelValue": d[0] ||= (e) => j.value = e,
|
|
884
819
|
type: "text",
|
|
885
820
|
class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
|
|
886
821
|
style: {
|
|
@@ -889,9 +824,9 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
889
824
|
color: "var(--tpl-text)"
|
|
890
825
|
},
|
|
891
826
|
autofocus: !G.value
|
|
892
|
-
}, null, 8,
|
|
893
|
-
|
|
894
|
-
"onUpdate:modelValue":
|
|
827
|
+
}, null, 8, et), [[D, j.value]])]),
|
|
828
|
+
E(T)(i.item.mimeType ?? "") ? (v(), s("div", tt, [c("label", nt, C(E(_).mediaLibrary.altText), 1), A(c("input", {
|
|
829
|
+
"onUpdate:modelValue": d[1] ||= (e) => N.value = e,
|
|
895
830
|
type: "text",
|
|
896
831
|
class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
|
|
897
832
|
style: {
|
|
@@ -899,46 +834,49 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
899
834
|
"background-color": "var(--tpl-bg)",
|
|
900
835
|
color: "var(--tpl-text)"
|
|
901
836
|
},
|
|
902
|
-
placeholder:
|
|
903
|
-
}, null, 8,
|
|
837
|
+
placeholder: E(_).mediaLibrary.altTextPlaceholder
|
|
838
|
+
}, null, 8, rt), [[D, N.value]])])) : o("", !0)
|
|
904
839
|
]),
|
|
905
|
-
|
|
840
|
+
c("div", it, [c("button", {
|
|
906
841
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
907
842
|
style: {
|
|
908
843
|
"border-color": "var(--tpl-border)",
|
|
909
844
|
color: "var(--tpl-text)",
|
|
910
845
|
"background-color": "var(--tpl-bg)"
|
|
911
846
|
},
|
|
912
|
-
onClick:
|
|
913
|
-
},
|
|
847
|
+
onClick: d[2] ||= (e) => m("close")
|
|
848
|
+
}, C(E(_).mediaLibrary.cancel), 1), c("button", {
|
|
914
849
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
915
850
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
916
851
|
disabled: U.value,
|
|
917
|
-
onClick:
|
|
918
|
-
},
|
|
919
|
-
], 2)], 40,
|
|
852
|
+
onClick: Y
|
|
853
|
+
}, C(U.value ? E(_).mediaLibrary.saving : E(_).mediaLibrary.saveChanges), 9, at)])
|
|
854
|
+
], 2)], 40, De)) : o("", !0)]),
|
|
920
855
|
_: 1
|
|
921
856
|
})], 8, ["to"]));
|
|
922
857
|
}
|
|
923
|
-
}),
|
|
858
|
+
}), st = (e, t) => {
|
|
924
859
|
let n = e.__vccOpts || e;
|
|
925
860
|
for (let [e, r] of t) n[e] = r;
|
|
926
861
|
return n;
|
|
927
|
-
},
|
|
862
|
+
}, ct = /*#__PURE__*/ st(ot, [["__scopeId", "data-v-c7f50076"]]), lt = {
|
|
928
863
|
key: 1,
|
|
929
864
|
class: "tpl:size-4 tpl:shrink-0"
|
|
930
|
-
},
|
|
865
|
+
}, ut = {
|
|
931
866
|
key: 0,
|
|
932
867
|
class: "tpl:truncate"
|
|
933
|
-
},
|
|
868
|
+
}, dt = {
|
|
934
869
|
key: 3,
|
|
935
870
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:gap-0.5 tpl:opacity-0 tpl:transition-opacity tpl:group-hover:opacity-100"
|
|
936
|
-
},
|
|
871
|
+
}, ft = ["title"], pt = ["title"], mt = { key: 0 }, ht = ["placeholder"], gt = /* @__PURE__ */ d({
|
|
937
872
|
__name: "MediaFolderTreeNode",
|
|
938
873
|
props: {
|
|
939
874
|
folder: {},
|
|
940
875
|
currentFolderId: {},
|
|
941
|
-
depth: {}
|
|
876
|
+
depth: {},
|
|
877
|
+
canCreateFolder: { type: Boolean },
|
|
878
|
+
canRenameFolder: { type: Boolean },
|
|
879
|
+
canDeleteFolder: { type: Boolean }
|
|
942
880
|
},
|
|
943
881
|
emits: [
|
|
944
882
|
"navigate",
|
|
@@ -946,64 +884,64 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
946
884
|
"renameFolder",
|
|
947
885
|
"deleteFolder"
|
|
948
886
|
],
|
|
949
|
-
setup(
|
|
950
|
-
let
|
|
951
|
-
function
|
|
952
|
-
for (let n of e) if (n.id === t ||
|
|
887
|
+
setup(t, { emit: n }) {
|
|
888
|
+
let i = t, l = n, { t: d } = Q(), f = b(!1), p = b(!1), m = b(""), _ = b(!1), y = b(""), w = r(() => i.folder.children.length > 0), T = r(() => i.depth < 4), O = r(() => i.currentFolderId === i.folder.id), k = r(() => i.currentFolderId ? F(i.folder.children, i.currentFolderId) : !1), N = r(() => f.value || k.value);
|
|
889
|
+
function F(e, t) {
|
|
890
|
+
for (let n of e) if (n.id === t || F(n.children, t)) return !0;
|
|
953
891
|
return !1;
|
|
954
892
|
}
|
|
955
|
-
function M() {
|
|
956
|
-
o.value = !o.value;
|
|
957
|
-
}
|
|
958
893
|
function I() {
|
|
959
|
-
|
|
894
|
+
f.value = !f.value;
|
|
960
895
|
}
|
|
961
896
|
function R() {
|
|
962
|
-
|
|
963
|
-
e && e !== n.folder.name && r("renameFolder", n.folder.id, e), c.value = !1, p.value = "";
|
|
897
|
+
p.value = !0, m.value = i.folder.name;
|
|
964
898
|
}
|
|
965
899
|
function z() {
|
|
966
|
-
|
|
900
|
+
let e = m.value.trim();
|
|
901
|
+
e && e !== i.folder.name && l("renameFolder", i.folder.id, e), p.value = !1, m.value = "";
|
|
902
|
+
}
|
|
903
|
+
function B() {
|
|
904
|
+
p.value = !1, m.value = "";
|
|
967
905
|
}
|
|
968
906
|
function V() {
|
|
969
|
-
|
|
907
|
+
_.value = !0, y.value = "", f.value = !0;
|
|
970
908
|
}
|
|
971
909
|
function H() {
|
|
972
|
-
|
|
910
|
+
y.value.trim() && l("createFolder", y.value.trim(), i.folder.id), _.value = !1, y.value = "";
|
|
973
911
|
}
|
|
974
|
-
function
|
|
975
|
-
|
|
912
|
+
function G() {
|
|
913
|
+
_.value = !1, y.value = "";
|
|
976
914
|
}
|
|
977
|
-
return (
|
|
978
|
-
let
|
|
979
|
-
return
|
|
915
|
+
return (n, r) => {
|
|
916
|
+
let i = S("MediaFolderTreeNode", !0);
|
|
917
|
+
return v(), s("div", null, [c("div", {
|
|
980
918
|
class: "tpl:group tpl:flex tpl:w-full tpl:items-center tpl:gap-1 tpl:py-1.5 tpl:pr-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
|
|
981
|
-
style:
|
|
982
|
-
paddingLeft: `${
|
|
983
|
-
backgroundColor:
|
|
984
|
-
color:
|
|
919
|
+
style: g({
|
|
920
|
+
paddingLeft: `${t.depth * 16 + 8}px`,
|
|
921
|
+
backgroundColor: O.value ? "var(--tpl-bg-active)" : "transparent",
|
|
922
|
+
color: O.value ? "var(--tpl-primary)" : "var(--tpl-text)"
|
|
985
923
|
})
|
|
986
924
|
}, [
|
|
987
|
-
|
|
925
|
+
w.value || _.value ? (v(), s("button", {
|
|
988
926
|
key: 0,
|
|
989
927
|
class: "tpl:flex tpl:size-4 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
|
|
990
|
-
onClick:
|
|
991
|
-
}, [
|
|
992
|
-
class:
|
|
928
|
+
onClick: M(I, ["stop"])
|
|
929
|
+
}, [u(E(P), {
|
|
930
|
+
class: h(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": N.value }]),
|
|
993
931
|
size: 10,
|
|
994
932
|
"stroke-width": 2
|
|
995
|
-
}, null, 8, ["class"])])) : (
|
|
996
|
-
|
|
933
|
+
}, null, 8, ["class"])])) : (v(), s("span", lt)),
|
|
934
|
+
c("button", {
|
|
997
935
|
class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-1.5",
|
|
998
|
-
onClick:
|
|
999
|
-
}, [
|
|
936
|
+
onClick: r[0] ||= (e) => l("navigate", t.folder.id)
|
|
937
|
+
}, [u(E(L), {
|
|
1000
938
|
class: "tpl:shrink-0",
|
|
1001
939
|
size: 14,
|
|
1002
940
|
"stroke-width": 1.5
|
|
1003
|
-
}),
|
|
1004
|
-
|
|
941
|
+
}), p.value ? o("", !0) : (v(), s("span", ut, C(t.folder.name), 1))]),
|
|
942
|
+
p.value ? A((v(), s("input", {
|
|
1005
943
|
key: 2,
|
|
1006
|
-
"onUpdate:modelValue":
|
|
944
|
+
"onUpdate:modelValue": r[1] ||= (e) => m.value = e,
|
|
1007
945
|
type: "text",
|
|
1008
946
|
class: "tpl:min-w-0 tpl:flex-1 tpl:rounded tpl:border tpl:px-1.5 tpl:py-0.5 tpl:text-xs tpl:outline-none",
|
|
1009
947
|
style: {
|
|
@@ -1012,56 +950,64 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1012
950
|
color: "var(--tpl-text)"
|
|
1013
951
|
},
|
|
1014
952
|
autofocus: "",
|
|
1015
|
-
onKeydown: [
|
|
1016
|
-
onBlur:
|
|
1017
|
-
onClick:
|
|
1018
|
-
}, null, 544)), [[
|
|
1019
|
-
|
|
1020
|
-
|
|
953
|
+
onKeydown: [j(z, ["enter"]), j(B, ["escape"])],
|
|
954
|
+
onBlur: z,
|
|
955
|
+
onClick: r[2] ||= M(() => {}, ["stop"])
|
|
956
|
+
}, null, 544)), [[D, m.value]]) : o("", !0),
|
|
957
|
+
p.value ? o("", !0) : (v(), s("span", dt, [
|
|
958
|
+
T.value && t.canCreateFolder ? (v(), s("button", {
|
|
1021
959
|
key: 0,
|
|
1022
960
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
|
|
1023
|
-
title:
|
|
1024
|
-
onClick:
|
|
1025
|
-
}, [
|
|
961
|
+
title: E(d).mediaLibrary.addSubfolder,
|
|
962
|
+
onClick: M(V, ["stop"])
|
|
963
|
+
}, [u(E(W), {
|
|
1026
964
|
size: 12,
|
|
1027
965
|
"stroke-width": 2
|
|
1028
|
-
})], 8,
|
|
1029
|
-
|
|
966
|
+
})], 8, ft)) : o("", !0),
|
|
967
|
+
t.canRenameFolder ? (v(), s("button", {
|
|
968
|
+
key: 1,
|
|
1030
969
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
|
|
1031
|
-
title:
|
|
1032
|
-
onClick:
|
|
1033
|
-
}, [
|
|
970
|
+
title: E(d).mediaLibrary.renameFolder,
|
|
971
|
+
onClick: M(R, ["stop"])
|
|
972
|
+
}, [u(E(U), {
|
|
1034
973
|
size: 12,
|
|
1035
974
|
"stroke-width": 2
|
|
1036
|
-
})], 8,
|
|
1037
|
-
|
|
975
|
+
})], 8, pt)) : o("", !0),
|
|
976
|
+
t.canDeleteFolder ? (v(), s("button", {
|
|
977
|
+
key: 2,
|
|
1038
978
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
|
|
1039
|
-
onClick:
|
|
1040
|
-
}, [
|
|
979
|
+
onClick: r[3] ||= M((e) => l("deleteFolder", t.folder.id), ["stop"])
|
|
980
|
+
}, [u(E(te), {
|
|
1041
981
|
size: 12,
|
|
1042
982
|
"stroke-width": 2,
|
|
1043
983
|
style: { color: "var(--tpl-danger)" }
|
|
1044
|
-
})])
|
|
984
|
+
})])) : o("", !0)
|
|
1045
985
|
]))
|
|
1046
|
-
], 4),
|
|
1047
|
-
key:
|
|
1048
|
-
folder:
|
|
1049
|
-
"current-folder-id":
|
|
1050
|
-
depth:
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
986
|
+
], 4), N.value ? (v(), s("div", mt, [(v(!0), s(e, null, x(t.folder.children, (e) => (v(), a(i, {
|
|
987
|
+
key: e.id,
|
|
988
|
+
folder: e,
|
|
989
|
+
"current-folder-id": t.currentFolderId,
|
|
990
|
+
depth: t.depth + 1,
|
|
991
|
+
"can-create-folder": t.canCreateFolder,
|
|
992
|
+
"can-rename-folder": t.canRenameFolder,
|
|
993
|
+
"can-delete-folder": t.canDeleteFolder,
|
|
994
|
+
onNavigate: r[4] ||= (e) => l("navigate", e),
|
|
995
|
+
onCreateFolder: r[5] ||= (e, t) => l("createFolder", e, t),
|
|
996
|
+
onRenameFolder: r[6] ||= (e, t) => l("renameFolder", e, t),
|
|
997
|
+
onDeleteFolder: r[7] ||= (e) => l("deleteFolder", e)
|
|
1055
998
|
}, null, 8, [
|
|
1056
999
|
"folder",
|
|
1057
1000
|
"current-folder-id",
|
|
1058
|
-
"depth"
|
|
1059
|
-
|
|
1001
|
+
"depth",
|
|
1002
|
+
"can-create-folder",
|
|
1003
|
+
"can-rename-folder",
|
|
1004
|
+
"can-delete-folder"
|
|
1005
|
+
]))), 128)), _.value ? (v(), s("div", {
|
|
1060
1006
|
key: 0,
|
|
1061
|
-
style:
|
|
1007
|
+
style: g({ paddingLeft: `${(t.depth + 1) * 16 + 8}px` }),
|
|
1062
1008
|
class: "tpl:py-1.5 tpl:pr-2"
|
|
1063
|
-
}, [
|
|
1064
|
-
"onUpdate:modelValue":
|
|
1009
|
+
}, [A(c("input", {
|
|
1010
|
+
"onUpdate:modelValue": r[8] ||= (e) => y.value = e,
|
|
1065
1011
|
type: "text",
|
|
1066
1012
|
class: "tpl:w-full tpl:rounded tpl:border tpl:px-2 tpl:py-1 tpl:text-xs tpl:outline-none",
|
|
1067
1013
|
style: {
|
|
@@ -1069,23 +1015,29 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1069
1015
|
"background-color": "var(--tpl-bg)",
|
|
1070
1016
|
color: "var(--tpl-text)"
|
|
1071
1017
|
},
|
|
1072
|
-
placeholder:
|
|
1018
|
+
placeholder: E(d).mediaLibrary.subfolderName,
|
|
1073
1019
|
autofocus: "",
|
|
1074
|
-
onKeydown: [
|
|
1020
|
+
onKeydown: [j(H, ["enter"]), j(G, ["escape"])],
|
|
1075
1021
|
onBlur: H
|
|
1076
|
-
}, null, 40,
|
|
1022
|
+
}, null, 40, ht), [[D, y.value]])], 4)) : o("", !0)])) : o("", !0)]);
|
|
1077
1023
|
};
|
|
1078
1024
|
}
|
|
1079
|
-
}),
|
|
1025
|
+
}), _t = {
|
|
1026
|
+
"data-testid": "media-folder-tree",
|
|
1027
|
+
class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto"
|
|
1028
|
+
}, vt = {
|
|
1080
1029
|
key: 0,
|
|
1081
1030
|
class: "tpl:px-3 tpl:py-2"
|
|
1082
|
-
},
|
|
1031
|
+
}, yt = ["placeholder"], bt = /* @__PURE__ */ d({
|
|
1083
1032
|
__name: "MediaFolderTree",
|
|
1084
1033
|
props: {
|
|
1085
1034
|
folders: {},
|
|
1086
1035
|
currentFolderId: {},
|
|
1087
1036
|
viewMode: {},
|
|
1088
|
-
hasFrequentlyUsed: { type: Boolean }
|
|
1037
|
+
hasFrequentlyUsed: { type: Boolean },
|
|
1038
|
+
canCreateFolder: { type: Boolean },
|
|
1039
|
+
canRenameFolder: { type: Boolean },
|
|
1040
|
+
canDeleteFolder: { type: Boolean }
|
|
1089
1041
|
},
|
|
1090
1042
|
emits: [
|
|
1091
1043
|
"navigate",
|
|
@@ -1094,41 +1046,50 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1094
1046
|
"deleteFolder",
|
|
1095
1047
|
"showFrequentlyUsed"
|
|
1096
1048
|
],
|
|
1097
|
-
setup(
|
|
1098
|
-
let
|
|
1099
|
-
function
|
|
1100
|
-
|
|
1049
|
+
setup(t, { emit: n }) {
|
|
1050
|
+
let r = n, { t: i } = Q(), d = b(!1), f = b("");
|
|
1051
|
+
function p() {
|
|
1052
|
+
d.value = !0, f.value = "";
|
|
1101
1053
|
}
|
|
1102
|
-
function
|
|
1103
|
-
|
|
1054
|
+
function m() {
|
|
1055
|
+
f.value.trim() && r("createFolder", f.value.trim()), d.value = !1, f.value = "";
|
|
1104
1056
|
}
|
|
1105
1057
|
function h() {
|
|
1106
|
-
|
|
1058
|
+
d.value = !1, f.value = "";
|
|
1107
1059
|
}
|
|
1108
|
-
return (
|
|
1109
|
-
|
|
1060
|
+
return (n, _) => (v(), s("div", _t, [
|
|
1061
|
+
c("button", {
|
|
1110
1062
|
class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
1111
|
-
style:
|
|
1112
|
-
backgroundColor:
|
|
1113
|
-
color:
|
|
1063
|
+
style: g({
|
|
1064
|
+
backgroundColor: t.viewMode === "files" && t.currentFolderId === null ? "var(--tpl-bg-active)" : "transparent",
|
|
1065
|
+
color: t.viewMode === "files" && t.currentFolderId === null ? "var(--tpl-primary)" : "var(--tpl-text)"
|
|
1114
1066
|
}),
|
|
1115
|
-
onClick:
|
|
1116
|
-
}, [
|
|
1067
|
+
onClick: _[0] ||= (e) => r("navigate", null)
|
|
1068
|
+
}, [u(E(I), {
|
|
1117
1069
|
size: 14,
|
|
1118
1070
|
"stroke-width": 1.5
|
|
1119
|
-
}),
|
|
1120
|
-
(
|
|
1121
|
-
key:
|
|
1122
|
-
folder:
|
|
1123
|
-
"current-folder-id":
|
|
1071
|
+
}), l(" " + C(E(i).mediaLibrary.allFiles), 1)], 4),
|
|
1072
|
+
(v(!0), s(e, null, x(t.folders, (e) => (v(), a(gt, {
|
|
1073
|
+
key: e.id,
|
|
1074
|
+
folder: e,
|
|
1075
|
+
"current-folder-id": t.currentFolderId,
|
|
1124
1076
|
depth: 0,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1077
|
+
"can-create-folder": t.canCreateFolder,
|
|
1078
|
+
"can-rename-folder": t.canRenameFolder,
|
|
1079
|
+
"can-delete-folder": t.canDeleteFolder,
|
|
1080
|
+
onNavigate: _[1] ||= (e) => r("navigate", e),
|
|
1081
|
+
onCreateFolder: _[2] ||= (e, t) => r("createFolder", e, t),
|
|
1082
|
+
onRenameFolder: _[3] ||= (e, t) => r("renameFolder", e, t),
|
|
1083
|
+
onDeleteFolder: _[4] ||= (e) => r("deleteFolder", e)
|
|
1084
|
+
}, null, 8, [
|
|
1085
|
+
"folder",
|
|
1086
|
+
"current-folder-id",
|
|
1087
|
+
"can-create-folder",
|
|
1088
|
+
"can-rename-folder",
|
|
1089
|
+
"can-delete-folder"
|
|
1090
|
+
]))), 128)),
|
|
1091
|
+
d.value ? (v(), s("div", vt, [A(c("input", {
|
|
1092
|
+
"onUpdate:modelValue": _[5] ||= (e) => f.value = e,
|
|
1132
1093
|
type: "text",
|
|
1133
1094
|
class: "tpl:w-full tpl:rounded tpl:border tpl:px-2 tpl:py-1 tpl:text-xs tpl:outline-none",
|
|
1134
1095
|
style: {
|
|
@@ -1136,37 +1097,38 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1136
1097
|
"background-color": "var(--tpl-bg)",
|
|
1137
1098
|
color: "var(--tpl-text)"
|
|
1138
1099
|
},
|
|
1139
|
-
placeholder:
|
|
1100
|
+
placeholder: E(i).mediaLibrary.folderName,
|
|
1140
1101
|
autofocus: "",
|
|
1141
|
-
onKeydown: [
|
|
1142
|
-
onBlur:
|
|
1143
|
-
}, null, 40,
|
|
1144
|
-
|
|
1102
|
+
onKeydown: [j(m, ["enter"]), j(h, ["escape"])],
|
|
1103
|
+
onBlur: m
|
|
1104
|
+
}, null, 40, yt), [[D, f.value]])])) : o("", !0),
|
|
1105
|
+
!d.value && t.canCreateFolder ? (v(), s("button", {
|
|
1145
1106
|
key: 1,
|
|
1146
1107
|
class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
|
|
1147
1108
|
style: { color: "var(--tpl-text-muted)" },
|
|
1148
|
-
onClick:
|
|
1149
|
-
}, [
|
|
1109
|
+
onClick: p
|
|
1110
|
+
}, [u(E(W), {
|
|
1150
1111
|
size: 14,
|
|
1151
1112
|
"stroke-width": 1.5
|
|
1152
|
-
}),
|
|
1153
|
-
|
|
1154
|
-
|
|
1113
|
+
}), l(" " + C(E(i).mediaLibrary.newFolder), 1)])) : o("", !0),
|
|
1114
|
+
_[7] ||= c("div", { class: "tpl:flex-1" }, null, -1),
|
|
1115
|
+
t.hasFrequentlyUsed ? (v(), s("button", {
|
|
1155
1116
|
key: 2,
|
|
1117
|
+
"data-testid": "media-frequently-used",
|
|
1156
1118
|
class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:border-t tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
1157
|
-
style:
|
|
1119
|
+
style: g({
|
|
1158
1120
|
borderColor: "var(--tpl-border)",
|
|
1159
|
-
backgroundColor:
|
|
1160
|
-
color:
|
|
1121
|
+
backgroundColor: t.viewMode === "frequently-used" ? "var(--tpl-bg-active)" : "transparent",
|
|
1122
|
+
color: t.viewMode === "frequently-used" ? "var(--tpl-primary)" : "var(--tpl-text)"
|
|
1161
1123
|
}),
|
|
1162
|
-
onClick:
|
|
1163
|
-
}, [
|
|
1124
|
+
onClick: _[6] ||= (e) => r("showFrequentlyUsed")
|
|
1125
|
+
}, [u(E(K), {
|
|
1164
1126
|
size: 14,
|
|
1165
1127
|
"stroke-width": 1.5
|
|
1166
|
-
}),
|
|
1128
|
+
}), l(" " + C(E(i).mediaLibrary.frequentlyUsed), 1)], 4)) : o("", !0)
|
|
1167
1129
|
]));
|
|
1168
1130
|
}
|
|
1169
|
-
}),
|
|
1131
|
+
}), xt = { class: "tpl:flex tpl:aspect-square tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2" }, St = /* @__PURE__ */ d({
|
|
1170
1132
|
__name: "MediaFileIcon",
|
|
1171
1133
|
props: { mimeType: {} },
|
|
1172
1134
|
setup(e) {
|
|
@@ -1261,13 +1223,13 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1261
1223
|
bgColor: "#f0fdfa",
|
|
1262
1224
|
icon: "audio"
|
|
1263
1225
|
}
|
|
1264
|
-
},
|
|
1226
|
+
}, i = {
|
|
1265
1227
|
label: "FILE",
|
|
1266
1228
|
color: "#6b7280",
|
|
1267
1229
|
bgColor: "#f9fafb",
|
|
1268
1230
|
icon: "document"
|
|
1269
|
-
},
|
|
1270
|
-
return (e, t) => (
|
|
1231
|
+
}, a = r(() => n[t.mimeType] ?? i);
|
|
1232
|
+
return (e, t) => (v(), s("div", xt, [a.value.icon === "document" ? (v(), s("svg", {
|
|
1271
1233
|
key: 0,
|
|
1272
1234
|
width: "60",
|
|
1273
1235
|
height: "60",
|
|
@@ -1275,23 +1237,23 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1275
1237
|
fill: "none",
|
|
1276
1238
|
stroke: "currentColor",
|
|
1277
1239
|
"stroke-width": "1.5",
|
|
1278
|
-
style:
|
|
1240
|
+
style: g({ color: a.value.color })
|
|
1279
1241
|
}, [...t[0] ||= [
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1242
|
+
c("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }, null, -1),
|
|
1243
|
+
c("polyline", { points: "14 2 14 8 20 8" }, null, -1),
|
|
1244
|
+
c("line", {
|
|
1283
1245
|
x1: "8",
|
|
1284
1246
|
y1: "13",
|
|
1285
1247
|
x2: "16",
|
|
1286
1248
|
y2: "13"
|
|
1287
1249
|
}, null, -1),
|
|
1288
|
-
|
|
1250
|
+
c("line", {
|
|
1289
1251
|
x1: "8",
|
|
1290
1252
|
y1: "17",
|
|
1291
1253
|
x2: "12",
|
|
1292
1254
|
y2: "17"
|
|
1293
1255
|
}, null, -1)
|
|
1294
|
-
]], 4)) :
|
|
1256
|
+
]], 4)) : a.value.icon === "video" ? (v(), s("svg", {
|
|
1295
1257
|
key: 1,
|
|
1296
1258
|
width: "40",
|
|
1297
1259
|
height: "40",
|
|
@@ -1299,18 +1261,18 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1299
1261
|
fill: "none",
|
|
1300
1262
|
stroke: "currentColor",
|
|
1301
1263
|
"stroke-width": "1.5",
|
|
1302
|
-
style:
|
|
1303
|
-
}, [...t[1] ||= [
|
|
1264
|
+
style: g({ color: a.value.color })
|
|
1265
|
+
}, [...t[1] ||= [c("rect", {
|
|
1304
1266
|
x: "2",
|
|
1305
1267
|
y: "4",
|
|
1306
1268
|
width: "20",
|
|
1307
1269
|
height: "16",
|
|
1308
1270
|
rx: "2"
|
|
1309
|
-
}, null, -1),
|
|
1271
|
+
}, null, -1), c("polygon", {
|
|
1310
1272
|
points: "10,8 16,12 10,16",
|
|
1311
1273
|
fill: "currentColor",
|
|
1312
1274
|
stroke: "none"
|
|
1313
|
-
}, null, -1)]], 4)) : (
|
|
1275
|
+
}, null, -1)]], 4)) : (v(), s("svg", {
|
|
1314
1276
|
key: 2,
|
|
1315
1277
|
width: "40",
|
|
1316
1278
|
height: "40",
|
|
@@ -1318,28 +1280,28 @@ var je = ["data-tpl-theme"], Me = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, Ne
|
|
|
1318
1280
|
fill: "none",
|
|
1319
1281
|
stroke: "currentColor",
|
|
1320
1282
|
"stroke-width": "1.5",
|
|
1321
|
-
style:
|
|
1283
|
+
style: g({ color: a.value.color })
|
|
1322
1284
|
}, [...t[2] ||= [
|
|
1323
|
-
|
|
1324
|
-
|
|
1285
|
+
c("path", { d: "M9 18V5l12-2v13" }, null, -1),
|
|
1286
|
+
c("circle", {
|
|
1325
1287
|
cx: "6",
|
|
1326
1288
|
cy: "18",
|
|
1327
1289
|
r: "3"
|
|
1328
1290
|
}, null, -1),
|
|
1329
|
-
|
|
1291
|
+
c("circle", {
|
|
1330
1292
|
cx: "18",
|
|
1331
1293
|
cy: "16",
|
|
1332
1294
|
r: "3"
|
|
1333
1295
|
}, null, -1)
|
|
1334
|
-
]], 4)),
|
|
1296
|
+
]], 4)), c("span", {
|
|
1335
1297
|
class: "tpl:text-xs tpl:font-bold tpl:tracking-wider",
|
|
1336
|
-
style:
|
|
1337
|
-
},
|
|
1298
|
+
style: g({ color: a.value.color })
|
|
1299
|
+
}, C(a.value.label), 5)]));
|
|
1338
1300
|
}
|
|
1339
1301
|
});
|
|
1340
1302
|
//#endregion
|
|
1341
1303
|
//#region src/utils/formatAbsoluteDate.ts
|
|
1342
|
-
function
|
|
1304
|
+
function Ct(e, t, n) {
|
|
1343
1305
|
let r = new Date(e);
|
|
1344
1306
|
if (Number.isNaN(r.getTime())) return "";
|
|
1345
1307
|
let i = t?.trim().replace(/_/g, "-") || void 0;
|
|
@@ -1351,48 +1313,56 @@ function Dt(e, t, n) {
|
|
|
1351
1313
|
}
|
|
1352
1314
|
//#endregion
|
|
1353
1315
|
//#region src/components/media/MediaGrid.vue?vue&type=script&setup=true&lang.ts
|
|
1354
|
-
var
|
|
1316
|
+
var wt = { class: "tpl:p-4" }, Tt = {
|
|
1355
1317
|
key: 1,
|
|
1356
1318
|
class: "tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:py-16"
|
|
1357
|
-
},
|
|
1319
|
+
}, Et = {
|
|
1358
1320
|
class: "tpl:text-xs",
|
|
1359
1321
|
style: { color: "var(--tpl-text-muted)" }
|
|
1360
|
-
},
|
|
1322
|
+
}, Dt = {
|
|
1361
1323
|
key: 2,
|
|
1362
1324
|
class: "tpl:grid tpl:grid-cols-4 tpl:gap-3"
|
|
1363
|
-
},
|
|
1325
|
+
}, Ot = [
|
|
1326
|
+
"data-media-id",
|
|
1327
|
+
"onClick",
|
|
1328
|
+
"onDblclick"
|
|
1329
|
+
], kt = { class: "tpl:aspect-square" }, At = ["src", "alt"], jt = { class: "tpl:px-2 tpl:py-1.5" }, Mt = {
|
|
1364
1330
|
class: "tpl:truncate tpl:text-[10px] tpl:font-medium",
|
|
1365
1331
|
style: { color: "var(--tpl-text)" }
|
|
1366
|
-
},
|
|
1332
|
+
}, Nt = {
|
|
1367
1333
|
class: "tpl:flex tpl:justify-between tpl:text-[9px]",
|
|
1368
1334
|
style: { color: "var(--tpl-text-muted)" }
|
|
1369
|
-
},
|
|
1335
|
+
}, Pt = { key: 0 }, Ft = { key: 1 }, It = { class: "tpl:absolute tpl:top-1.5 tpl:left-1.5 tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Lt = ["title", "onClick"], Rt = ["title", "onClick"], zt = {
|
|
1370
1336
|
key: 0,
|
|
1371
1337
|
class: "tpl:absolute tpl:top-1.5 tpl:right-1.5 tpl:flex tpl:size-5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1372
1338
|
style: { "background-color": "var(--tpl-primary)" }
|
|
1373
|
-
},
|
|
1339
|
+
}, Bt = {
|
|
1374
1340
|
key: 3,
|
|
1375
1341
|
class: "tpl:flex tpl:flex-col tpl:gap-1"
|
|
1376
|
-
},
|
|
1342
|
+
}, Vt = [
|
|
1343
|
+
"data-media-id",
|
|
1344
|
+
"onClick",
|
|
1345
|
+
"onDblclick"
|
|
1346
|
+
], Ht = {
|
|
1377
1347
|
class: "tpl:size-10 tpl:shrink-0 tpl:overflow-hidden tpl:rounded",
|
|
1378
1348
|
style: { "background-color": "var(--tpl-bg-hover)" }
|
|
1379
|
-
},
|
|
1349
|
+
}, Ut = ["src", "alt"], Wt = {
|
|
1380
1350
|
key: 1,
|
|
1381
1351
|
class: "tpl-list-icon tpl:size-full"
|
|
1382
|
-
},
|
|
1352
|
+
}, Gt = { class: "tpl:min-w-0 tpl:flex-1" }, Kt = {
|
|
1383
1353
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1384
1354
|
style: { color: "var(--tpl-text)" }
|
|
1385
|
-
},
|
|
1355
|
+
}, qt = {
|
|
1386
1356
|
class: "tpl:text-[10px]",
|
|
1387
1357
|
style: { color: "var(--tpl-text-muted)" }
|
|
1388
|
-
},
|
|
1358
|
+
}, Jt = { class: "tpl:flex tpl:gap-1 tpl:opacity-0 tpl:transition-opacity tpl:duration-150 tpl:group-hover:opacity-100" }, Yt = ["title", "onClick"], Xt = ["title", "onClick"], Zt = {
|
|
1389
1359
|
key: 0,
|
|
1390
1360
|
class: "tpl:flex tpl:size-5 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1391
1361
|
style: { "background-color": "var(--tpl-primary)" }
|
|
1392
|
-
},
|
|
1362
|
+
}, Qt = {
|
|
1393
1363
|
key: 4,
|
|
1394
1364
|
class: "tpl:flex tpl:justify-center tpl:py-4"
|
|
1395
|
-
},
|
|
1365
|
+
}, $t = /*#__PURE__*/ st(/* @__PURE__ */ d({
|
|
1396
1366
|
__name: "MediaGrid",
|
|
1397
1367
|
props: {
|
|
1398
1368
|
items: {},
|
|
@@ -1400,158 +1370,202 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1400
1370
|
isLoading: { type: Boolean },
|
|
1401
1371
|
hasMore: { type: Boolean },
|
|
1402
1372
|
accept: {},
|
|
1403
|
-
layout: {}
|
|
1373
|
+
layout: {},
|
|
1374
|
+
searchQuery: {},
|
|
1375
|
+
canUpdate: { type: Boolean },
|
|
1376
|
+
canReplace: { type: Boolean }
|
|
1404
1377
|
},
|
|
1405
1378
|
emits: [
|
|
1406
1379
|
"select",
|
|
1407
1380
|
"toggle",
|
|
1408
1381
|
"loadMore",
|
|
1409
1382
|
"edit",
|
|
1410
|
-
"replace"
|
|
1383
|
+
"replace",
|
|
1384
|
+
"confirm"
|
|
1411
1385
|
],
|
|
1412
|
-
setup(
|
|
1413
|
-
let
|
|
1414
|
-
function
|
|
1415
|
-
return
|
|
1386
|
+
setup(t, { emit: n }) {
|
|
1387
|
+
let r = t, i = n, { isAcceptedMimeType: d, isImageMimeType: f } = $();
|
|
1388
|
+
function m(e) {
|
|
1389
|
+
return e.mimeType ?? "";
|
|
1390
|
+
}
|
|
1391
|
+
function _(e) {
|
|
1392
|
+
return e.thumbnailUrl ?? e.url;
|
|
1393
|
+
}
|
|
1394
|
+
function y(e) {
|
|
1395
|
+
return !r.accept || r.accept.length === 0 || d(m(e), r.accept);
|
|
1416
1396
|
}
|
|
1417
|
-
function
|
|
1418
|
-
r
|
|
1397
|
+
function S(e) {
|
|
1398
|
+
return r.canUpdate === !0 && e.canUpdate !== !1;
|
|
1419
1399
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1400
|
+
function w(e) {
|
|
1401
|
+
return r.canReplace === !0 && e.canUpdate !== !1;
|
|
1402
|
+
}
|
|
1403
|
+
function T(e, t) {
|
|
1404
|
+
if (t.metaKey || t.ctrlKey) {
|
|
1405
|
+
i("toggle", e.id);
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
i("select", e);
|
|
1409
|
+
}
|
|
1410
|
+
function D(e) {
|
|
1411
|
+
y(e) && i("confirm", e);
|
|
1412
|
+
}
|
|
1413
|
+
let { t: O } = Q(), k = p(me, null), A = b(null);
|
|
1414
|
+
X(A, ([{ isIntersecting: e }]) => {
|
|
1415
|
+
e && r.hasMore && !r.isLoading && i("loadMore");
|
|
1423
1416
|
}, { threshold: .1 });
|
|
1424
|
-
function
|
|
1417
|
+
function j(e) {
|
|
1425
1418
|
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
1426
1419
|
}
|
|
1427
|
-
function
|
|
1428
|
-
return
|
|
1420
|
+
function P(e) {
|
|
1421
|
+
return Ct(e, k?.value, {
|
|
1429
1422
|
year: "numeric",
|
|
1430
1423
|
month: "short",
|
|
1431
1424
|
day: "numeric"
|
|
1432
1425
|
});
|
|
1433
1426
|
}
|
|
1434
|
-
return (
|
|
1435
|
-
|
|
1427
|
+
return (n, r) => (v(), s("div", wt, [
|
|
1428
|
+
t.isLoading && t.items.length === 0 ? (v(), s("div", {
|
|
1436
1429
|
key: 0,
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1430
|
+
role: "status",
|
|
1431
|
+
"aria-busy": "true",
|
|
1432
|
+
class: h(t.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
|
|
1433
|
+
}, [(v(), s(e, null, x(8, (e) => c("div", {
|
|
1434
|
+
key: e,
|
|
1435
|
+
class: h(["tpl-pulse tpl:rounded-lg", t.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
|
|
1436
|
+
style: { "background-color": "var(--tpl-bg-hover)" },
|
|
1437
|
+
"aria-hidden": "true"
|
|
1438
|
+
}, null, 2)), 64))], 2)) : t.items.length === 0 ? (v(), s("div", Tt, [u(E(I), {
|
|
1443
1439
|
class: "tpl:mb-3",
|
|
1444
1440
|
size: 40,
|
|
1445
1441
|
"stroke-width": 1,
|
|
1446
1442
|
style: { color: "var(--tpl-text-dim)" }
|
|
1447
|
-
}),
|
|
1448
|
-
key:
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1443
|
+
}), c("p", Et, C(t.searchQuery ? E(O).mediaLibrary.noSearchResults : E(O).mediaLibrary.noFiles), 1)])) : t.layout === "list" ? (v(), s("div", Bt, [(v(!0), s(e, null, x(t.items, (n) => (v(), s("div", {
|
|
1444
|
+
key: n.id,
|
|
1445
|
+
"data-testid": "media-library-item",
|
|
1446
|
+
class: h(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!y(n) && !t.selectedIds.has(n.id) ? "tpl:opacity-60" : ""]]),
|
|
1447
|
+
"data-media-id": n.id,
|
|
1448
|
+
style: g({ backgroundColor: t.selectedIds.has(n.id) ? "var(--tpl-bg-hover)" : "transparent" }),
|
|
1449
|
+
onClick: (e) => T(n, e),
|
|
1450
|
+
onDblclick: (e) => D(n)
|
|
1452
1451
|
}, [
|
|
1453
|
-
|
|
1452
|
+
c("div", Ht, [E(f)(m(n)) ? (v(), s("img", {
|
|
1454
1453
|
key: 0,
|
|
1455
|
-
src:
|
|
1456
|
-
alt:
|
|
1454
|
+
src: _(n),
|
|
1455
|
+
alt: n.filename || n.url,
|
|
1457
1456
|
class: "tpl:size-full tpl:object-cover",
|
|
1458
1457
|
loading: "lazy"
|
|
1459
|
-
}, null, 8,
|
|
1460
|
-
|
|
1461
|
-
|
|
1458
|
+
}, null, 8, Ut)) : (v(), s("div", Wt, [u(St, { "mime-type": m(n) }, null, 8, ["mime-type"])]))]),
|
|
1459
|
+
c("div", Gt, [c("p", Kt, C(n.filename || n.url), 1), c("p", qt, [
|
|
1460
|
+
n.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(C(j(n.size)), 1)], 64)),
|
|
1461
|
+
n.createdAt ? (v(), s(e, { key: 1 }, [n.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(" · ")], 64)), l(" " + C(P(n.createdAt)), 1)], 64)) : o("", !0),
|
|
1462
|
+
E(f)(m(n)) && n.width && n.height ? (v(), s(e, { key: 2 }, [l(" · " + C(n.width) + "×" + C(n.height), 1)], 64)) : o("", !0)
|
|
1463
|
+
])]),
|
|
1464
|
+
c("div", Jt, [S(n) ? (v(), s("button", {
|
|
1465
|
+
key: 0,
|
|
1466
|
+
"data-testid": "media-edit",
|
|
1462
1467
|
class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
|
|
1463
1468
|
style: { color: "var(--tpl-text-muted)" },
|
|
1464
|
-
title:
|
|
1465
|
-
onClick:
|
|
1466
|
-
}, [
|
|
1469
|
+
title: E(O).mediaLibrary.editFile,
|
|
1470
|
+
onClick: M((e) => i("edit", n), ["stop"])
|
|
1471
|
+
}, [u(E(U), {
|
|
1467
1472
|
size: 12,
|
|
1468
1473
|
"stroke-width": 2
|
|
1469
|
-
})], 8,
|
|
1474
|
+
})], 8, Yt)) : o("", !0), w(n) ? (v(), s("button", {
|
|
1475
|
+
key: 1,
|
|
1476
|
+
"data-testid": "media-replace",
|
|
1470
1477
|
class: "tpl:flex tpl:size-6 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded",
|
|
1471
1478
|
style: { color: "var(--tpl-text-muted)" },
|
|
1472
|
-
title:
|
|
1473
|
-
onClick:
|
|
1474
|
-
}, [
|
|
1479
|
+
title: E(O).mediaLibrary.replaceFile,
|
|
1480
|
+
onClick: M((e) => i("replace", n), ["stop"])
|
|
1481
|
+
}, [u(E(G), {
|
|
1475
1482
|
size: 12,
|
|
1476
1483
|
"stroke-width": 2
|
|
1477
|
-
})], 8,
|
|
1478
|
-
|
|
1484
|
+
})], 8, Xt)) : o("", !0)]),
|
|
1485
|
+
t.selectedIds.has(n.id) ? (v(), s("div", Zt, [u(E(N), {
|
|
1479
1486
|
size: 12,
|
|
1480
1487
|
"stroke-width": 3
|
|
1481
|
-
})])) :
|
|
1482
|
-
],
|
|
1483
|
-
key:
|
|
1484
|
-
|
|
1488
|
+
})])) : o("", !0)
|
|
1489
|
+
], 46, Vt))), 128))])) : (v(), s("div", Dt, [(v(!0), s(e, null, x(t.items, (e) => (v(), s("div", {
|
|
1490
|
+
key: e.id,
|
|
1491
|
+
"data-testid": "media-library-item",
|
|
1492
|
+
class: h(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
|
|
1485
1493
|
"tpl:cursor-pointer",
|
|
1486
|
-
!
|
|
1487
|
-
|
|
1494
|
+
!y(e) && !t.selectedIds.has(e.id) ? "tpl:opacity-60" : "",
|
|
1495
|
+
t.selectedIds.has(e.id) ? "tpl-media-item--selected" : ""
|
|
1488
1496
|
]]),
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1497
|
+
"data-media-id": e.id,
|
|
1498
|
+
style: g({
|
|
1499
|
+
borderColor: t.selectedIds.has(e.id) ? "var(--tpl-primary)" : "transparent",
|
|
1500
|
+
backgroundColor: !y(e) && !t.selectedIds.has(e.id) ? "var(--tpl-bg)" : "var(--tpl-bg-hover)"
|
|
1492
1501
|
}),
|
|
1493
|
-
onClick: (
|
|
1502
|
+
onClick: (t) => T(e, t),
|
|
1503
|
+
onDblclick: (t) => D(e)
|
|
1494
1504
|
}, [
|
|
1495
|
-
|
|
1505
|
+
c("div", kt, [E(f)(m(e)) ? (v(), s("img", {
|
|
1496
1506
|
key: 0,
|
|
1497
|
-
src:
|
|
1498
|
-
alt:
|
|
1507
|
+
src: _(e),
|
|
1508
|
+
alt: e.filename || e.url,
|
|
1499
1509
|
class: "tpl:size-full tpl:object-cover",
|
|
1500
1510
|
loading: "lazy"
|
|
1501
|
-
}, null, 8,
|
|
1511
|
+
}, null, 8, At)) : (v(), a(St, {
|
|
1502
1512
|
key: 1,
|
|
1503
|
-
"mime-type":
|
|
1513
|
+
"mime-type": m(e)
|
|
1504
1514
|
}, null, 8, ["mime-type"]))]),
|
|
1505
|
-
|
|
1506
|
-
|
|
1515
|
+
c("div", jt, [c("p", Mt, C(e.filename || e.url), 1), c("p", Nt, [e.size == null ? o("", !0) : (v(), s("span", Pt, C(j(e.size)), 1)), E(f)(m(e)) && e.width && e.height ? (v(), s("span", Ft, C(e.width) + "×" + C(e.height), 1)) : o("", !0)])]),
|
|
1516
|
+
c("div", It, [S(e) ? (v(), s("button", {
|
|
1517
|
+
key: 0,
|
|
1518
|
+
"data-testid": "media-edit",
|
|
1507
1519
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1508
1520
|
style: { "background-color": "rgba(0, 0, 0, 0.6)" },
|
|
1509
|
-
title:
|
|
1510
|
-
onClick:
|
|
1511
|
-
}, [
|
|
1521
|
+
title: E(O).mediaLibrary.editFile,
|
|
1522
|
+
onClick: M((t) => i("edit", e), ["stop"])
|
|
1523
|
+
}, [u(E(U), {
|
|
1512
1524
|
size: 11,
|
|
1513
1525
|
"stroke-width": 2
|
|
1514
|
-
})], 8,
|
|
1526
|
+
})], 8, Lt)) : o("", !0), w(e) ? (v(), s("button", {
|
|
1527
|
+
key: 1,
|
|
1528
|
+
"data-testid": "media-replace",
|
|
1515
1529
|
class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-white",
|
|
1516
1530
|
style: { "background-color": "rgba(0, 0, 0, 0.6)" },
|
|
1517
|
-
title:
|
|
1518
|
-
onClick:
|
|
1519
|
-
}, [
|
|
1531
|
+
title: E(O).mediaLibrary.replaceFile,
|
|
1532
|
+
onClick: M((t) => i("replace", e), ["stop"])
|
|
1533
|
+
}, [u(E(G), {
|
|
1520
1534
|
size: 11,
|
|
1521
1535
|
"stroke-width": 2
|
|
1522
|
-
})], 8,
|
|
1523
|
-
|
|
1536
|
+
})], 8, Rt)) : o("", !0)]),
|
|
1537
|
+
t.selectedIds.has(e.id) ? (v(), s("div", zt, [u(E(N), {
|
|
1524
1538
|
size: 12,
|
|
1525
1539
|
"stroke-width": 3
|
|
1526
|
-
})])) :
|
|
1527
|
-
],
|
|
1528
|
-
|
|
1540
|
+
})])) : o("", !0)
|
|
1541
|
+
], 46, Ot))), 128))])),
|
|
1542
|
+
c("div", {
|
|
1529
1543
|
ref_key: "sentinelRef",
|
|
1530
|
-
ref:
|
|
1544
|
+
ref: A,
|
|
1531
1545
|
class: "tpl:h-4"
|
|
1532
1546
|
}, null, 512),
|
|
1533
|
-
|
|
1547
|
+
t.isLoading && t.items.length > 0 ? (v(), s("div", Qt, [u(E(V), {
|
|
1534
1548
|
class: "tpl-spinner",
|
|
1535
1549
|
size: 20,
|
|
1536
1550
|
"stroke-width": 2,
|
|
1537
1551
|
style: { color: "var(--tpl-primary)" }
|
|
1538
|
-
})])) :
|
|
1552
|
+
})])) : o("", !0)
|
|
1539
1553
|
]));
|
|
1540
1554
|
}
|
|
1541
|
-
}), [["__scopeId", "data-v-
|
|
1555
|
+
}), [["__scopeId", "data-v-02bd861d"]]), en = ["data-tpl-theme"], tn = {
|
|
1542
1556
|
class: "tpl:max-h-[90%] tpl:w-full tpl:max-w-sm tpl:overflow-y-auto tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
|
|
1543
1557
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
1544
|
-
},
|
|
1558
|
+
}, nn = {
|
|
1545
1559
|
class: "tpl:mb-4 tpl:text-sm tpl:font-semibold",
|
|
1546
1560
|
style: { color: "var(--tpl-text)" }
|
|
1547
|
-
},
|
|
1561
|
+
}, rn = { class: "tpl:mb-3" }, an = ["placeholder", "disabled"], on = {
|
|
1548
1562
|
key: 0,
|
|
1549
1563
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1550
1564
|
style: { color: "var(--tpl-danger)" }
|
|
1551
|
-
},
|
|
1565
|
+
}, sn = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, cn = ["disabled"], ln = ["disabled"], un = {
|
|
1552
1566
|
key: 0,
|
|
1553
1567
|
class: "tpl:flex tpl:items-center tpl:gap-1.5"
|
|
1554
|
-
},
|
|
1568
|
+
}, dn = { key: 1 }, fn = /* @__PURE__ */ d({
|
|
1555
1569
|
__name: "MediaImportUrlModal",
|
|
1556
1570
|
props: {
|
|
1557
1571
|
visible: { type: Boolean },
|
|
@@ -1559,22 +1573,22 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1559
1573
|
error: {}
|
|
1560
1574
|
},
|
|
1561
1575
|
emits: ["import", "close"],
|
|
1562
|
-
setup(e, { emit:
|
|
1563
|
-
let
|
|
1564
|
-
|
|
1565
|
-
e && (
|
|
1576
|
+
setup(e, { emit: r }) {
|
|
1577
|
+
let i = e, d = r, { t: f } = Q(), m = p(Z, null), g = p(fe, b(null)), _ = b("");
|
|
1578
|
+
O(() => i.visible, (e) => {
|
|
1579
|
+
e && (_.value = "");
|
|
1566
1580
|
});
|
|
1567
|
-
function
|
|
1568
|
-
let e =
|
|
1569
|
-
e && !
|
|
1581
|
+
function y() {
|
|
1582
|
+
let e = _.value.trim();
|
|
1583
|
+
e && !i.isImporting && d("import", e);
|
|
1570
1584
|
}
|
|
1571
|
-
function
|
|
1572
|
-
|
|
1585
|
+
function x() {
|
|
1586
|
+
i.isImporting || d("close");
|
|
1573
1587
|
}
|
|
1574
|
-
function
|
|
1575
|
-
e.key === "Enter" && (e.preventDefault(),
|
|
1588
|
+
function S(e) {
|
|
1589
|
+
e.key === "Enter" && (e.preventDefault(), y()), e.key === "Escape" && x();
|
|
1576
1590
|
}
|
|
1577
|
-
return (
|
|
1591
|
+
return (r, i) => (v(), a(t, { to: E(g) || "body" }, [u(n, {
|
|
1578
1592
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
1579
1593
|
"enter-from-class": "tpl:opacity-0",
|
|
1580
1594
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -1582,17 +1596,17 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1582
1596
|
"leave-from-class": "tpl:opacity-100",
|
|
1583
1597
|
"leave-to-class": "tpl:opacity-0"
|
|
1584
1598
|
}, {
|
|
1585
|
-
default:
|
|
1599
|
+
default: k(() => [e.visible ? (v(), s("div", {
|
|
1586
1600
|
key: 0,
|
|
1587
|
-
"data-tpl-theme":
|
|
1588
|
-
class: "tpl tpl:fixed tpl:inset-0 tpl:z-
|
|
1601
|
+
"data-tpl-theme": E(m),
|
|
1602
|
+
class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
1589
1603
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
1590
|
-
onClick:
|
|
1591
|
-
onKeydown:
|
|
1592
|
-
}, [
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
"onUpdate:modelValue":
|
|
1604
|
+
onClick: M(x, ["self"]),
|
|
1605
|
+
onKeydown: S
|
|
1606
|
+
}, [c("div", tn, [
|
|
1607
|
+
c("h3", nn, C(E(f).mediaLibrary.importFromUrl), 1),
|
|
1608
|
+
c("div", rn, [A(c("input", {
|
|
1609
|
+
"onUpdate:modelValue": i[0] ||= (e) => _.value = e,
|
|
1596
1610
|
type: "url",
|
|
1597
1611
|
class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:outline-none",
|
|
1598
1612
|
style: {
|
|
@@ -1600,59 +1614,59 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1600
1614
|
"background-color": "var(--tpl-bg)",
|
|
1601
1615
|
color: "var(--tpl-text)"
|
|
1602
1616
|
},
|
|
1603
|
-
placeholder:
|
|
1617
|
+
placeholder: E(f).mediaLibrary.importUrlPlaceholder,
|
|
1604
1618
|
disabled: e.isImporting,
|
|
1605
1619
|
autofocus: ""
|
|
1606
|
-
}, null, 8,
|
|
1607
|
-
e.error ? (
|
|
1608
|
-
|
|
1609
|
-
class:
|
|
1620
|
+
}, null, 8, an), [[D, _.value]])]),
|
|
1621
|
+
e.error ? (v(), s("p", on, C(e.error), 1)) : o("", !0),
|
|
1622
|
+
c("div", sn, [c("button", {
|
|
1623
|
+
class: h(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": e.isImporting }]),
|
|
1610
1624
|
style: {
|
|
1611
1625
|
"border-color": "var(--tpl-border)",
|
|
1612
1626
|
color: "var(--tpl-text)",
|
|
1613
1627
|
"background-color": "var(--tpl-bg)"
|
|
1614
1628
|
},
|
|
1615
1629
|
disabled: e.isImporting,
|
|
1616
|
-
onClick:
|
|
1617
|
-
},
|
|
1630
|
+
onClick: x
|
|
1631
|
+
}, C(E(f).mediaLibrary.cancel), 11, cn), c("button", {
|
|
1618
1632
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
1619
1633
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
1620
|
-
disabled: !
|
|
1621
|
-
onClick:
|
|
1622
|
-
}, [e.isImporting ? (
|
|
1634
|
+
disabled: !_.value.trim() || e.isImporting,
|
|
1635
|
+
onClick: y
|
|
1636
|
+
}, [e.isImporting ? (v(), s("span", un, [u(E(V), {
|
|
1623
1637
|
class: "tpl:animate-spin",
|
|
1624
1638
|
size: 12,
|
|
1625
1639
|
"stroke-width": 2
|
|
1626
|
-
}),
|
|
1627
|
-
])], 40,
|
|
1640
|
+
}), l(" " + C(E(f).mediaLibrary.importing), 1)])) : (v(), s("span", dn, C(E(f).mediaLibrary.import), 1))], 8, ln)])
|
|
1641
|
+
])], 40, en)) : o("", !0)]),
|
|
1628
1642
|
_: 1
|
|
1629
1643
|
})], 8, ["to"]));
|
|
1630
1644
|
}
|
|
1631
|
-
}),
|
|
1645
|
+
}), pn = { class: "tpl:max-h-56 tpl:overflow-y-auto tpl:py-1" }, mn = ["disabled", "onClick"], hn = { class: "tpl:truncate" }, gn = {
|
|
1632
1646
|
key: 0,
|
|
1633
1647
|
class: "tpl:shrink-0",
|
|
1634
1648
|
style: { color: "var(--tpl-text-dim)" }
|
|
1635
|
-
},
|
|
1649
|
+
}, _n = /* @__PURE__ */ d({
|
|
1636
1650
|
__name: "MediaMovePicker",
|
|
1637
1651
|
props: {
|
|
1638
1652
|
folders: {},
|
|
1639
1653
|
currentFolderId: {}
|
|
1640
1654
|
},
|
|
1641
1655
|
emits: ["select", "close"],
|
|
1642
|
-
setup(
|
|
1643
|
-
let
|
|
1644
|
-
function
|
|
1656
|
+
setup(t, { emit: n }) {
|
|
1657
|
+
let r = n, { t: i } = Q(), a = b(null);
|
|
1658
|
+
function d(e, t = 0) {
|
|
1645
1659
|
let n = [];
|
|
1646
1660
|
for (let r of e) n.push({
|
|
1647
1661
|
id: r.id,
|
|
1648
1662
|
name: r.name,
|
|
1649
1663
|
depth: t
|
|
1650
|
-
}), r.children
|
|
1664
|
+
}), r.children.length && n.push(...d(r.children, t + 1));
|
|
1651
1665
|
return n;
|
|
1652
1666
|
}
|
|
1653
|
-
return
|
|
1654
|
-
|
|
1655
|
-
}), (
|
|
1667
|
+
return J(a, () => {
|
|
1668
|
+
r("close");
|
|
1669
|
+
}), (n, f) => (v(), s("div", {
|
|
1656
1670
|
ref_key: "pickerRef",
|
|
1657
1671
|
ref: a,
|
|
1658
1672
|
class: "tpl:absolute tpl:bottom-full tpl:left-0 tpl:z-10 tpl:mb-2 tpl:w-56 tpl:overflow-hidden tpl:rounded-lg tpl:border tpl:shadow-lg",
|
|
@@ -1660,193 +1674,139 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1660
1674
|
"border-color": "var(--tpl-border)",
|
|
1661
1675
|
"background-color": "var(--tpl-bg-elevated)"
|
|
1662
1676
|
}
|
|
1663
|
-
}, [
|
|
1677
|
+
}, [c("div", pn, [t.currentFolderId === null ? o("", !0) : (v(), s("button", {
|
|
1664
1678
|
key: 0,
|
|
1665
1679
|
class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
|
|
1666
1680
|
style: { color: "var(--tpl-text)" },
|
|
1667
|
-
onClick:
|
|
1668
|
-
}, [
|
|
1681
|
+
onClick: f[0] ||= (e) => r("select", null)
|
|
1682
|
+
}, [u(E(I), {
|
|
1669
1683
|
class: "tpl:shrink-0",
|
|
1670
1684
|
size: 14,
|
|
1671
1685
|
"stroke-width": 1.5
|
|
1672
|
-
}),
|
|
1673
|
-
key:
|
|
1686
|
+
}), l(" " + C(E(i).mediaLibrary.moveToRoot), 1)])), (v(!0), s(e, null, x(d(t.folders), (e) => (v(), s("button", {
|
|
1687
|
+
key: e.id,
|
|
1674
1688
|
class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:py-1.5 tpl:pr-3 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
|
|
1675
|
-
style:
|
|
1676
|
-
paddingLeft: `${
|
|
1677
|
-
color:
|
|
1678
|
-
opacity:
|
|
1689
|
+
style: g({
|
|
1690
|
+
paddingLeft: `${e.depth * 16 + 12}px`,
|
|
1691
|
+
color: e.id === t.currentFolderId ? "var(--tpl-text-dim)" : "var(--tpl-text)",
|
|
1692
|
+
opacity: e.id === t.currentFolderId ? .5 : 1
|
|
1679
1693
|
}),
|
|
1680
|
-
disabled:
|
|
1681
|
-
onClick: (
|
|
1694
|
+
disabled: e.id === t.currentFolderId,
|
|
1695
|
+
onClick: (t) => r("select", e.id)
|
|
1682
1696
|
}, [
|
|
1683
|
-
|
|
1697
|
+
u(E(L), {
|
|
1684
1698
|
class: "tpl:shrink-0",
|
|
1685
1699
|
size: 14,
|
|
1686
1700
|
"stroke-width": 1.5
|
|
1687
1701
|
}),
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
], 12,
|
|
1702
|
+
c("span", hn, C(e.name), 1),
|
|
1703
|
+
e.id === t.currentFolderId ? (v(), s("span", gn, C(E(i).mediaLibrary.currentFolder), 1)) : o("", !0)
|
|
1704
|
+
], 12, mn))), 128))])], 512));
|
|
1691
1705
|
}
|
|
1692
|
-
}),
|
|
1706
|
+
}), vn = { class: "tpl:flex tpl:items-center tpl:gap-3" }, yn = ["src", "alt"], bn = {
|
|
1693
1707
|
key: 1,
|
|
1694
1708
|
class: "tpl:flex tpl:size-10 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:overflow-hidden tpl:rounded",
|
|
1695
1709
|
style: { border: "1px solid var(--tpl-border)" }
|
|
1696
|
-
},
|
|
1710
|
+
}, xn = { class: "tpl:min-w-0 tpl:flex-1" }, Sn = {
|
|
1697
1711
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1698
1712
|
style: { color: "var(--tpl-text)" }
|
|
1699
|
-
},
|
|
1713
|
+
}, Cn = {
|
|
1700
1714
|
class: "tpl:mt-0.5 tpl:text-[10px]",
|
|
1701
1715
|
style: { color: "var(--tpl-text-muted)" }
|
|
1702
|
-
},
|
|
1703
|
-
key: 2,
|
|
1704
|
-
class: "tpl:shrink-0"
|
|
1705
|
-
}, On = {
|
|
1706
|
-
class: "tpl:block tpl:text-[10px]",
|
|
1707
|
-
style: { color: "var(--tpl-text-muted)" }
|
|
1708
|
-
}, kn = ["value"], An = ["value"], jn = /*#__PURE__*/ dt(/* @__PURE__ */ h({
|
|
1716
|
+
}, wn = /*#__PURE__*/ st(/* @__PURE__ */ d({
|
|
1709
1717
|
__name: "MediaPreviewPanel",
|
|
1710
1718
|
props: {
|
|
1711
1719
|
item: {},
|
|
1712
|
-
folders: {}
|
|
1713
|
-
selectedConversion: {}
|
|
1720
|
+
folders: {}
|
|
1714
1721
|
},
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
if (!C.value || !n.item.conversions_generated) return [];
|
|
1719
|
-
let e = [];
|
|
1720
|
-
return n.item.small_url && e.push({
|
|
1721
|
-
value: "small",
|
|
1722
|
-
label: a.mediaLibrary.conversionSmall,
|
|
1723
|
-
url: n.item.small_url
|
|
1724
|
-
}), n.item.medium_url && e.push({
|
|
1725
|
-
value: "medium",
|
|
1726
|
-
label: a.mediaLibrary.conversionMedium,
|
|
1727
|
-
url: n.item.medium_url
|
|
1728
|
-
}), n.item.large_url && e.push({
|
|
1729
|
-
value: "large",
|
|
1730
|
-
label: a.mediaLibrary.conversionLarge,
|
|
1731
|
-
url: n.item.large_url
|
|
1732
|
-
}), e.push({
|
|
1733
|
-
value: "original",
|
|
1734
|
-
label: a.mediaLibrary.conversionOriginal,
|
|
1735
|
-
url: n.item.url
|
|
1736
|
-
}), e;
|
|
1737
|
-
}), h = s(() => C.value && l.value.length > 1), g = s(() => {
|
|
1738
|
-
if (!C.value) return null;
|
|
1739
|
-
switch (n.selectedConversion) {
|
|
1740
|
-
case "small": return n.item.small_url || n.item.url;
|
|
1741
|
-
case "medium": return n.item.medium_url || n.item.url;
|
|
1742
|
-
case "large": return n.item.large_url || n.item.url;
|
|
1743
|
-
default: return n.item.url;
|
|
1744
|
-
}
|
|
1745
|
-
});
|
|
1746
|
-
function v(e) {
|
|
1747
|
-
let t = e.target;
|
|
1748
|
-
r("update:selectedConversion", t.value);
|
|
1749
|
-
}
|
|
1750
|
-
function b(e, t, n = []) {
|
|
1722
|
+
setup(t) {
|
|
1723
|
+
let n = t, i = p(me, null), { isImageMimeType: a } = $();
|
|
1724
|
+
function d(e, t, n = []) {
|
|
1751
1725
|
for (let r of e) {
|
|
1752
1726
|
let e = [...n, r.name];
|
|
1753
1727
|
if (r.id === t) return e;
|
|
1754
|
-
if (r.children) {
|
|
1755
|
-
let n =
|
|
1728
|
+
if (r.children.length) {
|
|
1729
|
+
let n = d(r.children, t, e);
|
|
1756
1730
|
if (n) return n;
|
|
1757
1731
|
}
|
|
1758
1732
|
}
|
|
1759
1733
|
return null;
|
|
1760
1734
|
}
|
|
1761
|
-
let
|
|
1762
|
-
if (!n.item.
|
|
1763
|
-
let e =
|
|
1735
|
+
let f = r(() => {
|
|
1736
|
+
if (!n.item.folderId || !n.folders) return null;
|
|
1737
|
+
let e = d(n.folders, n.item.folderId);
|
|
1764
1738
|
return e ? e.join("/") : null;
|
|
1765
|
-
}),
|
|
1766
|
-
function
|
|
1739
|
+
}), m = r(() => n.item.mimeType ?? ""), g = r(() => a(m.value));
|
|
1740
|
+
function _(e) {
|
|
1767
1741
|
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
1768
1742
|
}
|
|
1769
|
-
function
|
|
1770
|
-
return
|
|
1743
|
+
function y(e) {
|
|
1744
|
+
return Ct(e, i?.value, {
|
|
1771
1745
|
year: "numeric",
|
|
1772
1746
|
month: "short",
|
|
1773
1747
|
day: "numeric"
|
|
1774
1748
|
});
|
|
1775
1749
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
]),
|
|
1802
|
-
C.value ? (S(), d("p", {
|
|
1803
|
-
key: 0,
|
|
1804
|
-
class: y(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !e.item.alt_text }]),
|
|
1805
|
-
style: { color: "var(--tpl-text-dim)" }
|
|
1806
|
-
}, D(e.item.alt_text || "\xA0"), 3)) : u("", !0)
|
|
1750
|
+
let b = r(() => n.item.filename || n.item.url);
|
|
1751
|
+
return (n, r) => (v(), s("div", vn, [g.value ? (v(), s("img", {
|
|
1752
|
+
key: 0,
|
|
1753
|
+
src: t.item.url,
|
|
1754
|
+
alt: t.item.alt || b.value,
|
|
1755
|
+
class: "tpl:size-10 tpl:shrink-0 tpl:rounded tpl:object-cover",
|
|
1756
|
+
style: { border: "1px solid var(--tpl-border)" }
|
|
1757
|
+
}, null, 8, yn)) : (v(), s("div", bn, [u(St, {
|
|
1758
|
+
"mime-type": m.value,
|
|
1759
|
+
class: "tpl-preview-icon"
|
|
1760
|
+
}, null, 8, ["mime-type"])])), c("div", xn, [
|
|
1761
|
+
c("p", Sn, C(b.value), 1),
|
|
1762
|
+
c("p", Cn, [
|
|
1763
|
+
t.item.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(C(_(t.item.size)), 1)], 64)),
|
|
1764
|
+
t.item.createdAt ? (v(), s(e, { key: 1 }, [t.item.size == null ? o("", !0) : (v(), s(e, { key: 0 }, [l(" · ")], 64)), l(" " + C(y(t.item.createdAt)), 1)], 64)) : o("", !0),
|
|
1765
|
+
g.value && t.item.width && t.item.height ? (v(), s(e, { key: 2 }, [l(" · " + C(t.item.width) + "×" + C(t.item.height) + "px ", 1)], 64)) : o("", !0),
|
|
1766
|
+
f.value ? (v(), s(e, { key: 3 }, [
|
|
1767
|
+
r[0] ||= l(" · ", -1),
|
|
1768
|
+
u(E(L), {
|
|
1769
|
+
class: "tpl:mb-px tpl:inline",
|
|
1770
|
+
size: 9,
|
|
1771
|
+
"stroke-width": 2
|
|
1772
|
+
}),
|
|
1773
|
+
l(" " + C(f.value), 1)
|
|
1774
|
+
], 64)) : o("", !0)
|
|
1807
1775
|
]),
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
},
|
|
1815
|
-
value: e.selectedConversion,
|
|
1816
|
-
onChange: v
|
|
1817
|
-
}, [(S(!0), d(i, null, T(l.value, (e) => (S(), d("option", {
|
|
1818
|
-
key: e.value,
|
|
1819
|
-
value: e.value
|
|
1820
|
-
}, D(e.label), 9, An))), 128))], 40, kn)])) : u("", !0)
|
|
1821
|
-
]));
|
|
1776
|
+
g.value ? (v(), s("p", {
|
|
1777
|
+
key: 0,
|
|
1778
|
+
class: h(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !t.item.alt }]),
|
|
1779
|
+
style: { color: "var(--tpl-text-dim)" }
|
|
1780
|
+
}, C(t.item.alt || "\xA0"), 3)) : o("", !0)
|
|
1781
|
+
])]));
|
|
1822
1782
|
}
|
|
1823
|
-
}), [["__scopeId", "data-v-
|
|
1783
|
+
}), [["__scopeId", "data-v-c7fe5962"]]), Tn = ["data-tpl-theme"], En = {
|
|
1824
1784
|
class: "tpl:max-h-[90%] tpl:w-full tpl:max-w-sm tpl:overflow-y-auto tpl:rounded-lg tpl:p-5 tpl:shadow-xl",
|
|
1825
1785
|
style: { "background-color": "var(--tpl-bg-elevated)" }
|
|
1826
|
-
},
|
|
1786
|
+
}, Dn = {
|
|
1827
1787
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
1828
1788
|
style: { color: "var(--tpl-text)" }
|
|
1829
|
-
},
|
|
1789
|
+
}, On = {
|
|
1830
1790
|
class: "tpl:mb-2 tpl:text-xs",
|
|
1831
1791
|
style: { color: "var(--tpl-text-muted)" }
|
|
1832
|
-
},
|
|
1792
|
+
}, kn = {
|
|
1833
1793
|
key: 0,
|
|
1834
1794
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1835
1795
|
style: { color: "var(--tpl-warning)" }
|
|
1836
|
-
},
|
|
1796
|
+
}, An = {
|
|
1837
1797
|
class: "tpl:mb-3 tpl:rounded tpl:border tpl:p-2",
|
|
1838
1798
|
style: { "border-color": "var(--tpl-border)" }
|
|
1839
|
-
},
|
|
1799
|
+
}, jn = {
|
|
1840
1800
|
class: "tpl:truncate tpl:text-xs tpl:font-medium",
|
|
1841
1801
|
style: { color: "var(--tpl-text)" }
|
|
1842
|
-
},
|
|
1802
|
+
}, Mn = { class: "tpl:mb-4" }, Nn = {
|
|
1843
1803
|
class: "tpl:mb-1 tpl:block tpl:text-xs tpl:font-medium",
|
|
1844
1804
|
style: { color: "var(--tpl-text-muted)" }
|
|
1845
|
-
},
|
|
1805
|
+
}, Pn = ["accept"], Fn = {
|
|
1846
1806
|
key: 1,
|
|
1847
1807
|
class: "tpl:mb-3 tpl:text-xs",
|
|
1848
1808
|
style: { color: "var(--tpl-danger)" }
|
|
1849
|
-
},
|
|
1809
|
+
}, In = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Ln = ["disabled"], Rn = ["disabled"], zn = /* @__PURE__ */ d({
|
|
1850
1810
|
__name: "MediaReplaceModal",
|
|
1851
1811
|
props: {
|
|
1852
1812
|
visible: { type: Boolean },
|
|
@@ -1856,26 +1816,26 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1856
1816
|
error: {}
|
|
1857
1817
|
},
|
|
1858
1818
|
emits: ["replace", "close"],
|
|
1859
|
-
setup(e, { emit:
|
|
1860
|
-
let
|
|
1861
|
-
if (!
|
|
1862
|
-
let e =
|
|
1819
|
+
setup(e, { emit: i }) {
|
|
1820
|
+
let l = e, d = i, { t: f } = Q(), m = p(Z, null), h = p(fe, b(null)), g = b(null), _ = b(null), y = r(() => {
|
|
1821
|
+
if (!l.item) return "";
|
|
1822
|
+
let e = (l.item.filename ?? "").split(".");
|
|
1863
1823
|
return e.length > 1 ? e[e.length - 1].toLowerCase() : "";
|
|
1864
|
-
}),
|
|
1865
|
-
|
|
1866
|
-
e || (
|
|
1824
|
+
}), x = r(() => y.value ? `.${y.value}` : "*"), S = r(() => (l.usageInfo?.templateCount ?? 0) > 0);
|
|
1825
|
+
O(() => l.visible, (e) => {
|
|
1826
|
+
e || (_.value = null, g.value && (g.value.value = ""));
|
|
1867
1827
|
});
|
|
1868
|
-
function
|
|
1828
|
+
function w(e) {
|
|
1869
1829
|
let t = e.target;
|
|
1870
|
-
t.files && t.files.length > 0 && (
|
|
1830
|
+
t.files && t.files.length > 0 && (_.value = t.files[0]);
|
|
1871
1831
|
}
|
|
1872
|
-
function
|
|
1873
|
-
|
|
1832
|
+
function T() {
|
|
1833
|
+
_.value && d("replace", _.value);
|
|
1874
1834
|
}
|
|
1875
|
-
function
|
|
1876
|
-
e.key === "Escape" &&
|
|
1835
|
+
function D(e) {
|
|
1836
|
+
e.key === "Escape" && d("close");
|
|
1877
1837
|
}
|
|
1878
|
-
return (
|
|
1838
|
+
return (r, i) => (v(), a(t, { to: E(h) || "body" }, [u(n, {
|
|
1879
1839
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
1880
1840
|
"enter-from-class": "tpl:opacity-0",
|
|
1881
1841
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -1883,33 +1843,33 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1883
1843
|
"leave-from-class": "tpl:opacity-100",
|
|
1884
1844
|
"leave-to-class": "tpl:opacity-0"
|
|
1885
1845
|
}, {
|
|
1886
|
-
default:
|
|
1846
|
+
default: k(() => [e.visible && e.item ? (v(), s("div", {
|
|
1887
1847
|
key: 0,
|
|
1888
|
-
"data-tpl-theme":
|
|
1889
|
-
class: "tpl tpl:fixed tpl:inset-0 tpl:z-
|
|
1848
|
+
"data-tpl-theme": E(m),
|
|
1849
|
+
class: "tpl tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
1890
1850
|
style: { "background-color": "var(--tpl-overlay)" },
|
|
1891
|
-
onClick:
|
|
1892
|
-
onKeydown:
|
|
1893
|
-
}, [
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1851
|
+
onClick: i[1] ||= M((e) => d("close"), ["self"]),
|
|
1852
|
+
onKeydown: D
|
|
1853
|
+
}, [c("div", En, [
|
|
1854
|
+
c("h3", Dn, C(E(f).mediaLibrary.replaceWarningTitle), 1),
|
|
1855
|
+
c("p", On, C(E(f).mediaLibrary.replaceWarningMessage.replace("{extension}", `.${y.value}`)), 1),
|
|
1856
|
+
S.value ? (v(), s("p", kn, C(E(f).mediaLibrary.replaceWarningUsageNote.replace("{count}", e.usageInfo.templateCount.toString())), 1)) : o("", !0),
|
|
1857
|
+
c("div", An, [c("p", jn, C(e.item.filename), 1)]),
|
|
1858
|
+
c("div", Mn, [c("label", Nn, C(E(f).mediaLibrary.replaceSelectFile), 1), c("input", {
|
|
1899
1859
|
ref_key: "fileInputRef",
|
|
1900
|
-
ref:
|
|
1860
|
+
ref: g,
|
|
1901
1861
|
type: "file",
|
|
1902
|
-
accept:
|
|
1862
|
+
accept: x.value,
|
|
1903
1863
|
class: "tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs",
|
|
1904
1864
|
style: {
|
|
1905
1865
|
"border-color": "var(--tpl-border)",
|
|
1906
1866
|
"background-color": "var(--tpl-bg)",
|
|
1907
1867
|
color: "var(--tpl-text)"
|
|
1908
1868
|
},
|
|
1909
|
-
onChange:
|
|
1910
|
-
}, null, 40,
|
|
1911
|
-
e.error ? (
|
|
1912
|
-
|
|
1869
|
+
onChange: w
|
|
1870
|
+
}, null, 40, Pn)]),
|
|
1871
|
+
e.error ? (v(), s("p", Fn, C(e.error), 1)) : o("", !0),
|
|
1872
|
+
c("div", In, [c("button", {
|
|
1913
1873
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
1914
1874
|
style: {
|
|
1915
1875
|
"border-color": "var(--tpl-border)",
|
|
@@ -1917,93 +1877,94 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
1917
1877
|
"background-color": "var(--tpl-bg)"
|
|
1918
1878
|
},
|
|
1919
1879
|
disabled: e.isReplacing,
|
|
1920
|
-
onClick:
|
|
1921
|
-
},
|
|
1880
|
+
onClick: i[0] ||= (e) => d("close")
|
|
1881
|
+
}, C(E(f).mediaLibrary.cancel), 9, Ln), c("button", {
|
|
1922
1882
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white tpl:transition-all tpl:duration-150 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
1923
1883
|
style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
|
|
1924
|
-
disabled: !
|
|
1925
|
-
onClick:
|
|
1926
|
-
},
|
|
1927
|
-
])], 40,
|
|
1884
|
+
disabled: !_.value || e.isReplacing,
|
|
1885
|
+
onClick: T
|
|
1886
|
+
}, C(e.isReplacing ? E(f).mediaLibrary.replacing : E(f).mediaLibrary.replace), 9, Rn)])
|
|
1887
|
+
])], 40, Tn)) : o("", !0)]),
|
|
1928
1888
|
_: 1
|
|
1929
1889
|
})], 8, ["to"]));
|
|
1930
1890
|
}
|
|
1931
|
-
}),
|
|
1891
|
+
}), Bn = {
|
|
1932
1892
|
key: 0,
|
|
1933
1893
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
1934
|
-
},
|
|
1894
|
+
}, Vn = {
|
|
1935
1895
|
class: "tpl:text-xs",
|
|
1936
1896
|
style: { color: "var(--tpl-text-muted)" }
|
|
1937
|
-
},
|
|
1897
|
+
}, Hn = {
|
|
1938
1898
|
class: "tpl:text-xs",
|
|
1939
1899
|
style: { color: "var(--tpl-text-muted)" }
|
|
1940
|
-
},
|
|
1900
|
+
}, Un = {
|
|
1941
1901
|
class: "tpl:mt-1 tpl:text-[10px]",
|
|
1942
1902
|
style: { color: "var(--tpl-text-dim)" }
|
|
1943
|
-
},
|
|
1903
|
+
}, Wn = /* @__PURE__ */ d({
|
|
1944
1904
|
__name: "MediaUploadZone",
|
|
1945
1905
|
props: {
|
|
1946
1906
|
isUploading: { type: Boolean },
|
|
1947
1907
|
uploadProgress: {}
|
|
1948
1908
|
},
|
|
1949
1909
|
emits: ["upload"],
|
|
1950
|
-
setup(
|
|
1951
|
-
let
|
|
1952
|
-
function
|
|
1910
|
+
setup(t, { emit: n }) {
|
|
1911
|
+
let r = n, { t: i, format: a } = Q(), { allAcceptedInputString: o, isAcceptedFile: l } = $(), d = b();
|
|
1912
|
+
function f(e) {
|
|
1953
1913
|
let t = [];
|
|
1954
|
-
for (let n of Array.from(e))
|
|
1914
|
+
for (let n of Array.from(e)) l(n) && t.push(n);
|
|
1955
1915
|
return t;
|
|
1956
1916
|
}
|
|
1957
1917
|
function p(e) {
|
|
1958
|
-
let t =
|
|
1959
|
-
t.length &&
|
|
1918
|
+
let t = f(e);
|
|
1919
|
+
t.length && r("upload", t);
|
|
1960
1920
|
}
|
|
1961
|
-
let { isOverDropZone:
|
|
1921
|
+
let { isOverDropZone: m } = ae(d, { onDrop: (e) => {
|
|
1962
1922
|
e?.length && p(e);
|
|
1963
|
-
} }), { open: g, onChange: _ } =
|
|
1964
|
-
accept:
|
|
1923
|
+
} }), { open: g, onChange: _ } = se({
|
|
1924
|
+
accept: o.value,
|
|
1965
1925
|
multiple: !0
|
|
1966
1926
|
});
|
|
1967
1927
|
return _((e) => {
|
|
1968
1928
|
e?.length && p(e);
|
|
1969
|
-
}), (
|
|
1929
|
+
}), (n, r) => (v(), s("div", {
|
|
1970
1930
|
ref_key: "dropZoneRef",
|
|
1971
|
-
ref:
|
|
1972
|
-
|
|
1931
|
+
ref: d,
|
|
1932
|
+
"data-testid": "media-upload-zone",
|
|
1933
|
+
class: h(["tpl-upload-zone tpl:flex tpl:cursor-pointer tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded-lg tpl:border-2 tpl:border-dashed tpl:p-5 tpl:text-center tpl:transition-all tpl:duration-150", E(m) ? "tpl-upload-zone-active" : ""]),
|
|
1973
1934
|
style: {
|
|
1974
1935
|
"border-color": "var(--tpl-border-light)",
|
|
1975
1936
|
"background-color": "var(--tpl-bg)"
|
|
1976
1937
|
},
|
|
1977
|
-
onClick:
|
|
1978
|
-
}, [
|
|
1938
|
+
onClick: r[0] ||= (e) => E(g)()
|
|
1939
|
+
}, [t.isUploading ? (v(), s("div", Bn, [u(E(V), {
|
|
1979
1940
|
class: "tpl-spinner",
|
|
1980
1941
|
size: 20,
|
|
1981
1942
|
"stroke-width": 2,
|
|
1982
1943
|
style: { color: "var(--tpl-primary)" }
|
|
1983
|
-
}),
|
|
1984
|
-
current:
|
|
1985
|
-
total:
|
|
1986
|
-
}) :
|
|
1987
|
-
|
|
1944
|
+
}), c("span", Vn, C(t.uploadProgress && t.uploadProgress.total > 1 ? E(a)(E(i).mediaLibrary.uploadingProgress, {
|
|
1945
|
+
current: t.uploadProgress.current,
|
|
1946
|
+
total: t.uploadProgress.total
|
|
1947
|
+
}) : E(i).mediaLibrary.uploading), 1)])) : (v(), s(e, { key: 1 }, [
|
|
1948
|
+
u(E(q), {
|
|
1988
1949
|
class: "tpl:mb-2",
|
|
1989
1950
|
size: 24,
|
|
1990
1951
|
"stroke-width": 1.5,
|
|
1991
1952
|
style: { color: "var(--tpl-text-dim)" }
|
|
1992
1953
|
}),
|
|
1993
|
-
|
|
1994
|
-
|
|
1954
|
+
c("p", Hn, C(E(i).mediaLibrary.dropOrClick), 1),
|
|
1955
|
+
c("p", Un, C(E(i).mediaLibrary.acceptedFormats), 1)
|
|
1995
1956
|
], 64))], 2));
|
|
1996
1957
|
}
|
|
1997
|
-
}),
|
|
1958
|
+
}), Gn = [
|
|
1998
1959
|
"width",
|
|
1999
1960
|
"height",
|
|
2000
1961
|
"viewBox"
|
|
2001
|
-
],
|
|
1962
|
+
], Kn = [
|
|
2002
1963
|
"cx",
|
|
2003
1964
|
"cy",
|
|
2004
1965
|
"r",
|
|
2005
1966
|
"stroke-width"
|
|
2006
|
-
],
|
|
1967
|
+
], qn = [
|
|
2007
1968
|
"cx",
|
|
2008
1969
|
"cy",
|
|
2009
1970
|
"r",
|
|
@@ -2011,14 +1972,14 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
2011
1972
|
"stroke",
|
|
2012
1973
|
"stroke-dasharray",
|
|
2013
1974
|
"stroke-dashoffset"
|
|
2014
|
-
],
|
|
1975
|
+
], Jn = {
|
|
2015
1976
|
key: 0,
|
|
2016
1977
|
class: "tpl:absolute tpl:top-full tpl:left-1/2 tpl:z-50 tpl:mt-2 tpl:-translate-x-1/2 tpl:rounded-md tpl:px-2.5 tpl:py-1.5 tpl:text-xs tpl:whitespace-nowrap tpl:shadow-lg",
|
|
2017
1978
|
style: {
|
|
2018
1979
|
"background-color": "var(--tpl-text)",
|
|
2019
1980
|
color: "var(--tpl-bg-elevated)"
|
|
2020
1981
|
}
|
|
2021
|
-
},
|
|
1982
|
+
}, Yn = /* @__PURE__ */ d({
|
|
2022
1983
|
__name: "StorageProgressRing",
|
|
2023
1984
|
props: {
|
|
2024
1985
|
usedBytes: {},
|
|
@@ -2026,8 +1987,8 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
2026
1987
|
size: {}
|
|
2027
1988
|
},
|
|
2028
1989
|
setup(e) {
|
|
2029
|
-
let t = e, { t:
|
|
2030
|
-
function
|
|
1990
|
+
let t = e, { t: i, format: a } = Q(), d = b(!1), f = r(() => t.size ?? 24), p = r(() => Math.max(2, f.value / 8)), m = r(() => (f.value - p.value) / 2), h = r(() => 2 * Math.PI * m.value), g = r(() => t.limitBytes <= 0 ? 0 : Math.min(100, t.usedBytes / t.limitBytes * 100)), _ = r(() => h.value - g.value / 100 * h.value), y = r(() => g.value >= 95 ? "var(--tpl-danger)" : g.value >= 75 ? "var(--tpl-warning, #f59e0b)" : "var(--tpl-primary)");
|
|
1991
|
+
function x(e) {
|
|
2031
1992
|
if (e === 0) return "0 B";
|
|
2032
1993
|
let t = 1024, n = [
|
|
2033
1994
|
"B",
|
|
@@ -2037,39 +1998,40 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
2037
1998
|
], r = Math.floor(Math.log(e) / Math.log(t)), i = e / t ** r, a = +(r >= 2);
|
|
2038
1999
|
return `${i.toFixed(a)} ${n[r]}`;
|
|
2039
2000
|
}
|
|
2040
|
-
let
|
|
2041
|
-
used:
|
|
2042
|
-
total:
|
|
2043
|
-
remaining:
|
|
2001
|
+
let S = r(() => x(t.usedBytes)), w = r(() => x(t.limitBytes)), T = r(() => Math.max(0, t.limitBytes - t.usedBytes)), E = r(() => x(T.value)), D = r(() => a(i.mediaLibrary.storageTooltip, {
|
|
2002
|
+
used: S.value,
|
|
2003
|
+
total: w.value,
|
|
2004
|
+
remaining: E.value
|
|
2044
2005
|
}));
|
|
2045
|
-
return (e, t) => (
|
|
2006
|
+
return (e, t) => (v(), s("div", {
|
|
2007
|
+
"data-testid": "media-storage-ring",
|
|
2046
2008
|
class: "tpl:relative tpl:inline-flex tpl:cursor-help tpl:items-center tpl:justify-center",
|
|
2047
|
-
onMouseenter: t[0] ||= (e) =>
|
|
2048
|
-
onMouseleave: t[1] ||= (e) =>
|
|
2049
|
-
}, [(
|
|
2050
|
-
width:
|
|
2051
|
-
height:
|
|
2009
|
+
onMouseenter: t[0] ||= (e) => d.value = !0,
|
|
2010
|
+
onMouseleave: t[1] ||= (e) => d.value = !1
|
|
2011
|
+
}, [(v(), s("svg", {
|
|
2012
|
+
width: f.value,
|
|
2013
|
+
height: f.value,
|
|
2052
2014
|
class: "tpl:-rotate-90",
|
|
2053
|
-
viewBox: `0 0 ${
|
|
2054
|
-
}, [
|
|
2055
|
-
cx:
|
|
2056
|
-
cy:
|
|
2057
|
-
r:
|
|
2015
|
+
viewBox: `0 0 ${f.value} ${f.value}`
|
|
2016
|
+
}, [c("circle", {
|
|
2017
|
+
cx: f.value / 2,
|
|
2018
|
+
cy: f.value / 2,
|
|
2019
|
+
r: m.value,
|
|
2058
2020
|
fill: "none",
|
|
2059
|
-
"stroke-width":
|
|
2021
|
+
"stroke-width": p.value,
|
|
2060
2022
|
style: { stroke: "var(--tpl-border)" }
|
|
2061
|
-
}, null, 8,
|
|
2062
|
-
cx:
|
|
2063
|
-
cy:
|
|
2064
|
-
r:
|
|
2023
|
+
}, null, 8, Kn), c("circle", {
|
|
2024
|
+
cx: f.value / 2,
|
|
2025
|
+
cy: f.value / 2,
|
|
2026
|
+
r: m.value,
|
|
2065
2027
|
fill: "none",
|
|
2066
|
-
"stroke-width":
|
|
2067
|
-
stroke:
|
|
2028
|
+
"stroke-width": p.value,
|
|
2029
|
+
stroke: y.value,
|
|
2068
2030
|
"stroke-linecap": "round",
|
|
2069
2031
|
"stroke-dasharray": h.value,
|
|
2070
2032
|
"stroke-dashoffset": _.value,
|
|
2071
2033
|
class: "tpl:transition-all tpl:duration-300 tpl:ease-out"
|
|
2072
|
-
}, null, 8,
|
|
2034
|
+
}, null, 8, qn)], 8, Gn)), u(n, {
|
|
2073
2035
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
2074
2036
|
"enter-from-class": "tpl:opacity-0 tpl:translate-y-1",
|
|
2075
2037
|
"enter-to-class": "tpl:opacity-100 tpl:translate-y-0",
|
|
@@ -2077,58 +2039,62 @@ var Ot = { class: "tpl:p-4" }, kt = {
|
|
|
2077
2039
|
"leave-from-class": "tpl:opacity-100 tpl:translate-y-0",
|
|
2078
2040
|
"leave-to-class": "tpl:opacity-0 tpl:translate-y-1"
|
|
2079
2041
|
}, {
|
|
2080
|
-
default:
|
|
2042
|
+
default: k(() => [d.value ? (v(), s("div", Jn, [l(C(D.value) + " ", 1), t[2] ||= c("div", {
|
|
2081
2043
|
class: "tpl:absolute tpl:-top-1 tpl:left-1/2 tpl:size-2 tpl:-translate-x-1/2 tpl:rotate-45",
|
|
2082
2044
|
style: { "background-color": "var(--tpl-text)" }
|
|
2083
|
-
}, null, -1)])) :
|
|
2045
|
+
}, null, -1)])) : o("", !0)]),
|
|
2084
2046
|
_: 1
|
|
2085
2047
|
})], 32));
|
|
2086
2048
|
}
|
|
2087
2049
|
});
|
|
2088
2050
|
//#endregion
|
|
2051
|
+
//#region src/utils/treeFolders.ts
|
|
2052
|
+
function Xn(e) {
|
|
2053
|
+
let t = /* @__PURE__ */ new Map();
|
|
2054
|
+
for (let n of e) t.set(n.id, {
|
|
2055
|
+
...n,
|
|
2056
|
+
children: []
|
|
2057
|
+
});
|
|
2058
|
+
let n = [];
|
|
2059
|
+
for (let e of t.values()) {
|
|
2060
|
+
let r = e.parentId ?? null, i = r ? t.get(r) : void 0;
|
|
2061
|
+
i ? i.children.push(e) : n.push(e);
|
|
2062
|
+
}
|
|
2063
|
+
return n;
|
|
2064
|
+
}
|
|
2065
|
+
//#endregion
|
|
2089
2066
|
//#region src/composables/useMediaLibraryUI.ts
|
|
2090
|
-
function
|
|
2067
|
+
function Zn(e) {
|
|
2091
2068
|
let { library: t, translations: n } = e;
|
|
2092
|
-
function
|
|
2069
|
+
function i() {
|
|
2093
2070
|
return "value" in n && typeof n.value == "object" ? n.value : n;
|
|
2094
2071
|
}
|
|
2095
|
-
let
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
case "medium": return e.medium_url || e.url;
|
|
2101
|
-
case "large": return e.large_url || e.url;
|
|
2102
|
-
default: return e.url;
|
|
2103
|
-
}
|
|
2104
|
-
}), p = s(() => t.frequentlyUsedItems.value.length > 0), m = s(() => t.viewMode.value === "frequently-used" ? t.frequentlyUsedItems.value : t.items.value), h = s(() => Object.values(t.deleteUsageInfo.value).some((e) => e.template_count > 0)), g = {
|
|
2105
|
-
images: () => r().mediaLibrary.filterImages,
|
|
2106
|
-
documents: () => r().mediaLibrary.filterDocuments,
|
|
2107
|
-
videos: () => r().mediaLibrary.filterVideos,
|
|
2108
|
-
audio: () => r().mediaLibrary.filterAudio
|
|
2072
|
+
let a = b("grid"), o = b(!1), s = b(""), c = b(null), l = b(!1), u = b(!1), d = r(() => t.previewItem.value?.url ?? null), f = r(() => t.frequentlyUsedItems.value.length > 0), p = r(() => t.viewMode.value === "frequently-used" ? t.frequentlyUsedItems.value : t.items.value), m = r(() => Object.values(t.deleteUsageInfo.value).some((e) => e.templateCount > 0)), h = r(() => Xn(t.folders.value)), g = {
|
|
2073
|
+
images: () => i().mediaLibrary.filterImages,
|
|
2074
|
+
documents: () => i().mediaLibrary.filterDocuments,
|
|
2075
|
+
videos: () => i().mediaLibrary.filterVideos,
|
|
2076
|
+
audio: () => i().mediaLibrary.filterAudio
|
|
2109
2077
|
};
|
|
2110
2078
|
function _(e) {
|
|
2111
2079
|
return g[e]?.() ?? e;
|
|
2112
2080
|
}
|
|
2113
|
-
|
|
2081
|
+
O(o, (e) => {
|
|
2114
2082
|
e && t.loadFolders();
|
|
2115
|
-
}), j(() => t.previewItem.value?.id, () => {
|
|
2116
|
-
c.value = "original";
|
|
2117
2083
|
});
|
|
2118
|
-
let v =
|
|
2084
|
+
let v = ie((e) => {
|
|
2119
2085
|
t.search(e);
|
|
2120
2086
|
}, 300);
|
|
2121
2087
|
function y(e) {
|
|
2122
|
-
|
|
2088
|
+
s.value = e, v(e);
|
|
2123
2089
|
}
|
|
2124
|
-
let { copy:
|
|
2090
|
+
let { copy: x, copied: S } = Y({
|
|
2125
2091
|
copiedDuring: 2e3,
|
|
2126
2092
|
legacy: !0
|
|
2127
2093
|
});
|
|
2128
|
-
async function
|
|
2094
|
+
async function C(e) {
|
|
2129
2095
|
await t.uploadFiles(e);
|
|
2130
2096
|
}
|
|
2131
|
-
function
|
|
2097
|
+
function w(e) {
|
|
2132
2098
|
t.selectItem(e);
|
|
2133
2099
|
}
|
|
2134
2100
|
async function T(e, n) {
|
|
@@ -2140,17 +2106,17 @@ function rr(e) {
|
|
|
2140
2106
|
async function D(e) {
|
|
2141
2107
|
await t.deleteFolder(e);
|
|
2142
2108
|
}
|
|
2143
|
-
function
|
|
2144
|
-
|
|
2109
|
+
function k(e) {
|
|
2110
|
+
c.value = e;
|
|
2145
2111
|
}
|
|
2146
|
-
async function
|
|
2147
|
-
i && await t.replaceMediaDirectly(e, i.file), await t.updateFile(e, n, r),
|
|
2112
|
+
async function A(e, n, r, i) {
|
|
2113
|
+
i && await t.replaceMediaDirectly(e, i.file), await t.updateFile(e, n, r), c.value = null;
|
|
2148
2114
|
}
|
|
2149
|
-
async function
|
|
2150
|
-
await t.importFromUrl(e) && (
|
|
2115
|
+
async function j(e) {
|
|
2116
|
+
await t.importFromUrl(e) && (l.value = !1);
|
|
2151
2117
|
}
|
|
2152
2118
|
async function M(e) {
|
|
2153
|
-
|
|
2119
|
+
u.value = !1, await t.moveSelected(e);
|
|
2154
2120
|
}
|
|
2155
2121
|
async function N() {
|
|
2156
2122
|
await t.checkUsageBeforeDelete();
|
|
@@ -2162,32 +2128,32 @@ function rr(e) {
|
|
|
2162
2128
|
await t.replaceFile(e);
|
|
2163
2129
|
}
|
|
2164
2130
|
function I() {
|
|
2165
|
-
t.clearSelection(), t.cancelDelete(), t.cancelReplace(),
|
|
2131
|
+
t.clearSelection(), t.cancelDelete(), t.cancelReplace(), s.value = "", t.searchQuery.value = "", t.categoryFilter.value = null, t.sortOption.value = "newest", t.viewMode.value = "files", c.value = null, l.value = !1;
|
|
2166
2132
|
}
|
|
2167
2133
|
return {
|
|
2168
|
-
layoutMode:
|
|
2169
|
-
showSidebar:
|
|
2170
|
-
searchInput:
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
copy:
|
|
2180
|
-
copied:
|
|
2134
|
+
layoutMode: a,
|
|
2135
|
+
showSidebar: o,
|
|
2136
|
+
searchInput: s,
|
|
2137
|
+
editingItem: c,
|
|
2138
|
+
showImportUrlModal: l,
|
|
2139
|
+
showMovePicker: u,
|
|
2140
|
+
selectedUrl: d,
|
|
2141
|
+
hasFrequentlyUsed: f,
|
|
2142
|
+
displayItems: p,
|
|
2143
|
+
hasUsedFiles: m,
|
|
2144
|
+
folderTree: h,
|
|
2145
|
+
copy: x,
|
|
2146
|
+
copied: S,
|
|
2181
2147
|
getCategoryLabel: _,
|
|
2182
2148
|
handleSearchInput: y,
|
|
2183
|
-
handleUpload:
|
|
2184
|
-
handleSelect:
|
|
2149
|
+
handleUpload: C,
|
|
2150
|
+
handleSelect: w,
|
|
2185
2151
|
handleCreateFolder: T,
|
|
2186
2152
|
handleRenameFolder: E,
|
|
2187
2153
|
handleDeleteFolder: D,
|
|
2188
|
-
handleEditItem:
|
|
2189
|
-
handleEditSave:
|
|
2190
|
-
handleImportFromUrl:
|
|
2154
|
+
handleEditItem: k,
|
|
2155
|
+
handleEditSave: A,
|
|
2156
|
+
handleImportFromUrl: j,
|
|
2191
2157
|
handleMoveToFolder: M,
|
|
2192
2158
|
handleDeleteClick: N,
|
|
2193
2159
|
handleReplaceItem: P,
|
|
@@ -2197,39 +2163,39 @@ function rr(e) {
|
|
|
2197
2163
|
}
|
|
2198
2164
|
//#endregion
|
|
2199
2165
|
//#region src/i18n/index.ts
|
|
2200
|
-
var
|
|
2201
|
-
"./locales/ca.ts": () => import("./ca-
|
|
2202
|
-
"./locales/de.ts": () => import("./de-
|
|
2203
|
-
"./locales/en.ts": () => Promise.resolve().then(() =>
|
|
2204
|
-
"./locales/es.ts": () => import("./es-
|
|
2205
|
-
"./locales/fr.ts": () => import("./fr-
|
|
2206
|
-
"./locales/nl.ts": () => import("./nl-
|
|
2207
|
-
"./locales/pt-BR.ts": () => import("./pt-BR-
|
|
2166
|
+
var Qn = /* #__PURE__ */ Object.assign({
|
|
2167
|
+
"./locales/ca.ts": () => import("./ca-CGf3MuE2.js"),
|
|
2168
|
+
"./locales/de.ts": () => import("./de-D5ebAV5i.js"),
|
|
2169
|
+
"./locales/en.ts": () => Promise.resolve().then(() => he),
|
|
2170
|
+
"./locales/es.ts": () => import("./es-BG--QNW0.js"),
|
|
2171
|
+
"./locales/fr.ts": () => import("./fr-Mdi4AlCR.js"),
|
|
2172
|
+
"./locales/nl.ts": () => import("./nl-D-6hT8te.js"),
|
|
2173
|
+
"./locales/pt-BR.ts": () => import("./pt-BR-DMfAgDWi.js")
|
|
2208
2174
|
});
|
|
2209
|
-
function
|
|
2175
|
+
function $n(e) {
|
|
2210
2176
|
return Object.keys(e).map((e) => e.match(/\/([^/]+)\.ts$/)?.[1]).filter((e) => !!e);
|
|
2211
2177
|
}
|
|
2212
|
-
var
|
|
2213
|
-
function
|
|
2178
|
+
var er = $n(Qn);
|
|
2179
|
+
function tr(e) {
|
|
2214
2180
|
return e.trim().replace(/_/g, "-").toLowerCase();
|
|
2215
2181
|
}
|
|
2216
|
-
function
|
|
2217
|
-
let t =
|
|
2218
|
-
return
|
|
2182
|
+
function nr(e) {
|
|
2183
|
+
let t = tr(e);
|
|
2184
|
+
return er.find((e) => tr(e) === t);
|
|
2219
2185
|
}
|
|
2220
|
-
function
|
|
2221
|
-
return
|
|
2186
|
+
function rr(e) {
|
|
2187
|
+
return tr(e).split("-")[0];
|
|
2222
2188
|
}
|
|
2223
|
-
function
|
|
2224
|
-
return
|
|
2189
|
+
function ir(e) {
|
|
2190
|
+
return nr(e) ?? nr(rr(e)) ?? "en";
|
|
2225
2191
|
}
|
|
2226
|
-
async function
|
|
2227
|
-
let t =
|
|
2192
|
+
async function ar(e) {
|
|
2193
|
+
let t = Qn[`./locales/${ir(e)}.ts`];
|
|
2228
2194
|
return (await t()).default;
|
|
2229
2195
|
}
|
|
2230
2196
|
//#endregion
|
|
2231
2197
|
//#region src/components/MediaLibraryModal.vue?vue&type=script&setup=true&lang.ts
|
|
2232
|
-
var
|
|
2198
|
+
var or = ["data-tpl-theme"], sr = {
|
|
2233
2199
|
class: "tpl-media-modal tpl-scale-in tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
|
|
2234
2200
|
style: {
|
|
2235
2201
|
width: "900px",
|
|
@@ -2240,107 +2206,148 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2240
2206
|
border: "1px solid var(--tpl-border)",
|
|
2241
2207
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2242
2208
|
}
|
|
2243
|
-
},
|
|
2209
|
+
}, cr = {
|
|
2244
2210
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
|
|
2245
2211
|
style: { "border-color": "var(--tpl-border)" }
|
|
2246
|
-
},
|
|
2212
|
+
}, lr = {
|
|
2247
2213
|
class: "tpl:text-sm tpl:font-semibold",
|
|
2248
2214
|
style: { color: "var(--tpl-text)" }
|
|
2249
|
-
},
|
|
2215
|
+
}, ur = { class: "tpl:flex tpl:items-center tpl:gap-3" }, dr = { class: "tpl:relative" }, fr = [
|
|
2216
|
+
"value",
|
|
2217
|
+
"disabled",
|
|
2218
|
+
"placeholder"
|
|
2219
|
+
], pr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, mr = {
|
|
2250
2220
|
key: 0,
|
|
2251
2221
|
class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
|
|
2252
2222
|
style: {
|
|
2253
2223
|
"border-color": "var(--tpl-border)",
|
|
2254
2224
|
"background-color": "var(--tpl-bg)"
|
|
2255
2225
|
}
|
|
2256
|
-
},
|
|
2226
|
+
}, hr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, gr = {
|
|
2257
2227
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
|
|
2258
2228
|
style: { "border-color": "var(--tpl-border)" }
|
|
2259
|
-
},
|
|
2260
|
-
key:
|
|
2229
|
+
}, _r = { class: "tpl:flex tpl:items-center tpl:gap-2" }, vr = ["title"], yr = {
|
|
2230
|
+
key: 1,
|
|
2261
2231
|
class: "tpl:text-xs tpl:font-medium",
|
|
2262
2232
|
style: { color: "var(--tpl-text)" }
|
|
2263
|
-
},
|
|
2233
|
+
}, br = {
|
|
2264
2234
|
class: "tpl:flex tpl:rounded-md tpl:p-0.5",
|
|
2265
2235
|
style: {
|
|
2266
2236
|
border: "1px solid var(--tpl-border)",
|
|
2267
2237
|
"background-color": "var(--tpl-bg)"
|
|
2268
2238
|
}
|
|
2269
|
-
},
|
|
2239
|
+
}, xr = ["title"], Sr = ["title"], Cr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, wr = ["value"], Tr = { value: "" }, Er = ["value"], Dr = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, Or = {
|
|
2270
2240
|
key: 0,
|
|
2271
2241
|
class: "tpl:px-4 tpl:pt-3"
|
|
2272
|
-
},
|
|
2242
|
+
}, kr = {
|
|
2273
2243
|
class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
|
|
2274
2244
|
style: {
|
|
2275
2245
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2276
2246
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2277
2247
|
}
|
|
2278
|
-
},
|
|
2248
|
+
}, Ar = {
|
|
2279
2249
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
2280
2250
|
style: { color: "var(--tpl-text)" }
|
|
2281
|
-
},
|
|
2251
|
+
}, jr = {
|
|
2282
2252
|
key: 0,
|
|
2253
|
+
"data-testid": "media-delete-usage",
|
|
2283
2254
|
class: "tpl:mb-4 tpl:text-xs",
|
|
2284
2255
|
style: { color: "var(--tpl-text-muted)" }
|
|
2285
|
-
},
|
|
2256
|
+
}, Mr = {
|
|
2286
2257
|
key: 1,
|
|
2287
2258
|
class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
|
|
2288
2259
|
style: { "border-color": "var(--tpl-border)" }
|
|
2289
|
-
},
|
|
2260
|
+
}, Nr = { class: "tpl:font-medium" }, Pr = { style: { color: "var(--tpl-text-muted)" } }, Fr = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, Ir = {
|
|
2290
2261
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
|
|
2291
2262
|
style: { "border-color": "var(--tpl-border)" }
|
|
2292
|
-
},
|
|
2263
|
+
}, Lr = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Rr = { class: "tpl:flex tpl:items-center tpl:gap-5" }, zr = {
|
|
2293
2264
|
key: 0,
|
|
2294
2265
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
2295
|
-
},
|
|
2266
|
+
}, Br = {
|
|
2267
|
+
key: 1,
|
|
2268
|
+
class: "tpl:relative"
|
|
2269
|
+
}, Vr = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Hr = ["disabled"], Ur = /* @__PURE__ */ d({
|
|
2296
2270
|
__name: "MediaLibraryModal",
|
|
2297
2271
|
props: {
|
|
2298
2272
|
visible: { type: Boolean },
|
|
2273
|
+
provider: {},
|
|
2299
2274
|
accept: {},
|
|
2300
|
-
authManager: {},
|
|
2301
|
-
projectId: {},
|
|
2302
|
-
planConfig: {},
|
|
2303
2275
|
popoverTarget: {},
|
|
2304
2276
|
locale: {},
|
|
2305
|
-
uiTheme: {}
|
|
2277
|
+
uiTheme: {},
|
|
2278
|
+
templateId: {},
|
|
2279
|
+
onError: { type: Function }
|
|
2306
2280
|
},
|
|
2307
2281
|
emits: ["close", "select"],
|
|
2308
|
-
setup(
|
|
2309
|
-
let
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
}, { immediate: !0 }),
|
|
2313
|
-
let
|
|
2314
|
-
|
|
2315
|
-
let
|
|
2316
|
-
|
|
2317
|
-
let
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2282
|
+
setup(i, { emit: d }) {
|
|
2283
|
+
let f = i, p = d, m = b(null);
|
|
2284
|
+
O(() => f.locale, async (e) => {
|
|
2285
|
+
m.value = await ar(e ?? "en");
|
|
2286
|
+
}, { immediate: !0 }), y(pe, m);
|
|
2287
|
+
let _ = r(() => m.value), S = r(() => f.uiTheme);
|
|
2288
|
+
y(Z, S);
|
|
2289
|
+
let T = w(() => f.popoverTarget ?? null);
|
|
2290
|
+
y(fe, T), y(me, w(() => f.locale));
|
|
2291
|
+
let D = {
|
|
2292
|
+
get maxFileSize() {
|
|
2293
|
+
return f.provider.maxFileSize;
|
|
2294
|
+
},
|
|
2295
|
+
get mimeTypes() {
|
|
2296
|
+
return f.provider.mimeTypes;
|
|
2297
|
+
},
|
|
2298
|
+
get accept() {
|
|
2299
|
+
return f.accept;
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
y(de, D);
|
|
2303
|
+
let { isAcceptedMimeType: A, availableCategories: j } = $(D), P = ue({
|
|
2304
|
+
provider: f.provider,
|
|
2305
|
+
templateId: () => f.templateId,
|
|
2306
|
+
onError: (e) => f.onError?.(e)
|
|
2307
|
+
}), I = Zn({
|
|
2308
|
+
library: P,
|
|
2309
|
+
translations: _
|
|
2310
|
+
}), L = r(() => typeof f.provider.create == "function"), V = r(() => f.provider.folders !== !1), U = r(() => typeof f.provider.importFromUrl == "function"), W = r(() => typeof f.provider.delete == "function"), G = r(() => typeof f.provider.update == "function"), K = r(() => typeof f.provider.replace == "function"), te = r(() => typeof f.provider.frequentlyUsed == "function"), q = r(() => {
|
|
2311
|
+
let e = f.provider.folders;
|
|
2312
|
+
return e !== !1 && typeof e.move == "function";
|
|
2313
|
+
}), re = r(() => {
|
|
2314
|
+
let e = f.provider.folders;
|
|
2315
|
+
return e !== !1 && typeof e.create == "function";
|
|
2316
|
+
}), J = r(() => {
|
|
2317
|
+
let e = f.provider.folders;
|
|
2318
|
+
return e !== !1 && typeof e.update == "function";
|
|
2319
|
+
}), Y = r(() => {
|
|
2320
|
+
let e = f.provider.folders;
|
|
2321
|
+
return e !== !1 && typeof e.delete == "function";
|
|
2322
|
+
}), ie = r(() => P.isLoading.value && I.displayItems.value.length === 0), ae = r(() => {
|
|
2323
|
+
let e = P.previewItem.value;
|
|
2324
|
+
return e ? !f.accept?.length || A(e.mimeType ?? "", f.accept) : !1;
|
|
2325
|
+
}), se = r(() => {
|
|
2326
|
+
if (!W.value) return 0;
|
|
2327
|
+
let e = 0;
|
|
2328
|
+
for (let t of P.selectedItems.value) I.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && (e += 1);
|
|
2329
|
+
return e;
|
|
2326
2330
|
});
|
|
2327
|
-
|
|
2328
|
-
e.
|
|
2331
|
+
O(() => f.visible, (e) => {
|
|
2332
|
+
e ? (f.accept?.length === 1 && (P.categoryFilter.value = f.accept[0]), P.loadItems(), P.loadFrequentlyUsed(), P.loadStorage()) : I.resetUI();
|
|
2333
|
+
}, { immediate: !0 });
|
|
2334
|
+
function X(e) {
|
|
2335
|
+
e.key === "Escape" && p("close");
|
|
2329
2336
|
}
|
|
2330
|
-
|
|
2331
|
-
function
|
|
2332
|
-
|
|
2337
|
+
oe(document, "keydown", X);
|
|
2338
|
+
function ce() {
|
|
2339
|
+
ae.value && P.previewItem.value && (p("select", P.previewItem.value), p("close"));
|
|
2333
2340
|
}
|
|
2334
|
-
function
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
...e,
|
|
2338
|
-
url: P.selectedUrl.value || e.url
|
|
2339
|
-
};
|
|
2340
|
-
r("select", t), r("close");
|
|
2341
|
-
}
|
|
2341
|
+
function le(e) {
|
|
2342
|
+
let t = e.target.value;
|
|
2343
|
+
P.filterByCategory(t || null);
|
|
2342
2344
|
}
|
|
2343
|
-
|
|
2345
|
+
async function he() {
|
|
2346
|
+
let e = /* @__PURE__ */ new Set();
|
|
2347
|
+
for (let t of P.selectedItems.value) I.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && e.add(t);
|
|
2348
|
+
P.selectedItems.value = e, await I.handleDeleteClick();
|
|
2349
|
+
}
|
|
2350
|
+
return (r, d) => (v(), a(t, { to: i.popoverTarget || "body" }, [u(n, {
|
|
2344
2351
|
"enter-active-class": "tpl:transition tpl:duration-200",
|
|
2345
2352
|
"enter-from-class": "tpl:opacity-0",
|
|
2346
2353
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -2348,45 +2355,48 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2348
2355
|
"leave-from-class": "tpl:opacity-100",
|
|
2349
2356
|
"leave-to-class": "tpl:opacity-0"
|
|
2350
2357
|
}, {
|
|
2351
|
-
default:
|
|
2358
|
+
default: k(() => [i.visible && m.value ? (v(), s("div", {
|
|
2352
2359
|
key: 0,
|
|
2353
|
-
"data-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2360
|
+
"data-testid": "media-library-modal",
|
|
2361
|
+
"data-tpl-theme": S.value,
|
|
2362
|
+
class: "tpl tpl-media-overlay tpl:fixed tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:p-4",
|
|
2363
|
+
onClick: d[14] ||= M((e) => p("close"), ["self"])
|
|
2364
|
+
}, [c("div", sr, [
|
|
2365
|
+
c("div", cr, [c("h2", lr, C(_.value.mediaLibrary.title), 1), c("div", ur, [
|
|
2366
|
+
E(P).storageInfo.value ? (v(), a(Yn, {
|
|
2367
|
+
key: 0,
|
|
2368
|
+
"used-bytes": E(P).storageInfo.value.usedBytes,
|
|
2369
|
+
"limit-bytes": E(P).storageInfo.value.limitBytes,
|
|
2361
2370
|
size: 22
|
|
2362
|
-
}, null, 8, ["used-bytes", "limit-bytes"]),
|
|
2363
|
-
|
|
2364
|
-
value:
|
|
2371
|
+
}, null, 8, ["used-bytes", "limit-bytes"])) : o("", !0),
|
|
2372
|
+
c("div", dr, [c("input", {
|
|
2373
|
+
value: E(I).searchInput.value,
|
|
2365
2374
|
type: "text",
|
|
2366
|
-
|
|
2375
|
+
disabled: ie.value,
|
|
2376
|
+
class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
2367
2377
|
style: {
|
|
2368
2378
|
"border-color": "var(--tpl-border)",
|
|
2369
2379
|
"background-color": "var(--tpl-bg)",
|
|
2370
2380
|
color: "var(--tpl-text)"
|
|
2371
2381
|
},
|
|
2372
|
-
placeholder:
|
|
2373
|
-
onInput:
|
|
2374
|
-
}, null, 40,
|
|
2382
|
+
placeholder: _.value.mediaLibrary.searchPlaceholder,
|
|
2383
|
+
onInput: d[0] ||= (e) => E(I).handleSearchInput(e.target.value)
|
|
2384
|
+
}, null, 40, fr), u(E(ee), {
|
|
2375
2385
|
class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
|
|
2376
2386
|
size: 13,
|
|
2377
2387
|
"stroke-width": 2,
|
|
2378
2388
|
style: { color: "var(--tpl-text-dim)" }
|
|
2379
2389
|
})]),
|
|
2380
|
-
|
|
2390
|
+
c("button", {
|
|
2381
2391
|
class: "tpl:flex tpl:size-7 tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2382
2392
|
style: { color: "var(--tpl-text-muted)" },
|
|
2383
|
-
onClick:
|
|
2384
|
-
}, [
|
|
2393
|
+
onClick: d[1] ||= (e) => p("close")
|
|
2394
|
+
}, [u(E(ne), {
|
|
2385
2395
|
size: 18,
|
|
2386
2396
|
"stroke-width": 2
|
|
2387
2397
|
})])
|
|
2388
2398
|
])]),
|
|
2389
|
-
|
|
2399
|
+
c("div", pr, [u(n, {
|
|
2390
2400
|
"enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
|
|
2391
2401
|
"enter-from-class": "tpl:-ml-48 tpl:opacity-0",
|
|
2392
2402
|
"enter-to-class": "tpl:ml-0 tpl:opacity-100",
|
|
@@ -2394,76 +2404,84 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2394
2404
|
"leave-from-class": "tpl:ml-0 tpl:opacity-100",
|
|
2395
2405
|
"leave-to-class": "tpl:-ml-48 tpl:opacity-0"
|
|
2396
2406
|
}, {
|
|
2397
|
-
default:
|
|
2398
|
-
folders:
|
|
2399
|
-
"current-folder-id":
|
|
2400
|
-
"view-mode":
|
|
2401
|
-
"has-frequently-used":
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
+
default: k(() => [V.value && E(I).showSidebar.value ? (v(), s("div", mr, [u(bt, {
|
|
2408
|
+
folders: E(I).folderTree.value,
|
|
2409
|
+
"current-folder-id": E(P).currentFolderId.value,
|
|
2410
|
+
"view-mode": E(P).viewMode.value,
|
|
2411
|
+
"has-frequently-used": te.value && E(I).hasFrequentlyUsed.value,
|
|
2412
|
+
"can-create-folder": re.value,
|
|
2413
|
+
"can-rename-folder": J.value,
|
|
2414
|
+
"can-delete-folder": Y.value,
|
|
2415
|
+
onNavigate: E(P).navigateToFolder,
|
|
2416
|
+
onCreateFolder: E(I).handleCreateFolder,
|
|
2417
|
+
onRenameFolder: E(I).handleRenameFolder,
|
|
2418
|
+
onDeleteFolder: E(I).handleDeleteFolder,
|
|
2419
|
+
onShowFrequentlyUsed: E(P).showFrequentlyUsed
|
|
2407
2420
|
}, null, 8, [
|
|
2408
2421
|
"folders",
|
|
2409
2422
|
"current-folder-id",
|
|
2410
2423
|
"view-mode",
|
|
2411
2424
|
"has-frequently-used",
|
|
2425
|
+
"can-create-folder",
|
|
2426
|
+
"can-rename-folder",
|
|
2427
|
+
"can-delete-folder",
|
|
2412
2428
|
"onNavigate",
|
|
2413
2429
|
"onCreateFolder",
|
|
2414
2430
|
"onRenameFolder",
|
|
2415
2431
|
"onDeleteFolder",
|
|
2416
2432
|
"onShowFrequentlyUsed"
|
|
2417
|
-
])])) :
|
|
2433
|
+
])])) : o("", !0)]),
|
|
2418
2434
|
_: 1
|
|
2419
|
-
}),
|
|
2420
|
-
|
|
2435
|
+
}), c("div", hr, [c("div", gr, [c("div", _r, [
|
|
2436
|
+
V.value ? (v(), s("button", {
|
|
2437
|
+
key: 0,
|
|
2438
|
+
"data-testid": "media-folder-toggle",
|
|
2421
2439
|
class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2422
|
-
style:
|
|
2423
|
-
color:
|
|
2424
|
-
backgroundColor:
|
|
2425
|
-
border:
|
|
2440
|
+
style: g({
|
|
2441
|
+
color: E(I).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2442
|
+
backgroundColor: E(I).showSidebar.value ? "var(--tpl-bg)" : "transparent",
|
|
2443
|
+
border: E(I).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
|
|
2426
2444
|
}),
|
|
2427
|
-
title:
|
|
2428
|
-
onClick:
|
|
2429
|
-
}, [
|
|
2445
|
+
title: E(I).showSidebar.value ? _.value.mediaLibrary.hideFolders : _.value.mediaLibrary.showFolders,
|
|
2446
|
+
onClick: d[2] ||= (e) => E(I).showSidebar.value = !E(I).showSidebar.value
|
|
2447
|
+
}, [u(E(H), {
|
|
2430
2448
|
size: 16,
|
|
2431
2449
|
"stroke-width": 2
|
|
2432
|
-
})], 12,
|
|
2433
|
-
|
|
2434
|
-
key:
|
|
2435
|
-
folders:
|
|
2436
|
-
"current-folder-id":
|
|
2437
|
-
onNavigate:
|
|
2450
|
+
})], 12, vr)) : o("", !0),
|
|
2451
|
+
E(P).viewMode.value === "frequently-used" ? (v(), s("span", yr, C(_.value.mediaLibrary.frequentlyUsed), 1)) : (v(), a(be, {
|
|
2452
|
+
key: 2,
|
|
2453
|
+
folders: E(I).folderTree.value,
|
|
2454
|
+
"current-folder-id": E(P).currentFolderId.value,
|
|
2455
|
+
onNavigate: E(P).navigateToFolder
|
|
2438
2456
|
}, null, 8, [
|
|
2439
2457
|
"folders",
|
|
2440
2458
|
"current-folder-id",
|
|
2441
2459
|
"onNavigate"
|
|
2442
2460
|
])),
|
|
2443
|
-
|
|
2461
|
+
c("div", br, [c("button", {
|
|
2444
2462
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2445
|
-
style:
|
|
2446
|
-
color:
|
|
2447
|
-
backgroundColor:
|
|
2463
|
+
style: g({
|
|
2464
|
+
color: E(I).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2465
|
+
backgroundColor: E(I).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
|
|
2448
2466
|
}),
|
|
2449
|
-
title:
|
|
2450
|
-
onClick:
|
|
2451
|
-
}, [
|
|
2467
|
+
title: _.value.mediaLibrary.viewGrid,
|
|
2468
|
+
onClick: d[3] ||= (e) => E(I).layoutMode.value = "grid"
|
|
2469
|
+
}, [u(E(R), {
|
|
2452
2470
|
size: 14,
|
|
2453
2471
|
"stroke-width": 2
|
|
2454
|
-
})], 12,
|
|
2472
|
+
})], 12, xr), c("button", {
|
|
2455
2473
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2456
|
-
style:
|
|
2457
|
-
color:
|
|
2458
|
-
backgroundColor:
|
|
2474
|
+
style: g({
|
|
2475
|
+
color: E(I).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2476
|
+
backgroundColor: E(I).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
|
|
2459
2477
|
}),
|
|
2460
|
-
title:
|
|
2461
|
-
onClick:
|
|
2462
|
-
}, [
|
|
2478
|
+
title: _.value.mediaLibrary.viewList,
|
|
2479
|
+
onClick: d[4] ||= (e) => E(I).layoutMode.value = "list"
|
|
2480
|
+
}, [u(E(B), {
|
|
2463
2481
|
size: 14,
|
|
2464
2482
|
"stroke-width": 2
|
|
2465
|
-
})], 12,
|
|
2466
|
-
]),
|
|
2483
|
+
})], 12, Sr)])
|
|
2484
|
+
]), c("div", Cr, [E(j).length > 1 ? (v(), s("select", {
|
|
2467
2485
|
key: 0,
|
|
2468
2486
|
class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
|
|
2469
2487
|
style: {
|
|
@@ -2471,58 +2489,49 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2471
2489
|
"background-color": "var(--tpl-bg)",
|
|
2472
2490
|
color: "var(--tpl-text)"
|
|
2473
2491
|
},
|
|
2474
|
-
value:
|
|
2475
|
-
onChange:
|
|
2476
|
-
}, [
|
|
2492
|
+
value: E(P).categoryFilter.value ?? "",
|
|
2493
|
+
onChange: le
|
|
2494
|
+
}, [c("option", Tr, C(_.value.mediaLibrary.filterAll), 1), (v(!0), s(e, null, x(E(j), (e) => (v(), s("option", {
|
|
2477
2495
|
key: e,
|
|
2478
2496
|
value: e
|
|
2479
|
-
},
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
color: "var(--tpl-text)"
|
|
2485
|
-
},
|
|
2486
|
-
value: k(N).sortOption.value,
|
|
2487
|
-
onChange: n[6] ||= (e) => k(N).sortBy(e.target.value)
|
|
2488
|
-
}, [
|
|
2489
|
-
f("option", Pr, D(h.value.mediaLibrary.sortNewest), 1),
|
|
2490
|
-
f("option", Fr, D(h.value.mediaLibrary.sortOldest), 1),
|
|
2491
|
-
f("option", Ir, D(h.value.mediaLibrary.sortNameAsc), 1),
|
|
2492
|
-
f("option", Lr, D(h.value.mediaLibrary.sortNameDesc), 1),
|
|
2493
|
-
f("option", Rr, D(h.value.mediaLibrary.sortSizeAsc), 1),
|
|
2494
|
-
f("option", zr, D(h.value.mediaLibrary.sortSizeDesc), 1)
|
|
2495
|
-
], 40, Nr)])]), f("div", Br, [k(N).viewMode.value === "files" ? (S(), d("div", Vr, [m(Zn, {
|
|
2496
|
-
"is-uploading": k(N).isUploading.value,
|
|
2497
|
-
"upload-progress": k(N).uploadProgress.value,
|
|
2498
|
-
onUpload: k(P).handleUpload
|
|
2497
|
+
}, C(E(I).getCategoryLabel(e)), 9, Er))), 128))], 40, wr)) : o("", !0)])]), c("div", Dr, [E(P).viewMode.value === "files" && (L.value || U.value) ? (v(), s("div", Or, [L.value ? (v(), a(Wn, {
|
|
2498
|
+
key: 0,
|
|
2499
|
+
"is-uploading": E(P).isUploading.value,
|
|
2500
|
+
"upload-progress": E(P).uploadProgress.value,
|
|
2501
|
+
onUpload: E(I).handleUpload
|
|
2499
2502
|
}, null, 8, [
|
|
2500
2503
|
"is-uploading",
|
|
2501
2504
|
"upload-progress",
|
|
2502
2505
|
"onUpload"
|
|
2503
|
-
]),
|
|
2506
|
+
])) : o("", !0), U.value ? (v(), s("button", {
|
|
2507
|
+
key: 1,
|
|
2508
|
+
"data-testid": "media-import-url",
|
|
2504
2509
|
class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2505
2510
|
style: {
|
|
2506
2511
|
"border-color": "var(--tpl-border)",
|
|
2507
2512
|
color: "var(--tpl-text-muted)",
|
|
2508
2513
|
"background-color": "var(--tpl-bg)"
|
|
2509
2514
|
},
|
|
2510
|
-
onClick:
|
|
2511
|
-
}, [
|
|
2515
|
+
onClick: d[5] ||= (e) => E(I).showImportUrlModal.value = !0
|
|
2516
|
+
}, [u(E(z), {
|
|
2512
2517
|
size: 14,
|
|
2513
2518
|
"stroke-width": 2
|
|
2514
|
-
}),
|
|
2515
|
-
items:
|
|
2516
|
-
"selected-ids":
|
|
2517
|
-
"is-loading":
|
|
2518
|
-
"has-more":
|
|
2519
|
-
accept:
|
|
2520
|
-
layout:
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2519
|
+
}), l(" " + C(_.value.mediaLibrary.importFromUrl), 1)])) : o("", !0)])) : o("", !0), u($t, {
|
|
2520
|
+
items: E(I).displayItems.value,
|
|
2521
|
+
"selected-ids": E(P).selectedItems.value,
|
|
2522
|
+
"is-loading": E(P).isLoading.value,
|
|
2523
|
+
"has-more": E(P).viewMode.value === "files" && E(P).hasMore.value,
|
|
2524
|
+
accept: i.accept,
|
|
2525
|
+
layout: E(I).layoutMode.value,
|
|
2526
|
+
"search-query": E(P).searchQuery.value,
|
|
2527
|
+
"can-update": G.value,
|
|
2528
|
+
"can-replace": K.value,
|
|
2529
|
+
onSelect: E(I).handleSelect,
|
|
2530
|
+
onToggle: E(P).toggleSelection,
|
|
2531
|
+
onLoadMore: E(P).loadMore,
|
|
2532
|
+
onEdit: E(I).handleEditItem,
|
|
2533
|
+
onReplace: E(I).handleReplaceItem,
|
|
2534
|
+
onConfirm: ce
|
|
2526
2535
|
}, null, 8, [
|
|
2527
2536
|
"items",
|
|
2528
2537
|
"selected-ids",
|
|
@@ -2530,42 +2539,45 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2530
2539
|
"has-more",
|
|
2531
2540
|
"accept",
|
|
2532
2541
|
"layout",
|
|
2542
|
+
"search-query",
|
|
2543
|
+
"can-update",
|
|
2544
|
+
"can-replace",
|
|
2533
2545
|
"onSelect",
|
|
2534
2546
|
"onToggle",
|
|
2535
2547
|
"onLoadMore",
|
|
2536
2548
|
"onEdit",
|
|
2537
2549
|
"onReplace"
|
|
2538
2550
|
])])])]),
|
|
2539
|
-
|
|
2540
|
-
visible:
|
|
2541
|
-
"is-importing":
|
|
2542
|
-
error:
|
|
2543
|
-
onImport:
|
|
2544
|
-
onClose:
|
|
2551
|
+
u(fn, {
|
|
2552
|
+
visible: E(I).showImportUrlModal.value,
|
|
2553
|
+
"is-importing": E(P).isImportingFromUrl.value,
|
|
2554
|
+
error: E(P).importFromUrlError.value,
|
|
2555
|
+
onImport: E(I).handleImportFromUrl,
|
|
2556
|
+
onClose: d[6] ||= (e) => E(I).showImportUrlModal.value = !1
|
|
2545
2557
|
}, null, 8, [
|
|
2546
2558
|
"visible",
|
|
2547
2559
|
"is-importing",
|
|
2548
2560
|
"error",
|
|
2549
2561
|
"onImport"
|
|
2550
2562
|
]),
|
|
2551
|
-
|
|
2552
|
-
visible: !!
|
|
2553
|
-
item:
|
|
2554
|
-
onSave:
|
|
2555
|
-
onClose:
|
|
2563
|
+
u(ct, {
|
|
2564
|
+
visible: !!E(I).editingItem.value,
|
|
2565
|
+
item: E(I).editingItem.value,
|
|
2566
|
+
onSave: E(I).handleEditSave,
|
|
2567
|
+
onClose: d[7] ||= (e) => E(I).editingItem.value = null
|
|
2556
2568
|
}, null, 8, [
|
|
2557
2569
|
"visible",
|
|
2558
2570
|
"item",
|
|
2559
2571
|
"onSave"
|
|
2560
2572
|
]),
|
|
2561
|
-
|
|
2562
|
-
visible:
|
|
2563
|
-
item:
|
|
2564
|
-
"usage-info":
|
|
2565
|
-
"is-replacing":
|
|
2566
|
-
error:
|
|
2567
|
-
onReplace:
|
|
2568
|
-
onClose:
|
|
2573
|
+
u(zn, {
|
|
2574
|
+
visible: E(P).showReplaceWarning.value,
|
|
2575
|
+
item: E(P).pendingReplaceItem.value,
|
|
2576
|
+
"usage-info": E(P).replaceUsageInfo.value,
|
|
2577
|
+
"is-replacing": E(P).isReplacing.value,
|
|
2578
|
+
error: E(P).replaceError.value,
|
|
2579
|
+
onReplace: E(I).handleReplaceFile,
|
|
2580
|
+
onClose: E(P).cancelReplace
|
|
2569
2581
|
}, null, 8, [
|
|
2570
2582
|
"visible",
|
|
2571
2583
|
"item",
|
|
@@ -2575,7 +2587,7 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2575
2587
|
"onReplace",
|
|
2576
2588
|
"onClose"
|
|
2577
2589
|
]),
|
|
2578
|
-
|
|
2590
|
+
u(n, {
|
|
2579
2591
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
2580
2592
|
"enter-from-class": "tpl:opacity-0",
|
|
2581
2593
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -2583,7 +2595,7 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2583
2595
|
"leave-from-class": "tpl:opacity-100",
|
|
2584
2596
|
"leave-to-class": "tpl:opacity-0"
|
|
2585
2597
|
}, {
|
|
2586
|
-
default:
|
|
2598
|
+
default: k(() => [E(P).showDeleteWarning.value ? (v(), s("div", {
|
|
2587
2599
|
key: 0,
|
|
2588
2600
|
class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
|
|
2589
2601
|
style: {
|
|
@@ -2591,112 +2603,108 @@ var fr = ["data-tpl-theme"], pr = {
|
|
|
2591
2603
|
"backdrop-filter": "blur(8px)",
|
|
2592
2604
|
"-webkit-backdrop-filter": "blur(8px)"
|
|
2593
2605
|
},
|
|
2594
|
-
onClick:
|
|
2595
|
-
}, [
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
class:
|
|
2606
|
+
onClick: d[10] ||= M((...e) => E(P).cancelDelete && E(P).cancelDelete(...e), ["self"])
|
|
2607
|
+
}, [c("div", kr, [
|
|
2608
|
+
c("h3", Ar, C(_.value.mediaLibrary.deleteWarningTitle), 1),
|
|
2609
|
+
c("p", {
|
|
2610
|
+
class: h(["tpl:text-xs", E(I).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
|
|
2599
2611
|
style: { color: "var(--tpl-text-muted)" }
|
|
2600
|
-
},
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
key:
|
|
2612
|
+
}, C(_.value.mediaLibrary.deleteWarningMessage), 3),
|
|
2613
|
+
E(I).hasUsedFiles.value ? (v(), s("p", jr, C(_.value.mediaLibrary.deleteWarningUsageNote), 1)) : o("", !0),
|
|
2614
|
+
E(I).hasUsedFiles.value ? (v(), s("div", Mr, [(v(!0), s(e, null, x(E(P).deleteUsageInfo.value, (t, n) => (v(), s("div", {
|
|
2615
|
+
key: n,
|
|
2604
2616
|
class: "tpl:text-xs",
|
|
2605
2617
|
style: { color: "var(--tpl-text)" }
|
|
2606
|
-
}, [
|
|
2607
|
-
|
|
2618
|
+
}, [t.templateCount > 0 ? (v(), s(e, { key: 0 }, [c("span", Nr, C(E(I).displayItems.value.find((e) => e.id === n)?.filename || n), 1), c("span", Pr, " - " + C(_.value.mediaLibrary.usedInTemplates.replace("{count}", t.templateCount.toString())), 1)], 64)) : o("", !0)]))), 128))])) : o("", !0),
|
|
2619
|
+
c("div", Fr, [c("button", {
|
|
2608
2620
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2609
2621
|
style: {
|
|
2610
2622
|
"border-color": "var(--tpl-border)",
|
|
2611
2623
|
color: "var(--tpl-text)",
|
|
2612
2624
|
"background-color": "var(--tpl-bg)"
|
|
2613
2625
|
},
|
|
2614
|
-
onClick:
|
|
2615
|
-
},
|
|
2626
|
+
onClick: d[8] ||= (...e) => E(P).cancelDelete && E(P).cancelDelete(...e)
|
|
2627
|
+
}, C(_.value.mediaLibrary.cancel), 1), c("button", {
|
|
2616
2628
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2617
2629
|
style: {
|
|
2618
2630
|
"border-color": "var(--tpl-danger)",
|
|
2619
2631
|
color: "var(--tpl-danger)",
|
|
2620
2632
|
"background-color": "var(--tpl-danger-light)"
|
|
2621
2633
|
},
|
|
2622
|
-
onClick:
|
|
2623
|
-
},
|
|
2624
|
-
])])) :
|
|
2634
|
+
onClick: d[9] ||= (...e) => E(P).confirmDelete && E(P).confirmDelete(...e)
|
|
2635
|
+
}, C(E(I).hasUsedFiles.value ? _.value.mediaLibrary.deleteAnyway : _.value.mediaLibrary.confirmDelete), 1)])
|
|
2636
|
+
])])) : o("", !0)]),
|
|
2625
2637
|
_: 1
|
|
2626
2638
|
}),
|
|
2627
|
-
|
|
2639
|
+
c("div", Ir, [c("div", Lr, [E(P).previewItem.value ? (v(), a(wn, {
|
|
2628
2640
|
key: 0,
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
folders: k(N).folders.value
|
|
2633
|
-
}, null, 8, [
|
|
2634
|
-
"selected-conversion",
|
|
2635
|
-
"item",
|
|
2636
|
-
"folders"
|
|
2637
|
-
])) : u("", !0)]), f("div", Zr, [k(N).selectedItems.value.size > 0 ? (S(), d("div", Qr, [k(N).previewItem.value ? (S(), d("button", {
|
|
2641
|
+
item: E(P).previewItem.value,
|
|
2642
|
+
folders: E(I).folderTree.value
|
|
2643
|
+
}, null, 8, ["item", "folders"])) : o("", !0)]), c("div", Rr, [E(P).selectedItems.value.size > 0 ? (v(), s("div", zr, [E(P).previewItem.value ? (v(), s("button", {
|
|
2638
2644
|
key: 0,
|
|
2639
2645
|
class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2640
|
-
style:
|
|
2641
|
-
borderColor:
|
|
2642
|
-
color:
|
|
2646
|
+
style: g({
|
|
2647
|
+
borderColor: E(I).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
|
|
2648
|
+
color: E(I).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
|
|
2643
2649
|
backgroundColor: "var(--tpl-bg)"
|
|
2644
2650
|
}),
|
|
2645
|
-
onClick:
|
|
2646
|
-
}, [
|
|
2651
|
+
onClick: d[11] ||= (e) => E(I).copy(E(I).selectedUrl.value)
|
|
2652
|
+
}, [E(I).copied.value ? (v(), a(E(N), {
|
|
2647
2653
|
key: 1,
|
|
2648
2654
|
size: 12,
|
|
2649
2655
|
"stroke-width": 2
|
|
2650
|
-
})) : (
|
|
2656
|
+
})) : (v(), a(E(F), {
|
|
2651
2657
|
key: 0,
|
|
2652
2658
|
size: 12,
|
|
2653
2659
|
"stroke-width": 2
|
|
2654
|
-
})),
|
|
2660
|
+
})), l(" " + C(E(I).copied.value ? _.value.mediaLibrary.copied : _.value.mediaLibrary.copyUrl), 1)], 4)) : o("", !0), q.value ? (v(), s("div", Br, [c("button", {
|
|
2655
2661
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2656
2662
|
style: {
|
|
2657
2663
|
"border-color": "var(--tpl-border)",
|
|
2658
2664
|
color: "var(--tpl-text)",
|
|
2659
2665
|
"background-color": "var(--tpl-bg)"
|
|
2660
2666
|
},
|
|
2661
|
-
onClick:
|
|
2662
|
-
},
|
|
2667
|
+
onClick: d[12] ||= (e) => E(I).showMovePicker.value = !E(I).showMovePicker.value
|
|
2668
|
+
}, C(_.value.mediaLibrary.moveSelected), 1), E(I).showMovePicker.value ? (v(), a(_n, {
|
|
2663
2669
|
key: 0,
|
|
2664
|
-
folders:
|
|
2665
|
-
"current-folder-id":
|
|
2666
|
-
onSelect:
|
|
2667
|
-
onClose:
|
|
2670
|
+
folders: E(I).folderTree.value,
|
|
2671
|
+
"current-folder-id": E(P).currentFolderId.value,
|
|
2672
|
+
onSelect: E(I).handleMoveToFolder,
|
|
2673
|
+
onClose: d[13] ||= (e) => E(I).showMovePicker.value = !1
|
|
2668
2674
|
}, null, 8, [
|
|
2669
2675
|
"folders",
|
|
2670
2676
|
"current-folder-id",
|
|
2671
2677
|
"onSelect"
|
|
2672
|
-
])) :
|
|
2678
|
+
])) : o("", !0)])) : o("", !0)])) : o("", !0), c("div", Vr, [se.value > 0 ? (v(), s("button", {
|
|
2673
2679
|
key: 0,
|
|
2680
|
+
"data-testid": "media-delete",
|
|
2674
2681
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2675
2682
|
style: {
|
|
2676
2683
|
"border-color": "var(--tpl-danger)",
|
|
2677
2684
|
color: "var(--tpl-danger)",
|
|
2678
2685
|
"background-color": "var(--tpl-danger-light)"
|
|
2679
2686
|
},
|
|
2680
|
-
onClick:
|
|
2681
|
-
},
|
|
2687
|
+
onClick: he
|
|
2688
|
+
}, C(_.value.mediaLibrary.deleteSelected), 1)) : o("", !0), c("button", {
|
|
2689
|
+
"data-testid": "media-confirm",
|
|
2682
2690
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
2683
2691
|
style: {
|
|
2684
2692
|
"background-color": "var(--tpl-primary)",
|
|
2685
2693
|
color: "var(--tpl-bg)"
|
|
2686
2694
|
},
|
|
2687
|
-
disabled: !
|
|
2688
|
-
onClick:
|
|
2689
|
-
},
|
|
2690
|
-
])], 8,
|
|
2695
|
+
disabled: !ae.value,
|
|
2696
|
+
onClick: ce
|
|
2697
|
+
}, C(i.accept?.length ? _.value.mediaLibrary.selectImage : _.value.mediaLibrary.selectFile), 9, Hr)])])])
|
|
2698
|
+
])], 8, or)) : o("", !0)]),
|
|
2691
2699
|
_: 1
|
|
2692
2700
|
})], 8, ["to"]));
|
|
2693
2701
|
}
|
|
2694
2702
|
});
|
|
2695
2703
|
//#endregion
|
|
2696
2704
|
//#region src/composables/useMediaPicker.ts
|
|
2697
|
-
function
|
|
2698
|
-
let e =
|
|
2699
|
-
async function
|
|
2705
|
+
function Wr() {
|
|
2706
|
+
let e = p("onRequestMedia"), t = b(!1), n = r(() => !!e);
|
|
2707
|
+
async function i(n) {
|
|
2700
2708
|
if (!e) return null;
|
|
2701
2709
|
t.value = !0;
|
|
2702
2710
|
try {
|
|
@@ -2708,12 +2716,12 @@ function ri() {
|
|
|
2708
2716
|
return {
|
|
2709
2717
|
isPluggableMediaEnabled: n,
|
|
2710
2718
|
isRequesting: t,
|
|
2711
|
-
requestMedia:
|
|
2719
|
+
requestMedia: i
|
|
2712
2720
|
};
|
|
2713
2721
|
}
|
|
2714
2722
|
//#endregion
|
|
2715
2723
|
//#region src/standalone/MediaLibrary.vue?vue&type=script&setup=true&lang.ts
|
|
2716
|
-
var
|
|
2724
|
+
var Gr = {
|
|
2717
2725
|
class: "tpl tpl:flex tpl:flex-col tpl:overflow-hidden tpl:rounded-[var(--tpl-radius-lg)]",
|
|
2718
2726
|
style: {
|
|
2719
2727
|
width: "100%",
|
|
@@ -2721,121 +2729,154 @@ var ii = {
|
|
|
2721
2729
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2722
2730
|
border: "1px solid var(--tpl-border)"
|
|
2723
2731
|
}
|
|
2724
|
-
},
|
|
2732
|
+
}, Kr = {
|
|
2725
2733
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-5 tpl:py-3.5",
|
|
2726
2734
|
style: { "border-color": "var(--tpl-border)" }
|
|
2727
|
-
},
|
|
2735
|
+
}, qr = {
|
|
2728
2736
|
class: "tpl:text-sm tpl:font-semibold",
|
|
2729
2737
|
style: { color: "var(--tpl-text)" }
|
|
2730
|
-
},
|
|
2738
|
+
}, Jr = { class: "tpl:flex tpl:items-center tpl:gap-3" }, Yr = { class: "tpl:relative" }, Xr = [
|
|
2739
|
+
"value",
|
|
2740
|
+
"disabled",
|
|
2741
|
+
"placeholder"
|
|
2742
|
+
], Zr = { class: "tpl:flex tpl:min-h-0 tpl:flex-1 tpl:overflow-hidden" }, Qr = {
|
|
2731
2743
|
key: 0,
|
|
2732
2744
|
class: "tpl:flex tpl:w-48 tpl:shrink-0 tpl:flex-col tpl:border-r",
|
|
2733
2745
|
style: {
|
|
2734
2746
|
"border-color": "var(--tpl-border)",
|
|
2735
2747
|
"background-color": "var(--tpl-bg)"
|
|
2736
2748
|
}
|
|
2737
|
-
},
|
|
2749
|
+
}, $r = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:flex-col" }, ei = {
|
|
2738
2750
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-b tpl:px-4 tpl:py-2.5",
|
|
2739
2751
|
style: { "border-color": "var(--tpl-border)" }
|
|
2740
|
-
},
|
|
2741
|
-
key:
|
|
2752
|
+
}, ti = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ni = ["title"], ri = {
|
|
2753
|
+
key: 1,
|
|
2742
2754
|
class: "tpl:text-xs tpl:font-medium",
|
|
2743
2755
|
style: { color: "var(--tpl-text)" }
|
|
2744
|
-
},
|
|
2756
|
+
}, ii = {
|
|
2745
2757
|
class: "tpl:flex tpl:rounded-md tpl:p-0.5",
|
|
2746
2758
|
style: {
|
|
2747
2759
|
border: "1px solid var(--tpl-border)",
|
|
2748
2760
|
"background-color": "var(--tpl-bg)"
|
|
2749
2761
|
}
|
|
2750
|
-
},
|
|
2762
|
+
}, ai = ["title"], oi = ["title"], si = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ci = ["value"], li = { value: "" }, ui = ["value"], di = { class: "tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto" }, fi = {
|
|
2751
2763
|
key: 0,
|
|
2752
2764
|
class: "tpl:px-4 tpl:pt-3"
|
|
2753
|
-
},
|
|
2765
|
+
}, pi = {
|
|
2754
2766
|
class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
|
|
2755
2767
|
style: {
|
|
2756
2768
|
"background-color": "var(--tpl-bg-elevated)",
|
|
2757
2769
|
"box-shadow": "var(--tpl-shadow-xl)"
|
|
2758
2770
|
}
|
|
2759
|
-
},
|
|
2771
|
+
}, mi = {
|
|
2760
2772
|
class: "tpl:mb-2 tpl:text-sm tpl:font-semibold",
|
|
2761
2773
|
style: { color: "var(--tpl-text)" }
|
|
2762
|
-
},
|
|
2774
|
+
}, hi = {
|
|
2763
2775
|
key: 0,
|
|
2776
|
+
"data-testid": "media-delete-usage",
|
|
2764
2777
|
class: "tpl:mb-4 tpl:text-xs",
|
|
2765
2778
|
style: { color: "var(--tpl-text-muted)" }
|
|
2766
|
-
},
|
|
2779
|
+
}, gi = {
|
|
2767
2780
|
key: 1,
|
|
2768
2781
|
class: "tpl:mb-4 tpl:max-h-32 tpl:overflow-y-auto tpl:rounded tpl:border tpl:p-2",
|
|
2769
2782
|
style: { "border-color": "var(--tpl-border)" }
|
|
2770
|
-
},
|
|
2783
|
+
}, _i = { class: "tpl:font-medium" }, vi = { style: { color: "var(--tpl-text-muted)" } }, yi = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, bi = {
|
|
2771
2784
|
class: "tpl:flex tpl:shrink-0 tpl:items-center tpl:justify-between tpl:border-t tpl:px-5 tpl:py-3",
|
|
2772
2785
|
style: { "border-color": "var(--tpl-border)" }
|
|
2773
|
-
},
|
|
2786
|
+
}, xi = { class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-3" }, Si = { class: "tpl:flex tpl:items-center tpl:gap-5" }, Ci = {
|
|
2774
2787
|
key: 0,
|
|
2775
2788
|
class: "tpl:flex tpl:items-center tpl:gap-2"
|
|
2776
|
-
},
|
|
2789
|
+
}, wi = {
|
|
2790
|
+
key: 1,
|
|
2791
|
+
class: "tpl:relative"
|
|
2792
|
+
}, Ti = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Ei = ["disabled"], Di = /* @__PURE__ */ d({
|
|
2777
2793
|
__name: "MediaLibrary",
|
|
2778
2794
|
props: {
|
|
2779
|
-
|
|
2780
|
-
projectId: {},
|
|
2781
|
-
planConfig: {},
|
|
2795
|
+
provider: {},
|
|
2782
2796
|
translations: {},
|
|
2783
2797
|
onSelect: { type: Function },
|
|
2784
|
-
|
|
2798
|
+
accept: {},
|
|
2799
|
+
locale: {}
|
|
2785
2800
|
},
|
|
2786
2801
|
emits: ["ready"],
|
|
2787
|
-
setup(
|
|
2788
|
-
let
|
|
2789
|
-
|
|
2790
|
-
let
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2802
|
+
setup(t, { emit: i }) {
|
|
2803
|
+
let d = t, f = i, p = r(() => d.translations);
|
|
2804
|
+
y(pe, b(d.translations)), y(me, w(() => d.locale));
|
|
2805
|
+
let m = {
|
|
2806
|
+
get maxFileSize() {
|
|
2807
|
+
return d.provider.maxFileSize;
|
|
2808
|
+
},
|
|
2809
|
+
get mimeTypes() {
|
|
2810
|
+
return d.provider.mimeTypes;
|
|
2811
|
+
},
|
|
2812
|
+
get accept() {
|
|
2813
|
+
return d.accept;
|
|
2814
|
+
}
|
|
2796
2815
|
};
|
|
2797
|
-
|
|
2798
|
-
let
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2816
|
+
y(de, m);
|
|
2817
|
+
let { isAcceptedMimeType: S, availableCategories: T } = $(m), D = ue({ provider: d.provider }), O = Zn({
|
|
2818
|
+
library: D,
|
|
2819
|
+
translations: p
|
|
2820
|
+
}), A = r(() => typeof d.provider.create == "function"), j = r(() => d.provider.folders !== !1), P = r(() => typeof d.provider.importFromUrl == "function"), I = r(() => typeof d.provider.delete == "function"), L = r(() => typeof d.provider.update == "function"), V = r(() => typeof d.provider.replace == "function"), U = r(() => typeof d.provider.frequentlyUsed == "function"), W = r(() => {
|
|
2821
|
+
let e = d.provider.folders;
|
|
2822
|
+
return e !== !1 && typeof e.move == "function";
|
|
2823
|
+
}), G = r(() => {
|
|
2824
|
+
let e = d.provider.folders;
|
|
2825
|
+
return e !== !1 && typeof e.create == "function";
|
|
2826
|
+
}), K = r(() => {
|
|
2827
|
+
let e = d.provider.folders;
|
|
2828
|
+
return e !== !1 && typeof e.update == "function";
|
|
2829
|
+
}), te = r(() => {
|
|
2830
|
+
let e = d.provider.folders;
|
|
2831
|
+
return e !== !1 && typeof e.delete == "function";
|
|
2832
|
+
}), q = r(() => D.isLoading.value && O.displayItems.value.length === 0), ne = r(() => {
|
|
2833
|
+
let e = D.previewItem.value;
|
|
2834
|
+
return e ? !d.accept?.length || S(e.mimeType ?? "", d.accept) : !1;
|
|
2835
|
+
}), re = r(() => {
|
|
2836
|
+
if (!I.value) return 0;
|
|
2837
|
+
let e = 0;
|
|
2838
|
+
for (let t of D.selectedItems.value) O.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && (e += 1);
|
|
2839
|
+
return e;
|
|
2805
2840
|
});
|
|
2806
|
-
function
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2841
|
+
function J() {
|
|
2842
|
+
d.onSelect && ne.value && D.previewItem.value && d.onSelect(D.previewItem.value);
|
|
2843
|
+
}
|
|
2844
|
+
function Y(e) {
|
|
2845
|
+
let t = e.target.value;
|
|
2846
|
+
D.filterByCategory(t || null);
|
|
2847
|
+
}
|
|
2848
|
+
async function ie() {
|
|
2849
|
+
let e = /* @__PURE__ */ new Set();
|
|
2850
|
+
for (let t of D.selectedItems.value) O.displayItems.value.find((e) => e.id === t)?.canDelete !== !1 && e.add(t);
|
|
2851
|
+
D.selectedItems.value = e, await O.handleDeleteClick();
|
|
2852
|
+
}
|
|
2853
|
+
return _(() => {
|
|
2854
|
+
d.accept?.length === 1 && (D.categoryFilter.value = d.accept[0]), D.loadItems(), D.loadFrequentlyUsed(), D.loadStorage(), f("ready");
|
|
2855
|
+
}), (r, i) => (v(), s("div", Gr, [
|
|
2856
|
+
c("div", Kr, [c("h2", qr, C(p.value.mediaLibrary.title), 1), c("div", Jr, [E(D).storageInfo.value ? (v(), a(Yn, {
|
|
2857
|
+
key: 0,
|
|
2858
|
+
"used-bytes": E(D).storageInfo.value.usedBytes,
|
|
2859
|
+
"limit-bytes": E(D).storageInfo.value.limitBytes,
|
|
2820
2860
|
size: 22
|
|
2821
|
-
}, null, 8, ["used-bytes", "limit-bytes"]),
|
|
2822
|
-
value:
|
|
2861
|
+
}, null, 8, ["used-bytes", "limit-bytes"])) : o("", !0), c("div", Yr, [c("input", {
|
|
2862
|
+
value: E(O).searchInput.value,
|
|
2823
2863
|
type: "text",
|
|
2824
|
-
|
|
2864
|
+
disabled: q.value,
|
|
2865
|
+
class: "tpl:w-52 tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-3 tpl:pl-8 tpl:text-xs tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:outline-none tpl:focus:shadow-[var(--tpl-ring)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
2825
2866
|
style: {
|
|
2826
2867
|
"border-color": "var(--tpl-border)",
|
|
2827
2868
|
"background-color": "var(--tpl-bg)",
|
|
2828
2869
|
color: "var(--tpl-text)"
|
|
2829
2870
|
},
|
|
2830
|
-
placeholder:
|
|
2831
|
-
onInput:
|
|
2832
|
-
}, null, 40,
|
|
2871
|
+
placeholder: p.value.mediaLibrary.searchPlaceholder,
|
|
2872
|
+
onInput: i[0] ||= (e) => E(O).handleSearchInput(e.target.value)
|
|
2873
|
+
}, null, 40, Xr), u(E(ee), {
|
|
2833
2874
|
class: "tpl:absolute tpl:top-1/2 tpl:left-2.5 tpl:-translate-y-1/2",
|
|
2834
2875
|
size: 13,
|
|
2835
2876
|
"stroke-width": 2,
|
|
2836
2877
|
style: { color: "var(--tpl-text-dim)" }
|
|
2837
2878
|
})])])]),
|
|
2838
|
-
|
|
2879
|
+
c("div", Zr, [u(n, {
|
|
2839
2880
|
"enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
|
|
2840
2881
|
"enter-from-class": "tpl:-ml-48 tpl:opacity-0",
|
|
2841
2882
|
"enter-to-class": "tpl:ml-0 tpl:opacity-100",
|
|
@@ -2843,76 +2884,84 @@ var ii = {
|
|
|
2843
2884
|
"leave-from-class": "tpl:ml-0 tpl:opacity-100",
|
|
2844
2885
|
"leave-to-class": "tpl:-ml-48 tpl:opacity-0"
|
|
2845
2886
|
}, {
|
|
2846
|
-
default:
|
|
2847
|
-
folders:
|
|
2848
|
-
"current-folder-id":
|
|
2849
|
-
"view-mode":
|
|
2850
|
-
"has-frequently-used":
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2887
|
+
default: k(() => [j.value && E(O).showSidebar.value ? (v(), s("div", Qr, [u(bt, {
|
|
2888
|
+
folders: E(O).folderTree.value,
|
|
2889
|
+
"current-folder-id": E(D).currentFolderId.value,
|
|
2890
|
+
"view-mode": E(D).viewMode.value,
|
|
2891
|
+
"has-frequently-used": U.value && E(O).hasFrequentlyUsed.value,
|
|
2892
|
+
"can-create-folder": G.value,
|
|
2893
|
+
"can-rename-folder": K.value,
|
|
2894
|
+
"can-delete-folder": te.value,
|
|
2895
|
+
onNavigate: E(D).navigateToFolder,
|
|
2896
|
+
onCreateFolder: E(O).handleCreateFolder,
|
|
2897
|
+
onRenameFolder: E(O).handleRenameFolder,
|
|
2898
|
+
onDeleteFolder: E(O).handleDeleteFolder,
|
|
2899
|
+
onShowFrequentlyUsed: E(D).showFrequentlyUsed
|
|
2856
2900
|
}, null, 8, [
|
|
2857
2901
|
"folders",
|
|
2858
2902
|
"current-folder-id",
|
|
2859
2903
|
"view-mode",
|
|
2860
2904
|
"has-frequently-used",
|
|
2905
|
+
"can-create-folder",
|
|
2906
|
+
"can-rename-folder",
|
|
2907
|
+
"can-delete-folder",
|
|
2861
2908
|
"onNavigate",
|
|
2862
2909
|
"onCreateFolder",
|
|
2863
2910
|
"onRenameFolder",
|
|
2864
2911
|
"onDeleteFolder",
|
|
2865
2912
|
"onShowFrequentlyUsed"
|
|
2866
|
-
])])) :
|
|
2913
|
+
])])) : o("", !0)]),
|
|
2867
2914
|
_: 1
|
|
2868
|
-
}),
|
|
2869
|
-
|
|
2915
|
+
}), c("div", $r, [c("div", ei, [c("div", ti, [
|
|
2916
|
+
j.value ? (v(), s("button", {
|
|
2917
|
+
key: 0,
|
|
2918
|
+
"data-testid": "media-folder-toggle",
|
|
2870
2919
|
class: "tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:transition-all tpl:duration-150",
|
|
2871
|
-
style:
|
|
2872
|
-
color:
|
|
2873
|
-
backgroundColor:
|
|
2874
|
-
border:
|
|
2920
|
+
style: g({
|
|
2921
|
+
color: E(O).showSidebar.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2922
|
+
backgroundColor: E(O).showSidebar.value ? "var(--tpl-bg)" : "transparent",
|
|
2923
|
+
border: E(O).showSidebar.value ? "1px solid var(--tpl-border)" : "1px solid transparent"
|
|
2875
2924
|
}),
|
|
2876
|
-
title:
|
|
2877
|
-
onClick:
|
|
2878
|
-
}, [
|
|
2925
|
+
title: E(O).showSidebar.value ? p.value.mediaLibrary.hideFolders : p.value.mediaLibrary.showFolders,
|
|
2926
|
+
onClick: i[1] ||= (e) => E(O).showSidebar.value = !E(O).showSidebar.value
|
|
2927
|
+
}, [u(E(H), {
|
|
2879
2928
|
size: 16,
|
|
2880
2929
|
"stroke-width": 2
|
|
2881
|
-
})], 12,
|
|
2882
|
-
|
|
2883
|
-
key:
|
|
2884
|
-
folders:
|
|
2885
|
-
"current-folder-id":
|
|
2886
|
-
onNavigate:
|
|
2930
|
+
})], 12, ni)) : o("", !0),
|
|
2931
|
+
E(D).viewMode.value === "frequently-used" ? (v(), s("span", ri, C(p.value.mediaLibrary.frequentlyUsed), 1)) : (v(), a(be, {
|
|
2932
|
+
key: 2,
|
|
2933
|
+
folders: E(O).folderTree.value,
|
|
2934
|
+
"current-folder-id": E(D).currentFolderId.value,
|
|
2935
|
+
onNavigate: E(D).navigateToFolder
|
|
2887
2936
|
}, null, 8, [
|
|
2888
2937
|
"folders",
|
|
2889
2938
|
"current-folder-id",
|
|
2890
2939
|
"onNavigate"
|
|
2891
2940
|
])),
|
|
2892
|
-
|
|
2941
|
+
c("div", ii, [c("button", {
|
|
2893
2942
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2894
|
-
style:
|
|
2895
|
-
color:
|
|
2896
|
-
backgroundColor:
|
|
2943
|
+
style: g({
|
|
2944
|
+
color: E(O).layoutMode.value === "grid" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2945
|
+
backgroundColor: E(O).layoutMode.value === "grid" ? "var(--tpl-bg-elevated)" : "transparent"
|
|
2897
2946
|
}),
|
|
2898
|
-
title:
|
|
2899
|
-
onClick:
|
|
2900
|
-
}, [
|
|
2947
|
+
title: p.value.mediaLibrary.viewGrid,
|
|
2948
|
+
onClick: i[2] ||= (e) => E(O).layoutMode.value = "grid"
|
|
2949
|
+
}, [u(E(R), {
|
|
2901
2950
|
size: 14,
|
|
2902
2951
|
"stroke-width": 2
|
|
2903
|
-
})], 12,
|
|
2952
|
+
})], 12, ai), c("button", {
|
|
2904
2953
|
class: "tpl:flex tpl:size-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded tpl:transition-all tpl:duration-150",
|
|
2905
|
-
style:
|
|
2906
|
-
color:
|
|
2907
|
-
backgroundColor:
|
|
2954
|
+
style: g({
|
|
2955
|
+
color: E(O).layoutMode.value === "list" ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
|
|
2956
|
+
backgroundColor: E(O).layoutMode.value === "list" ? "var(--tpl-bg-elevated)" : "transparent"
|
|
2908
2957
|
}),
|
|
2909
|
-
title:
|
|
2910
|
-
onClick:
|
|
2911
|
-
}, [
|
|
2958
|
+
title: p.value.mediaLibrary.viewList,
|
|
2959
|
+
onClick: i[3] ||= (e) => E(O).layoutMode.value = "list"
|
|
2960
|
+
}, [u(E(B), {
|
|
2912
2961
|
size: 14,
|
|
2913
2962
|
"stroke-width": 2
|
|
2914
|
-
})], 12,
|
|
2915
|
-
]),
|
|
2963
|
+
})], 12, oi)])
|
|
2964
|
+
]), c("div", si, [E(T).length > 1 ? (v(), s("select", {
|
|
2916
2965
|
key: 0,
|
|
2917
2966
|
class: "tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-7 tpl:pl-2.5 tpl:text-xs tpl:transition-all tpl:duration-150 tpl:outline-none",
|
|
2918
2967
|
style: {
|
|
@@ -2920,99 +2969,95 @@ var ii = {
|
|
|
2920
2969
|
"background-color": "var(--tpl-bg)",
|
|
2921
2970
|
color: "var(--tpl-text)"
|
|
2922
2971
|
},
|
|
2923
|
-
value:
|
|
2924
|
-
onChange:
|
|
2925
|
-
}, [
|
|
2972
|
+
value: E(D).categoryFilter.value ?? "",
|
|
2973
|
+
onChange: Y
|
|
2974
|
+
}, [c("option", li, C(p.value.mediaLibrary.filterAll), 1), (v(!0), s(e, null, x(E(T), (e) => (v(), s("option", {
|
|
2926
2975
|
key: e,
|
|
2927
2976
|
value: e
|
|
2928
|
-
},
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
color: "var(--tpl-text)"
|
|
2934
|
-
},
|
|
2935
|
-
value: k(v).sortOption.value,
|
|
2936
|
-
onChange: n[5] ||= (e) => k(v).sortBy(e.target.value)
|
|
2937
|
-
}, [
|
|
2938
|
-
f("option", Ti, D(a.value.mediaLibrary.sortNewest), 1),
|
|
2939
|
-
f("option", Ei, D(a.value.mediaLibrary.sortOldest), 1),
|
|
2940
|
-
f("option", Di, D(a.value.mediaLibrary.sortNameAsc), 1),
|
|
2941
|
-
f("option", Oi, D(a.value.mediaLibrary.sortNameDesc), 1),
|
|
2942
|
-
f("option", ki, D(a.value.mediaLibrary.sortSizeAsc), 1),
|
|
2943
|
-
f("option", Ai, D(a.value.mediaLibrary.sortSizeDesc), 1)
|
|
2944
|
-
], 40, wi)])]), f("div", ji, [k(v).viewMode.value === "files" ? (S(), d("div", Mi, [m(Zn, {
|
|
2945
|
-
"is-uploading": k(v).isUploading.value,
|
|
2946
|
-
"upload-progress": k(v).uploadProgress.value,
|
|
2947
|
-
onUpload: k(E).handleUpload
|
|
2977
|
+
}, C(E(O).getCategoryLabel(e)), 9, ui))), 128))], 40, ci)) : o("", !0)])]), c("div", di, [E(D).viewMode.value === "files" && (A.value || P.value) ? (v(), s("div", fi, [A.value ? (v(), a(Wn, {
|
|
2978
|
+
key: 0,
|
|
2979
|
+
"is-uploading": E(D).isUploading.value,
|
|
2980
|
+
"upload-progress": E(D).uploadProgress.value,
|
|
2981
|
+
onUpload: E(O).handleUpload
|
|
2948
2982
|
}, null, 8, [
|
|
2949
2983
|
"is-uploading",
|
|
2950
2984
|
"upload-progress",
|
|
2951
2985
|
"onUpload"
|
|
2952
|
-
]),
|
|
2986
|
+
])) : o("", !0), P.value ? (v(), s("button", {
|
|
2987
|
+
key: 1,
|
|
2988
|
+
"data-testid": "media-import-url",
|
|
2953
2989
|
class: "tpl:mt-2 tpl:flex tpl:w-full tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
2954
2990
|
style: {
|
|
2955
2991
|
"border-color": "var(--tpl-border)",
|
|
2956
2992
|
color: "var(--tpl-text-muted)",
|
|
2957
2993
|
"background-color": "var(--tpl-bg)"
|
|
2958
2994
|
},
|
|
2959
|
-
onClick:
|
|
2960
|
-
}, [
|
|
2995
|
+
onClick: i[4] ||= (e) => E(O).showImportUrlModal.value = !0
|
|
2996
|
+
}, [u(E(z), {
|
|
2961
2997
|
size: 14,
|
|
2962
2998
|
"stroke-width": 2
|
|
2963
|
-
}),
|
|
2964
|
-
items:
|
|
2965
|
-
"selected-ids":
|
|
2966
|
-
"is-loading":
|
|
2967
|
-
"has-more":
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2999
|
+
}), l(" " + C(p.value.mediaLibrary.importFromUrl), 1)])) : o("", !0)])) : o("", !0), u($t, {
|
|
3000
|
+
items: E(O).displayItems.value,
|
|
3001
|
+
"selected-ids": E(D).selectedItems.value,
|
|
3002
|
+
"is-loading": E(D).isLoading.value,
|
|
3003
|
+
"has-more": E(D).viewMode.value === "files" && E(D).hasMore.value,
|
|
3004
|
+
accept: t.accept,
|
|
3005
|
+
layout: E(O).layoutMode.value,
|
|
3006
|
+
"search-query": E(D).searchQuery.value,
|
|
3007
|
+
"can-update": L.value,
|
|
3008
|
+
"can-replace": V.value,
|
|
3009
|
+
onSelect: E(O).handleSelect,
|
|
3010
|
+
onToggle: E(D).toggleSelection,
|
|
3011
|
+
onLoadMore: E(D).loadMore,
|
|
3012
|
+
onEdit: E(O).handleEditItem,
|
|
3013
|
+
onReplace: E(O).handleReplaceItem,
|
|
3014
|
+
onConfirm: J
|
|
2974
3015
|
}, null, 8, [
|
|
2975
3016
|
"items",
|
|
2976
3017
|
"selected-ids",
|
|
2977
3018
|
"is-loading",
|
|
2978
3019
|
"has-more",
|
|
3020
|
+
"accept",
|
|
2979
3021
|
"layout",
|
|
3022
|
+
"search-query",
|
|
3023
|
+
"can-update",
|
|
3024
|
+
"can-replace",
|
|
2980
3025
|
"onSelect",
|
|
2981
3026
|
"onToggle",
|
|
2982
3027
|
"onLoadMore",
|
|
2983
3028
|
"onEdit",
|
|
2984
3029
|
"onReplace"
|
|
2985
3030
|
])])])]),
|
|
2986
|
-
|
|
2987
|
-
visible:
|
|
2988
|
-
"is-importing":
|
|
2989
|
-
error:
|
|
2990
|
-
onImport:
|
|
2991
|
-
onClose:
|
|
3031
|
+
u(fn, {
|
|
3032
|
+
visible: E(O).showImportUrlModal.value,
|
|
3033
|
+
"is-importing": E(D).isImportingFromUrl.value,
|
|
3034
|
+
error: E(D).importFromUrlError.value,
|
|
3035
|
+
onImport: E(O).handleImportFromUrl,
|
|
3036
|
+
onClose: i[5] ||= (e) => E(O).showImportUrlModal.value = !1
|
|
2992
3037
|
}, null, 8, [
|
|
2993
3038
|
"visible",
|
|
2994
3039
|
"is-importing",
|
|
2995
3040
|
"error",
|
|
2996
3041
|
"onImport"
|
|
2997
3042
|
]),
|
|
2998
|
-
|
|
2999
|
-
visible: !!
|
|
3000
|
-
item:
|
|
3001
|
-
onSave:
|
|
3002
|
-
onClose:
|
|
3043
|
+
u(ct, {
|
|
3044
|
+
visible: !!E(O).editingItem.value,
|
|
3045
|
+
item: E(O).editingItem.value,
|
|
3046
|
+
onSave: E(O).handleEditSave,
|
|
3047
|
+
onClose: i[6] ||= (e) => E(O).editingItem.value = null
|
|
3003
3048
|
}, null, 8, [
|
|
3004
3049
|
"visible",
|
|
3005
3050
|
"item",
|
|
3006
3051
|
"onSave"
|
|
3007
3052
|
]),
|
|
3008
|
-
|
|
3009
|
-
visible:
|
|
3010
|
-
item:
|
|
3011
|
-
"usage-info":
|
|
3012
|
-
"is-replacing":
|
|
3013
|
-
error:
|
|
3014
|
-
onReplace:
|
|
3015
|
-
onClose:
|
|
3053
|
+
u(zn, {
|
|
3054
|
+
visible: E(D).showReplaceWarning.value,
|
|
3055
|
+
item: E(D).pendingReplaceItem.value,
|
|
3056
|
+
"usage-info": E(D).replaceUsageInfo.value,
|
|
3057
|
+
"is-replacing": E(D).isReplacing.value,
|
|
3058
|
+
error: E(D).replaceError.value,
|
|
3059
|
+
onReplace: E(O).handleReplaceFile,
|
|
3060
|
+
onClose: E(D).cancelReplace
|
|
3016
3061
|
}, null, 8, [
|
|
3017
3062
|
"visible",
|
|
3018
3063
|
"item",
|
|
@@ -3022,7 +3067,7 @@ var ii = {
|
|
|
3022
3067
|
"onReplace",
|
|
3023
3068
|
"onClose"
|
|
3024
3069
|
]),
|
|
3025
|
-
|
|
3070
|
+
u(n, {
|
|
3026
3071
|
"enter-active-class": "tpl:transition tpl:ease-out tpl:duration-150",
|
|
3027
3072
|
"enter-from-class": "tpl:opacity-0",
|
|
3028
3073
|
"enter-to-class": "tpl:opacity-100",
|
|
@@ -3030,154 +3075,147 @@ var ii = {
|
|
|
3030
3075
|
"leave-from-class": "tpl:opacity-100",
|
|
3031
3076
|
"leave-to-class": "tpl:opacity-0"
|
|
3032
3077
|
}, {
|
|
3033
|
-
default:
|
|
3078
|
+
default: k(() => [E(D).showDeleteWarning.value ? (v(), s("div", {
|
|
3034
3079
|
key: 0,
|
|
3035
3080
|
class: "tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-lg)]",
|
|
3036
3081
|
style: {
|
|
3037
|
-
"background-color": "
|
|
3082
|
+
"background-color": "var(--tpl-overlay)",
|
|
3038
3083
|
"backdrop-filter": "blur(8px)",
|
|
3039
3084
|
"-webkit-backdrop-filter": "blur(8px)"
|
|
3040
3085
|
},
|
|
3041
|
-
onClick:
|
|
3042
|
-
}, [
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
class:
|
|
3086
|
+
onClick: i[9] ||= M((...e) => E(D).cancelDelete && E(D).cancelDelete(...e), ["self"])
|
|
3087
|
+
}, [c("div", pi, [
|
|
3088
|
+
c("h3", mi, C(p.value.mediaLibrary.deleteWarningTitle), 1),
|
|
3089
|
+
c("p", {
|
|
3090
|
+
class: h(["tpl:text-xs", E(O).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
|
|
3046
3091
|
style: { color: "var(--tpl-text-muted)" }
|
|
3047
|
-
},
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
key:
|
|
3092
|
+
}, C(p.value.mediaLibrary.deleteWarningMessage), 3),
|
|
3093
|
+
E(O).hasUsedFiles.value ? (v(), s("p", hi, C(p.value.mediaLibrary.deleteWarningUsageNote), 1)) : o("", !0),
|
|
3094
|
+
E(O).hasUsedFiles.value ? (v(), s("div", gi, [(v(!0), s(e, null, x(E(D).deleteUsageInfo.value, (t, n) => (v(), s("div", {
|
|
3095
|
+
key: n,
|
|
3051
3096
|
class: "tpl:text-xs",
|
|
3052
3097
|
style: { color: "var(--tpl-text)" }
|
|
3053
|
-
}, [
|
|
3054
|
-
|
|
3098
|
+
}, [t.templateCount > 0 ? (v(), s(e, { key: 0 }, [c("span", _i, C(E(O).displayItems.value.find((e) => e.id === n)?.filename || n), 1), c("span", vi, " - " + C(p.value.mediaLibrary.usedInTemplates.replace("{count}", t.templateCount.toString())), 1)], 64)) : o("", !0)]))), 128))])) : o("", !0),
|
|
3099
|
+
c("div", yi, [c("button", {
|
|
3055
3100
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
3056
3101
|
style: {
|
|
3057
3102
|
"border-color": "var(--tpl-border)",
|
|
3058
3103
|
color: "var(--tpl-text)",
|
|
3059
3104
|
"background-color": "var(--tpl-bg)"
|
|
3060
3105
|
},
|
|
3061
|
-
onClick:
|
|
3062
|
-
},
|
|
3106
|
+
onClick: i[7] ||= (...e) => E(D).cancelDelete && E(D).cancelDelete(...e)
|
|
3107
|
+
}, C(p.value.mediaLibrary.cancel), 1), c("button", {
|
|
3063
3108
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
3064
3109
|
style: {
|
|
3065
3110
|
"border-color": "var(--tpl-danger)",
|
|
3066
3111
|
color: "var(--tpl-danger)",
|
|
3067
3112
|
"background-color": "var(--tpl-danger-light)"
|
|
3068
3113
|
},
|
|
3069
|
-
onClick:
|
|
3070
|
-
},
|
|
3071
|
-
])])) :
|
|
3114
|
+
onClick: i[8] ||= (...e) => E(D).confirmDelete && E(D).confirmDelete(...e)
|
|
3115
|
+
}, C(E(O).hasUsedFiles.value ? p.value.mediaLibrary.deleteAnyway : p.value.mediaLibrary.confirmDelete), 1)])
|
|
3116
|
+
])])) : o("", !0)]),
|
|
3072
3117
|
_: 1
|
|
3073
3118
|
}),
|
|
3074
|
-
|
|
3119
|
+
c("div", bi, [c("div", xi, [E(D).previewItem.value ? (v(), a(wn, {
|
|
3075
3120
|
key: 0,
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
folders: k(v).folders.value
|
|
3080
|
-
}, null, 8, [
|
|
3081
|
-
"selected-conversion",
|
|
3082
|
-
"item",
|
|
3083
|
-
"folders"
|
|
3084
|
-
])) : u("", !0)]), f("div", Hi, [k(v).selectedItems.value.size > 0 ? (S(), d("div", Ui, [k(v).previewItem.value ? (S(), d("button", {
|
|
3121
|
+
item: E(D).previewItem.value,
|
|
3122
|
+
folders: E(O).folderTree.value
|
|
3123
|
+
}, null, 8, ["item", "folders"])) : o("", !0)]), c("div", Si, [E(D).selectedItems.value.size > 0 ? (v(), s("div", Ci, [E(D).previewItem.value ? (v(), s("button", {
|
|
3085
3124
|
key: 0,
|
|
3086
3125
|
class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-1 tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
3087
|
-
style:
|
|
3088
|
-
borderColor:
|
|
3089
|
-
color:
|
|
3126
|
+
style: g({
|
|
3127
|
+
borderColor: E(O).copied.value ? "var(--tpl-success)" : "var(--tpl-border)",
|
|
3128
|
+
color: E(O).copied.value ? "var(--tpl-success)" : "var(--tpl-text)",
|
|
3090
3129
|
backgroundColor: "var(--tpl-bg)"
|
|
3091
3130
|
}),
|
|
3092
|
-
onClick:
|
|
3093
|
-
}, [
|
|
3131
|
+
onClick: i[10] ||= (e) => E(O).copy(E(O).selectedUrl.value)
|
|
3132
|
+
}, [E(O).copied.value ? (v(), a(E(N), {
|
|
3094
3133
|
key: 1,
|
|
3095
3134
|
size: 12,
|
|
3096
3135
|
"stroke-width": 2
|
|
3097
|
-
})) : (
|
|
3136
|
+
})) : (v(), a(E(F), {
|
|
3098
3137
|
key: 0,
|
|
3099
3138
|
size: 12,
|
|
3100
3139
|
"stroke-width": 2
|
|
3101
|
-
})),
|
|
3140
|
+
})), l(" " + C(E(O).copied.value ? p.value.mediaLibrary.copied : p.value.mediaLibrary.copyUrl), 1)], 4)) : o("", !0), W.value ? (v(), s("div", wi, [c("button", {
|
|
3102
3141
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
3103
3142
|
style: {
|
|
3104
3143
|
"border-color": "var(--tpl-border)",
|
|
3105
3144
|
color: "var(--tpl-text)",
|
|
3106
3145
|
"background-color": "var(--tpl-bg)"
|
|
3107
3146
|
},
|
|
3108
|
-
onClick:
|
|
3109
|
-
},
|
|
3147
|
+
onClick: i[11] ||= (e) => E(O).showMovePicker.value = !E(O).showMovePicker.value
|
|
3148
|
+
}, C(p.value.mediaLibrary.moveSelected), 1), E(O).showMovePicker.value ? (v(), a(_n, {
|
|
3110
3149
|
key: 0,
|
|
3111
|
-
folders:
|
|
3112
|
-
"current-folder-id":
|
|
3113
|
-
onSelect:
|
|
3114
|
-
onClose:
|
|
3150
|
+
folders: E(O).folderTree.value,
|
|
3151
|
+
"current-folder-id": E(D).currentFolderId.value,
|
|
3152
|
+
onSelect: E(O).handleMoveToFolder,
|
|
3153
|
+
onClose: i[12] ||= (e) => E(O).showMovePicker.value = !1
|
|
3115
3154
|
}, null, 8, [
|
|
3116
3155
|
"folders",
|
|
3117
3156
|
"current-folder-id",
|
|
3118
3157
|
"onSelect"
|
|
3119
|
-
])) :
|
|
3158
|
+
])) : o("", !0)])) : o("", !0)])) : o("", !0), c("div", Ti, [re.value > 0 ? (v(), s("button", {
|
|
3120
3159
|
key: 0,
|
|
3160
|
+
"data-testid": "media-delete",
|
|
3121
3161
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
|
|
3122
3162
|
style: {
|
|
3123
3163
|
"border-color": "var(--tpl-danger)",
|
|
3124
3164
|
color: "var(--tpl-danger)",
|
|
3125
3165
|
"background-color": "var(--tpl-danger-light)"
|
|
3126
3166
|
},
|
|
3127
|
-
onClick:
|
|
3128
|
-
},
|
|
3167
|
+
onClick: ie
|
|
3168
|
+
}, C(p.value.mediaLibrary.deleteSelected), 1)) : o("", !0), t.onSelect ? (v(), s("button", {
|
|
3129
3169
|
key: 1,
|
|
3170
|
+
"data-testid": "media-select",
|
|
3130
3171
|
class: "tpl:cursor-pointer tpl:rounded-md tpl:px-4 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50",
|
|
3131
3172
|
style: {
|
|
3132
3173
|
"background-color": "var(--tpl-primary)",
|
|
3133
3174
|
color: "var(--tpl-bg)"
|
|
3134
3175
|
},
|
|
3135
|
-
disabled: !
|
|
3136
|
-
onClick:
|
|
3137
|
-
},
|
|
3176
|
+
disabled: !ne.value,
|
|
3177
|
+
onClick: J
|
|
3178
|
+
}, C(t.accept?.length ? p.value.mediaLibrary.selectImage : p.value.mediaLibrary.selectFile), 9, Ei)) : o("", !0)])])])
|
|
3138
3179
|
]));
|
|
3139
3180
|
}
|
|
3140
|
-
}),
|
|
3141
|
-
async function
|
|
3142
|
-
let
|
|
3143
|
-
if (!
|
|
3144
|
-
let
|
|
3145
|
-
|
|
3146
|
-
let a = await new t(i).fetchConfig(), o = await dr(e.locale ?? "en");
|
|
3147
|
-
return Zi(n, e.theme), $ && Xi(), new Promise((t, r) => {
|
|
3181
|
+
}), Oi = null, ki = b(null);
|
|
3182
|
+
async function Ai(e) {
|
|
3183
|
+
let t = typeof e.container == "string" ? document.querySelector(e.container) : e.container;
|
|
3184
|
+
if (!t) throw Error(`Container element not found: ${e.container}`);
|
|
3185
|
+
let n = await ar(e.locale ?? "en");
|
|
3186
|
+
return Mi(t, e.theme), Oi && ji(), new Promise((r, a) => {
|
|
3148
3187
|
try {
|
|
3149
|
-
|
|
3150
|
-
let
|
|
3151
|
-
|
|
3152
|
-
setTheme: (e) =>
|
|
3153
|
-
unmount:
|
|
3188
|
+
Oi = i({ setup() {
|
|
3189
|
+
let i = () => {
|
|
3190
|
+
r({
|
|
3191
|
+
setTheme: (e) => Mi(t, e),
|
|
3192
|
+
unmount: ji
|
|
3154
3193
|
});
|
|
3155
3194
|
};
|
|
3156
|
-
return () =>
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
planConfig: a,
|
|
3160
|
-
translations: o,
|
|
3195
|
+
return () => f(Di, {
|
|
3196
|
+
provider: e.provider,
|
|
3197
|
+
translations: n,
|
|
3161
3198
|
onSelect: e.onSelect,
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3199
|
+
accept: e.accept,
|
|
3200
|
+
locale: e.locale,
|
|
3201
|
+
ref: ki,
|
|
3202
|
+
onReady: i
|
|
3165
3203
|
});
|
|
3166
|
-
} }),
|
|
3204
|
+
} }), Oi.mount(t);
|
|
3167
3205
|
} catch (e) {
|
|
3168
|
-
|
|
3206
|
+
a(e);
|
|
3169
3207
|
}
|
|
3170
3208
|
});
|
|
3171
3209
|
}
|
|
3172
|
-
function
|
|
3173
|
-
|
|
3210
|
+
function ji() {
|
|
3211
|
+
Oi && (Oi.unmount(), Oi = null, ki.value = null);
|
|
3174
3212
|
}
|
|
3175
|
-
function
|
|
3213
|
+
function Mi(e, t) {
|
|
3176
3214
|
t && (t.primaryColor && e.style.setProperty("--tpl-primary", t.primaryColor), t.borderRadius !== void 0 && (e.style.setProperty("--tpl-radius", `${t.borderRadius}px`), e.style.setProperty("--tpl-radius-sm", `${Math.max(0, t.borderRadius - 3)}px`), e.style.setProperty("--tpl-radius-lg", `${t.borderRadius + 4}px`)));
|
|
3177
3215
|
}
|
|
3178
3216
|
typeof window < "u" && (window.TemplaticalMedia = {
|
|
3179
|
-
init:
|
|
3180
|
-
unmount:
|
|
3217
|
+
init: Ai,
|
|
3218
|
+
unmount: ji
|
|
3181
3219
|
});
|
|
3182
3220
|
//#endregion
|
|
3183
|
-
export {
|
|
3221
|
+
export { Ur as MediaLibraryModal, Ai as init, ji as unmount, Q as useI18n, $ as useMediaCategories, ue as useMediaLibrary, Wr as useMediaPicker };
|