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