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